forked from community/device-mgt-plugins
parent
f6d04fba4b
commit
887af1a9f6
@ -1,261 +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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<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>camera-plugin</artifactId>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.iot.camera.controller.service.impl</artifactId>
|
|
||||||
<packaging>war</packaging>
|
|
||||||
<name>WSO2 Carbon - IoT Server Camera API</name>
|
|
||||||
<description>WSO2 Carbon - Camera Service Controller API Implementation</description>
|
|
||||||
<url>http://wso2.org</url>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!-- CDM -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.apache.axis2.wso2</groupId>
|
|
||||||
<artifactId>axis2-client</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.analytics</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.apache.axis2.wso2</groupId>
|
|
||||||
<artifactId>axis2-client</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>commons-codec.wso2</groupId>
|
|
||||||
<artifactId>commons-codec</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!--CXF -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-transports-http</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--MQTT -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.paho</groupId>
|
|
||||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--IOT -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
|
||||||
<artifactId>httpasyncclient</artifactId>
|
|
||||||
<version>4.1</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.iot</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.iot.camera.plugin.impl</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--JAX-RS -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.jackson</groupId>
|
|
||||||
<artifactId>jackson-core-asl</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.jackson</groupId>
|
|
||||||
<artifactId>jackson-jaxrs</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax</groupId>
|
|
||||||
<artifactId>javaee-web-api</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.ws.rs</groupId>
|
|
||||||
<artifactId>jsr311-api</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-httpclient.wso2</groupId>
|
|
||||||
<artifactId>commons-httpclient</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.utils</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.bouncycastle.wso2</groupId>
|
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.wso2.carbon</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.user.api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.wso2.carbon</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.queuing</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.wso2.carbon</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.base</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.apache.axis2.wso2</groupId>
|
|
||||||
<artifactId>axis2</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.igniterealtime.smack.wso2</groupId>
|
|
||||||
<artifactId>smack</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.igniterealtime.smack.wso2</groupId>
|
|
||||||
<artifactId>smackx</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>jaxen</groupId>
|
|
||||||
<artifactId>jaxen</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>commons-fileupload.wso2</groupId>
|
|
||||||
<artifactId>commons-fileupload</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.apache.ant.wso2</groupId>
|
|
||||||
<artifactId>ant</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.apache.ant.wso2</groupId>
|
|
||||||
<artifactId>ant</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>commons-httpclient.wso2</groupId>
|
|
||||||
<artifactId>commons-httpclient</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.eclipse.equinox</groupId>
|
|
||||||
<artifactId>javax.servlet</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.wso2.carbon</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.registry.api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-codec.wso2</groupId>
|
|
||||||
<artifactId>commons-codec</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.igniterealtime.smack.wso2</groupId>
|
|
||||||
<artifactId>smack</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.igniterealtime.smack.wso2</groupId>
|
|
||||||
<artifactId>smackx</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
<source>${wso2.maven.compiler.source}</source>
|
|
||||||
<target>${wso2.maven.compiler.target}</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<warName>camera</warName>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,261 +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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<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>camera-plugin</artifactId>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.iot.camera.manager.service.impl</artifactId>
|
|
||||||
<packaging>war</packaging>
|
|
||||||
<name>WSO2 Carbon - IoT Server Camera API</name>
|
|
||||||
<description>WSO2 Carbon - Camera Service Management API Implementation</description>
|
|
||||||
<url>http://wso2.org</url>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!-- CDM -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.apache.axis2.wso2</groupId>
|
|
||||||
<artifactId>axis2-client</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.analytics</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.apache.axis2.wso2</groupId>
|
|
||||||
<artifactId>axis2-client</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>commons-codec.wso2</groupId>
|
|
||||||
<artifactId>commons-codec</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!--CXF -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cxf</groupId>
|
|
||||||
<artifactId>cxf-rt-transports-http</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--MQTT -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.paho</groupId>
|
|
||||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--IOT -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
|
||||||
<artifactId>httpasyncclient</artifactId>
|
|
||||||
<version>4.1</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.iot</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.iot.camera.plugin.impl</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--JAX-RS -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.jackson</groupId>
|
|
||||||
<artifactId>jackson-core-asl</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.jackson</groupId>
|
|
||||||
<artifactId>jackson-jaxrs</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax</groupId>
|
|
||||||
<artifactId>javaee-web-api</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.ws.rs</groupId>
|
|
||||||
<artifactId>jsr311-api</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-httpclient.wso2</groupId>
|
|
||||||
<artifactId>commons-httpclient</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.utils</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.bouncycastle.wso2</groupId>
|
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.wso2.carbon</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.user.api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.wso2.carbon</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.queuing</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.wso2.carbon</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.base</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.apache.axis2.wso2</groupId>
|
|
||||||
<artifactId>axis2</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.igniterealtime.smack.wso2</groupId>
|
|
||||||
<artifactId>smack</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.igniterealtime.smack.wso2</groupId>
|
|
||||||
<artifactId>smackx</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>jaxen</groupId>
|
|
||||||
<artifactId>jaxen</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>commons-fileupload.wso2</groupId>
|
|
||||||
<artifactId>commons-fileupload</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.apache.ant.wso2</groupId>
|
|
||||||
<artifactId>ant</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.apache.ant.wso2</groupId>
|
|
||||||
<artifactId>ant</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>commons-httpclient.wso2</groupId>
|
|
||||||
<artifactId>commons-httpclient</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.eclipse.equinox</groupId>
|
|
||||||
<artifactId>javax.servlet</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.wso2.carbon</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.registry.api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-codec.wso2</groupId>
|
|
||||||
<artifactId>commons-codec</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.igniterealtime.smack.wso2</groupId>
|
|
||||||
<artifactId>smack</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.igniterealtime.smack.wso2</groupId>
|
|
||||||
<artifactId>smackx</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
<source>${wso2.maven.compiler.source}</source>
|
|
||||||
<target>${wso2.maven.compiler.target}</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<warName>camera_mgt</warName>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,123 +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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<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>camera-plugin</artifactId>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.iot.camera.plugin.impl</artifactId>
|
|
||||||
<packaging>bundle</packaging>
|
|
||||||
<name>WSO2 Carbon - IoT Server Camera Management Plugin</name>
|
|
||||||
<description>WSO2 Carbon - Camera Management/Control Plugin Implementation</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.devicemgt.plugins.version}</Bundle-Version>
|
|
||||||
<Bundle-Description>IoT Server Camera Impl Bundle</Bundle-Description>
|
|
||||||
<Private-Package>org.wso2.carbon.device.mgt.iot.camera.plugin.internal</Private-Package>
|
|
||||||
<Import-Package>
|
|
||||||
org.osgi.framework,
|
|
||||||
org.osgi.service.component,
|
|
||||||
org.apache.commons.logging,
|
|
||||||
javax.xml.bind.*,
|
|
||||||
javax.naming,
|
|
||||||
javax.sql,
|
|
||||||
javax.xml.bind.annotation.*,
|
|
||||||
javax.xml.parsers,
|
|
||||||
javax.net,
|
|
||||||
javax.net.ssl,
|
|
||||||
org.w3c.dom,
|
|
||||||
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.*,
|
|
||||||
</Import-Package>
|
|
||||||
|
|
||||||
<Export-Package>
|
|
||||||
!org.wso2.carbon.device.mgt.iot.camera.plugin.internal,
|
|
||||||
org.wso2.carbon.device.mgt.iot.camera.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,27 +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.wso2.carbon.device.mgt.iot.camera.plugin.constants;
|
|
||||||
|
|
||||||
public class CameraConstants {
|
|
||||||
public final static String DEVICE_TYPE = "camera";
|
|
||||||
public final static String DEVICE_PLUGIN_DEVICE_NAME = "DEVICE_NAME";
|
|
||||||
public final static String DEVICE_PLUGIN_DEVICE_ID = "CAMERA_DEVICE_ID";
|
|
||||||
public final static String STATE_ON = "ON";
|
|
||||||
public final static String STATE_OFF = "OFF";
|
|
||||||
}
|
|
@ -1,281 +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.wso2.carbon.device.mgt.iot.camera.plugin.impl;
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
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 org.wso2.carbon.device.mgt.iot.camera.plugin.impl.dao.CameraDAO;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOException;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOFactory;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dto.IotDevice;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.util.IotDeviceManagementUtil;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This represents the FireAlarm implementation of DeviceManagerService.
|
|
||||||
*/
|
|
||||||
public class CameraManager implements DeviceManager {
|
|
||||||
|
|
||||||
private static final IotDeviceManagementDAOFactory iotDeviceManagementDAOFactory = new CameraDAO();
|
|
||||||
private static final Log log = LogFactory.getLog(CameraManager.class);
|
|
||||||
|
|
||||||
|
|
||||||
@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;
|
|
||||||
IotDevice iotDevice = IotDeviceManagementUtil.convertToIotDevice(device);
|
|
||||||
try {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("Enrolling a new Camera device : " + device.getDeviceIdentifier());
|
|
||||||
}
|
|
||||||
CameraDAO.beginTransaction();
|
|
||||||
status = iotDeviceManagementDAOFactory.getIotDeviceDAO().addIotDevice(
|
|
||||||
iotDevice);
|
|
||||||
CameraDAO.commitTransaction();
|
|
||||||
} catch (IotDeviceManagementDAOException e) {
|
|
||||||
try {
|
|
||||||
CameraDAO.rollbackTransaction();
|
|
||||||
} catch (IotDeviceManagementDAOException iotDAOEx) {
|
|
||||||
String msg = "Error occurred while roll back the device enrol transaction :" + device.toString();
|
|
||||||
log.warn(msg, iotDAOEx);
|
|
||||||
}
|
|
||||||
String msg = "Error while enrolling the Camera device : " + device.getDeviceIdentifier();
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new DeviceManagementException(msg, e);
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
|
|
||||||
boolean status;
|
|
||||||
IotDevice iotDevice = IotDeviceManagementUtil.convertToIotDevice(device);
|
|
||||||
try {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("Modifying the Camera device enrollment data");
|
|
||||||
}
|
|
||||||
CameraDAO.beginTransaction();
|
|
||||||
status = iotDeviceManagementDAOFactory.getIotDeviceDAO()
|
|
||||||
.updateIotDevice(iotDevice);
|
|
||||||
CameraDAO.commitTransaction();
|
|
||||||
} catch (IotDeviceManagementDAOException e) {
|
|
||||||
try {
|
|
||||||
CameraDAO.rollbackTransaction();
|
|
||||||
} catch (IotDeviceManagementDAOException 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 Camera 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 Camera device : " + deviceId);
|
|
||||||
}
|
|
||||||
CameraDAO.beginTransaction();
|
|
||||||
status = iotDeviceManagementDAOFactory.getIotDeviceDAO()
|
|
||||||
.deleteIotDevice(deviceId.getId());
|
|
||||||
CameraDAO.commitTransaction();
|
|
||||||
} catch (IotDeviceManagementDAOException e) {
|
|
||||||
try {
|
|
||||||
CameraDAO.rollbackTransaction();
|
|
||||||
} catch (IotDeviceManagementDAOException 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 Camera 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 Camera device : " + deviceId.getId());
|
|
||||||
}
|
|
||||||
IotDevice iotDevice =
|
|
||||||
iotDeviceManagementDAOFactory.getIotDeviceDAO().getIotDevice(
|
|
||||||
deviceId.getId());
|
|
||||||
if (iotDevice != null) {
|
|
||||||
isEnrolled = true;
|
|
||||||
}
|
|
||||||
} catch (IotDeviceManagementDAOException e) {
|
|
||||||
String msg = "Error while checking the enrollment status of Camera 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 Camera device : " + deviceId.getId());
|
|
||||||
}
|
|
||||||
IotDevice iotDevice = iotDeviceManagementDAOFactory.getIotDeviceDAO().
|
|
||||||
getIotDevice(deviceId.getId());
|
|
||||||
device = IotDeviceManagementUtil.convertToDevice(iotDevice);
|
|
||||||
} catch (IotDeviceManagementDAOException e) {
|
|
||||||
String msg = "Error while fetching the Camera 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;
|
|
||||||
IotDevice iotDevice = IotDeviceManagementUtil.convertToIotDevice(device);
|
|
||||||
try {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug(
|
|
||||||
"updating the details of Camera device : " + deviceIdentifier);
|
|
||||||
}
|
|
||||||
CameraDAO.beginTransaction();
|
|
||||||
status = iotDeviceManagementDAOFactory.getIotDeviceDAO()
|
|
||||||
.updateIotDevice(iotDevice);
|
|
||||||
CameraDAO.commitTransaction();
|
|
||||||
} catch (IotDeviceManagementDAOException e) {
|
|
||||||
try {
|
|
||||||
CameraDAO.rollbackTransaction();
|
|
||||||
} catch (IotDeviceManagementDAOException 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 Camera 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 Camera devices");
|
|
||||||
}
|
|
||||||
List<IotDevice> iotDevices =
|
|
||||||
iotDeviceManagementDAOFactory.getIotDeviceDAO().getAllIotDevices();
|
|
||||||
if (iotDevices != null) {
|
|
||||||
devices = new ArrayList<Device>();
|
|
||||||
for (IotDevice iotDevice : iotDevices) {
|
|
||||||
devices.add(IotDeviceManagementUtil.convertToDevice(iotDevice));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IotDeviceManagementDAOException e) {
|
|
||||||
String msg = "Error while fetching all Camera devices.";
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new DeviceManagementException(msg, e);
|
|
||||||
}
|
|
||||||
return devices;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,112 +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.wso2.carbon.device.mgt.iot.camera.plugin.impl;
|
|
||||||
|
|
||||||
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.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.spi.DeviceManagementService;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.camera.plugin.constants.CameraConstants;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CameraManagerService implements DeviceManagementService{
|
|
||||||
private DeviceManager deviceManager;
|
|
||||||
@Override
|
|
||||||
public String getType() {
|
|
||||||
return CameraConstants.DEVICE_TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProviderTenantDomain() {
|
|
||||||
return "carbon.super";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSharedWithAllTenants() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getSharedTenantsDomain() {
|
|
||||||
return new String[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() throws DeviceManagementException {
|
|
||||||
this.deviceManager=new CameraManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DeviceManager getDeviceManager() {
|
|
||||||
return deviceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ApplicationManager getApplicationManager() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void notifyOperationToDevices(Operation operation, List<DeviceIdentifier> deviceIds)
|
|
||||||
throws DeviceManagementException {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Application[] getApplications(String domain, int pageNumber, int size)
|
|
||||||
throws ApplicationManagementException {
|
|
||||||
return new Application[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateApplicationStatus(DeviceIdentifier deviceId, Application application,
|
|
||||||
String status) throws ApplicationManagementException {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getApplicationStatus(DeviceIdentifier deviceId, Application application)
|
|
||||||
throws ApplicationManagementException {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
|
|
||||||
throws ApplicationManagementException {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void installApplicationForUsers(Operation operation, List<String> userNameList)
|
|
||||||
throws ApplicationManagementException {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void installApplicationForUserRoles(Operation operation, List<String> userRoleList)
|
|
||||||
throws ApplicationManagementException {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,121 +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.wso2.carbon.device.mgt.iot.camera.plugin.impl.dao;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.camera.plugin.constants.CameraConstants;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.camera.plugin.impl.dao.impl.CameraDeviceDAOImpl;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceDAO;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOException;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOFactory;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOFactoryInterface;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class CameraDAO extends IotDeviceManagementDAOFactory implements IotDeviceManagementDAOFactoryInterface {
|
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(CameraDAO.class);
|
|
||||||
static DataSource dataSource;
|
|
||||||
private static ThreadLocal<Connection> currentConnection = new ThreadLocal<Connection>();
|
|
||||||
|
|
||||||
public CameraDAO() {
|
|
||||||
initFireAlarmDAO();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void initFireAlarmDAO() {
|
|
||||||
dataSource = getDataSourceMap().get(CameraConstants.DEVICE_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public IotDeviceDAO getIotDeviceDAO() {
|
|
||||||
return new CameraDeviceDAOImpl();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void beginTransaction() throws IotDeviceManagementDAOException {
|
|
||||||
try {
|
|
||||||
Connection conn = dataSource.getConnection();
|
|
||||||
conn.setAutoCommit(false);
|
|
||||||
currentConnection.set(conn);
|
|
||||||
} catch (SQLException e) {
|
|
||||||
throw new IotDeviceManagementDAOException("Error occurred while retrieving datasource connection", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Connection getConnection() throws IotDeviceManagementDAOException {
|
|
||||||
if (currentConnection.get() == null) {
|
|
||||||
try {
|
|
||||||
currentConnection.set(dataSource.getConnection());
|
|
||||||
} catch (SQLException e) {
|
|
||||||
throw new IotDeviceManagementDAOException("Error occurred while retrieving data source connection", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return currentConnection.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void commitTransaction() throws IotDeviceManagementDAOException {
|
|
||||||
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 IotDeviceManagementDAOException("Error occurred while committing the transaction", e);
|
|
||||||
} finally {
|
|
||||||
closeConnection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void closeConnection() throws IotDeviceManagementDAOException {
|
|
||||||
|
|
||||||
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 IotDeviceManagementDAOException {
|
|
||||||
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 IotDeviceManagementDAOException("Error occurred while rollback the transaction", e);
|
|
||||||
} finally {
|
|
||||||
closeConnection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,237 +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.wso2.carbon.device.mgt.iot.camera.plugin.impl.dao.impl;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.camera.plugin.constants.CameraConstants;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.camera.plugin.impl.dao.CameraDAO;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceDAO;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOException;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.util.IotDeviceManagementDAOUtil;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dto.IotDevice;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements IotDeviceDAO for camera Devices.
|
|
||||||
*/
|
|
||||||
public class CameraDeviceDAOImpl implements IotDeviceDAO{
|
|
||||||
|
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(CameraDeviceDAOImpl.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IotDevice getIotDevice(String iotDeviceId)
|
|
||||||
throws IotDeviceManagementDAOException {
|
|
||||||
Connection conn = null;
|
|
||||||
PreparedStatement stmt = null;
|
|
||||||
IotDevice iotDevice = null;
|
|
||||||
ResultSet resultSet = null;
|
|
||||||
try {
|
|
||||||
conn = CameraDAO.getConnection();
|
|
||||||
String selectDBQuery =
|
|
||||||
"SELECT CAMERA_DEVICE_ID, DEVICE_NAME" +
|
|
||||||
" FROM CAMERA_DEVICE WHERE CAMERA_DEVICE_ID = ?";
|
|
||||||
stmt = conn.prepareStatement(selectDBQuery);
|
|
||||||
stmt.setString(1, iotDeviceId);
|
|
||||||
resultSet = stmt.executeQuery();
|
|
||||||
|
|
||||||
if (resultSet.next()) {
|
|
||||||
iotDevice = new IotDevice();
|
|
||||||
iotDevice.setIotDeviceName(resultSet.getString(
|
|
||||||
CameraConstants.DEVICE_PLUGIN_DEVICE_NAME));
|
|
||||||
Map<String, String> propertyMap = new HashMap<String, String>();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
iotDevice.setDeviceProperties(propertyMap);
|
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("Camera device " + iotDeviceId + " data has been fetched from " +
|
|
||||||
"Camera database.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
String msg = "Error occurred while fetching Camera device : '" + iotDeviceId + "'";
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new IotDeviceManagementDAOException(msg, e);
|
|
||||||
} finally {
|
|
||||||
IotDeviceManagementDAOUtil.cleanupResources(stmt, resultSet);
|
|
||||||
CameraDAO.closeConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
return iotDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean addIotDevice(IotDevice iotDevice)
|
|
||||||
throws IotDeviceManagementDAOException {
|
|
||||||
boolean status = false;
|
|
||||||
Connection conn = null;
|
|
||||||
PreparedStatement stmt = null;
|
|
||||||
try {
|
|
||||||
conn = CameraDAO.getConnection();
|
|
||||||
String createDBQuery =
|
|
||||||
"INSERT INTO CAMERA_DEVICE(CAMERA_DEVICE_ID, DEVICE_NAME) VALUES (?, ?)";
|
|
||||||
|
|
||||||
stmt = conn.prepareStatement(createDBQuery);
|
|
||||||
stmt.setString(1, iotDevice.getIotDeviceId());
|
|
||||||
stmt.setString(2,iotDevice.getIotDeviceName());
|
|
||||||
if (iotDevice.getDeviceProperties() == null) {
|
|
||||||
iotDevice.setDeviceProperties(new HashMap<String, String>());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int rows = stmt.executeUpdate();
|
|
||||||
if (rows > 0) {
|
|
||||||
status = true;
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("Camera device " + iotDevice.getIotDeviceId() + " data has been" +
|
|
||||||
" added to the Camere database.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
String msg = "Error occurred while adding the Camera device '" +
|
|
||||||
iotDevice.getIotDeviceId() + "' to the Camera db.";
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new IotDeviceManagementDAOException(msg, e);
|
|
||||||
} finally {
|
|
||||||
IotDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateIotDevice(IotDevice iotDevice)
|
|
||||||
throws IotDeviceManagementDAOException {
|
|
||||||
boolean status = false;
|
|
||||||
Connection conn = null;
|
|
||||||
PreparedStatement stmt = null;
|
|
||||||
try {
|
|
||||||
conn = CameraDAO.getConnection();
|
|
||||||
String updateDBQuery =
|
|
||||||
"UPDATE CAMERA_DEVICE SET DEVICE_NAME = ? WHERE CAMERA_DEVICE_ID = ?";
|
|
||||||
|
|
||||||
stmt = conn.prepareStatement(updateDBQuery);
|
|
||||||
|
|
||||||
if (iotDevice.getDeviceProperties() == null) {
|
|
||||||
iotDevice.setDeviceProperties(new HashMap<String, String>());
|
|
||||||
}
|
|
||||||
stmt.setString(1, iotDevice.getIotDeviceName());
|
|
||||||
|
|
||||||
stmt.setString(2, iotDevice.getIotDeviceId());
|
|
||||||
int rows = stmt.executeUpdate();
|
|
||||||
if (rows > 0) {
|
|
||||||
status = true;
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("Camera device " + iotDevice.getIotDeviceId() + " data has been" +
|
|
||||||
" modified.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
String msg = "Error occurred while modifying the Camera device '" +
|
|
||||||
iotDevice.getIotDeviceId() + "' data.";
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new IotDeviceManagementDAOException(msg, e);
|
|
||||||
} finally {
|
|
||||||
IotDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deleteIotDevice(String iotDeviceId)
|
|
||||||
throws IotDeviceManagementDAOException {
|
|
||||||
boolean status = false;
|
|
||||||
Connection conn = null;
|
|
||||||
PreparedStatement stmt = null;
|
|
||||||
try {
|
|
||||||
conn = CameraDAO.getConnection();
|
|
||||||
String deleteDBQuery =
|
|
||||||
"DELETE FROM CAMERA_DEVICE WHERE CAMERA_DEVICE_ID = ?";
|
|
||||||
stmt = conn.prepareStatement(deleteDBQuery);
|
|
||||||
stmt.setString(1, iotDeviceId);
|
|
||||||
int rows = stmt.executeUpdate();
|
|
||||||
if (rows > 0) {
|
|
||||||
status = true;
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("Camera device " + iotDeviceId + " data has deleted from the Camera database.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
String msg = "Error occurred while deleting Camera device " + iotDeviceId;
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new IotDeviceManagementDAOException(msg, e);
|
|
||||||
} finally {
|
|
||||||
IotDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<IotDevice> getAllIotDevices()
|
|
||||||
throws IotDeviceManagementDAOException {
|
|
||||||
|
|
||||||
Connection conn = null;
|
|
||||||
PreparedStatement stmt = null;
|
|
||||||
ResultSet resultSet = null;
|
|
||||||
IotDevice iotDevice;
|
|
||||||
List<IotDevice> iotDevices = new ArrayList<IotDevice>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
conn = CameraDAO.getConnection();
|
|
||||||
String selectDBQuery =
|
|
||||||
"SELECT CAMERA_DEVICE_ID, DEVICE_NAME " +
|
|
||||||
"FROM CAMERA_DEVICE";
|
|
||||||
stmt = conn.prepareStatement(selectDBQuery);
|
|
||||||
resultSet = stmt.executeQuery();
|
|
||||||
while (resultSet.next()) {
|
|
||||||
iotDevice = new IotDevice();
|
|
||||||
iotDevice.setIotDeviceId(resultSet.getString(CameraConstants.DEVICE_PLUGIN_DEVICE_ID));
|
|
||||||
iotDevice.setIotDeviceName(resultSet.getString(CameraConstants.DEVICE_PLUGIN_DEVICE_NAME));
|
|
||||||
|
|
||||||
Map<String, String> propertyMap = new HashMap<String, String>();
|
|
||||||
|
|
||||||
iotDevice.setDeviceProperties(propertyMap);
|
|
||||||
iotDevices.add(iotDevice);
|
|
||||||
}
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("All Camera device details have fetched from Firealarm database.");
|
|
||||||
}
|
|
||||||
return iotDevices;
|
|
||||||
} catch (SQLException e) {
|
|
||||||
String msg = "Error occurred while fetching all Camera device data'";
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new IotDeviceManagementDAOException(msg, e);
|
|
||||||
} finally {
|
|
||||||
IotDeviceManagementDAOUtil.cleanupResources(stmt, resultSet);
|
|
||||||
CameraDAO.closeConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,45 +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.wso2.carbon.device.mgt.iot.camera.plugin.impl.util;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains utility methods used by FireAlarm plugin.
|
|
||||||
*/
|
|
||||||
public class VirtualFireAlarmUtils {
|
|
||||||
|
|
||||||
private static Log log = LogFactory.getLog(VirtualFireAlarmUtils.class);
|
|
||||||
|
|
||||||
public static String getDeviceProperty(Map<String, String> deviceProperties, String property) {
|
|
||||||
|
|
||||||
String deviceProperty = deviceProperties.get(property);
|
|
||||||
|
|
||||||
if (deviceProperty == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return deviceProperty;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,98 +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.wso2.carbon.device.mgt.iot.camera.plugin.internal;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
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;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.camera.plugin.impl.CameraManagerService;
|
|
||||||
import org.wso2.carbon.device.mgt.iot.service.DeviceTypeService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @scr.component name="org.wso2.carbon.device.mgt.iot.camera.plugin.internal
|
|
||||||
* .CameraManagementServiceComponent"
|
|
||||||
* immediate="true"
|
|
||||||
* @scr.reference name="org.wso2.carbon.device.mgt.iot.service.DeviceTypeServiceImpl"
|
|
||||||
* interface="org.wso2.carbon.device.mgt.iot.service.DeviceTypeService"
|
|
||||||
* cardinality="1..1"
|
|
||||||
* policy="dynamic"
|
|
||||||
* bind="setDeviceTypeService"
|
|
||||||
* unbind="unsetDeviceTypeService"
|
|
||||||
*/
|
|
||||||
public class CameraManagementServiceComponent {
|
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(CameraManagementServiceComponent.class);
|
|
||||||
private ServiceRegistration firealarmServiceRegRef;
|
|
||||||
|
|
||||||
protected void activate(ComponentContext ctx) {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("Activating Camera Device Management Service Component");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
BundleContext bundleContext = ctx.getBundleContext();
|
|
||||||
firealarmServiceRegRef =
|
|
||||||
bundleContext.registerService(DeviceManagementService.class.getName(),
|
|
||||||
new CameraManagerService(), null);
|
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug(
|
|
||||||
"Camera Device Management Service Component has been successfully activated");
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
log.error(
|
|
||||||
"Error occurred while activating Camera Device Management Service Component", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void deactivate(ComponentContext ctx) {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("De-activating Camera Device Management Service Component");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (firealarmServiceRegRef != null) {
|
|
||||||
firealarmServiceRegRef.unregister();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug(
|
|
||||||
"Camera Device Management Service Component has been successfully de-activated");
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
log.error(
|
|
||||||
"Error occurred while de-activating Camera Device Management bundle", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setDeviceTypeService(DeviceTypeService deviceTypeService) {
|
|
||||||
/* This is to avoid this component getting initialized before the common registered */
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("Data source service set to mobile service component");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void unsetDeviceTypeService(DeviceTypeService deviceTypeService) {
|
|
||||||
//do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,62 +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/maven-v4_0_0.xsd">
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>camera-plugin</artifactId>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>org.wso2.carbon.device.mgt.iot.camera.ui</artifactId>
|
|
||||||
<name>WSO2 Carbon - IoT Server Camera UI</name>
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
|
||||||
<version>2.5.5</version>
|
|
||||||
<configuration>
|
|
||||||
<finalName>${project.artifactId}-${carbon.device.mgt.version}</finalName>
|
|
||||||
<appendAssemblyId>false</appendAssemblyId>
|
|
||||||
<descriptors>
|
|
||||||
<descriptor>src/assembly/src.xml</descriptor>
|
|
||||||
</descriptors>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>create-archive</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>single</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,63 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
~ Copyright (c) 2014, 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>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
|
||||||
<artifactId>iot-plugins</artifactId>
|
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
|
||||||
<artifactId>camera-plugin</artifactId>
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
<name>WSO2 Carbon - Arduino Plugin</name>
|
|
||||||
<url>http://wso2.org</url>
|
|
||||||
|
|
||||||
<modules>
|
|
||||||
<module>org.wso2.carbon.device.mgt.iot.camera.controller.service.impl</module>
|
|
||||||
<module>org.wso2.carbon.device.mgt.iot.camera.manager.service.impl</module>
|
|
||||||
<module>org.wso2.carbon.device.mgt.iot.camera.plugin.impl</module>
|
|
||||||
<module>org.wso2.carbon.device.mgt.iot.camera.ui</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.felix</groupId>
|
|
||||||
<artifactId>maven-scr-plugin</artifactId>
|
|
||||||
<version>1.7.2</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>generate-scr-scrdescriptor</id>
|
|
||||||
<goals>
|
|
||||||
<goal>scr</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,103 +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.wso2.carbon.device.mgt.iot.api;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
|
||||||
import org.wso2.carbon.device.mgt.analytics.common.AnalyticsDataRecord;
|
|
||||||
import org.wso2.carbon.device.mgt.analytics.exception.DeviceManagementAnalyticsException;
|
|
||||||
import org.wso2.carbon.device.mgt.analytics.service.DeviceAnalyticsService;
|
|
||||||
import javax.jws.WebService;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.ws.rs.Consumes;
|
|
||||||
import javax.ws.rs.GET;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
import javax.ws.rs.PathParam;
|
|
||||||
import javax.ws.rs.Produces;
|
|
||||||
import javax.ws.rs.QueryParam;
|
|
||||||
import javax.ws.rs.core.Context;
|
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@WebService public class StatsManagerService {
|
|
||||||
|
|
||||||
private static Log log = LogFactory.getLog(StatsManagerService.class);
|
|
||||||
|
|
||||||
@Context //injected response proxy supporting multiple thread
|
|
||||||
private HttpServletResponse response;
|
|
||||||
//TODO THIS NEEDS TO BE REMOVED.
|
|
||||||
@Path("/stats/device/type/{type}/identifier/{identifier}")
|
|
||||||
@GET
|
|
||||||
@Consumes("application/json")
|
|
||||||
@Produces("application/json")
|
|
||||||
public DeviceUsageDTO[] getDeviceStats(@PathParam("type") String type, @PathParam("identifier") String identifier,
|
|
||||||
@QueryParam("table") String table, @QueryParam("column") String column, @QueryParam("username") String user,
|
|
||||||
@QueryParam("from") long from, @QueryParam("to") long to) {
|
|
||||||
|
|
||||||
String fromDate = String.valueOf(from);
|
|
||||||
String toDate = String.valueOf(to);
|
|
||||||
|
|
||||||
List<DeviceUsageDTO> deviceUsageDTOs = new ArrayList<>();
|
|
||||||
PrivilegedCarbonContext.startTenantFlow();
|
|
||||||
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
|
||||||
ctx.setTenantDomain("carbon.super", true);
|
|
||||||
DeviceAnalyticsService deviceAnalyticsService = (DeviceAnalyticsService) ctx
|
|
||||||
.getOSGiService(DeviceAnalyticsService.class, null);
|
|
||||||
String query = "owner:" + user + " AND deviceId:" + identifier + " AND deviceType:" + type +
|
|
||||||
" AND time : [" + fromDate + " TO " + toDate + "]";
|
|
||||||
try {
|
|
||||||
List<AnalyticsDataRecord> records = deviceAnalyticsService.getAllEventsForDevice(table, query);
|
|
||||||
|
|
||||||
Collections.sort(records, new Comparator<AnalyticsDataRecord>() {
|
|
||||||
@Override
|
|
||||||
public int compare(AnalyticsDataRecord o1, AnalyticsDataRecord o2) {
|
|
||||||
long t1 = (Long) o1.getValue("time");
|
|
||||||
long t2 = (Long) o2.getValue("time");
|
|
||||||
if (t1 < t2) {
|
|
||||||
return -1;
|
|
||||||
} else if (t1 > t2) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
for (AnalyticsDataRecord record : records) {
|
|
||||||
DeviceUsageDTO deviceUsageDTO = new DeviceUsageDTO();
|
|
||||||
deviceUsageDTO.setTime("" + (long)record.getValue("time"));
|
|
||||||
deviceUsageDTO.setValue("" + (float) record.getValue(column.toLowerCase()));
|
|
||||||
deviceUsageDTOs.add(deviceUsageDTO);
|
|
||||||
}
|
|
||||||
return deviceUsageDTOs.toArray(new DeviceUsageDTO[deviceUsageDTOs.size()]);
|
|
||||||
} catch (DeviceManagementAnalyticsException e) {
|
|
||||||
String errorMsg= "Error on retrieving stats on table " + table + " with query " + query;
|
|
||||||
log.error(errorMsg);
|
|
||||||
response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
|
|
||||||
return deviceUsageDTOs.toArray(new DeviceUsageDTO[deviceUsageDTOs.size()]);
|
|
||||||
} finally {
|
|
||||||
PrivilegedCarbonContext.endTenantFlow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in new issue