refactoring code

application-manager-new
GPrathap 9 years ago
parent 9b38eddd09
commit 24fe930727

@ -20,9 +20,9 @@
<property name="project-name" value="${ant.project.name}"/>
<property name="target-dir" value="target/carbonapps"/>
<property name="src-dir" value="src/main/resources/carbonapps"/>
<property name="sensor_dir" value="Sensor"/>
<property name="sensor_dir" value="smartLock"/>
<target name="clean">
<delete dir="${target-dir}" />
<delete dir="${target-dir}"/>
</target>
<target name="zip" depends="clean">
<mkdir dir="${target-dir}"/>

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
@ -15,19 +16,19 @@
* 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"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.homeautomation</groupId>
<artifactId>component</artifactId>
<artifactId>doormanager-component</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>${groupId}.doormanager.analytics</artifactId>
<artifactId>org.homeautomation.doormanager.analytics</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name> ${groupId}.doormanager.analytics </name>
<name>org.homeautomation.doormanager.analytics</name>
<url>http://wso2.org</url>
<build>
<plugins>
@ -65,7 +66,7 @@
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.5</version>
<configuration>
<finalName>${project.artifactId}-1.0.0-SNAPSHOT</finalName>
<finalName>org.homeautomation.doormanager.analytics-1.0.0-SNAPSHOT</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/assembly/src.xml</descriptor>

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
@ -17,8 +18,8 @@
-->
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>src</id>
<formats>

@ -27,8 +27,12 @@ import javax.xml.bind.annotation.XmlRootElement;
@JsonIgnoreProperties(ignoreUnknown = true)
public class DeviceJSON {
@XmlElement(required = true) public String owner;
@XmlElement(required = true) public String deviceId;
@XmlElement(required = true) public String UIDofUser;
@XmlElement(required = true) public String serialNumber;
@XmlElement(required = true)
public String owner;
@XmlElement(required = true)
public String deviceId;
@XmlElement(required = true)
public String UIDofUser;
@XmlElement(required = true)
public String serialNumber;
}

@ -16,7 +16,7 @@
* under the License.
*/
package org.homeautomation.doormanager.manager.api.dto;
package org.homeautomation.doormanager.controller.api.dto;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
@ -27,8 +27,10 @@ import javax.xml.bind.annotation.XmlRootElement;
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserInfo {
@XmlElement(required = true) public String serialNumber;
@XmlElement(required = true) public String deviceId;
@XmlElement(required = true) public String cardNumber;
@XmlElement(required = true) public String userName;
@XmlElement(required = true)
public String deviceId;
@XmlElement(required = true)
public String cardNumber;
@XmlElement(required = true)
public String userName;
}

@ -1,4 +1,3 @@
package org.homeautomation.doormanager.controller.api.exception;
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
@ -16,20 +15,16 @@ package org.homeautomation.doormanager.controller.api.exception;
* specific language governing permissions and limitations
* under the License.
*/
package org.homeautomation.doormanager.controller.api.exception;
public class DoorManagerException extends Exception {
private static final long serialVersionUID = 2736466230451105441L;
private String errorMessage;
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
@SuppressWarnings("unused")
public DoorManagerException(String msg, DoorManagerException nestedEx) {
super(msg, nestedEx);
setErrorMessage(msg);
@ -40,18 +35,30 @@ public class DoorManagerException extends Exception {
setErrorMessage(message);
}
@SuppressWarnings("unused")
public DoorManagerException(String msg) {
super(msg);
setErrorMessage(msg);
}
@SuppressWarnings("unused")
public DoorManagerException() {
super();
}
@SuppressWarnings("unused")
public DoorManagerException(Throwable cause) {
super(cause);
}
@SuppressWarnings("unused")
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
}

@ -1,37 +1,65 @@
package org.homeautomation.doormanager.controller.api.util;
/*
* 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.homeautomation.doormanager.controller.api.transport;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.homeautomation.doormanager.controller.api.exception.DoorManagerException;
import org.homeautomation.doormanager.controller.api.util.DoorManagerServiceUtils;
import org.homeautomation.doormanager.plugin.constants.DoorManagerConstants;
import org.wso2.carbon.device.mgt.analytics.exception.DataPublisherConfigurationException;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.iot.controlqueue.mqtt.MqttConfig;
import org.wso2.carbon.device.mgt.iot.sensormgt.SensorDataManager;
import org.wso2.carbon.device.mgt.iot.transport.TransportHandlerException;
import org.wso2.carbon.device.mgt.iot.transport.mqtt.MQTTTransportHandler;
import javax.ws.rs.core.Response;
import java.io.File;
import java.util.Calendar;
import java.util.UUID;
/**
* MQTT is used as transport protocol. So this will provide basic functional requirement in order to communicate over
* MQTT
*/
@SuppressWarnings("no JAX-WS annotation")
public class DoorManagerMQTTConnector extends MQTTTransportHandler {
private static Log log = LogFactory.getLog(DoorManagerMQTTConnector.class);
private static final String subscribeTopic =
"wso2" + File.separator + "iot" + File.separator + "+" + File.separator +
DoorManagerConstants.DEVICE_TYPE + File.separator + "+" + File.separator +
"lockStatusPublisher"+ File.separator;
private static String iotServerSubscriber = UUID.randomUUID().toString().substring(0, 5);
private static String PUBLISHER_CONTEXT = "publisher";
private static String SUBSCRIBER_CONTEXT = "subscriber";
private static String SUBCRIBER_TOPIC = "wso2" + File.separator + "iot" + File.separator + "+" + File.separator +
DoorManagerConstants.DEVICE_TYPE + File.separator + "+" + File.separator + PUBLISHER_CONTEXT;
private static String PUBLISHER_TOPIC = "wso2/iot/%s/" + DoorManagerConstants.DEVICE_TYPE + "/%s/"
+ SUBSCRIBER_CONTEXT;
private static String SUBSCRIBER = UUID.randomUUID().toString().substring(0, 5);
private DoorManagerMQTTConnector() {
super(iotServerSubscriber, DoorManagerConstants.DEVICE_TYPE,
MqttConfig.getInstance().getMqttQueueEndpoint(), subscribeTopic);
super(SUBSCRIBER, DoorManagerConstants.DEVICE_TYPE,
MqttConfig.getInstance().getMqttQueueEndpoint(), SUBCRIBER_TOPIC);
}
/**
* This method will initialize connection with message broker
*/
@Override
public void connect() {
Runnable connector = new Runnable() {
@ -63,79 +91,103 @@ public class DoorManagerMQTTConnector extends MQTTTransportHandler {
connectorThread.start();
}
/**
* This callback function will be called by message broker when some messages available to subscribed topic
*
* @param message mqtt message which is coming form agent side
* @param messageParams metadata of mqtt message
*/
@Override
public void processIncomingMessage(MqttMessage message, String... messageParams) {
String topic = messageParams[0];
String ownerAndId = topic.replace("wso2" + File.separator + "iot" + File.separator, "");
ownerAndId = ownerAndId.replace(File.separator + DoorManagerConstants.DEVICE_TYPE
+ File.separator, ":");
ownerAndId = ownerAndId.replace(File.separator + "lockStatusPublisher", "");
ownerAndId = ownerAndId.replace(File.separator + PUBLISHER_CONTEXT, "");
String owner = ownerAndId.split(":")[0];
String deviceId = ownerAndId.split(":")[1];
log.warn(deviceId);
String[] messageData = message.toString().split(":");
if (log.isDebugEnabled()){
if (log.isDebugEnabled()) {
log.debug("Received MQTT message for: [OWNER-" + owner + "] & [DEVICE.ID-" + deviceId + "]");
}
if (messageData.length == 2) {
log.warn("-------------------------------------------");
log.warn(messageData[0]);
log.warn(messageData[1]);
String lockerCurrentState = messageData[1];
float lockerStatus;
if (lockerCurrentState.equals("LOCKED")) {
lockerStatus = 0;
} else {
lockerStatus = 1;
}
try {
SensorDataManager.getInstance().setSensorRecord(deviceId, "door_locker_state",
String.valueOf(1), Calendar.getInstance().getTimeInMillis());
if (!DoorManagerServiceUtils.publishToDASCurrent(owner, deviceId, 1)) {
log.warn("An error occured whilst trying to publish with ID [" + deviceId +
"] of owner [" + owner + "]");
SensorDataManager.getInstance().setSensorRecord(deviceId, "doorLockerCurrentStatus",
String.valueOf(lockerStatus), Calendar.getInstance().getTimeInMillis());
if (!DoorManagerServiceUtils.publishToDASLockerStatus(owner, deviceId, lockerStatus)) {
log.warn("An error occurred while trying to publish with ID [" + deviceId + "] of owner ["
+ owner + "]");
}
} catch(Exception e){
log.error(e);
}
if(log.isDebugEnabled()){
//log.debug("Return result " + result + " for Request " + requestMessage);
} catch (Exception e) {
log.error(e);
}
}
}
/**
* Publish a MQTT message to device through message broker
*
* @param topic mqtt topic which will be used to uniquely identify who are the subscribers to this topic
* @param payLoad message is to be published
* @param qos level of qos(quality of service):1,2,3
* @param retained klkkl
* @throws TransportHandlerException
*/
private void publishToAutomaticDoorLocker(String topic, String payLoad, int qos, boolean retained)
throws TransportHandlerException {
if(log.isDebugEnabled()){
if (log.isDebugEnabled()) {
log.debug("Publishing message [" + payLoad + "to topic [" + topic + "].");
}
publishToQueue(topic, payLoad, qos, retained);
}
/**
* Publish a MQTT message to device through message broker
*
* @param deviceOwner person who own the device
* @param deviceId unique identifier for each device
* @param operation command is to executed at agent side e.g: off, on
* @param param additional payload
* @throws DeviceManagementException
* @throws DoorManagerException
*/
public void sendCommandViaMQTT(String deviceOwner, String deviceId, String operation, String param)
throws DeviceManagementException, DoorManagerException {
String PUBLISH_TOPIC = "wso2/iot/%s/doormanager/%s/lockController";
String topic = String.format(PUBLISH_TOPIC, deviceOwner, deviceId);
String topic = String.format(PUBLISHER_TOPIC, deviceOwner, deviceId);
String payload = operation + param;
try {
publishToAutomaticDoorLocker(topic, payload, 2, false);
if(param.equals("LOCK")){
if (!DoorManagerServiceUtils.publishToDASCurrent(deviceOwner, deviceId, 0)) {
log.warn("An error occured whilst trying to publish with ID [" + deviceId +
"] of owner [" + deviceOwner + "]");
if (param.equals("LOCK")) {
if (!DoorManagerServiceUtils.publishToDASLockerStatus(deviceOwner, deviceId, 0)) {
log.warn("An error occurred whilst trying to publish with ID [" + deviceId + "] of owner [" +
deviceOwner + "]");
}
}else{
if (!DoorManagerServiceUtils.publishToDASCurrent(deviceOwner, deviceId, 1)) {
log.warn("An error occured whilst trying to publish with ID [" + deviceId +
"] of owner [" + deviceOwner + "]");
} else {
if (!DoorManagerServiceUtils.publishToDASLockerStatus(deviceOwner, deviceId, 1)) {
log.warn("An error occurred whilst trying to publish with ID [" + deviceId + "] of owner [" +
deviceOwner + "]");
}
}
if (!DoorManagerServiceUtils.publishToDASCurrent(deviceOwner, deviceId, 1)) {
log.warn("An error occured whilst trying to publish with ID [" + deviceId +
"] of owner [" + deviceOwner + "]");
}
} catch (TransportHandlerException e) {
String errorMessage = "Error publishing data to device with ID " + deviceId;
throw new DoorManagerException(errorMessage, e);
} catch (DataPublisherConfigurationException e) {
String errorMessage = "Error publishing data to DAS with ID " + deviceId;
throw new DoorManagerException(errorMessage, e);
}
}
/**
* Connection with message broker can be terminated
*/
@Override
public void disconnect() {
Runnable stopConnection = new Runnable() {
@ -143,8 +195,7 @@ public class DoorManagerMQTTConnector extends MQTTTransportHandler {
while (isConnected()) {
try {
closeConnection();
}
catch (MqttException e) {
} catch (MqttException e) {
if (log.isDebugEnabled()) {
log.warn("Unable to 'STOP' MQTT connection at broker at: " + mqttBrokerEndPoint);
}

@ -16,9 +16,9 @@
~ limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
@ -30,12 +30,12 @@
</bean>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
</jaxrs:providers>
</jaxrs:server>
<bean id="communicationHandler"
class="org.homeautomation.doormanager.controller.api.util.DoorManagerMQTTConnector" >
class="org.homeautomation.doormanager.controller.api.transport.DoorManagerMQTTConnector">
</bean>
</beans>

@ -19,15 +19,15 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.homeautomation</groupId>
<artifactId>component</artifactId>
<artifactId>doormanager-component</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>${groupId}.doormanager.manager</artifactId>
<artifactId>org.homeautomation.doormanager.manager</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>${groupId}.doormanager.manager </name>
<name>org.homeautomation.doormanager.manager </name>
<url>http://wso2.org</url>
<build>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
@ -46,7 +46,7 @@
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<configuration>
<warName>${groupId}.doormanager.manager_mgt</warName>
<warName>org.homeautomation.doormanager.manager_mgt</warName>
</configuration>
</plugin>
</plugins>
@ -54,7 +54,7 @@
<dependencies>
<dependency>
<groupId>org.homeautomation</groupId>
<artifactId>${project-base-package}.plugin</artifactId>
<artifactId>org.homeautomation.doormanager.plugin</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>

@ -15,7 +15,9 @@
* 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">
*/-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.homeautomation</groupId>
<artifactId>doormanager</artifactId>
@ -24,7 +26,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<version>1.0.0-SNAPSHOT</version>
<artifactId>component</artifactId>
<artifactId>doormanager-component</artifactId>
<packaging>pom</packaging>
<build>
<pluginManagement>
@ -271,12 +273,11 @@
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>plugin</module>
<module>controller</module>
<module>manager</module>
<module>agent</module>
<module>analytics</module>
<module>ui</module>
</modules>
<modules>
<module>plugin</module>
<module>controller</module>
<module>manager</module>
<module>analytics</module>
<module>ui</module>
</modules>
</project>

@ -16,18 +16,18 @@
~ 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"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.homeautomation</groupId>
<artifactId>component</artifactId>
<artifactId>doormanager-component</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>${groupId}.doormanager.ui</artifactId>
<name>${groupId}.doormanager.ui</name>
<artifactId>org.homeautomation.doormanager.ui</artifactId>
<name>org.homeautomation.doormanager.ui</name>
<packaging>pom</packaging>
<build>
<plugins>
@ -35,7 +35,7 @@
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.5</version>
<configuration>
<finalName>${project.artifactId}-1.0.0-SNAPSHOT</finalName>
<finalName>org.homeautomation.doormanager.ui-1.0.0-SNAPSHOT</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/assembly/src.xml</descriptor>

@ -17,8 +17,8 @@
-->
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>src</id>
<formats>

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
@ -15,20 +16,20 @@
~ 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"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.homeautomation</groupId>
<artifactId>feature</artifactId>
<artifactId>doormanager-feature</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>1.0.0-SNAPSHOT</version>
<artifactId>${groupId}.doormanager.feature</artifactId>
<artifactId>org.homeautomation.doormanager.feature</artifactId>
<packaging>pom</packaging>
<name> ${project.artifactId} </name>
<url>http://wso2.org</url>
<name>${project.artifactId}</name>
<url>http://wso2.org</url>
<dependencies>
<dependency>
<groupId>org.homeautomation</groupId>
@ -47,12 +48,6 @@
<version>1.0.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.homeautomation</groupId>
<artifactId>${project-base-package}.agent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.h2database.wso2</groupId>
<artifactId>h2-database-engine</artifactId>
@ -63,6 +58,7 @@
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>copy-resources</id>
@ -104,7 +100,7 @@
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>
${basedir}/src/main/resources/carbonapps
${project.build.directory}/maven-shared-archive-resources/carbonapps
</outputDirectory>
<includes>**/*</includes>
</artifactItem>
@ -115,7 +111,9 @@
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${basedir}/src/main/resources/jaggeryapps/</outputDirectory>
<outputDirectory>
${project.build.directory}/maven-shared-archive-resources/jaggeryapps
</outputDirectory>
<includes>**/*</includes>
</artifactItem>
</artifactItems>
@ -134,7 +132,9 @@
<artifactId>${project-base-package}.manager</artifactId>
<type>war</type>
<overWrite>true</overWrite>
<outputDirectory>${basedir}/src/main/resources/webapps/</outputDirectory>
<outputDirectory>
${project.build.directory}/maven-shared-archive-resources/webapps/
</outputDirectory>
<destFileName>doormanager_mgt.war</destFileName>
</artifactItem>
</artifactItems>
@ -153,31 +153,14 @@
<artifactId>${project-base-package}.controller</artifactId>
<type>war</type>
<overWrite>true</overWrite>
<outputDirectory>${basedir}/src/main/resources/webapps/</outputDirectory>
<outputDirectory>
${project.build.directory}/maven-shared-archive-resources/webapps/
</outputDirectory>
<destFileName>doormanager.war</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy-jaxrs-agent-war</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.homeautomation</groupId>
<artifactId>${project-base-package}.agent</artifactId>
<type>war</type>
<overWrite>true</overWrite>
<outputDirectory>${basedir}/src/main/resources/webapps/</outputDirectory>
<destFileName>doormanager_agent.war</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
@ -198,7 +181,7 @@
<property name="userid" value="wso2carbon"/>
<property name="password" value="wso2carbon"/>
<property name="dbURL"
value="jdbc:h2:file:${basedir}/${db.dir}/doormanagerDM_DB;DB_CLOSE_ON_EXIT=FALSE"/>
value="jdbc:h2:file:${basedir}/${db.dir}/doormanagerDM_DB;DB_CLOSE_ON_EXIT=FALSE"/>
<mkdir dir="${basedir}/${db.dir}"/>
<sql driver="org.h2.Driver" url="${dbURL}" userid="${userid}"
password="${password}"
@ -216,6 +199,7 @@
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>${carbon-p2-plugin.version}</version>
<executions>
<execution>
<id>p2-feature-generation</id>

@ -5,13 +5,25 @@
},
"analyticStreams": [
{
"name": "sensorValue",
"table": "DEVICE_SENSOR_DATA_SUMMARY",
"name": "smartLock",
"table": "DEVICE_smartLock_SUMMARY",
"ui_unit": {
"name": "cdmf.unit.analytics.line-chart",
"data":[
{"column": {"name":"TIME", "label":"time", "ui-mapping":"x-axis"}},
{"column": {"name":"sensorValue", "label":"sensorValue", "ui-mapping":"y-axis"}}
"data": [
{
"column": {
"name": "TIME",
"label": "time",
"ui-mapping": "x-axis"
}
},
{
"column": {
"name": "smartLock",
"label": "smartLock",
"ui-mapping": "y-axis"
}
}
]
}
}

@ -18,7 +18,7 @@
-->
<DeviceTypeConfigurations>
<DeviceTypeConfig type="doormanager">
<DatasourceName>jdbc/doormanagerDM_DB</DatasourceName>
</DeviceTypeConfig>
<DeviceTypeConfig type="doormanager">
<DatasourceName>jdbc/doormanagerDM_DB</DatasourceName>
</DeviceTypeConfig>
</DeviceTypeConfigurations>

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
@ -16,14 +17,14 @@
~ under the License.
-->
<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
<datasources-configuration>
<providers>
<provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
</providers>
<datasources>
<datasource>
<name>doormanagerDM_DB</name>
<description>The datasource used for the this device type </description>
<description>The datasource used for the this device type</description>
<jndiConfig>
<name>jdbc/doormanagerDM_DB</name>
</jndiConfig>

Loading…
Cancel
Save