forked from community/device-mgt-plugins
parent
83bfaded86
commit
99337539e6
@ -0,0 +1,59 @@
|
|||||||
|
<?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>carbon-device-mgt-plugins-parent</artifactId>
|
||||||
|
<version>6.0.16-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>device-types</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>WSO2 Carbon - IoT Plugins</name>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>virtual-fire-alarm-plugin</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>
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Unauthorised copying/redistribution of this file, via any medium is strictly prohibited.
|
||||||
|
*
|
||||||
|
* Licensed under the Entgra Commercial License, Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://entgra.io/licenses/entgra-commercial/1.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.virtualfirealarm.service.impl.dao;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.dto.SensorRecord;
|
||||||
|
|
||||||
|
public interface DeviceEventsDAO {
|
||||||
|
|
||||||
|
SensorRecord getStats(String deviceId, long fromTime, long toTime);
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Unauthorised copying/redistribution of this file, via any medium is strictly prohibited.
|
||||||
|
*
|
||||||
|
* Licensed under the Entgra Commercial License, Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://entgra.io/licenses/entgra-commercial/1.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.virtualfirealarm.service.impl.dao;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.exceptions.*;
|
||||||
|
import org.wso2.carbon.device.mgt.core.dao.util.*;
|
||||||
|
|
||||||
|
public class DeviceEventsDAOFactory {
|
||||||
|
|
||||||
|
private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(DeviceEventsDAOFactory.class);
|
||||||
|
private static javax.sql.DataSource dataSource;
|
||||||
|
private static String databaseEngine;
|
||||||
|
private static final ThreadLocal<java.sql.Connection> currentConnection = new ThreadLocal<>();
|
||||||
|
|
||||||
|
public static void init(String jndiName) {
|
||||||
|
dataSource = DeviceManagementDAOUtil.lookupDataSource(jndiName, null);
|
||||||
|
try {
|
||||||
|
databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
log.error("Error occurred while retrieving config.datasource connection", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DeviceEventsDAO getDeviceEventDao() {
|
||||||
|
return new DeviceEventsDAOImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void openDBConnection() throws DBConnectionException {
|
||||||
|
java.sql.Connection conn = currentConnection.get();
|
||||||
|
if (conn != null) {
|
||||||
|
throw new IllegalTransactionStateException("Database connection has already been obtained.");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
conn = dataSource.getConnection();
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
throw new DBConnectionException("Failed to get a database connection.", e);
|
||||||
|
}
|
||||||
|
currentConnection.set(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void beginTransaction() throws DBConnectionException {
|
||||||
|
try {
|
||||||
|
java.sql.Connection conn = dataSource.getConnection();
|
||||||
|
conn.setAutoCommit(false);
|
||||||
|
currentConnection.set(conn);
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
throw new DBConnectionException("Error occurred while retrieving datasource connection", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static java.sql.Connection getConnection() throws DBConnectionException {
|
||||||
|
if (currentConnection.get() == null) {
|
||||||
|
try {
|
||||||
|
currentConnection.set(dataSource.getConnection());
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
throw new DBConnectionException("Error occurred while retrieving data source connection", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return currentConnection.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void commitTransaction() throws DBConnectionException {
|
||||||
|
try {
|
||||||
|
java.sql.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 (java.sql.SQLException e) {
|
||||||
|
throw new DBConnectionException("Error occurred while committing the transaction", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void closeConnection() {
|
||||||
|
java.sql.Connection conn = currentConnection.get();
|
||||||
|
try {
|
||||||
|
if (conn != null) {
|
||||||
|
conn.close();
|
||||||
|
}
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
log.error("Error occurred while close the connection");
|
||||||
|
}
|
||||||
|
currentConnection.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void rollbackTransaction() {
|
||||||
|
java.sql.Connection conn = currentConnection.get();
|
||||||
|
if (conn == null) {
|
||||||
|
throw new org.wso2.carbon.device.mgt.common.exceptions.IllegalTransactionStateException("Database connection is not active. Hence, rollback is "
|
||||||
|
+ "not attempted.");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
conn.rollback();
|
||||||
|
} catch (java.sql.SQLException e) {
|
||||||
|
log.warn("Error occurred while roll-backing the transaction", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Unauthorised copying/redistribution of this file, via any medium is strictly prohibited.
|
||||||
|
*
|
||||||
|
* Licensed under the Entgra Commercial License, Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://entgra.io/licenses/entgra-commercial/1.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.virtualfirealarm.service.impl.dao;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.dto.SensorRecord;
|
||||||
|
import org.wso2.carbon.device.mgt.common.exceptions.*;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
/**
|
||||||
|
* Implements MobileDeviceDAO for Android Devices.
|
||||||
|
*/
|
||||||
|
public class DeviceEventsDAOImpl implements DeviceEventsDAO {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(DeviceEventsDAOImpl.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SensorRecord getStats(String deviceId, long fromTime, long toTime) {
|
||||||
|
String sql = "SELECT * FROM TABLE_VIRTUALFIREALARM_CARBONSUPER_RDBMS_PUBLISHER WHERE " +
|
||||||
|
"META_DEVICEID = ? AND " +
|
||||||
|
"META_TIME >= ? AND " +
|
||||||
|
"META_TIME <= ? " +
|
||||||
|
"ORDER BY META_TIME ASC";
|
||||||
|
Map<Long, Float> stats = new LinkedHashMap<>();
|
||||||
|
try {
|
||||||
|
DeviceEventsDAOFactory.init("jdbc/EVENT_DB");
|
||||||
|
Connection conn = DeviceEventsDAOFactory.getConnection();
|
||||||
|
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||||
|
stmt.setString(1, deviceId);
|
||||||
|
stmt.setLong(2, fromTime);
|
||||||
|
stmt.setLong(3, toTime);
|
||||||
|
try (ResultSet rs = stmt.executeQuery()) {
|
||||||
|
while (rs.next()) {
|
||||||
|
stats.put(rs.getLong("META_TIME"), rs.getFloat("TEMPERATURE"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg = "Error occurred while retrieving device details";
|
||||||
|
log.error(msg);
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (DBConnectionException e) {
|
||||||
|
String msg = "Error occurred while obtaining DB connection to retrieve device details";
|
||||||
|
log.error(msg);
|
||||||
|
|
||||||
|
}
|
||||||
|
// stats.entrySet()
|
||||||
|
// .stream()
|
||||||
|
// .sorted(Map.Entry.<Long, Float>comparingByKey())
|
||||||
|
// .forEach(System.out::println);
|
||||||
|
return new SensorRecord(stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
<?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>device-types</artifactId>
|
||||||
|
<version>6.0.16-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>virtual-fire-alarm-plugin</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>WSO2 Carbon - Virtual Fire Alarm Plugin</name>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl</module>
|
||||||
|
<module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.api</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>
|
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
~
|
||||||
|
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
~ Version 2.0 (the "License"); you may not use this file except
|
||||||
|
~ in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing,
|
||||||
|
~ software distributed under the License is distributed on an
|
||||||
|
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
~ KIND, either express or implied. See the License for the
|
||||||
|
~ specific language governing permissions and limitations
|
||||||
|
~ under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>carbon-device-mgt-plugins-parent</artifactId>
|
||||||
|
<version>6.0.16-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>device-types-feature</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>WSO2 Carbon - Device Management IoT Plugins Feature</name>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>virtual-fire-alarm-plugin-feature</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,157 @@
|
|||||||
|
<?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>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>virtual-fire-alarm-plugin-feature</artifactId>
|
||||||
|
<version>6.0.16-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>WSO2 Carbon - IoT Server VirtualFireAlarm Backend Feature</name>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
<description>This feature contains the VirtualFireAlarm Device type specific backend implementations for the IoT Server
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<!-- <properties>-->
|
||||||
|
<!-- <orbit.h2.version>1.4.199.wso2v1</orbit.h2.version>-->
|
||||||
|
<!-- </properties>-->
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.api</artifactId>
|
||||||
|
<version>${carbon.devicemgt.plugins.version}</version>
|
||||||
|
<type>war</type>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.orbit.com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
<version>${orbit.h2.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-resources</id>
|
||||||
|
<phase>generate-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>src/main/resources</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>build.properties</include>
|
||||||
|
<include>p2.inf</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-jaxrs-war</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactItems>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.api
|
||||||
|
</artifactId>
|
||||||
|
<type>war</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${project.build.directory}/maven-shared-archive-resources/webapps/</outputDirectory>
|
||||||
|
<destFileName>virtual_firealarm.war</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
</artifactItems>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>copy-agent-jar</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactItems>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl
|
||||||
|
</artifactId>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${project.build.directory}/maven-shared-archive-resources/agent/</outputDirectory>
|
||||||
|
<destFileName>wso2-firealarm-virtual-agent.jar</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
</artifactItems>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.wso2.maven</groupId>
|
||||||
|
<artifactId>carbon-p2-plugin</artifactId>
|
||||||
|
<version>${carbon.p2.plugin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>p2-feature-generation</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>p2-feature-gen</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<id>org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend</id>
|
||||||
|
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
|
||||||
|
<adviceFile>
|
||||||
|
<properties>
|
||||||
|
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
|
||||||
|
<propertyDef>org.eclipse.equinox.p2.type.group:true</propertyDef>
|
||||||
|
</properties>
|
||||||
|
</adviceFile>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,34 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed 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.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
#[Device-Configurations]
|
||||||
|
tenantDomain=${TENANT_DOMAIN}
|
||||||
|
owner=${DEVICE_OWNER}
|
||||||
|
deviceId=${DEVICE_ID}
|
||||||
|
device-name=${DEVICE_NAME}
|
||||||
|
https-ep=${HTTPS_EP}
|
||||||
|
http-ep=${HTTP_EP}
|
||||||
|
apim-ep=${APIM_EP}
|
||||||
|
mqtt-ep=${MQTT_EP}
|
||||||
|
xmpp-ep=${XMPP_EP}
|
||||||
|
application-key=${API_APPLICATION_KEY}
|
||||||
|
auth-token=${DEVICE_TOKEN}
|
||||||
|
refresh-token=${DEVICE_REFRESH_TOKEN}
|
||||||
|
push-interval=15
|
||||||
|
xmpp-server-name=${SERVER_NAME}
|
||||||
|
server-jid=${SERVER_JID}
|
||||||
|
|
@ -0,0 +1,2 @@
|
|||||||
|
templates=deviceConfig.properties
|
||||||
|
zipfilename=FireAlarmVirtualAgent.zip
|
@ -0,0 +1,7 @@
|
|||||||
|
@echo off
|
||||||
|
echo.
|
||||||
|
echo.WSO2 IOT Sample
|
||||||
|
echo.Virtual Fire Alarm
|
||||||
|
echo.initializing agent
|
||||||
|
echo.
|
||||||
|
java -jar wso2-firealarm-virtual-agent.jar
|
@ -0,0 +1,190 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "----------------------------------------------------------------"
|
||||||
|
echo "| WSO2 IOT Sample "
|
||||||
|
echo "| Virtual RaspiAlarm "
|
||||||
|
echo "| ---------------- "
|
||||||
|
echo "| ....initializing startup-script "
|
||||||
|
echo "----------------------------------------------------------------"
|
||||||
|
|
||||||
|
#while true; do
|
||||||
|
# read -p "What is the network-interface of your device that the Agent should use (find from ifconfig. ex: wlan0,en0,eth0..) > " interface
|
||||||
|
#
|
||||||
|
# echo "Setting the network-interface to " $interface
|
||||||
|
# sed s/^network-interface=.*/network-interface=$interface/ deviceConfig.properties > myTmp
|
||||||
|
# mv -f myTmp deviceConfig.properties
|
||||||
|
# break;
|
||||||
|
#done
|
||||||
|
#
|
||||||
|
#while true; do
|
||||||
|
# read -p "Whats the time-interval (in seconds) between successive Data-Pushes to the WSO2-IoT-Server (ex: '60' indicates 1 minute) > " interval
|
||||||
|
#
|
||||||
|
# if [ $interval -eq $interval 2>/dev/null ]
|
||||||
|
# then
|
||||||
|
# echo "Setting data-push interval to " $interval " seconds."
|
||||||
|
# sed s/^push-interval=.*/push-interval=$interval/ deviceConfig.properties > myTmp
|
||||||
|
# mv -f myTmp deviceConfig.properties
|
||||||
|
# break;
|
||||||
|
# else
|
||||||
|
# echo "Input needs to be an integer indicating the number seconds between successive data-pushes."
|
||||||
|
# fi
|
||||||
|
#done
|
||||||
|
|
||||||
|
|
||||||
|
java -jar wso2-firealarm-virtual-agent.jar
|
||||||
|
|
||||||
|
#while true; do
|
||||||
|
# read -p "Do you wish to run 'apt-get update' and continue? [Yes/No] " yn
|
||||||
|
# case $yn in
|
||||||
|
# [Yy]* ) sudo apt-get update;
|
||||||
|
# break;;
|
||||||
|
# [Nn]* ) echo "Continuing without apt-get update...";
|
||||||
|
# break;;
|
||||||
|
# * ) echo "Please answer yes or no.";
|
||||||
|
# esac
|
||||||
|
#done
|
||||||
|
#
|
||||||
|
#if [ $? -ne 0 ]; then
|
||||||
|
# echo "apt-get update failed.... Some dependencies may not get installed"
|
||||||
|
# echo "If an already installed version of the package exists, try running:"
|
||||||
|
# echo "----------------------------------------------------------------"
|
||||||
|
# echo "sudo -i"
|
||||||
|
# echo "cd /var/lib/dpkg/info"
|
||||||
|
# echo "rm -rf wso2-raspi-alarm*"
|
||||||
|
# echo "dpkg --remove --force-remove-reinstreq wso2-raspi-alarm"
|
||||||
|
# echo "exit"
|
||||||
|
# echo "----------------------------------------------------------------"
|
||||||
|
# echo "Retry Installation...."
|
||||||
|
# break;
|
||||||
|
#fi
|
||||||
|
#
|
||||||
|
#echo "Installing 'gdebi' package..."
|
||||||
|
#sudo apt-get install gdebi # installation of gdebi
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#if [ $? -ne 0 ]; then
|
||||||
|
# echo "gdebi installation failed.... dependencies will not be installed without gdebi"
|
||||||
|
# read -p "Do you wish to continue without gdebi? [Yes/No] " yn
|
||||||
|
# case $yn in
|
||||||
|
# [Yy]* ) echo "Continueing without gdebi.....";;
|
||||||
|
# [Nn]* ) echo "Try to resolve errors and re-run the script.";
|
||||||
|
# exit;;
|
||||||
|
# * ) exit;;
|
||||||
|
# esac
|
||||||
|
#fi
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#for f in ./wso2-raspi-alarm_1.0_armhf.deb; do
|
||||||
|
# ## Check if the glob gets expanded to existing files.
|
||||||
|
# ## If not, f here will be exactly the pattern above
|
||||||
|
# ## and the exists test will evaluate to false.
|
||||||
|
# # [ -e "$f" ] && echo "'wso2-raspi-alarm_1.0_armhf.deb' file found and installing" || echo "'wso2-raspi-alarm_1.0_armhf.deb' file does not exist in current path"; exit;
|
||||||
|
# if [ -e "$f" ]; then
|
||||||
|
# echo "'wso2-raspi-alarm_1.0_armhf.deb' file found and installing now...."
|
||||||
|
# else
|
||||||
|
# echo "'wso2-raspi-alarm_1.0_armhf.deb' file does not exist in current path. \nExiting installation...";
|
||||||
|
# exit;
|
||||||
|
# fi
|
||||||
|
# ## This is all we needed to know, so we can break after the first iteration
|
||||||
|
# break
|
||||||
|
#done
|
||||||
|
#
|
||||||
|
#echo "Installing the 'wso2-raspi-alarm deb package'"
|
||||||
|
#sudo gdebi wso2-raspi-alarm_1.0_armhf.deb
|
||||||
|
#
|
||||||
|
#if [ $? -ne 0 ]; then
|
||||||
|
# echo "Installation Failed...."
|
||||||
|
# exit;
|
||||||
|
#fi
|
||||||
|
|
||||||
|
#sudo killall -9 python
|
||||||
|
#
|
||||||
|
#for f in ./RaspberryAgent.zip; do
|
||||||
|
# ## Check if the glob gets expanded to existing files.
|
||||||
|
# ## If not, f here will be exactly the pattern above
|
||||||
|
# ## and the exists test will evaluate to false.
|
||||||
|
# # [ -e "$f" ] && echo "'wso2-raspi-alarm_1.0_armhf.deb' file found and installing" || echo "'wso2-raspi-alarm_1.0_armhf.deb' file does not exist in current path"; exit;
|
||||||
|
# if [ -e "$f" ]; then
|
||||||
|
# echo "Agent files found......"
|
||||||
|
# sudo rm -rf /usr/local/src/RaspberryAgent
|
||||||
|
# sudo unzip RaspberryAgent.zip -d /usr/local/src/
|
||||||
|
# else
|
||||||
|
# echo "'RaspberryAgent.zip' file does not exist in current path. \nInstalling without upgrading agent...";
|
||||||
|
# fi
|
||||||
|
# ## This is all we needed to know, so we can break after the first iteration
|
||||||
|
# break
|
||||||
|
#done
|
||||||
|
#
|
||||||
|
#for f in /usr/local/src/RaspberryAgent/rc.local; do
|
||||||
|
# ## Check if the glob gets expanded to existing files.
|
||||||
|
# ## If not, f here will be exactly the pattern above
|
||||||
|
# ## and the exists test will evaluate to false.
|
||||||
|
# if [ -e "$f" ]; then
|
||||||
|
# echo "Copying boot script"
|
||||||
|
# sudo mv /usr/local/src/RaspberryAgent/rc.local /etc/rc.local
|
||||||
|
# sudo chmod +x /etc/rc.local
|
||||||
|
# else
|
||||||
|
# echo "Unable to set agent statup on boot";
|
||||||
|
# fi
|
||||||
|
# ## This is all we needed to know, so we can break after the first iteration
|
||||||
|
# break
|
||||||
|
#done
|
||||||
|
#
|
||||||
|
#for f in ./deviceConfigs.cfg; do
|
||||||
|
# ## Check if the glob gets expanded to existing files.
|
||||||
|
# ## If not, f here will be exactly the pattern above
|
||||||
|
# ## and the exists test will evaluate to false.
|
||||||
|
# if [ -e "$f" ]; then
|
||||||
|
# echo "Configuration file found......"
|
||||||
|
# else
|
||||||
|
# echo "'deviceConfigs.cfg' file does not exist in current path. \nExiting installation...";
|
||||||
|
# exit;
|
||||||
|
# fi
|
||||||
|
# ## This is all we needed to know, so we can break after the first iteration
|
||||||
|
# break
|
||||||
|
#done
|
||||||
|
#
|
||||||
|
#echo "Altering Configuration file"
|
||||||
|
#sed -i 's|[/,]||g' deviceConfigs.cfg
|
||||||
|
#
|
||||||
|
#echo "Copying configurations file to /usr/local/src/RaspberryAgent"
|
||||||
|
#sudo cp ./deviceConfigs.cfg /usr/local/src/RaspberryAgent/
|
||||||
|
#
|
||||||
|
#if [ $? -ne 0 ]; then
|
||||||
|
# echo "Copying configuration file failed...."
|
||||||
|
# exit;
|
||||||
|
#fi
|
||||||
|
#
|
||||||
|
#while true; do
|
||||||
|
# read -p "Whats the time-interval (in seconds) between successive Data-Pushes to the WSO2-DC (ex: '60' indicates 1 minute) > " input
|
||||||
|
#
|
||||||
|
# if [ $input -eq $input 2>/dev/null ]
|
||||||
|
# then
|
||||||
|
# echo "Setting data-push interval to $input seconds."
|
||||||
|
# echo $input > /usr/local/src/RaspberryAgent/time-interval
|
||||||
|
# break;
|
||||||
|
# else
|
||||||
|
# echo "Input needs to be an integer indicating the number seconds between successive data-pushes."
|
||||||
|
# fi
|
||||||
|
#done
|
||||||
|
#
|
||||||
|
#cd /usr/local/src/RaspberryAgent/
|
||||||
|
#sudo chmod +x RaspberryStats.py
|
||||||
|
#sudo nohup ./RaspberryStats.py -i $input </dev/null &
|
||||||
|
#
|
||||||
|
#if [ $? -ne 0 ]; then
|
||||||
|
# echo "Could not start the service..."
|
||||||
|
# exit;
|
||||||
|
#else
|
||||||
|
# echo "Running the RaspberryAgent service...."
|
||||||
|
#fi
|
||||||
|
#
|
||||||
|
#echo "--------------------------------------------------------------------------"
|
||||||
|
#echo "| Successfully Started "
|
||||||
|
#echo "| -------------------------- "
|
||||||
|
#echo "| cd to /usr/local/src/RaspberryAgent"
|
||||||
|
#echo "| run 'sudo nohup ./RaspberryStats.py -i time </dev/null &'to start service manually."
|
||||||
|
#echo "| Relapce time with the time-interval (in seconds) between successive Data-Pushes to the WSO2-DC (ex: '60' indicates 1 minute)"
|
||||||
|
#echo "| Find logs at: /usr/local/src/RaspberryAgent/logs/RaspberryStats.log"
|
||||||
|
#echo "---------------------------------------------------------------------------"
|
||||||
|
|
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
custom = true
|
@ -0,0 +1,58 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
<DeviceTypeConfiguration name="virtual_firealarm">
|
||||||
|
<Features>
|
||||||
|
<Feature code="buzz">
|
||||||
|
<Name>Control buzzer</Name>
|
||||||
|
<Description>Control buzzer on Virtual Firealarm</Description>
|
||||||
|
<Operation context="/virtual_firealarm/device/{deviceId}/buzz" method="POST">
|
||||||
|
</Operation>
|
||||||
|
</Feature>
|
||||||
|
</Features>
|
||||||
|
|
||||||
|
<ProvisioningConfig>
|
||||||
|
<SharedWithAllTenants>true</SharedWithAllTenants>
|
||||||
|
</ProvisioningConfig>
|
||||||
|
|
||||||
|
<PushNotificationProviderConfig type="MQTT">
|
||||||
|
<FileBasedProperties>true</FileBasedProperties>
|
||||||
|
</PushNotificationProviderConfig>
|
||||||
|
|
||||||
|
<!--<PushNotificationProviderConfig type="XMPP">-->
|
||||||
|
<!--<FileBasedProperties>true</FileBasedProperties>-->
|
||||||
|
<!--<!–if file based properties is set to false then the configuration will be picked from platform configuration–>-->
|
||||||
|
<!--<ConfigProperties>-->
|
||||||
|
<!--<Property Name="xmpp.adapter.name">virtualfirealarm.xmpp.adapter</Property>-->
|
||||||
|
<!--<Property Name="host">localhost</Property>-->
|
||||||
|
<!--<Property Name="port">5222</Property>-->
|
||||||
|
<!--<Property Name="username">admin</Property>-->
|
||||||
|
<!--<Property Name="password">admin</Property>-->
|
||||||
|
<!--<Property Name="jid">admin@localhost</Property>-->
|
||||||
|
<!--<Property Name="server.name">localhost</Property>-->
|
||||||
|
<!--</ConfigProperties>-->
|
||||||
|
<!--</PushNotificationProviderConfig>-->
|
||||||
|
|
||||||
|
<License>
|
||||||
|
<Language>en_US</Language>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Text>This is license text</Text>
|
||||||
|
</License>
|
||||||
|
|
||||||
|
</DeviceTypeConfiguration>
|
@ -0,0 +1,16 @@
|
|||||||
|
instructions.configure = \
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/webapps/);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend_${feature.version}/webapps/,target:${installFolder}/../../../repository/deployment/server/webapps/,overwrite:true);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/devicetypes/);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend_${feature.version}/devicetypes/,target:${installFolder}/../../../repository/deployment/server/devicetypes/,overwrite:true);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend_${feature.version}/receiver/,target:${installFolder}/../../../repository/deployment/server/eventreceivers/,overwrite:true);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend_${feature.version}/streams/,target:${installFolder}/../../../repository/deployment/server/eventstreams/,overwrite:true);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend_${feature.version}/publisher/,target:${installFolder}/../../../repository/deployment/server/eventpublishers/,overwrite:true);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/sketches/);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/sketches/virtual_firealarm/);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend_${feature.version}/agent/,target:${installFolder}/../../../repository/resources/sketches/virtual_firealarm/,overwrite:true);\
|
||||||
|
|
||||||
|
instructions.unconfigure = \
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/webapps/virtual_firealarm.war);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/webapps/virtual_firealarm);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/devicetypes/virtual_firealarm.xml);\
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<eventPublisher name="virtual_firealarm_rdbms_publisher-carbon.super" processing="enable"
|
||||||
|
statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
|
||||||
|
<from streamName="iot.per.device.stream.virtualfirealarm" version="1.0.0"/>
|
||||||
|
<mapping customMapping="disable" type="map"/>
|
||||||
|
<to eventAdapterType="rdbms">
|
||||||
|
<property name="datasource.name">EVENT_DB</property>
|
||||||
|
<property name="table.name">table_virtualfirealarm_carbonsuper_rdbms_publisher</property>
|
||||||
|
<property name="execution.mode">insert</property>
|
||||||
|
</to>
|
||||||
|
</eventPublisher>
|
||||||
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
<eventReceiver name="virtualfirealarm_receiver-carbon.super" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventreceiver">
|
||||||
|
<from eventAdapterType="oauth-mqtt">
|
||||||
|
<property name="contentTransformer"/>
|
||||||
|
<property name="topic">carbon.super/virtual_firealarm/+/temperature</property>
|
||||||
|
<property name="contentValidator">default</property>
|
||||||
|
<property name="cleanSession">true</property>
|
||||||
|
</from>
|
||||||
|
<mapping customMapping="disable" type="json"/>
|
||||||
|
<to streamName="iot.per.device.stream.virtualfirealarm" version="1.0.0"/>
|
||||||
|
|
||||||
|
</eventReceiver>
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "iot.per.device.stream.virtualfirealarm",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"nickName": "virtual_firealarm",
|
||||||
|
"description": "Temperature data received from the virtual_firealarm",
|
||||||
|
"metaData": [
|
||||||
|
{"name":"owner","type":"STRING"},
|
||||||
|
{"name":"deviceId","type":"STRING"},
|
||||||
|
{"name":"time","type":"TIMESTAMP"}
|
||||||
|
],
|
||||||
|
"payloadData": [
|
||||||
|
{
|
||||||
|
"name": "temperature","type": "FLOAT"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
~
|
||||||
|
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
~ Version 2.0 (the "License"); you may not use this file except
|
||||||
|
~ in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing,
|
||||||
|
~ software distributed under the License is distributed on an
|
||||||
|
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
~ KIND, either express or implied. See the License for the
|
||||||
|
~ specific language governing permissions and limitations
|
||||||
|
~ under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>device-types-feature</artifactId>
|
||||||
|
<version>6.0.16-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>virtual-fire-alarm-plugin-feature</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>WSO2 Carbon - IoT Server VirtualFireAlarm Device Feature</name>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
Loading…
Reference in new issue