removed plugin and added the deployer file for connected cup

application-manager-new
ayyoob 8 years ago
commit a4b8e81a56

@ -244,28 +244,20 @@ d <exclude name="**/shindig.properties" /
<exclude name="**/digitaldisplay/**" /> <exclude name="**/digitaldisplay/**" />
<exclude name="**/doormanager/**" /> <exclude name="**/doormanager/**" />
<exclude name="**/droneanalyzer/**" /> <exclude name="**/droneanalyzer/**" />
<exclude name="**/installer/**" /> <exclude name="**/connectedlap/**" />
<exclude name="**/firealarm/**" />
<exclude name="**/geolocationTracker/**" />
<exclude name="**/watertank/**" />
</fileset> </fileset>
</copy> </copy>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/" overwrite="true"> <!--<copy todir="target/wso2carbon-core-${carbon.kernel.version}/" overwrite="true">-->
<fileset dir="../samples/installer/"> <!--<fileset dir="../samples/installer/">-->
<exclude name="**/*.iml" /> <!--<exclude name="**/*.iml" />-->
<exclude name="**/.DS_Store" /> <!--<exclude name="**/.DS_Store" />-->
<exclude name="**/target/" /> <!--<exclude name="**/target/" />-->
</fileset> <!--</fileset>-->
</copy> <!--</copy>-->
<!--<copy todir="target/wso2carbon-core-${carbon.kernel.version}/modules" overwrite="true">
<fileset dir="src/repository/modules"></fileset>
</copy>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/jaggeryapps" overwrite="true">
<fileset dir="../apps"></fileset>
</copy>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins" overwrite="true">
<fileset dir="src/repository/components/patches/apimgt"></fileset>
</copy>-->
</tasks> </tasks>
</configuration> </configuration>

@ -1272,6 +1272,7 @@
<file> <file>
<source>src/samples-deployer.xml</source> <source>src/samples-deployer.xml</source>
<outputDirectory>${pom.artifactId}-${pom.version}/</outputDirectory> <outputDirectory>${pom.artifactId}-${pom.version}/</outputDirectory>
<filtered>true</filtered>
</file> </file>
<!-- Copying webapp-publisher-config.xml --> <!-- Copying webapp-publisher-config.xml -->
<file> <file>

@ -35,5 +35,23 @@
<exclude>features/**</exclude> <exclude>features/**</exclude>
</excludes> </excludes>
</fileSet> </fileSet>
<fileSet>
<directory>../samples</directory>
<outputDirectory>${pom.artifactId}-${pom.version}/samples</outputDirectory>
<excludes>
<exclude>**/*.iml</exclude>
<exclude>**/.DS_Store</exclude>
<exclude>**/target/</exclude>
<exclude>**/currentsensor/**</exclude>
<exclude>**/digitaldisplay/**</exclude>
<exclude>**/doormanager/**</exclude>
<exclude>**/droneanalyzer/**</exclude>
<exclude>**/connectedlap/**</exclude>
<exclude>**/firealarm/**</exclude>
<exclude>**/geolocationTracker/**</exclude>
<exclude>**/watertank/**</exclude>
</excludes>
<filtered>true</filtered>
</fileSet>
</fileSets> </fileSets>
</assembly> </assembly>

@ -25,3 +25,5 @@ carbon.version=4.4.9
default.server.role=IoTServer default.server.role=IoTServer
cep.server.role=ComplexEventProcessor cep.server.role=ComplexEventProcessor
das.server.role=DataAnalyticsServer das.server.role=DataAnalyticsServer
devicetype.plugins.version=2.2.5-SNAPSHOT
cdm.version=1.2.6-SNAPSHOT

@ -27,7 +27,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.iot.devicemgt-plugins</groupId> <groupId>org.wso2.iot.devicemgt-plugins</groupId>
<artifactId>iot-devicetype-feature-installation</artifactId> <artifactId>iot-devicetype-feature-installation</artifactId>
<version>1.0.0</version> <version>${product.version}</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Creating custom distribution</name> <name>Creating custom distribution</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
@ -184,10 +184,6 @@
</plugins> </plugins>
</build> </build>
<properties>
<carbon.device.mgt.plugin.version>2.2.4-SNAPSHOT</carbon.device.mgt.plugin.version>
</properties>
<pluginRepositories> <pluginRepositories>
<pluginRepository> <pluginRepository>
<id>wso2.releases</id> <id>wso2.releases</id>

@ -150,7 +150,7 @@
<!-- IoT Device Management Features --> <!-- IoT Device Management Features -->
<featureArtifactDef> <featureArtifactDef>
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.feature:${carbon.device.mgt.plugin.version} org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.url.printer.feature:${carbon.device.mgt.plugin.version}
</featureArtifactDef> </featureArtifactDef>
<featureArtifactDef> <featureArtifactDef>
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.adapter.feature:${carbon.device.mgt.plugin.version} org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.adapter.feature:${carbon.device.mgt.plugin.version}
@ -905,7 +905,7 @@
<!-- End of Device Management Features --> <!-- End of Device Management Features -->
<feature> <feature>
<id>org.wso2.carbon.device.mgt.iot.feature.group</id> <id>org.wso2.carbon.device.mgt.iot.url.printer.feature.group</id>
<version>${carbon.device.mgt.plugin.version}</version> <version>${carbon.device.mgt.plugin.version}</version>
</feature> </feature>
<feature> <feature>
@ -2608,7 +2608,7 @@
<!-- End of Device Management Features --> <!-- End of Device Management Features -->
<feature> <feature>
<id>org.wso2.carbon.device.mgt.iot.feature.group</id> <id>org.wso2.carbon.device.mgt.iot.url.printer.feature.group</id>
<version>${carbon.device.mgt.plugin.version}</version> <version>${carbon.device.mgt.plugin.version}</version>
</feature> </feature>
<feature> <feature>
@ -3156,7 +3156,7 @@
<!-- End of Device Management Features --> <!-- End of Device Management Features -->
<feature> <feature>
<id>org.wso2.carbon.device.mgt.iot.feature.group</id> <id>org.wso2.carbon.device.mgt.iot.url.printer.feature.group</id>
<version>${carbon.device.mgt.plugin.version}</version> <version>${carbon.device.mgt.plugin.version}</version>
</feature> </feature>
<feature> <feature>

@ -71,13 +71,6 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!--MQTT -->
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<scope>provided</scope>
</dependency>
<!--IOT --> <!--IOT -->
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
@ -85,16 +78,6 @@
<version>4.1</version> <version>4.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.coffeeking</groupId>
<artifactId>org.coffeeking.connectedcup.plugin</artifactId>
<scope>provided</scope>
</dependency>
<!--JAX-RS --> <!--JAX-RS -->
<dependency> <dependency>
@ -116,11 +99,6 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher</artifactId>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId> <artifactId>org.wso2.carbon.apimgt.annotations</artifactId>

@ -39,7 +39,7 @@ public interface ConnectedCupService {
@Path("device/ordercoffee") @Path("device/ordercoffee")
@POST @POST
@Feature(code = "ordercoffee", name = "Order Coffee", description = "Order coffee cup") @Feature(code = "ordercoffee", name = "Order Coffee", description = "Order coffee cup")
@Permission(scope = "connectedcup_user", permissions = {"/permission/admin/device-mgt/user/operations"}) //@Permission(scope = "connectedcup_user", permissions = {"/permission/admin/device-mgt/user/operations"})
Response orderCoffee(@QueryParam("deviceId") String deviceId); Response orderCoffee(@QueryParam("deviceId") String deviceId);
/** /**
@ -49,13 +49,13 @@ public interface ConnectedCupService {
@GET @GET
@Consumes("application/json") @Consumes("application/json")
@Produces("application/json") @Produces("application/json")
@Permission(scope = "connectedcup_user", permissions = {"/permission/admin/device-mgt/user/stats"}) //@Permission(scope = "connectedcup_user", permissions = {"/permission/admin/device-mgt/user/stats"})
Response getDeviceStats(@PathParam("deviceId") String deviceId, @PathParam("sensorName") String sensor, Response getDeviceStats(@PathParam("deviceId") String deviceId, @PathParam("sensorName") String sensor,
@QueryParam("from") long from, @QueryParam("to") long to); @QueryParam("from") long from, @QueryParam("to") long to);
@Path("device/register") @Path("device/register")
@POST @POST
@Permission(scope = "connectedcup_user", permissions = {"/permission/admin/device-mgt/user/devices"}) //@Permission(scope = "connectedcup_user", permissions = {"/permission/admin/device-mgt/user/devices"})
boolean register(@QueryParam("name") String name); boolean register(@QueryParam("name") String name);
} }

@ -20,11 +20,11 @@ package org.coffeeking.api;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.coffeeking.api.constants.ConnectedCupConstants;
import org.coffeeking.api.util.APIUtil; import org.coffeeking.api.util.APIUtil;
import org.coffeeking.api.util.SensorRecord; import org.coffeeking.api.util.SensorRecord;
import org.coffeeking.connectedcup.plugin.constants.ConnectedCupConstants;
import org.wso2.carbon.analytics.dataservice.commons.SORT;
import org.wso2.carbon.analytics.dataservice.commons.SortByField; import org.wso2.carbon.analytics.dataservice.commons.SortByField;
import org.wso2.carbon.analytics.dataservice.commons.SortType;
import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
@ -98,7 +98,7 @@ public class ConnectedCupServiceImpl implements ConnectedCupService {
} }
List<SensorRecord> sensorDatas; List<SensorRecord> sensorDatas;
List<SortByField> sortByFields = new ArrayList<>(); List<SortByField> sortByFields = new ArrayList<>();
SortByField sortByField = new SortByField("time", SORT.ASC, false); SortByField sortByField = new SortByField("time", SortType.ASC);
sortByFields.add(sortByField); sortByFields.add(sortByField);
sensorDatas = APIUtil.getAllEventsForDevice(sensorTableName, query, sortByFields); sensorDatas = APIUtil.getAllEventsForDevice(sensorTableName, query, sortByFields);
return Response.ok().entity(sensorDatas).build(); return Response.ok().entity(sensorDatas).build();

@ -15,7 +15,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.coffeeking.connectedcup.plugin.constants; package org.coffeeking.api.constants;
public class ConnectedCupConstants { public class ConnectedCupConstants {

@ -1,122 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. 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>
<artifactId>device-mgt-iot-connectedcup</artifactId>
<groupId>org.coffeeking</groupId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.coffeeking.connectedcup.plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 IoTS(Device Types) - Connected Cup CDMF Plugin</name>
<description>WSO2 IoTS(Device Types) - Connected Cup CDMF Plugin</description>
<url>http://wso2.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.device.mgt.plugin.version}</Bundle-Version>
<Bundle-Description>IoT Server Impl Bundle</Bundle-Description>
<Private-Package>org.coffeeking.connectedcup.plugin.internal</Private-Package>
<Import-Package>
org.osgi.framework,
org.osgi.service.component,
org.apache.commons.logging,
javax.xml.bind.*;resolution:=optional,
javax.naming;resolution:=optional,
javax.sql;resolution:=optional,
javax.xml.bind.annotation.*;resolution:=optional,
javax.net;resolution:=optional,
javax.net.ssl;resolution:=optional,
org.w3c.dom;resolution:=optional,
org.wso2.carbon.device.mgt.common.*,
org.wso2.carbon.device.mgt.common,
org.wso2.carbon.context.*,
org.wso2.carbon.ndatasource.core,
org.wso2.carbon.device.mgt.iot.*,
javax.xml.parsers.*;resolution:=optional
</Import-Package>
<Export-Package>
!org.coffeeking.connectedcup.plugin.internal,
org.coffeeking.connectedcup.plugin.*
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.ndatasource.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot</artifactId>
</dependency>
</dependencies>
</project>

@ -1,42 +0,0 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.coffeeking.connectedcup.plugin.exception;
public class ConnectedCupDeviceMgtPluginException extends Exception {
public ConnectedCupDeviceMgtPluginException(String msg, Exception nestedEx) {
super(msg, nestedEx);
}
public ConnectedCupDeviceMgtPluginException(String message, Throwable cause) {
super(message, cause);
}
public ConnectedCupDeviceMgtPluginException(String msg) {
super(msg);
}
public ConnectedCupDeviceMgtPluginException() {
super();
}
public ConnectedCupDeviceMgtPluginException(Throwable cause) {
super(cause);
}
}

@ -1,258 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.coffeeking.connectedcup.plugin.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.coffeeking.connectedcup.plugin.exception.ConnectedCupDeviceMgtPluginException;
import org.coffeeking.connectedcup.plugin.impl.dao.ConnectedCupDAOUtil;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import java.util.List;
/**
*
*/
public class ConnectedCupManager implements DeviceManager {
private static final Log log = LogFactory.getLog(ConnectedCupManager.class);
private static final ConnectedCupDAOUtil CONNECTED_CUP_DAO_UTIL = new ConnectedCupDAOUtil();
@Override
public FeatureManager getFeatureManager() {
return null;
}
@Override
public boolean saveConfiguration(TenantConfiguration tenantConfiguration)
throws DeviceManagementException {
//TODO implement this
return false;
}
@Override
public TenantConfiguration getConfiguration() throws DeviceManagementException {
//TODO implement this
return null;
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
boolean status;
try {
if (log.isDebugEnabled()) {
log.debug("Enrolling a new Connected Cup device : " + device.getDeviceIdentifier());
}
ConnectedCupDAOUtil.beginTransaction();
status = CONNECTED_CUP_DAO_UTIL.getConnectedCupDeviceDAO().addDevice(device);
ConnectedCupDAOUtil.commitTransaction();
} catch (ConnectedCupDeviceMgtPluginException e) {
try {
ConnectedCupDAOUtil.rollbackTransaction();
} catch (ConnectedCupDeviceMgtPluginException iotDAOEx) {
String msg = "Error occurred while roll back the device enrol transaction :" + device.toString();
log.warn(msg, iotDAOEx);
}
String msg = "Error while enrolling the Connected Cup device : " + device.getDeviceIdentifier();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return status;
}
@Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
boolean status;
try {
if (log.isDebugEnabled()) {
log.debug("Modifying the Connected Cup device enrollment data");
}
ConnectedCupDAOUtil.beginTransaction();
status = CONNECTED_CUP_DAO_UTIL.getConnectedCupDeviceDAO().updateDevice(device);
ConnectedCupDAOUtil.commitTransaction();
} catch (ConnectedCupDeviceMgtPluginException e) {
try {
ConnectedCupDAOUtil.rollbackTransaction();
} catch (ConnectedCupDeviceMgtPluginException iotDAOEx) {
String msg = "Error occurred while roll back the update device transaction :" + device.toString();
log.warn(msg, iotDAOEx);
}
String msg = "Error while updating the enrollment of the Connected Cup device : " +
device.getDeviceIdentifier();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return status;
}
@Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
boolean status;
try {
if (log.isDebugEnabled()) {
log.debug("Dis-enrolling Connected Cup device : " + deviceId);
}
ConnectedCupDAOUtil.beginTransaction();
status = CONNECTED_CUP_DAO_UTIL.getConnectedCupDeviceDAO().deleteDevice(deviceId.getId());
ConnectedCupDAOUtil.commitTransaction();
} catch (ConnectedCupDeviceMgtPluginException e) {
try {
ConnectedCupDAOUtil.rollbackTransaction();
} catch (ConnectedCupDeviceMgtPluginException iotDAOEx) {
String msg = "Error occurred while roll back the device dis enrol transaction :" + deviceId.toString();
log.warn(msg, iotDAOEx);
}
String msg = "Error while removing the Connected Cup device : " + deviceId.getId();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return status;
}
@Override
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
boolean isEnrolled = false;
try {
if (log.isDebugEnabled()) {
log.debug("Checking the enrollment of Connected Cup device : " + deviceId.getId());
}
Device iotDevice = CONNECTED_CUP_DAO_UTIL.getConnectedCupDeviceDAO().getDevice(deviceId.getId());
if (iotDevice != null) {
isEnrolled = true;
}
} catch (ConnectedCupDeviceMgtPluginException e) {
String msg = "Error while checking the enrollment status of Connected Cup device : " +
deviceId.getId();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return isEnrolled;
}
@Override
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
return true;
}
@Override
public boolean setActive(DeviceIdentifier deviceId, boolean status)
throws DeviceManagementException {
return true;
}
@Override
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
Device device;
try {if (log.isDebugEnabled()) {
log.debug("Getting the details of Connected Cup device : " + deviceId.getId());
}
device = CONNECTED_CUP_DAO_UTIL.getConnectedCupDeviceDAO().getDevice(deviceId.getId());
} catch (ConnectedCupDeviceMgtPluginException e) {
String msg = "Error while fetching the Connected Cup device : " + deviceId.getId();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return device;
}
@Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
throws DeviceManagementException {
return true;
}
public boolean isClaimable(DeviceIdentifier deviceIdentifier) throws DeviceManagementException {
return false;
}
@Override
public boolean setStatus(DeviceIdentifier deviceId, String currentOwner,
EnrolmentInfo.Status status) throws DeviceManagementException {
return false;
}
@Override
public License getLicense(String s) throws LicenseManagementException {
return null;
}
@Override
public void addLicense(License license) throws LicenseManagementException {
}
@Override
public boolean requireDeviceAuthorization() {
return false;
}
@Override
public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException {
boolean status;
try {
if (log.isDebugEnabled()) {
log.debug(
"updating the details of Connected Cup device : " + deviceIdentifier);
}
ConnectedCupDAOUtil.beginTransaction();
status = CONNECTED_CUP_DAO_UTIL.getConnectedCupDeviceDAO().updateDevice(device);
ConnectedCupDAOUtil.commitTransaction();
} catch (ConnectedCupDeviceMgtPluginException e) {
try {
ConnectedCupDAOUtil.rollbackTransaction();
} catch (ConnectedCupDeviceMgtPluginException iotDAOEx) {
String msg = "Error occurred while roll back the update device info transaction :" + device.toString();
log.warn(msg, iotDAOEx);
}
String msg =
"Error while updating the Connected Cup device : " + deviceIdentifier;
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return status;
}
@Override
public List<Device> getAllDevices() throws DeviceManagementException {
List<Device> devices = null;
try {
if (log.isDebugEnabled()) {
log.debug("Fetching the details of all Connected Cup devices");
}
devices = CONNECTED_CUP_DAO_UTIL.getConnectedCupDeviceDAO().getAllDevices();
} catch (ConnectedCupDeviceMgtPluginException e) {
String msg = "Error while fetching all Connected Cup devices.";
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return devices;
}
}

@ -1,68 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.coffeeking.connectedcup.plugin.impl;
import org.coffeeking.connectedcup.plugin.constants.ConnectedCupConstants;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import java.util.List;
public class ConnectedCupManagerService implements DeviceManagementService{
private DeviceManager deviceManager;
@Override
public String getType() {
return ConnectedCupConstants.DEVICE_TYPE;
}
@Override
public void init() throws DeviceManagementException {
this.deviceManager=new ConnectedCupManager();
}
@Override
public DeviceManager getDeviceManager() {
return deviceManager;
}
@Override
public ApplicationManager getApplicationManager() {
return null;
}
@Override
public ProvisioningConfig getProvisioningConfig() {
return new ProvisioningConfig("carbon.super", false);
}
@Override
public PushNotificationConfig getPushNotificationConfig() {
return null;
}
}

@ -1,204 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.coffeeking.connectedcup.plugin.impl.dao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.coffeeking.connectedcup.plugin.constants.ConnectedCupConstants;
import org.coffeeking.connectedcup.plugin.exception.ConnectedCupDeviceMgtPluginException;
import org.coffeeking.connectedcup.plugin.impl.dao.util.ConnectedCupUtils;
import org.wso2.carbon.device.mgt.common.Device;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* Device Dao for connected cup Devices.
*/
public class ConnectedCupDAO {
private static final Log log = LogFactory.getLog(ConnectedCupDAO.class);
public Device getDevice(String deviceId) throws ConnectedCupDeviceMgtPluginException {
Connection conn = null;
PreparedStatement stmt = null;
Device connectedCupDevice = null;
ResultSet resultSet = null;
try {
conn = ConnectedCupDAOUtil.getConnection();
String selectDBQuery =
"SELECT CONNECTED_CUP_DEVICE_ID, DEVICE_NAME FROM CONNECTED_CUP_DEVICE WHERE CONNECTED_CUP_DEVICE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, deviceId);
resultSet = stmt.executeQuery();
if (resultSet.next()) {
connectedCupDevice = new Device();
connectedCupDevice.setName(resultSet.getString(ConnectedCupConstants.DEVICE_PLUGIN_DEVICE_NAME));
if (log.isDebugEnabled()) {
log.debug("Connected Cup service " + deviceId + " data has been fetched from" +
"Connected Cup database.");
}
}
} catch (SQLException e) {
String msg = "Error occurred while fetching Connected Cup device : '" + deviceId + "'";
log.error(msg, e);
throw new ConnectedCupDeviceMgtPluginException(msg, e);
} finally {
ConnectedCupUtils.cleanupResources(stmt, resultSet);
ConnectedCupDAOUtil.closeConnection();
}
return connectedCupDevice;
}
public boolean addDevice(Device connectedCupDevice) throws ConnectedCupDeviceMgtPluginException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = ConnectedCupDAOUtil.getConnection();
String createDBQuery =
"INSERT INTO CONNECTED_CUP_DEVICE(CONNECTED_CUP_DEVICE_ID, DEVICE_NAME ) VALUES (?, ?)";
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, connectedCupDevice.getDeviceIdentifier());
stmt.setString(2, connectedCupDevice.getName());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
if (log.isDebugEnabled()) {
log.debug("Connected Cup device " + connectedCupDevice.getDeviceIdentifier() +
" data has been added to the Connected Cup database.");
}
}
} catch (SQLException e) {
String msg = "Error occurred while adding the Connected Cup device '" +
connectedCupDevice.getDeviceIdentifier() + "' to the Connected Cup db.";
log.error(msg, e);
throw new ConnectedCupDeviceMgtPluginException(msg, e);
} finally {
ConnectedCupUtils.cleanupResources(stmt, null);
}
return status;
}
public boolean updateDevice(Device connectedCupDevice) throws ConnectedCupDeviceMgtPluginException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = ConnectedCupDAOUtil.getConnection();
String updateDBQuery =
"UPDATE CONNECTED_CUP_DEVICE SET DEVICE_NAME = ? WHERE CONNECTED_CUP_DEVICE_ID = ?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, connectedCupDevice.getName());
stmt.setString(2, connectedCupDevice.getDeviceIdentifier());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
if (log.isDebugEnabled()) {
log.debug("Connected Cup device " + connectedCupDevice.getDeviceIdentifier() +
" data has been modified.");
}
}
} catch (SQLException e) {
String msg = "Error occurred while modifying the Connected Cup device '" +
connectedCupDevice.getDeviceIdentifier() + "' data.";
log.error(msg, e);
throw new ConnectedCupDeviceMgtPluginException(msg, e);
} finally {
ConnectedCupUtils.cleanupResources(stmt, null);
}
return status;
}
public boolean deleteDevice(String deviceId) throws ConnectedCupDeviceMgtPluginException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = ConnectedCupDAOUtil.getConnection();
String deleteDBQuery =
"DELETE FROM CONNECTED_CUP_DEVICE WHERE CONNECTED_CUP_DEVICE_ID = ?";
stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, deviceId);
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
if (log.isDebugEnabled()) {
log.debug("Connected Cup device " + deviceId + " data has deleted" +
" from the Connected Cup database.");
}
}
} catch (SQLException e) {
String msg = "Error occurred while deleting Connected Cup device " + deviceId;
log.error(msg, e);
throw new ConnectedCupDeviceMgtPluginException(msg, e);
} finally {
ConnectedCupUtils.cleanupResources(stmt, null);
}
return status;
}
public List<Device> getAllDevices() throws ConnectedCupDeviceMgtPluginException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet resultSet = null;
Device connectedCupDevice;
List<Device> iotDevices = new ArrayList<>();
try {
conn = ConnectedCupDAOUtil.getConnection();
String selectDBQuery =
"SELECT CONNECTED_CUP_DEVICE_ID, DEVICE_NAME" +
"FROM CONNECTED_CUP_DEVICE";
stmt = conn.prepareStatement(selectDBQuery);
resultSet = stmt.executeQuery();
while (resultSet.next()) {
connectedCupDevice = new Device();
connectedCupDevice.setDeviceIdentifier(resultSet.getString(
ConnectedCupConstants.DEVICE_PLUGIN_DEVICE_ID));
connectedCupDevice.setName(resultSet.getString(
ConnectedCupConstants.DEVICE_PLUGIN_DEVICE_NAME));
}
if (log.isDebugEnabled()) {
log.debug("All Connected Cup device details have fetched from Connected Cup database" +
".");
}
return iotDevices;
} catch (SQLException e) {
String msg = "Error occurred while fetching all Connected Cup device data'";
log.error(msg, e);
throw new ConnectedCupDeviceMgtPluginException(msg, e);
} finally {
ConnectedCupUtils.cleanupResources(stmt, resultSet);
ConnectedCupDAOUtil.closeConnection();
}
}
}

@ -1,132 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.coffeeking.connectedcup.plugin.impl.dao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.coffeeking.connectedcup.plugin.constants.ConnectedCupConstants;
import org.coffeeking.connectedcup.plugin.exception.ConnectedCupDeviceMgtPluginException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
public class ConnectedCupDAOUtil {
private static final Log log = LogFactory.getLog(ConnectedCupDAOUtil.class);
static DataSource dataSource;
private static ThreadLocal<Connection> currentConnection = new ThreadLocal<Connection>();
public ConnectedCupDAOUtil() {
initConnectedCupDAO();
}
public static void initConnectedCupDAO() {
try {
Context ctx = new InitialContext();
dataSource = (DataSource) ctx.lookup(ConnectedCupConstants.DATA_SOURCE_NAME);
} catch (NamingException e) {
log.error("Error while looking up the data source: " +
ConnectedCupConstants.DATA_SOURCE_NAME);
}
}
public ConnectedCupDAO getConnectedCupDeviceDAO() {
return new ConnectedCupDAO();
}
public static void beginTransaction() throws ConnectedCupDeviceMgtPluginException {
try {
Connection conn = dataSource.getConnection();
conn.setAutoCommit(false);
currentConnection.set(conn);
} catch (SQLException e) {
throw new ConnectedCupDeviceMgtPluginException(
"Error occurred while retrieving datasource connection", e);
}
}
public static Connection getConnection() throws ConnectedCupDeviceMgtPluginException {
if (currentConnection.get() == null) {
try {
currentConnection.set(dataSource.getConnection());
} catch (SQLException e) {
throw new ConnectedCupDeviceMgtPluginException(
"Error occurred while retrieving data source connection", e);
}
}
return currentConnection.get();
}
public static void commitTransaction() throws ConnectedCupDeviceMgtPluginException {
try {
Connection conn = currentConnection.get();
if (conn != null) {
conn.commit();
} else {
if (log.isDebugEnabled()) {
log.debug("Datasource connection associated with the current thread is null, " +
"hence commit has not been attempted");
}
}
} catch (SQLException e) {
throw new ConnectedCupDeviceMgtPluginException(
"Error occurred while committing the transaction", e);
} finally {
closeConnection();
}
}
public static void closeConnection() throws ConnectedCupDeviceMgtPluginException {
Connection con = currentConnection.get();
if (con != null) {
try {
con.close();
} catch (SQLException e) {
log.error("Error occurred while close the connection");
}
}
currentConnection.remove();
}
public static void rollbackTransaction() throws ConnectedCupDeviceMgtPluginException {
try {
Connection conn = currentConnection.get();
if (conn != null) {
conn.rollback();
} else {
if (log.isDebugEnabled()) {
log.debug(
"Datasource connection associated with the current thread is null, " +
"hence rollback has not been attempted");
}
}
} catch (SQLException e) {
throw new ConnectedCupDeviceMgtPluginException("Error occurred while rollback the transaction", e);
} finally {
closeConnection();
}
}
}

@ -1,88 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.coffeeking.connectedcup.plugin.impl.dao.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.Device;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
/**
* Contains utility methods used by FireAlarm plugin.
*/
public class ConnectedCupUtils {
private static Log log = LogFactory.getLog(ConnectedCupUtils.class);
public static String getDeviceProperty(List<Device.Property> deviceProperties, String propertyKey) {
String deviceProperty = "";
for (Device.Property property : deviceProperties) {
if (propertyKey.equals(property.getName())) {
deviceProperty = property.getValue();
}
}
return deviceProperty;
}
public static Device.Property getProperty(String property, String value) {
if (property != null) {
Device.Property prop = new Device.Property();
prop.setName(property);
prop.setValue(value);
return prop;
}
return null;
}
public static void cleanupResources(Connection conn, PreparedStatement stmt, ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
log.warn("Error occurred while closing result set", e);
}
}
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
log.warn("Error occurred while closing prepared statement", e);
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
log.warn("Error occurred while closing database connection", e);
}
}
}
public static void cleanupResources(PreparedStatement stmt, ResultSet rs) {
cleanupResources(null, stmt, rs);
}
}

@ -1,74 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.coffeeking.connectedcup.plugin.internal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.coffeeking.connectedcup.plugin.impl.ConnectedCupManagerService;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
/**
* @scr.component name="org.coffeeking.connectedcup.plugin.internal
* .ConnectedCupServiceComponent"
* immediate="true"
*/
public class ConnectedCupServiceComponent {
private static final Log log = LogFactory.getLog(ConnectedCupServiceComponent.class);
private ServiceRegistration connectedCupServiceRegRef;
protected void activate(ComponentContext ctx) {
if (log.isDebugEnabled()) {
log.debug("Activating Connected Cup Service Component");
}
try {
BundleContext bundleContext = ctx.getBundleContext();
connectedCupServiceRegRef =
bundleContext.registerService(DeviceManagementService.class.getName(),
new ConnectedCupManagerService(), null);
if (log.isDebugEnabled()) {
log.debug("Connected Cup Service Component has been successfully activated");
}
} catch (Throwable e) {
log.error("Error occurred while activating Connected Cup Service Component", e);
}
}
protected void deactivate(ComponentContext ctx) {
if (log.isDebugEnabled()) {
log.debug("De-activating Connected Cup Service Component");
}
try {
if (connectedCupServiceRegRef != null) {
connectedCupServiceRegRef.unregister();
}
if (log.isDebugEnabled()) {
log.debug("Connected Cup Service Component has been successfully de-activated");
}
} catch (Throwable e) {
log.error("Error occurred while de-activating Connected Cup Service Component", e);
}
}
}

@ -38,7 +38,6 @@
<modules> <modules>
<module>analytics</module> <module>analytics</module>
<module>plugin</module>
<module>api</module> <module>api</module>
<module>agent</module> <module>agent</module>
<module>ui</module> <module>ui</module>

@ -38,11 +38,6 @@
<url>http://wso2.org</url> <url>http://wso2.org</url>
<dependencies> <dependencies>
<dependency>
<groupId>org.coffeeking</groupId>
<artifactId>org.coffeeking.connectedcup.plugin</artifactId>
<version>${wso2.iot.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.coffeeking</groupId> <groupId>org.coffeeking</groupId>
<artifactId>org.coffeeking.connectedcup.api</artifactId> <artifactId>org.coffeeking.connectedcup.api</artifactId>
@ -55,11 +50,6 @@
<version>${wso2.iot.version}</version> <version>${wso2.iot.version}</version>
<type>war</type> <type>war</type>
</dependency> </dependency>
<dependency>
<groupId>com.h2database.wso2</groupId>
<artifactId>h2-database-engine</artifactId>
<version>1.2.140.wso2v3</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -158,46 +148,6 @@
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<!-- Creating Connected Cup Plugin Management schema -->
<id>create-connected-cup-plugin-mgt-schema</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo
message="########### Create Connected Cup plugin Management H2 Schema ###########"/>
<property name="db.dir"
value="target/maven-shared-archive-resources/database"/>
<property name="userid" value="wso2carbon"/>
<property name="password" value="wso2carbon"/>
<property name="dbURL"
value="jdbc:h2:file:${basedir}/${db.dir}/ConnectedCupDM_DB;DB_CLOSE_ON_EXIT=FALSE"/>
<mkdir dir="${basedir}/${db.dir}"/>
<sql driver="org.h2.Driver" url="${dbURL}" userid="${userid}"
password="${password}"
autocommit="true" onerror="continue">
<classpath refid="maven.dependency.classpath"/>
<classpath refid="maven.compile.classpath"/>
<classpath refid="maven.runtime.classpath"/>
<fileset file="${basedir}/src/main/resources/dbscripts/h2.sql"/>
</sql>
<echo message="##################### END ####################"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.wso2.maven</groupId> <groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId> <artifactId>carbon-p2-plugin</artifactId>
@ -217,11 +167,6 @@
<propertyDef>org.eclipse.equinox.p2.type.group:true</propertyDef> <propertyDef>org.eclipse.equinox.p2.type.group:true</propertyDef>
</properties> </properties>
</adviceFile> </adviceFile>
<bundles>
<bundleDef>
org.coffeeking:org.coffeeking.connectedcup.plugin:${wso2.iot.version}
</bundleDef>
</bundles>
<importFeatures> <importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version} <importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}
</importFeatureDef> </importFeatureDef>

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. 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.
-->
<DeviceTypeConfigurations>
<DeviceTypeConfig type="connectedcup">
<DatasourceName>jdbc/ConnectedCupDM_DB</DatasourceName>
<!--ApiApplicationName>firealarm</ApiApplicationName-->
</DeviceTypeConfig>
</DeviceTypeConfigurations>

@ -1,46 +0,0 @@
<!--
~ Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. 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.
-->
<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
<providers>
<provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
</providers>
<datasources>
<datasource>
<name>ConnectedCupDM_DB</name>
<description>The datasource used for the Connected Cup database</description>
<jndiConfig>
<name>jdbc/ConnectedCupDM_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:h2:repository/database/ConnectedCupDM_DB;DB_CLOSE_ON_EXIT=FALSE
</url>
<username>wso2carbon</username>
<password>wso2carbon</password>
<driverClassName>org.h2.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>
</datasources>
</datasources-configuration>

@ -1,11 +0,0 @@
-- -----------------------------------------------------
-- Table `CONNECTED_CUP_DEVICE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `CONNECTED_CUP_DEVICE` (
`CONNECTED_CUP_DEVICE_ID` VARCHAR(45) NOT NULL ,
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (`CONNECTED_CUP_DEVICE_ID`) );

@ -1,12 +0,0 @@
-- -----------------------------------------------------
-- Table `CONNECTED_CUP_DEVICE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `CONNECTED_CUP_DEVICE` (
`CONNECTED_CUP_DEVICE_ID` VARCHAR(45) NOT NULL ,
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
PRIMARY KEY (`CONNECTED_CUP_DEVICE_ID`) )
ENGINE = InnoDB;

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. 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.
-->
<DeviceManagementConfiguration>
<DeviceType>connectedcup</DeviceType>
<ManagementRepository>
<DeviceDefinition>
<License>
<Language>en_US</Language>
<Version>1.0.0</Version>
<Text>This is license text</Text>
</License>
<!--if generate is set to true then the feature information will be picked up from the annotation in the api-->
<Features generate="true"/>
</DeviceDefinition>
<ProvisioningConfig>
<SharedWithAllTenants>false</SharedWithAllTenants>
</ProvisioningConfig>
</ManagementRepository>
</DeviceManagementConfiguration>

@ -1,26 +1,18 @@
instructions.configure = \ instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../conf/device-types/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.coffeeking.connectedcup_${feature.version}/configs/,target:${installFolder}/../../conf/device-types/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.coffeeking.connectedcup_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.coffeeking.connectedcup_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/carbonapps/);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/carbonapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.coffeeking.connectedcup_${feature.version}/carbonapps/,target:${installFolder}/../../deployment/server/carbonapps/,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.coffeeking.connectedcup_${feature.version}/carbonapps/,target:${installFolder}/../../deployment/server/carbonapps/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.coffeeking.connectedcup_${feature.version}/dbscripts/,target:${installFolder}/../../../dbscripts/cdm/plugins/connectedcup,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.coffeeking.connectedcup_${feature.version}/datasources/,target:${installFolder}/../../conf/datasources/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.coffeeking.connectedcup_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.coffeeking.connectedcup_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../database/);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/devicetypes/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.coffeeking.connectedcup_${feature.version}/database/,target:${installFolder}/../../database/,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.connectedcup_${feature.version}/devicetypes/,target:${installFolder}/../../deployment/server/devicetypes/,overwrite:true);\
instructions.unconfigure = \ instructions.unconfigure = \
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../conf/device-types/connectedcup.xml);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/connectedcup.war);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/connectedcup.war);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/connected-cup-agent.war);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/connected-cup-agent.war);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/connectedcup);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/connectedcup);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/connected-cup-agent);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/connected-cup-agent);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/cdm/plugins/connectedcup);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../conf/datasources/connectedcup-datasources.xml);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/ConnectedCupDM_DB.h2.db);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.device-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.type-view);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.type-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.analytics-view);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.analytics-view);\

@ -135,12 +135,6 @@
<version>4.1</version> <version>4.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.coffeeking</groupId>
<artifactId>org.coffeeking.connectedcup.plugin</artifactId>
<version>${wso2.iot.version}</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId> <artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
@ -372,8 +366,8 @@
<carbon.kernel.version>4.4.3</carbon.kernel.version> <carbon.kernel.version>4.4.3</carbon.kernel.version>
<!-- Carbon Device Management --> <!-- Carbon Device Management -->
<carbon.device.mgt.version>1.2.3-SNAPSHOT</carbon.device.mgt.version> <carbon.device.mgt.version>1.2.6-SNAPSHOT</carbon.device.mgt.version>
<carbon.device.mgt.plugin.version>2.2.3-SNAPSHOT</carbon.device.mgt.plugin.version> <carbon.device.mgt.plugin.version>2.2.5-SNAPSHOT</carbon.device.mgt.plugin.version>
<paho.mqtt.version>1.0.2</paho.mqtt.version> <paho.mqtt.version>1.0.2</paho.mqtt.version>
<commons-json.version>3.0.0.wso2v1</commons-json.version> <commons-json.version>3.0.0.wso2v1</commons-json.version>
@ -388,7 +382,7 @@
<commons-httpclient.orbit.version>3.1.0.wso2v2</commons-httpclient.orbit.version> <commons-httpclient.orbit.version>3.1.0.wso2v2</commons-httpclient.orbit.version>
<commons-json.version>3.0.0.wso2v1</commons-json.version> <commons-json.version>3.0.0.wso2v1</commons-json.version>
<eclipse.equinox.common.version>3.6.100.v20120522-1841</eclipse.equinox.common.version> <eclipse.equinox.common.version>3.6.100.v20120522-1841</eclipse.equinox.common.version>
<analytics.version>1.0.6-ALPHA</analytics.version> <analytics.version>1.2.8</analytics.version>
<wso2.iot.version>1.0.0-SNAPSHOT</wso2.iot.version> <wso2.iot.version>1.0.0-SNAPSHOT</wso2.iot.version>
</properties> </properties>

@ -27,7 +27,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.iot.devicemgt-plugins</groupId> <groupId>org.wso2.iot.devicemgt-plugins</groupId>
<artifactId>devicetype-feature-installation</artifactId> <artifactId>devicetype-feature-installation</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>${product.version}</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Creating custom distribution</name> <name>Creating custom distribution</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>
@ -35,7 +35,6 @@
<modules> <modules>
<!-- STEP#1 ADD THE LOCATION OF YOUR DEVICE-TYPE --> <!-- STEP#1 ADD THE LOCATION OF YOUR DEVICE-TYPE -->
<module>samples/connectedcup</module> <module>samples/connectedcup</module>
<module>samples/connectedlap</module>
</modules> </modules>
<build> <build>
@ -60,10 +59,7 @@
<featureArtifacts> <featureArtifacts>
<featureArtifactDef> <featureArtifactDef>
<!-- STEP#2. ADD YOUR DEVICE TYPE FEATURE HERE "< GROUP_ID:ARTIFACT_ID:VERSION >" --> <!-- STEP#2. ADD YOUR DEVICE TYPE FEATURE HERE "< GROUP_ID:ARTIFACT_ID:VERSION >" -->
org.coffeeking:org.coffeeking.connectedcup.feature:1.0.0-SNAPSHOT org.coffeeking:org.coffeeking.connectedcup.feature:${product.version}
</featureArtifactDef>
<featureArtifactDef>
org.wso2:org.wso2.connectedlap.feature:1.0.0-SNAPSHOT
</featureArtifactDef> </featureArtifactDef>
</featureArtifacts> </featureArtifacts>
</configuration> </configuration>
@ -91,11 +87,7 @@
<features> <features>
<feature> <feature>
<id>org.coffeeking.connectedcup.feature.group</id> <id>org.coffeeking.connectedcup.feature.group</id>
<version>1.0.0-SNAPSHOT</version> <version>${product.version}</version>
</feature>
<feature>
<id>org.wso2.connectedlap.feature.group</id>
<version>1.0.0-SNAPSHOT</version>
</feature> </feature>
</features> </features>
</configuration> </configuration>
@ -115,11 +107,7 @@
<features> <features>
<feature> <feature>
<id>org.coffeeking.connectedcup.feature.group</id> <id>org.coffeeking.connectedcup.feature.group</id>
<version>1.0.0-SNAPSHOT</version> <version>${product.version}</version>
</feature>
<feature>
<id>org.wso2.connectedlap.feature.group</id>
<version>1.0.0-SNAPSHOT</version>
</feature> </feature>
</features> </features>
</configuration> </configuration>

@ -1100,7 +1100,7 @@
<carbon.iot.device.mgt.version>1.0.0-SNAPSHOT</carbon.iot.device.mgt.version> <carbon.iot.device.mgt.version>1.0.0-SNAPSHOT</carbon.iot.device.mgt.version>
<!-- Carbon Device Management Plugins--> <!-- Carbon Device Management Plugins-->
<carbon.device.mgt.plugin.version>2.2.4-SNAPSHOT</carbon.device.mgt.plugin.version> <carbon.device.mgt.plugin.version>2.2.5-SNAPSHOT</carbon.device.mgt.plugin.version>
<!-- API Management --> <!-- API Management -->
<carbon.api.mgt.version>6.0.5</carbon.api.mgt.version> <carbon.api.mgt.version>6.0.5</carbon.api.mgt.version>
@ -1185,7 +1185,7 @@
<eclipse.paho.version>1.0.2</eclipse.paho.version> <eclipse.paho.version>1.0.2</eclipse.paho.version>
<!-- CDMF Analytics --> <!-- CDMF Analytics -->
<cdmf.analytics.version>1.0.1-SNAPSHOT</cdmf.analytics.version> <cdmf.analytics.version>1.0.2-SNAPSHOT</cdmf.analytics.version>
</properties> </properties>
<scm> <scm>

Loading…
Cancel
Save