From d9f48423e3ed0a10d1de3088736ee369ccc6e24d Mon Sep 17 00:00:00 2001 From: GPrathap Date: Thu, 25 Feb 2016 19:25:06 +0530 Subject: [PATCH 1/3] Fix for JIRA IOTS-79 --- .../resources/META-INF/maven/archetype-metadata.xml | 4 ++-- .../archetype-resources/component/analytics/pom.xml | 2 +- .../archetype-resources/component/controller/pom.xml | 2 +- .../controller/api/ControllerService.java | 12 +++--------- .../archetype-resources/component/manager/pom.xml | 2 +- .../archetype-resources/component/plugin/pom.xml | 8 ++++---- .../resources/archetype-resources/component/pom.xml | 2 +- .../archetype-resources/component/ui/pom.xml | 2 +- .../archetype-resources/feature/feature/pom.xml | 2 +- .../resources/archetype-resources/feature/pom.xml | 2 +- 10 files changed, 16 insertions(+), 22 deletions(-) diff --git a/modules/tools/cdmf-devicetype-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/modules/tools/cdmf-devicetype-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml index df8c0a31..d2cff1cb 100644 --- a/modules/tools/cdmf-devicetype-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/modules/tools/cdmf-devicetype-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -21,7 +21,7 @@ - + @@ -149,7 +149,7 @@ - + diff --git a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/analytics/pom.xml b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/analytics/pom.xml index 58302f07..c15ef204 100644 --- a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/analytics/pom.xml +++ b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/analytics/pom.xml @@ -19,7 +19,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> ${groupId} - component + ${rootArtifactId}-component ${version} ../pom.xml diff --git a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/controller/pom.xml b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/controller/pom.xml index ae62e9cc..28698904 100644 --- a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/controller/pom.xml +++ b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/controller/pom.xml @@ -19,7 +19,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> ${groupId} - component + ${rootArtifactId}-component ${version} ../pom.xml diff --git a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/controller/src/main/java/__groupId__/__rootArtifactId__/controller/api/ControllerService.java b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/controller/src/main/java/__groupId__/__rootArtifactId__/controller/api/ControllerService.java index 5238f257..52e657cd 100644 --- a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/controller/src/main/java/__groupId__/__rootArtifactId__/controller/api/ControllerService.java +++ b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/controller/src/main/java/__groupId__/__rootArtifactId__/controller/api/ControllerService.java @@ -142,15 +142,10 @@ public class ControllerService { @POST @Consumes(MediaType.APPLICATION_JSON) public void pushData(final DeviceJSON agentInfo, @Context HttpServletResponse response) { - String owner = agentInfo.owner; - String deviceId = agentInfo.deviceId; - float pinData = agentInfo.sensorValue; - log.warn(pinData); - log.warn(String.valueOf(pinData)); - if (!ServiceUtils.publishToDASSensorValue(agentInfo.owner, agentInfo.deviceId, pinData)) { + if (!ServiceUtils.publishToDASSensorValue(agentInfo.owner, agentInfo.deviceId, agentInfo.sensorValue)) { response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); - log.warn("An error occurred whilst trying to publish pin data of go Data with ID [" + deviceId + - "] of owner [" + owner + "]"); + log.warn("An error occurred whilst trying to publish pin data of go Data with ID [" + agentInfo.deviceId + + "] of owner [" + agentInfo.owner + "]"); } } @@ -170,7 +165,6 @@ public class ControllerService { @Context HttpServletResponse response) { try { mqttConnector.sendCommandViaMQTT(owner, deviceId, "Sensor:", state.toUpperCase()); - response.setStatus(Response.Status.OK.getStatusCode()); } catch (DeviceManagementException e) { log.error(e); diff --git a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/manager/pom.xml b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/manager/pom.xml index ee3bdf1d..8a137283 100644 --- a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/manager/pom.xml +++ b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/manager/pom.xml @@ -19,7 +19,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> ${groupId} - component + ${rootArtifactId}-component ${version} ../pom.xml diff --git a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/plugin/pom.xml b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/plugin/pom.xml index d1c942c9..145a5dd2 100644 --- a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/plugin/pom.xml +++ b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/plugin/pom.xml @@ -19,7 +19,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> ${groupId} - component + ${rootArtifactId}-component ${version} ../pom.xml @@ -56,7 +56,7 @@ ${artifactId} ${version} IoT Server Impl Bundle - ${groupId}.${rootArtifactId}.plugin.internal + ${project-base-package}.plugin.internal org.osgi.framework, org.osgi.service.component, @@ -73,8 +73,8 @@ org.wso2.carbon.device.mgt.iot.*, - !${groupId}.${rootArtifactId}.plugin.internal, - ${groupId}.${rootArtifactId}.plugin.* + !${project-base-package}.plugin.internal, + ${project-base-package}.plugin.* diff --git a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/pom.xml b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/pom.xml index 966cc1d2..020ee93d 100644 --- a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/pom.xml +++ b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/pom.xml @@ -25,7 +25,7 @@ 4.0.0 ${version} - ${artifactId} + ${rootArtifactId}-component pom diff --git a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/ui/pom.xml b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/ui/pom.xml index 8179af4e..405b95ba 100644 --- a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/ui/pom.xml +++ b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/component/ui/pom.xml @@ -21,7 +21,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> ${groupId} - component + ${rootArtifactId}-component ${version} ../pom.xml diff --git a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/feature/feature/pom.xml b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/feature/feature/pom.xml index e67eab67..4f97d376 100644 --- a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/feature/feature/pom.xml +++ b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/feature/feature/pom.xml @@ -19,7 +19,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> ${groupId} - feature + ${rootArtifactId}-feature ${version} ../pom.xml diff --git a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/feature/pom.xml b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/feature/pom.xml index 530e9007..cf0b704c 100644 --- a/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/feature/pom.xml +++ b/modules/tools/cdmf-devicetype-archetype/src/main/resources/archetype-resources/feature/pom.xml @@ -23,7 +23,7 @@ ${version} ../pom.xml - ${artifactId} + ${rootArtifactId}-feature 4.0.0 pom ${version} From 4c2eeb4b2abc89487d4e8eea7858e884e1b7ec95 Mon Sep 17 00:00:00 2001 From: GPrathap Date: Thu, 25 Feb 2016 23:52:21 +0530 Subject: [PATCH 2/3] Fix for JIRA IOTS-80 --- modules/samples/installer/device-deployer.xml | 7 +++--- .../tools/cdmf-devicetype-archetype/README.md | 24 ++++++++++++------- .../tools/cdmf-devicetype-archetype/pom.xml | 4 ++-- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/modules/samples/installer/device-deployer.xml b/modules/samples/installer/device-deployer.xml index 583a9282..efb3575e 100644 --- a/modules/samples/installer/device-deployer.xml +++ b/modules/samples/installer/device-deployer.xml @@ -32,7 +32,7 @@ http://wso2.org - + samples/connectedcup samples/currentsensor @@ -43,7 +43,6 @@ org.wso2.maven carbon-p2-plugin 1.5.3 - 2-p2-repo-generation @@ -59,7 +58,7 @@ - + org.wso2.carbon.devicemgt-plugins:org.coffeeking.connectedcup.feature:2.0.4-SNAPSHOT @@ -89,7 +88,7 @@ repository/components true - + org.coffeeking.connectedcup.feature.group 2.0.4-SNAPSHOT diff --git a/modules/tools/cdmf-devicetype-archetype/README.md b/modules/tools/cdmf-devicetype-archetype/README.md index c72d2e90..de25c9c9 100644 --- a/modules/tools/cdmf-devicetype-archetype/README.md +++ b/modules/tools/cdmf-devicetype-archetype/README.md @@ -1,16 +1,16 @@ # cdmf-devicetype-archetype To install this maven archetype - go to this folder cdmf-devicetype-archetype + go to this folder `cdmf-devicetype-archetype` mvn clean install To create new project - go to this folder /wso2iots-1.0.0-SNAPSHOT/samples + go to this folder `/wso2iots-1.0.0-SNAPSHOT/samples` mvn archetype:generate -DarchetypeCatalog=local -Then select the cdmf.devicetype:cdmf-devicetype-archetype as new archetype. Then you need to provide groupId, artifactId, +Then select the `cdmf.devicetype:cdmf-devicetype-archetype` as new archetype. Then you need to provide groupId, artifactId, version, packaging, name of your device type and name for sensor as shown bellow. Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 3 @@ -30,20 +30,28 @@ version, packaging, name of your device type and name for sensor as shown bellow To install sample app into IOTS - open '`device-deployer.xml` which is located in wso2iots-1.0.0-SNAPSHOT directory - Under featureArtifacts tag add feature artifact definition as below + open `device-deployer.xml` which is located in wso2iots-1.0.0-SNAPSHOT directory + +Under modules tag add name of sample which you created as module as below + + samples/safeLocker + +Under featureArtifacts tag add feature artifact definition as below org.homeautomation:org.homeautomation.safeLocker.feature:1.0.0-SNAPSHOT - Under features tag add feature group definition as below +Under features tag add feature group definition as below org.homeautomation.safeLocker.feature.group 1.0.0-SNAPSHOT - mvn clean install -f device-deployer.xml - +Finally to deploy sample device type into IoT Server + + mvn clean install -f device-deployer.xml + +Note: This command should be executed place where `device-deployer.xml` is located diff --git a/modules/tools/cdmf-devicetype-archetype/pom.xml b/modules/tools/cdmf-devicetype-archetype/pom.xml index d9255a41..4f4cbfb8 100644 --- a/modules/tools/cdmf-devicetype-archetype/pom.xml +++ b/modules/tools/cdmf-devicetype-archetype/pom.xml @@ -28,8 +28,8 @@ cdmf.devicetype cdmf-devicetype-archetype 1.0.0-SNAPSHOT - Archetype of WSO2 CDMF Device Type - Archetype of WSO2 CDMF Device Type + WSO2 CDMF Device Type Archetype + WSO2 CDMF Device Type Archetype maven-archetype WSO2 Inc. From 0a29e013567e29bb659cab816c32401529a89769 Mon Sep 17 00:00:00 2001 From: Geesara Prathap Date: Thu, 25 Feb 2016 23:57:26 +0530 Subject: [PATCH 3/3] Update README.md --- modules/tools/cdmf-devicetype-archetype/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/tools/cdmf-devicetype-archetype/README.md b/modules/tools/cdmf-devicetype-archetype/README.md index de25c9c9..8ee77d26 100644 --- a/modules/tools/cdmf-devicetype-archetype/README.md +++ b/modules/tools/cdmf-devicetype-archetype/README.md @@ -1,12 +1,14 @@ # cdmf-devicetype-archetype To install this maven archetype - go to this folder `cdmf-devicetype-archetype` + +go to this folder `cdmf-devicetype-archetype` mvn clean install To create new project - go to this folder `/wso2iots-1.0.0-SNAPSHOT/samples` + +go to this folder `/wso2iots-1.0.0-SNAPSHOT/samples` mvn archetype:generate -DarchetypeCatalog=local @@ -32,7 +34,7 @@ version, packaging, name of your device type and name for sensor as shown bellow To install sample app into IOTS open `device-deployer.xml` which is located in wso2iots-1.0.0-SNAPSHOT directory -Under modules tag add name of sample which you created as module as below +Under modules tag add name of sample which you created as module samples/safeLocker