You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by am...@apache.org on 2017/08/08 12:47:58 UTC
[01/12] incubator-unomi git commit: Rename bundle and add description
Repository: incubator-unomi
Updated Branches:
refs/heads/master a4ecc1ee1 -> 8806c8f92
Rename bundle and add description
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/d620b667
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/d620b667
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/d620b667
Branch: refs/heads/master
Commit: d620b6675a5e34dcbd3d0e32e03e5e48b2d9426a
Parents: 25857fa
Author: dinesh1996 <Dragonball21>
Authored: Wed Aug 2 15:47:47 2017 +0200
Committer: dinesh1996 <Dragonball21>
Committed: Thu Aug 3 14:27:18 2017 +0200
----------------------------------------------------------------------
.../core/src/main/resources/OSGI-INF/blueprint/blueprint.xml | 2 +-
.../core/src/main/resources/messages_en.properties | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d620b667/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 8eb45b4..0339ce8 100755
--- a/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -33,7 +33,7 @@
<!-- Action executor -->
<service auto-export="interfaces">
<service-properties>
- <entry key="actionExecutorId" value="WeatherUpdate"/>
+ <entry key="actionExecutorId" value="weatherUpdate"/>
</service-properties>
<bean class="org.apache.unomi.weatherupdate.actions.WeatherUpdateAction">
<property name="weatherApiKey" value="${weatherUpdate.apiKey}"/>
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d620b667/extensions/weather-update/core/src/main/resources/messages_en.properties
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/messages_en.properties b/extensions/weather-update/core/src/main/resources/messages_en.properties
index 98b9bc4..3f2dbac 100755
--- a/extensions/weather-update/core/src/main/resources/messages_en.properties
+++ b/extensions/weather-update/core/src/main/resources/messages_en.properties
@@ -14,5 +14,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-action.WeatherUpdateAction.description=This action will retrieve the weather associated with the resolved location of the user (from his IP address)
-action.WeatherUpdateAction.name=Update session with local weather information
+action.weatherUpdateAction.name=Update session with local weather information
+action.weatherUpdateAction.description=This action will retrieve the weather associated with the resolved location of the user (from his IP address)
[07/12] incubator-unomi git commit: Properties description changed
Posted by am...@apache.org.
Properties description changed
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/25857fa1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/25857fa1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/25857fa1
Branch: refs/heads/master
Commit: 25857fa19914fd09fb6435e40d0ccba626821856
Parents: fd67c2f
Author: dinesh1996 <Dragonball21>
Authored: Tue Aug 1 12:05:02 2017 +0200
Committer: dinesh1996 <Dragonball21>
Committed: Thu Aug 3 14:27:18 2017 +0200
----------------------------------------------------------------------
.../core/src/main/resources/OSGI-INF/blueprint/blueprint.xml | 2 +-
.../core/src/main/resources/messages_en.properties | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/25857fa1/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index 0339ce8..8eb45b4 100755
--- a/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -33,7 +33,7 @@
<!-- Action executor -->
<service auto-export="interfaces">
<service-properties>
- <entry key="actionExecutorId" value="weatherUpdate"/>
+ <entry key="actionExecutorId" value="WeatherUpdate"/>
</service-properties>
<bean class="org.apache.unomi.weatherupdate.actions.WeatherUpdateAction">
<property name="weatherApiKey" value="${weatherUpdate.apiKey}"/>
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/25857fa1/extensions/weather-update/core/src/main/resources/messages_en.properties
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/messages_en.properties b/extensions/weather-update/core/src/main/resources/messages_en.properties
index ef653d6..98b9bc4 100755
--- a/extensions/weather-update/core/src/main/resources/messages_en.properties
+++ b/extensions/weather-update/core/src/main/resources/messages_en.properties
@@ -14,5 +14,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-action.incrementTweetNumberAction.description=This action will retrieve the weather associated with the resolved location of the user (from his IP address)
-action.incrementTweetNumberAction.name=Update session with local weather information
\ No newline at end of file
+action.WeatherUpdateAction.description=This action will retrieve the weather associated with the resolved location of the user (from his IP address)
+action.WeatherUpdateAction.name=Update session with local weather information
[05/12] incubator-unomi git commit: Add Java Doc and update the
README.
Posted by am...@apache.org.
Add Java Doc and update the README.
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/acfe90d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/acfe90d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/acfe90d9
Branch: refs/heads/master
Commit: acfe90d96db14a4a0b65ae892b6ebb8c480acec3
Parents: 774e801
Author: dinesh1996 <Dragonball21>
Authored: Wed Jul 26 15:56:49 2017 +0200
Committer: dinesh1996 <Dragonball21>
Committed: Thu Aug 3 14:27:18 2017 +0200
----------------------------------------------------------------------
extensions/weather-update/README.md | 21 ++--
.../actions/WeatherUpdateAction.java | 106 ++++++++++---------
.../org.apache.unomi.weatherUpdate.cfg | 2 +-
3 files changed, 72 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/acfe90d9/extensions/weather-update/README.md
----------------------------------------------------------------------
diff --git a/extensions/weather-update/README.md b/extensions/weather-update/README.md
index 0763929..dcc486f 100644
--- a/extensions/weather-update/README.md
+++ b/extensions/weather-update/README.md
@@ -16,15 +16,20 @@
-->
-# UnomiWeatherUpdate
-A simple plugin to send Unomi events when a member is logged
+Apache Unomi Unomi Weather Update
+=================================
+This sample plugin will retrieve the weather associated with the resolved location of the user (from his IP address)
-In the etc/org.apache.unomi.weatherupdate.cfg file change the following settings:
+## Getting started
- weatherUpdate.apiKey=YOUR_WEATHER_APIKEY
-
-
- <configfile finalname="/etc/org.apache.unomi.weatherupdate.cfg">mvn:org.apache.unomi
- .samples/weather-update-karaf-kar/${project.version}/cfg/weatherupdatecfg</configfile>
+1. Configure the Apache Unomi Weather Update. In the etc/org.apache.unomi.weatherUpdate.cfg file
+change the following settings:
+ weatherUpdate.apiKey=YOUR_WEATHER_APIKEY
+
+
+2. Deploy into Apache Unomi using the following commands from the Apache Karaf shell:
+
+ feature:repo-add mvn:org.apache.unomi/unomi-weather-update-karaf-kar/1.2.0-incubating-SNAPSHOT/xml/features
+ feature:install unomi-weather-update-karaf-kar
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/acfe90d9/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
index e37895e..c3a345e 100644
--- a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
+++ b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
@@ -57,15 +57,12 @@ public class WeatherUpdateAction implements ActionExecutor {
}
Session session = event.getSession();
-
if (!(weatherApiKey == null || weatherUrlBase == null || weatherUrlAttributes == null)) {
Map<String, Object> sessionProperties = session.getProperties();
if (sessionProperties.containsKey("location")) {
Map<String, Double> location = (Map<String, Double>) session.getProperty("location");
- HttpGet httpGet = new HttpGet(weatherUrlBase + "/" + weatherUrlAttributes + "?lat=" +
- location.get("lat") + "&lon=" + location.get("lon") + "&appid=" + weatherApiKey
- );
-
+ HttpGet httpGet = new HttpGet(weatherUrlBase + "/" + weatherUrlAttributes +
+ "?lat=" + location.get("lat") + "&lon=" + location.get("lon") + "&appid=" + weatherApiKey);
JsonNode jsonNode = null;
CloseableHttpResponse response = null;
try {
@@ -114,9 +111,16 @@ public class WeatherUpdateAction implements ActionExecutor {
}
}
}
+ logger.info("No update made.");
return EventService.NO_CHANGE;
}
+ /**
+ * Extract the temperature property from the response
+ *
+ * @param jsonNode
+ * @return String temperature in celsius
+ */
private String extractTemperature(JsonNode jsonNode) {
float temperature;
if (jsonNode.has("main") && jsonNode.get("main").has("temp")) {
@@ -134,6 +138,12 @@ public class WeatherUpdateAction implements ActionExecutor {
return null;
}
+ /**
+ * Extract the wind speed property from the response
+ *
+ * @param jsonNode
+ * @return String wind speed in km/h
+ */
private String extractWindSpeed(JsonNode jsonNode) {
JsonNode WindInfoSpeed;
if (jsonNode.has("wind") && jsonNode.get("wind").has("speed")) {
@@ -149,56 +159,50 @@ public class WeatherUpdateAction implements ActionExecutor {
}
+ /**
+ * Extract the wind direction property from the response
+ *
+ * @param jsonNode
+ * @return String wind direction in cardinal points format
+ */
private String extractWindDirection(JsonNode jsonNode) {
- JsonNode WindInfoDirection;
+ JsonNode windInfoDirection;
+ String direction = "";
if (jsonNode.has("wind")) {
- WindInfoDirection = jsonNode.get("wind").get("deg");
- String direction = "";
- float deg = Float.parseFloat(WindInfoDirection.toString());
- if (11.25 < deg && deg < 348.75) {
- direction = ("N");
- } else if (11.25 < deg && deg < 33.75) {
- direction = ("NNE");
- } else if (33.75 < deg && deg < 56.25) {
- direction = ("NE");
- } else if (56.25 < deg && deg < 78.75) {
- direction = ("ENE");
- } else if (78.75 < deg && deg < 101.25) {
- direction = ("E");
- } else if (101.25 < deg && deg < 123.75) {
- direction = ("ESE");
- } else if (123.75 < deg && deg < 146.25) {
- direction = ("SE");
- } else if (146.25 < deg && deg < 168.75) {
- direction = ("SSE");
- } else if (168.75 < deg && deg < 191.25) {
- direction = ("S");
- } else if (191.25 < deg && deg < 213.75) {
- direction = ("SSW");
- } else if (213.75 < deg && deg < 236.25) {
- direction = ("SW");
- } else if (236.25 < deg && deg < 258.75) {
- direction = ("WSW");
- } else if (258.75 < deg && deg < 281.25) {
- direction = ("W");
- } else if (281.25 < deg && deg < 303.75) {
- direction = ("WNW");
- } else if (303.75 < deg && deg < 326.25) {
- direction = ("NW");
- } else if (326.25 < deg && deg < 348.75) {
- direction = ("NNW");
+ windInfoDirection = jsonNode.get("wind").get("deg");
+ if (windInfoDirection != null) {
+
+ float deg = Float.parseFloat(windInfoDirection.toString());
+ if (340 < deg && deg < 360 || 0 < deg && deg < 20) {
+ direction = ("N");
+ } else if (20 < deg && deg < 70) {
+ direction = ("NE");
+ } else if (70 < deg && deg < 110) {
+ direction = ("E");
+ } else if (110 < deg && deg < 160) {
+ direction = ("SE");
+ } else if (160 < deg && deg < 200) {
+ direction = ("S");
+ } else if (200 < deg && deg < 245) {
+ direction = ("SW");
+ } else if (245 < deg && deg < 290) {
+ direction = ("W");
+ } else if (290 < deg && deg < 340) {
+ direction = ("NW");
+ }
+ logger.debug("Wind direction: " + direction);
+ return direction;
}
- logger.debug("Wind direction: " + direction);
- return direction;
}
logger.info("API Response doesn't contains the wind direction");
return null;
}
/**
+ * Extract the weather like property from the response
*
* @param jsonNode
- * @return
+ * @return String weather like
*/
private String extractWeatherLike(JsonNode jsonNode) {
JsonNode weatherLike;
@@ -215,10 +219,9 @@ public class WeatherUpdateAction implements ActionExecutor {
}
/**
- *
- * @param session
- * @param property
- * @param value
+ * @param session the current session
+ * @param property session property to fill
+ * @param value of property
*/
private void fillPropreties(Session session, String property, String value) {
session.setProperty(property, value);
@@ -227,6 +230,9 @@ public class WeatherUpdateAction implements ActionExecutor {
//Setters
/**
+ * +
+ * Set the weatherApiKey
+ *
* @param weatherApiKey
*/
public void setWeatherApiKey(String weatherApiKey) {
@@ -234,6 +240,8 @@ public class WeatherUpdateAction implements ActionExecutor {
}
/**
+ * Set the weatherUrlBase
+ *
* @param weatherUrlBase
*/
public void setWeatherUrlBase(String weatherUrlBase) {
@@ -241,6 +249,8 @@ public class WeatherUpdateAction implements ActionExecutor {
}
/**
+ * Set the weatherUrlAttributes
+ *
* @param weatherUrlAttributes
*/
public void setWeatherUrlAttributes(String weatherUrlAttributes) {
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/acfe90d9/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg b/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
index 475b631..6b8afd1 100644
--- a/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
+++ b/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
@@ -15,6 +15,6 @@
# limitations under the License.
#
-weatherUpdate.apiKey=3e66ec6001684dad10724dbddaf547e6
+weatherUpdate.apiKey=
weatherUpdate.url.base=http://api.openweathermap.org
weatherUpdate.url.attributes=data/2.5/weather
[02/12] incubator-unomi git commit: Cluster name changed
Posted by am...@apache.org.
Cluster name changed
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/fd67c2f9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/fd67c2f9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/fd67c2f9
Branch: refs/heads/master
Commit: fd67c2f988b403ac81d2edfe930f18ca921e327b
Parents: cdcaeba
Author: dinesh1996 <Dragonball21>
Authored: Thu Jul 27 17:19:00 2017 +0200
Committer: dinesh1996 <Dragonball21>
Committed: Thu Aug 3 14:27:18 2017 +0200
----------------------------------------------------------------------
.../main/resources/org.apache.unomi.persistence.elasticsearch.cfg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/fd67c2f9/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
index 57127fd..5b07a1f 100644
--- a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
+++ b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
@@ -15,7 +15,7 @@
# limitations under the License.
#
-cluster.name=dineshElasticSearch
+cluster.name=contextElasticSearch
# The elasticSearchAddresses may be a comma seperated list of host names and ports such as
# hostA:9300,hostB:9300
# Note: the port number must be repeated for each host.
[12/12] incubator-unomi git commit: Merge commit
'c94efbebab3172bd18b829dbeed132679d54bb4f'
Posted by am...@apache.org.
Merge commit 'c94efbebab3172bd18b829dbeed132679d54bb4f'
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/8806c8f9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/8806c8f9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/8806c8f9
Branch: refs/heads/master
Commit: 8806c8f9259ea6cb491605c5be169507ef4b0940
Parents: a4ecc1e c94efbe
Author: Abdelkader Midani <am...@apache.org>
Authored: Tue Aug 8 14:47:39 2017 +0200
Committer: Abdelkader Midani <am...@apache.org>
Committed: Tue Aug 8 14:47:39 2017 +0200
----------------------------------------------------------------------
extensions/pom.xml | 1 +
extensions/weather-update/.gitignore | 8 +
extensions/weather-update/README.md | 43 +++
extensions/weather-update/core/pom.xml | 100 +++++++
.../actions/WeatherUpdateAction.java | 279 +++++++++++++++++++
.../cxs/actions/UpdateWeatherAction.json | 15 +
.../sessions/weather/weatherLike.json | 13 +
.../sessions/weather/weatherTemp.json | 13 +
.../sessions/weather/weatherWindDirection.json | 13 +
.../sessions/weather/weatherWindSpeed.json | 13 +
.../META-INF/cxs/rules/UpdateWeather.json | 40 +++
.../sessions/weatherSessionProperties.json | 5 +
.../resources/OSGI-INF/blueprint/blueprint.xml | 44 +++
.../src/main/resources/messages_en.properties | 18 ++
.../org.apache.unomi.weatherUpdate.cfg | 19 ++
extensions/weather-update/karaf-kar/pom.xml | 82 ++++++
.../karaf-kar/src/main/feature/feature.xml | 28 ++
extensions/weather-update/pom.xml | 37 +++
...g.apache.unomi.persistence.elasticsearch.cfg | 2 +-
19 files changed, 772 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[08/12] incubator-unomi git commit: Updating the branch
Posted by am...@apache.org.
Updating the branch
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/512cb2d7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/512cb2d7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/512cb2d7
Branch: refs/heads/master
Commit: 512cb2d7744401587a1512db3bbeae82892965aa
Parents: acfe90d
Author: dinesh1996 <Dragonball21>
Authored: Wed Jul 26 16:30:05 2017 +0200
Committer: dinesh1996 <Dragonball21>
Committed: Thu Aug 3 14:27:18 2017 +0200
----------------------------------------------------------------------
.../actions/WeatherUpdateAction.java | 106 +++++++++----------
.../org.apache.unomi.weatherUpdate.cfg | 2 +-
2 files changed, 49 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/512cb2d7/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
index c3a345e..e37895e 100644
--- a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
+++ b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
@@ -57,12 +57,15 @@ public class WeatherUpdateAction implements ActionExecutor {
}
Session session = event.getSession();
+
if (!(weatherApiKey == null || weatherUrlBase == null || weatherUrlAttributes == null)) {
Map<String, Object> sessionProperties = session.getProperties();
if (sessionProperties.containsKey("location")) {
Map<String, Double> location = (Map<String, Double>) session.getProperty("location");
- HttpGet httpGet = new HttpGet(weatherUrlBase + "/" + weatherUrlAttributes +
- "?lat=" + location.get("lat") + "&lon=" + location.get("lon") + "&appid=" + weatherApiKey);
+ HttpGet httpGet = new HttpGet(weatherUrlBase + "/" + weatherUrlAttributes + "?lat=" +
+ location.get("lat") + "&lon=" + location.get("lon") + "&appid=" + weatherApiKey
+ );
+
JsonNode jsonNode = null;
CloseableHttpResponse response = null;
try {
@@ -111,16 +114,9 @@ public class WeatherUpdateAction implements ActionExecutor {
}
}
}
- logger.info("No update made.");
return EventService.NO_CHANGE;
}
- /**
- * Extract the temperature property from the response
- *
- * @param jsonNode
- * @return String temperature in celsius
- */
private String extractTemperature(JsonNode jsonNode) {
float temperature;
if (jsonNode.has("main") && jsonNode.get("main").has("temp")) {
@@ -138,12 +134,6 @@ public class WeatherUpdateAction implements ActionExecutor {
return null;
}
- /**
- * Extract the wind speed property from the response
- *
- * @param jsonNode
- * @return String wind speed in km/h
- */
private String extractWindSpeed(JsonNode jsonNode) {
JsonNode WindInfoSpeed;
if (jsonNode.has("wind") && jsonNode.get("wind").has("speed")) {
@@ -159,50 +149,56 @@ public class WeatherUpdateAction implements ActionExecutor {
}
- /**
- * Extract the wind direction property from the response
- *
- * @param jsonNode
- * @return String wind direction in cardinal points format
- */
private String extractWindDirection(JsonNode jsonNode) {
- JsonNode windInfoDirection;
- String direction = "";
+ JsonNode WindInfoDirection;
if (jsonNode.has("wind")) {
- windInfoDirection = jsonNode.get("wind").get("deg");
- if (windInfoDirection != null) {
-
- float deg = Float.parseFloat(windInfoDirection.toString());
- if (340 < deg && deg < 360 || 0 < deg && deg < 20) {
- direction = ("N");
- } else if (20 < deg && deg < 70) {
- direction = ("NE");
- } else if (70 < deg && deg < 110) {
- direction = ("E");
- } else if (110 < deg && deg < 160) {
- direction = ("SE");
- } else if (160 < deg && deg < 200) {
- direction = ("S");
- } else if (200 < deg && deg < 245) {
- direction = ("SW");
- } else if (245 < deg && deg < 290) {
- direction = ("W");
- } else if (290 < deg && deg < 340) {
- direction = ("NW");
- }
- logger.debug("Wind direction: " + direction);
- return direction;
+ WindInfoDirection = jsonNode.get("wind").get("deg");
+ String direction = "";
+ float deg = Float.parseFloat(WindInfoDirection.toString());
+ if (11.25 < deg && deg < 348.75) {
+ direction = ("N");
+ } else if (11.25 < deg && deg < 33.75) {
+ direction = ("NNE");
+ } else if (33.75 < deg && deg < 56.25) {
+ direction = ("NE");
+ } else if (56.25 < deg && deg < 78.75) {
+ direction = ("ENE");
+ } else if (78.75 < deg && deg < 101.25) {
+ direction = ("E");
+ } else if (101.25 < deg && deg < 123.75) {
+ direction = ("ESE");
+ } else if (123.75 < deg && deg < 146.25) {
+ direction = ("SE");
+ } else if (146.25 < deg && deg < 168.75) {
+ direction = ("SSE");
+ } else if (168.75 < deg && deg < 191.25) {
+ direction = ("S");
+ } else if (191.25 < deg && deg < 213.75) {
+ direction = ("SSW");
+ } else if (213.75 < deg && deg < 236.25) {
+ direction = ("SW");
+ } else if (236.25 < deg && deg < 258.75) {
+ direction = ("WSW");
+ } else if (258.75 < deg && deg < 281.25) {
+ direction = ("W");
+ } else if (281.25 < deg && deg < 303.75) {
+ direction = ("WNW");
+ } else if (303.75 < deg && deg < 326.25) {
+ direction = ("NW");
+ } else if (326.25 < deg && deg < 348.75) {
+ direction = ("NNW");
}
+ logger.debug("Wind direction: " + direction);
+ return direction;
}
logger.info("API Response doesn't contains the wind direction");
return null;
}
/**
- * Extract the weather like property from the response
*
* @param jsonNode
- * @return String weather like
+ * @return
*/
private String extractWeatherLike(JsonNode jsonNode) {
JsonNode weatherLike;
@@ -219,9 +215,10 @@ public class WeatherUpdateAction implements ActionExecutor {
}
/**
- * @param session the current session
- * @param property session property to fill
- * @param value of property
+ *
+ * @param session
+ * @param property
+ * @param value
*/
private void fillPropreties(Session session, String property, String value) {
session.setProperty(property, value);
@@ -230,9 +227,6 @@ public class WeatherUpdateAction implements ActionExecutor {
//Setters
/**
- * +
- * Set the weatherApiKey
- *
* @param weatherApiKey
*/
public void setWeatherApiKey(String weatherApiKey) {
@@ -240,8 +234,6 @@ public class WeatherUpdateAction implements ActionExecutor {
}
/**
- * Set the weatherUrlBase
- *
* @param weatherUrlBase
*/
public void setWeatherUrlBase(String weatherUrlBase) {
@@ -249,8 +241,6 @@ public class WeatherUpdateAction implements ActionExecutor {
}
/**
- * Set the weatherUrlAttributes
- *
* @param weatherUrlAttributes
*/
public void setWeatherUrlAttributes(String weatherUrlAttributes) {
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/512cb2d7/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg b/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
index 6b8afd1..475b631 100644
--- a/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
+++ b/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
@@ -15,6 +15,6 @@
# limitations under the License.
#
-weatherUpdate.apiKey=
+weatherUpdate.apiKey=3e66ec6001684dad10724dbddaf547e6
weatherUpdate.url.base=http://api.openweathermap.org
weatherUpdate.url.attributes=data/2.5/weather
[11/12] incubator-unomi git commit: fix a issue with a constant
Posted by am...@apache.org.
fix a issue with a constant
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/c94efbeb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/c94efbeb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/c94efbeb
Branch: refs/heads/master
Commit: c94efbebab3172bd18b829dbeed132679d54bb4f
Parents: e097087
Author: dinesh1996 <Dragonball21>
Authored: Tue Aug 8 10:40:52 2017 +0200
Committer: dinesh1996 <Dragonball21>
Committed: Tue Aug 8 10:40:52 2017 +0200
----------------------------------------------------------------------
.../unomi/weatherupdate/actions/WeatherUpdateAction.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c94efbeb/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
index 47c2f11..f5a5a5a 100644
--- a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
+++ b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
@@ -49,7 +49,7 @@ public class WeatherUpdateAction implements ActionExecutor {
private static final double KELVIN = 273.15;
private static final double ROUND_TO_THE_TENTH = 0.5;
private static final double SECOND_TO_HOUR = 3.6;
- private static final String MAIM_INFO_WEATHER = "main";
+ private static final String MAIN_INFO_WEATHER = "main";
private static final String SPEED = "speed";
private static final String STATUS_CODE = "cod";
private static final String TEMPERATURE_VALUE = "temp";
@@ -139,8 +139,8 @@ public class WeatherUpdateAction implements ActionExecutor {
*/
private String extractTemperature(JsonNode jsonNode) {
float temperature;
- if (jsonNode.has(MAIM_INFO_WEATHER) && jsonNode.get(MAIM_INFO_WEATHER).has(TEMPERATURE_VALUE)) {
- String responseString = jsonNode.get(MAIM_INFO_WEATHER).get(TEMPERATURE_VALUE).asText();
+ if (jsonNode.has(MAIN_INFO_WEATHER) && jsonNode.get(MAIN_INFO_WEATHER).has(TEMPERATURE_VALUE)) {
+ String responseString = jsonNode.get(MAIN_INFO_WEATHER).get(TEMPERATURE_VALUE).asText();
temperature = Float.parseFloat(responseString);
temperature -= KELVIN;
int temperatureTreated = (int) temperature;
@@ -227,7 +227,7 @@ public class WeatherUpdateAction implements ActionExecutor {
if (jsonNode.has(WEATHER_LIKE_INFO)) {
weatherLike = jsonNode.get(WEATHER_LIKE_INFO);
if (weatherLike.size() > 0) {
- weatherLike = weatherLike.get(0).get(MAIM_INFO_WEATHER);
+ weatherLike = weatherLike.get(0).get(MAIN_INFO_WEATHER);
logger.debug("Weather like: " + weatherLike);
return weatherLike.asText();
}
[10/12] incubator-unomi git commit: Made changes asked by the pull
request
Posted by am...@apache.org.
Made changes asked by the pull request
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/e0970871
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/e0970871
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/e0970871
Branch: refs/heads/master
Commit: e097087123f6f976146fbff8bc18e060631c4f0a
Parents: d620b66
Author: dinesh1996 <Dragonball21>
Authored: Mon Aug 7 11:27:55 2017 +0200
Committer: dinesh1996 <Dragonball21>
Committed: Mon Aug 7 11:27:55 2017 +0200
----------------------------------------------------------------------
extensions/weather-update/README.md | 6 +-
.../actions/WeatherUpdateAction.java | 98 ++++++++++++--------
2 files changed, 61 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0970871/extensions/weather-update/README.md
----------------------------------------------------------------------
diff --git a/extensions/weather-update/README.md b/extensions/weather-update/README.md
index a1943b7..3f89e23 100644
--- a/extensions/weather-update/README.md
+++ b/extensions/weather-update/README.md
@@ -16,10 +16,10 @@
-->
-Apache Unomi Unomi Weather Update
+Apache Unomi Weather Update
=================================
-This sample plugin will retrieve the weather associated with the resolved location of the user (from his IP address)
+This extension will retrieve the weather associated with the resolved location of the user (from his IP address)
## Getting started
@@ -39,5 +39,5 @@ change the following settings:
3. Deploy into Apache Unomi using the following commands from the Apache Karaf shell:
- feature:repo-add mvn:org.apache.unomi/unomi-weather-update-karaf-kar/1.2.0-incubating-SNAPSHOT/xml/features
+ feature:repo-add mvn:org.apache.unomi/unomi-weather-update-karaf-kar/${project.version}/xml/features
feature:install unomi-weather-update-karaf-kar
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/e0970871/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
index c3a345e..47c2f11 100644
--- a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
+++ b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
@@ -43,9 +43,25 @@ import java.util.Map;
* @author dsalhotra
*/
public class WeatherUpdateAction implements ActionExecutor {
+
private static Logger logger = LoggerFactory.getLogger(WeatherUpdateAction.class);
- private CloseableHttpClient httpClient;
+ private static final double KELVIN = 273.15;
+ private static final double ROUND_TO_THE_TENTH = 0.5;
+ private static final double SECOND_TO_HOUR = 3.6;
+ private static final String MAIM_INFO_WEATHER = "main";
+ private static final String SPEED = "speed";
+ private static final String STATUS_CODE = "cod";
+ private static final String TEMPERATURE_VALUE = "temp";
+ private static final String WEATHER_LIKE_INFO = "weather";
+ private static final String WIND = "wind";
+ private static final String WIND_DIRECTION_INFO = "deg";
+ private static final String WEATHER_TEMPERATURE = "weatherTemperature";
+ private static final String WEATHER_LIKE = "weatherLike";
+ private static final String WEATHER_WIND_DIRECTION = "weatherWindDirection";
+ private static final String WEATHER_WIND_SPEED = "weatherWindSpeed";
+
+ private CloseableHttpClient httpClient;
private String weatherApiKey;
private String weatherUrlBase;
private String weatherUrlAttributes;
@@ -88,23 +104,23 @@ public class WeatherUpdateAction implements ActionExecutor {
}
}
- if (jsonNode.has("cod")) {
- if (jsonNode.get("cod").asText().equals("200")) {
+ if (jsonNode.has(STATUS_CODE)) {
+ if (jsonNode.get(STATUS_CODE).asText().equals("200")) {
String temperature = extractTemperature(jsonNode);
String weatherLike = extractWeatherLike(jsonNode);
String windDirection = extractWindDirection(jsonNode);
String windSpeed = extractWindSpeed(jsonNode);
if (temperature != null) {
- fillPropreties(session, "weatherTemperature", temperature);
+ fillPropreties(session, WEATHER_TEMPERATURE, temperature);
}
if (weatherLike != null) {
- fillPropreties(session, "weatherLike", weatherLike);
+ fillPropreties(session, WEATHER_LIKE, weatherLike);
}
if (windDirection != null) {
- fillPropreties(session, "weatherWindDirection", windDirection);
+ fillPropreties(session, WEATHER_WIND_DIRECTION, windDirection);
}
if (windSpeed != null) {
- fillPropreties(session, "weatherWindSpeed", windSpeed);
+ fillPropreties(session, WEATHER_WIND_SPEED, windSpeed);
}
return EventService.SESSION_UPDATED;
}
@@ -123,12 +139,12 @@ public class WeatherUpdateAction implements ActionExecutor {
*/
private String extractTemperature(JsonNode jsonNode) {
float temperature;
- if (jsonNode.has("main") && jsonNode.get("main").has("temp")) {
- String responseString = jsonNode.get("main").get("temp").asText();
+ if (jsonNode.has(MAIM_INFO_WEATHER) && jsonNode.get(MAIM_INFO_WEATHER).has(TEMPERATURE_VALUE)) {
+ String responseString = jsonNode.get(MAIM_INFO_WEATHER).get(TEMPERATURE_VALUE).asText();
temperature = Float.parseFloat(responseString);
- temperature -= 273.15;
+ temperature -= KELVIN;
int temperatureTreated = (int) temperature;
- if (temperature - temperatureTreated > 0.5) {
+ if (temperature - temperatureTreated > ROUND_TO_THE_TENTH) {
temperatureTreated++;
}
logger.debug("Temperature: " + temperatureTreated);
@@ -146,10 +162,10 @@ public class WeatherUpdateAction implements ActionExecutor {
*/
private String extractWindSpeed(JsonNode jsonNode) {
JsonNode WindInfoSpeed;
- if (jsonNode.has("wind") && jsonNode.get("wind").has("speed")) {
- WindInfoSpeed = jsonNode.get("wind").get("speed");
+ if (jsonNode.has(WIND) && jsonNode.get(WIND).has(SPEED)) {
+ WindInfoSpeed = jsonNode.get(WIND).get(SPEED);
float speed = Float.parseFloat(WindInfoSpeed.toString());
- speed *= 3.6;
+ speed *= SECOND_TO_HOUR;
int speedTreated = (int) speed;
logger.debug("Wind speed: " + speedTreated);
return speedTreated + "";
@@ -168,30 +184,32 @@ public class WeatherUpdateAction implements ActionExecutor {
private String extractWindDirection(JsonNode jsonNode) {
JsonNode windInfoDirection;
String direction = "";
- if (jsonNode.has("wind")) {
- windInfoDirection = jsonNode.get("wind").get("deg");
- if (windInfoDirection != null) {
+ if (jsonNode.has(WIND)) {
+ if (jsonNode.get(WIND).has(WIND_DIRECTION_INFO)) {
+ windInfoDirection = jsonNode.get(WIND).get(WIND_DIRECTION_INFO);
+ if (windInfoDirection != null) {
- float deg = Float.parseFloat(windInfoDirection.toString());
- if (340 < deg && deg < 360 || 0 < deg && deg < 20) {
- direction = ("N");
- } else if (20 < deg && deg < 70) {
- direction = ("NE");
- } else if (70 < deg && deg < 110) {
- direction = ("E");
- } else if (110 < deg && deg < 160) {
- direction = ("SE");
- } else if (160 < deg && deg < 200) {
- direction = ("S");
- } else if (200 < deg && deg < 245) {
- direction = ("SW");
- } else if (245 < deg && deg < 290) {
- direction = ("W");
- } else if (290 < deg && deg < 340) {
- direction = ("NW");
+ float deg = Float.parseFloat(windInfoDirection.toString());
+ if (340 < deg && deg < 360 || 0 < deg && deg < 20) {
+ direction = ("N");
+ } else if (20 < deg && deg < 70) {
+ direction = ("NE");
+ } else if (70 < deg && deg < 110) {
+ direction = ("E");
+ } else if (110 < deg && deg < 160) {
+ direction = ("SE");
+ } else if (160 < deg && deg < 200) {
+ direction = ("S");
+ } else if (200 < deg && deg < 245) {
+ direction = ("SW");
+ } else if (245 < deg && deg < 290) {
+ direction = ("W");
+ } else if (290 < deg && deg < 340) {
+ direction = ("NW");
+ }
+ logger.debug("Wind direction: " + direction);
+ return direction;
}
- logger.debug("Wind direction: " + direction);
- return direction;
}
}
logger.info("API Response doesn't contains the wind direction");
@@ -206,10 +224,10 @@ public class WeatherUpdateAction implements ActionExecutor {
*/
private String extractWeatherLike(JsonNode jsonNode) {
JsonNode weatherLike;
- if (jsonNode.has("weather")) {
- weatherLike = jsonNode.get("weather");
+ if (jsonNode.has(WEATHER_LIKE_INFO)) {
+ weatherLike = jsonNode.get(WEATHER_LIKE_INFO);
if (weatherLike.size() > 0) {
- weatherLike = weatherLike.get(0).get("main");
+ weatherLike = weatherLike.get(0).get(MAIM_INFO_WEATHER);
logger.debug("Weather like: " + weatherLike);
return weatherLike.asText();
}
@@ -230,7 +248,7 @@ public class WeatherUpdateAction implements ActionExecutor {
//Setters
/**
- * +
+ *
* Set the weatherApiKey
*
* @param weatherApiKey
[06/12] incubator-unomi git commit: Changed the default value
Posted by am...@apache.org.
Changed the default value
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/ee6b238b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/ee6b238b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/ee6b238b
Branch: refs/heads/master
Commit: ee6b238b88b153bb5f9e1480f11bd712b6226203
Parents: 512cb2d
Author: dinesh1996 <Dragonball21>
Authored: Wed Jul 26 17:51:22 2017 +0200
Committer: dinesh1996 <Dragonball21>
Committed: Thu Aug 3 14:27:18 2017 +0200
----------------------------------------------------------------------
.../core/src/main/resources/org.apache.unomi.weatherUpdate.cfg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ee6b238b/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg b/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
index 475b631..1f69568 100644
--- a/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
+++ b/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
@@ -15,6 +15,6 @@
# limitations under the License.
#
-weatherUpdate.apiKey=3e66ec6001684dad10724dbddaf547e6
+weatherUpdate.apiKey=YOUR_WEATHER_APIKEY
weatherUpdate.url.base=http://api.openweathermap.org
weatherUpdate.url.attributes=data/2.5/weather
[04/12] incubator-unomi git commit: Integrate weather update
extension to unomi
Posted by am...@apache.org.
Integrate weather update extension to unomi
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/774e8010
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/774e8010
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/774e8010
Branch: refs/heads/master
Commit: 774e8010ed4bf2d8452f8eaa86582c35e0f90d02
Parents: bc06486
Author: dinesh1996 <Dragonball21>
Authored: Wed Jul 26 14:29:54 2017 +0200
Committer: dinesh1996 <Dragonball21>
Committed: Thu Aug 3 14:27:18 2017 +0200
----------------------------------------------------------------------
extensions/pom.xml | 1 +
extensions/weather-update/.gitignore | 8 +
extensions/weather-update/README.md | 30 +++
extensions/weather-update/core/pom.xml | 100 ++++++++
.../actions/WeatherUpdateAction.java | 251 +++++++++++++++++++
.../cxs/actions/UpdateWeatherAction.json | 15 ++
.../sessions/weather/weatherLike.json | 13 +
.../sessions/weather/weatherTemp.json | 13 +
.../sessions/weather/weatherWindDirection.json | 13 +
.../sessions/weather/weatherWindSpeed.json | 13 +
.../META-INF/cxs/rules/UpdateWeather.json | 40 +++
.../sessions/weatherSessionProperties.json | 5 +
.../resources/OSGI-INF/blueprint/blueprint.xml | 44 ++++
.../src/main/resources/messages_en.properties | 18 ++
.../org.apache.unomi.weatherUpdate.cfg | 20 ++
extensions/weather-update/karaf-kar/pom.xml | 82 ++++++
.../karaf-kar/src/main/feature/feature.xml | 28 +++
extensions/weather-update/pom.xml | 37 +++
...g.apache.unomi.persistence.elasticsearch.cfg | 4 +-
19 files changed, 733 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 07608b3..29437be 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -36,6 +36,7 @@
<module>geonames</module>
<module>router</module>
<module>salesforce-connector</module>
+ <module>weather-update</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/.gitignore
----------------------------------------------------------------------
diff --git a/extensions/weather-update/.gitignore b/extensions/weather-update/.gitignore
new file mode 100644
index 0000000..851a31c
--- /dev/null
+++ b/extensions/weather-update/.gitignore
@@ -0,0 +1,8 @@
+/.classpath
+/.project
+/.settings
+.idea
+*.iml
+*.ipr
+target
+repository.xml.generated
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/README.md
----------------------------------------------------------------------
diff --git a/extensions/weather-update/README.md b/extensions/weather-update/README.md
new file mode 100644
index 0000000..0763929
--- /dev/null
+++ b/extensions/weather-update/README.md
@@ -0,0 +1,30 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+
+# UnomiWeatherUpdate
+A simple plugin to send Unomi events when a member is logged
+
+
+In the etc/org.apache.unomi.weatherupdate.cfg file change the following settings:
+
+ weatherUpdate.apiKey=YOUR_WEATHER_APIKEY
+
+
+ <configfile finalname="/etc/org.apache.unomi.weatherupdate.cfg">mvn:org.apache.unomi
+ .samples/weather-update-karaf-kar/${project.version}/cfg/weatherupdatecfg</configfile>
+
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/core/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/pom.xml b/extensions/weather-update/core/pom.xml
new file mode 100755
index 0000000..06aa2ee
--- /dev/null
+++ b/extensions/weather-update/core/pom.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.unomi</groupId>
+ <artifactId>unomi-weather-update</artifactId>
+ <version>1.2.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>unomi-weather-update-core</artifactId>
+ <name>Apache Unomi :: Extension :: Weather Update :: Core</name>
+ <description>This is a simple Apache Unomi plugin.</description>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.unomi</groupId>
+ <artifactId>unomi-api</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient-osgi</artifactId>
+ <version>4.5.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore-osgi</artifactId>
+ <version>4.4.6</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
+ <Import-Package>
+ *
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>
+ src/main/resources/org.apache.unomi.weatherupdate.cfg
+ </file>
+ <type>cfg</type>
+ <classifier>weatherupdatecfg</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
new file mode 100644
index 0000000..e37895e
--- /dev/null
+++ b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
@@ -0,0 +1,251 @@
+/*
+
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+*/
+
+package org.apache.unomi.weatherupdate.actions;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.apache.unomi.api.Event;
+import org.apache.unomi.api.Session;
+import org.apache.unomi.api.actions.Action;
+import org.apache.unomi.api.actions.ActionExecutor;
+import org.apache.unomi.api.services.EventService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * Get the weather location of the users by an API
+ *
+ * @author dsalhotra
+ */
+public class WeatherUpdateAction implements ActionExecutor {
+ private static Logger logger = LoggerFactory.getLogger(WeatherUpdateAction.class);
+ private CloseableHttpClient httpClient;
+
+ private String weatherApiKey;
+ private String weatherUrlBase;
+ private String weatherUrlAttributes;
+
+ @Override
+ public int execute(Action action, Event event) {
+ if (httpClient == null) {
+ httpClient = HttpClients.createDefault();
+ }
+
+ Session session = event.getSession();
+
+ if (!(weatherApiKey == null || weatherUrlBase == null || weatherUrlAttributes == null)) {
+ Map<String, Object> sessionProperties = session.getProperties();
+ if (sessionProperties.containsKey("location")) {
+ Map<String, Double> location = (Map<String, Double>) session.getProperty("location");
+ HttpGet httpGet = new HttpGet(weatherUrlBase + "/" + weatherUrlAttributes + "?lat=" +
+ location.get("lat") + "&lon=" + location.get("lon") + "&appid=" + weatherApiKey
+ );
+
+ JsonNode jsonNode = null;
+ CloseableHttpResponse response = null;
+ try {
+ response = httpClient.execute(httpGet);
+ if (response != null) {
+ HttpEntity entity = response.getEntity();
+ String responseString;
+ if (entity != null) {
+ try {
+ responseString = EntityUtils.toString(entity);
+ ObjectMapper objectMapper = new ObjectMapper();
+ jsonNode = objectMapper.readTree(responseString);
+ } catch (IOException e) {
+ logger.error("Error : With the API json response.", e.getMessage());
+ }
+ }
+ }
+ } catch (IOException e) {
+ logger.error("Error : With the Http Request execution. Wrong parameters given", e.getMessage());
+ } finally {
+ if (response != null) {
+ EntityUtils.consumeQuietly(response.getEntity());
+ }
+ }
+
+ if (jsonNode.has("cod")) {
+ if (jsonNode.get("cod").asText().equals("200")) {
+ String temperature = extractTemperature(jsonNode);
+ String weatherLike = extractWeatherLike(jsonNode);
+ String windDirection = extractWindDirection(jsonNode);
+ String windSpeed = extractWindSpeed(jsonNode);
+ if (temperature != null) {
+ fillPropreties(session, "weatherTemperature", temperature);
+ }
+ if (weatherLike != null) {
+ fillPropreties(session, "weatherLike", weatherLike);
+ }
+ if (windDirection != null) {
+ fillPropreties(session, "weatherWindDirection", windDirection);
+ }
+ if (windSpeed != null) {
+ fillPropreties(session, "weatherWindSpeed", windSpeed);
+ }
+ return EventService.SESSION_UPDATED;
+ }
+ }
+ }
+ }
+ return EventService.NO_CHANGE;
+ }
+
+ private String extractTemperature(JsonNode jsonNode) {
+ float temperature;
+ if (jsonNode.has("main") && jsonNode.get("main").has("temp")) {
+ String responseString = jsonNode.get("main").get("temp").asText();
+ temperature = Float.parseFloat(responseString);
+ temperature -= 273.15;
+ int temperatureTreated = (int) temperature;
+ if (temperature - temperatureTreated > 0.5) {
+ temperatureTreated++;
+ }
+ logger.debug("Temperature: " + temperatureTreated);
+ return temperatureTreated + "";
+ }
+ logger.info("API Response doesn't contains the temperature");
+ return null;
+ }
+
+ private String extractWindSpeed(JsonNode jsonNode) {
+ JsonNode WindInfoSpeed;
+ if (jsonNode.has("wind") && jsonNode.get("wind").has("speed")) {
+ WindInfoSpeed = jsonNode.get("wind").get("speed");
+ float speed = Float.parseFloat(WindInfoSpeed.toString());
+ speed *= 3.6;
+ int speedTreated = (int) speed;
+ logger.debug("Wind speed: " + speedTreated);
+ return speedTreated + "";
+ }
+ logger.info("API Response doesn't contains the wind speed");
+ return null;
+
+ }
+
+ private String extractWindDirection(JsonNode jsonNode) {
+ JsonNode WindInfoDirection;
+ if (jsonNode.has("wind")) {
+ WindInfoDirection = jsonNode.get("wind").get("deg");
+ String direction = "";
+ float deg = Float.parseFloat(WindInfoDirection.toString());
+ if (11.25 < deg && deg < 348.75) {
+ direction = ("N");
+ } else if (11.25 < deg && deg < 33.75) {
+ direction = ("NNE");
+ } else if (33.75 < deg && deg < 56.25) {
+ direction = ("NE");
+ } else if (56.25 < deg && deg < 78.75) {
+ direction = ("ENE");
+ } else if (78.75 < deg && deg < 101.25) {
+ direction = ("E");
+ } else if (101.25 < deg && deg < 123.75) {
+ direction = ("ESE");
+ } else if (123.75 < deg && deg < 146.25) {
+ direction = ("SE");
+ } else if (146.25 < deg && deg < 168.75) {
+ direction = ("SSE");
+ } else if (168.75 < deg && deg < 191.25) {
+ direction = ("S");
+ } else if (191.25 < deg && deg < 213.75) {
+ direction = ("SSW");
+ } else if (213.75 < deg && deg < 236.25) {
+ direction = ("SW");
+ } else if (236.25 < deg && deg < 258.75) {
+ direction = ("WSW");
+ } else if (258.75 < deg && deg < 281.25) {
+ direction = ("W");
+ } else if (281.25 < deg && deg < 303.75) {
+ direction = ("WNW");
+ } else if (303.75 < deg && deg < 326.25) {
+ direction = ("NW");
+ } else if (326.25 < deg && deg < 348.75) {
+ direction = ("NNW");
+ }
+ logger.debug("Wind direction: " + direction);
+ return direction;
+ }
+ logger.info("API Response doesn't contains the wind direction");
+ return null;
+ }
+
+ /**
+ *
+ * @param jsonNode
+ * @return
+ */
+ private String extractWeatherLike(JsonNode jsonNode) {
+ JsonNode weatherLike;
+ if (jsonNode.has("weather")) {
+ weatherLike = jsonNode.get("weather");
+ if (weatherLike.size() > 0) {
+ weatherLike = weatherLike.get(0).get("main");
+ logger.debug("Weather like: " + weatherLike);
+ return weatherLike.asText();
+ }
+ }
+ logger.info("API Response doesn't contains the weather description");
+ return null;
+ }
+
+ /**
+ *
+ * @param session
+ * @param property
+ * @param value
+ */
+ private void fillPropreties(Session session, String property, String value) {
+ session.setProperty(property, value);
+ }
+
+ //Setters
+
+ /**
+ * @param weatherApiKey
+ */
+ public void setWeatherApiKey(String weatherApiKey) {
+ this.weatherApiKey = weatherApiKey;
+ }
+
+ /**
+ * @param weatherUrlBase
+ */
+ public void setWeatherUrlBase(String weatherUrlBase) {
+ this.weatherUrlBase = weatherUrlBase;
+ }
+
+ /**
+ * @param weatherUrlAttributes
+ */
+ public void setWeatherUrlAttributes(String weatherUrlAttributes) {
+ this.weatherUrlAttributes = weatherUrlAttributes;
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/core/src/main/resources/META-INF/cxs/actions/UpdateWeatherAction.json
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/META-INF/cxs/actions/UpdateWeatherAction.json b/extensions/weather-update/core/src/main/resources/META-INF/cxs/actions/UpdateWeatherAction.json
new file mode 100755
index 0000000..339291b
--- /dev/null
+++ b/extensions/weather-update/core/src/main/resources/META-INF/cxs/actions/UpdateWeatherAction.json
@@ -0,0 +1,15 @@
+{
+ "metadata": {
+ "id": "weatherUpdateAction",
+ "name": "Update session with local weather information",
+ "description": "This action will retrieve the weather associated with the resolved location of the user (from his IP address)",
+ "tags": [
+ "event",
+ "hidden.availableToEndUser",
+ "hidden.hasNoTemplate"
+ ],
+ "readOnly": true
+ },
+ "actionExecutor": "weatherUpdate",
+ "parameters": []
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherLike.json
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherLike.json b/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherLike.json
new file mode 100755
index 0000000..ade7495
--- /dev/null
+++ b/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherLike.json
@@ -0,0 +1,13 @@
+{
+ "metadata": {
+ "id": "weatherLike",
+ "name": "Weather Description"
+ },
+ "type": "string",
+ "tags": [
+ "sessionProperties"
+ ],
+ "defaultValue": "",
+ "automaticMappingsFrom": [],
+ "rank": "302.0"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherTemp.json
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherTemp.json b/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherTemp.json
new file mode 100755
index 0000000..d3aebe5
--- /dev/null
+++ b/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherTemp.json
@@ -0,0 +1,13 @@
+{
+ "metadata": {
+ "id": "weatherTemperature",
+ "name": "Weather Temperature"
+ },
+ "type": "integer",
+ "tags": [
+ "sessionProperties"
+ ],
+ "defaultValue": "",
+ "automaticMappingsFrom": [],
+ "rank": "302.0"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherWindDirection.json
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherWindDirection.json b/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherWindDirection.json
new file mode 100755
index 0000000..c9fc3e6
--- /dev/null
+++ b/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherWindDirection.json
@@ -0,0 +1,13 @@
+{
+ "metadata": {
+ "id": "weatherWindDirection",
+ "name": "Weather Wind Direction"
+ },
+ "type": "string",
+ "tags": [
+ "sessionProperties"
+ ],
+ "defaultValue": "",
+ "automaticMappingsFrom": [],
+ "rank": "302.0"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherWindSpeed.json
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherWindSpeed.json b/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherWindSpeed.json
new file mode 100755
index 0000000..5077f1e
--- /dev/null
+++ b/extensions/weather-update/core/src/main/resources/META-INF/cxs/properties/sessions/weather/weatherWindSpeed.json
@@ -0,0 +1,13 @@
+{
+ "metadata": {
+ "id": "weatherWindSpeed",
+ "name": "Weather Wind Speed"
+ },
+ "type": "integer",
+ "tags": [
+ "sessionProperties"
+ ],
+ "defaultValue": "",
+ "automaticMappingsFrom": [],
+ "rank": "302.0"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/core/src/main/resources/META-INF/cxs/rules/UpdateWeather.json
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/META-INF/cxs/rules/UpdateWeather.json b/extensions/weather-update/core/src/main/resources/META-INF/cxs/rules/UpdateWeather.json
new file mode 100755
index 0000000..ec25145
--- /dev/null
+++ b/extensions/weather-update/core/src/main/resources/META-INF/cxs/rules/UpdateWeather.json
@@ -0,0 +1,40 @@
+{
+ "metadata": {
+ "id": "weatherUpdate",
+ "name": "Add weather information to session",
+ "description": "Get the weather from a city"
+ },
+ "raiseEventOnlyOnceForSession": false,
+ "condition": {
+
+ "parameterValues": {
+ "subConditions": [
+ {
+ "type": "eventTypeCondition",
+ "parameterValues": {
+ "eventTypeId": "weatherEvent"
+ }
+ },
+ {
+ "type": "eventTypeCondition",
+ "parameterValues": {
+ "eventTypeId": "login"
+ }
+ }
+ ],
+ "operator" : "or"
+ },
+ "type": "booleanCondition"
+ },
+ "actions": [
+ {
+ "type": "weatherUpdateAction",
+ "parameterValues": {}
+ }
+ ]
+}
+
+
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/core/src/main/resources/META-INF/cxs/tags/properties/sessions/weatherSessionProperties.json
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/META-INF/cxs/tags/properties/sessions/weatherSessionProperties.json b/extensions/weather-update/core/src/main/resources/META-INF/cxs/tags/properties/sessions/weatherSessionProperties.json
new file mode 100755
index 0000000..d634f69
--- /dev/null
+++ b/extensions/weather-update/core/src/main/resources/META-INF/cxs/tags/properties/sessions/weatherSessionProperties.json
@@ -0,0 +1,5 @@
+{
+ "id": "weatherSessionProperties",
+ "parent": "sessionProperties",
+ "rank": "1.0"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100755
index 0000000..0339ce8
--- /dev/null
+++ b/extensions/weather-update/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+ xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <!-- cfg configuration -->
+ <cm:property-placeholder persistent-id="org.apache.unomi.weatherupdate"
+ update-strategy="reload">
+ <cm:default-properties>
+ <cm:property name="weatherUpdate.apiKey" value=""/>
+ <cm:property name="weatherUpdate.url.base" value=""/>
+ <cm:property name="weatherUpdate.url.attributes" value=""/>
+ </cm:default-properties>
+ </cm:property-placeholder>
+
+ <!-- Action executor -->
+ <service auto-export="interfaces">
+ <service-properties>
+ <entry key="actionExecutorId" value="weatherUpdate"/>
+ </service-properties>
+ <bean class="org.apache.unomi.weatherupdate.actions.WeatherUpdateAction">
+ <property name="weatherApiKey" value="${weatherUpdate.apiKey}"/>
+ <property name="weatherUrlBase" value="${weatherUpdate.url.base}"/>
+ <property name="weatherUrlAttributes" value="${weatherUpdate.url.attributes}"/>
+ </bean>
+ </service>
+</blueprint>
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/core/src/main/resources/messages_en.properties
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/messages_en.properties b/extensions/weather-update/core/src/main/resources/messages_en.properties
new file mode 100755
index 0000000..ef653d6
--- /dev/null
+++ b/extensions/weather-update/core/src/main/resources/messages_en.properties
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+action.incrementTweetNumberAction.description=This action will retrieve the weather associated with the resolved location of the user (from his IP address)
+action.incrementTweetNumberAction.name=Update session with local weather information
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg b/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
new file mode 100644
index 0000000..475b631
--- /dev/null
+++ b/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+weatherUpdate.apiKey=3e66ec6001684dad10724dbddaf547e6
+weatherUpdate.url.base=http://api.openweathermap.org
+weatherUpdate.url.attributes=data/2.5/weather
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/karaf-kar/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/weather-update/karaf-kar/pom.xml b/extensions/weather-update/karaf-kar/pom.xml
new file mode 100644
index 0000000..ffe164e
--- /dev/null
+++ b/extensions/weather-update/karaf-kar/pom.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.unomi</groupId>
+ <artifactId>unomi-weather-update</artifactId>
+ <version>1.2.0-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>unomi-weather-update-karaf-kar</artifactId>
+ <name>Apache Unomi :: Extension :: Weather Update :: Apache Karaf Feature and KAR archive</name>
+ <description>This is a simple Apache Unomi plugin.</description>
+ <packaging>kar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.unomi</groupId>
+ <artifactId>unomi-api</artifactId>
+ <version>1.2.0-incubating-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore-osgi</artifactId>
+ <version>4.4.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient-osgi</artifactId>
+ <version>4.5.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.unomi</groupId>
+ <artifactId>unomi-weather-update-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <includeTransitiveDependency>false</includeTransitiveDependency>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <configuration>
+ <startLevel>85</startLevel>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/karaf-kar/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/extensions/weather-update/karaf-kar/src/main/feature/feature.xml b/extensions/weather-update/karaf-kar/src/main/feature/feature.xml
new file mode 100644
index 0000000..73ebcb6
--- /dev/null
+++ b/extensions/weather-update/karaf-kar/src/main/feature/feature.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.1" name="unomi-weather-update-karaf-feature">
+ <feature name="unomi-weather-update-karaf-kar" version="1.0-SNAPSHOT"
+ description="Apache Unomi :: Extensions :: Weather update :: Apache Karaf Feature">
+ <details>Apache Karaf feature for the Apache Unomi Context Server extension that integrates Weather
+ update</details>
+ <configfile finalname="/etc/org.apache.unomi.weatherupdate.cfg">mvn:org.apache.unomi/unomi-weather-update-core/1.2.0-incubating-SNAPSHOT/cfg/weatherupdatecfg</configfile>
+ <bundle start-level="85">mvn:org.apache.httpcomponents/httpcore-osgi/4.4.6</bundle>
+ <bundle start-level="85">mvn:org.apache.httpcomponents/httpclient-osgi/4.5.1</bundle>
+ <bundle start-level="85">mvn:org.apache.unomi/unomi-weather-update-core/1.2.0-incubating-SNAPSHOT</bundle>
+ </feature>
+</features>
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/extensions/weather-update/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/weather-update/pom.xml b/extensions/weather-update/pom.xml
new file mode 100644
index 0000000..36c53fb
--- /dev/null
+++ b/extensions/weather-update/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.unomi</groupId>
+ <artifactId>unomi-extensions</artifactId>
+ <version>1.2.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>unomi-weather-update</artifactId>
+ <name>Apache Unomi :: Extension :: Weather Update</name>
+ <description>Apache Unomi Context Server that get the visitor weather based on his location</description>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>core</module>
+ <module>karaf-kar</module>
+ </modules>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/774e8010/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
----------------------------------------------------------------------
diff --git a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
index 77eb091..57127fd 100644
--- a/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
+++ b/persistence-elasticsearch/core/src/main/resources/org.apache.unomi.persistence.elasticsearch.cfg
@@ -15,7 +15,7 @@
# limitations under the License.
#
-cluster.name=contextElasticSearch
+cluster.name=dineshElasticSearch
# The elasticSearchAddresses may be a comma seperated list of host names and ports such as
# hostA:9300,hostB:9300
# Note: the port number must be repeated for each host.
@@ -42,4 +42,4 @@ bulkProcessor.backoffPolicy=exponential
# for each node in the ElasticSearch cluster:
# minimalElasticSearchVersion <= ElasticSearch node version < maximalElasticSearchVersion
minimalElasticSearchVersion=5.0.0
-maximalElasticSearchVersion=5.3.0
\ No newline at end of file
+maximalElasticSearchVersion=5.3.0
[09/12] incubator-unomi git commit: Integrate weather update
extension to unomi
Posted by am...@apache.org.
Integrate weather update extension to unomi
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/5d90e592
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/5d90e592
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/5d90e592
Branch: refs/heads/master
Commit: 5d90e592f3b6328aea13509cd23574d1e7573a8b
Parents: ee6b238
Author: dinesh1996 <Dragonball21>
Authored: Wed Jul 26 14:29:54 2017 +0200
Committer: dinesh1996 <Dragonball21>
Committed: Thu Aug 3 14:27:18 2017 +0200
----------------------------------------------------------------------
extensions/weather-update/README.md | 12 ++++++++++--
.../main/resources/org.apache.unomi.weatherUpdate.cfg | 1 -
2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/5d90e592/extensions/weather-update/README.md
----------------------------------------------------------------------
diff --git a/extensions/weather-update/README.md b/extensions/weather-update/README.md
index dcc486f..a1943b7 100644
--- a/extensions/weather-update/README.md
+++ b/extensions/weather-update/README.md
@@ -23,13 +23,21 @@ This sample plugin will retrieve the weather associated with the resolved locati
## Getting started
-1. Configure the Apache Unomi Weather Update. In the etc/org.apache.unomi.weatherUpdate.cfg file
+1. Create an new account :
+
+ https://home.openweathermap.org/users/sign_up
+
+2. Generate a new API Key, or get the default
+
+ https://home.openweathermap.org/api_keys
+
+2. Configure the Apache Unomi Weather Update. In the etc/org.apache.unomi.weatherUpdate.cfg file
change the following settings:
weatherUpdate.apiKey=YOUR_WEATHER_APIKEY
-2. Deploy into Apache Unomi using the following commands from the Apache Karaf shell:
+3. Deploy into Apache Unomi using the following commands from the Apache Karaf shell:
feature:repo-add mvn:org.apache.unomi/unomi-weather-update-karaf-kar/1.2.0-incubating-SNAPSHOT/xml/features
feature:install unomi-weather-update-karaf-kar
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/5d90e592/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg b/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
index 1f69568..aa85dc0 100644
--- a/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
+++ b/extensions/weather-update/core/src/main/resources/org.apache.unomi.weatherUpdate.cfg
@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
weatherUpdate.apiKey=YOUR_WEATHER_APIKEY
weatherUpdate.url.base=http://api.openweathermap.org
weatherUpdate.url.attributes=data/2.5/weather
[03/12] incubator-unomi git commit: Add Java Doc and update the
README.
Posted by am...@apache.org.
Add Java Doc and update the README.
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/cdcaeba3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/cdcaeba3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/cdcaeba3
Branch: refs/heads/master
Commit: cdcaeba38d8021818fe32d98ee31da6b9cc0724b
Parents: 5d90e59
Author: dinesh1996 <Dragonball21>
Authored: Wed Jul 26 15:56:49 2017 +0200
Committer: dinesh1996 <Dragonball21>
Committed: Thu Aug 3 14:27:18 2017 +0200
----------------------------------------------------------------------
.../actions/WeatherUpdateAction.java | 106 ++++++++++---------
1 file changed, 58 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/cdcaeba3/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
----------------------------------------------------------------------
diff --git a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
index e37895e..c3a345e 100644
--- a/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
+++ b/extensions/weather-update/core/src/main/java/org/apache/unomi/weatherupdate/actions/WeatherUpdateAction.java
@@ -57,15 +57,12 @@ public class WeatherUpdateAction implements ActionExecutor {
}
Session session = event.getSession();
-
if (!(weatherApiKey == null || weatherUrlBase == null || weatherUrlAttributes == null)) {
Map<String, Object> sessionProperties = session.getProperties();
if (sessionProperties.containsKey("location")) {
Map<String, Double> location = (Map<String, Double>) session.getProperty("location");
- HttpGet httpGet = new HttpGet(weatherUrlBase + "/" + weatherUrlAttributes + "?lat=" +
- location.get("lat") + "&lon=" + location.get("lon") + "&appid=" + weatherApiKey
- );
-
+ HttpGet httpGet = new HttpGet(weatherUrlBase + "/" + weatherUrlAttributes +
+ "?lat=" + location.get("lat") + "&lon=" + location.get("lon") + "&appid=" + weatherApiKey);
JsonNode jsonNode = null;
CloseableHttpResponse response = null;
try {
@@ -114,9 +111,16 @@ public class WeatherUpdateAction implements ActionExecutor {
}
}
}
+ logger.info("No update made.");
return EventService.NO_CHANGE;
}
+ /**
+ * Extract the temperature property from the response
+ *
+ * @param jsonNode
+ * @return String temperature in celsius
+ */
private String extractTemperature(JsonNode jsonNode) {
float temperature;
if (jsonNode.has("main") && jsonNode.get("main").has("temp")) {
@@ -134,6 +138,12 @@ public class WeatherUpdateAction implements ActionExecutor {
return null;
}
+ /**
+ * Extract the wind speed property from the response
+ *
+ * @param jsonNode
+ * @return String wind speed in km/h
+ */
private String extractWindSpeed(JsonNode jsonNode) {
JsonNode WindInfoSpeed;
if (jsonNode.has("wind") && jsonNode.get("wind").has("speed")) {
@@ -149,56 +159,50 @@ public class WeatherUpdateAction implements ActionExecutor {
}
+ /**
+ * Extract the wind direction property from the response
+ *
+ * @param jsonNode
+ * @return String wind direction in cardinal points format
+ */
private String extractWindDirection(JsonNode jsonNode) {
- JsonNode WindInfoDirection;
+ JsonNode windInfoDirection;
+ String direction = "";
if (jsonNode.has("wind")) {
- WindInfoDirection = jsonNode.get("wind").get("deg");
- String direction = "";
- float deg = Float.parseFloat(WindInfoDirection.toString());
- if (11.25 < deg && deg < 348.75) {
- direction = ("N");
- } else if (11.25 < deg && deg < 33.75) {
- direction = ("NNE");
- } else if (33.75 < deg && deg < 56.25) {
- direction = ("NE");
- } else if (56.25 < deg && deg < 78.75) {
- direction = ("ENE");
- } else if (78.75 < deg && deg < 101.25) {
- direction = ("E");
- } else if (101.25 < deg && deg < 123.75) {
- direction = ("ESE");
- } else if (123.75 < deg && deg < 146.25) {
- direction = ("SE");
- } else if (146.25 < deg && deg < 168.75) {
- direction = ("SSE");
- } else if (168.75 < deg && deg < 191.25) {
- direction = ("S");
- } else if (191.25 < deg && deg < 213.75) {
- direction = ("SSW");
- } else if (213.75 < deg && deg < 236.25) {
- direction = ("SW");
- } else if (236.25 < deg && deg < 258.75) {
- direction = ("WSW");
- } else if (258.75 < deg && deg < 281.25) {
- direction = ("W");
- } else if (281.25 < deg && deg < 303.75) {
- direction = ("WNW");
- } else if (303.75 < deg && deg < 326.25) {
- direction = ("NW");
- } else if (326.25 < deg && deg < 348.75) {
- direction = ("NNW");
+ windInfoDirection = jsonNode.get("wind").get("deg");
+ if (windInfoDirection != null) {
+
+ float deg = Float.parseFloat(windInfoDirection.toString());
+ if (340 < deg && deg < 360 || 0 < deg && deg < 20) {
+ direction = ("N");
+ } else if (20 < deg && deg < 70) {
+ direction = ("NE");
+ } else if (70 < deg && deg < 110) {
+ direction = ("E");
+ } else if (110 < deg && deg < 160) {
+ direction = ("SE");
+ } else if (160 < deg && deg < 200) {
+ direction = ("S");
+ } else if (200 < deg && deg < 245) {
+ direction = ("SW");
+ } else if (245 < deg && deg < 290) {
+ direction = ("W");
+ } else if (290 < deg && deg < 340) {
+ direction = ("NW");
+ }
+ logger.debug("Wind direction: " + direction);
+ return direction;
}
- logger.debug("Wind direction: " + direction);
- return direction;
}
logger.info("API Response doesn't contains the wind direction");
return null;
}
/**
+ * Extract the weather like property from the response
*
* @param jsonNode
- * @return
+ * @return String weather like
*/
private String extractWeatherLike(JsonNode jsonNode) {
JsonNode weatherLike;
@@ -215,10 +219,9 @@ public class WeatherUpdateAction implements ActionExecutor {
}
/**
- *
- * @param session
- * @param property
- * @param value
+ * @param session the current session
+ * @param property session property to fill
+ * @param value of property
*/
private void fillPropreties(Session session, String property, String value) {
session.setProperty(property, value);
@@ -227,6 +230,9 @@ public class WeatherUpdateAction implements ActionExecutor {
//Setters
/**
+ * +
+ * Set the weatherApiKey
+ *
* @param weatherApiKey
*/
public void setWeatherApiKey(String weatherApiKey) {
@@ -234,6 +240,8 @@ public class WeatherUpdateAction implements ActionExecutor {
}
/**
+ * Set the weatherUrlBase
+ *
* @param weatherUrlBase
*/
public void setWeatherUrlBase(String weatherUrlBase) {
@@ -241,6 +249,8 @@ public class WeatherUpdateAction implements ActionExecutor {
}
/**
+ * Set the weatherUrlAttributes
+ *
* @param weatherUrlAttributes
*/
public void setWeatherUrlAttributes(String weatherUrlAttributes) {