From 2e8279b61abda03133bd3ac938c17c33d0558493 Mon Sep 17 00:00:00 2001 From: ayyoob Date: Sat, 7 Jan 2017 14:54:46 +0530 Subject: [PATCH 1/7] removed scep impl from virtual fire alarm --- .../mqtt/FireAlarmMQTTCommunicator.java | 5 +- .../xmpp/FireAlarmXMPPCommunicator.java | 5 +- .../agent/advanced/core/AgentConstants.java | 2 +- .../agent/advanced/core/AgentManager.java | 14 +- .../advanced/core/AgentUtilOperations.java | 90 ++++---- .../enrollment/EnrollmentManager.java | 10 + .../mqtt/FireAlarmMQTTCommunicator.java | 5 +- .../xmpp/FireAlarmXMPPCommunicator.java | 6 +- .../agent/core/AgentConstants.java | 2 +- .../agent/core/AgentManager.java | 18 +- .../agent/core/AgentUtilOperations.java | 90 ++++---- .../agent/enrollment/EnrollmentManager.java | 2 +- .../build.xml | 38 ++++ .../pom.xml | 75 +++++++ .../src/assembly/src.xml | 36 ++++ .../carbonapps/virtualfirealarm/artifacts.xml | 26 +++ .../virtualfirealarm_execution/artifact.xml | 23 ++ .../virtualfirealarm_execution.siddhiql | 20 ++ .../virtualfirealarm_receiver/artifact.xml | 22 ++ .../virtualfirealarm_receiver.xml | 31 +++ .../virtualfirealarm_stream/artifact.xml | 23 ++ .../org.wso2.iot.virtualfirealarm_1.0.0.json | 16 ++ .../pom.xml | 5 - .../impl/VirtualFireAlarmServiceImpl.java | 65 ++---- .../constants/VirtualFireAlarmConstants.java | 84 ++++++++ .../util/VirtualFireAlarmServiceUtils.java | 51 ----- .../util/VirtualFireAlarmUtilConstants.java | 1 - .../service/impl/util/ZipUtil.java | 2 +- .../xmpp/VirtualFirealarmXMPPException.java | 56 +++++ .../service/impl/xmpp/XmppAccount.java | 63 ++++++ .../service/impl/xmpp/XmppConfig.java | 124 +++++++++++ .../service/impl/xmpp/XmppServerClient.java | 66 ++++++ .../src/main/webapp/WEB-INF/web.xml | 2 + .../src/main/webapp/WEB-INF/xmpp.properties | 25 +++ .../pom.xml | 199 ------------------ .../impl/VirtualFireAlarmScepServer.java | 65 ------ .../impl/VirtualFireAlarmScepServerImpl.java | 136 ------------ .../exception/VirtualFireAlarmException.java | 31 --- .../util/VirtualFireAlarmServiceUtils.java | 103 --------- .../service/impl/util/scep/ContentType.java | 26 --- .../service/impl/util/scep/SCEPOperation.java | 39 ---- .../webapp/META-INF/webapp-classloading.xml | 33 --- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 38 ---- .../src/main/webapp/WEB-INF/web.xml | 38 ---- .../virtual-fire-alarm-plugin/pom.xml | 2 +- .../pom.xml | 31 ++- .../src/main/resources/p2.inf | 6 +- pom.xml | 6 - 48 files changed, 909 insertions(+), 947 deletions(-) create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/build.xml create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/assembly/src.xml create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/artifacts.xml create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_execution/artifact.xml create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_execution/virtualfirealarm_execution.siddhiql create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_receiver/artifact.xml create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_receiver/virtualfirealarm_receiver.xml create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_stream/artifact.xml create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_stream/org.wso2.iot.virtualfirealarm_1.0.0.json create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/constants/VirtualFireAlarmConstants.java delete mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/util/VirtualFireAlarmServiceUtils.java create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/VirtualFirealarmXMPPException.java create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/XmppAccount.java create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/XmppConfig.java create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/XmppServerClient.java create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/WEB-INF/xmpp.properties delete mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml delete mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/VirtualFireAlarmScepServer.java delete mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/VirtualFireAlarmScepServerImpl.java delete mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/exception/VirtualFireAlarmException.java delete mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/util/VirtualFireAlarmServiceUtils.java delete mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/util/scep/ContentType.java delete mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/util/scep/SCEPOperation.java delete mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/META-INF/webapp-classloading.xml delete mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/WEB-INF/cxf-servlet.xml delete mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/WEB-INF/web.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/communication/mqtt/FireAlarmMQTTCommunicator.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/communication/mqtt/FireAlarmMQTTCommunicator.java index f9e6bd6d3..cd5c25571 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/communication/mqtt/FireAlarmMQTTCommunicator.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/communication/mqtt/FireAlarmMQTTCommunicator.java @@ -191,7 +191,10 @@ public class FireAlarmMQTTCommunicator extends MQTTTransportHandler { @Override public void run() { int currentTemperature = agentManager.getTemperature(); - String message = "PUBLISHER:" + AgentConstants.TEMPERATURE_CONTROL + ":" + currentTemperature; + String message = "{\"event\": {\"metaData\": {\"owner\": \"" + AgentManager + .getInstance().getAgentConfigs().getDeviceOwner() + "\",\"deviceId\": \"" + AgentManager + .getInstance().getAgentConfigs().getDeviceId() + "\",\"time\": " + + "0},\"payloadData\": { \"temperature\": " + currentTemperature + "} }}"; try { String payLoad = AgentUtilOperations.prepareSecurePayLoad(message); diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/communication/xmpp/FireAlarmXMPPCommunicator.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/communication/xmpp/FireAlarmXMPPCommunicator.java index 668b0e16d..8ba82906f 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/communication/xmpp/FireAlarmXMPPCommunicator.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/communication/xmpp/FireAlarmXMPPCommunicator.java @@ -189,7 +189,10 @@ public class FireAlarmXMPPCommunicator extends XMPPTransportHandler { try { int currentTemperature = agentManager.getTemperature(); - String message = AgentConstants.TEMPERATURE_CONTROL + ":" + currentTemperature; + String message = "{\"event\": {\"metaData\": {\"owner\": \"" + AgentManager + .getInstance().getAgentConfigs().getDeviceOwner() + "\",\"deviceId\": \"" + AgentManager + .getInstance().getAgentConfigs().getDeviceId() + "\",\"time\": " + + "0},\"payloadData\": { \"temperature\": " + currentTemperature + "} }}"; String payLoad = AgentUtilOperations.prepareSecurePayLoad(message); xmppMessage.setTo(xmppAdminJID); diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentConstants.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentConstants.java index 7c02e675d..c3c2f77da 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentConstants.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentConstants.java @@ -58,7 +58,7 @@ public class AgentConstants { public static final int DEFAULT_MQTT_RECONNECTION_INTERVAL = 2; // time in seconds public static final int DEFAULT_MQTT_QUALITY_OF_SERVICE = 0; public static final String MQTT_SUBSCRIBE_TOPIC = "%s/" + DEVICE_TYPE + "/%s"; - public static final String MQTT_PUBLISH_TOPIC = "%s/" + DEVICE_TYPE + "/%s/publisher"; + public static final String MQTT_PUBLISH_TOPIC = "%s/" + DEVICE_TYPE + "/%s/temperature"; /* --------------------------------------------------------------------------------------- XMPP Connection specific information --------------------------------------------------------------------------------------- */ diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentManager.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentManager.java index 30a4fe0b9..e3b83a4c4 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentManager.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentManager.java @@ -168,13 +168,13 @@ public class AgentManager { } } - try { - EnrollmentManager.getInstance().beginEnrollmentFlow(); - } catch (AgentCoreOperationException e) { - log.error("Device Enrollment Failed:\n"); - e.printStackTrace(); - System.exit(0); - } +// try { +// EnrollmentManager.getInstance().beginEnrollmentFlow(); +// } catch (AgentCoreOperationException e) { +// log.error("Device Enrollment Failed:\n"); +// e.printStackTrace(); +// System.exit(0); +// } //Start agent communication agentCommunicator.get(protocol).connect(); diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentUtilOperations.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentUtilOperations.java index 15e15c1be..9123c5fac 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentUtilOperations.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentUtilOperations.java @@ -241,59 +241,67 @@ public class AgentUtilOperations { public static String prepareSecurePayLoad(String message) throws AgentCoreOperationException { - PrivateKey devicePrivateKey = EnrollmentManager.getInstance().getPrivateKey(); - String encodedMessage = Base64.encodeBase64String(message.getBytes()); - String signedPayload; - try { - signedPayload = CommunicationUtils.signMessage(encodedMessage, devicePrivateKey); - } catch (TransportHandlerException e) { - String errorMsg = "Error occurred whilst trying to sign encrypted message of: [" + message + "]"; - log.error(errorMsg); - throw new AgentCoreOperationException(errorMsg, e); - } + if (EnrollmentManager.getInstance().isEnrolled()) { + PrivateKey devicePrivateKey = EnrollmentManager.getInstance().getPrivateKey(); + String encodedMessage = Base64.encodeBase64String(message.getBytes()); + String signedPayload; + try { + signedPayload = CommunicationUtils.signMessage(encodedMessage, devicePrivateKey); + } catch (TransportHandlerException e) { + String errorMsg = "Error occurred whilst trying to sign encrypted message of: [" + message + "]"; + log.error(errorMsg); + throw new AgentCoreOperationException(errorMsg, e); + } - JSONObject jsonPayload = new JSONObject(); - jsonPayload.put(JSON_MESSAGE_KEY, encodedMessage); - jsonPayload.put(JSON_SIGNATURE_KEY, signedPayload); - //below statements are temporary fix. - jsonPayload.put(JSON_SERIAL_KEY, EnrollmentManager.getInstance().getSCEPCertificate().getSerialNumber()); + JSONObject jsonPayload = new JSONObject(); + jsonPayload.put(JSON_MESSAGE_KEY, encodedMessage); + jsonPayload.put(JSON_SIGNATURE_KEY, signedPayload); + //below statements are temporary fix. + jsonPayload.put(JSON_SERIAL_KEY, EnrollmentManager.getInstance().getSCEPCertificate().getSerialNumber()); - return jsonPayload.toString(); + return jsonPayload.toString(); + } else { + return message; + } } public static String extractMessageFromPayload(String message) throws AgentCoreOperationException { - String actualMessage; + if (EnrollmentManager.getInstance().isEnrolled()) { + String actualMessage; - PublicKey serverPublicKey = EnrollmentManager.getInstance().getServerPublicKey(); - JSONObject jsonPayload = new JSONObject(message); - Object encodedMessage = jsonPayload.get(JSON_MESSAGE_KEY); - Object signedPayload = jsonPayload.get(JSON_SIGNATURE_KEY); - boolean verification; + PublicKey serverPublicKey = EnrollmentManager.getInstance().getServerPublicKey(); + JSONObject jsonPayload = new JSONObject(message); + Object encodedMessage = jsonPayload.get(JSON_MESSAGE_KEY); + Object signedPayload = jsonPayload.get(JSON_SIGNATURE_KEY); + boolean verification; - if (encodedMessage != null && signedPayload != null) { - try { - verification = CommunicationUtils.verifySignature( - encodedMessage.toString(), signedPayload.toString(), serverPublicKey); - } catch (TransportHandlerException e) { - String errorMsg = - "Error occurred whilst trying to verify signature on received message: [" + message + "]"; + if (encodedMessage != null && signedPayload != null) { + try { + verification = CommunicationUtils.verifySignature( + encodedMessage.toString(), signedPayload.toString(), serverPublicKey); + } catch (TransportHandlerException e) { + String errorMsg = + "Error occurred whilst trying to verify signature on received message: [" + message + "]"; + log.error(errorMsg); + throw new AgentCoreOperationException(errorMsg, e); + } + } else { + String errorMsg = "The received message is in an INVALID format. " + + "Need to be JSON - {\"Msg\":\"\", \"Sig\":\"\"}."; + throw new AgentCoreOperationException(errorMsg); + } + if (verification) { + actualMessage = new String(Base64.decodeBase64(encodedMessage.toString()), StandardCharsets.UTF_8); + } else { + String errorMsg = "Could not verify payload signature. The message was not signed by a valid client"; log.error(errorMsg); - throw new AgentCoreOperationException(errorMsg, e); + throw new AgentCoreOperationException(errorMsg); } + return actualMessage; } else { - String errorMsg = "The received message is in an INVALID format. " + - "Need to be JSON - {\"Msg\":\"\", \"Sig\":\"\"}."; - throw new AgentCoreOperationException(errorMsg); - } - if (verification) { - actualMessage = new String(Base64.decodeBase64(encodedMessage.toString()), StandardCharsets.UTF_8); - } else { - String errorMsg = "Could not verify payload signature. The message was not signed by a valid client"; - log.error(errorMsg); - throw new AgentCoreOperationException(errorMsg); + return message; } - return actualMessage; } public static String formatMessage(String message) { diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/enrollment/EnrollmentManager.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/enrollment/EnrollmentManager.java index a60f25f03..d6d6954d7 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/enrollment/EnrollmentManager.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/enrollment/EnrollmentManager.java @@ -96,6 +96,7 @@ public class EnrollmentManager { private PublicKey publicKey; private PublicKey serverPublicKey; private X509Certificate SCEPCertificate; + private boolean isEnrolled = false; /** @@ -443,4 +444,13 @@ public class EnrollmentManager { public PublicKey getServerPublicKey() { return serverPublicKey; } + + /** + * Checks whether the device has already been enrolled with the SCEP Server. + * + * @return the enrollment status; 'TRUE' if already enrolled else 'FALSE'. + */ + public boolean isEnrolled() { + return isEnrolled; + } } diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/mqtt/FireAlarmMQTTCommunicator.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/mqtt/FireAlarmMQTTCommunicator.java index 5b24783e7..8f89750fd 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/mqtt/FireAlarmMQTTCommunicator.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/mqtt/FireAlarmMQTTCommunicator.java @@ -208,7 +208,10 @@ public class FireAlarmMQTTCommunicator extends MQTTTransportHandler { @Override public void run() { int currentTemperature = agentManager.getTemperature(); - String message = "PUBLISHER:" + AgentConstants.TEMPERATURE_CONTROL + ":" + currentTemperature; + String message = "{\"event\": {\"metaData\": {\"owner\": \"" + AgentManager + .getInstance().getAgentConfigs().getDeviceOwner() + "\",\"deviceId\": \"" + AgentManager + .getInstance().getAgentConfigs().getDeviceId() + "\",\"time\": " + + "0},\"payloadData\": { \"temperature\": " + currentTemperature + "} }}"; try { String payLoad = AgentUtilOperations.prepareSecurePayLoad(message); diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/xmpp/FireAlarmXMPPCommunicator.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/xmpp/FireAlarmXMPPCommunicator.java index abb8d7965..0780f2d84 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/xmpp/FireAlarmXMPPCommunicator.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/xmpp/FireAlarmXMPPCommunicator.java @@ -189,8 +189,10 @@ public class FireAlarmXMPPCommunicator extends XMPPTransportHandler { try { int currentTemperature = agentManager.getTemperature(); - - String message = AgentConstants.TEMPERATURE_CONTROL + ":" + currentTemperature; + String message = "{\"event\": {\"metaData\": {\"owner\": \"" + AgentManager + .getInstance().getAgentConfigs().getDeviceOwner() + "\",\"deviceId\": \"" + AgentManager + .getInstance().getAgentConfigs().getDeviceId() + "\",\"time\": " + + "0},\"payloadData\": { \"temperature\": " + currentTemperature + "} }}"; String payLoad = AgentUtilOperations.prepareSecurePayLoad(message); xmppMessage.setTo(xmppAdminJID); diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/core/AgentConstants.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/core/AgentConstants.java index 566e5cfc0..f1372b25a 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/core/AgentConstants.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/core/AgentConstants.java @@ -62,7 +62,7 @@ public class AgentConstants { public static final int DEFAULT_MQTT_RECONNECTION_INTERVAL = 2; // time in seconds public static final int DEFAULT_MQTT_QUALITY_OF_SERVICE = 0; public static final String MQTT_SUBSCRIBE_TOPIC = "%s/" + DEVICE_TYPE + "/%s"; - public static final String MQTT_PUBLISH_TOPIC = "%s/" + DEVICE_TYPE + "/%s/publisher"; + public static final String MQTT_PUBLISH_TOPIC = "%s/" + DEVICE_TYPE + "/%s/temperature"; /* --------------------------------------------------------------------------------------- Device/Agent specific properties to be read from the 'deviceConfig.properties' file diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/core/AgentManager.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/core/AgentManager.java index 2e7634054..6ee95dceb 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/core/AgentManager.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/core/AgentManager.java @@ -153,15 +153,15 @@ public class AgentManager { } } - try { - if (!EnrollmentManager.getInstance().isEnrolled()) { - EnrollmentManager.getInstance().beginEnrollmentFlow(); - } - } catch (AgentCoreOperationException e) { - log.error("Device Enrollment Failed:\n"); - log.error(e); - System.exit(0); - } +// try { +// if (!EnrollmentManager.getInstance().isEnrolled()) { +// EnrollmentManager.getInstance().beginEnrollmentFlow(); +// } +// } catch (AgentCoreOperationException e) { +// log.error("Device Enrollment Failed:\n"); +// log.error(e); +// System.exit(0); +// } //Start agent communication agentCommunicator.get(protocol).connect(); diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/core/AgentUtilOperations.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/core/AgentUtilOperations.java index 60c3941b8..7a365174b 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/core/AgentUtilOperations.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/core/AgentUtilOperations.java @@ -250,57 +250,65 @@ public class AgentUtilOperations { } public static String prepareSecurePayLoad(String message) throws AgentCoreOperationException { - PrivateKey devicePrivateKey = EnrollmentManager.getInstance().getPrivateKey(); - String encodedMessage = Base64.encodeBase64String(message.getBytes()); - String signedPayload; - try { - signedPayload = CommunicationUtils.signMessage(encodedMessage, devicePrivateKey); - } catch (TransportHandlerException e) { - String errorMsg = "Error occurred whilst trying to sign encrypted message of: [" + message + "]"; - log.error(errorMsg); - throw new AgentCoreOperationException(errorMsg, e); - } + if (EnrollmentManager.getInstance().isEnrolled()) { + PrivateKey devicePrivateKey = EnrollmentManager.getInstance().getPrivateKey(); + String encodedMessage = Base64.encodeBase64String(message.getBytes()); + String signedPayload; + try { + signedPayload = CommunicationUtils.signMessage(encodedMessage, devicePrivateKey); + } catch (TransportHandlerException e) { + String errorMsg = "Error occurred whilst trying to sign encrypted message of: [" + message + "]"; + log.error(errorMsg); + throw new AgentCoreOperationException(errorMsg, e); + } - JSONObject jsonPayload = new JSONObject(); - jsonPayload.put(JSON_MESSAGE_KEY, encodedMessage); - jsonPayload.put(JSON_SIGNATURE_KEY, signedPayload); - //below statements are temporary fix. - jsonPayload.put(JSON_SERIAL_KEY, EnrollmentManager.getInstance().getSCEPCertificate().getSerialNumber()); - return jsonPayload.toString(); + JSONObject jsonPayload = new JSONObject(); + jsonPayload.put(JSON_MESSAGE_KEY, encodedMessage); + jsonPayload.put(JSON_SIGNATURE_KEY, signedPayload); + //below statements are temporary fix. + jsonPayload.put(JSON_SERIAL_KEY, EnrollmentManager.getInstance().getSCEPCertificate().getSerialNumber()); + return jsonPayload.toString(); + } else { + return message; + } } public static String extractMessageFromPayload(String message) throws AgentCoreOperationException { - String actualMessage; + if (EnrollmentManager.getInstance().isEnrolled()) { + String actualMessage; - PublicKey serverPublicKey = EnrollmentManager.getInstance().getServerPublicKey(); - JSONObject jsonPayload = new JSONObject(message); - Object encodedMessage = jsonPayload.get(JSON_MESSAGE_KEY); - Object signedPayload = jsonPayload.get(JSON_SIGNATURE_KEY); - boolean verification; + PublicKey serverPublicKey = EnrollmentManager.getInstance().getServerPublicKey(); + JSONObject jsonPayload = new JSONObject(message); + Object encodedMessage = jsonPayload.get(JSON_MESSAGE_KEY); + Object signedPayload = jsonPayload.get(JSON_SIGNATURE_KEY); + boolean verification; - if (encodedMessage != null && signedPayload != null) { - try { - verification = CommunicationUtils.verifySignature( - encodedMessage.toString(), signedPayload.toString(), serverPublicKey); - } catch (TransportHandlerException e) { - String errorMsg = - "Error occurred whilst trying to verify signature on received message: [" + message + "]"; + if (encodedMessage != null && signedPayload != null) { + try { + verification = CommunicationUtils.verifySignature( + encodedMessage.toString(), signedPayload.toString(), serverPublicKey); + } catch (TransportHandlerException e) { + String errorMsg = + "Error occurred whilst trying to verify signature on received message: [" + message + "]"; + log.error(errorMsg); + throw new AgentCoreOperationException(errorMsg, e); + } + } else { + String errorMsg = "The received message is in an INVALID format. " + + "Need to be JSON - {\"Msg\":\"\", \"Sig\":\"\"}."; + throw new AgentCoreOperationException(errorMsg); + } + if (verification) { + actualMessage = new String(Base64.decodeBase64(encodedMessage.toString()), StandardCharsets.UTF_8); + } else { + String errorMsg = "Could not verify payload signature. The message was not signed by a valid client"; log.error(errorMsg); - throw new AgentCoreOperationException(errorMsg, e); + throw new AgentCoreOperationException(errorMsg); } + return actualMessage; } else { - String errorMsg = "The received message is in an INVALID format. " + - "Need to be JSON - {\"Msg\":\"\", \"Sig\":\"\"}."; - throw new AgentCoreOperationException(errorMsg); - } - if (verification) { - actualMessage = new String(Base64.decodeBase64(encodedMessage.toString()), StandardCharsets.UTF_8); - } else { - String errorMsg = "Could not verify payload signature. The message was not signed by a valid client"; - log.error(errorMsg); - throw new AgentCoreOperationException(errorMsg); + return message; } - return actualMessage; } public static String getAuthenticationMethod() { diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/enrollment/EnrollmentManager.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/enrollment/EnrollmentManager.java index 6059483bc..deaa5ac24 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/enrollment/EnrollmentManager.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/enrollment/EnrollmentManager.java @@ -111,7 +111,7 @@ public class EnrollmentManager { */ private EnrollmentManager() { this.SCEPUrl = AgentManager.getInstance().getEnrollmentEP(); - setEnrollmentStatus(); + //setEnrollmentStatus(); } /** diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/build.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/build.xml new file mode 100644 index 000000000..90687661e --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/build.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + 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 new file mode 100644 index 000000000..afcd89e0f --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml @@ -0,0 +1,75 @@ + + + + + + virtual-fire-alarm-plugin + org.wso2.carbon.devicemgt-plugins + 3.0.5-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics + WSO2 Carbon - IoT Server Virtual Firealarm Analytics capp + pom + + + + + maven-antrun-plugin + 1.7 + + + process-resources + + + + + + + run + + + + + + maven-assembly-plugin + 2.5.5 + + ${project.artifactId}-${carbon.devicemgt.plugins.version} + false + + src/assembly/src.xml + + + + + create-archive + package + + single + + + + + + + + \ No newline at end of file diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/assembly/src.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/assembly/src.xml new file mode 100644 index 000000000..a5a375010 --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/assembly/src.xml @@ -0,0 +1,36 @@ + + + + src + + zip + + false + ${basedir}/src + + + ${basedir}/target/carbonapps + / + true + + + \ No newline at end of file diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/artifacts.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/artifacts.xml new file mode 100644 index 000000000..fbd1362af --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/artifacts.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_execution/artifact.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_execution/artifact.xml new file mode 100644 index 000000000..b23fa50d7 --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_execution/artifact.xml @@ -0,0 +1,23 @@ + + + + + virtualfirealarm_execution.siddhiql + + diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_execution/virtualfirealarm_execution.siddhiql b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_execution/virtualfirealarm_execution.siddhiql new file mode 100644 index 000000000..4346a6199 --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_execution/virtualfirealarm_execution.siddhiql @@ -0,0 +1,20 @@ +/* Enter a unique ExecutionPlan */ +@Plan:name('virtualfirealarm_execution') + +/* Enter a unique description for ExecutionPlan */ +-- @Plan:description('virtualfirealarm_execution') + +/* define streams/tables and write queries here ... */ + +@Import('org.wso2.iot.virtualfirealarm:1.0.0') +define stream virtualfirealarm (meta_owner string, meta_deviceId string, meta_time long, temperature float); + +@Export('org.wso2.iot.devices.temperature:1.0.0') +define stream temperature (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, temperature float); + +from virtualfirealarm +select meta_owner, 'virtual_firealarm' as meta_deviceType, meta_deviceId, time:timestampInMilliseconds() as meta_time, temperature +insert into temperature; + + + diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_receiver/artifact.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_receiver/artifact.xml new file mode 100644 index 000000000..14141e7da --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_receiver/artifact.xml @@ -0,0 +1,22 @@ + + + + + virtualfirealarm_receiver.xml + diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_receiver/virtualfirealarm_receiver.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_receiver/virtualfirealarm_receiver.xml new file mode 100644 index 000000000..465f22269 --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_receiver/virtualfirealarm_receiver.xml @@ -0,0 +1,31 @@ + + + + + carbon.super/virtual_firealarm/+/temperature + admin + org.wso2.carbon.device.mgt.input.adapter.mqtt.util.MQTTContentValidator + default + https://${iot.core.host}:${iot.core.https.port}/dynamic-client-web/register + tcp://${mqtt.broker.host}:${mqtt.broker.port} + true + + + + diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_stream/artifact.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_stream/artifact.xml new file mode 100644 index 000000000..d14485b3b --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_stream/artifact.xml @@ -0,0 +1,23 @@ + + + + + org.wso2.iot.virtualfirealarm_1.0.0.json + + diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_stream/org.wso2.iot.virtualfirealarm_1.0.0.json b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_stream/org.wso2.iot.virtualfirealarm_1.0.0.json new file mode 100644 index 000000000..0ba70911e --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_stream/org.wso2.iot.virtualfirealarm_1.0.0.json @@ -0,0 +1,16 @@ +{ + "name": "org.wso2.iot.virtualfirealarm", + "version": "1.0.0", + "nickName": "virtual_firealarm", + "description": "Temperature data received from the virtual_firealarm", + "metaData": [ + {"name":"owner","type":"STRING"}, + {"name":"deviceId","type":"STRING"}, + {"name":"time","type":"LONG"} + ], + "payloadData": [ + { + "name": "temperature","type": "FLOAT" + } + ] +} \ No newline at end of file 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 59ccc4a79..7d00d0033 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 @@ -235,11 +235,6 @@ org.wso2.carbon.device.mgt.extensions provided - - org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin - provided - diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmServiceImpl.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmServiceImpl.java index c00dd6ab7..f5bb1d84b 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmServiceImpl.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmServiceImpl.java @@ -18,7 +18,6 @@ package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl; -import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -35,18 +34,15 @@ import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroupConstants; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation; -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.impl.VirtualFirealarmSecurityManager; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.xmpp.XmppAccount; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.xmpp.XmppConfig; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.xmpp.XmppServerClient; +import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.constants.VirtualFireAlarmConstants; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.dto.SensorRecord; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.exception.VirtualFireAlarmException; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.util.APIUtil; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.util.VirtualFireAlarmServiceUtils; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.util.ZipArchive; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.util.ZipUtil; +import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.xmpp.VirtualFirealarmXMPPException; +import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.xmpp.XmppAccount; +import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.xmpp.XmppConfig; +import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.xmpp.XmppServerClient; import org.wso2.carbon.identity.jwt.client.extension.JWTClient; import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; @@ -76,11 +72,8 @@ import java.util.UUID; public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService { - private static final String XMPP_PROTOCOL = "XMPP"; - private static final String MQTT_PROTOCOL = "MQTT"; private static final String KEY_TYPE = "PRODUCTION"; private static ApiApplicationKey apiApplicationKey; - private static final String DEVICE_MGT_SCOPE_IDENTIFIER = "device-mgt"; private static Log log = LogFactory.getLog(VirtualFireAlarmServiceImpl.class); @POST @@ -103,10 +96,7 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService { return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); } String resource = VirtualFireAlarmConstants.BULB_CONTEXT.replace("/", ""); - PrivateKey serverPrivateKey = VirtualFirealarmSecurityManager.getServerPrivateKey(); String actualMessage = resource + ":" + switchToState; - String encryptedMsg = VirtualFireAlarmServiceUtils.prepareSecurePayLoad(actualMessage, - serverPrivateKey); String publishTopic = APIUtil.getTenantDomainOftheUser() + "/" + VirtualFireAlarmConstants.DEVICE_TYPE + "/" + deviceId; @@ -114,7 +104,7 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService { commandOp.setCode("buzz"); commandOp.setType(Operation.Type.COMMAND); commandOp.setEnabled(true); - commandOp.setPayLoad(encryptedMsg); + commandOp.setPayLoad(actualMessage); Properties props = new Properties(); props.setProperty(VirtualFireAlarmConstants.MQTT_ADAPTER_TOPIC_PROPERTY_NAME, publishTopic); @@ -137,10 +127,6 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService { } catch (DeviceAccessAuthorizationException e) { log.error(e.getErrorMessage(), e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); - } catch (VirtualFireAlarmException e) { - String errorMsg = "Preparing Secure payload failed for device - [" + deviceId + "]"; - log.error(errorMsg); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } catch (OperationManagementException e) { String msg = "Error occurred while executing command operation upon ringing the buzzer"; log.error(msg, e); @@ -162,37 +148,22 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService { DeviceGroupConstants.Permissions.DEFAULT_MANAGE_POLICIES_PERMISSIONS)) { return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); } - PrivateKey serverPrivateKey = VirtualFirealarmSecurityManager.getServerPrivateKey(); String actualMessage = VirtualFireAlarmConstants.POLICY_CONTEXT + ":" + policy; - String encryptedMsg = VirtualFireAlarmServiceUtils.prepareSecurePayLoad(actualMessage, - serverPrivateKey); Map dynamicProperties = new HashMap<>(); - switch (protocolString) { - case XMPP_PROTOCOL: - dynamicProperties.put(VirtualFireAlarmConstants.JID_PROPERTY_KEY, - deviceId + "@" + XmppConfig.getInstance().getServerName()); - dynamicProperties.put(VirtualFireAlarmConstants.SUBJECT_PROPERTY_KEY, "POLICTY-REQUEST"); - dynamicProperties.put(VirtualFireAlarmConstants.MESSAGE_TYPE_PROPERTY_KEY, - VirtualFireAlarmConstants.CHAT_PROPERTY_KEY); - APIUtil.getOutputEventAdapterService().publish(VirtualFireAlarmConstants.XMPP_ADAPTER_NAME, - dynamicProperties, encryptedMsg); - break; - default: - - String publishTopic = APIUtil.getTenantDomainOftheUser() + "/" - + VirtualFireAlarmConstants.DEVICE_TYPE + "/" + deviceId; - dynamicProperties.put(VirtualFireAlarmConstants.ADAPTER_TOPIC_PROPERTY, publishTopic); - APIUtil.getOutputEventAdapterService().publish(VirtualFireAlarmConstants.MQTT_ADAPTER_NAME, - dynamicProperties, encryptedMsg); - break; - } + String publishTopic = APIUtil.getTenantDomainOftheUser() + "/" + + VirtualFireAlarmConstants.DEVICE_TYPE + "/" + deviceId; + dynamicProperties.put(VirtualFireAlarmConstants.ADAPTER_TOPIC_PROPERTY, publishTopic); + dynamicProperties.put(VirtualFireAlarmConstants.JID_PROPERTY_KEY, + deviceId + "@" + XmppConfig.getInstance().getServerName()); + dynamicProperties.put(VirtualFireAlarmConstants.SUBJECT_PROPERTY_KEY, "POLICTY-REQUEST"); + dynamicProperties.put(VirtualFireAlarmConstants.MESSAGE_TYPE_PROPERTY_KEY, + VirtualFireAlarmConstants.CHAT_PROPERTY_KEY); + APIUtil.getOutputEventAdapterService().publish(VirtualFireAlarmConstants.XMPP_ADAPTER_NAME, + dynamicProperties, actualMessage); return Response.ok().build(); } catch (DeviceAccessAuthorizationException e) { log.error(e.getErrorMessage(), e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); - } catch (VirtualFireAlarmException e) { - log.error(e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } } @@ -260,7 +231,7 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService { } catch (UserStoreException ex) { log.error(ex.getMessage(), ex); return Response.status(500).entity(ex.getMessage()).build(); - } catch (VirtualFirealarmDeviceMgtPluginException ex) { + } catch (VirtualFirealarmXMPPException ex) { log.error(ex.getMessage(), ex); return Response.status(500).entity(ex.getMessage()).build(); } @@ -294,7 +265,7 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService { private ZipArchive createDownloadFile(String owner, String deviceName, String sketchType) throws DeviceManagementException, APIManagerException, JWTClientException, - UserStoreException, VirtualFirealarmDeviceMgtPluginException { + UserStoreException, VirtualFirealarmXMPPException { //create new device id String deviceId = shortUUID(); boolean status = register(deviceId, deviceName); diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/constants/VirtualFireAlarmConstants.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/constants/VirtualFireAlarmConstants.java new file mode 100644 index 000000000..204ede004 --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/constants/VirtualFireAlarmConstants.java @@ -0,0 +1,84 @@ +/* + * 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.service.impl.constants; + +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.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/util/VirtualFireAlarmServiceUtils.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/util/VirtualFireAlarmServiceUtils.java deleted file mode 100644 index 277000e0f..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/util/VirtualFireAlarmServiceUtils.java +++ /dev/null @@ -1,51 +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.service.impl.util; - -import org.apache.commons.codec.binary.Base64; -import org.json.JSONObject; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.exception.VirtualFirealarmDeviceMgtPluginException; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.impl.VirtualFirealarmSecurityManager; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.exception.VirtualFireAlarmException; - -import java.lang.*; -import java.security.PrivateKey; - -/** - * - */ -public class VirtualFireAlarmServiceUtils { - - private static final String JSON_MESSAGE_KEY = "Msg"; - private static final String JSON_SIGNATURE_KEY = "Sig"; - - public static String prepareSecurePayLoad(String message, PrivateKey signatureKey) throws VirtualFireAlarmException { - try { - message = Base64.encodeBase64String(message.getBytes()); - String signedPayload = VirtualFirealarmSecurityManager.signMessage(message, signatureKey); - JSONObject jsonPayload = new JSONObject(); - jsonPayload.put(JSON_MESSAGE_KEY, message); - jsonPayload.put(JSON_SIGNATURE_KEY, signedPayload); - return jsonPayload.toString(); - } catch (VirtualFirealarmDeviceMgtPluginException e) { - throw new VirtualFireAlarmException(e); - } - - } -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/util/VirtualFireAlarmUtilConstants.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/util/VirtualFireAlarmUtilConstants.java index fae96848d..a255b9537 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/util/VirtualFireAlarmUtilConstants.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/util/VirtualFireAlarmUtilConstants.java @@ -1,6 +1,5 @@ package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.util; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.xmpp.XmppConfig; public class VirtualFireAlarmUtilConstants { diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/util/ZipUtil.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/util/ZipUtil.java index 2c6cd2840..39e938f2b 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/util/ZipUtil.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/util/ZipUtil.java @@ -30,7 +30,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.xmpp.XmppConfig; +import org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl.xmpp.XmppConfig; import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.NetworkUtils; diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/VirtualFirealarmXMPPException.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/VirtualFirealarmXMPPException.java new file mode 100644 index 000000000..57d0b8a0b --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/VirtualFirealarmXMPPException.java @@ -0,0 +1,56 @@ +/* + * 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.service.impl.xmpp; + + +public class VirtualFirealarmXMPPException extends Exception{ + + private String errorMessage; + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public VirtualFirealarmXMPPException(String msg, Exception nestedEx) { + super(msg, nestedEx); + setErrorMessage(msg); + } + + public VirtualFirealarmXMPPException(String message, Throwable cause) { + super(message, cause); + setErrorMessage(message); + } + + public VirtualFirealarmXMPPException(String msg) { + super(msg); + setErrorMessage(msg); + } + + public VirtualFirealarmXMPPException() { + super(); + } + + public VirtualFirealarmXMPPException(Throwable cause) { + super(cause); + } + +} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/XmppAccount.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/XmppAccount.java new file mode 100644 index 000000000..162ea957f --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/XmppAccount.java @@ -0,0 +1,63 @@ +/* + * 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.service.impl.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.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/XmppConfig.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/XmppConfig.java new file mode 100644 index 000000000..d96f14c6e --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/XmppConfig.java @@ -0,0 +1,124 @@ +/* + * 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.service.impl.xmpp; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +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 static final String ENABLED = "enabled"; + private static final String USERNAME = "username"; + private static final String PASSWORD = "password"; + private static final String HOST = "host"; + private static final String PORT = "port"; + private static final String SERVERNAME = "serverName"; + private static final String JID = "jid"; + + private XmppConfig() { + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + InputStream input = classLoader.getResourceAsStream("../xmpp.properties"); + Properties properties = new Properties(); + try { + properties.load(input); + enabled = Boolean.parseBoolean(properties.getProperty(ENABLED, "false")); + host = properties.getProperty(HOST); + port = Integer.parseInt(properties.getProperty(PORT)); + username = properties.getProperty(USERNAME); + password = properties.getProperty(PASSWORD); + serverName = properties.getProperty(SERVERNAME); + jid = properties.getProperty(JID); + } catch (IOException e) { + log.error("Failed to load xmpp config properties."); + } + } + + 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.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/XmppServerClient.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/XmppServerClient.java new file mode 100644 index 000000000..7369f90a4 --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/xmpp/XmppServerClient.java @@ -0,0 +1,66 @@ +/* + * 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.service.impl.xmpp; + +import org.jivesoftware.smack.AccountManager; +import org.jivesoftware.smack.ConnectionConfiguration; +import org.jivesoftware.smack.XMPPConnection; +import org.jivesoftware.smack.XMPPException; + +import java.util.HashMap; +import java.util.Map; + +public class XmppServerClient { + + public static boolean createAccount(XmppAccount xmppAccount) throws VirtualFirealarmXMPPException { + 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 VirtualFirealarmXMPPException( + "XMPP account creation failed. Error: " + e.getLocalizedMessage(), e); + } + } + } else { + throw new VirtualFirealarmXMPPException("Invalid XMPP attributes"); + } + } else { + return true; + } + } +} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/WEB-INF/web.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/WEB-INF/web.xml index d250c67de..eb4a397bf 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/WEB-INF/web.xml @@ -35,4 +35,6 @@ true + + \ No newline at end of file diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/WEB-INF/xmpp.properties b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/WEB-INF/xmpp.properties new file mode 100644 index 000000000..3a173cb92 --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/WEB-INF/xmpp.properties @@ -0,0 +1,25 @@ +# +# Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# + +#[XMPP-Configurations] +enabled=false +username=admin +password=admin +host=localhost +port=5222 +serverName=localhost +jid=admin@localhost \ No newline at end of file diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml deleted file mode 100644 index 3c71c1b28..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - virtual-fire-alarm-plugin - org.wso2.carbon.devicemgt-plugins - 3.0.5-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api - war - WSO2 Carbon - IoT Server SCEP Server API - WSO2 Carbon - Virtual FireAlarm SCEP Server API Implementation - http://wso2.org - - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.common - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.core - provided - - - org.apache.axis2.wso2 - axis2-client - - - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.certificate.mgt.core - provided - - - commons-codec - commons-codec - - - - - - - - org.apache.cxf - cxf-rt-frontend-jaxws - provided - - - org.apache.cxf - cxf-rt-frontend-jaxrs - provided - - - org.apache.cxf - cxf-rt-transports-http - provided - - - - - org.codehaus.jackson - jackson-core-asl - - - org.codehaus.jackson - jackson-jaxrs - - - javax - javaee-web-api - provided - - - javax.ws.rs - jsr311-api - provided - - - commons-httpclient.wso2 - commons-httpclient - provided - - - - org.wso2.carbon - org.wso2.carbon.utils - provided - - - org.bouncycastle.wso2 - bcprov-jdk15on - - - org.wso2.carbon - org.wso2.carbon.user.api - - - org.wso2.carbon - org.wso2.carbon.queuing - - - org.wso2.carbon - org.wso2.carbon.base - - - org.apache.axis2.wso2 - axis2 - - - org.igniterealtime.smack.wso2 - smack - - - org.igniterealtime.smack.wso2 - smackx - - - jaxen - jaxen - - - commons-fileupload.wso2 - commons-fileupload - - - org.apache.ant.wso2 - ant - - - org.apache.ant.wso2 - ant - - - commons-httpclient.wso2 - commons-httpclient - - - org.eclipse.equinox - javax.servlet - - - org.wso2.carbon - org.wso2.carbon.registry.api - - - - - - commons-codec - commons-codec - - - - - - - - maven-compiler-plugin - - UTF-8 - ${wso2.maven.compiler.source} - ${wso2.maven.compiler.target} - - - - maven-war-plugin - - virtual_firealarm_scep - - - - - - diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/VirtualFireAlarmScepServer.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/VirtualFireAlarmScepServer.java deleted file mode 100644 index c5b4676bc..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/VirtualFireAlarmScepServer.java +++ /dev/null @@ -1,65 +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.scep.service.impl; - -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Response; -import java.io.InputStream; - - -public interface VirtualFireAlarmScepServer { - - /** - * This is an API called/used by the SCEP Client of the VirtualFirealarm device in its SCEP enrollment process. - * This acts as the endpoint exposed as part of the SCEP-Server for use by a SCEP Client. This is one of the two - * method-signatures that takes different parameters according to the SCEP-Operation executed by the SCEP-Client - * of the enrolling device. The API supports 2 SCEP Operations [GetCACert] and [GetCACaps]. - *

- * Operation [GetCACert] returns the CA cert of the SCEP-Server for the device to verify its authenticity. - * Operation [GetCACaps] returns the CA Capabilities of the SCEP-Server. - * - * @param operation the SCEP operation requested by the client. [GetCACert] or [GetCACaps] - * @param message any messages pertaining to the requested SCEP Operation. - * @return an HTTP Response object with either the CA-Cert or the CA-Capabilities according to the operation. - */ - @GET - @Path("scep") - Response scepRequest(@QueryParam("operation") String operation, @QueryParam("message") String message); - - - /** - * This is an API called/used by the SCEP Client of the VirtualFirealarm device in its SCEP enrollment process. - * This acts as the endpoint exposed as part of the SCEP-Server for use by a SCEP Client. This is one of the two - * method-signatures that takes different parameters according to the SCEP-Operation executed by the SCEP-Client - * of the enrolling device. This API supports the SCEP Operation [PKIOperation]. - *

- * Operation [PKIOperation] returns a certificate generated by the SCEP-Server for the enrolling device. - * - * @param operation the final SCEP operation executed in the enrollment process - which is [PKIOperation] - * @param inputStream an input stream consisting of the Certificate-Signing-Request (CSR) from the device. - * @return an HTTP Response object with the signed certificate for the device by the CA of the SCEP Server. - */ - @POST - @Path("scep") - Response scepRequestPost(@QueryParam("operation") String operation, InputStream inputStream); - -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/VirtualFireAlarmScepServerImpl.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/VirtualFireAlarmScepServerImpl.java deleted file mode 100644 index c2f7a17e6..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/VirtualFireAlarmScepServerImpl.java +++ /dev/null @@ -1,136 +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.scep.service.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.certificate.mgt.core.dto.SCEPResponse; -import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException; -import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.service.impl.exception.VirtualFireAlarmException; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.service.impl.util.scep.ContentType; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.service.impl.util.scep.SCEPOperation; -import org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.service.impl.util.VirtualFireAlarmServiceUtils; - -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.InputStream; - -@SuppressWarnings("Non-Annoted WebService") -public class VirtualFireAlarmScepServerImpl implements VirtualFireAlarmScepServer { - - private static Log log = LogFactory.getLog(VirtualFireAlarmScepServerImpl.class); - - @GET - @Path("scep") - public Response scepRequest(@QueryParam("operation") String operation, @QueryParam("message") String message) { - if (log.isDebugEnabled()) { - log.debug("Invoking SCEP operation " + operation); - } - if (SCEPOperation.GET_CA_CERT.getValue().equals(operation)) { - if (log.isDebugEnabled()) { - log.debug("Invoking GetCACert"); - } - try { - CertificateManagementService certificateManagementService = - VirtualFireAlarmServiceUtils.getCertificateManagementService(); - SCEPResponse scepResponse = certificateManagementService.getCACertSCEP(); - Response.ResponseBuilder responseBuilder; - switch (scepResponse.getResultCriteria()) { - case CA_CERT_FAILED: - log.error("CA cert failed"); - responseBuilder = Response.serverError(); - break; - case CA_CERT_RECEIVED: - if (log.isDebugEnabled()) { - log.debug("CA certificate received in GetCACert"); - } - responseBuilder = Response.ok(scepResponse.getEncodedResponse(), - ContentType.X_X509_CA_CERT); - break; - case CA_RA_CERT_RECEIVED: - if (log.isDebugEnabled()) { - log.debug("CA and RA certificates received in GetCACert"); - } - responseBuilder = Response.ok(scepResponse.getEncodedResponse(), - ContentType.X_X509_CA_RA_CERT); - break; - default: - log.error("Invalid SCEP request"); - responseBuilder = Response.serverError(); - break; - } - - return responseBuilder.build(); - } catch (VirtualFireAlarmException e) { - log.error("Error occurred while enrolling the VirtualFireAlarm device", e); - } catch (KeystoreException e) { - log.error("Keystore error occurred while enrolling the VirtualFireAlarm device", e); - } - - } else if (SCEPOperation.GET_CA_CAPS.getValue().equals(operation)) { - - if (log.isDebugEnabled()) { - log.debug("Invoking GetCACaps"); - } - try { - CertificateManagementService certificateManagementService = VirtualFireAlarmServiceUtils. - getCertificateManagementService(); - byte caCaps[] = certificateManagementService.getCACapsSCEP(); - - return Response.ok(caCaps, MediaType.TEXT_PLAIN).build(); - - } catch (VirtualFireAlarmException e) { - log.error("Error occurred while enrolling the device", e); - } - } else { - log.error("Invalid SCEP operation " + operation); - } - return Response.serverError().build(); - } - - @POST - @Path("scep") - public Response scepRequestPost(@QueryParam("operation") String operation, InputStream inputStream) { - if (log.isDebugEnabled()) { - log.debug("Invoking SCEP operation " + operation); - } - if (SCEPOperation.PKI_OPERATION.getValue().equals(operation)) { - if (log.isDebugEnabled()) { - log.debug("Invoking PKIOperation"); - } - try { - CertificateManagementService certificateManagementService = VirtualFireAlarmServiceUtils. - getCertificateManagementService(); - byte pkiMessage[] = certificateManagementService.getPKIMessageSCEP(inputStream); - return Response.ok(pkiMessage, ContentType.X_PKI_MESSAGE).build(); - } catch (VirtualFireAlarmException e) { - log.error("Error occurred while enrolling the device", e); - } catch (KeystoreException e) { - log.error("Keystore error occurred while enrolling the device", e); - } - } - return Response.serverError().build(); - } - -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/exception/VirtualFireAlarmException.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/exception/VirtualFireAlarmException.java deleted file mode 100644 index 4a81ec6d5..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/exception/VirtualFireAlarmException.java +++ /dev/null @@ -1,31 +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.scep.service.impl.exception; - -public class VirtualFireAlarmException extends Exception { - private static final long serialVersionUID = 118512086957330189L; - - public VirtualFireAlarmException(String errorMessage) { - super(errorMessage); - } - - public VirtualFireAlarmException(String errorMessage, Throwable throwable) { - super(errorMessage, throwable); - } -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/util/VirtualFireAlarmServiceUtils.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/util/VirtualFireAlarmServiceUtils.java deleted file mode 100644 index de3d1e6a2..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/util/VirtualFireAlarmServiceUtils.java +++ /dev/null @@ -1,103 +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.scep.service.impl.util; - -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.iot.virtualfirealarm.scep.service.impl.exception.VirtualFireAlarmException; - -import java.lang.*; -import java.security.PublicKey; -import java.security.cert.X509Certificate; - -/** - * - */ -public class VirtualFireAlarmServiceUtils { - private static final Log log = LogFactory.getLog(VirtualFireAlarmServiceUtils.class); - - /** - * - * @return - * @throws VirtualFireAlarmException - */ - public static CertificateManagementService getCertificateManagementService() throws VirtualFireAlarmException { - - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - CertificateManagementService certificateManagementService = (CertificateManagementService) - ctx.getOSGiService(CertificateManagementService.class, null); - - if (certificateManagementService == null) { - String msg = "EnrollmentService is not initialized"; - log.error(msg); - throw new VirtualFireAlarmException(msg); - } - - return certificateManagementService; - } - - /** - * - * @param deviceId - * @return - * @throws VirtualFireAlarmException - */ - public static PublicKey getDevicePublicKey(String deviceId) throws VirtualFireAlarmException { - PublicKey clientPublicKey; - String alias = ""; - - try { - alias += deviceId.hashCode(); - - CertificateManagementService certificateManagementService = - VirtualFireAlarmServiceUtils.getCertificateManagementService(); - X509Certificate clientCertificate = (X509Certificate) certificateManagementService.getCertificateByAlias( - alias); - clientPublicKey = clientCertificate.getPublicKey(); - - } catch (VirtualFireAlarmException e) { - String errorMsg = "Could not retrieve CertificateManagementService from the runtime."; - if(log.isDebugEnabled()){ - log.debug(errorMsg); - } - throw new VirtualFireAlarmException(errorMsg, e); - } 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 VirtualFireAlarmException(errorMsg, e); - } else { - errorMsg = "An error occurred whilst trying to retrieve certificate for deviceId [" + deviceId + - "] with alias: [" + alias + "]"; - if(log.isDebugEnabled()){ - log.debug(errorMsg); - } - throw new VirtualFireAlarmException(errorMsg, e); - } - } - return clientPublicKey; - } - -} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/util/scep/ContentType.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/util/scep/ContentType.java deleted file mode 100644 index 707ca75fd..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/util/scep/ContentType.java +++ /dev/null @@ -1,26 +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.scep.service.impl.util.scep; - -public class ContentType { - public static final String X_PKI_MESSAGE = "application/x-pki-message"; - public static final String X_X509_CA_CERT = "application/x-x509-ca-cert"; - public static final String X_X509_CA_RA_CERT = "application/x-x509-ca-ra-cert"; -} - diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/util/scep/SCEPOperation.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/util/scep/SCEPOperation.java deleted file mode 100644 index b93a99016..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/scep/service/impl/util/scep/SCEPOperation.java +++ /dev/null @@ -1,39 +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.scep.service.impl.util.scep; - -public enum SCEPOperation { - GET_CA_CERT("GetCACert"), - GET_CA_CAPS("GetCACaps"), - PKI_OPERATION("PKIOperation"); - - private String value; - - private SCEPOperation(String value) { - this.setValue(value); - } - - 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.scep.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/META-INF/webapp-classloading.xml deleted file mode 100644 index fa4461919..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/META-INF/webapp-classloading.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - false - - - CXF,Carbon - diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/WEB-INF/cxf-servlet.xml deleted file mode 100644 index 23280d436..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/WEB-INF/web.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 2d8392be4..000000000 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - WSO2 IoT Server - WSO2 IoT Server - - - CXFServlet - org.apache.cxf.transport.servlet.CXFServlet - 1 - - - CXFServlet - /* - - - isAdminService - false - - - doAuthentication - false - - - isSharedWithAllTenants - true - - - - - managed-api-enabled - false - - - \ No newline at end of file diff --git a/components/device-types/virtual-fire-alarm-plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/pom.xml index 17832867a..afcde9a9b 100644 --- a/components/device-types/virtual-fire-alarm-plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/pom.xml @@ -38,7 +38,7 @@ org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl org.wso2.carbon.device.mgt.iot.virtualfirealarm.api - org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api + org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics 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 d6b111f6f..dd6ffe790 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 @@ -45,11 +45,6 @@ org.wso2.carbon.device.mgt.iot.virtualfirealarm.api war - - org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api - war - com.h2database.wso2 h2-database-engine @@ -96,6 +91,18 @@ + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics + + ${project.version} + zip + true + + ${project.build.directory}/maven-shared-archive-resources/carbonapps + + **/* + org.wso2.carbon.devicemgt-plugins org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui @@ -128,15 +135,6 @@ ${project.build.directory}/maven-shared-archive-resources/webapps/ virtual_firealarm.war - - org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api - - war - true - ${project.build.directory}/maven-shared-archive-resources/webapps/ - virtual_firealarm_scep.war - @@ -227,11 +225,6 @@ org.eclipse.equinox.p2.type.group:true - - - org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin:${carbon.devicemgt.plugins.version} - - org.wso2.carbon.core.server:${carbon.kernel.version} diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/src/main/resources/p2.inf b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/src/main/resources/p2.inf index 7a18d54a3..f88a8eb2d 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/src/main/resources/p2.inf +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/src/main/resources/p2.inf @@ -18,7 +18,9 @@ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../reso org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/devicetypes/);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm_${feature.version}/devicetypes/,target:${installFolder}/../../deployment/server/devicetypes/,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../conf/etc/device-mgt-plugins/);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm_${feature.version}/conf/virtual_firealarm.xml,target:${installFolder}/../../conf/etc/device-mgt-plugins/virtual_firealarm.xml,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/carbonapps/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm_${feature.version}/carbonapps/,target:${installFolder}/../../deployment/server/carbonapps/,overwrite:true);\ + instructions.unconfigure = \ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/virtual_firealarm.war);\ @@ -40,4 +42,4 @@ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../dep org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.policy-wizard);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../resources/security/wso2certs.jks);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/devicetypes/virtual_firealarm.xml);\ -org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../conf/etc/device-mgt-plugins/virtual_firealarm.xml);\ +org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/carbonapps/virtualfirealarm.car);\ \ No newline at end of file diff --git a/pom.xml b/pom.xml index 096152ebf..172469dd2 100644 --- a/pom.xml +++ b/pom.xml @@ -471,12 +471,6 @@ ${carbon.devicemgt.plugins.version} war - - org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api - ${carbon.devicemgt.plugins.version} - war - org.wso2.carbon.devicemgt-plugins org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl From 8c4dee7c2fc48465664ea5627f86ab77727542be Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Sat, 7 Jan 2017 15:40:21 +0530 Subject: [PATCH 2/7] Updating cdmf version into 2.0.6 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4dc0057f0..bf119d419 100644 --- a/pom.xml +++ b/pom.xml @@ -1250,7 +1250,7 @@ 1.1.1 - 2.0.6-SNAPSHOT + 2.0.6 [2.0.0, 3.0.0) From b7a5454c2ffb606b1663a7e0442ae3401afa265d Mon Sep 17 00:00:00 2001 From: WSO2 Builder Date: Sat, 7 Jan 2017 11:22:33 +0000 Subject: [PATCH 3/7] [maven-release-plugin] prepare release v3.0.5 --- .../org.wso2.carbon.device.mgt.iot.analytics/pom.xml | 2 +- .../org.wso2.carbon.iot.device.statistics.dashboard/pom.xml | 2 +- .../iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml | 2 +- components/analytics/iot-analytics/pom.xml | 2 +- components/analytics/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml | 2 +- components/device-types/androidsense-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml | 2 +- components/device-types/arduino-plugin/pom.xml | 2 +- components/device-types/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml | 2 +- components/device-types/raspberrypi-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-types/virtual-fire-alarm-plugin/pom.xml | 2 +- .../org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml | 2 +- components/extensions/appm-connector/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.http/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml | 2 +- components/extensions/cdmf-transport-adapters/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/mb-extensions/pom.xml | 2 +- components/extensions/pom.xml | 2 +- .../org.wso2.extension.siddhi.execution.json/pom.xml | 2 +- components/extensions/siddhi-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.mobile.android/pom.xml | 2 +- components/mobile-plugins/android-plugin/pom.xml | 2 +- components/mobile-plugins/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.mobile.windows/pom.xml | 2 +- components/mobile-plugins/windows-plugin/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.iot.geo.dashboard.feature/pom.xml | 2 +- features/analytics-feature/pom.xml | 2 +- .../pom.xml | 4 ++-- .../androidsense-plugin-feature/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.feature/pom.xml | 2 +- .../device-types-feature/arduino-plugin-feature/pom.xml | 2 +- features/device-types-feature/pom.xml | 4 ++-- .../pom.xml | 2 +- .../device-types-feature/raspberrypi-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../virtual-fire-alarm-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 6 +++--- .../org.wso2.carbon.device.mgt.adapter.feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- features/extensions-feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../mobile-plugins-feature/android-plugin-feature/pom.xml | 4 ++-- features/mobile-plugins-feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../mobile-plugins-feature/windows-plugin-feature/pom.xml | 4 ++-- pom.xml | 6 +++--- 75 files changed, 93 insertions(+), 93 deletions(-) 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 bbb867dac..b5fe8c337 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.5-SNAPSHOT + 3.0.5 ../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 ed31c04ba..25b9b14cc 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.5-SNAPSHOT + 3.0.5 ../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 6869eeae7..9b8ec5eb3 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/analytics/iot-analytics/pom.xml b/components/analytics/iot-analytics/pom.xml index 43b0bb55c..a4fb6050b 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/analytics/pom.xml b/components/analytics/pom.xml index 6b4bf1908..ac8e67ce3 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.5-SNAPSHOT + 3.0.5 ../../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 4a94f1592..c2582e998 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.5-SNAPSHOT + 3.0.5 ../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 4a4a2f845..fca93bbc1 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.5-SNAPSHOT + 3.0.5 ../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 f362df4d4..aa5c9ca19 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/device-types/androidsense-plugin/pom.xml b/components/device-types/androidsense-plugin/pom.xml index 43386b1f8..24eca9ec0 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.5-SNAPSHOT + 3.0.5 ../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 f04ebe19b..5517173c6 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.5-SNAPSHOT + 3.0.5 ../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 9b2465e21..b25070c5a 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.5-SNAPSHOT + 3.0.5 ../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 5bed06280..6ff2d28ed 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/device-types/arduino-plugin/pom.xml b/components/device-types/arduino-plugin/pom.xml index ff196368b..bb2d05045 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/device-types/pom.xml b/components/device-types/pom.xml index f4e7c9ab6..627287563 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.5-SNAPSHOT + 3.0.5 ../../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 ccca11f18..e6cd1d122 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.5-SNAPSHOT + 3.0.5 ../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 ddae87c22..f8e3bedb2 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.5-SNAPSHOT + 3.0.5 ../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 77b68621c..b870c904f 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/pom.xml b/components/device-types/raspberrypi-plugin/pom.xml index d42d8d567..07d69081f 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.5-SNAPSHOT + 3.0.5 ../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 e4ec55de6..301ebfa74 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.5-SNAPSHOT + 3.0.5 ../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 4e3e50615..53ca0ea28 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.5-SNAPSHOT + 3.0.5 ../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 6c9cc0636..47a7e940b 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.5-SNAPSHOT + 3.0.5 ../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 index ddd6b0745..5c70b691f 100644 --- 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 @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml index 3c71c1b28..2237f5b72 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.5-SNAPSHOT + 3.0.5 ../pom.xml 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 1022c15ad..21f6bc63d 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.5-SNAPSHOT + 3.0.5 ../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 17832867a..2ab6c6ae3 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.5-SNAPSHOT + 3.0.5 ../pom.xml 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 7351fa82c..682bce16c 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/extensions/appm-connector/pom.xml b/components/extensions/appm-connector/pom.xml index 3e8801d59..a44568679 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.5-SNAPSHOT + 3.0.5 ../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 f47feca20..c769fee4e 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.5-SNAPSHOT + 3.0.5 ../../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 1d972eb97..41033b749 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.5-SNAPSHOT + 3.0.5 ../../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 c217dd92a..2e8c64559 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.5-SNAPSHOT + 3.0.5 ../../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 34f3a24d9..55c0bcaaf 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.5-SNAPSHOT + 3.0.5 ../../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 f6af28854..3e1579376 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.5-SNAPSHOT + 3.0.5 ../../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 1c2f0a48e..37278a6f2 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.5-SNAPSHOT + 3.0.5 ../../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 c72d27c77..518747ed5 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.5-SNAPSHOT + 3.0.5 ../../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 15f1ac8a9..d7645f6c2 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.5-SNAPSHOT + 3.0.5 ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/pom.xml b/components/extensions/cdmf-transport-adapters/pom.xml index d8b44c000..9576cfbd3 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.5-SNAPSHOT + 3.0.5 ../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 b7e13a322..ff8028e70 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index 955aef40b..ad107195d 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml index cfdeeaffb..90aa8909f 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.5-SNAPSHOT + 3.0.5 ../../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 fa7056957..fb1a879fd 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml index c2e8e2cb4..d4ca3c626 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.5-SNAPSHOT + 3.0.5 ../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 2497c485f..6919fc59b 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.5-SNAPSHOT + 3.0.5 ../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 c2ea04177..26755e735 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.5-SNAPSHOT + 3.0.5 ../pom.xml 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 d2245d5e4..34452e8e4 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.5-SNAPSHOT + 3.0.5 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.ui - 3.0.5-SNAPSHOT + 3.0.5 WSO2 Carbon - Mobile Android UI pom 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 e89d77a25..c45f3202d 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index acd95cde4..544ca0540 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index bf68fc73e..1b792cb8f 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.5-SNAPSHOT + 3.0.5 ../../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 53533a75c..45c6c5f92 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.5-SNAPSHOT + 3.0.5 ../pom.xml 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 029a613a0..1e773d50a 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.5-SNAPSHOT + 3.0.5 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.windows.ui - 3.0.5-SNAPSHOT + 3.0.5 WSO2 Carbon - Mobile Windows UI pom 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 3a74f23de..a3999aa7f 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/components/mobile-plugins/windows-plugin/pom.xml b/components/mobile-plugins/windows-plugin/pom.xml index 8478e9575..20c347c48 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.5-SNAPSHOT + 3.0.5 ../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 e714b5822..aec6fc7b8 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.5-SNAPSHOT + 3.0.5 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.analytics.feature - 3.0.5-SNAPSHOT + 3.0.5 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 a4bc43fa2..a0847239e 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.5-SNAPSHOT + 3.0.5 ../pom.xml 4.0.0 org.wso2.carbon.iot.device.statistics.dashboard.feature - 3.0.5-SNAPSHOT + 3.0.5 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 a58c81890..122c6a853 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/features/analytics-feature/pom.xml b/features/analytics-feature/pom.xml index 510dd1f0e..8d7feb99b 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.5-SNAPSHOT + 3.0.5 ../../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 9e7f88175..a04220329 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.5-SNAPSHOT + 3.0.5 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.feature - 3.0.5-SNAPSHOT + 3.0.5 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 2a66c7275..819d9f781 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.5-SNAPSHOT + 3.0.5 ../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 5a76c077e..ea86473e2 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.5-SNAPSHOT + 3.0.5 ../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 aff26f722..50d1d383b 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/features/device-types-feature/pom.xml b/features/device-types-feature/pom.xml index 3ae21f3cf..1089ad95e 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.5-SNAPSHOT + 3.0.5 ../../pom.xml 4.0.0 device-types-feature - 3.0.5-SNAPSHOT + 3.0.5 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 d953a7939..17eb81c7e 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.5-SNAPSHOT + 3.0.5 ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml index f64b6f2fc..669169552 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.5-SNAPSHOT + 3.0.5 ../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 d6b111f6f..24c91d436 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.5-SNAPSHOT + 3.0.5 ../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 59acfd41b..248f40363 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.5-SNAPSHOT + 3.0.5 ../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 a659dc923..199026336 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.5-SNAPSHOT + 3.0.5 ../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 7a13fe1a6..7115d1fe6 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.5-SNAPSHOT + 3.0.5 ../pom.xml org.wso2.carbon.appmgt.mdm.osgiconnector.feature pom - 3.0.5-SNAPSHOT + 3.0.5 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.5-SNAPSHOT + 3.0.5 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 70836caa4..71ae71e3d 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.5-SNAPSHOT + 3.0.5 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.adapter.feature pom - 3.0.5-SNAPSHOT + 3.0.5 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 8f146842d..ffa4d006a 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.5-SNAPSHOT + 3.0.5 ../pom.xml org.wso2.extension.siddhi.execution.json.feature pom - 3.0.5-SNAPSHOT + 3.0.5 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 ce66047ca..b3c3d25c6 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.5-SNAPSHOT + 3.0.5 ../../pom.xml 4.0.0 extensions-feature - 3.0.5-SNAPSHOT + 3.0.5 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 9c2883b72..ce3dc94e1 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.5-SNAPSHOT + 3.0.5 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.feature pom - 3.0.5-SNAPSHOT + 3.0.5 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 922f0aa3a..dd446fc6e 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.5-SNAPSHOT + 3.0.5 ../pom.xml 4.0.0 android-plugin-feature - 3.0.5-SNAPSHOT + 3.0.5 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 caa137038..a5b403446 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.5-SNAPSHOT + 3.0.5 ../../pom.xml 4.0.0 mobile-plugins-feature - 3.0.5-SNAPSHOT + 3.0.5 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 0032639f2..beae84067 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.5-SNAPSHOT + 3.0.5 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.windows.feature pom - 3.0.5-SNAPSHOT + 3.0.5 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 9192d7c16..55371b041 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.5-SNAPSHOT + 3.0.5 ../pom.xml 4.0.0 windows-plugin-feature - 3.0.5-SNAPSHOT + 3.0.5 pom WSO2 Carbon - Device Management Windows Plugin Feature http://wso2.org diff --git a/pom.xml b/pom.xml index bf119d419..cbd3ef4cb 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent pom - 3.0.5-SNAPSHOT + 3.0.5 WSO2 Carbon - Device Management Plugins Parent http://wso2.org WSO2 Carbon - Device Management Plugins Parent @@ -1257,7 +1257,7 @@ 1.2.9 - 3.0.5-SNAPSHOT + 3.0.5 4.4.8 @@ -1383,7 +1383,7 @@ scm:git:https://github.com/wso2/carbon-device-mgt-plugins.git scm:git:https://github.com/wso2/carbon-device-mgt-plugins.git - HEAD + v3.0.5 From b10579950bc1491fe1014b9b966ee562fda18873 Mon Sep 17 00:00:00 2001 From: WSO2 Builder Date: Sat, 7 Jan 2017 11:25:51 +0000 Subject: [PATCH 4/7] [maven-release-plugin] prepare for next development iteration --- .../org.wso2.carbon.device.mgt.iot.analytics/pom.xml | 2 +- .../org.wso2.carbon.iot.device.statistics.dashboard/pom.xml | 2 +- .../iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml | 2 +- components/analytics/iot-analytics/pom.xml | 2 +- components/analytics/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml | 2 +- components/device-types/androidsense-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml | 2 +- components/device-types/arduino-plugin/pom.xml | 2 +- components/device-types/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml | 2 +- components/device-types/raspberrypi-plugin/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-types/virtual-fire-alarm-plugin/pom.xml | 2 +- .../org.wso2.carbon.appmgt.mdm.osgiconnector/pom.xml | 2 +- components/extensions/appm-connector/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.http/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml | 2 +- components/extensions/cdmf-transport-adapters/pom.xml | 2 +- .../pom.xml | 2 +- components/extensions/mb-extensions/pom.xml | 2 +- components/extensions/pom.xml | 2 +- .../org.wso2.extension.siddhi.execution.json/pom.xml | 2 +- components/extensions/siddhi-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.mobile.android/pom.xml | 2 +- components/mobile-plugins/android-plugin/pom.xml | 2 +- components/mobile-plugins/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.mobile.windows/pom.xml | 2 +- components/mobile-plugins/windows-plugin/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.iot.geo.dashboard.feature/pom.xml | 2 +- features/analytics-feature/pom.xml | 2 +- .../pom.xml | 4 ++-- .../androidsense-plugin-feature/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.iot.arduino.feature/pom.xml | 2 +- .../device-types-feature/arduino-plugin-feature/pom.xml | 2 +- features/device-types-feature/pom.xml | 4 ++-- .../pom.xml | 2 +- .../device-types-feature/raspberrypi-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../virtual-fire-alarm-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 6 +++--- .../org.wso2.carbon.device.mgt.adapter.feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- features/extensions-feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../mobile-plugins-feature/android-plugin-feature/pom.xml | 4 ++-- features/mobile-plugins-feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../mobile-plugins-feature/windows-plugin-feature/pom.xml | 4 ++-- pom.xml | 6 +++--- 75 files changed, 93 insertions(+), 93 deletions(-) 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 b5fe8c337..de0b0b0c2 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.5 + 3.0.6-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 25b9b14cc..a20dfa538 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.5 + 3.0.6-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 9b8ec5eb3..529950353 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/pom.xml b/components/analytics/iot-analytics/pom.xml index a4fb6050b..5f5d269d2 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/analytics/pom.xml b/components/analytics/pom.xml index ac8e67ce3..ce6574f96 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.5 + 3.0.6-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 c2582e998..ff84765e6 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.5 + 3.0.6-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 fca93bbc1..8cdb81317 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.5 + 3.0.6-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 aa5c9ca19..7f8bb2dc1 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/pom.xml b/components/device-types/androidsense-plugin/pom.xml index 24eca9ec0..cba450b58 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.5 + 3.0.6-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 5517173c6..5584f230a 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.5 + 3.0.6-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 b25070c5a..1dbb17457 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.5 + 3.0.6-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 6ff2d28ed..55167c521 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/pom.xml b/components/device-types/arduino-plugin/pom.xml index bb2d05045..460dd3127 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-types/pom.xml b/components/device-types/pom.xml index 627287563..5cc40ae83 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.5 + 3.0.6-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 e6cd1d122..6dd2008d4 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.5 + 3.0.6-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 f8e3bedb2..f13a7ab09 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.5 + 3.0.6-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 b870c904f..c03a3c9f2 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/pom.xml b/components/device-types/raspberrypi-plugin/pom.xml index 07d69081f..584a4a288 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.5 + 3.0.6-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 301ebfa74..0b1805d43 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.5 + 3.0.6-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 53ca0ea28..bc54bbb8f 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.5 + 3.0.6-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 47a7e940b..a864e988a 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.5 + 3.0.6-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 index 5c70b691f..40fe1a347 100644 --- 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 @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml index 2237f5b72..ea477f5eb 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.scep.api/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 3.0.5 + 3.0.6-SNAPSHOT ../pom.xml 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 21f6bc63d..25f13368a 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.5 + 3.0.6-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 2ab6c6ae3..aa4dcaf46 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.5 + 3.0.6-SNAPSHOT ../pom.xml 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 682bce16c..a4d5e3879 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/extensions/appm-connector/pom.xml b/components/extensions/appm-connector/pom.xml index a44568679..d1132e33b 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.5 + 3.0.6-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 c769fee4e..82ac22538 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.5 + 3.0.6-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 41033b749..0f03141f2 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.5 + 3.0.6-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 2e8c64559..e74b82fb7 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.5 + 3.0.6-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 55c0bcaaf..b721416e8 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.5 + 3.0.6-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 3e1579376..f744b9fde 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.5 + 3.0.6-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 37278a6f2..390264d2e 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.5 + 3.0.6-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 518747ed5..862dcd3a9 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.5 + 3.0.6-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 d7645f6c2..2ea306b49 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.5 + 3.0.6-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/pom.xml b/components/extensions/cdmf-transport-adapters/pom.xml index 9576cfbd3..268645224 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.5 + 3.0.6-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 ff8028e70..8d77e5a57 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index ad107195d..d7ff1c8e9 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml index 90aa8909f..5f1ca115a 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.5 + 3.0.6-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 fb1a879fd..d1f5e612b 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml index d4ca3c626..08457f5e6 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.5 + 3.0.6-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 6919fc59b..c19788ccb 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.5 + 3.0.6-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 26755e735..b87cc8e2e 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.5 + 3.0.6-SNAPSHOT ../pom.xml 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 34452e8e4..22b0ecc00 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.5 + 3.0.6-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.ui - 3.0.5 + 3.0.6-SNAPSHOT WSO2 Carbon - Mobile Android UI pom 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 c45f3202d..b0c423876 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index 544ca0540..4134f7b74 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index 1b792cb8f..3810638b7 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.5 + 3.0.6-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 45c6c5f92..bb6ef365a 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.5 + 3.0.6-SNAPSHOT ../pom.xml 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 1e773d50a..9e00f3351 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.5 + 3.0.6-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.windows.ui - 3.0.5 + 3.0.6-SNAPSHOT WSO2 Carbon - Mobile Windows UI pom 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 a3999aa7f..a24a58fbf 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/windows-plugin/pom.xml b/components/mobile-plugins/windows-plugin/pom.xml index 20c347c48..5034b0f4c 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.5 + 3.0.6-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 aec6fc7b8..9ead91c6d 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.5 + 3.0.6-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.analytics.feature - 3.0.5 + 3.0.6-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 a0847239e..f40e936f4 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.5 + 3.0.6-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.iot.device.statistics.dashboard.feature - 3.0.5 + 3.0.6-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 122c6a853..23edf67e1 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/features/analytics-feature/pom.xml b/features/analytics-feature/pom.xml index 8d7feb99b..b91c2ee4b 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.5 + 3.0.6-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 a04220329..85987af31 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.5 + 3.0.6-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.feature - 3.0.5 + 3.0.6-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 819d9f781..6ab20fba1 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.5 + 3.0.6-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 ea86473e2..6814f5477 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.5 + 3.0.6-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 50d1d383b..bab8505dd 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/pom.xml b/features/device-types-feature/pom.xml index 1089ad95e..da7fb7b4a 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.5 + 3.0.6-SNAPSHOT ../../pom.xml 4.0.0 device-types-feature - 3.0.5 + 3.0.6-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 17eb81c7e..18aa1d354 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.5 + 3.0.6-SNAPSHOT ../pom.xml diff --git a/features/device-types-feature/raspberrypi-plugin-feature/pom.xml b/features/device-types-feature/raspberrypi-plugin-feature/pom.xml index 669169552..a7b08e9a7 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.5 + 3.0.6-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 24c91d436..50bd4c974 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.5 + 3.0.6-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 248f40363..8572726ff 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.5 + 3.0.6-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 199026336..9a62fd795 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.5 + 3.0.6-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 7115d1fe6..9e032f536 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.5 + 3.0.6-SNAPSHOT ../pom.xml org.wso2.carbon.appmgt.mdm.osgiconnector.feature pom - 3.0.5 + 3.0.6-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.5 + 3.0.6-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 71ae71e3d..adac5f2ce 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.5 + 3.0.6-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.adapter.feature pom - 3.0.5 + 3.0.6-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 ffa4d006a..775815ffd 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.5 + 3.0.6-SNAPSHOT ../pom.xml org.wso2.extension.siddhi.execution.json.feature pom - 3.0.5 + 3.0.6-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 b3c3d25c6..b6174d6fb 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.5 + 3.0.6-SNAPSHOT ../../pom.xml 4.0.0 extensions-feature - 3.0.5 + 3.0.6-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 ce3dc94e1..ffb729fb3 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.5 + 3.0.6-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.feature pom - 3.0.5 + 3.0.6-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 dd446fc6e..52ceb5645 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.5 + 3.0.6-SNAPSHOT ../pom.xml 4.0.0 android-plugin-feature - 3.0.5 + 3.0.6-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 a5b403446..53f2ff839 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.5 + 3.0.6-SNAPSHOT ../../pom.xml 4.0.0 mobile-plugins-feature - 3.0.5 + 3.0.6-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 beae84067..43c3059c0 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.5 + 3.0.6-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.windows.feature pom - 3.0.5 + 3.0.6-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 55371b041..414d7e132 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.5 + 3.0.6-SNAPSHOT ../pom.xml 4.0.0 windows-plugin-feature - 3.0.5 + 3.0.6-SNAPSHOT pom WSO2 Carbon - Device Management Windows Plugin Feature http://wso2.org diff --git a/pom.xml b/pom.xml index cbd3ef4cb..2fcd759ba 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent pom - 3.0.5 + 3.0.6-SNAPSHOT WSO2 Carbon - Device Management Plugins Parent http://wso2.org WSO2 Carbon - Device Management Plugins Parent @@ -1257,7 +1257,7 @@ 1.2.9 - 3.0.5 + 3.0.6-SNAPSHOT 4.4.8 @@ -1383,7 +1383,7 @@ scm:git:https://github.com/wso2/carbon-device-mgt-plugins.git scm:git:https://github.com/wso2/carbon-device-mgt-plugins.git - v3.0.5 + HEAD From ccaf47112a71d3dc9c797581ef3cef3d1b2dbdd0 Mon Sep 17 00:00:00 2001 From: ayyoob Date: Sun, 8 Jan 2017 01:20:04 +0530 Subject: [PATCH 5/7] removed DCR, added global configuration values for input and output adapter --- .../android_sense_receiver.xml | 4 +- .../arduino_receiver/arduino_receiver.xml | 7 -- .../raspberrypi_receiver.xml | 4 +- .../virtualfirealarm_receiver.xml | 4 +- .../input/adapter/http/HTTPEventAdapter.java | 2 +- .../adapter/http/HTTPEventAdapterFactory.java | 39 ------- .../adapter/http/HTTPMessageServlet.java | 5 +- .../http/oauth/OAuthAuthenticator.java | 5 +- .../oauth/OAuthTokenValidaterStubFactory.java | 30 +++-- .../http/util/HTTPEventAdapterConstants.java | 4 +- .../adapter/http/i18n/Resources.properties | 10 -- .../pom.xml | 5 - .../input/adapter/mqtt/MQTTEventAdapter.java | 28 +---- .../adapter/mqtt/MQTTEventAdapterFactory.java | 18 +-- .../InputAdapterServiceComponent.java | 12 -- .../InputAdapterServiceDataHolder.java | 11 -- .../mqtt/util/MQTTAdapterListener.java | 73 ++++++++---- .../MQTTBrokerConnectionConfiguration.java | 63 ++++++++--- .../mqtt/util/MQTTEventAdapterConstants.java | 16 ++- .../mgt/input/adapter/mqtt/util/MQTTUtil.java | 14 --- .../adapter/mqtt/i18n/Resources.properties | 4 +- .../pom.xml | 9 +- .../output/adapter/mqtt/MQTTEventAdapter.java | 14 +-- .../adapter/mqtt/MQTTEventAdapterFactory.java | 14 +-- .../mqtt/util/MQTTAdapterPublisher.java | 97 +++++++++++----- .../MQTTBrokerConnectionConfiguration.java | 59 ++++++++-- .../mqtt/util/MQTTEventAdapterConstants.java | 21 +++- .../output/adapter/mqtt/util/MQTTUtil.java | 12 -- .../adapter/mqtt/util/PropertyUtils.java | 40 +++++++ .../adapter/mqtt/i18n/Resources.properties | 6 +- .../websocket/UIEventAdapterFactory.java | 56 +++++++++ .../authentication/Authenticator.java | 7 +- .../authentication/OAuthAuthenticator.java | 7 +- .../oauth/OAuthTokenValdiator.java | 41 +------ .../oauth/OAuthTokenValidaterStubFactory.java | 97 ++++++++-------- .../websocket/authorization/Authorizer.java | 7 ++ .../authorization/DeviceAuthorizer.java | 56 ++++----- .../client/OAuthRequestInterceptor.java | 78 ++++--------- .../websocket/config/Authenticator.java | 107 ------------------ .../adapter/websocket/config/Authorizer.java | 107 ------------------ .../adapter/websocket/config/Properties.java | 86 -------------- .../adapter/websocket/config/Property.java | 104 ----------------- .../websocket/config/WebsocketConfig.java | 81 ------------- .../config/WebsocketValidationConfigs.java | 105 ----------------- ...alidationConfigurationFailedException.java | 44 ------- .../constants/WebsocketConstants.java | 3 +- .../UILocalEventAdapterServiceComponent.java | 37 +----- .../adapter/websocket/util/PropertyUtils.java | 45 ++++++++ .../util/UIEventAdapterConstants.java | 2 + .../websocket/util/WebsocketUtils.java | 45 -------- .../resources/devicetypes/android_sense.xml | 5 +- .../resources/devicetypes/raspberrypi.xml | 5 +- .../main/resources/conf/virtual_firealarm.xml | 5 +- .../devicetypes/virtual_firealarm.xml | 5 +- 54 files changed, 587 insertions(+), 1178 deletions(-) create mode 100644 components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/PropertyUtils.java delete mode 100644 components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Authenticator.java delete mode 100644 components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Authorizer.java delete mode 100644 components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Properties.java delete mode 100644 components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Property.java delete mode 100644 components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java delete mode 100644 components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigs.java delete mode 100644 components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigurationFailedException.java create mode 100644 components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/PropertyUtils.java delete mode 100644 components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_receiver/android_sense_receiver.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_receiver/android_sense_receiver.xml index 48bb1f919..e94bf47ca 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_receiver/android_sense_receiver.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_receiver/android_sense_receiver.xml @@ -21,10 +21,8 @@ carbon.super/android_sense/+/data admin + admin org.wso2.carbon.device.mgt.input.adapter.mqtt.util.MQTTContentValidator - default - https://${iot.core.host}:${iot.core.https.port}/dynamic-client-web/register - tcp://${mqtt.broker.host}:${mqtt.broker.port} true diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/src/main/resources/carbonapps/Arduino/arduino_receiver/arduino_receiver.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/src/main/resources/carbonapps/Arduino/arduino_receiver/arduino_receiver.xml index a12cae680..c8c306ef9 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/src/main/resources/carbonapps/Arduino/arduino_receiver/arduino_receiver.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/src/main/resources/carbonapps/Arduino/arduino_receiver/arduino_receiver.xml @@ -18,14 +18,7 @@ --> - 2 - admin org.wso2.carbon.device.mgt.input.adapter.http.util.HTTPContentValidator - default - all - 100 - https://localhost:${dcr.endpoint.port}/services/OAuth2TokenValidationService - admin diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_receiver/raspberrypi_receiver.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_receiver/raspberrypi_receiver.xml index 60d130514..9cd4a9eb4 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_receiver/raspberrypi_receiver.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_receiver/raspberrypi_receiver.xml @@ -20,10 +20,8 @@ carbon.super/raspberrypi/+/temperature admin + admin org.wso2.carbon.device.mgt.input.adapter.mqtt.util.MQTTContentValidator - default - https://${iot.core.host}:${iot.core.https.port}/dynamic-client-web/register - tcp://${mqtt.broker.host}:${mqtt.broker.port} true diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_receiver/virtualfirealarm_receiver.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_receiver/virtualfirealarm_receiver.xml index 465f22269..7f7b3cf7f 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_receiver/virtualfirealarm_receiver.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_receiver/virtualfirealarm_receiver.xml @@ -20,10 +20,8 @@ carbon.super/virtual_firealarm/+/temperature admin + admin org.wso2.carbon.device.mgt.input.adapter.mqtt.util.MQTTContentValidator - default - https://${iot.core.host}:${iot.core.https.port}/dynamic-client-web/register - tcp://${mqtt.broker.host}:${mqtt.broker.port} true diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapter.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapter.java index 009db280f..b85cef4d0 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapter.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapter.java @@ -186,7 +186,7 @@ public final class HTTPEventAdapter implements InputEventAdapter { "HttpService not available, Error in registering endpoint " + endpoint); } httpService.registerServlet(endpoint, new HTTPMessageServlet(eventAdaptorListener, tenantId, - eventAdapterConfiguration), + eventAdapterConfiguration, globalProperties), new Hashtable(), httpService.createDefaultHttpContext()); } catch (ServletException | NamespaceException e) { throw new InputEventAdapterRuntimeException("Error in registering endpoint " + endpoint, e); diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapterFactory.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapterFactory.java index 6ac043edd..763ae771c 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapterFactory.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapterFactory.java @@ -75,45 +75,6 @@ public class HTTPEventAdapterFactory extends InputEventAdapterFactory { exposedTransportsProperty.setDefaultValue(HTTPEventAdapterConstants.ALL); propertyList.add(exposedTransportsProperty); - // OAUTH validation endpoint admin service username - Property username = new Property(HTTPEventAdapterConstants.USERNAME); - username.setRequired(true); - username.setDisplayName(resourceBundle.getString(HTTPEventAdapterConstants.USERNAME)); - username.setHint(resourceBundle.getString(HTTPEventAdapterConstants.USERNAME_HINT)); - propertyList.add(username); - - // OAUTH validation endpoint admin service password - Property password = new Property(HTTPEventAdapterConstants.PASSWORD); - password.setRequired(true); - password.setDisplayName(resourceBundle.getString(HTTPEventAdapterConstants.PASSWORD)); - password.setHint(resourceBundle.getString(HTTPEventAdapterConstants.PASSWORD_HINT)); - propertyList.add(password); - - // OAUTH validation endpoint - Property tokenValidationEndpoint = new Property(HTTPEventAdapterConstants.TOKEN_VALIDATION_ENDPOINT_URL); - tokenValidationEndpoint.setRequired(true); - tokenValidationEndpoint.setDisplayName(resourceBundle.getString(HTTPEventAdapterConstants.TOKEN_VALIDATION_ENDPOINT_URL)); - tokenValidationEndpoint.setHint(resourceBundle.getString(HTTPEventAdapterConstants.TOKEN_VALIDATION_ENDPOINT_URL_HINT)); - propertyList.add(tokenValidationEndpoint); - - Property maximumHttpConnectionPerHost = new Property(HTTPEventAdapterConstants.MAXIMUM_HTTP_CONNECTION_PER_HOST); - maximumHttpConnectionPerHost.setRequired(true); - maximumHttpConnectionPerHost.setDisplayName(resourceBundle.getString( - HTTPEventAdapterConstants.MAXIMUM_HTTP_CONNECTION_PER_HOST)); - maximumHttpConnectionPerHost.setHint(resourceBundle.getString( - HTTPEventAdapterConstants.MAXIMUM_HTTP_CONNECTION_PER_HOST_HINT)); - maximumHttpConnectionPerHost.setDefaultValue(HTTPEventAdapterConstants.MAX_HTTP_CONNECTION); - propertyList.add(maximumHttpConnectionPerHost); - - Property maxTotalHttpConnection = new Property(HTTPEventAdapterConstants.MAXIMUM_TOTAL_HTTP_CONNECTION); - maxTotalHttpConnection.setRequired(true); - maxTotalHttpConnection.setDisplayName(resourceBundle.getString( - HTTPEventAdapterConstants.MAXIMUM_TOTAL_HTTP_CONNECTION)); - maxTotalHttpConnection.setHint(resourceBundle.getString( - HTTPEventAdapterConstants.MAXIMUM_TOTAL_HTTP_CONNECTION_HINT)); - maxTotalHttpConnection.setDefaultValue(HTTPEventAdapterConstants.MAX_TOTAL_HTTP_CONNECTION); - propertyList.add(maxTotalHttpConnection); - //Content Validator details Property contentValidator = new Property(HTTPEventAdapterConstants.ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME); contentValidator.setDisplayName( diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPMessageServlet.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPMessageServlet.java index 8538ef3a2..3d5351b30 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPMessageServlet.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPMessageServlet.java @@ -60,7 +60,8 @@ public class HTTPMessageServlet extends HttpServlet { private static OAuthAuthenticator oAuthAuthenticator; public HTTPMessageServlet(InputEventAdapterListener eventAdaptorListener, int tenantId, - InputEventAdapterConfiguration eventAdapterConfiguration) { + InputEventAdapterConfiguration eventAdapterConfiguration, + Map globalProperties) { this.eventAdaptorListener = eventAdaptorListener; this.tenantId = tenantId; this.exposedTransports = eventAdapterConfiguration.getProperties().get( @@ -107,7 +108,7 @@ public class HTTPMessageServlet extends HttpServlet { } jwtAuthenticator = new JWTAuthenticator(); - oAuthAuthenticator = new OAuthAuthenticator(eventAdapterConfiguration); + oAuthAuthenticator = new OAuthAuthenticator(globalProperties); } @Override diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/oauth/OAuthAuthenticator.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/oauth/OAuthAuthenticator.java index 408cb745a..7ccd3c98c 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/oauth/OAuthAuthenticator.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/oauth/OAuthAuthenticator.java @@ -36,6 +36,7 @@ import org.wso2.carbon.utils.multitenancy.MultitenantUtils; import javax.servlet.http.HttpServletRequest; import java.rmi.RemoteException; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -51,8 +52,8 @@ public class OAuthAuthenticator { private static final String AUTHORIZATION_HEADER = "Authorization"; private static Log log = LogFactory.getLog(OAuthAuthenticator.class); - public OAuthAuthenticator(InputEventAdapterConfiguration eventAdapterConfiguration) { - this.stubs = new GenericObjectPool(new OAuthTokenValidaterStubFactory(eventAdapterConfiguration)); + public OAuthAuthenticator(Map globalProperties) { + this.stubs = new GenericObjectPool(new OAuthTokenValidaterStubFactory(globalProperties)); } public AuthenticationInfo authenticate(HttpServletRequest req) { diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/oauth/OAuthTokenValidaterStubFactory.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/oauth/OAuthTokenValidaterStubFactory.java index ee2d7eb87..38a75f0c1 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/oauth/OAuthTokenValidaterStubFactory.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/oauth/OAuthTokenValidaterStubFactory.java @@ -34,7 +34,6 @@ import org.apache.commons.pool.BasePoolableObjectFactory; import org.apache.log4j.Logger; import org.wso2.carbon.core.util.Utils; import org.wso2.carbon.device.mgt.input.adapter.http.oauth.exception.OAuthTokenValidationException; -import org.wso2.carbon.event.input.adapter.core.InputEventAdapterConfiguration; import org.wso2.carbon.device.mgt.input.adapter.http.util.HTTPEventAdapterConstants; import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub; @@ -42,6 +41,7 @@ import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.security.GeneralSecurityException; +import java.util.Map; /** * This follows object pool pattern to manage the stub for oauth validation service. @@ -49,11 +49,11 @@ import java.security.GeneralSecurityException; public class OAuthTokenValidaterStubFactory extends BasePoolableObjectFactory { private static final Logger log = Logger.getLogger(OAuthTokenValidaterStubFactory.class); private HttpClient httpClient; - InputEventAdapterConfiguration eventAdapterConfiguration; + Map globalProperties; - public OAuthTokenValidaterStubFactory(InputEventAdapterConfiguration eventAdapterConfiguration) { - this.eventAdapterConfiguration = eventAdapterConfiguration; + public OAuthTokenValidaterStubFactory(Map globalProperties) { + this.globalProperties = globalProperties; this.httpClient = createHttpClient(); } @@ -92,9 +92,10 @@ public class OAuthTokenValidaterStubFactory extends BasePoolableObjectFactory { private OAuth2TokenValidationServiceStub generateStub() throws OAuthTokenValidationException { OAuth2TokenValidationServiceStub stub; try { - URL hostURL = new URL(Utils.replaceSystemProperty(eventAdapterConfiguration.getProperties().get( - HTTPEventAdapterConstants.TOKEN_VALIDATION_ENDPOINT_URL))); - if (hostURL != null) { + URL hostURL = new URL(Utils.replaceSystemProperty(globalProperties.get( + HTTPEventAdapterConstants.TOKEN_VALIDATION_ENDPOINT_URL) + + HTTPEventAdapterConstants.TOKEN_VALIDATION_POST_FIX)); + if (hostURL != null) { stub = new OAuth2TokenValidationServiceStub(hostURL.toString()); if (stub != null) { ServiceClient client = stub._getServiceClient(); @@ -104,10 +105,8 @@ public class OAuthTokenValidaterStubFactory extends BasePoolableObjectFactory { HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator(); auth.setPreemptiveAuthentication(true); - String username = eventAdapterConfiguration.getProperties().get(HTTPEventAdapterConstants - .USERNAME); - String password = eventAdapterConfiguration.getProperties().get(HTTPEventAdapterConstants - .PASSWORD); + String username = globalProperties.get(HTTPEventAdapterConstants.USERNAME); + String password = globalProperties.get(HTTPEventAdapterConstants.PASSWORD); auth.setPassword(username); auth.setUsername(password); Options options = client.getOptions(); @@ -151,8 +150,7 @@ public class OAuthTokenValidaterStubFactory extends BasePoolableObjectFactory { */ private EasySSLProtocolSocketFactory createProtocolSocketFactory() throws OAuthTokenValidationException { try { - EasySSLProtocolSocketFactory easySSLPSFactory = new EasySSLProtocolSocketFactory(); - return easySSLPSFactory; + return new EasySSLProtocolSocketFactory(); } catch (IOException e) { String errorMsg = "Failed to initiate EasySSLProtocolSocketFactory."; throw new OAuthTokenValidationException(errorMsg, e); @@ -170,9 +168,9 @@ public class OAuthTokenValidaterStubFactory extends BasePoolableObjectFactory { */ private HttpClient createHttpClient() { HttpConnectionManagerParams params = new HttpConnectionManagerParams(); - params.setDefaultMaxConnectionsPerHost(Integer.parseInt(eventAdapterConfiguration.getProperties().get( - HTTPEventAdapterConstants.MAXIMUM_HTTP_CONNECTION_PER_HOST))); - params.setMaxTotalConnections(Integer.parseInt(eventAdapterConfiguration.getProperties().get( + params.setDefaultMaxConnectionsPerHost(Integer.parseInt(globalProperties.get( + HTTPEventAdapterConstants.MAXIMUM_HTTP_CONNECTION_PER_HOST))); + params.setMaxTotalConnections(Integer.parseInt(globalProperties.get( HTTPEventAdapterConstants.MAXIMUM_TOTAL_HTTP_CONNECTION))); HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager(); connectionManager.setParams(params); diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/util/HTTPEventAdapterConstants.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/util/HTTPEventAdapterConstants.java index b2e4e02f2..c5d88a975 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/util/HTTPEventAdapterConstants.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/util/HTTPEventAdapterConstants.java @@ -51,8 +51,8 @@ public final class HTTPEventAdapterConstants { public static final String MAXIMUM_TOTAL_HTTP_CONNECTION_HINT = "maximumTotalHttpConnection.hint"; public static final String MAXIMUM_HTTP_CONNECTION_PER_HOST = "maximumHttpConnectionPerHost"; public static final String MAXIMUM_HTTP_CONNECTION_PER_HOST_HINT = "maximumHttpConnectionPerHost.hint"; - public static final String TOKEN_VALIDATION_ENDPOINT_URL = "tokenValidationEndpointUrl"; - public static final String TOKEN_VALIDATION_ENDPOINT_URL_HINT = "tokenValidationEndpointUrl.hint"; + public static final String TOKEN_VALIDATION_ENDPOINT_URL = "keymanagerUrl"; + public static final String TOKEN_VALIDATION_POST_FIX = "/services/OAuth2TokenValidationService"; public static final String USERNAME = "username"; public static final String USERNAME_HINT = "username.hint"; public static final String PASSWORD = "password"; diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/resources/org/wso2/carbon/device/mgt/input/adapter/http/i18n/Resources.properties b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/resources/org/wso2/carbon/device/mgt/input/adapter/http/i18n/Resources.properties index ccdfbfa7b..d21d20917 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/resources/org/wso2/carbon/device/mgt/input/adapter/http/i18n/Resources.properties +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/resources/org/wso2/carbon/device/mgt/input/adapter/http/i18n/Resources.properties @@ -22,16 +22,6 @@ http.usage.tips_mid1=/endpoints/<event_receiver_name>
  < http.usage.tips_mid2=/endpoints/<event_receiver_name>

For other tenants:
  http://localhost: http.usage.tips_mid3=/endpoints/t/<tenant_domain>/<event_receiver_name>
  https://localhost: http.usage.tips_postfix=/endpoints/t/<tenant_domain>/<event_receiver_name> -tokenValidationEndpointUrl=tokenEndpointUrl -tokenValidationEndpointUrl.hint=OAUTH Token Validation Endpoint -username=username -username.hint=username of the user to connect to the admin services -password=password -password.hint=password of the user to connect to the admin services. -maximumTotalHttpConnection=maximumTotalHttpConnection -maximumTotalHttpConnection.hint=Maximum Total connection to be made with the endpoint -maximumHttpConnectionPerHost=maximumHttpConnectionPerHost -maximumHttpConnectionPerHost.hint=Maximum Http connection per host. contentValidator=contentValidator contentValidator.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required) contentTransformer=contentTransformer 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 c217dd92a..ef7f75e8e 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 @@ -60,10 +60,6 @@ com.googlecode.json-simple.wso2 json-simple
- - org.wso2.carbon.devicemgt - org.wso2.carbon.identity.jwt.client.extension - com.jayway.jsonpath json-path @@ -128,7 +124,6 @@ org.apache.http.client.methods;version="${httpclient.version.range}", org.apache.http.impl.client;version="${httpclient.version.range}", org.json.simple.*, - org.wso2.carbon.identity.jwt.client.extension.*, com.jayway.jsonpath.* * diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapter.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapter.java index ce148c6a4..a2ddfd446 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapter.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapter.java @@ -53,29 +53,13 @@ public class MQTTEventAdapter implements InputEventAdapter { public void init(InputEventAdapterListener eventAdapterListener) throws InputEventAdapterException { this.eventAdapterListener = eventAdapterListener; try { - int keepAlive; - - //If global properties are available those will be assigned else constant values will be assigned - if (globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_KEEP_ALIVE) != null) { - keepAlive = Integer.parseInt((globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_KEEP_ALIVE))); - } else { - keepAlive = MQTTEventAdapterConstants.ADAPTER_CONF_DEFAULT_KEEP_ALIVE; - } - mqttBrokerConnectionConfiguration = new MQTTBrokerConnectionConfiguration( - eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_URL), - eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_USERNAME), - eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_SCOPES), - eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_DCR_URL), - eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_CLEAN_SESSION), - keepAlive, - eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME), - eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_CONTENT_TRANSFORMER_CLASSNAME) - ); - mqttAdapterListener = new MQTTAdapterListener(mqttBrokerConnectionConfiguration, - eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_MESSAGE_TOPIC), - eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_CLIENTID), - eventAdapterListener, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); + mqttBrokerConnectionConfiguration = new MQTTBrokerConnectionConfiguration(eventAdapterConfiguration + ,globalProperties); + mqttAdapterListener = new MQTTAdapterListener(mqttBrokerConnectionConfiguration + ,eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_MESSAGE_TOPIC) + ,eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_CLIENTID) + ,eventAdapterListener, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); } catch (Throwable t) { throw new InputEventAdapterException(t.getMessage(), t); } diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapterFactory.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapterFactory.java index 643bce4fb..5212b029d 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapterFactory.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/MQTTEventAdapterFactory.java @@ -59,16 +59,10 @@ public class MQTTEventAdapterFactory extends InputEventAdapterFactory { //Broker Url Property brokerUrl = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_URL); brokerUrl.setDisplayName(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_URL)); - brokerUrl.setRequired(true); + brokerUrl.setRequired(false); brokerUrl.setHint(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_URL_HINT)); propertyList.add(brokerUrl); - //DCR endpoint details - Property dcrUrl = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_DCR_URL); - dcrUrl.setDisplayName(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_DCR_URL)); - dcrUrl.setRequired(false); - dcrUrl.setHint(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_DCR_URL_HINT)); - propertyList.add(dcrUrl); //Content Validator details Property contentValidator = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME); @@ -84,10 +78,18 @@ public class MQTTEventAdapterFactory extends InputEventAdapterFactory { Property userName = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_USERNAME); userName.setDisplayName( resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_USERNAME)); - userName.setRequired(false); + userName.setRequired(true); userName.setHint(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_USERNAME_HINT)); propertyList.add(userName); + //Broker Password + Property password = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_PASSWORD); + userName.setDisplayName( + resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_PASSWORD)); + userName.setRequired(true); + userName.setHint(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_PASSWORD_HINT)); + propertyList.add(password); + //Broker Required Scopes. Property scopes = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_SCOPES); scopes.setDisplayName( diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/internal/InputAdapterServiceComponent.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/internal/InputAdapterServiceComponent.java index 4a39cf4f7..d02b8d356 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/internal/InputAdapterServiceComponent.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/internal/InputAdapterServiceComponent.java @@ -23,13 +23,9 @@ import org.osgi.service.component.ComponentContext; import org.osgi.service.http.HttpService; import org.wso2.carbon.device.mgt.input.adapter.mqtt.MQTTEventAdapterFactory; import org.wso2.carbon.event.input.adapter.core.InputEventAdapterFactory; -import org.wso2.carbon.user.core.service.RealmService; /** * @scr.component name="input.iot.mqtt.AdapterService.component" immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" cardinality="1..1" - * policy="dynamic" bind="setRealmService" unbind="unsetRealmService" */ public class InputAdapterServiceComponent { @@ -48,14 +44,6 @@ public class InputAdapterServiceComponent { } } - protected void setRealmService(RealmService realmService) { - InputAdapterServiceDataHolder.registerRealmService(realmService); - } - - protected void unsetRealmService(RealmService realmService) { - InputAdapterServiceDataHolder.registerRealmService(null); - } - protected void setHttpService(HttpService httpService) { InputAdapterServiceDataHolder.registerHTTPService(httpService); } diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/internal/InputAdapterServiceDataHolder.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/internal/InputAdapterServiceDataHolder.java index 77053f658..5335ddfb4 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/internal/InputAdapterServiceDataHolder.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/internal/InputAdapterServiceDataHolder.java @@ -15,28 +15,17 @@ package org.wso2.carbon.device.mgt.input.adapter.mqtt.internal; import org.osgi.service.http.HttpService; -import org.wso2.carbon.user.core.service.RealmService; /** * common place to hold some OSGI service references. */ public final class InputAdapterServiceDataHolder { - private static RealmService realmService; private static HttpService httpService; private InputAdapterServiceDataHolder() { } - public static void registerRealmService( - RealmService realmService) { - InputAdapterServiceDataHolder.realmService = realmService; - } - - public static RealmService getRealmService() { - return realmService; - } - public static void registerHTTPService( HttpService httpService) { InputAdapterServiceDataHolder.httpService = httpService; diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java index cf864d583..96546c3ad 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java @@ -17,13 +17,18 @@ */ package org.wso2.carbon.device.mgt.input.adapter.mqtt.util; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; +import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicNameValuePair; import org.eclipse.paho.client.mqttv3.*; import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence; import org.json.simple.JSONObject; @@ -39,9 +44,6 @@ import org.wso2.carbon.device.mgt.input.adapter.extension.DefaultContentValidato import org.wso2.carbon.event.input.adapter.core.InputEventAdapterListener; import org.wso2.carbon.event.input.adapter.core.exception.InputEventAdapterRuntimeException; import org.wso2.carbon.device.mgt.input.adapter.mqtt.exception.MQTTContentInitializationException; -import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; -import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; -import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; import java.io.IOException; import java.net.MalformedURLException; @@ -49,7 +51,9 @@ import java.net.URL; import java.security.KeyManagementException; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; public class MQTTAdapterListener implements MqttCallback, Runnable { @@ -144,16 +148,14 @@ public class MQTTAdapterListener implements MqttCallback, Runnable { } public void startListener() throws MqttException { - if (this.mqttBrokerConnectionConfiguration.getBrokerUsername() != null && + if (this.mqttBrokerConnectionConfiguration.getUsername() != null && this.mqttBrokerConnectionConfiguration.getDcrUrl() != null) { - String username = this.mqttBrokerConnectionConfiguration.getBrokerUsername(); + String username = this.mqttBrokerConnectionConfiguration.getUsername(); + String password = this.mqttBrokerConnectionConfiguration.getPassword(); String dcrUrlString = this.mqttBrokerConnectionConfiguration.getDcrUrl(); String scopes = this.mqttBrokerConnectionConfiguration.getBrokerScopes(); //getJWT Client Parameters. if (dcrUrlString != null && !dcrUrlString.isEmpty()) { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenantId, true); - PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(username); try { URL dcrUrl = new URL(dcrUrlString); HttpClient httpClient = MQTTUtil.getHttpClient(dcrUrl.getProtocol()); @@ -163,11 +165,15 @@ public class MQTTAdapterListener implements MqttCallback, Runnable { registrationProfile.setGrantType(MQTTEventAdapterConstants.GRANT_TYPE); registrationProfile.setOwner(username); registrationProfile.setTokenScope(MQTTEventAdapterConstants.TOKEN_SCOPE); - registrationProfile.setApplicationType(MQTTEventAdapterConstants.APPLICATION_TYPE); - registrationProfile.setClientName(username + "_" + tenantId); + registrationProfile.setClientName(MQTTEventAdapterConstants.APPLICATION_NAME_PREFIX + + mqttBrokerConnectionConfiguration.getAdapterName() + "_" + tenantId); String jsonString = registrationProfile.toJSON(); StringEntity requestEntity = new StringEntity(jsonString, ContentType.APPLICATION_JSON); postMethod.setEntity(requestEntity); + String basicAuth = getBase64Encode(username, password); + postMethod.setHeader(new BasicHeader(MQTTEventAdapterConstants.AUTHORIZATION_HEADER_NAME, + MQTTEventAdapterConstants.AUTHORIZATION_HEADER_VALUE_PREFIX + + basicAuth)); HttpResponse httpResponse = httpClient.execute(postMethod); if (httpResponse != null) { String response = MQTTUtil.getResponseString(httpResponse); @@ -177,16 +183,10 @@ public class MQTTAdapterListener implements MqttCallback, Runnable { JSONObject jsonPayload = (JSONObject) jsonParser.parse(response); String clientId = (String) jsonPayload.get(MQTTEventAdapterConstants.CLIENT_ID); String clientSecret = (String) jsonPayload.get(MQTTEventAdapterConstants.CLIENT_SECRET); - JWTClientManagerService jwtClientManagerService = MQTTUtil.getJWTClientManagerService(); - AccessTokenInfo accessTokenInfo = jwtClientManagerService.getJWTClient().getAccessToken( - clientId, clientSecret, username, scopes); - connectionOptions.setUserName(accessTokenInfo.getAccessToken()); + connectionOptions.setUserName(getToken(clientId, clientSecret)); } } catch (ParseException e) { - String msg = "error occurred while parsing client credential payload"; - log.error(msg, e); - } catch (JWTClientException e) { - String msg = "error occurred while parsing the response from JWT Client"; + String msg = "error occurred while parsing generating token for the adapter"; log.error(msg, e); } } @@ -194,8 +194,6 @@ public class MQTTAdapterListener implements MqttCallback, Runnable { log.error("Invalid dcrUrl : " + dcrUrlString); } catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | IOException e) { log.error("Failed to create an https connection.", e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); } } } @@ -287,4 +285,39 @@ public class MQTTAdapterListener implements MqttCallback, Runnable { public boolean isConnectionInitialized() { return connectionInitialized; } + + private String getToken(String clientId, String clientSecret) + throws IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, ParseException { + URL tokenEndpoint = new URL(mqttBrokerConnectionConfiguration.getTokenUrl()); + HttpClient httpClient = MQTTUtil.getHttpClient(tokenEndpoint.getProtocol()); + HttpPost postMethod = new HttpPost(tokenEndpoint.toString()); + + List nameValuePairs = new ArrayList<>(); + nameValuePairs.add(new BasicNameValuePair(MQTTEventAdapterConstants.GRANT_TYPE_PARAM_NAME, + MQTTEventAdapterConstants.PASSWORD_GRANT_TYPE)); + nameValuePairs.add(new BasicNameValuePair(MQTTEventAdapterConstants.PASSWORD_GRANT_TYPE_USERNAME, + mqttBrokerConnectionConfiguration.getUsername())); + nameValuePairs.add(new BasicNameValuePair(MQTTEventAdapterConstants.PASSWORD_GRANT_TYPE_PASSWORD, + mqttBrokerConnectionConfiguration.getPassword())); + String scopes = mqttBrokerConnectionConfiguration.getBrokerScopes(); + if (scopes != null && !scopes.isEmpty()) { + nameValuePairs.add(new BasicNameValuePair(MQTTEventAdapterConstants.PASSWORD_GRANT_TYPE_SCOPES, scopes)); + } + + postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs)); + postMethod.addHeader("Authorization", "Basic " + getBase64Encode(clientId, clientSecret)); + postMethod.addHeader("Content-Type", "application/x-www-form-urlencoded"); + HttpResponse httpResponse = httpClient.execute(postMethod); + String response = MQTTUtil.getResponseString(httpResponse); + if (log.isDebugEnabled()) { + log.debug(response); + } + JSONParser jsonParser = new JSONParser(); + JSONObject jsonObject = (JSONObject) jsonParser.parse(response); + return (String) jsonObject.get(MQTTEventAdapterConstants.ACCESS_TOKEN_GRANT_TYPE_PARAM_NAME); + } + + private String getBase64Encode(String key, String value) { + return new String(Base64.encodeBase64((key + ":" + value).getBytes())); + } } diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTBrokerConnectionConfiguration.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTBrokerConnectionConfiguration.java index 072493779..59ef8a3b4 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTBrokerConnectionConfiguration.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTBrokerConnectionConfiguration.java @@ -17,28 +17,38 @@ */ package org.wso2.carbon.device.mgt.input.adapter.mqtt.util; +import org.wso2.carbon.event.input.adapter.core.InputEventAdapterConfiguration; import org.wso2.carbon.event.input.adapter.core.exception.InputEventAdapterException; +import java.util.Map; + /** * This holds the configurations related to MQTT Broker. */ public class MQTTBrokerConnectionConfiguration { - private String brokerUsername = null; + private String username = null; + private String password = null; private String brokerScopes = null; private boolean cleanSession = true; private int keepAlive; private String brokerUrl; private String dcrUrl; + private String tokenUrl; private String contentValidatorClassName; private String contentTransformerClassName; + private String adapterName; public String getBrokerScopes() { return brokerScopes; } - public String getBrokerUsername() { - return brokerUsername; + public String getUsername() { + return username; + } + + public String getPassword() { + return password; } public boolean isCleanSession() { @@ -65,21 +75,44 @@ public class MQTTBrokerConnectionConfiguration { return contentTransformerClassName; } - public MQTTBrokerConnectionConfiguration(String brokerUrl, String brokerUsername, String brokerScopes, - String dcrUrl, String cleanSession, int keepAlive, - String contentValidatorClassName, String contentTransformerClassName) throws InputEventAdapterException { - this.brokerUsername = brokerUsername; - this.brokerScopes = brokerScopes; + public String getTokenUrl() { + return tokenUrl; + } + + public String getAdapterName() { + return adapterName; + } + + public MQTTBrokerConnectionConfiguration(InputEventAdapterConfiguration eventAdapterConfiguration, + Map globalProperties) throws InputEventAdapterException { + + adapterName = eventAdapterConfiguration.getName(); + this.username = eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_USERNAME); + this.password = eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_PASSWORD); + this.brokerScopes = eventAdapterConfiguration.getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_SCOPES); if (brokerScopes == null) { this.brokerScopes = MQTTEventAdapterConstants.EMPTY_STRING; } - this.brokerUrl = PropertyUtils.replaceMqttProperty(brokerUrl); - this.dcrUrl = PropertyUtils.replaceMqttProperty(dcrUrl); - this.contentValidatorClassName = contentValidatorClassName; - if (cleanSession != null) { - this.cleanSession = Boolean.parseBoolean(cleanSession); + String url = eventAdapterConfiguration .getProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_URL); + if (url == null || url.isEmpty()) { + url = globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_URL); + } + this.brokerUrl = PropertyUtils.replaceMqttProperty(url); + this.dcrUrl = PropertyUtils + .replaceMqttProperty(globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_DCR_URL)); + this.tokenUrl = PropertyUtils + .replaceMqttProperty(globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_TOKEN_URL)); + this.contentValidatorClassName = eventAdapterConfiguration.getProperties() + .get(MQTTEventAdapterConstants.ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME); + this.cleanSession = Boolean.parseBoolean(eventAdapterConfiguration.getProperties() + .get(MQTTEventAdapterConstants.ADAPTER_CONF_CLEAN_SESSION)); + //If global properties are available those will be assigned else constant values will be assigned + if (globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_KEEP_ALIVE) != null) { + keepAlive = Integer.parseInt((globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_KEEP_ALIVE))); + } else { + keepAlive = MQTTEventAdapterConstants.ADAPTER_CONF_DEFAULT_KEEP_ALIVE; } - this.keepAlive = keepAlive; - this.contentTransformerClassName = contentTransformerClassName; + this.contentTransformerClassName = eventAdapterConfiguration.getProperties() + .get(MQTTEventAdapterConstants.ADAPTER_CONF_CONTENT_TRANSFORMER_CLASSNAME); } } diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTEventAdapterConstants.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTEventAdapterConstants.java index d02d5624f..c7427a81a 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTEventAdapterConstants.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTEventAdapterConstants.java @@ -27,10 +27,13 @@ public class MQTTEventAdapterConstants { public static final String ADAPTER_CONF_URL = "url"; public static final String ADAPTER_CONF_USERNAME = "username"; public static final String ADAPTER_CONF_USERNAME_HINT = "username.hint"; + public static final String ADAPTER_CONF_PASSWORD = "password"; + public static final String ADAPTER_CONF_PASSWORD_HINT = "password.hint"; public static final String ADAPTER_CONF_SCOPES = "scopes"; public static final String ADAPTER_CONF_SCOPES_HINT = "scopes.hint"; public static final String ADAPTER_CONF_URL_HINT = "url.hint"; public static final String ADAPTER_CONF_DCR_URL = "dcrUrl"; + public static final String ADAPTER_CONF_TOKEN_URL = "tokenUrl"; public static final String ADAPTER_CONF_DCR_URL_HINT = "dcrUrl.hint"; public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME = "contentValidator"; public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidator.hint"; @@ -49,9 +52,10 @@ public class MQTTEventAdapterConstants { public static final int RECONNECTION_PROGRESS_FACTOR = 2; public static final String EMPTY_STRING = ""; - public static final String GRANT_TYPE = "urn:ietf:params:oauth:grant-type:jwt-bearer refresh_token"; + public static final String GRANT_TYPE_PARAM_NAME = "grant_type"; + public static final String GRANT_TYPE = "password refresh_token"; public static final String TOKEN_SCOPE = "production"; - public static final String APPLICATION_TYPE = "device"; + public static final String APPLICATION_NAME_PREFIX = "InputAdapter_"; public static final String CLIENT_ID = "client_id"; public static final String CLIENT_SECRET = "client_secret"; public static final String CLIENT_NAME = "client_name"; @@ -62,4 +66,12 @@ public class MQTTEventAdapterConstants { public static final String DEVICE_ID_JSON_PATH = "event.metaData.deviceId"; public static final String DEVICE_TYPE_JSON_PATH = "event.metaData.deviceId"; public static final int DEVICE_ID_TOPIC_HIERARCHY_INDEX = 2; + public static final String AUTHORIZATION_HEADER_NAME = "Authorization"; + public static final String AUTHORIZATION_HEADER_VALUE_PREFIX = "Basic "; + public static final String PASSWORD_GRANT_TYPE = "password"; + public static final String PASSWORD_GRANT_TYPE_USERNAME = "username"; + public static final String PASSWORD_GRANT_TYPE_PASSWORD = "password"; + public static final String PASSWORD_GRANT_TYPE_SCOPES = "scopes"; + public static final String ACCESS_TOKEN_GRANT_TYPE_PARAM_NAME = "access_token"; + } diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTUtil.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTUtil.java index ca01b75b6..2a5f71a10 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTUtil.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTUtil.java @@ -27,8 +27,6 @@ import org.apache.http.conn.ssl.SSLContextBuilder; import org.apache.http.conn.ssl.TrustSelfSignedStrategy; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; import java.io.BufferedReader; import java.io.IOException; @@ -84,16 +82,4 @@ public class MQTTUtil { } } } - - public static JWTClientManagerService getJWTClientManagerService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - JWTClientManagerService jwtClientManagerService = - (JWTClientManagerService) ctx.getOSGiService(JWTClientManagerService.class, null); - if (jwtClientManagerService == null) { - String msg = "JWT management service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return jwtClientManagerService; - } } diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/resources/org/wso2/carbon/device/mgt/input/adapter/mqtt/i18n/Resources.properties b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/resources/org/wso2/carbon/device/mgt/input/adapter/mqtt/i18n/Resources.properties index f75e4075c..a2d877419 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/resources/org/wso2/carbon/device/mgt/input/adapter/mqtt/i18n/Resources.properties +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/resources/org/wso2/carbon/device/mgt/input/adapter/mqtt/i18n/Resources.properties @@ -20,9 +20,11 @@ topic=Topic topic.hint=Topic subscribed clientId=Client Id clientId.hint=client identifier is used by the server to identify a client when it reconnects, It used for durable subscriptions or reliable delivery of messages is required. -url=Broker Url +url=Broker Url (Not required), If it is not provided then it will connect to the default broker. username=Username username.hint=Username of the broker (if required) +password=Password +password.hint=Password of the user for the broker (if required) scopes=Scopes scopes.hint=Scopes required to connect to broker (if required) dcrUrl=dcrUrl 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 f6af28854..d167b6cdf 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 @@ -61,10 +61,6 @@ com.googlecode.json-simple.wso2 json-simple - - org.wso2.carbon.devicemgt - org.wso2.carbon.identity.jwt.client.extension - @@ -122,7 +118,10 @@ org.osgi.framework, org.osgi.service.component, org.wso2.carbon.context, - org.wso2.carbon.identity.jwt.client.extension.* + org.apache.commons.codec.binary, + org.apache.http.client.entity, + org.apache.http.message, + org.apache.commons.ssl diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/MQTTEventAdapter.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/MQTTEventAdapter.java index ca7b33393..a87fddf58 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/MQTTEventAdapter.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/MQTTEventAdapter.java @@ -118,19 +118,7 @@ public class MQTTEventAdapter implements OutputEventAdapter { @Override public void connect() { MQTTBrokerConnectionConfiguration mqttBrokerConnectionConfiguration = - new MQTTBrokerConnectionConfiguration(eventAdapterConfiguration.getStaticProperties() - .get(MQTTEventAdapterConstants.ADAPTER_CONF_URL), - eventAdapterConfiguration.getStaticProperties() - .get(MQTTEventAdapterConstants.ADAPTER_CONF_USERNAME), - eventAdapterConfiguration.getStaticProperties() - .get(MQTTEventAdapterConstants.ADAPTER_CONF_DCR_URL), - eventAdapterConfiguration.getStaticProperties() - .get(MQTTEventAdapterConstants.ADAPTER_CONF_SCOPES), - connectionKeepAliveInterval, - eventAdapterConfiguration.getStaticProperties() - .get(MQTTEventAdapterConstants.ADAPTER_CONF_CLEAN_SESSION) - ); - + new MQTTBrokerConnectionConfiguration(eventAdapterConfiguration, globalProperties); String clientId = eventAdapterConfiguration.getStaticProperties().get( MQTTEventAdapterConstants.ADAPTER_CONF_CLIENTID); qos = eventAdapterConfiguration.getStaticProperties().get(MQTTEventAdapterConstants.ADAPTER_MESSAGE_QOS); diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/MQTTEventAdapterFactory.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/MQTTEventAdapterFactory.java index d2f7ff3be..9275ec20d 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/MQTTEventAdapterFactory.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/MQTTEventAdapterFactory.java @@ -50,7 +50,7 @@ public class MQTTEventAdapterFactory extends OutputEventAdapterFactory { //Broker Url Property brokerUrl = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_URL); brokerUrl.setDisplayName(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_URL)); - brokerUrl.setRequired(true); + brokerUrl.setRequired(false); brokerUrl.setHint(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_URL_HINT)); //Broker Username @@ -59,11 +59,11 @@ public class MQTTEventAdapterFactory extends OutputEventAdapterFactory { userName.setRequired(true); userName.setHint(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_USERNAME_HINT)); - //Broker dcr URL - Property dcrUrl = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_DCR_URL); - dcrUrl.setDisplayName(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_DCR_URL)); - dcrUrl.setRequired(true); - dcrUrl.setHint(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_DCR_URL_HINT)); + //Broker Password + Property password = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_PASSWORD); + password.setDisplayName(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_PASSWORD)); + password.setRequired(true); + password.setHint(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_PASSWORD_HINT)); //Broker Connection Scopes Property scopes = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_SCOPES); @@ -95,10 +95,10 @@ public class MQTTEventAdapterFactory extends OutputEventAdapterFactory { staticPropertyList.add(brokerUrl); staticPropertyList.add(userName); - staticPropertyList.add(dcrUrl); staticPropertyList.add(scopes); staticPropertyList.add(clearSession); staticPropertyList.add(qos); + staticPropertyList.add(password); return staticPropertyList; } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTAdapterPublisher.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTAdapterPublisher.java index eee4d6084..0e5dfed8e 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTAdapterPublisher.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTAdapterPublisher.java @@ -19,11 +19,16 @@ package org.wso2.carbon.device.mgt.output.adapter.mqtt.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.commons.ssl.Base64; import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; +import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicNameValuePair; import org.eclipse.paho.client.mqttv3.MqttClient; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.MqttException; @@ -36,9 +41,6 @@ import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.event.output.adapter.core.exception.ConnectionUnavailableException; import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException; import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterRuntimeException; -import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; -import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; -import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; import java.io.IOException; import java.net.MalformedURLException; @@ -46,6 +48,8 @@ import java.net.URL; import java.security.KeyManagementException; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.List; /** * MQTT publisher related configuration initialization and publishing capabilties are implemented here. @@ -77,10 +81,8 @@ public class MQTTAdapterPublisher { MqttConnectOptions connectionOptions = new MqttConnectOptions(); connectionOptions.setCleanSession(cleanSession); connectionOptions.setKeepAliveInterval(keepAlive); - if (mqttBrokerConnectionConfiguration.getBrokerUsername() != null) { - connectionOptions.setUserName(getToken(mqttBrokerConnectionConfiguration.getBrokerUsername(), - mqttBrokerConnectionConfiguration.getDcrUrl(), - mqttBrokerConnectionConfiguration.getScopes())); + if (mqttBrokerConnectionConfiguration.getUsername() != null) { + connectionOptions.setUserName(getToken()); connectionOptions.setPassword(MQTTEventAdapterConstants.DEFAULT_PASSWORD.toCharArray()); } // Construct an MQTT blocking mode client @@ -139,7 +141,11 @@ public class MQTTAdapterPublisher { } } - private String getToken(String username, String dcrUrlString, String scopes) { + private String getToken() { + String username = this.mqttBrokerConnectionConfiguration.getUsername(); + String password = this.mqttBrokerConnectionConfiguration.getPassword(); + String dcrUrlString = this.mqttBrokerConnectionConfiguration.getDcrUrl(); + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); if (dcrUrlString != null && !dcrUrlString.isEmpty()) { try { @@ -147,32 +153,34 @@ public class MQTTAdapterPublisher { HttpClient httpClient = MQTTUtil.getHttpClient(dcrUrl.getProtocol()); HttpPost postMethod = new HttpPost(dcrUrlString); RegistrationProfile registrationProfile = new RegistrationProfile(); - registrationProfile.setCallbackUrl(MQTTEventAdapterConstants.DEFAULT_CALLBACK); + registrationProfile.setCallbackUrl(MQTTEventAdapterConstants.EMPTY_STRING); registrationProfile.setGrantType(MQTTEventAdapterConstants.GRANT_TYPE); registrationProfile.setOwner(username); registrationProfile.setTokenScope(MQTTEventAdapterConstants.TOKEN_SCOPE); - registrationProfile.setApplicationType(MQTTEventAdapterConstants.APPLICATION_TYPE); - registrationProfile.setClientName(username + "_" + tenantId); + registrationProfile.setClientName(MQTTEventAdapterConstants.APPLICATION_NAME_PREFIX + + mqttBrokerConnectionConfiguration.getAdapterName() + "_" + tenantId); String jsonString = registrationProfile.toJSON(); StringEntity requestEntity = new StringEntity(jsonString, ContentType.APPLICATION_JSON); postMethod.setEntity(requestEntity); + String basicAuth = getBase64Encode(username, password); + postMethod.setHeader(new BasicHeader(MQTTEventAdapterConstants.AUTHORIZATION_HEADER_NAME, + MQTTEventAdapterConstants.AUTHORIZATION_HEADER_VALUE_PREFIX + + basicAuth)); HttpResponse httpResponse = httpClient.execute(postMethod); - String response = MQTTUtil.getResponseString(httpResponse); - try { - JSONParser jsonParser = new JSONParser(); - JSONObject jsonPayload = (JSONObject) jsonParser.parse(response); - String clientId = (String) jsonPayload.get(MQTTEventAdapterConstants.CLIENT_ID); - String clientSecret = (String) jsonPayload.get(MQTTEventAdapterConstants.CLIENT_SECRET); - JWTClientManagerService jwtClientManagerService = MQTTUtil.getJWTClientManagerService(); - AccessTokenInfo accessTokenInfo = jwtClientManagerService.getJWTClient().getAccessToken( - clientId, clientSecret, username, scopes); - return accessTokenInfo.getAccessToken(); - } catch (ParseException e) { - String msg = "error occurred while parsing client credential payload"; - throw new OutputEventAdapterRuntimeException(msg, e); - } catch (JWTClientException e) { - String msg = "error occurred while parsing the response from JWT Client"; - throw new OutputEventAdapterRuntimeException(msg, e); + if (httpResponse != null) { + String response = MQTTUtil.getResponseString(httpResponse); + try { + if (response != null) { + JSONParser jsonParser = new JSONParser(); + JSONObject jsonPayload = (JSONObject) jsonParser.parse(response); + String clientId = (String) jsonPayload.get(MQTTEventAdapterConstants.CLIENT_ID); + String clientSecret = (String) jsonPayload.get(MQTTEventAdapterConstants.CLIENT_SECRET); + getToken(clientId, clientSecret); + } + } catch (ParseException e) { + String msg = "error occurred while parsing generating token for the adapter"; + log.error(msg, e); + } } } catch (MalformedURLException e) { throw new OutputEventAdapterRuntimeException("Invalid dcrUrl : " + dcrUrlString); @@ -183,4 +191,39 @@ public class MQTTAdapterPublisher { throw new OutputEventAdapterRuntimeException("Invalid configuration for mqtt publisher"); } + private String getToken(String clientId, String clientSecret) + throws IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, ParseException { + URL tokenEndpoint = new URL(mqttBrokerConnectionConfiguration.getTokenUrl()); + HttpClient httpClient = MQTTUtil.getHttpClient(tokenEndpoint.getProtocol()); + HttpPost postMethod = new HttpPost(tokenEndpoint.toString()); + + List nameValuePairs = new ArrayList<>(); + nameValuePairs.add(new BasicNameValuePair(MQTTEventAdapterConstants.GRANT_TYPE_PARAM_NAME, + MQTTEventAdapterConstants.PASSWORD_GRANT_TYPE)); + nameValuePairs.add(new BasicNameValuePair(MQTTEventAdapterConstants.PASSWORD_GRANT_TYPE_USERNAME, + mqttBrokerConnectionConfiguration.getUsername())); + nameValuePairs.add(new BasicNameValuePair(MQTTEventAdapterConstants.PASSWORD_GRANT_TYPE_PASSWORD, + mqttBrokerConnectionConfiguration.getPassword())); + String scopes = mqttBrokerConnectionConfiguration.getScopes(); + if (scopes != null && !scopes.isEmpty()) { + nameValuePairs.add(new BasicNameValuePair(MQTTEventAdapterConstants.PASSWORD_GRANT_TYPE_SCOPES, scopes)); + } + + postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs)); + postMethod.addHeader("Authorization", "Basic " + getBase64Encode(clientId, clientSecret)); + postMethod.addHeader("Content-Type", "application/x-www-form-urlencoded"); + HttpResponse httpResponse = httpClient.execute(postMethod); + String response = MQTTUtil.getResponseString(httpResponse); + if (log.isDebugEnabled()) { + log.debug(response); + } + JSONParser jsonParser = new JSONParser(); + JSONObject jsonObject = (JSONObject) jsonParser.parse(response); + return (String) jsonObject.get(MQTTEventAdapterConstants.ACCESS_TOKEN_GRANT_TYPE_PARAM_NAME); + } + + private String getBase64Encode(String key, String value) { + return new String(Base64.encodeBase64((key + ":" + value).getBytes())); + } + } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTBrokerConnectionConfiguration.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTBrokerConnectionConfiguration.java index 83a8460b8..b88d9d18b 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTBrokerConnectionConfiguration.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTBrokerConnectionConfiguration.java @@ -17,14 +17,25 @@ */ package org.wso2.carbon.device.mgt.output.adapter.mqtt.util; +import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration; +import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException; + +import java.util.Map; + public class MQTTBrokerConnectionConfiguration { - private String brokerUsername; + private String adapterName; + private String username; + private String password; private String dcrUrl; private String scopes; private String brokerUrl; + private String tokenUrl; private boolean cleanSession = true; private int keepAlive; + public String getTokenUrl() { + return tokenUrl; + } public String getDcrUrl() { return dcrUrl; @@ -34,8 +45,12 @@ public class MQTTBrokerConnectionConfiguration { return scopes; } - public String getBrokerUsername() { - return brokerUsername; + public String getUsername() { + return username; + } + + public String getPassword() { + return password; } public boolean isCleanSession() { @@ -50,15 +65,35 @@ public class MQTTBrokerConnectionConfiguration { return keepAlive; } - public MQTTBrokerConnectionConfiguration(String brokerUrl, String brokerUsername, - String dcrUrl, String scopes, int keepAlive, String cleanSession) { - this.brokerUsername = brokerUsername; - this.dcrUrl = dcrUrl; - this.scopes = scopes; - this.brokerUrl = brokerUrl; - this.keepAlive = keepAlive; - if (cleanSession != null) { - this.cleanSession = Boolean.parseBoolean(cleanSession); + public String getAdapterName() { + return adapterName; + } + + public MQTTBrokerConnectionConfiguration(OutputEventAdapterConfiguration eventAdapterConfiguration, + Map globalProperties) { + adapterName = eventAdapterConfiguration.getName(); + this.username = eventAdapterConfiguration.getStaticProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_USERNAME); + this.password = eventAdapterConfiguration.getStaticProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_PASSWORD); + String url = eventAdapterConfiguration .getStaticProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_URL); + if (url == null || url.isEmpty()) { + url = globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_URL); + } + this.brokerUrl = PropertyUtils.replaceMqttProperty(url); + this.dcrUrl = PropertyUtils + .replaceMqttProperty(globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_DCR_URL)); + this.tokenUrl = PropertyUtils + .replaceMqttProperty(globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_TOKEN_URL)); + this.scopes = eventAdapterConfiguration.getStaticProperties().get(MQTTEventAdapterConstants.ADAPTER_CONF_SCOPES); + if (scopes == null) { + this.scopes = MQTTEventAdapterConstants.EMPTY_STRING; + } + this.cleanSession = Boolean.parseBoolean(eventAdapterConfiguration.getStaticProperties() + .get(MQTTEventAdapterConstants.ADAPTER_CONF_CLEAN_SESSION)); + //If global properties are available those will be assigned else constant values will be assigned + if (globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_KEEP_ALIVE) != null) { + keepAlive = Integer.parseInt((globalProperties.get(MQTTEventAdapterConstants.ADAPTER_CONF_KEEP_ALIVE))); + } else { + keepAlive = MQTTEventAdapterConstants.ADAPTER_CONF_DEFAULT_KEEP_ALIVE; } } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTEventAdapterConstants.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTEventAdapterConstants.java index 228a8c6b4..31520c6e5 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTEventAdapterConstants.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTEventAdapterConstants.java @@ -27,8 +27,10 @@ public final class MQTTEventAdapterConstants { public static final String ADAPTER_CONF_URL = "url"; public static final String ADAPTER_CONF_USERNAME = "username"; public static final String ADAPTER_CONF_USERNAME_HINT = "username.hint"; + public static final String ADAPTER_CONF_PASSWORD = "password"; + public static final String ADAPTER_CONF_PASSWORD_HINT = "password.hint"; public static final String ADAPTER_CONF_DCR_URL = "dcrUrl"; - public static final String ADAPTER_CONF_DCR_URL_HINT = "dcrUrl.hint"; + public static final String ADAPTER_CONF_TOKEN_URL = "keymanagerUrl"; public static final String ADAPTER_CONF_SCOPES = "scopes"; public static final String ADAPTER_CONF_SCOPES_HINT = "scopes.hint"; public static final String ADAPTER_CONF_URL_HINT = "url.hint"; @@ -41,6 +43,9 @@ public final class MQTTEventAdapterConstants { public static final String ADAPTER_TEMP_DIRECTORY_NAME = "java.io.tmpdir"; public static final String ADAPTER_CONF_CLIENTID = "clientId"; public static final String ADAPTER_CONF_CLIENTID_HINT = "clientId.hint"; + public static final String EMPTY_STRING = ""; + public static final String ADAPTER_CONF_KEEP_ALIVE = "keepAlive"; + public static final int ADAPTER_CONF_DEFAULT_KEEP_ALIVE = 60000; public static final int DEFAULT_MIN_THREAD_POOL_SIZE = 8; public static final int DEFAULT_MAX_THREAD_POOL_SIZE = 100; @@ -53,9 +58,19 @@ public final class MQTTEventAdapterConstants { public static final String DEFAULT_CALLBACK = ""; public static final String DEFAULT_PASSWORD = ""; - public static final String GRANT_TYPE = "urn:ietf:params:oauth:grant-type:jwt-bearer refresh_token"; + public static final String GRANT_TYPE = "grant_type"; public static final String TOKEN_SCOPE = "production"; - public static final String APPLICATION_TYPE = "device"; + public static final String APPLICATION_NAME_PREFIX = "OutputAdapter_"; public static final String CLIENT_ID = "client_id"; public static final String CLIENT_SECRET = "client_secret"; + + + public static final String AUTHORIZATION_HEADER_NAME = "Authorization"; + public static final String AUTHORIZATION_HEADER_VALUE_PREFIX = "Basic "; + public static final String PASSWORD_GRANT_TYPE = "password"; + public static final String PASSWORD_GRANT_TYPE_USERNAME = "username"; + public static final String PASSWORD_GRANT_TYPE_PASSWORD = "password"; + public static final String PASSWORD_GRANT_TYPE_SCOPES = "scopes"; + public static final String ACCESS_TOKEN_GRANT_TYPE_PARAM_NAME = "access_token"; + public static final String GRANT_TYPE_PARAM_NAME = "grant_type"; } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTUtil.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTUtil.java index 0cb463991..fcc855814 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTUtil.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTUtil.java @@ -28,7 +28,6 @@ import org.apache.http.conn.ssl.TrustSelfSignedStrategy; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; import java.io.BufferedReader; import java.io.IOException; @@ -85,15 +84,4 @@ public class MQTTUtil { } } - public static JWTClientManagerService getJWTClientManagerService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - JWTClientManagerService jwtClientManagerService = - (JWTClientManagerService) ctx.getOSGiService(JWTClientManagerService.class, null); - if (jwtClientManagerService == null) { - String msg = "JWT management service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return jwtClientManagerService; - } } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/PropertyUtils.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/PropertyUtils.java new file mode 100644 index 000000000..deda48085 --- /dev/null +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/PropertyUtils.java @@ -0,0 +1,40 @@ +/* +* 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.output.adapter.mqtt.util; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +class PropertyUtils { + + //This method is only used if the mb features are within DAS. + static String replaceMqttProperty(String urlWithPlaceholders) { + String regex = "\\$\\{(.*?)\\}"; + Pattern pattern = Pattern.compile(regex); + Matcher matchPattern = pattern.matcher(urlWithPlaceholders); + while (matchPattern.find()) { + String sysPropertyName = matchPattern.group(1); + String sysPropertyValue = System.getProperty(sysPropertyName); + if (sysPropertyValue != null && !sysPropertyName.isEmpty()) { + urlWithPlaceholders = urlWithPlaceholders.replaceAll("\\$\\{(" + sysPropertyName + ")\\}", sysPropertyValue); + } + } + return urlWithPlaceholders; + } +} diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/resources/org/wso2/carbon/device/mgt/output/adapter/mqtt/i18n/Resources.properties b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/resources/org/wso2/carbon/device/mgt/output/adapter/mqtt/i18n/Resources.properties index c73a259ef..8ffee0874 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/resources/org/wso2/carbon/device/mgt/output/adapter/mqtt/i18n/Resources.properties +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/resources/org/wso2/carbon/device/mgt/output/adapter/mqtt/i18n/Resources.properties @@ -18,13 +18,13 @@ topic=Topic url=Broker Url +url.hint=MQTT broker url username=Username username.hint=Username of the broker -dcrUrl=dcrUrl -dcrUrl.hint=Dynamic Client Registration Url +password=Password +password.hint=Password to connect to the server. scopes=scopes scopes.hint=Scopes that required to connect with the broker. -url.hint=MQTT broker url cleanSession=Clean Session cleanSession.hint=Persist topic subscriptions and ack positions across client sessions keepAlive=Keep Alive (In seconds) diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapterFactory.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapterFactory.java index 6233f6eaa..6150ec59d 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapterFactory.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapterFactory.java @@ -18,6 +18,13 @@ */ package org.wso2.carbon.device.mgt.output.adapter.websocket; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.framework.BundleContext; +import org.wso2.carbon.device.mgt.output.adapter.websocket.authentication.Authenticator; +import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.Authorizer; +import org.wso2.carbon.device.mgt.output.adapter.websocket.service.WebsocketValidationService; +import org.wso2.carbon.device.mgt.output.adapter.websocket.service.WebsocketValidationServiceImpl; import org.wso2.carbon.device.mgt.output.adapter.websocket.util.UIEventAdapterConstants; import org.wso2.carbon.event.output.adapter.core.MessageType; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapter; @@ -38,6 +45,9 @@ public class UIEventAdapterFactory extends OutputEventAdapterFactory { private ResourceBundle resourceBundle = ResourceBundle.getBundle("org.wso2.carbon.device.mgt.output.adapter.websocket.i18n" + ".Resources", Locale.getDefault()); + private BundleContext bundleContext; + private boolean isAuthInitialized = false; + private static final Log log = LogFactory.getLog(UIEventAdapter.class); public UIEventAdapterFactory() { } @@ -74,7 +84,53 @@ public class UIEventAdapterFactory extends OutputEventAdapterFactory { @Override public OutputEventAdapter createEventAdapter(OutputEventAdapterConfiguration eventAdapterConfiguration, Map globalProperties) { + if (!isAuthInitialized) { + initializeAuthenticatorAndAuthorizor(globalProperties); + } return new UIEventAdapter(eventAdapterConfiguration, globalProperties); } + public BundleContext getBundleContext() { + return bundleContext; + } + + public void setBundleContext(BundleContext bundleContext) { + this.bundleContext = bundleContext; + } + + private void initializeAuthenticatorAndAuthorizor (Map globalProperties) { + if (!isAuthInitialized) { + synchronized (UIEventAdapterFactory.class) { + if (!isAuthInitialized) { + try { + WebsocketValidationServiceImpl websocketValidationService = + new WebsocketValidationServiceImpl(); + String authenticatorClassName = globalProperties.get( + UIEventAdapterConstants.AUTHENTICATOR_CLASS); + String authorizerClassName = globalProperties.get(UIEventAdapterConstants.AUTHORIZER_CLASS); + if (authenticatorClassName != null && !authenticatorClassName.isEmpty()) { + Class authenticatorClass = Class.forName(authenticatorClassName) + .asSubclass(Authenticator.class); + Authenticator authenticator = authenticatorClass.newInstance(); + websocketValidationService.setAuthenticator(authenticator); + } + if (authorizerClassName != null && !authorizerClassName.isEmpty()) { + Class authorizerClass = Class.forName(authorizerClassName) + .asSubclass(Authorizer.class); + Authorizer authorizer = authorizerClass.newInstance(); + websocketValidationService.setAuthorizer(authorizer); + } + bundleContext.registerService( + WebsocketValidationService.class.getName(), websocketValidationService, null); + isAuthInitialized = true; + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { + log.error("Failed to initialize the class authentication and authorization given " + + "in the websocket validation configuration.", e); + } + } + } + } + + } + } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/Authenticator.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/Authenticator.java index d1d06cc5c..fc3a85f79 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/Authenticator.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/Authenticator.java @@ -22,9 +22,14 @@ import java.util.Map; */ public interface Authenticator { + /** + * This is used to initialize the authenticator + * @param globalProperties related to the output adapter + */ + void init(Map globalProperties); + /** * Check whether the client is authenticated to connect. - * @param session user object. * @return AuthenticationInfo which contains authentication client information. */ AuthenticationInfo isAuthenticated(Map> webSocketConnectionProperties); diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/OAuthAuthenticator.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/OAuthAuthenticator.java index 698f4f826..da5d75144 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/OAuthAuthenticator.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/OAuthAuthenticator.java @@ -20,8 +20,13 @@ import java.util.List; import java.util.Map; public class OAuthAuthenticator implements Authenticator { + OAuthTokenValdiator oAuthTokenValdiator; + @Override + public void init(Map globalProperties) { + oAuthTokenValdiator = new OAuthTokenValdiator(globalProperties); + } public AuthenticationInfo isAuthenticated(Map> webSocketConnectionProperties) { - return OAuthTokenValdiator.getInstance().validateToken(webSocketConnectionProperties); + return oAuthTokenValdiator.validateToken(webSocketConnectionProperties); } } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValdiator.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValdiator.java index b92f08ae0..55566963c 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValdiator.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValdiator.java @@ -20,24 +20,18 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.pool.impl.GenericObjectPool; import org.wso2.carbon.device.mgt.output.adapter.websocket.authentication.AuthenticationInfo; -import org.wso2.carbon.device.mgt.output.adapter.websocket.config.Property; -import org.wso2.carbon.device.mgt.output.adapter.websocket.config.WebsocketConfig; import org.wso2.carbon.device.mgt.output.adapter.websocket.constants.WebsocketConstants; import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub; import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO; import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO_OAuth2AccessToken; import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationResponseDTO; import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -import java.io.File; -import java.io.IOException; import java.rmi.RemoteException; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Properties; /** * This acts as a contract point for OAuth token validation. @@ -47,8 +41,6 @@ public class OAuthTokenValdiator { private static String cookie; private GenericObjectPool stubs; private static Log log = LogFactory.getLog(OAuthTokenValdiator.class); - private static final String WEBSOCKET_CONFIG_LOCATION = - CarbonUtils.getEtcCarbonConfigDirPath() + File.separator + "websocket-validation.properties"; private static final String COOKIE_KEY_VALUE_SEPERATOR = "="; private static final String COOKIE_KEYPAIR_SEPERATOR = ";"; private static final String COOKIE = "cookie"; @@ -56,25 +48,9 @@ public class OAuthTokenValdiator { private static final String TOKEN_IDENTIFIER = "websocket-token"; private static OAuthTokenValdiator oAuthTokenValdiator; - public static OAuthTokenValdiator getInstance() { - if (oAuthTokenValdiator == null) { - synchronized (OAuthTokenValdiator.class) { - if (oAuthTokenValdiator == null) { - oAuthTokenValdiator = new OAuthTokenValdiator(); - } - } - } - return oAuthTokenValdiator; - } - private OAuthTokenValdiator() { - try { - Properties properties = getWebSocketConfig(); - this.stubs = new GenericObjectPool(new OAuthTokenValidaterStubFactory(properties)); - } catch (IOException e) { - log.error("Failed to parse the web socket org.wso2.carbon.device.mgt.output.adapter.websocket.config file " + - WEBSOCKET_CONFIG_LOCATION, e); - } + public OAuthTokenValdiator(Map globalProperties) { + this.stubs = new GenericObjectPool(new OAuthTokenValidaterStubFactory(globalProperties)); } /** @@ -174,19 +150,6 @@ public class OAuthTokenValdiator { return authenticationInfo; } - /** - * Retrieve JWT configs from registry. - */ - private Properties getWebSocketConfig() throws IOException { - Properties properties = new Properties(); - List propertyList = WebsocketConfig.getInstance().getWebsocketValidationConfigs().getAuthenticator() - .getProperties().getProperty(); - for (Property property : propertyList) { - properties.put(property.getName(), property.getValue()); - } - return properties; - } - /** * Retrieving the token from the http header * @param webSocketConnectionProperties WebSocket connection information including http headers diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValidaterStubFactory.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValidaterStubFactory.java index 50ce3f584..776b3d223 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValidaterStubFactory.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValidaterStubFactory.java @@ -35,13 +35,15 @@ import org.apache.commons.logging.LogFactory; import org.apache.commons.pool.BasePoolableObjectFactory; import org.wso2.carbon.device.mgt.output.adapter.websocket.authentication.oauth.exception.OAuthTokenValidationException; import org.wso2.carbon.device.mgt.output.adapter.websocket.constants.WebsocketConstants; +import org.wso2.carbon.device.mgt.output.adapter.websocket.util.PropertyUtils; +import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException; import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.security.GeneralSecurityException; -import java.util.Properties; +import java.util.Map; /** * This follows object pool pattern to manage the stub for oauth validation service. @@ -49,11 +51,11 @@ import java.util.Properties; public class OAuthTokenValidaterStubFactory extends BasePoolableObjectFactory { private static final Log log = LogFactory.getLog(OAuthTokenValidaterStubFactory.class); private HttpClient httpClient; - Properties tokenValidationProperties; + Map tokenValidationProperties; - public OAuthTokenValidaterStubFactory(Properties tokenValidationProperties) { - this.tokenValidationProperties = tokenValidationProperties; + public OAuthTokenValidaterStubFactory(Map globalProperties) { + this.tokenValidationProperties = globalProperties; this.httpClient = createHttpClient(); } @@ -91,51 +93,46 @@ public class OAuthTokenValidaterStubFactory extends BasePoolableObjectFactory { */ private OAuth2TokenValidationServiceStub generateStub() throws OAuthTokenValidationException { OAuth2TokenValidationServiceStub stub; - try { - URL hostURL = new URL(tokenValidationProperties.getProperty((WebsocketConstants.TOKEN_VALIDATION_ENDPOINT_URL))); - if (hostURL != null) { - stub = new OAuth2TokenValidationServiceStub(hostURL.toString()); - if (stub != null) { - ServiceClient client = stub._getServiceClient(); - client.getServiceContext().getConfigurationContext().setProperty( - HTTPConstants.CACHED_HTTP_CLIENT, httpClient); + try { + URL hostURL = new URL(PropertyUtils.replaceMqttProperty(tokenValidationProperties.get( + (WebsocketConstants.TOKEN_VALIDATION_ENDPOINT_URL))) + + WebsocketConstants.TOKEN_VALIDATION_CONTEXT); + stub = new OAuth2TokenValidationServiceStub(hostURL.toString()); + ServiceClient client = stub._getServiceClient(); + client.getServiceContext().getConfigurationContext().setProperty( + HTTPConstants.CACHED_HTTP_CLIENT, httpClient); - HttpTransportProperties.Authenticator auth = - new HttpTransportProperties.Authenticator(); - auth.setPreemptiveAuthentication(true); - String username = tokenValidationProperties.getProperty(WebsocketConstants.USERNAME); - String password = tokenValidationProperties.getProperty(WebsocketConstants.PASSWORD); - auth.setPassword(username); - auth.setUsername(password); - Options options = client.getOptions(); - options.setProperty(HTTPConstants.AUTHENTICATE, auth); - options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE); - client.setOptions(options); - if (hostURL.getProtocol().equals("https")) { - // set up ssl factory since axis2 https transport is used. - EasySSLProtocolSocketFactory sslProtocolSocketFactory = createProtocolSocketFactory(); - Protocol authhttps = new Protocol(hostURL.getProtocol() - , (ProtocolSocketFactory) sslProtocolSocketFactory, hostURL.getPort()); - Protocol.registerProtocol(hostURL.getProtocol(), authhttps); - options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, authhttps); - } - } else { - String errorMsg = "OAuth Validation instanization failed."; - throw new OAuthTokenValidationException(errorMsg); - } - } else { - String errorMsg = "host url is invalid"; - throw new OAuthTokenValidationException(errorMsg); - } - } catch (AxisFault axisFault) { - throw new OAuthTokenValidationException( - "Error occurred while creating the OAuth2TokenValidationServiceStub.", axisFault); - } catch (MalformedURLException e) { - throw new OAuthTokenValidationException( - "Error occurred while parsing token endpoint URL", e); - } + HttpTransportProperties.Authenticator auth = + new HttpTransportProperties.Authenticator(); + auth.setPreemptiveAuthentication(true); + String username = tokenValidationProperties.get(WebsocketConstants.USERNAME); + String password = tokenValidationProperties.get(WebsocketConstants.PASSWORD); + auth.setPassword(username); + auth.setUsername(password); + Options options = client.getOptions(); + options.setProperty(HTTPConstants.AUTHENTICATE, auth); + options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE); + client.setOptions(options); + if (hostURL.getProtocol().equals("https")) { + // set up ssl factory since axis2 https transport is used. + EasySSLProtocolSocketFactory sslProtocolSocketFactory = createProtocolSocketFactory(); + Protocol authhttps = new Protocol(hostURL.getProtocol() + , (ProtocolSocketFactory) sslProtocolSocketFactory, hostURL.getPort()); + Protocol.registerProtocol(hostURL.getProtocol(), authhttps); + options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, authhttps); + } + + } catch (AxisFault axisFault) { + throw new OAuthTokenValidationException( + "Error occurred while creating the OAuth2TokenValidationServiceStub.", axisFault); + } catch (MalformedURLException e) { + throw new OAuthTokenValidationException( + "Error occurred while parsing token endpoint URL", e); + } catch (OutputEventAdapterException e) { + throw new OAuthTokenValidationException("Invalid token endpoint url", e); + } - return stub; + return stub; } /** @@ -165,9 +162,9 @@ public class OAuthTokenValidaterStubFactory extends BasePoolableObjectFactory { */ private HttpClient createHttpClient() { HttpConnectionManagerParams params = new HttpConnectionManagerParams(); - params.setDefaultMaxConnectionsPerHost(Integer.parseInt(tokenValidationProperties.getProperty( - WebsocketConstants.MAXIMUM_HTTP_CONNECTION_PER_HOST))); - params.setMaxTotalConnections(Integer.parseInt(tokenValidationProperties.getProperty( + params.setDefaultMaxConnectionsPerHost(Integer.parseInt(tokenValidationProperties.get( + WebsocketConstants.MAXIMUM_HTTP_CONNECTION_PER_HOST))); + params.setMaxTotalConnections(Integer.parseInt(tokenValidationProperties.get( WebsocketConstants.MAXIMUM_TOTAL_HTTP_CONNECTION))); HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager(); connectionManager.setParams(params); diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/Authorizer.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/Authorizer.java index 65809a358..e64f11dca 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/Authorizer.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/Authorizer.java @@ -21,12 +21,19 @@ package org.wso2.carbon.device.mgt.output.adapter.websocket.authorization; import org.wso2.carbon.device.mgt.output.adapter.websocket.authentication.AuthenticationInfo; import javax.websocket.Session; +import java.util.Map; /** * Check whether the client is authorized to connect. */ public interface Authorizer { + /** + * This is used to initialize the authenticator + * @param globalProperties related to the output adapter + */ + void init(Map globalProperties); + /** * Check whether the client is authorized to connect with the stream. * @param authenticationInfo authenticated client information. diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/DeviceAuthorizer.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/DeviceAuthorizer.java index f02470625..cd475d6af 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/DeviceAuthorizer.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/DeviceAuthorizer.java @@ -31,13 +31,13 @@ import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.client. .DeviceAccessAuthorizationAdminService; import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.client.dto.DeviceAuthorizationResult; import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.client.dto.DeviceIdentifier; -import org.wso2.carbon.device.mgt.output.adapter.websocket.config.Properties; -import org.wso2.carbon.device.mgt.output.adapter.websocket.config.Property; -import org.wso2.carbon.device.mgt.output.adapter.websocket.config.WebsocketConfig; +import org.wso2.carbon.device.mgt.output.adapter.websocket.util.PropertyUtils; import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebSocketSessionRequest; +import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException; import javax.websocket.Session; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; @@ -50,26 +50,34 @@ public class DeviceAuthorizer implements Authorizer { private static final String CDMF_SERVER_BASE_CONTEXT = "/api/device-mgt/v1.0"; private static final String DEVICE_MGT_SERVER_URL = "deviceMgtServerUrl"; private static final String STAT_PERMISSION = "statsPermission"; + private static final String DEVICE_ID = "deviceId"; + private static final String DEVICE_TYPE = "deviceType"; private static Log logger = LogFactory.getLog(DeviceAuthorizer.class); private static List statPermissions; public DeviceAuthorizer() { - Properties properties = - WebsocketConfig.getInstance().getWebsocketValidationConfigs().getAuthorizer().getProperties(); - statPermissions = getPermissions(properties); - deviceAccessAuthorizationAdminService = Feign.builder() - .requestInterceptor(new OAuthRequestInterceptor()) - .contract(new JAXRSContract()).encoder(new GsonEncoder()).decoder(new GsonDecoder()) - .target(DeviceAccessAuthorizationAdminService.class, getDeviceMgtServerUrl(properties) - + CDMF_SERVER_BASE_CONTEXT); + } + + @Override + public void init(Map globalProperties) { + statPermissions = getPermissions(globalProperties); + try { + deviceAccessAuthorizationAdminService = Feign.builder() + .requestInterceptor(new OAuthRequestInterceptor(globalProperties)) + .contract(new JAXRSContract()).encoder(new GsonEncoder()).decoder(new GsonDecoder()) + .target(DeviceAccessAuthorizationAdminService.class, getDeviceMgtServerUrl(globalProperties) + + CDMF_SERVER_BASE_CONTEXT); + } catch (OutputEventAdapterException e) { + logger.error("Invalid value for deviceMgtServerUrl in globalProperties."); + } } @Override public boolean isAuthorized(AuthenticationInfo authenticationInfo, Session session, String stream) { WebSocketSessionRequest webSocketSessionRequest = new WebSocketSessionRequest(session); Map queryParams = webSocketSessionRequest.getQueryParamValuePairs(); - String deviceId = queryParams.get("deviceId"); - String deviceType = queryParams.get("deviceType"); + String deviceId = queryParams.get(DEVICE_ID); + String deviceType = queryParams.get(DEVICE_TYPE); if (deviceId != null && !deviceId.isEmpty() && deviceType != null && !deviceType.isEmpty()) { @@ -102,27 +110,19 @@ public class DeviceAuthorizer implements Authorizer { return false; } - private String getDeviceMgtServerUrl(Properties properties) { - String deviceMgtServerUrl = null; - for (Property property : properties.getProperty()) { - if (property.getName().equals(DEVICE_MGT_SERVER_URL)) { - deviceMgtServerUrl = property.getValue(); - break; - } - } + private String getDeviceMgtServerUrl(Map properties) throws OutputEventAdapterException { + String deviceMgtServerUrl = PropertyUtils.replaceMqttProperty(properties.get(DEVICE_MGT_SERVER_URL)); if (deviceMgtServerUrl == null || deviceMgtServerUrl.isEmpty()) { logger.error("deviceMgtServerUrl can't be empty "); } return deviceMgtServerUrl; } - private List getPermissions(Properties properties) { - List permission = new ArrayList<>(); - for (Property property : properties.getProperty()) { - if (property.getName().equals(STAT_PERMISSION)) { - permission.add(property.getValue()); - } + private List getPermissions(Map properties) { + String stats = properties.get(STAT_PERMISSION); + if (stats != null && !stats.isEmpty()) { + return Arrays.asList(stats.replace("\n", "").split(" ")); } - return permission; + return null; } } \ No newline at end of file diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/client/OAuthRequestInterceptor.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/client/OAuthRequestInterceptor.java index 76466b09d..a96f3bcab 100755 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/client/OAuthRequestInterceptor.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/client/OAuthRequestInterceptor.java @@ -28,9 +28,8 @@ import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.client. import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.client.dto.ApiApplicationRegistrationService; import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.client.dto.ApiRegistrationProfile; import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.client.dto.TokenIssuerService; -import org.wso2.carbon.device.mgt.output.adapter.websocket.config.Properties; -import org.wso2.carbon.device.mgt.output.adapter.websocket.config.Property; -import org.wso2.carbon.device.mgt.output.adapter.websocket.config.WebsocketConfig; + +import java.util.Map; /** * This is a request interceptor to add oauth token header. @@ -51,25 +50,27 @@ public class OAuthRequestInterceptor implements RequestInterceptor { private static final String CONNECTION_USERNAME = "username"; private static final String CONNECTION_PASSWORD = "password"; - private static final String TOKEN_ENDPOINT = "tokenEndpoint"; + private static final String TOKEN_ENDPOINT = "keymanagerUrl"; private static final String TOKEN_REFRESH_TIME_OFFSET = "tokenRefreshTimeOffset"; private static final String DEVICE_MGT_SERVER_URL = "deviceMgtServerUrl"; + private static final String TOKEN_ENDPOINT_CONTEXT = "tokenEndpointContext"; private static String username; private static String password; private static String tokenEndpoint; private static String deviceMgtServerUrl; + private static Map globalProperties; + /** * Creates an interceptor that authenticates all requests. */ - public OAuthRequestInterceptor() { - Properties properties = - WebsocketConfig.getInstance().getWebsocketValidationConfigs().getAuthorizer().getProperties(); - deviceMgtServerUrl = getDeviceMgtServerUrl(properties); - refreshTimeOffset = getRefreshTimeOffset(properties); - username = getUsername(properties); - password = getPassword(properties); - tokenEndpoint = getTokenEndpoint(properties); + public OAuthRequestInterceptor(Map globalProperties) { + this.globalProperties = globalProperties; + deviceMgtServerUrl = getDeviceMgtServerUrl(globalProperties); + refreshTimeOffset = getRefreshTimeOffset(globalProperties); + username = getUsername(globalProperties); + password = getPassword(globalProperties); + tokenEndpoint = getTokenEndpoint(globalProperties); apiApplicationRegistrationService = Feign.builder().requestInterceptor( new BasicAuthRequestInterceptor(username, password)) .contract(new JAXRSContract()).encoder(new GsonEncoder()).decoder(new GsonDecoder()) @@ -106,71 +107,42 @@ public class OAuthRequestInterceptor implements RequestInterceptor { template.header("Authorization", headerValue); } - private String getUsername(Properties properties) { - String username = null; - for (Property property : properties.getProperty()) { - if (property.getName().equals(CONNECTION_USERNAME)) { - username = property.getValue(); - break; - } - } + private String getUsername(Map globalProperties) { + String username = globalProperties.get(CONNECTION_USERNAME); if (username == null || username.isEmpty()) { logger.error("username can't be empty "); } return username; } - private String getPassword(Properties properties) { - String password = null; - for (Property property : properties.getProperty()) { - if (property.getName().equals(CONNECTION_PASSWORD)) { - password = property.getValue(); - break; - } - } + private String getPassword(Map globalProperties) { + String password = globalProperties.get(CONNECTION_PASSWORD);; if (password == null || password.isEmpty()) { logger.error("password can't be empty "); } return password; } - private String getDeviceMgtServerUrl(Properties properties) { - String deviceMgtServerUrl = null; - for (Property property : properties.getProperty()) { - if (property.getName().equals(DEVICE_MGT_SERVER_URL)) { - deviceMgtServerUrl = property.getValue(); - break; - } - } + private String getDeviceMgtServerUrl(Map globalProperties) { + String deviceMgtServerUrl = globalProperties.get(DEVICE_MGT_SERVER_URL); if (deviceMgtServerUrl == null || deviceMgtServerUrl.isEmpty()) { logger.error("deviceMgtServerUrl can't be empty "); } return deviceMgtServerUrl; } - private String getTokenEndpoint(Properties properties) { - String tokenEndpoint = null; - for (Property property : properties.getProperty()) { - if (property.getName().equals(TOKEN_ENDPOINT)) { - tokenEndpoint = property.getValue(); - break; - } - } - if (tokenEndpoint == null || tokenEndpoint.isEmpty()) { + private String getTokenEndpoint(Map globalProperties) { + String tokenEndpoint = globalProperties.get(TOKEN_ENDPOINT) + globalProperties.get(TOKEN_ENDPOINT_CONTEXT); + if ( tokenEndpoint.isEmpty()) { logger.error("tokenEndpoint can't be empty "); } return tokenEndpoint; } - private long getRefreshTimeOffset(Properties properties) { - long refreshTimeOffset = 0; + private long getRefreshTimeOffset(Map globalProperties) { + long refreshTimeOffset = 100; try { - for (Property property : properties.getProperty()) { - if (property.getName().equals(TOKEN_REFRESH_TIME_OFFSET)) { - refreshTimeOffset = Long.parseLong(property.getValue()); - break; - } - } + refreshTimeOffset = Long.parseLong(globalProperties.get(TOKEN_REFRESH_TIME_OFFSET)); } catch (NumberFormatException e) { logger.error("refreshTimeOffset should be a number", e); } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Authenticator.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Authenticator.java deleted file mode 100644 index 25c0794ea..000000000 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Authenticator.java +++ /dev/null @@ -1,107 +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.output.adapter.websocket.config; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Authenticator complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Authenticator">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Properties" type="{}Properties"/>
- *       </sequence>
- *       <attribute name="class" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Authenticator", propOrder = { - "properties" -}) -public class Authenticator { - - @XmlElement(name = "Properties", required = false) - protected Properties properties; - @XmlAttribute(name = "class") - protected String clazz; - - /** - * Gets the value of the properties property. - * - * @return - * possible object is - * {@link Properties } - * - */ - public Properties getProperties() { - return properties; - } - - /** - * Sets the value of the properties property. - * - * @param value - * allowed object is - * {@link Properties } - * - */ - public void setProperties(Properties value) { - this.properties = value; - } - - /** - * Gets the value of the clazz property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getClazz() { - return clazz; - } - - /** - * Sets the value of the clazz property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setClazz(String value) { - this.clazz = value; - } - -} diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Authorizer.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Authorizer.java deleted file mode 100644 index 03cc6b9fd..000000000 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Authorizer.java +++ /dev/null @@ -1,107 +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.output.adapter.websocket.config; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for Authorizer complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Authorizer">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Properties" type="{}Properties"/>
- *       </sequence>
- *       <attribute name="class" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Authorizer", propOrder = { - "properties" -}) -public class Authorizer { - - @XmlElement(name = "Properties", required = false) - protected Properties properties; - @XmlAttribute(name = "class") - protected String clazz; - - /** - * Gets the value of the properties property. - * - * @return - * possible object is - * {@link Properties } - * - */ - public Properties getProperties() { - return properties; - } - - /** - * Sets the value of the properties property. - * - * @param value - * allowed object is - * {@link Properties } - * - */ - public void setProperties(Properties value) { - this.properties = value; - } - - /** - * Gets the value of the clazz property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getClazz() { - return clazz; - } - - /** - * Sets the value of the clazz property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setClazz(String value) { - this.clazz = value; - } - -} diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Properties.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Properties.java deleted file mode 100644 index 9620f46a4..000000000 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Properties.java +++ /dev/null @@ -1,86 +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.output.adapter.websocket.config; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; -import java.util.ArrayList; -import java.util.List; - - -/** - *

Java class for Properties complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Properties">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Property" type="{}Property" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Properties", propOrder = { - "property" -}) -public class Properties { - - @XmlElement(name = "Property") - protected List property; - - /** - * Gets the value of the property property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the property property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getProperty().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link Property } - * - * - */ - public List getProperty() { - if (property == null) { - property = new ArrayList(); - } - return this.property; - } - -} diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Property.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Property.java deleted file mode 100644 index 7b14dbbe6..000000000 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/Property.java +++ /dev/null @@ -1,104 +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.output.adapter.websocket.config; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; - - -/** - *

Java class for Property complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="Property">
- *   <simpleContent>
- *     <extension base="<http://www.w3.org/2001/XMLSchema>string">
- *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </extension>
- *   </simpleContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Property", propOrder = { - "value" -}) -public class Property { - - @XmlValue - protected String value; - @XmlAttribute(name = "name") - protected String name; - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - -} diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java deleted file mode 100644 index 3499cd5e6..000000000 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java +++ /dev/null @@ -1,81 +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.output.adapter.websocket.config; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebsocketUtils; -import org.wso2.carbon.utils.CarbonUtils; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import java.io.File; - -/** - * This class represents the configuration that are needed for scopes to permission map. - */ -public class WebsocketConfig { - - private static WebsocketConfig config = new WebsocketConfig(); - private WebsocketValidationConfigs websocketValidationConfigs; - private static final Log log = LogFactory.getLog(WebsocketConfig.class); - - private static final String WEBSOCKET_VALIDATION_CONFIG_PATH = - CarbonUtils.getEtcCarbonConfigDirPath() + File.separator + "websocket-validation.xml"; - - private WebsocketConfig() { - } - - public static WebsocketConfig getInstance() { - return config; - } - - public void init() throws WebsocketValidationConfigurationFailedException { - try { - File deviceMgtConfig = new File(WEBSOCKET_VALIDATION_CONFIG_PATH); - Document doc = WebsocketUtils.convertToDocument(deviceMgtConfig); - - /* Un-marshaling DeviceMGtScope configuration */ - JAXBContext ctx = JAXBContext.newInstance(WebsocketValidationConfigs.class); - Unmarshaller unmarshaller = ctx.createUnmarshaller(); - //unmarshaller.setSchema(getSchema()); - websocketValidationConfigs = (WebsocketValidationConfigs) unmarshaller.unmarshal(doc); - } catch (JAXBException e) { - throw new WebsocketValidationConfigurationFailedException("Error occurred while un-marshalling Websocket" + - " Config", e); - } - } - - public WebsocketValidationConfigs getWebsocketValidationConfigs() { - if (websocketValidationConfigs == null) { - try { - init(); - } catch (WebsocketValidationConfigurationFailedException e) { - log.error("failed to initialize the config", e); - } - } - return websocketValidationConfigs; - } - - public void setWebsocketValidationConfigs(WebsocketValidationConfigs websocketValidationConfigs) { - websocketValidationConfigs = websocketValidationConfigs; - } -} diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigs.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigs.java deleted file mode 100644 index 020cfd2ce..000000000 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigs.java +++ /dev/null @@ -1,105 +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.output.adapter.websocket.config; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - - -/** - *

Java class for WebsocketValidationConfigs complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="WebsocketValidationConfigs">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Authenticator" type="{}Authenticator"/>
- *         <element name="Authorizer" type="{}Authorizer"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ - -@XmlRootElement(name = "WebsocketValidationConfigs") -@XmlAccessorType(XmlAccessType.FIELD) -public class WebsocketValidationConfigs { - - @XmlElement(name = "Authenticator", required = true) - protected Authenticator authenticator; - @XmlElement(name = "Authorizer", required = true) - protected Authorizer authorizer; - - /** - * Gets the value of the authenticator property. - * - * @return - * possible object is - * {@link Authenticator } - * - */ - public Authenticator getAuthenticator() { - return authenticator; - } - - /** - * Sets the value of the authenticator property. - * - * @param value - * allowed object is - * {@link Authenticator } - * - */ - public void setAuthenticator(Authenticator value) { - this.authenticator = value; - } - - /** - * Gets the value of the authorizer property. - * - * @return - * possible object is - * {@link Authorizer } - * - */ - public Authorizer getAuthorizer() { - return authorizer; - } - - /** - * Sets the value of the authorizer property. - * - * @param value - * allowed object is - * {@link Authorizer } - * - */ - public void setAuthorizer(Authorizer value) { - this.authorizer = value; - } - -} diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigurationFailedException.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigurationFailedException.java deleted file mode 100644 index cc1eb08c5..000000000 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketValidationConfigurationFailedException.java +++ /dev/null @@ -1,44 +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.output.adapter.websocket.config; - -public class WebsocketValidationConfigurationFailedException extends Exception { - - private static final long serialVersionUID = -3151279329290703928L; - - public WebsocketValidationConfigurationFailedException(String msg, Exception nestedEx) { - super(msg, nestedEx); - } - - public WebsocketValidationConfigurationFailedException(String message, Throwable cause) { - super(message, cause); - } - - public WebsocketValidationConfigurationFailedException(String msg) { - super(msg); - } - - public WebsocketValidationConfigurationFailedException() { - super(); - } - - public WebsocketValidationConfigurationFailedException(Throwable cause) { - super(cause); - } -} diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/constants/WebsocketConstants.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/constants/WebsocketConstants.java index 5d459cd2e..1c1c2af96 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/constants/WebsocketConstants.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/constants/WebsocketConstants.java @@ -29,7 +29,8 @@ public class WebsocketConstants { public static final String SCOPE_IDENTIFIER = "scopes"; public static final String MAXIMUM_TOTAL_HTTP_CONNECTION = "maximumTotalHttpConnection"; public static final String MAXIMUM_HTTP_CONNECTION_PER_HOST = "maximumHttpConnectionPerHost"; - public static final String TOKEN_VALIDATION_ENDPOINT_URL = "tokenValidationEndpoint"; + public static final String TOKEN_VALIDATION_ENDPOINT_URL = "keymanagerUrl"; + public static final String TOKEN_VALIDATION_CONTEXT = "/services/OAuth2TokenValidationService"; public static final String USERNAME = "username"; public static final String PASSWORD = "password"; public static final String TOKEN_PARAM = "token"; diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UILocalEventAdapterServiceComponent.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UILocalEventAdapterServiceComponent.java index ce5aa792b..76a92a451 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UILocalEventAdapterServiceComponent.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UILocalEventAdapterServiceComponent.java @@ -23,12 +23,6 @@ import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; import org.wso2.carbon.device.mgt.output.adapter.websocket.UIEventAdapterFactory; import org.wso2.carbon.device.mgt.output.adapter.websocket.UIOutputCallbackControllerServiceImpl; -import org.wso2.carbon.device.mgt.output.adapter.websocket.authentication.Authenticator; -import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.Authorizer; -import org.wso2.carbon.device.mgt.output.adapter.websocket.config.WebsocketConfig; -import org.wso2.carbon.device.mgt.output.adapter.websocket.config.WebsocketValidationConfigurationFailedException; -import org.wso2.carbon.device.mgt.output.adapter.websocket.service.WebsocketValidationService; -import org.wso2.carbon.device.mgt.output.adapter.websocket.service.WebsocketValidationServiceImpl; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterFactory; import org.wso2.carbon.device.mgt.output.adapter.websocket.UIOutputCallbackControllerService; import org.wso2.carbon.event.stream.core.EventStreamService; @@ -51,45 +45,20 @@ public class UILocalEventAdapterServiceComponent { protected void activate(ComponentContext context) { try { - OutputEventAdapterFactory uiEventAdapterFactory = new UIEventAdapterFactory(); + UIEventAdapterFactory uiEventAdapterFactory = new UIEventAdapterFactory(); context.getBundleContext().registerService(OutputEventAdapterFactory.class.getName(), uiEventAdapterFactory, null); UIOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl = new UIOutputCallbackControllerServiceImpl(); context.getBundleContext().registerService(UIOutputCallbackControllerService.class.getName(), UIOutputCallbackRegisterServiceImpl, null); + uiEventAdapterFactory.setBundleContext(context.getBundleContext()); + UIEventAdaptorServiceDataHolder.registerUIOutputCallbackRegisterServiceInternal( UIOutputCallbackRegisterServiceImpl); if (log.isDebugEnabled()) { log.debug("Successfully deployed the output websocket adapter service"); } - try { - WebsocketConfig.getInstance().init(); - WebsocketValidationServiceImpl websocketValidationService = new WebsocketValidationServiceImpl(); - String authenticatorClassName = WebsocketConfig.getInstance().getWebsocketValidationConfigs() - .getAuthenticator().getClazz(); - String authorizerClassName = WebsocketConfig.getInstance().getWebsocketValidationConfigs() - .getAuthorizer().getClazz(); - if (authenticatorClassName != null && !authenticatorClassName.isEmpty()) { - Class authenticatorClass = Class.forName(authenticatorClassName) - .asSubclass(Authenticator.class); - Authenticator authenticator = authenticatorClass.newInstance(); - websocketValidationService.setAuthenticator(authenticator); - } - if (authorizerClassName != null && !authorizerClassName.isEmpty()) { - Class authorizerClass = Class.forName(authorizerClassName) - .asSubclass(Authorizer.class); - Authorizer authorizer = authorizerClass.newInstance(); - websocketValidationService.setAuthorizer(authorizer); - } - context.getBundleContext().registerService( - WebsocketValidationService.class.getName(), websocketValidationService, null); - } catch (WebsocketValidationConfigurationFailedException e) { - log.error("Failed to initialize configuration for websocket.", e); - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { - log.error("Failed to initialize the class authentication and authorization given " + - "in the websocket validation configuration.", e); - } } catch (RuntimeException e) { log.error("Can not create the output websocket adapter service ", e); } catch (Throwable e) { diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/PropertyUtils.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/PropertyUtils.java new file mode 100644 index 000000000..414df9c12 --- /dev/null +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/PropertyUtils.java @@ -0,0 +1,45 @@ +/* +* 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.output.adapter.websocket.util; + +import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class PropertyUtils { + + //This method is only used if the mb features are within DAS. + public static String replaceMqttProperty(String urlWithPlaceholders) throws OutputEventAdapterException { + String regex = "\\$\\{(.*?)\\}"; + Pattern pattern = Pattern.compile(regex); + Matcher matchPattern = pattern.matcher(urlWithPlaceholders); + while (matchPattern.find()) { + String sysPropertyName = matchPattern.group(1); + String sysPropertyValue = System.getProperty(sysPropertyName); + if (sysPropertyValue != null && !sysPropertyName.isEmpty()) { + urlWithPlaceholders = urlWithPlaceholders.replaceAll("\\$\\{(" + sysPropertyName + ")\\}", sysPropertyValue); + } else { + throw new OutputEventAdapterException("System property - " + sysPropertyName + + " is not defined, hence cannot resolve : " + urlWithPlaceholders); + } + } + return urlWithPlaceholders; + } +} diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/UIEventAdapterConstants.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/UIEventAdapterConstants.java index bef12b7c3..ba5a1fd8e 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/UIEventAdapterConstants.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/UIEventAdapterConstants.java @@ -46,5 +46,7 @@ public class UIEventAdapterConstants { public static final String ADAPTER_EVENT_QUEUE_SIZE_NAME = "eventQueueSize"; public static final int EVENTS_QUEUE_SIZE = 30; + public static final String AUTHENTICATOR_CLASS = "authenticator"; + public static final String AUTHORIZER_CLASS = "authorizer"; } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java deleted file mode 100644 index 162bc9955..000000000 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * you may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.output.adapter.websocket.util; - -import org.w3c.dom.Document; -import org.wso2.carbon.device.mgt.output.adapter.websocket.config.WebsocketValidationConfigurationFailedException; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.File; - -/** - * This class holds util methods used by OAuth extension bundle. - */ -public class WebsocketUtils { - - public static Document convertToDocument(File file) throws WebsocketValidationConfigurationFailedException { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); - return docBuilder.parse(file); - } catch (Exception e) { - throw new WebsocketValidationConfigurationFailedException("Error occurred while parsing file, while converting " + - "to a org.w3c.dom.Document", e); - } - } - -} diff --git a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/devicetypes/android_sense.xml b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/devicetypes/android_sense.xml index 4c028dd9d..d06d6ccce 100644 --- a/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/devicetypes/android_sense.xml +++ b/features/device-types-feature/androidsense-plugin-feature/org.wso2.carbon.device.mgt.iot.androidsense.feature/src/main/resources/devicetypes/android_sense.xml @@ -56,10 +56,9 @@ true - androidsense.mqtt.adapter - tcp://localhost:1886 + androidsense.mqtt.adapter admin - https://localhost:9443/dynamic-client-web/register + admin 0 true diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/devicetypes/raspberrypi.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/devicetypes/raspberrypi.xml index 8656af2e2..60bbfa162 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/devicetypes/raspberrypi.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/devicetypes/raspberrypi.xml @@ -38,10 +38,9 @@ true - raspberrypi.mqtt.adapter - tcp://localhost:1886 + raspberrypi.mqtt.adapter admin - https://localhost:9443/dynamic-client-web/register + admin 0 true diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/src/main/resources/conf/virtual_firealarm.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/src/main/resources/conf/virtual_firealarm.xml index 9cef7c138..b4a9a64a9 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/src/main/resources/conf/virtual_firealarm.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/src/main/resources/conf/virtual_firealarm.xml @@ -22,10 +22,9 @@ MQTT - virtualfirealarm.mqtt.adapter - tcp://localhost:1886 + virtualfirealarm.mqtt.adapter admin - https://localhost:9443/dynamic-client-web/register + admin 0 true diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/src/main/resources/devicetypes/virtual_firealarm.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/src/main/resources/devicetypes/virtual_firealarm.xml index 1a4209ada..e88e4f03d 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/src/main/resources/devicetypes/virtual_firealarm.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.feature/src/main/resources/devicetypes/virtual_firealarm.xml @@ -38,10 +38,9 @@ true - virtualfirealarm.mqtt.adapter - tcp://localhost:1886 + virtualfirealarm.mqtt.adapter admin - https://localhost:9443/dynamic-client-web/register + admin 0 true From 514f971a21f9813bde9d756de64cd06d7645ba65 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Sun, 8 Jan 2017 08:21:36 +0530 Subject: [PATCH 6/7] Updating cdmf version into [2.0.7-SNAPHOT] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2fcd759ba..248aff698 100644 --- a/pom.xml +++ b/pom.xml @@ -1250,7 +1250,7 @@ 1.1.1 - 2.0.6 + 2.0.7-SNAPSHOT [2.0.0, 3.0.0) From 1df7d20a81fde7d537d670472cbb8745758eeb87 Mon Sep 17 00:00:00 2001 From: ayyoob Date: Sun, 8 Jan 2017 21:26:14 +0530 Subject: [PATCH 7/7] moved common configuration to global properties for input and output adapters --- .../pom.xml | 1 + .../pom.xml | 1 + .../pom.xml | 2 +- .../pom.xml | 1 + .../adapter/http/HTTPEventAdapterFactory.java | 2 +- .../mqtt/util/MQTTEventAdapterConstants.java | 4 +- .../mqtt/util/MQTTAdapterPublisher.java | 2 +- .../mqtt/util/MQTTEventAdapterConstants.java | 8 +-- .../endpoint/SubscriptionEndpoint.java | 4 +- .../SuperTenantSubscriptionEndpoint.java | 2 +- .../endpoint/TenantSubscriptionEndpoint.java | 2 +- .../endpoint/util/ServiceHolder.java | 12 ++-- ...dapter.java => WebsocketEventAdapter.java} | 64 +++++++++---------- ...java => WebsocketEventAdapterFactory.java} | 24 +++---- ...ocketOutputCallbackControllerService.java} | 2 +- ...tOutputCallbackControllerServiceImpl.java} | 20 +++--- .../oauth/OAuthTokenValidaterStubFactory.java | 4 +- .../authorization/DeviceAuthorizer.java | 2 +- .../client/OAuthRequestInterceptor.java | 54 ++++++++++------ .../client/dto/TokenIssuerService.java | 7 +- .../constants/WebsocketConstants.java | 2 +- ...bsocketEventAdaptorServiceDataHolder.java} | 18 +++--- ...ketLocalEventAdapterServiceComponent.java} | 31 ++++----- .../adapter/websocket/util/PropertyUtils.java | 2 +- ...va => WebsocketEventAdapterConstants.java} | 4 +- pom.xml | 2 +- 26 files changed, 153 insertions(+), 124 deletions(-) rename components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/{UIEventAdapter.java => WebsocketEventAdapter.java} (87%) rename components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/{UIEventAdapterFactory.java => WebsocketEventAdapterFactory.java} (85%) rename components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/{UIOutputCallbackControllerService.java => WebsocketOutputCallbackControllerService.java} (96%) rename components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/{UIOutputCallbackControllerServiceImpl.java => WebsocketOutputCallbackControllerServiceImpl.java} (87%) rename components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/{UIEventAdaptorServiceDataHolder.java => WebsocketEventAdaptorServiceDataHolder.java} (72%) rename components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/{UILocalEventAdapterServiceComponent.java => WebsocketLocalEventAdapterServiceComponent.java} (64%) rename components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/{UIEventAdapterConstants.java => WebsocketEventAdapterConstants.java} (95%) 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 8cdb81317..b747d2f5d 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 @@ -156,6 +156,7 @@ org.wso2.carbon.devicemgt org.wso2.carbon.apimgt.annotations + provided 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 1dbb17457..cfabc64c7 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 @@ -144,6 +144,7 @@ org.wso2.carbon.devicemgt org.wso2.carbon.apimgt.annotations + provided 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 afcd89e0f..d4b7524f3 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.5-SNAPSHOT + 3.0.6-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 a37fc8ad4..ab9ed68ed 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 @@ -238,6 +238,7 @@ org.wso2.carbon.devicemgt org.wso2.carbon.apimgt.annotations + provided diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapterFactory.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapterFactory.java index 763ae771c..b46117f65 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapterFactory.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/src/main/java/org/wso2/carbon/device/mgt/input/adapter/http/HTTPEventAdapterFactory.java @@ -66,7 +66,7 @@ public class HTTPEventAdapterFactory extends InputEventAdapterFactory { // Transport Exposed Property exposedTransportsProperty = new Property(HTTPEventAdapterConstants.EXPOSED_TRANSPORTS); - exposedTransportsProperty.setRequired(true); + exposedTransportsProperty.setRequired(false); exposedTransportsProperty.setDisplayName( resourceBundle.getString(HTTPEventAdapterConstants.EXPOSED_TRANSPORTS)); exposedTransportsProperty.setOptions( diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTEventAdapterConstants.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTEventAdapterConstants.java index c7427a81a..f21abd29b 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTEventAdapterConstants.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTEventAdapterConstants.java @@ -56,8 +56,8 @@ public class MQTTEventAdapterConstants { public static final String GRANT_TYPE = "password refresh_token"; public static final String TOKEN_SCOPE = "production"; public static final String APPLICATION_NAME_PREFIX = "InputAdapter_"; - public static final String CLIENT_ID = "client_id"; - public static final String CLIENT_SECRET = "client_secret"; + public static final String CLIENT_ID = "clientId"; + public static final String CLIENT_SECRET = "clientSecret"; public static final String CLIENT_NAME = "client_name"; public static final String DEFAULT = "default"; public static final String MQTT_CONTENT_VALIDATION_DEFAULT_PARAMETERS = ""; diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTAdapterPublisher.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTAdapterPublisher.java index 0e5dfed8e..79188e840 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTAdapterPublisher.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTAdapterPublisher.java @@ -175,7 +175,7 @@ public class MQTTAdapterPublisher { JSONObject jsonPayload = (JSONObject) jsonParser.parse(response); String clientId = (String) jsonPayload.get(MQTTEventAdapterConstants.CLIENT_ID); String clientSecret = (String) jsonPayload.get(MQTTEventAdapterConstants.CLIENT_SECRET); - getToken(clientId, clientSecret); + return getToken(clientId, clientSecret); } } catch (ParseException e) { String msg = "error occurred while parsing generating token for the adapter"; diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTEventAdapterConstants.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTEventAdapterConstants.java index 31520c6e5..732af141c 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTEventAdapterConstants.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/util/MQTTEventAdapterConstants.java @@ -30,7 +30,7 @@ public final class MQTTEventAdapterConstants { public static final String ADAPTER_CONF_PASSWORD = "password"; public static final String ADAPTER_CONF_PASSWORD_HINT = "password.hint"; public static final String ADAPTER_CONF_DCR_URL = "dcrUrl"; - public static final String ADAPTER_CONF_TOKEN_URL = "keymanagerUrl"; + public static final String ADAPTER_CONF_TOKEN_URL = "tokenUrl"; public static final String ADAPTER_CONF_SCOPES = "scopes"; public static final String ADAPTER_CONF_SCOPES_HINT = "scopes.hint"; public static final String ADAPTER_CONF_URL_HINT = "url.hint"; @@ -58,11 +58,11 @@ public final class MQTTEventAdapterConstants { public static final String DEFAULT_CALLBACK = ""; public static final String DEFAULT_PASSWORD = ""; - public static final String GRANT_TYPE = "grant_type"; + public static final String GRANT_TYPE = "password"; public static final String TOKEN_SCOPE = "production"; public static final String APPLICATION_NAME_PREFIX = "OutputAdapter_"; - public static final String CLIENT_ID = "client_id"; - public static final String CLIENT_SECRET = "client_secret"; + public static final String CLIENT_ID = "clientId"; + public static final String CLIENT_SECRET = "clientSecret"; public static final String AUTHORIZATION_HEADER_NAME = "Authorization"; diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SubscriptionEndpoint.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SubscriptionEndpoint.java index fc92f9cb1..0afe5ebe2 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SubscriptionEndpoint.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SubscriptionEndpoint.java @@ -52,7 +52,7 @@ public class SubscriptionEndpoint { () + ", for request URI - " + session.getRequestURI()); } - ServiceHolder.getInstance().getUiOutputCallbackControllerService().unsubscribeWebsocket(streamName, version, + ServiceHolder.getInstance().getWebsocketOutputCallbackControllerService().unsubscribeWebsocket(streamName, version, session); } @@ -68,7 +68,7 @@ public class SubscriptionEndpoint { log.error( "Error occurred in session ID: " + session.getId() + ", for request URI - " + session.getRequestURI() + ", " + throwable.getMessage(), throwable); - ServiceHolder.getInstance().getUiOutputCallbackControllerService().unsubscribeWebsocket(streamName, version, + ServiceHolder.getInstance().getWebsocketOutputCallbackControllerService().unsubscribeWebsocket(streamName, version, session); } } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SuperTenantSubscriptionEndpoint.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SuperTenantSubscriptionEndpoint.java index 5eac9280e..672e9aedf 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SuperTenantSubscriptionEndpoint.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/SuperTenantSubscriptionEndpoint.java @@ -75,7 +75,7 @@ public class SuperTenantSubscriptionEndpoint extends SubscriptionEndpoint { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId( MultitenantConstants.SUPER_TENANT_ID); - ServiceHolder.getInstance().getUiOutputCallbackControllerService().subscribeWebsocket(streamName, + ServiceHolder.getInstance().getWebsocketOutputCallbackControllerService().subscribeWebsocket(streamName, version, session); } finally { diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/TenantSubscriptionEndpoint.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/TenantSubscriptionEndpoint.java index 9243498a1..6203f8888 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/TenantSubscriptionEndpoint.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/TenantSubscriptionEndpoint.java @@ -74,7 +74,7 @@ public class TenantSubscriptionEndpoint extends SubscriptionEndpoint { try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tdomain, true); - ServiceHolder.getInstance().getUiOutputCallbackControllerService().subscribeWebsocket(streamName + ServiceHolder.getInstance().getWebsocketOutputCallbackControllerService().subscribeWebsocket(streamName , version, session); } finally { PrivilegedCarbonContext.endTenantFlow(); diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/util/ServiceHolder.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/util/ServiceHolder.java index c6ddc4914..7bd8f06d0 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/util/ServiceHolder.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/endpoint/util/ServiceHolder.java @@ -21,18 +21,18 @@ package org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.output.adapter.websocket.UIOutputCallbackControllerService; +import org.wso2.carbon.device.mgt.output.adapter.websocket.WebsocketOutputCallbackControllerService; import org.wso2.carbon.device.mgt.output.adapter.websocket.service.WebsocketValidationService; public class ServiceHolder { private static ServiceHolder instance; - private UIOutputCallbackControllerService uiOutputCallbackControllerService; + private WebsocketOutputCallbackControllerService websocketOutputCallbackControllerService; private static final Log log = LogFactory.getLog(ServiceHolder.class); private ServiceHolder(){ - uiOutputCallbackControllerService = (UIOutputCallbackControllerService) PrivilegedCarbonContext - .getThreadLocalCarbonContext().getOSGiService(UIOutputCallbackControllerService.class, null); + websocketOutputCallbackControllerService = (WebsocketOutputCallbackControllerService) PrivilegedCarbonContext + .getThreadLocalCarbonContext().getOSGiService(WebsocketOutputCallbackControllerService.class, null); } public synchronized static ServiceHolder getInstance() { @@ -42,8 +42,8 @@ public class ServiceHolder { return instance; } - public UIOutputCallbackControllerService getUiOutputCallbackControllerService() { - return uiOutputCallbackControllerService; + public WebsocketOutputCallbackControllerService getWebsocketOutputCallbackControllerService() { + return websocketOutputCallbackControllerService; } public static WebsocketValidationService getWebsocketValidationService() { diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapter.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketEventAdapter.java similarity index 87% rename from components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapter.java rename to components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketEventAdapter.java index 4d622d8e7..edf39993a 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapter.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketEventAdapter.java @@ -28,8 +28,8 @@ import org.wso2.carbon.databridge.commons.Attribute; import org.wso2.carbon.databridge.commons.Event; import org.wso2.carbon.databridge.commons.StreamDefinition; import org.wso2.carbon.device.mgt.output.adapter.websocket.constants.WebsocketConstants; -import org.wso2.carbon.device.mgt.output.adapter.websocket.internal.UIEventAdaptorServiceDataHolder; -import org.wso2.carbon.device.mgt.output.adapter.websocket.util.UIEventAdapterConstants; +import org.wso2.carbon.device.mgt.output.adapter.websocket.internal.WebsocketEventAdaptorServiceDataHolder; +import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebsocketEventAdapterConstants; import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebSocketSessionRequest; import org.wso2.carbon.event.output.adapter.core.EventAdapterUtil; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapter; @@ -56,9 +56,9 @@ import java.util.concurrent.TimeUnit; * Contains the life cycle of executions regarding the UI Adapter */ -public class UIEventAdapter implements OutputEventAdapter { +public class WebsocketEventAdapter implements OutputEventAdapter { - private static final Log log = LogFactory.getLog(UIEventAdapter.class); + private static final Log log = LogFactory.getLog(WebsocketEventAdapter.class); private OutputEventAdapterConfiguration eventAdapterConfiguration; private Map globalProperties; private int queueSize; @@ -72,7 +72,7 @@ public class UIEventAdapter implements OutputEventAdapter { private List streamCorrelationAttributes; private List streamPayloadAttributes; - public UIEventAdapter(OutputEventAdapterConfiguration eventAdapterConfiguration, Map globalProperties) { this.eventAdapterConfiguration = eventAdapterConfiguration; this.globalProperties = globalProperties; @@ -91,32 +91,32 @@ public class UIEventAdapter implements OutputEventAdapter { int jobQueSize; //If global properties are available those will be assigned else constant values will be assigned - if (globalProperties.get(UIEventAdapterConstants.ADAPTER_MIN_THREAD_POOL_SIZE_NAME) != null) { + if (globalProperties.get(WebsocketEventAdapterConstants.ADAPTER_MIN_THREAD_POOL_SIZE_NAME) != null) { minThread = Integer.parseInt(globalProperties.get( - UIEventAdapterConstants.ADAPTER_MIN_THREAD_POOL_SIZE_NAME)); + WebsocketEventAdapterConstants.ADAPTER_MIN_THREAD_POOL_SIZE_NAME)); } else { - minThread = UIEventAdapterConstants.ADAPTER_MIN_THREAD_POOL_SIZE; + minThread = WebsocketEventAdapterConstants.ADAPTER_MIN_THREAD_POOL_SIZE; } - if (globalProperties.get(UIEventAdapterConstants.ADAPTER_MAX_THREAD_POOL_SIZE_NAME) != null) { + if (globalProperties.get(WebsocketEventAdapterConstants.ADAPTER_MAX_THREAD_POOL_SIZE_NAME) != null) { maxThread = Integer.parseInt(globalProperties.get( - UIEventAdapterConstants.ADAPTER_MAX_THREAD_POOL_SIZE_NAME)); + WebsocketEventAdapterConstants.ADAPTER_MAX_THREAD_POOL_SIZE_NAME)); } else { - maxThread = UIEventAdapterConstants.ADAPTER_MAX_THREAD_POOL_SIZE; + maxThread = WebsocketEventAdapterConstants.ADAPTER_MAX_THREAD_POOL_SIZE; } - if (globalProperties.get(UIEventAdapterConstants.ADAPTER_KEEP_ALIVE_TIME_NAME) != null) { + if (globalProperties.get(WebsocketEventAdapterConstants.ADAPTER_KEEP_ALIVE_TIME_NAME) != null) { defaultKeepAliveTime = Integer.parseInt(globalProperties.get( - UIEventAdapterConstants.ADAPTER_KEEP_ALIVE_TIME_NAME)); + WebsocketEventAdapterConstants.ADAPTER_KEEP_ALIVE_TIME_NAME)); } else { - defaultKeepAliveTime = UIEventAdapterConstants.DEFAULT_KEEP_ALIVE_TIME_IN_MILLIS; + defaultKeepAliveTime = WebsocketEventAdapterConstants.DEFAULT_KEEP_ALIVE_TIME_IN_MILLIS; } - if (globalProperties.get(UIEventAdapterConstants.ADAPTER_EXECUTOR_JOB_QUEUE_SIZE_NAME) != null) { + if (globalProperties.get(WebsocketEventAdapterConstants.ADAPTER_EXECUTOR_JOB_QUEUE_SIZE_NAME) != null) { jobQueSize = Integer.parseInt(globalProperties.get( - UIEventAdapterConstants.ADAPTER_EXECUTOR_JOB_QUEUE_SIZE_NAME)); + WebsocketEventAdapterConstants.ADAPTER_EXECUTOR_JOB_QUEUE_SIZE_NAME)); } else { - jobQueSize = UIEventAdapterConstants.ADAPTER_EXECUTOR_JOB_QUEUE_SIZE; + jobQueSize = WebsocketEventAdapterConstants.ADAPTER_EXECUTOR_JOB_QUEUE_SIZE; } executorService = new ThreadPoolExecutor(minThread, maxThread, defaultKeepAliveTime, TimeUnit.MILLISECONDS, @@ -137,7 +137,7 @@ public class UIEventAdapter implements OutputEventAdapter { streamPayloadAttributes = streamDefinition.getPayloadData(); ConcurrentHashMap> tenantSpecifcEventOutputAdapterMap = - UIEventAdaptorServiceDataHolder.getTenantSpecificOutputEventStreamAdapterMap(); + WebsocketEventAdaptorServiceDataHolder.getTenantSpecificOutputEventStreamAdapterMap(); ConcurrentHashMap streamSpecifAdapterMap = tenantSpecifcEventOutputAdapterMap.get(tenantId); @@ -157,7 +157,7 @@ public class UIEventAdapter implements OutputEventAdapter { streamSpecifAdapterMap.put(streamId, eventAdapterConfiguration.getName()); ConcurrentHashMap>> tenantSpecificStreamMap = - UIEventAdaptorServiceDataHolder.getTenantSpecificStreamEventMap(); + WebsocketEventAdaptorServiceDataHolder.getTenantSpecificStreamEventMap(); ConcurrentHashMap> streamSpecificEventsMap = tenantSpecificStreamMap.get(tenantId); if (streamSpecificEventsMap == null) { @@ -175,16 +175,16 @@ public class UIEventAdapter implements OutputEventAdapter { } } - if (globalProperties.get(UIEventAdapterConstants.ADAPTER_EVENT_QUEUE_SIZE_NAME) != null) { + if (globalProperties.get(WebsocketEventAdapterConstants.ADAPTER_EVENT_QUEUE_SIZE_NAME) != null) { try { queueSize = Integer.parseInt( - globalProperties.get(UIEventAdapterConstants.ADAPTER_EVENT_QUEUE_SIZE_NAME)); + globalProperties.get(WebsocketEventAdapterConstants.ADAPTER_EVENT_QUEUE_SIZE_NAME)); } catch (NumberFormatException e) { log.error("String does not have the appropriate format for conversion." + e.getMessage()); - queueSize = UIEventAdapterConstants.EVENTS_QUEUE_SIZE; + queueSize = WebsocketEventAdapterConstants.EVENTS_QUEUE_SIZE; } } else { - queueSize = UIEventAdapterConstants.EVENTS_QUEUE_SIZE; + queueSize = WebsocketEventAdapterConstants.EVENTS_QUEUE_SIZE; } } @@ -256,9 +256,9 @@ public class UIEventAdapter implements OutputEventAdapter { eventString = message.toString(); } - Object[] eventValues = new Object[UIEventAdapterConstants.INDEX_TWO]; - eventValues[UIEventAdapterConstants.INDEX_ZERO] = eventString; - eventValues[UIEventAdapterConstants.INDEX_ONE] = System.currentTimeMillis(); + Object[] eventValues = new Object[WebsocketEventAdapterConstants.INDEX_TWO]; + eventValues[WebsocketEventAdapterConstants.INDEX_ZERO] = eventString; + eventValues[WebsocketEventAdapterConstants.INDEX_ONE] = System.currentTimeMillis(); streamSpecificEvents.add(eventValues); // fetch all valid sessions checked against any queryParameters provided when subscribing. @@ -282,14 +282,14 @@ public class UIEventAdapter implements OutputEventAdapter { public void destroy() { int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); - ConcurrentHashMap tenantSpecificAdapterMap = UIEventAdaptorServiceDataHolder + ConcurrentHashMap tenantSpecificAdapterMap = WebsocketEventAdaptorServiceDataHolder .getTenantSpecificOutputEventStreamAdapterMap().get(tenantId); if (tenantSpecificAdapterMap != null && streamId != null) { tenantSpecificAdapterMap.remove(streamId); //Removing outputadapter and streamId } ConcurrentHashMap> tenantSpecificStreamEventMap = - UIEventAdaptorServiceDataHolder.getTenantSpecificStreamEventMap().get(tenantId); + WebsocketEventAdaptorServiceDataHolder.getTenantSpecificStreamEventMap().get(tenantId); if (tenantSpecificStreamEventMap != null && streamId != null) { //Removing the streamId and events registered for the output adapter tenantSpecificStreamEventMap.remove(streamId); @@ -310,7 +310,7 @@ public class UIEventAdapter implements OutputEventAdapter { * the matching Steam-Definition for the given StreamId cannot be retrieved. */ private StreamDefinition getStreamDefinition(String streamId) throws OutputEventAdapterException { - EventStreamService eventStreamService = UIEventAdaptorServiceDataHolder.getEventStreamService(); + EventStreamService eventStreamService = WebsocketEventAdaptorServiceDataHolder.getEventStreamService(); if (eventStreamService != null) { try { return eventStreamService.getStreamDefinition(streamId); @@ -337,11 +337,11 @@ public class UIEventAdapter implements OutputEventAdapter { */ private CopyOnWriteArrayList getValidSessions(Object event) { CopyOnWriteArrayList validSessions = new CopyOnWriteArrayList<>(); - UIOutputCallbackControllerServiceImpl uiOutputCallbackControllerServiceImpl = - UIEventAdaptorServiceDataHolder.getUIOutputCallbackRegisterServiceImpl(); + WebsocketOutputCallbackControllerServiceImpl websocketOutputCallbackControllerServiceImpl = + WebsocketEventAdaptorServiceDataHolder.getUIOutputCallbackRegisterServiceImpl(); // get all subscribed web-socket sessions. CopyOnWriteArrayList webSocketSessionUtils = - uiOutputCallbackControllerServiceImpl.getSessions(tenantId, streamId); + websocketOutputCallbackControllerServiceImpl.getSessions(tenantId, streamId); if (webSocketSessionUtils != null) { for (WebSocketSessionRequest webSocketSessionUtil : webSocketSessionUtils) { boolean isValidSession; diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapterFactory.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketEventAdapterFactory.java similarity index 85% rename from components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapterFactory.java rename to components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketEventAdapterFactory.java index 6150ec59d..d06baa908 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIEventAdapterFactory.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketEventAdapterFactory.java @@ -25,7 +25,7 @@ import org.wso2.carbon.device.mgt.output.adapter.websocket.authentication.Authen import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.Authorizer; import org.wso2.carbon.device.mgt.output.adapter.websocket.service.WebsocketValidationService; import org.wso2.carbon.device.mgt.output.adapter.websocket.service.WebsocketValidationServiceImpl; -import org.wso2.carbon.device.mgt.output.adapter.websocket.util.UIEventAdapterConstants; +import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebsocketEventAdapterConstants; import org.wso2.carbon.event.output.adapter.core.MessageType; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapter; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration; @@ -41,20 +41,20 @@ import java.util.ResourceBundle; /** * The UI event adapter factory class to create a UI output adapter */ -public class UIEventAdapterFactory extends OutputEventAdapterFactory { +public class WebsocketEventAdapterFactory extends OutputEventAdapterFactory { private ResourceBundle resourceBundle = ResourceBundle.getBundle("org.wso2.carbon.device.mgt.output.adapter.websocket.i18n" + ".Resources", Locale.getDefault()); private BundleContext bundleContext; private boolean isAuthInitialized = false; - private static final Log log = LogFactory.getLog(UIEventAdapter.class); + private static final Log log = LogFactory.getLog(WebsocketEventAdapter.class); - public UIEventAdapterFactory() { + public WebsocketEventAdapterFactory() { } @Override public String getType() { - return UIEventAdapterConstants.ADAPTER_TYPE_UI; + return WebsocketEventAdapterConstants.ADAPTER_TYPE_UI; } @Override @@ -77,8 +77,8 @@ public class UIEventAdapterFactory extends OutputEventAdapterFactory { @Override public String getUsageTips() { - return resourceBundle.getString(UIEventAdapterConstants.ADAPTER_USAGE_TIPS_PREFIX) + " " - + resourceBundle.getString(UIEventAdapterConstants.ADAPTER_USAGE_TIPS_POSTFIX); + return resourceBundle.getString(WebsocketEventAdapterConstants.ADAPTER_USAGE_TIPS_PREFIX) + " " + + resourceBundle.getString(WebsocketEventAdapterConstants.ADAPTER_USAGE_TIPS_POSTFIX); } @Override @@ -87,7 +87,7 @@ public class UIEventAdapterFactory extends OutputEventAdapterFactory { if (!isAuthInitialized) { initializeAuthenticatorAndAuthorizor(globalProperties); } - return new UIEventAdapter(eventAdapterConfiguration, globalProperties); + return new WebsocketEventAdapter(eventAdapterConfiguration, globalProperties); } public BundleContext getBundleContext() { @@ -100,24 +100,26 @@ public class UIEventAdapterFactory extends OutputEventAdapterFactory { private void initializeAuthenticatorAndAuthorizor (Map globalProperties) { if (!isAuthInitialized) { - synchronized (UIEventAdapterFactory.class) { + synchronized (WebsocketEventAdapterFactory.class) { if (!isAuthInitialized) { try { WebsocketValidationServiceImpl websocketValidationService = new WebsocketValidationServiceImpl(); String authenticatorClassName = globalProperties.get( - UIEventAdapterConstants.AUTHENTICATOR_CLASS); - String authorizerClassName = globalProperties.get(UIEventAdapterConstants.AUTHORIZER_CLASS); + WebsocketEventAdapterConstants.AUTHENTICATOR_CLASS); + String authorizerClassName = globalProperties.get(WebsocketEventAdapterConstants.AUTHORIZER_CLASS); if (authenticatorClassName != null && !authenticatorClassName.isEmpty()) { Class authenticatorClass = Class.forName(authenticatorClassName) .asSubclass(Authenticator.class); Authenticator authenticator = authenticatorClass.newInstance(); + authenticator.init(globalProperties); websocketValidationService.setAuthenticator(authenticator); } if (authorizerClassName != null && !authorizerClassName.isEmpty()) { Class authorizerClass = Class.forName(authorizerClassName) .asSubclass(Authorizer.class); Authorizer authorizer = authorizerClass.newInstance(); + authorizer.init(globalProperties); websocketValidationService.setAuthorizer(authorizer); } bundleContext.registerService( diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIOutputCallbackControllerService.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketOutputCallbackControllerService.java similarity index 96% rename from components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIOutputCallbackControllerService.java rename to components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketOutputCallbackControllerService.java index ffcfb72a4..8d1858380 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIOutputCallbackControllerService.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketOutputCallbackControllerService.java @@ -24,7 +24,7 @@ import javax.websocket.Session; /** * This interface is exposed as an OSGI service, which will be invoked by the local websocket endpoint to inform new subscriptions; and do un-subscriptions.. */ -public interface UIOutputCallbackControllerService { +public interface WebsocketOutputCallbackControllerService { /** * Used to subscribe the session id and stream id for later web socket connectivity diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIOutputCallbackControllerServiceImpl.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketOutputCallbackControllerServiceImpl.java similarity index 87% rename from components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIOutputCallbackControllerServiceImpl.java rename to components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketOutputCallbackControllerServiceImpl.java index b71a6fc78..d1566795d 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/UIOutputCallbackControllerServiceImpl.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/WebsocketOutputCallbackControllerServiceImpl.java @@ -19,9 +19,9 @@ package org.wso2.carbon.device.mgt.output.adapter.websocket; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.output.adapter.websocket.internal.UIEventAdaptorServiceDataHolder; +import org.wso2.carbon.device.mgt.output.adapter.websocket.internal.WebsocketEventAdaptorServiceDataHolder; import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebSocketSessionRequest; -import org.wso2.carbon.device.mgt.output.adapter.websocket.util.UIEventAdapterConstants; +import org.wso2.carbon.device.mgt.output.adapter.websocket.util.WebsocketEventAdapterConstants; import javax.websocket.Session; import java.util.Iterator; @@ -32,12 +32,12 @@ import java.util.concurrent.LinkedBlockingDeque; /** * Service implementation class which exposes to front end */ -public class UIOutputCallbackControllerServiceImpl implements UIOutputCallbackControllerService { +public class WebsocketOutputCallbackControllerServiceImpl implements WebsocketOutputCallbackControllerService { private ConcurrentHashMap>> outputEventAdaptorSessionMap; - public UIOutputCallbackControllerServiceImpl() { + public WebsocketOutputCallbackControllerServiceImpl() { outputEventAdaptorSessionMap = new ConcurrentHashMap<>(); } @@ -53,9 +53,9 @@ public class UIOutputCallbackControllerServiceImpl implements UIOutputCallbackCo int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); if (version == null || " ".equals(version)) { - version = UIEventAdapterConstants.ADAPTER_UI_DEFAULT_OUTPUT_STREAM_VERSION; + version = WebsocketEventAdapterConstants.ADAPTER_UI_DEFAULT_OUTPUT_STREAM_VERSION; } - String streamId = streamName + UIEventAdapterConstants.ADAPTER_UI_COLON + version; + String streamId = streamName + WebsocketEventAdapterConstants.ADAPTER_UI_COLON + version; ConcurrentHashMap> tenantSpecificAdaptorMap = outputEventAdaptorSessionMap.get(tenantId); if (tenantSpecificAdaptorMap == null) { @@ -102,9 +102,9 @@ public class UIOutputCallbackControllerServiceImpl implements UIOutputCallbackCo */ public LinkedBlockingDeque getEvents(int tenanId, String streamName, String version) { ConcurrentHashMap> tenantSpecificStreamMap = - UIEventAdaptorServiceDataHolder.getTenantSpecificStreamEventMap().get(tenanId); + WebsocketEventAdaptorServiceDataHolder.getTenantSpecificStreamEventMap().get(tenanId); if (tenantSpecificStreamMap != null) { - String streamId = streamName + UIEventAdapterConstants.ADAPTER_UI_COLON + version; + String streamId = streamName + WebsocketEventAdapterConstants.ADAPTER_UI_COLON + version; return tenantSpecificStreamMap.get(streamId); } return null; @@ -120,9 +120,9 @@ public class UIOutputCallbackControllerServiceImpl implements UIOutputCallbackCo public void unsubscribeWebsocket(String streamName, String version, Session session) { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); if (version == null || " ".equals(version)) { - version = UIEventAdapterConstants.ADAPTER_UI_DEFAULT_OUTPUT_STREAM_VERSION; + version = WebsocketEventAdapterConstants.ADAPTER_UI_DEFAULT_OUTPUT_STREAM_VERSION; } - String id = streamName + UIEventAdapterConstants.ADAPTER_UI_COLON + version; + String id = streamName + WebsocketEventAdapterConstants.ADAPTER_UI_COLON + version; ConcurrentHashMap> tenantSpecificAdaptorMap = outputEventAdaptorSessionMap.get(tenantId); if (tenantSpecificAdaptorMap != null) { diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValidaterStubFactory.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValidaterStubFactory.java index 776b3d223..637787c68 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValidaterStubFactory.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authentication/oauth/OAuthTokenValidaterStubFactory.java @@ -94,9 +94,9 @@ public class OAuthTokenValidaterStubFactory extends BasePoolableObjectFactory { private OAuth2TokenValidationServiceStub generateStub() throws OAuthTokenValidationException { OAuth2TokenValidationServiceStub stub; try { - URL hostURL = new URL(PropertyUtils.replaceMqttProperty(tokenValidationProperties.get( + URL hostURL = new URL(PropertyUtils.replaceProperty(tokenValidationProperties.get( (WebsocketConstants.TOKEN_VALIDATION_ENDPOINT_URL))) - + WebsocketConstants.TOKEN_VALIDATION_CONTEXT); + + WebsocketConstants.TOKEN_VALIDATION_CONTEX); stub = new OAuth2TokenValidationServiceStub(hostURL.toString()); ServiceClient client = stub._getServiceClient(); client.getServiceContext().getConfigurationContext().setProperty( diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/DeviceAuthorizer.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/DeviceAuthorizer.java index cd475d6af..d8e779491 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/DeviceAuthorizer.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/DeviceAuthorizer.java @@ -111,7 +111,7 @@ public class DeviceAuthorizer implements Authorizer { } private String getDeviceMgtServerUrl(Map properties) throws OutputEventAdapterException { - String deviceMgtServerUrl = PropertyUtils.replaceMqttProperty(properties.get(DEVICE_MGT_SERVER_URL)); + String deviceMgtServerUrl = PropertyUtils.replaceProperty(properties.get(DEVICE_MGT_SERVER_URL)); if (deviceMgtServerUrl == null || deviceMgtServerUrl.isEmpty()) { logger.error("deviceMgtServerUrl can't be empty "); } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/client/OAuthRequestInterceptor.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/client/OAuthRequestInterceptor.java index a96f3bcab..8ab7db938 100755 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/client/OAuthRequestInterceptor.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/client/OAuthRequestInterceptor.java @@ -28,6 +28,8 @@ import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.client. import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.client.dto.ApiApplicationRegistrationService; import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.client.dto.ApiRegistrationProfile; import org.wso2.carbon.device.mgt.output.adapter.websocket.authorization.client.dto.TokenIssuerService; +import org.wso2.carbon.device.mgt.output.adapter.websocket.util.PropertyUtils; +import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException; import java.util.Map; @@ -50,14 +52,16 @@ public class OAuthRequestInterceptor implements RequestInterceptor { private static final String CONNECTION_USERNAME = "username"; private static final String CONNECTION_PASSWORD = "password"; - private static final String TOKEN_ENDPOINT = "keymanagerUrl"; + private static final String TOKEN_ENDPOINT = "tokenUrl"; private static final String TOKEN_REFRESH_TIME_OFFSET = "tokenRefreshTimeOffset"; + private static final String TOKEN_SCOPES = "scopes"; private static final String DEVICE_MGT_SERVER_URL = "deviceMgtServerUrl"; - private static final String TOKEN_ENDPOINT_CONTEXT = "tokenEndpointContext"; + private static final String TOKEN_ENDPOINT_CONTEXT = "tokenUrl"; private static String username; private static String password; private static String tokenEndpoint; private static String deviceMgtServerUrl; + private static String scopes; private static Map globalProperties; @@ -66,16 +70,22 @@ public class OAuthRequestInterceptor implements RequestInterceptor { */ public OAuthRequestInterceptor(Map globalProperties) { this.globalProperties = globalProperties; - deviceMgtServerUrl = getDeviceMgtServerUrl(globalProperties); - refreshTimeOffset = getRefreshTimeOffset(globalProperties); - username = getUsername(globalProperties); - password = getPassword(globalProperties); - tokenEndpoint = getTokenEndpoint(globalProperties); - apiApplicationRegistrationService = Feign.builder().requestInterceptor( - new BasicAuthRequestInterceptor(username, password)) - .contract(new JAXRSContract()).encoder(new GsonEncoder()).decoder(new GsonDecoder()) - .target(ApiApplicationRegistrationService.class, - deviceMgtServerUrl + API_APPLICATION_REGISTRATION_CONTEXT); + try { + deviceMgtServerUrl = getDeviceMgtServerUrl(globalProperties); + refreshTimeOffset = getRefreshTimeOffset(globalProperties); + username = getUsername(globalProperties); + password = getPassword(globalProperties); + tokenEndpoint = getTokenEndpoint(globalProperties); + scopes = getScopes(globalProperties); + apiApplicationRegistrationService = Feign.builder().requestInterceptor( + new BasicAuthRequestInterceptor(username, password)) + .contract(new JAXRSContract()).encoder(new GsonEncoder()).decoder(new GsonDecoder()) + .target(ApiApplicationRegistrationService.class, + deviceMgtServerUrl + API_APPLICATION_REGISTRATION_CONTEXT); + } catch (OutputEventAdapterException e) { + logger.error("Invalid url: deviceMgtServerUrl" + deviceMgtServerUrl + " or tokenEndpoint:" + tokenEndpoint, + e); + } } @Override @@ -94,7 +104,11 @@ public class OAuthRequestInterceptor implements RequestInterceptor { new BasicAuthRequestInterceptor(consumerKey, consumerSecret)) .contract(new JAXRSContract()).encoder(new GsonEncoder()).decoder(new GsonDecoder()) .target(TokenIssuerService.class, tokenEndpoint); - tokenInfo = tokenIssuerService.getToken(PASSWORD_GRANT_TYPE, username, password); + if (scopes == null || scopes.isEmpty()) { + tokenInfo = tokenIssuerService.getToken(PASSWORD_GRANT_TYPE, username, password); + } else { + tokenInfo = tokenIssuerService.getToken(PASSWORD_GRANT_TYPE, username, password, scopes); + } tokenInfo.setExpires_in(System.currentTimeMillis() + tokenInfo.getExpires_in()); } synchronized(this) { @@ -123,20 +137,20 @@ public class OAuthRequestInterceptor implements RequestInterceptor { return password; } - private String getDeviceMgtServerUrl(Map globalProperties) { + private String getDeviceMgtServerUrl(Map globalProperties) throws OutputEventAdapterException { String deviceMgtServerUrl = globalProperties.get(DEVICE_MGT_SERVER_URL); if (deviceMgtServerUrl == null || deviceMgtServerUrl.isEmpty()) { logger.error("deviceMgtServerUrl can't be empty "); } - return deviceMgtServerUrl; + return PropertyUtils.replaceProperty(deviceMgtServerUrl); } - private String getTokenEndpoint(Map globalProperties) { - String tokenEndpoint = globalProperties.get(TOKEN_ENDPOINT) + globalProperties.get(TOKEN_ENDPOINT_CONTEXT); + private String getTokenEndpoint(Map globalProperties) throws OutputEventAdapterException { + String tokenEndpoint = globalProperties.get(TOKEN_ENDPOINT_CONTEXT); if ( tokenEndpoint.isEmpty()) { logger.error("tokenEndpoint can't be empty "); } - return tokenEndpoint; + return PropertyUtils.replaceProperty(tokenEndpoint); } private long getRefreshTimeOffset(Map globalProperties) { @@ -149,5 +163,9 @@ public class OAuthRequestInterceptor implements RequestInterceptor { return refreshTimeOffset; } + private String getScopes(Map globalProperties) { + return globalProperties.get(TOKEN_SCOPES); + } + } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/client/dto/TokenIssuerService.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/client/dto/TokenIssuerService.java index 9680d50f9..046184559 100755 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/client/dto/TokenIssuerService.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/authorization/client/dto/TokenIssuerService.java @@ -36,7 +36,6 @@ import javax.ws.rs.core.MediaType; /** * This hold the api defintion that is used as a contract with netflix feign. */ -@Path("/token") public interface TokenIssuerService { @POST @@ -45,6 +44,12 @@ public interface TokenIssuerService { AccessTokenInfo getToken(@QueryParam("grant_type") String grant, @QueryParam("username") String username, @QueryParam("password") String password); + @POST + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_FORM_URLENCODED) + AccessTokenInfo getToken(@QueryParam("grant_type") String grant, @QueryParam("username") String username, + @QueryParam("password") String password, @QueryParam("scopes") String scopes); + @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/constants/WebsocketConstants.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/constants/WebsocketConstants.java index 1c1c2af96..6391fa07d 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/constants/WebsocketConstants.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/constants/WebsocketConstants.java @@ -30,7 +30,7 @@ public class WebsocketConstants { public static final String MAXIMUM_TOTAL_HTTP_CONNECTION = "maximumTotalHttpConnection"; public static final String MAXIMUM_HTTP_CONNECTION_PER_HOST = "maximumHttpConnectionPerHost"; public static final String TOKEN_VALIDATION_ENDPOINT_URL = "keymanagerUrl"; - public static final String TOKEN_VALIDATION_CONTEXT = "/services/OAuth2TokenValidationService"; + public static final String TOKEN_VALIDATION_CONTEX = "/services/OAuth2TokenValidationService"; public static final String USERNAME = "username"; public static final String PASSWORD = "password"; public static final String TOKEN_PARAM = "token"; diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UIEventAdaptorServiceDataHolder.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/WebsocketEventAdaptorServiceDataHolder.java similarity index 72% rename from components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UIEventAdaptorServiceDataHolder.java rename to components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/WebsocketEventAdaptorServiceDataHolder.java index ec3c32217..0485b0710 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UIEventAdaptorServiceDataHolder.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/WebsocketEventAdaptorServiceDataHolder.java @@ -18,7 +18,7 @@ */ package org.wso2.carbon.device.mgt.output.adapter.websocket.internal; -import org.wso2.carbon.device.mgt.output.adapter.websocket.UIOutputCallbackControllerServiceImpl; +import org.wso2.carbon.device.mgt.output.adapter.websocket.WebsocketOutputCallbackControllerServiceImpl; import org.wso2.carbon.event.stream.core.EventStreamService; import java.util.concurrent.ConcurrentHashMap; @@ -27,9 +27,9 @@ import java.util.concurrent.LinkedBlockingDeque; /** * Creates a holder of type UIOutputCallbackRegisterServiceImpl. */ -public final class UIEventAdaptorServiceDataHolder { +public final class WebsocketEventAdaptorServiceDataHolder { - private static UIOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl; + private static WebsocketOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl; private static ConcurrentHashMap> tenantSpecificOutputEventStreamAdapterMap = new ConcurrentHashMap<>(); private static ConcurrentHashMap>> @@ -37,21 +37,21 @@ public final class UIEventAdaptorServiceDataHolder { private static EventStreamService eventStreamService; public static void registerEventStreamService(EventStreamService eventBuilderService) { - UIEventAdaptorServiceDataHolder.eventStreamService = eventBuilderService; + WebsocketEventAdaptorServiceDataHolder.eventStreamService = eventBuilderService; } public static EventStreamService getEventStreamService() { - return UIEventAdaptorServiceDataHolder.eventStreamService; + return WebsocketEventAdaptorServiceDataHolder.eventStreamService; } public static void registerUIOutputCallbackRegisterServiceInternal( - UIOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl) { - UIEventAdaptorServiceDataHolder.UIOutputCallbackRegisterServiceImpl = + WebsocketOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl) { + WebsocketEventAdaptorServiceDataHolder.UIOutputCallbackRegisterServiceImpl = UIOutputCallbackRegisterServiceImpl; } - public static UIOutputCallbackControllerServiceImpl getUIOutputCallbackRegisterServiceImpl() { - return UIEventAdaptorServiceDataHolder.UIOutputCallbackRegisterServiceImpl; + public static WebsocketOutputCallbackControllerServiceImpl getUIOutputCallbackRegisterServiceImpl() { + return WebsocketEventAdaptorServiceDataHolder.UIOutputCallbackRegisterServiceImpl; } public static ConcurrentHashMap> diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UILocalEventAdapterServiceComponent.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/WebsocketLocalEventAdapterServiceComponent.java similarity index 64% rename from components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UILocalEventAdapterServiceComponent.java rename to components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/WebsocketLocalEventAdapterServiceComponent.java index 76a92a451..4820d46e6 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/UILocalEventAdapterServiceComponent.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/internal/WebsocketLocalEventAdapterServiceComponent.java @@ -21,21 +21,21 @@ package org.wso2.carbon.device.mgt.output.adapter.websocket.internal; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.device.mgt.output.adapter.websocket.UIEventAdapterFactory; -import org.wso2.carbon.device.mgt.output.adapter.websocket.UIOutputCallbackControllerServiceImpl; +import org.wso2.carbon.device.mgt.output.adapter.websocket.WebsocketEventAdapterFactory; +import org.wso2.carbon.device.mgt.output.adapter.websocket.WebsocketOutputCallbackControllerServiceImpl; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterFactory; -import org.wso2.carbon.device.mgt.output.adapter.websocket.UIOutputCallbackControllerService; +import org.wso2.carbon.device.mgt.output.adapter.websocket.WebsocketOutputCallbackControllerService; import org.wso2.carbon.event.stream.core.EventStreamService; /** - * @scr.component component.name="output.extensions.Ui.AdapterService.component" immediate="true" + * @scr.component component.name="output.extensions.secured.websocket.AdapterService.component" immediate="true" * @scr.reference name="eventStreamService.service" * interface="org.wso2.carbon.event.stream.core.EventStreamService" cardinality="1..1" * policy="dynamic" bind="setEventStreamService" unbind="unsetEventStreamService" */ -public class UILocalEventAdapterServiceComponent { +public class WebsocketLocalEventAdapterServiceComponent { - private static final Log log = LogFactory.getLog(UILocalEventAdapterServiceComponent.class); + private static final Log log = LogFactory.getLog(WebsocketLocalEventAdapterServiceComponent.class); /** * initialize the websocket adapter service here service here. @@ -45,16 +45,17 @@ public class UILocalEventAdapterServiceComponent { protected void activate(ComponentContext context) { try { - UIEventAdapterFactory uiEventAdapterFactory = new UIEventAdapterFactory(); - context.getBundleContext().registerService(OutputEventAdapterFactory.class.getName(), uiEventAdapterFactory, null); - UIOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl = - new UIOutputCallbackControllerServiceImpl(); - context.getBundleContext().registerService(UIOutputCallbackControllerService.class.getName(), + WebsocketEventAdapterFactory websocketEventAdapterFactory = new WebsocketEventAdapterFactory(); + context.getBundleContext().registerService(OutputEventAdapterFactory.class.getName() + , websocketEventAdapterFactory, null); + WebsocketOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl = + new WebsocketOutputCallbackControllerServiceImpl(); + context.getBundleContext().registerService(WebsocketOutputCallbackControllerService.class.getName(), UIOutputCallbackRegisterServiceImpl, null); - uiEventAdapterFactory.setBundleContext(context.getBundleContext()); + websocketEventAdapterFactory.setBundleContext(context.getBundleContext()); - UIEventAdaptorServiceDataHolder.registerUIOutputCallbackRegisterServiceInternal( + WebsocketEventAdaptorServiceDataHolder.registerUIOutputCallbackRegisterServiceInternal( UIOutputCallbackRegisterServiceImpl); if (log.isDebugEnabled()) { log.debug("Successfully deployed the output websocket adapter service"); @@ -70,13 +71,13 @@ public class UILocalEventAdapterServiceComponent { if (log.isDebugEnabled()) { log.debug("Setting the EventStreamService reference for the UILocalEventAdaptor Service"); } - UIEventAdaptorServiceDataHolder.registerEventStreamService(eventStreamService); + WebsocketEventAdaptorServiceDataHolder.registerEventStreamService(eventStreamService); } protected void unsetEventStreamService(EventStreamService eventStreamService) { if (log.isDebugEnabled()) { log.debug("Un-Setting the EventStreamService reference for the UILocalEventAdaptor Service"); } - UIEventAdaptorServiceDataHolder.registerEventStreamService(null); + WebsocketEventAdaptorServiceDataHolder.registerEventStreamService(null); } } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/PropertyUtils.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/PropertyUtils.java index 414df9c12..55b6539d7 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/PropertyUtils.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/PropertyUtils.java @@ -26,7 +26,7 @@ import java.util.regex.Pattern; public class PropertyUtils { //This method is only used if the mb features are within DAS. - public static String replaceMqttProperty(String urlWithPlaceholders) throws OutputEventAdapterException { + public static String replaceProperty(String urlWithPlaceholders) throws OutputEventAdapterException { String regex = "\\$\\{(.*?)\\}"; Pattern pattern = Pattern.compile(regex); Matcher matchPattern = pattern.matcher(urlWithPlaceholders); diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/UIEventAdapterConstants.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketEventAdapterConstants.java similarity index 95% rename from components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/UIEventAdapterConstants.java rename to components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketEventAdapterConstants.java index ba5a1fd8e..7fd15519f 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/UIEventAdapterConstants.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketEventAdapterConstants.java @@ -21,9 +21,9 @@ package org.wso2.carbon.device.mgt.output.adapter.websocket.util; /** * This class contains the constants related to websocket Output Event Adaptor. */ -public class UIEventAdapterConstants { +public class WebsocketEventAdapterConstants { - private UIEventAdapterConstants() { + private WebsocketEventAdapterConstants() { } public static final String ADAPTER_TYPE_UI = "secured-websocket"; diff --git a/pom.xml b/pom.xml index 72ebc2dc4..229be01b1 100644 --- a/pom.xml +++ b/pom.xml @@ -1244,7 +1244,7 @@ 1.1.1 - 2.0.6 + 2.0.7-SNAPSHOT [2.0.0, 3.0.0)