diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml index 795d9d086..925456dbc 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml index 4c897aa83..a2d9c0f6b 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml index b540ebf2a..581c07c33 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/pom.xml b/components/analytics/iot-analytics/pom.xml index 9eb28c648..92ad61b0b 100644 --- a/components/analytics/iot-analytics/pom.xml +++ b/components/analytics/iot-analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins analytics - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/analytics/pom.xml b/components/analytics/pom.xml index 848023896..60cd864f2 100644 --- a/components/analytics/pom.xml +++ b/components/analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml index 0f9fcdad0..951be22be 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml @@ -21,7 +21,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index f85135ebb..fc1a18732 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -3,7 +3,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml index 79d8f8c63..03816ecd9 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml @@ -22,7 +22,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/pom.xml b/components/device-types/androidsense-plugin/pom.xml index 6a310ca39..f25886b19 100644 --- a/components/device-types/androidsense-plugin/pom.xml +++ b/components/device-types/androidsense-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml index 90d7804f1..6b9ca04e0 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml index e7e48b452..532f22f17 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml index f6981badf..385570c29 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml @@ -23,7 +23,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/pom.xml b/components/device-types/arduino-plugin/pom.xml index d6fc20c3f..f37fdec2a 100644 --- a/components/device-types/arduino-plugin/pom.xml +++ b/components/device-types/arduino-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/pom.xml b/components/device-types/pom.xml index 933f1dc92..f64171e44 100644 --- a/components/device-types/pom.xml +++ b/components/device-types/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml index 3b8e5bb5a..ec0649181 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml index c2399a9d2..a80de0fad 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml index aba60ddd8..8c832bbf3 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml @@ -23,7 +23,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/pom.xml b/components/device-types/raspberrypi-plugin/pom.xml index 08a175acd..15fec876b 100644 --- a/components/device-types/raspberrypi-plugin/pom.xml +++ b/components/device-types/raspberrypi-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/pom.xml index 3014a6841..d739f8d11 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml index 3e7328988..ec91a2e5d 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml index ce6469656..436d77892 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml index 57abd74f8..024ef6b57 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml deleted file mode 100644 index 7c29380db..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - virtual-fire-alarm-plugin - org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin - bundle - WSO2 Carbon - IoT Server VirtualFireAlarm Management Plugin - WSO2 Carbon - Virtual FireAlarm Management/Control Plugin Implementation - http://wso2.org - - - - - org.apache.felix - maven-scr-plugin - - - maven-compiler-plugin - - 1.7 - 1.7 - - 2.3.2 - - - org.apache.felix - maven-bundle-plugin - 1.4.0 - true - - - ${project.artifactId} - ${project.artifactId} - ${carbon.devicemgt.plugins.version} - IoT Server Virtual Firealarm Impl Bundle - org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.internal - - org.osgi.framework, - org.osgi.service.component, - org.apache.commons.logging, - javax.naming;resolution:=optional, - javax.sql;resolution:=optional, - org.wso2.carbon.device.mgt.common.*, - org.wso2.carbon.device.mgt.common, - org.wso2.carbon.device.mgt.input.adapter.extension.*, - org.wso2.carbon.device.mgt.extensions.feature.mgt.*, - org.wso2.carbon.utils.*, - org.wso2.carbon.context, - org.wso2.carbon.core, - javax.crypto, - org.apache.commons.codec.binary, - org.json.*;version="${commons-json.version.range}", - org.wso2.carbon.certificate.mgt.core.*, - org.wso2.carbon.device.mgt.analytics.data.publisher.exception, - org.wso2.carbon.device.mgt.analytics.data.publisher.service, - org.wso2.carbon.event.input.adapter.core, - org.wso2.carbon.event.input.adapter.core.exception, - org.jivesoftware.smack.*, - javax.xml, - javax.xml.bind, - javax.xml.bind.annotation, - javax.xml.parsers; version="${javax.xml.parsers.import.pkg.version}", - org.w3c.dom - - - !org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.internal, - org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.*, - - - - - - - - - - commons-codec - commons-codec - - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - - - org.wso2.carbon - org.wso2.carbon.logging - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.common - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.core - - - org.wso2.carbon - org.wso2.carbon.ndatasource.core - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.extensions - - - org.wso2.carbon - org.wso2.carbon.utils - - - org.wso2.carbon.analytics-common - org.wso2.carbon.event.input.adapter.core - - - org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.input.adapter.extension - - - org.json.wso2 - json - - - org.wso2.carbon.devicemgt - org.wso2.carbon.certificate.mgt.core - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.analytics.data.publisher - - - org.igniterealtime.smack.wso2 - smack - - - org.igniterealtime.smack.wso2 - smackx - - - \ No newline at end of file diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/DeviceManagementConfiguration.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/DeviceManagementConfiguration.java deleted file mode 100644 index f7721fdd2..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/DeviceManagementConfiguration.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "DeviceManagementConfiguration") -public class DeviceManagementConfiguration { - - private EventListenerConfiguration eventListenerConfiguration; - - private static final Log log = LogFactory.getLog(DeviceManagementConfiguration.class); - - private DeviceManagementConfiguration() { - } - - @XmlElement(name = "EventListenerConfiguration", required = false) - public EventListenerConfiguration getEventListenerConfiguration() { - return eventListenerConfiguration; - } - - public void setEventListenerConfiguration(EventListenerConfiguration eventListenerConfiguration) { - this.eventListenerConfiguration = eventListenerConfiguration; - } -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/EventListenerConfiguration.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/EventListenerConfiguration.java deleted file mode 100644 index c182b9218..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/EventListenerConfiguration.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; -import java.util.List; - -@XmlRootElement(name = "EventListenerConfiguration") -public class EventListenerConfiguration { - - private String eventListenerProvider; - private List properties; - - @XmlElementWrapper(name = "Properties", required = true) - @XmlElement(name = "Property", required = true) - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - @XmlElement(name = "EventListenerProvider", required = true) - public String getEventListenerProvider() { - return eventListenerProvider; - } - - public void setEventListenerProvider(String eventListenerProvider) { - this.eventListenerProvider = eventListenerProvider; - } - - @XmlRootElement(name = "Property") - public static class Property { - - private String name; - private String value; - - @XmlAttribute(name = "Name", required = true) - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @XmlValue - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - } - -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/VirtualFirealarmConfig.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/VirtualFirealarmConfig.java deleted file mode 100644 index 9bb1380e5..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/VirtualFirealarmConfig.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config.exception.VirtualFirealarmConfigurationException; -import org.wso2.carbon.utils.CarbonUtils; - -import javax.xml.XMLConstants; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.File; -public class VirtualFirealarmConfig { - - private static final Log log = LogFactory.getLog(VirtualFirealarmConfig.class); - private static final String DEVICE_TYPE_CONFIG_PATH = - CarbonUtils.getEtcCarbonConfigDirPath() + File.separator + "device-mgt-plugins" + File.separator - + "virtual_firealarm.xml"; - private static VirtualFirealarmConfig virtualFirealarmConfig = new VirtualFirealarmConfig(); - private static DeviceManagementConfiguration deviceManagementConfiguration; - - public static VirtualFirealarmConfig getInstance() { - return virtualFirealarmConfig; - } - - public static void initialize() throws VirtualFirealarmConfigurationException { - File configFile = new File(DEVICE_TYPE_CONFIG_PATH); - try { - Document doc = convertToDocument(configFile); - - /* Un-marshaling Webapp Authenticator configuration */ - JAXBContext ctx = JAXBContext.newInstance(DeviceManagementConfiguration.class); - Unmarshaller unmarshaller = ctx.createUnmarshaller(); - //unmarshaller.setSchema(getSchema()); - deviceManagementConfiguration = (DeviceManagementConfiguration) unmarshaller.unmarshal(doc); - } catch (JAXBException e) { - throw new VirtualFirealarmConfigurationException("Error occurred while un-marshalling the file " + - DEVICE_TYPE_CONFIG_PATH, e); - } - - } - - public DeviceManagementConfiguration getDeviceTypeConfiguration() { - return deviceManagementConfiguration; - } - - public static Document convertToDocument(File file) throws VirtualFirealarmConfigurationException { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - try { - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - DocumentBuilder docBuilder = factory.newDocumentBuilder(); - return docBuilder.parse(file); - } catch (Exception e) { - throw new VirtualFirealarmConfigurationException("Error occurred while parsing file, while converting " + - "to a org.w3c.dom.Document", e); - } - } -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/exception/VirtualFirealarmConfigurationException.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/exception/VirtualFirealarmConfigurationException.java deleted file mode 100644 index 0cba81bcc..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/exception/VirtualFirealarmConfigurationException.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config.exception; - -public class VirtualFirealarmConfigurationException extends Exception { - - private static final long serialVersionUID = -3151279431229070297L; - - public VirtualFirealarmConfigurationException(int errorCode, String message) { - super(message); - } - - public VirtualFirealarmConfigurationException(int errorCode, String message, Throwable cause) { - super(message, cause); - } - - public VirtualFirealarmConfigurationException(String msg, Exception nestedEx) { - super(msg, nestedEx); - } - - public VirtualFirealarmConfigurationException(String message, Throwable cause) { - super(message, cause); - } - - public VirtualFirealarmConfigurationException(String msg) { - super(msg); - } - - public VirtualFirealarmConfigurationException() { - super(); - } - - public VirtualFirealarmConfigurationException(Throwable cause) { - super(cause); - } - -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/constants/VirtualFireAlarmConstants.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/constants/VirtualFireAlarmConstants.java deleted file mode 100644 index 5815fa1c7..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/constants/VirtualFireAlarmConstants.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.constants; - -import org.wso2.carbon.utils.CarbonUtils; - -import java.io.File; - -public class VirtualFireAlarmConstants { - public final static String DEVICE_TYPE = "virtual_firealarm"; - public final static String DEVICE_PLUGIN_DEVICE_NAME = "DEVICE_NAME"; - public final static String DEVICE_PLUGIN_DEVICE_ID = "VIRTUAL_FIREALARM_DEVICE_ID"; - public final static String STATE_ON = "ON"; - public final static String STATE_OFF = "OFF"; - - public static final String URL_PREFIX = "http://"; - public static final String BULB_CONTEXT = "BULB"; - public static final String POLICY_CONTEXT = "POLICY"; - - //sensor events sumerized table name for temperature - public static final String TEMPERATURE_EVENT_TABLE = "DEVICE_TEMPERATURE_SUMMARY"; - public final static String DEVICE_TYPE_PROVIDER_DOMAIN = "carbon.super"; - - //mqtt tranport related constants - public static final String MQTT_ADAPTER_NAME = "virtual_firealarm_mqtt"; - public static final String MQTT_ADAPTER_TYPE = "oauth-mqtt"; - public static final String ADAPTER_TOPIC_PROPERTY = "topic"; - public static final String MQTT_PORT = "\\$\\{mqtt.broker.port\\}"; - public static final String MQTT_BROKER_HOST = "\\$\\{mqtt.broker.host\\}"; - public static final String CARBON_CONFIG_PORT_OFFSET = "Ports.Offset"; - public static final String DEFAULT_CARBON_LOCAL_IP_PROPERTY = "carbon.local.ip"; - public static final int CARBON_DEFAULT_PORT_OFFSET = 0; - public static final int DEFAULT_MQTT_PORT = 1886; - - //xmpp transport related constants - public static final String XMPP_ADAPTER_NAME = "virtual_firealarm_xmpp"; - public static final String XMPP_ADAPTER_TYPE = "xmpp"; - public static final String PASSWORD_PROPERTY_KEY = "password"; - public static final String JID_PROPERTY_KEY = "jid"; - public static final String CLIENT_JID_PROPERTY_KEY = "xmpp.client.jid"; - public static final String SUBJECT_PROPERTY_KEY = "xmpp.client.subject"; - public static final String MESSAGE_TYPE_PROPERTY_KEY = "xmpp.client.messageType"; - public static final String CHAT_PROPERTY_KEY = "chat"; - - public static final String USERNAME_PROPERTY_KEY = "username"; - public static final String DCR_PROPERTY_KEY = "dcrUrl"; - public static final String BROKER_URL_PROPERTY_KEY = "url"; - public static final String SCOPES_PROPERTY_KEY = "scopes"; - public static final String QOS_PROPERTY_KEY = "qos"; - public static final String CLIENT_ID_PROPERTY_KEY = "qos"; - public static final String CLEAR_SESSION_PROPERTY_KEY = "clearSession"; - public static final String TOPIC = "topic"; - public static final String SUBSCRIBED_TOPIC = "carbon.super/virtual_firealarm/+/publisher"; - - public static final String CONTENT_VALIDATION = "contentValidator"; - public static final String CONTENT_TRANSFORMATION = "contentTransformer"; - public static final String RESOURCE = "resource"; - - public static final String JSON_SERIAL_KEY = "SerialNumber"; - public static final String TEMPERATURE_STREAM_DEFINITION = "org.wso2.iot.devices.temperature"; - public static final String JSON_MESSAGE_KEY = "Msg"; - public static final String JSON_SIGNATURE_KEY = "Sig"; - - public static final String HOST_KEY = "host"; - public static final String PORT_KEY = "port"; - - public static final String SERVER_NAME = "serverName"; - - public static final String MQTT_ADAPTER_TOPIC_PROPERTY_NAME = "mqtt.adapter.topic"; - - public static final String APIM_APPLICATION_TOKEN_VALIDITY_PERIOD = "3600"; -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/exception/VirtualFirealarmDeviceMgtPluginException.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/exception/VirtualFirealarmDeviceMgtPluginException.java deleted file mode 100644 index 150745ac8..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/exception/VirtualFirealarmDeviceMgtPluginException.java +++ /dev/null @@ -1,56 +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.virtualfirealarm.plugin.exception; - - -public class VirtualFirealarmDeviceMgtPluginException extends Exception{ - - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public VirtualFirealarmDeviceMgtPluginException(String msg, Exception nestedEx) { - super(msg, nestedEx); - setErrorMessage(msg); - } - - public VirtualFirealarmDeviceMgtPluginException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public VirtualFirealarmDeviceMgtPluginException(String msg) { - super(msg); - setErrorMessage(msg); - } - - public VirtualFirealarmDeviceMgtPluginException() { - super(); - } - - public VirtualFirealarmDeviceMgtPluginException(Throwable cause) { - super(cause); - } - -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFireAlarmUtils.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFireAlarmUtils.java deleted file mode 100644 index d9dbf9936..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFireAlarmUtils.java +++ /dev/null @@ -1,223 +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.virtualfirealarm.plugin.impl; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException; -import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; -import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.constants.VirtualFireAlarmConstants; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.exception.VirtualFirealarmDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.internal.VirtualFirealarmManagementDataHolder; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.mqtt.MqttConfig; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.xmpp.XmppConfig; -import org.wso2.carbon.event.input.adapter.core.InputEventAdapterConfiguration; -import org.wso2.carbon.event.input.adapter.core.MessageType; -import org.wso2.carbon.event.input.adapter.core.exception.InputEventAdapterException; -import org.json.JSONObject; - -import java.io.IOException; -import java.security.PublicKey; -import java.security.cert.X509Certificate; -import java.util.HashMap; -import java.util.Map; - -/** - * Contains utility methods used by FireAlarm plugin. - */ -public class VirtualFireAlarmUtils { - - private static Log log = LogFactory.getLog(VirtualFireAlarmUtils.class); - - public static void setupMqttInputAdapter() throws IOException { - if (!MqttConfig.getInstance().isEnabled()) { - return; - } - InputEventAdapterConfiguration inputEventAdapterConfiguration = - createMqttInputEventAdapterConfiguration(VirtualFireAlarmConstants.MQTT_ADAPTER_NAME, - VirtualFireAlarmConstants.MQTT_ADAPTER_TYPE, MessageType.TEXT); - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain( - VirtualFireAlarmConstants.DEVICE_TYPE_PROVIDER_DOMAIN, true); - VirtualFirealarmManagementDataHolder.getInstance().getInputEventAdapterService() - .create(inputEventAdapterConfiguration, new VirtualFirealarmEventAdapterSubscription()); - } catch (InputEventAdapterException e) { - log.error("Unable to create Input Event Adapter : " + VirtualFireAlarmConstants.MQTT_ADAPTER_NAME, e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - } - - /** - * Create Output Event Adapter Configuration for given configuration. - * - * @param name Input Event Adapter name - * @param type Input Event Adapter type - * @param msgFormat Input Event Adapter message format - * @return InputEventAdapterConfiguration instance for given configuration - */ - private static InputEventAdapterConfiguration createMqttInputEventAdapterConfiguration(String name, String type, - String msgFormat) throws IOException { - InputEventAdapterConfiguration inputEventAdapterConfiguration = new InputEventAdapterConfiguration(); - inputEventAdapterConfiguration.setName(name); - inputEventAdapterConfiguration.setType(type); - inputEventAdapterConfiguration.setMessageFormat(msgFormat); - Map mqttAdapterProperties = new HashMap<>(); - mqttAdapterProperties.put(VirtualFireAlarmConstants.USERNAME_PROPERTY_KEY, MqttConfig.getInstance().getUsername()); - mqttAdapterProperties.put(VirtualFireAlarmConstants.DCR_PROPERTY_KEY, MqttConfig.getInstance().getDcrUrl()); - mqttAdapterProperties.put(VirtualFireAlarmConstants.BROKER_URL_PROPERTY_KEY, MqttConfig.getInstance().getUrl()); - mqttAdapterProperties.put(VirtualFireAlarmConstants.SCOPES_PROPERTY_KEY, MqttConfig.getInstance().getScopes()); - mqttAdapterProperties.put(VirtualFireAlarmConstants.CLEAR_SESSION_PROPERTY_KEY, MqttConfig.getInstance() - .getClearSession()); - mqttAdapterProperties.put(VirtualFireAlarmConstants.QOS_PROPERTY_KEY, MqttConfig.getInstance().getQos()); - mqttAdapterProperties.put(VirtualFireAlarmConstants.CLIENT_ID_PROPERTY_KEY, ""); - mqttAdapterProperties.put(VirtualFireAlarmConstants.TOPIC, VirtualFireAlarmConstants.SUBSCRIBED_TOPIC); - mqttAdapterProperties.put(VirtualFireAlarmConstants.CONTENT_TRANSFORMATION, - VirtualFirealarmMqttContentTransformer.class.getName()); - mqttAdapterProperties.put(VirtualFireAlarmConstants.CONTENT_VALIDATION, "default"); - mqttAdapterProperties.put(VirtualFireAlarmConstants.RESOURCE, "input-event"); - inputEventAdapterConfiguration.setProperties(mqttAdapterProperties); - - return inputEventAdapterConfiguration; - } - - public static String extractMessageFromPayload(String message, PublicKey verifySignatureKey) - throws VirtualFirealarmDeviceMgtPluginException { - String actualMessage; - - JSONObject jsonPayload = new JSONObject(message); - Object encodedMessage = jsonPayload.get(VirtualFireAlarmConstants.JSON_MESSAGE_KEY); - Object signedPayload = jsonPayload.get(VirtualFireAlarmConstants.JSON_SIGNATURE_KEY); - - if (encodedMessage != null && signedPayload != null) { - if (VirtualFirealarmSecurityManager.verifySignature( - encodedMessage.toString(), signedPayload.toString(), verifySignatureKey)) { - actualMessage = new String(Base64.decodeBase64(encodedMessage.toString())); - //VirtualFirealarmSecurityManager.decryptMessage(encryptedMessage.toString(), decryptionKey); - } else { - String errorMsg = "The message was not signed by a valid client. Could not verify signature on payload"; - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg); - } - } else { - String errorMsg = "The received message is in an INVALID format. " + - "Need to be JSON - {\"Msg\":\"\", \"Sig\":\"\"}."; - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg); - } - - return actualMessage; - } - - public static PublicKey getDevicePublicKey(String alias) throws VirtualFirealarmDeviceMgtPluginException { - PublicKey clientPublicKey; - try { - CertificateManagementService certificateManagementService = - VirtualFirealarmManagementDataHolder.getInstance().getCertificateManagementService(); - X509Certificate clientCertificate = (X509Certificate) certificateManagementService.getCertificateByAlias( - alias); - clientPublicKey = clientCertificate.getPublicKey(); - } catch (KeystoreException e) { - String errorMsg; - if (e.getMessage().contains("NULL_CERT")) { - errorMsg = "The Device-View page might have been accessed prior to the device being started."; - if(log.isDebugEnabled()){ - log.debug(errorMsg); - } - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } else { - errorMsg = "An error occurred whilst trying to retrieve certificate for alias [" + alias + - "] with alias: [" + alias + "]"; - if(log.isDebugEnabled()){ - log.debug(errorMsg); - } - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } - } - return clientPublicKey; - } - - public static boolean publishToDAS(String deviceId, float temperature) { - EventsPublisherService deviceAnalyticsService = - VirtualFirealarmManagementDataHolder.getInstance().getEventsPublisherService(); - if (deviceAnalyticsService != null) { - String owner = ""; - Object metdaData[] = {owner, VirtualFireAlarmConstants.DEVICE_TYPE, deviceId, System.currentTimeMillis()}; - Object payloadData[] = {temperature}; - try { - deviceAnalyticsService.publishEvent(VirtualFireAlarmConstants.TEMPERATURE_STREAM_DEFINITION, - "1.0.0", metdaData, new Object[0], payloadData); - } catch (DataPublisherConfigurationException e) { - return false; - } - return true; - } - return false; - } - - public static void setupXmppInputAdapter() throws IOException { - if (!XmppConfig.getInstance().isEnabled()) return; - InputEventAdapterConfiguration inputEventAdapterConfiguration = - createXmppInputEventAdapterConfiguration(VirtualFireAlarmConstants.XMPP_ADAPTER_NAME, - VirtualFireAlarmConstants.XMPP_ADAPTER_TYPE, MessageType.TEXT); - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain( - VirtualFireAlarmConstants.DEVICE_TYPE_PROVIDER_DOMAIN, true); - VirtualFirealarmManagementDataHolder.getInstance().getInputEventAdapterService() - .create(inputEventAdapterConfiguration, new VirtualFirealarmEventAdapterSubscription()); - } catch (InputEventAdapterException e) { - log.error("Unable to create Input Event Adapter : " + VirtualFireAlarmConstants.MQTT_ADAPTER_NAME, e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - } - - /** - * Create Input Event Adapter Configuration for given configuration. - * - * @param name Input Event Adapter name - * @param type Input Event Adapter type - * @param msgFormat Input Event Adapter message format - * @return InputEventAdapterConfiguration instance for given configuration - */ - private static InputEventAdapterConfiguration createXmppInputEventAdapterConfiguration(String name, String type, - String msgFormat) throws IOException { - InputEventAdapterConfiguration inputEventAdapterConfiguration = new InputEventAdapterConfiguration(); - inputEventAdapterConfiguration.setName(name); - inputEventAdapterConfiguration.setType(type); - inputEventAdapterConfiguration.setMessageFormat(msgFormat); - Map xmppAdapterProperties = new HashMap<>(); - XmppConfig xmppConfig = XmppConfig.getInstance(); - xmppAdapterProperties.put(VirtualFireAlarmConstants.HOST_KEY, xmppConfig.getHost()); - xmppAdapterProperties.put(VirtualFireAlarmConstants.PORT_KEY, String.valueOf(xmppConfig.getPort())); - xmppAdapterProperties.put(VirtualFireAlarmConstants.USERNAME_PROPERTY_KEY, xmppConfig.getUsername()); - xmppAdapterProperties.put(VirtualFireAlarmConstants.PASSWORD_PROPERTY_KEY, xmppConfig.getPassword()); - xmppAdapterProperties.put(VirtualFireAlarmConstants.JID_PROPERTY_KEY, xmppConfig.getJid()); - xmppAdapterProperties.put(VirtualFireAlarmConstants.CONTENT_TRANSFORMATION, - VirtualFirealarmXmppContentTransformer.class.getName()); - xmppAdapterProperties.put(VirtualFireAlarmConstants.CONTENT_VALIDATION, "default"); - inputEventAdapterConfiguration.setProperties(xmppAdapterProperties); - return inputEventAdapterConfiguration; - } - -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmEventAdapterSubscription.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmEventAdapterSubscription.java deleted file mode 100644 index 89c977260..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmEventAdapterSubscription.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.impl; - -import org.wso2.carbon.event.input.adapter.core.InputEventAdapterSubscription; - -public class VirtualFirealarmEventAdapterSubscription implements InputEventAdapterSubscription { - - @Override - public void onEvent(Object o) { - String msg = (String) o; - if (msg != null && !msg.isEmpty()) { - String[] messages = (msg).split(","); - String deviceId = messages[0]; - String actualMessage = messages[1]; - if (actualMessage.contains("PUBLISHER")) { - float temperature = Float.parseFloat(actualMessage.split(":")[2]); - VirtualFireAlarmUtils.publishToDAS(deviceId, temperature); - } else { - float temperature = Float.parseFloat(actualMessage.split(":")[1]); - VirtualFireAlarmUtils.publishToDAS(deviceId, temperature); - } - } - } -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmMqttContentTransformer.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmMqttContentTransformer.java deleted file mode 100644 index bf42dd578..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmMqttContentTransformer.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.impl; - -import org.json.JSONObject; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.input.adapter.extension.ContentTransformer; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.constants.VirtualFireAlarmConstants; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.exception.VirtualFirealarmDeviceMgtPluginException; - -import java.security.PublicKey; -import java.util.Map; - -public class VirtualFirealarmMqttContentTransformer implements ContentTransformer { - - @Override - public Object transform(Object message, Map dynamicProperties) { - String topic = (String) dynamicProperties.get("topic"); - String[] topicParams = topic.split("/"); - String tenantDomain = topicParams[0]; - String deviceId = topicParams[2]; - JSONObject jsonPayload = new JSONObject((String) message); - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ctx.setTenantDomain(tenantDomain, true); - Integer serialNo = (Integer) jsonPayload.get(VirtualFireAlarmConstants.JSON_SERIAL_KEY); - // the hash-code of the deviceId is used as the alias for device certificates during SCEP enrollment. - // hence, the same is used here to fetch the device-specific-certificate from the key store. - PublicKey clientPublicKey = VirtualFireAlarmUtils.getDevicePublicKey("" + serialNo); - - // the MQTT-messages from VirtualFireAlarm devices are in the form {"Msg":, "Sig":} - String actualMessage = VirtualFireAlarmUtils.extractMessageFromPayload((String) message, clientPublicKey); - return deviceId + "," + actualMessage; - } catch (VirtualFirealarmDeviceMgtPluginException e) { - return ""; - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - } -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmSecurityManager.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmSecurityManager.java deleted file mode 100644 index f7b19fdce..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmSecurityManager.java +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.impl; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.certificate.mgt.core.config.CertificateConfigurationManager; -import org.wso2.carbon.certificate.mgt.core.config.CertificateKeystoreConfig; -import org.wso2.carbon.certificate.mgt.core.exception.CertificateManagementException; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.exception.VirtualFirealarmDeviceMgtPluginException; - -import javax.crypto.BadPaddingException; -import javax.crypto.Cipher; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.NoSuchPaddingException; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.security.InvalidKeyException; -import java.security.Key; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.Signature; -import java.security.SignatureException; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; - -public class VirtualFirealarmSecurityManager { - private static final Log log = LogFactory.getLog(VirtualFirealarmSecurityManager.class); - - private static PrivateKey serverPrivateKey; - private static final String SHA_512 = "SHA-512"; - private static final String CIPHER_PADDING = "RSA/ECB/PKCS1Padding"; - private static CertificateKeystoreConfig certificateKeystoreConfig; - private VirtualFirealarmSecurityManager() { - - } - - private static CertificateKeystoreConfig getCertKeyStoreConfig() throws CertificateManagementException { - if (certificateKeystoreConfig == null) { - certificateKeystoreConfig = CertificateConfigurationManager.getInstance().getCertificateKeyStoreConfig(); - } - return certificateKeystoreConfig; - } - - public static void initVerificationManager() { - serverPrivateKey = retrievePrivateKey(); - } - - public static PrivateKey retrievePrivateKey() { - PrivateKey privateKey = null; - InputStream inputStream = null; - KeyStore keyStore; - try { - CertificateKeystoreConfig certificateKeystoreConfig = getCertKeyStoreConfig(); - keyStore = KeyStore.getInstance(certificateKeystoreConfig.getCertificateKeystoreType()); - inputStream = new FileInputStream(certificateKeystoreConfig.getCertificateKeystoreLocation()); - - keyStore.load(inputStream, certificateKeystoreConfig.getCertificateKeystorePassword().toCharArray()); - - privateKey = (PrivateKey) (keyStore.getKey(certificateKeystoreConfig.getCACertAlias(), - certificateKeystoreConfig.getCAPrivateKeyPassword().toCharArray())); - - } catch (KeyStoreException e) { - String errorMsg = "Could not load KeyStore of given type in [certificate-config.xml] file." ; - log.error(errorMsg, e); - } catch (FileNotFoundException e) { - String errorMsg = "KeyStore file could not be loaded from path given in [certificate-config.xml] file."; - log.error(errorMsg, e); - } catch (NoSuchAlgorithmException e) { - String errorMsg = "Algorithm not found when loading KeyStore"; - log.error(errorMsg, e); - } catch (CertificateException e) { - String errorMsg = "CertificateException when loading KeyStore"; - log.error(errorMsg, e); - } catch (IOException e) { - String errorMsg = "Input output issue occurred when loading KeyStore"; - log.error(errorMsg, e); - } catch (UnrecoverableKeyException e) { - String errorMsg = "Key is unrecoverable when retrieving CA private key"; - log.error(errorMsg, e); - } catch (CertificateManagementException e) { - String errorMsg = "Failed to load the certificate"; - log.error(errorMsg, e); - } finally { - try { - if (inputStream != null) { - inputStream.close(); - } - } catch (IOException e) { - log.error("Error closing KeyStore input stream", e); - } - } - - return privateKey; - } - - public static PrivateKey getServerPrivateKey() { - return serverPrivateKey; - } - - public static String encryptMessage(String message, Key encryptionKey) throws - VirtualFirealarmDeviceMgtPluginException { - Cipher encrypter; - byte[] cipherData; - - try { - encrypter = Cipher.getInstance(CIPHER_PADDING); - encrypter.init(Cipher.ENCRYPT_MODE, encryptionKey); - cipherData = encrypter.doFinal(message.getBytes(StandardCharsets.UTF_8)); - - } catch (NoSuchAlgorithmException e) { - String errorMsg = "Algorithm not found exception occurred for Cipher instance of [" + CIPHER_PADDING + "]"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } catch (NoSuchPaddingException e) { - String errorMsg = "No Padding error occurred for Cipher instance of [" + CIPHER_PADDING + "]"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } catch (InvalidKeyException e) { - String errorMsg = "InvalidKey exception occurred for encryptionKey \n[\n" + encryptionKey + "\n]\n"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } catch (BadPaddingException e) { - String errorMsg = "Bad Padding error occurred for Cipher instance of [" + CIPHER_PADDING + "]"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } catch (IllegalBlockSizeException e) { - String errorMsg = "Illegal blockSize error occurred for Cipher instance of [" + CIPHER_PADDING + "]"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } - - return Base64.encodeBase64String(cipherData); - } - - public static String signMessage(String encryptedData, PrivateKey signatureKey) throws VirtualFirealarmDeviceMgtPluginException { - - Signature signature; - String signedEncodedString; - - try { - signature = Signature.getInstance(SHA_512); - signature.initSign(signatureKey); - signature.update(Base64.decodeBase64(encryptedData)); - - byte[] signatureBytes = signature.sign(); - signedEncodedString = Base64.encodeBase64String(signatureBytes); - - } catch (NoSuchAlgorithmException e) { - String errorMsg = "Algorithm not found exception occurred for Signature instance of [" + SHA_512 + "]"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } catch (SignatureException e) { - String errorMsg = "Signature exception occurred for Signature instance of [" + SHA_512 + "]"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } catch (InvalidKeyException e) { - String errorMsg = "InvalidKey exception occurred for signatureKey \n[\n" + signatureKey + "\n]\n"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } - - return signedEncodedString; - } - - public static boolean verifySignature(String data, String signedData, PublicKey verificationKey) - throws VirtualFirealarmDeviceMgtPluginException { - - Signature signature; - boolean verified; - - try { - signature = Signature.getInstance(SHA_512); - signature.initVerify(verificationKey); - signature.update(Base64.decodeBase64(data)); - - verified = signature.verify(Base64.decodeBase64(signedData)); - - } catch (NoSuchAlgorithmException e) { - String errorMsg = "Algorithm not found exception occurred for Signature instance of [" + SHA_512 + "]"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } catch (SignatureException e) { - String errorMsg = "Signature exception occurred for Signature instance of [" + SHA_512 + "]"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } catch (InvalidKeyException e) { - String errorMsg = "InvalidKey exception occurred for signatureKey \n[\n" + verificationKey + "\n]\n"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } - - return verified; - } - - public static String decryptMessage(String encryptedMessage, Key decryptKey) throws VirtualFirealarmDeviceMgtPluginException { - - Cipher decrypter; - String decryptedMessage; - - try { - - decrypter = Cipher.getInstance(CIPHER_PADDING); - decrypter.init(Cipher.DECRYPT_MODE, decryptKey); - decryptedMessage = new String(decrypter.doFinal(Base64.decodeBase64(encryptedMessage)), StandardCharsets.UTF_8); - - } catch (NoSuchAlgorithmException e) { - String errorMsg = "Algorithm not found exception occurred for Cipher instance of [" + CIPHER_PADDING + "]"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } catch (NoSuchPaddingException e) { - String errorMsg = "No Padding error occurred for Cipher instance of [" + CIPHER_PADDING + "]"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } catch (InvalidKeyException e) { - String errorMsg = "InvalidKey exception occurred for encryptionKey \n[\n" + decryptKey + "\n]\n"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } catch (BadPaddingException e) { - String errorMsg = "Bad Padding error occurred for Cipher instance of [" + CIPHER_PADDING + "]"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } catch (IllegalBlockSizeException e) { - String errorMsg = "Illegal blockSize error occurred for Cipher instance of [" + CIPHER_PADDING + "]"; - log.error(errorMsg); - throw new VirtualFirealarmDeviceMgtPluginException(errorMsg, e); - } - - return decryptedMessage; - } - - -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmStartupListener.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmStartupListener.java deleted file mode 100644 index 70dbcc7d9..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmStartupListener.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.core.ServerStartupObserver; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.internal.VirtualFirealarmManagementDataHolder; - -import java.io.IOException; - -public class VirtualFirealarmStartupListener implements ServerStartupObserver { - private static final Log log = LogFactory.getLog(VirtualFirealarmStartupListener.class); - - @Override - public void completingServerStartup() { - } - - @Override - public void completedServerStartup() { - try { - VirtualFireAlarmUtils.setupMqttInputAdapter(); - VirtualFireAlarmUtils.setupXmppInputAdapter(); - VirtualFirealarmManagementDataHolder.getInstance().getInputEventAdapterService().start(); - } catch (IOException e) { - log.error("Failed to intilaize the virtual firealarm input adapter", e); - } - } - -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmXmppContentTransformer.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmXmppContentTransformer.java deleted file mode 100644 index 20ae77f46..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/impl/VirtualFirealarmXmppContentTransformer.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.impl; - -import org.json.JSONObject; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.input.adapter.extension.ContentTransformer; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.constants.VirtualFireAlarmConstants; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.exception.VirtualFirealarmDeviceMgtPluginException; - -import java.security.PublicKey; -import java.util.Map; - -public class VirtualFirealarmXmppContentTransformer implements ContentTransformer { - - @Override - public Object transform(Object message, Map dynamicProperties) { - String from = (String) dynamicProperties.get("from"); - String subject = (String) dynamicProperties.get("subject"); - - int indexOfAt = from.indexOf("@"); - int indexOfSlash = from.indexOf("/"); - - if (indexOfAt != -1 && indexOfSlash != -1) { - String deviceId = from.substring(0, indexOfAt); - JSONObject jsonPayload = new JSONObject((String) message); - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ctx.setTenantDomain(subject, true); - Integer serialNo = (Integer) jsonPayload.get(VirtualFireAlarmConstants.JSON_SERIAL_KEY); - // the hash-code of the deviceId is used as the alias for device certificates during SCEP enrollment. - // hence, the same is used here to fetch the device-specific-certificate from the key store. - PublicKey clientPublicKey = VirtualFireAlarmUtils.getDevicePublicKey("" + serialNo); - - // the MQTT-messages from VirtualFireAlarm devices are in the form {"Msg":, "Sig":} - String actualMessage = VirtualFireAlarmUtils.extractMessageFromPayload((String) message, - clientPublicKey); - return deviceId + "," + actualMessage; - } catch (VirtualFirealarmDeviceMgtPluginException e) { - return ""; - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - } - return ""; - } -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/internal/VirtualFirealarmManagementDataHolder.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/internal/VirtualFirealarmManagementDataHolder.java deleted file mode 100644 index 9fc9111fb..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/internal/VirtualFirealarmManagementDataHolder.java +++ /dev/null @@ -1,67 +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.virtualfirealarm.plugin.internal; - -import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; -import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService; -import org.wso2.carbon.event.input.adapter.core.InputEventAdapterService; - -/** - * DataHolder class of virtual firealarm plugins component. - */ -public class VirtualFirealarmManagementDataHolder { - - private InputEventAdapterService inputEventAdapterService; - private EventsPublisherService eventsPublisherService; - private CertificateManagementService certificateManagementService; - - private static VirtualFirealarmManagementDataHolder thisInstance = new VirtualFirealarmManagementDataHolder(); - - private VirtualFirealarmManagementDataHolder() { - } - - public static VirtualFirealarmManagementDataHolder getInstance() { - return thisInstance; - } - - public InputEventAdapterService getInputEventAdapterService() { - return inputEventAdapterService; - } - - public void setInputEventAdapterService(InputEventAdapterService inputEventAdapterService) { - this.inputEventAdapterService = inputEventAdapterService; - } - - public EventsPublisherService getEventsPublisherService() { - return eventsPublisherService; - } - - public void setEventsPublisherService( - EventsPublisherService eventsPublisherService) { - this.eventsPublisherService = eventsPublisherService; - } - - public CertificateManagementService getCertificateManagementService() { - return certificateManagementService; - } - - public void setCertificateManagementService(CertificateManagementService certificateManagementService) { - this.certificateManagementService = certificateManagementService; - } -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/internal/VirtualFirealarmManagementServiceComponent.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/internal/VirtualFirealarmManagementServiceComponent.java deleted file mode 100644 index 6a1e8c4bf..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/internal/VirtualFirealarmManagementServiceComponent.java +++ /dev/null @@ -1,117 +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.virtualfirealarm.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.certificate.mgt.core.service.CertificateManagementService; -import org.wso2.carbon.core.ServerStartupObserver; -import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config.VirtualFirealarmConfig; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.impl.VirtualFirealarmSecurityManager; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.impl.VirtualFirealarmStartupListener; -import org.wso2.carbon.event.input.adapter.core.InputEventAdapterService; - -/** - * @scr.component name="org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.internal - * .VirtualFirealarmManagementServiceComponent" - * immediate="true" - * @scr.reference name="event.input.adapter.service" - * interface="org.wso2.carbon.event.input.adapter.core.InputEventAdapterService" - * cardinality="1..1" - * policy="dynamic" - * bind="setInputEventAdapterService" - * unbind="unsetInputEventAdapterService" - * @scr.reference name="certificate.management.service" - * interface="org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService" - * cardinality="1..1" - * policy="dynamic" - * bind="setCertificateManagementService" - * unbind="unsetCertificateManagementService" - * @scr.reference name="event.publisher.service" - * interface="org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService" - * cardinality="1..1" - * policy="dynamic" - * bind="setEventsPublisherService" - * unbind="unsetEventsPublisherService" - */ -public class VirtualFirealarmManagementServiceComponent { - - private static final Log log = LogFactory.getLog(VirtualFirealarmManagementServiceComponent.class); - private ServiceRegistration firealarmServiceRegRef; - - protected void activate(ComponentContext ctx) { - if (log.isDebugEnabled()) { - log.debug("Activating Virtual Firealarm Device Management Service Component"); - } - try { - VirtualFirealarmConfig.initialize(); - BundleContext bundleContext = ctx.getBundleContext(); - bundleContext.registerService(ServerStartupObserver.class.getName(), new VirtualFirealarmStartupListener(), - null); - if (log.isDebugEnabled()) { - log.debug("Virtual Firealarm Device Management Service Component has been successfully activated"); - } - VirtualFirealarmSecurityManager.initVerificationManager(); - } catch (Throwable e) { - log.error("Error occurred while activating Virtual Firealarm Device Management Service Component", e); - } - } - - protected void deactivate(ComponentContext ctx) { - if (log.isDebugEnabled()) { - log.debug("De-activating Virtual Firealarm Device Management Service Component"); - } - } - - /** - * Initialize the Input EventAdapter Service dependency - * - * @param inputEventAdapterService Input EventAdapter Service reference - */ - protected void setInputEventAdapterService(InputEventAdapterService inputEventAdapterService) { - VirtualFirealarmManagementDataHolder.getInstance().setInputEventAdapterService(inputEventAdapterService); - } - - /** - * De-reference the Input EventAdapter Service dependency. - */ - protected void unsetInputEventAdapterService(InputEventAdapterService inputEventAdapterService) { - VirtualFirealarmManagementDataHolder.getInstance().setInputEventAdapterService(null); - } - - protected void setCertificateManagementService(CertificateManagementService certificateManagementService) { - VirtualFirealarmManagementDataHolder.getInstance().setCertificateManagementService(certificateManagementService); - } - - protected void unsetCertificateManagementService(CertificateManagementService certificateManagementService) { - VirtualFirealarmManagementDataHolder.getInstance().setCertificateManagementService(null); - } - - protected void setEventsPublisherService(EventsPublisherService eventsPublisherService) { - VirtualFirealarmManagementDataHolder.getInstance().setEventsPublisherService(eventsPublisherService); - } - - protected void unsetEventsPublisherService(EventsPublisherService eventsPublisherService) { - VirtualFirealarmManagementDataHolder.getInstance().setEventsPublisherService(null); - } -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/mqtt/MqttConfig.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/mqtt/MqttConfig.java deleted file mode 100644 index e47ac11ea..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/mqtt/MqttConfig.java +++ /dev/null @@ -1,108 +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.virtualfirealarm.plugin.mqtt; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config.DeviceManagementConfiguration; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config.EventListenerConfiguration; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config.VirtualFirealarmConfig; - -import java.util.List; - -public class MqttConfig { - - private static MqttConfig mqttConfig = new MqttConfig(); - private static final Log log = LogFactory.getLog(MqttConfig.class); - - private boolean enabled; - private String url; - private String username; - private String dcrUrl; - private String qos; - private String scopes; - private String clearSession; - - private MqttConfig() { - DeviceManagementConfiguration deviceManagementConfiguration = VirtualFirealarmConfig.getInstance() - .getDeviceTypeConfiguration(); - List properties = deviceManagementConfiguration - .getEventListenerConfiguration().getProperties(); - String provider = deviceManagementConfiguration.getEventListenerConfiguration().getEventListenerProvider(); - if (provider.equals("MQTT")) { - enabled = true; - } - if (enabled) { - for (EventListenerConfiguration.Property property : properties) { - switch (property.getName()) { - case "url": - url = property.getValue(); - break; - case "username": - username = property.getValue(); - break; - case "dcrUrl": - dcrUrl = property.getValue(); - break; - case "qos": - qos = property.getValue(); - break; - case "scopes": - scopes = property.getValue(); - break; - case "clearSession": - clearSession = property.getValue(); - break; - } - } - } - } - - public static MqttConfig getInstance() { - return mqttConfig; - } - - public boolean isEnabled() { - return enabled; - } - - public String getUrl() { - return url; - } - - public String getUsername() { - return username; - } - - public String getDcrUrl() { - return dcrUrl; - } - - public String getQos() { - return qos; - } - - public String getScopes() { - return scopes; - } - - public String getClearSession() { - return clearSession; - } -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppAccount.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppAccount.java deleted file mode 100644 index f8239a8d9..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppAccount.java +++ /dev/null @@ -1,63 +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.virtualfirealarm.plugin.xmpp; - -/** - * holds the information related to account that needs to be created on xmpp server. - */ -public class XmppAccount { - - private String username; - private String password; - private String accountName; - private String email; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getAccountName() { - return accountName; - } - - public void setAccountName(String accountName) { - this.accountName = accountName; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppConfig.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppConfig.java deleted file mode 100644 index d600b3a82..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppConfig.java +++ /dev/null @@ -1,136 +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.virtualfirealarm.plugin.xmpp; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config.DeviceManagementConfiguration; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config.EventListenerConfiguration; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config.VirtualFirealarmConfig; - -import java.util.List; - -public class XmppConfig { - - private String host; - private int port; - private String username; - private String password; - private String serverName; - private boolean enabled; - private String jid; - private static XmppConfig xmppConfig = new XmppConfig(); - private static final Log log = LogFactory.getLog(XmppConfig.class); - - private XmppConfig() { - DeviceManagementConfiguration deviceManagementConfiguration = VirtualFirealarmConfig.getInstance() - .getDeviceTypeConfiguration(); - List properties = deviceManagementConfiguration.getEventListenerConfiguration() - .getProperties(); - String provider = deviceManagementConfiguration.getEventListenerConfiguration().getEventListenerProvider(); - if ("XMPP".equals(provider)) { - enabled = true; - } - if (enabled) { - for (EventListenerConfiguration.Property property : properties) { - switch (property.getName()) { - case "host": - host = property.getValue(); - break; - case "port": - port = Integer.parseInt(property.getValue()); - break; - case "username": - username = property.getValue(); - break; - case "password": - password = property.getValue(); - break; - case "server.name": - serverName = property.getValue(); - break; - case "jid": - jid = property.getValue(); - break; - - } - } - } - } - - public static XmppConfig getInstance() { - return xmppConfig; - } - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public int getPort() { - return port; - } - - public void setPort(int port) { - this.port = port; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getServerName() { - return serverName; - } - - public void setServerName(String serverName) { - this.serverName = serverName; - } - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public String getJid() { - return jid; - } - - public void setJid(String jid) { - this.jid = jid; - } -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppServerClient.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppServerClient.java deleted file mode 100644 index cdbcb87dd..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppServerClient.java +++ /dev/null @@ -1,67 +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.virtualfirealarm.plugin.xmpp; - -import org.jivesoftware.smack.AccountManager; -import org.jivesoftware.smack.ConnectionConfiguration; -import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.XMPPException; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.exception.VirtualFirealarmDeviceMgtPluginException; - -import java.util.HashMap; -import java.util.Map; - -public class XmppServerClient { - - public static boolean createAccount(XmppAccount xmppAccount) throws VirtualFirealarmDeviceMgtPluginException { - if (XmppConfig.getInstance().isEnabled()) { - if (xmppAccount != null) { - try { - ConnectionConfiguration config = new ConnectionConfiguration(XmppConfig.getInstance().getHost(), - XmppConfig.getInstance().getPort(), - "Accounts"); - XMPPConnection xmppConnection = new XMPPConnection(config); - xmppConnection.connect(); - xmppConnection.login(XmppConfig.getInstance().getUsername(), XmppConfig.getInstance().getPassword()); - AccountManager accountManager = xmppConnection.getAccountManager(); - Map attributes = new HashMap<>(); - attributes.put("username", xmppAccount.getUsername()); - attributes.put("password", xmppAccount.getPassword()); - attributes.put("email", xmppAccount.getEmail()); - attributes.put("name", xmppAccount.getAccountName()); - accountManager.createAccount(xmppAccount.getUsername(), xmppAccount.getPassword(), attributes); - xmppConnection.disconnect(); - return true; - } catch (XMPPException e) { - if (e.getXMPPError().getCode() == 409) { - //AccountAlreadyExist - return true; - } else { - throw new VirtualFirealarmDeviceMgtPluginException( - "XMPP account creation failed. Error: " + e.getLocalizedMessage(), e); - } - } - } else { - throw new VirtualFirealarmDeviceMgtPluginException("Invalid XMPP attributes"); - } - } else { - return true; - } - } -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml index ee380a899..7fbe10a02 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/pom.xml index ad4c98766..935d73e49 100644 --- a/components/device-types/virtual-fire-alarm-plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml @@ -33,7 +33,6 @@ http://wso2.org - org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml index c27686237..f81aedf64 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml @@ -18,7 +18,7 @@ org.wso2.carbon.devicemgt-plugins appm-connector - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml index 36bd4b271..95489a87c 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml @@ -18,7 +18,7 @@ org.wso2.carbon.devicemgt-plugins appm-connector - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml @@ -27,29 +27,6 @@ bundle WSO2 Carbon - App Manager WSO2 MDM REST Connector Component http://maven.apache.org - - - wso2-maven2-repository - WSO2 Maven2 Repository - http://dist.wso2.org/maven2/ - - - wso2-maven2-snapshot-repository - WSO2 Maven2 Snapshot Repository - http://dist.wso2.org/snapshots/maven2/ - - - wso2-nexus - WSO2 internal Repository - http://maven.wso2.org/nexus/content/groups/wso2-public/ - - true - daily - ignore - - - - diff --git a/components/extensions/appm-connector/pom.xml b/components/extensions/appm-connector/pom.xml index 883ae7ec4..2cba956a1 100644 --- a/components/extensions/appm-connector/pom.xml +++ b/components/extensions/appm-connector/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml index 2f20bfa37..a86b13a8d 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml index 30d5334f3..282f33f64 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml index e0f2affd4..2ca1248e4 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml index 5302ba3e5..b125b2459 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml index 29aac549c..8c29a6cae 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml index 9d0a3b3c0..a4246e7d4 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml index 866d56d62..b86ab8f08 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml index 201e1ff7c..3029e8abd 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/pom.xml b/components/extensions/cdmf-transport-adapters/pom.xml index 7225b86e2..bf715c897 100644 --- a/components/extensions/cdmf-transport-adapters/pom.xml +++ b/components/extensions/cdmf-transport-adapters/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml index 1731ee8e2..7885a389a 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index 8d3c530bc..e920fde00 100644 --- a/components/extensions/mb-extensions/pom.xml +++ b/components/extensions/mb-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml index 8f2ebd214..7c1457b78 100644 --- a/components/extensions/pom.xml +++ b/components/extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml index 9122e5db2..c90a2dabb 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml index 5f2f79262..25332b34f 100644 --- a/components/extensions/siddhi-extensions/pom.xml +++ b/components/extensions/siddhi-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml index 88e3bb181..99cb9be3b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins android-plugin - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index cebd48d8e..b21b40149 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java index db795dcd8..78bb83361 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java @@ -415,7 +415,7 @@ public interface DeviceManagementAdminService { value = "Clearing the Password on Android Devices", notes = "Clear the password on Android devices", response = Activity.class, - tags = "Android Device Management Administrative Service.", + tags = "Android Device Management Administrative Service", extensions = { @Extension(properties = { @ExtensionProperty(name = AndroidConstants.SCOPE, value = "perm:android:clear-password") diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml index 29a189a4d..027b1a800 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml @@ -23,13 +23,13 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.ui - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT WSO2 Carbon - Mobile Android UI pom diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs index ca9efda9d..4b2dfe84a 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs @@ -1,4 +1,5 @@ {{unit "cdmf.unit.device.type.android.leaflet"}} +{{unit "cdmf.unit.lib.editable"}} {{unit "cdmf.unit.lib.qrcode"}} {{unit "cdmf.unit.device.type.qr-modal"}} @@ -51,14 +52,41 @@ Status - {{#equal device.status "ACTIVE"}}Active{{/equal}} - {{#equal device.status "INACTIVE"}}Inactive{{/equal}} - {{#equal device.status "BLOCKED"}}Blocked{{/equal}} - {{#equal device.status "REMOVED"}}Removed{{/equal}} + {{#if permissions.CHANGE_DEVICE_STATUS}} + {{#equal device.status "ACTIVE"}} + + {{/equal}} + {{#equal device.status "INACTIVE"}} + + {{/equal}} + {{#equal device.status "BLOCKED"}} + + {{/equal}} + {{#equal device.status "REMOVED"}} + + {{/equal}} + {{else}} + {{#equal device.status "ACTIVE"}} Active{{/equal}} + {{#equal device.status "INACTIVE"}} Inactive{{/equal}} + {{#equal device.status "BLOCKED"}} Blocked{{/equal}} + {{#equal device.status "REMOVED"}} Removed{{/equal}} + {{/if}} {{/if}} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js index a5816da5b..0a0bba6ba 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js @@ -210,7 +210,10 @@ function onRequest(context) { {"name" : "deviceId", "value" : deviceId} ]; + var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; + var permissions = userModule.getUIPermissions(); deviceViewData["autoCompleteParams"] = autoCompleteParams; + deviceViewData["permissions"] = permissions; deviceViewData["portalUrl"] = devicemgtProps['portalURL']; deviceViewData["anchor"] = encodeURI(JSON.stringify({ "device" : { "id" : deviceId, "type" : deviceType}})); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/device-detail.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/device-detail.js index 449dec84c..c628f1260 100755 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/device-detail.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/device-detail.js @@ -81,6 +81,62 @@ var InitiateViewOption = null; } }); + $('#status').on('save', function (e, params) { + var deviceStatus = params.submitValue.toUpperCase(); + var serviceUrl = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceIdentifier + + "/changestatus?newStatus=" + deviceStatus; + var payload = null; + + if (serviceUrl) { + var successCallback = function (jqXHR, status, resp) { + if (resp.status == 200) { + setTimeout(function () { + if (deviceStatus == "REMOVED") { + $('#statusIcon').removeClass().addClass('fw fw-delete icon-danger'); + } else if (deviceStatus == "INACTIVE") { + $('#statusIcon').removeClass().addClass('fw fw-warning icon-warning'); + } else if (deviceStatus == "ACTIVE") { + $('#statusIcon').removeClass().addClass('fw fw-success icon-success'); + } + $("#statusIcon").show(); + + }, 1500); + } else { + console.log(resp.status); + } + }; + + invokerUtil.put(serviceUrl, payload, + successCallback, function (message) { + console.log(message); + }); + } + + }); + + $("#status").click(function () { + $("#statusIcon").hide(); + }); + + $.fn.editable.defaults.mode = 'inline'; + + $('#status').editable({ + value: $('#status').attr("selectedValue"), + source: [ + {value: 'Active', text: 'Active'}, + {value: "Inactive", text: 'Inactive'}, + {value: "Removed", text: 'Removed'} + ], + success: this.update_elements + }); + + $.fn.editableform.buttons = + '' + + ''; function positionArrow(selectedTab) { var selectedTabHeight = $(selectedTab).innerHeight(); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js index 4a7361e27..10c4ec453 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js @@ -19,8 +19,11 @@ var map; function loadLeafletMap() { + var deviceLocationID = "#device-location", locations = $(deviceLocationID).data("locations"), + location_lat = $(deviceLocationID).data("lat"), + location_long = $(deviceLocationID).data("long"), container = "device-location", zoomLevel = 13, tileSet = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", @@ -46,6 +49,19 @@ function loadLeafletMap() { $("#map-error").hide(); $("#device-location").show(); + } else if (location_long && location_lat) { + + map = L.map(container).setView([location_lat, location_long], zoomLevel); + L.tileLayer(tileSet, {attribution: attribution}).addTo(map); + + var m = L.marker([location_lat, location_long], {"opacity": opacVal}).addTo(map).bindPopup("Your device is here"); + m.on('mouseover', function (e) { + this.openPopup(); + }); + m.on('mouseout', function (e) { + this.closePopup(); + }); + } else { $("#device-location").hide(); $("#map-error").show(); @@ -56,4 +72,4 @@ $(document).ready(function () { $(".location_tab").on("click", function () { loadLeafletMap(); }); -}); \ No newline at end of file +}); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml index 6b3f575ef..bd97bd6eb 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml @@ -22,7 +22,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index b9c893a85..2493fdc14 100644 --- a/components/mobile-plugins/android-plugin/pom.xml +++ b/components/mobile-plugins/android-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index 1698be573..4ce34b0f5 100644 --- a/components/mobile-plugins/pom.xml +++ b/components/mobile-plugins/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml index 5dd290ccf..f8537e1f9 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml @@ -21,7 +21,7 @@ windows-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java index 936b353ac..b97f0e6dc 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/DeviceManagementAdminService.java @@ -179,7 +179,7 @@ public interface DeviceManagementAdminService { value = "Dis-enrol the windows Devices", notes = "Dis-enroll on Android devices", response = Activity.class, - tags = "Windows Device Management Administrative Service.", + tags = "Windows Device Management Administrative Service", extensions = { @Extension(properties = { @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:disenroll") diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/discovery/DiscoveryService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/discovery/DiscoveryService.java index 4a3f0b12b..d271d9892 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/discovery/DiscoveryService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/discovery/DiscoveryService.java @@ -41,6 +41,7 @@ import javax.xml.ws.soap.SOAPBinding; @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) public interface DiscoveryService { @POST + @RequestWrapper(localName = "Discover", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) @WebMethod(operationName = "Discover") @ResponseWrapper(localName = "DiscoverResponse", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/syncml/SyncmlService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/syncml/SyncmlService.java index 9b1928319..b666e3f22 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/syncml/SyncmlService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/syncml/SyncmlService.java @@ -17,7 +17,10 @@ */ package org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml; + import org.w3c.dom.Document; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; @@ -36,6 +39,16 @@ import javax.ws.rs.core.Response; */ @Path("/devicemanagement") +@Scopes( + scopes = { + @Scope( + name = "Pending operations", + description = "Register an Windows device", + key = "perm:windows:enroll", + permissions = {"/device-mgt/devices/enroll/windows"} + ) + } +) public interface SyncmlService { @Path("/request") diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml index 60c7f1574..e979e3af3 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml @@ -23,13 +23,13 @@ windows-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.windows.ui - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT WSO2 Carbon - Mobile Windows UI pom diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs index 3e999e40d..046a5ae15 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs @@ -1,4 +1,5 @@ {{unit "cdmf.unit.device.type.windows.leaflet"}} +{{unit "cdmf.unit.lib.editable"}} {{unit "cdmf.unit.lib.qrcode"}} {{unit "cdmf.unit.device.type.qr-modal"}} @@ -51,14 +52,41 @@ Status - {{#equal device.status "ACTIVE"}}Active{{/equal}} - {{#equal device.status "INACTIVE"}}Inactive{{/equal}} - {{#equal device.status "BLOCKED"}}Blocked{{/equal}} - {{#equal device.status "REMOVED"}}Removed{{/equal}} + {{#if permissions.CHANGE_DEVICE_STATUS}} + {{#equal device.status "ACTIVE"}} + + {{/equal}} + {{#equal device.status "INACTIVE"}} + + {{/equal}} + {{#equal device.status "BLOCKED"}} + + {{/equal}} + {{#equal device.status "REMOVED"}} + + {{/equal}} + {{else}} + {{#equal device.status "ACTIVE"}} Active{{/equal}} + {{#equal device.status "INACTIVE"}} Inactive{{/equal}} + {{#equal device.status "BLOCKED"}} Blocked{{/equal}} + {{#equal device.status "REMOVED"}} Removed{{/equal}} + {{/if}} {{/if}} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.js index c5e0619f7..b363aa2ec 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.js +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.js @@ -112,6 +112,9 @@ function onRequest(context) { {"name" : "deviceId", "value" : deviceId} ]; + var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; + var permissions = userModule.getUIPermissions(); deviceViewData["autoCompleteParams"] = autoCompleteParams; + deviceViewData["permissions"] = permissions; return deviceViewData; } \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js index 0e2375033..ac2a06be8 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js @@ -69,8 +69,7 @@ var InitiateViewOption = null; activeTabPaneCaret.removeClass("fw-up").addClass("fw-down"); activeTabPaneCaretSiblings.removeClass("fw-down").addClass("fw-up"); }); - - + $('.media.tab-responsive a[data-toggle="collapse"]').on('click',function(){ var clickedPanel = $(this).attr('href'); @@ -81,6 +80,62 @@ var InitiateViewOption = null; } }); + $('#status').on('save', function (e, params) { + var deviceStatus = params.submitValue.toUpperCase(); + var serviceUrl = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceIdentifier + + "/changestatus?newStatus=" + deviceStatus; + var payload = null; + + if (serviceUrl) { + var successCallback = function (jqXHR, status, resp) { + if (resp.status == 200) { + setTimeout(function () { + if (deviceStatus == "REMOVED") { + $('#statusIcon').removeClass().addClass('fw fw-delete icon-danger'); + } else if (deviceStatus == "INACTIVE") { + $('#statusIcon').removeClass().addClass('fw fw-warning icon-warning'); + } else if (deviceStatus == "ACTIVE") { + $('#statusIcon').removeClass().addClass('fw fw-success icon-success'); + } + $("#statusIcon").show(); + + }, 1500); + } else { + console.log(resp.status); + } + }; + + invokerUtil.put(serviceUrl, payload, + successCallback, function (message) { + console.log(message); + }); + } + + }); + + $("#status").click(function () { + $("#statusIcon").hide(); + }); + + $.fn.editable.defaults.mode = 'inline'; + + $('#status').editable({ + value: $('#status').attr("selectedValue"), + source: [ + {value: 'Active', text: 'Active'}, + {value: "Inactive", text: 'Inactive'}, + {value: "Removed", text: 'Removed'} + ], + success: this.update_elements + }); + + $.fn.editableform.buttons = + '' + + ''; function positionArrow(selectedTab) { var selectedTabHeight = $(selectedTab).innerHeight(); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml index f60702205..e33b5b18d 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml @@ -22,7 +22,7 @@ windows-plugin org.wso2.carbon.devicemgt-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/windows-plugin/pom.xml b/components/mobile-plugins/windows-plugin/pom.xml index 0cf274e26..aaecc79ad 100644 --- a/components/mobile-plugins/windows-plugin/pom.xml +++ b/components/mobile-plugins/windows-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml index 6cefa2886..8f74c380d 100644 --- a/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.device.mgt.iot.analytics.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.analytics.feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml index 541759d68..8a3c12b30 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.device.statistics.dashboard.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.iot.device.statistics.dashboard.feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT pom WSO2 Carbon - IoT Server Analytics Feature http://wso2.org diff --git a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml index 2d611715f..fc3aa7b15 100644 --- a/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml +++ b/features/analytics-feature/org.wso2.carbon.iot.geo.dashboard.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins analytics-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/features/analytics-feature/pom.xml b/features/analytics-feature/pom.xml index 3faea5eff..9836a4b77 100644 --- a/features/analytics-feature/pom.xml +++ b/features/analytics-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/pom.xml index d1a1c60a3..64acf8258 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt-plugins androidsense-plugin-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT pom WSO2 Carbon - IoT Server Android Sense Feature http://wso2.org diff --git a/features/device-types-feature/androidsense-plugin-feature/pom.xml b/features/device-types-feature/androidsense-plugin-feature/pom.xml index 4c98941be..f539e272b 100644 --- a/features/device-types-feature/androidsense-plugin-feature/pom.xml +++ b/features/device-types-feature/androidsense-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.feature/pom.xml index 0a868935d..f18237123 100644 --- a/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/org.wso2.carbon.device.mgt.iot.arduino.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins arduino-plugin-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/arduino-plugin-feature/pom.xml b/features/device-types-feature/arduino-plugin-feature/pom.xml index 449624a27..d491fc821 100644 --- a/features/device-types-feature/arduino-plugin-feature/pom.xml +++ b/features/device-types-feature/arduino-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/pom.xml b/features/device-types-feature/pom.xml index 2c3921ff3..17c67605f 100644 --- a/features/device-types-feature/pom.xml +++ b/features/device-types-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml 4.0.0 device-types-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT pom WSO2 Carbon - Device Management IoT Plugins Feature http://wso2.org diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/pom.xml index 7eb8cc10d..aab3de96e 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins raspberrypi-plugin-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/Adafruit_Python_DHT.zip b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/Adafruit_Python_DHT.zip new file mode 100644 index 000000000..bff9920cf Binary files /dev/null and b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/Adafruit_Python_DHT.zip differ diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/RaspberryService.sh b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/RaspberryService.sh index e32907e54..114226790 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/RaspberryService.sh +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/RaspberryService.sh @@ -1,23 +1,3 @@ -#""" -#/** -#* 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. -#**/ -#""" - #!/bin/sh ### BEGIN INIT INFO @@ -35,7 +15,7 @@ DESC="This service is used to publish events from the Raspberry Pi to the WSO2 D NAME=RaspberryStats DIR=/usr/local/src/RaspberryAgent/src/ -DAEMON=$DIR/RaspberryAgent.py +DAEMON=python $DIR/RaspberryAgent.py DAEMON_NAME=$NAME SCRIPTNAME=RaspberryService.sh diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/RaspberryAgent.py b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/RaspberryAgent.py index 7b4afed5b..759a0b6c9 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/RaspberryAgent.py +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/RaspberryAgent.py @@ -23,6 +23,7 @@ import logging, logging.handlers import sys, os, signal, argparse import running_mode import time, threading, datetime, calendar +import iotUtils, mqttConnector, Adafruit_DHT, httpServer # import httplib, ssl # from functools import wraps @@ -40,7 +41,7 @@ import time, threading, datetime, calendar # return bar # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -PUSH_INTERVAL = 5000 # time interval between successive data pushes in seconds +PUSH_INTERVAL = 2 # time interval between successive data pushes in seconds # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -82,7 +83,7 @@ if args.mode: running_mode.RUNNING_MODE = args.mode iotUtils = __import__('iotUtils') mqttConnector = __import__('mqttConnector') - # httpServer = __import__('httpServer') # python script used to start a http-server to listen for operations + httpServer = __import__('httpServer') # python script used to start a http-server to listen for operations # (includes the TEMPERATURE global variable) if running_mode.RUNNING_MODE == 'N': @@ -329,6 +330,7 @@ def main(): # ListenHTTPServerThread() # starts an HTTP Server that listens for operational commands to switch ON/OFF Led SubscribeToMQTTQueue() # connects and subscribes to an MQTT Queue that receives MQTT commands from the server TemperatureReaderThread() # initiates and runs the thread to continuously read temperature from DHT Sensor + # time.sleep(2) #wait for agent to connect to broker before publishing data while True: try: if iotUtils.LAST_TEMP > 0: # Push data only if there had been a successful temperature read diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/mqttConnector.py b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/mqttConnector.py index f0da9154c..ccfa6b067 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/mqttConnector.py +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/mqttConnector.py @@ -72,9 +72,11 @@ def on_publish(client, userdata, mid): # The callback for when a PUBLISH message to the server when door is open or close # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def publish(msg): -# global mqttClient + global mqttClient mqttClient.publish(TOPIC_TO_PUBLISH, msg) +def on_subscribe(client, userdata, mid, granted_qos): + print "Successfully subscribed to " + TOPIC_TO_SUBSCRIBE # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # The Main method of the server script @@ -103,6 +105,7 @@ def main(): mqttClient.on_connect = on_connect mqttClient.on_message = on_message mqttClient.on_publish = on_publish + mqttClient.on_subscribe = on_subscribe mqttClient.username_pw_set(iotUtils.AUTH_TOKEN, password = "") while True: diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/startService.sh b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/startService.sh index e073b1092..4ccf64e01 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/startService.sh +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/startService.sh @@ -33,6 +33,17 @@ if [ ! -d "$destination" ] then mkdir $destination fi +# installing dependencies +echo ===Installing Dependencies +sudo apt-get update +sudo apt-get install python-pip +sudo pip install paho-mqtt + +#installing ada +sudo apt-get install build-essential python-dev +unzip Adafruit_Python_DHT +sudo python Adafruit_Python_DHT/setup.py install + sudo cp $currentDir/deviceConfig.properties $currentDir/src sudo cp -r $currentDir/src $destination sudo chmod +x $destination/src/RaspberryAgent.py diff --git a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml index 42e6b5087..92626ddee 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/pom.xml index bde337686..d4ce75d37 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins virtual-fire-alarm-plugin-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml index 101b76d6c..e11e61d2f 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml index 9fa70d98d..a8be9fc35 100644 --- a/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml diff --git a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml index c73fef8d2..b9c0d4c09 100644 --- a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.osgiconnector.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml org.wso2.carbon.appmgt.mdm.osgiconnector.feature pom - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT WSO2 Carbon - App management MDM OSGI Connector http://wso2.org This feature contains the core bundles required for APP management OSGI MDM connection @@ -36,7 +36,7 @@ org.wso2.carbon.devicemgt-plugins org.wso2.carbon.appmgt.mdm.osgiconnector - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT org.apache.ws.commons.axiom diff --git a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.restconnector.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.restconnector.feature/pom.xml index 9c39ddcb5..83728f311 100644 --- a/features/extensions-feature/org.wso2.carbon.appmgt.mdm.restconnector.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.appmgt.mdm.restconnector.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml org.wso2.carbon.appmgt.mdm.restconnector.feature pom - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT WSO2 Carbon - App management MDM REST Connector http://wso2.org This feature contains the core bundles required for APP management MDM REST connection @@ -36,7 +36,7 @@ org.wso2.carbon.devicemgt-plugins org.wso2.carbon.appmgt.mdm.restconnector - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT org.apache.ws.commons.axiom diff --git a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml index b275137a9..e24f48384 100644 --- a/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml +++ b/features/extensions-feature/org.wso2.carbon.device.mgt.adapter.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.adapter.feature pom - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT WSO2 Carbon - Device Management Adapters Feature http://wso2.org This feature contains the adapter bundles required for IoT Server diff --git a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml index 1eec6b355..b1623498e 100644 --- a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml +++ b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml @@ -20,13 +20,13 @@ org.wso2.carbon.devicemgt-plugins extensions-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml org.wso2.extension.siddhi.execution.json.feature pom - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT WSO2 Siddhi Execution Extension - Json Feature http://wso2.org This feature contains Siddhi extension feature for changing a json string to individual properties. diff --git a/features/extensions-feature/pom.xml b/features/extensions-feature/pom.xml index 60f1cdc46..20b5b1da2 100644 --- a/features/extensions-feature/pom.xml +++ b/features/extensions-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml 4.0.0 extensions-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT pom WSO2 Carbon - Device Management Extensions http://wso2.org diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml index ecd88e58c..2e113fc04 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt-plugins android-plugin-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.feature pom - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT WSO2 Carbon - Android Device Management Feature http://wso2.org This feature contains the core bundles required for Android Device Management diff --git a/features/mobile-plugins-feature/android-plugin-feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/pom.xml index 0e3ab629d..b8c5c34a3 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml 4.0.0 android-plugin-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT pom WSO2 Carbon - Device Management Android Plugin Feature http://wso2.org diff --git a/features/mobile-plugins-feature/pom.xml b/features/mobile-plugins-feature/pom.xml index 7360be3c0..0a16bf3fb 100644 --- a/features/mobile-plugins-feature/pom.xml +++ b/features/mobile-plugins-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../../pom.xml 4.0.0 mobile-plugins-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT pom WSO2 Carbon - Device Management EMM Plugins Feature http://wso2.org diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml index f1682835f..ef7f85eb1 100644 --- a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt-plugins windows-plugin-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.windows.feature pom - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT WSO2 Carbon - Windows Device Management Feature http://wso2.org This feature contains the core bundles required for Windows Device Management diff --git a/features/mobile-plugins-feature/windows-plugin-feature/pom.xml b/features/mobile-plugins-feature/windows-plugin-feature/pom.xml index 64f71fe2f..9c001ac8f 100644 --- a/features/mobile-plugins-feature/windows-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/windows-plugin-feature/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT ../pom.xml 4.0.0 windows-plugin-feature - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT pom WSO2 Carbon - Device Management Windows Plugin Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 56e1dd346..183f2b19f 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent pom - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT WSO2 Carbon - Device Management Plugins Parent http://wso2.org WSO2 Carbon - Device Management Plugins Parent @@ -1244,14 +1244,14 @@ 1.1.1 - 2.0.13 + 2.0.17 [2.0.0, 3.0.0) 1.2.15 - 3.0.11-SNAPSHOT + 3.0.12-SNAPSHOT 4.4.8