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/AgentConfiguration.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/AgentConfiguration.java index 7621119b8..50c3c7015 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/AgentConfiguration.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/AgentConfiguration.java @@ -28,14 +28,11 @@ public class AgentConfiguration { private String deviceOwner; private String deviceId; private String deviceName; - private String controllerContext; - private String scepContext; private String HTTPS_ServerEndpoint; private String HTTP_ServerEndpoint; private String apimGatewayEndpoint; private String mqttBrokerEndpoint; private String xmppServerEndpoint; - private String authMethod; private String authToken; private String refreshToken; private int dataPushInterval; @@ -82,14 +79,6 @@ public class AgentConfiguration { this.deviceName = deviceName; } - public String getControllerContext() { - return controllerContext; - } - - public void setControllerContext(String controllerContext) { - this.controllerContext = controllerContext; - } - public String getHTTPS_ServerEndpoint() { return HTTPS_ServerEndpoint; } @@ -130,14 +119,6 @@ public class AgentConfiguration { this.xmppServerEndpoint = xmppServerEndpoint; } - public String getAuthMethod() { - return authMethod; - } - - public void setAuthMethod(String authMethod) { - this.authMethod = authMethod; - } - public String getAuthToken() { return authToken; } @@ -162,14 +143,6 @@ public class AgentConfiguration { this.dataPushInterval = dataPushInterval; } - public String getScepContext() { - return scepContext; - } - - public void setScepContext(String scepContext) { - this.scepContext = scepContext; - } - public String getXmppServerName() { return xmppServerName; } @@ -177,6 +150,7 @@ public class AgentConfiguration { public void setXmppServerName(String xmppServerName) { this.xmppServerName = xmppServerName; } + } 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 13b2e74a7..0f83aa4d1 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 @@ -72,14 +72,11 @@ public class AgentConstants { public static final String DEVICE_ID_PROPERTY = "deviceId"; public static final String SERVER_JID_PROPERTY = "server-jid"; public static final String DEVICE_NAME_PROPERTY = "device-name"; - public static final String DEVICE_CONTROLLER_CONTEXT_PROPERTY = "controller-context"; - public static final String DEVICE_SCEP_CONTEXT_PROPERTY = "scep-context"; public static final String SERVER_HTTPS_EP_PROPERTY = "https-ep"; public static final String SERVER_HTTP_EP_PROPERTY = "http-ep"; public static final String APIM_GATEWAY_EP_PROPERTY = "apim-ep"; public static final String MQTT_BROKER_EP_PROPERTY = "mqtt-ep"; public static final String XMPP_SERVER_EP_PROPERTY = "xmpp-ep"; - public static final String AUTH_METHOD_PROPERTY = "auth-method"; public static final String AUTH_TOKEN_PROPERTY = "auth-token"; public static final String REFRESH_TOKEN_PROPERTY = "refresh-token"; public static final String NETWORK_INTERFACE_PROPERTY = "network-interface"; @@ -97,7 +94,6 @@ public class AgentConstants { public static final String DEFAULT_APIM_GATEWAY_EP = "http://127.0.0.1:8281"; public static final String DEFAULT_MQTT_BROKER_EP = "tcp://127.0.0.1:1883"; public static final String DEFAULT_XMPP_SERVER_EP = "http://127.0.0.1:9061"; - public static final String DEFAULT_AUTH_METHOD = "token"; public static final String DEFAULT_AUTH_TOKEN = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0987654321"; public static final String DEFAULT_REFRESH_TOKEN = "1234567890ZYXWVUTSRQPONMKLJIHGFEDCBA"; public static final String DEFAULT_NETWORK_INTERFACE = "en0"; 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 e3b83a4c4..78e3b19cf 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 @@ -48,7 +48,6 @@ public class AgentManager { private boolean isAlarmOn = false; private String initialPolicy; - private String deviceMgtControlUrl, deviceMgtAnalyticUrl; private String deviceName, agentStatus; private int pushInterval; // seconds @@ -107,9 +106,6 @@ public class AgentManager { AgentConstants.DEVICE_TYPE, agentConfigs.getDeviceId()); - this.deviceMgtAnalyticUrl = agentConfigs.getHTTPS_ServerEndpoint() + analyticsPageContext; - this.deviceMgtControlUrl = agentConfigs.getHTTPS_ServerEndpoint() + controlPageContext; - this.agentStatus = AgentConstants.NOT_REGISTERED; this.deviceName = this.agentConfigs.getDeviceName(); @@ -255,14 +251,6 @@ public class AgentManager { return initialPolicy; } - public String getDeviceMgtControlUrl() { - return deviceMgtControlUrl; - } - - public String getDeviceMgtAnalyticUrl() { - return deviceMgtAnalyticUrl; - } - public AgentConfiguration getAgentConfigs() { return agentConfigs; } 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 4ce5d5188..a7ca10e73 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 @@ -90,10 +90,6 @@ public class AgentUtilOperations { AgentConstants.SERVER_JID_PROPERTY)); iotServerConfigs.setDeviceName(properties.getProperty( AgentConstants.DEVICE_NAME_PROPERTY)); - iotServerConfigs.setControllerContext(properties.getProperty( - AgentConstants.DEVICE_CONTROLLER_CONTEXT_PROPERTY)); - iotServerConfigs.setScepContext(properties.getProperty( - AgentConstants.DEVICE_SCEP_CONTEXT_PROPERTY)); iotServerConfigs.setHTTPS_ServerEndpoint(properties.getProperty( AgentConstants.SERVER_HTTPS_EP_PROPERTY)); iotServerConfigs.setHTTP_ServerEndpoint(properties.getProperty( @@ -106,8 +102,6 @@ public class AgentUtilOperations { AgentConstants.XMPP_SERVER_EP_PROPERTY)); iotServerConfigs.setXmppServerName(properties.getProperty( AgentConstants.XMPP_SERVER_NAME_PROPERTY)); - iotServerConfigs.setAuthMethod(properties.getProperty( - AgentConstants.AUTH_METHOD_PROPERTY)); iotServerConfigs.setAuthToken(properties.getProperty( AgentConstants.AUTH_TOKEN_PROPERTY)); iotServerConfigs.setRefreshToken(properties.getProperty( @@ -119,11 +113,10 @@ public class AgentUtilOperations { iotServerConfigs.getTenantDomain()); log.info(AgentConstants.LOG_APPENDER + "Device Owner: " + iotServerConfigs.getDeviceOwner()); - log.info(AgentConstants.LOG_APPENDER + "Device ID: " + iotServerConfigs.getDeviceId()); + log.info(AgentConstants.LOG_APPENDER + "Device ID: " + + iotServerConfigs.getDeviceId()); log.info(AgentConstants.LOG_APPENDER + "Device Name: " + iotServerConfigs.getDeviceName()); - log.info(AgentConstants.LOG_APPENDER + "Device Controller Context: " + - iotServerConfigs.getControllerContext()); log.info(AgentConstants.LOG_APPENDER + "IoT Server HTTPS EndPoint: " + iotServerConfigs.getHTTPS_ServerEndpoint()); log.info(AgentConstants.LOG_APPENDER + "IoT Server HTTP EndPoint: " + @@ -134,8 +127,6 @@ public class AgentUtilOperations { iotServerConfigs.getMqttBrokerEndpoint()); log.info(AgentConstants.LOG_APPENDER + "XMPP Server EndPoint: " + iotServerConfigs.getXmppServerEndpoint()); - log.info(AgentConstants.LOG_APPENDER + "Authentication Method: " + - iotServerConfigs.getAuthMethod()); log.info(AgentConstants.LOG_APPENDER + "Authentication Token: " + iotServerConfigs.getAuthToken()); log.info(AgentConstants.LOG_APPENDER + "Refresh Token: " + @@ -186,14 +177,11 @@ public class AgentUtilOperations { iotServerConfigs.setDeviceId(AgentConstants.DEFAULT_DEVICE_ID); iotServerConfigs.setServerJID(AgentConstants.DEFAULT_SERVER_JID); iotServerConfigs.setDeviceName(AgentConstants.DEFAULT_DEVICE_NAME); - iotServerConfigs.setControllerContext(AgentConstants.DEVICE_CONTROLLER_API_EP); - iotServerConfigs.setScepContext(AgentConstants.DEVICE_SCEP_API_EP); iotServerConfigs.setHTTPS_ServerEndpoint(AgentConstants.DEFAULT_HTTPS_SERVER_EP); iotServerConfigs.setHTTP_ServerEndpoint(AgentConstants.DEFAULT_HTTP_SERVER_EP); iotServerConfigs.setApimGatewayEndpoint(AgentConstants.DEFAULT_APIM_GATEWAY_EP); iotServerConfigs.setMqttBrokerEndpoint(AgentConstants.DEFAULT_MQTT_BROKER_EP); iotServerConfigs.setXmppServerEndpoint(AgentConstants.DEFAULT_XMPP_SERVER_EP); - iotServerConfigs.setAuthMethod(AgentConstants.DEFAULT_AUTH_METHOD); iotServerConfigs.setAuthToken(AgentConstants.DEFAULT_AUTH_TOKEN); iotServerConfigs.setRefreshToken(AgentConstants.DEFAULT_REFRESH_TOKEN); iotServerConfigs.setDataPushInterval(AgentConstants.DEFAULT_DATA_PUBLISH_INTERVAL); @@ -214,8 +202,8 @@ public class AgentUtilOperations { AgentManager agentManager = AgentManager.getInstance(); String serverSecureEndpoint = agentManager.getAgentConfigs().getHTTPS_ServerEndpoint(); String serverUnSecureEndpoint = agentManager.getAgentConfigs().getHTTP_ServerEndpoint(); - String backEndContext = agentManager.getAgentConfigs().getControllerContext(); - String scepBackEndContext = agentManager.getAgentConfigs().getScepContext(); + String backEndContext =AgentConstants.DEVICE_CONTROLLER_API_EP; + String scepBackEndContext = AgentConstants.DEVICE_SCEP_API_EP;S String deviceControllerAPIEndpoint = serverSecureEndpoint + backEndContext; String deviceEnrollmentEndpoint = 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/virtual/ui/AgentUI.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/virtual/ui/AgentUI.java index 96546e5b6..963872555 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/virtual/ui/AgentUI.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/virtual/ui/AgentUI.java @@ -43,8 +43,6 @@ public class AgentUI extends JFrame { private volatile java.util.List policyLogs = new ArrayList<>(); // Variables declaration - do not modify - private JButton btnControl; - private JButton btnView; private JCheckBox chkbxEmulate; private JCheckBox chkbxHumidityRandom; private JCheckBox chkbxHumiditySmooth; @@ -173,8 +171,6 @@ public class AgentUI extends JFrame { chkbxTemperatureSmooth = new JCheckBox(); jPanel6 = new JPanel(); jLabel20 = new JLabel(); - btnView = new JButton(); - btnControl = new JButton(); lblStatus = new JLabel(); jPanel8 = new JPanel(); jLabel23 = new JLabel(); @@ -427,20 +423,6 @@ public class AgentUI extends JFrame { jLabel20.setText("Connection Status:"); jLabel20.setVerticalTextPosition(SwingConstants.TOP); - btnView.setText("View Device Data"); - btnView.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - btnViewMouseClicked(evt); - } - }); - - btnControl.setText("Control Device"); - btnControl.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - btnControlMouseClicked(evt); - } - }); - lblStatus.setFont(new Font("Cantarell", 1, 15)); // NOI18N lblStatus.setText("Not Connected"); @@ -455,10 +437,6 @@ public class AgentUI extends JFrame { .ComponentPlacement.RELATED) .addComponent(lblStatus, GroupLayout .DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnControl) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnView) .addContainerGap()) ); jPanel6Layout.setVerticalGroup( @@ -474,11 +452,6 @@ public class AgentUI extends JFrame { Short.MAX_VALUE) .addGroup(jPanel6Layout.createParallelGroup( GroupLayout.Alignment.BASELINE) - .addComponent(btnView, - GroupLayout.DEFAULT_SIZE, - GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addComponent(btnControl) .addComponent(lblStatus))) .addContainerGap()) ); @@ -876,30 +849,6 @@ public class AgentUI extends JFrame { AgentManager.getInstance().setDeviceReady(true); } - private void btnControlMouseClicked(java.awt.event.MouseEvent evt) { - Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; - if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { - try { - URI uri = new URI(AgentManager.getInstance().getDeviceMgtControlUrl()); - desktop.browse(uri); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - private void btnViewMouseClicked(java.awt.event.MouseEvent evt) { - Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; - if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { - try { - URI uri = new URI(AgentManager.getInstance().getDeviceMgtAnalyticUrl()); - desktop.browse(uri); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - private void chkbxTemperatureRandomActionPerformed(java.awt.event.ActionEvent evt) { isTemperatureRandomized = chkbxTemperatureRandom.isSelected(); VirtualHardwareManager.getInstance().setIsTemperatureRandomized(isTemperatureRandomized); diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/build-impl.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/build-impl.xml index 112454207..67a63a7f4 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/build-impl.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/build-impl.xml @@ -46,8 +46,8 @@ is divided into following sections: - - + + @@ -76,7 +76,7 @@ is divided into following sections: - + @@ -156,6 +156,7 @@ is divided into following sections: + @@ -191,7 +192,12 @@ is divided into following sections: - + + + + + + @@ -217,6 +223,7 @@ is divided into following sections: + @@ -693,7 +700,7 @@ is divided into following sections: - + @@ -768,7 +775,7 @@ is divided into following sections: - + @@ -795,7 +802,7 @@ is divided into following sections: - + @@ -834,7 +841,7 @@ is divided into following sections: - + @@ -846,7 +853,7 @@ is divided into following sections: - + @@ -969,15 +976,15 @@ is divided into following sections: - + - + - + @@ -985,7 +992,7 @@ is divided into following sections: - + @@ -1180,7 +1187,7 @@ is divided into following sections: Must select one file in the IDE or set run.class - + Must select one file in the IDE or set applet.url diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/genfiles.properties b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/genfiles.properties index a6df38fd8..1a7c9fdef 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/genfiles.properties +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/genfiles.properties @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=8064a381@1.75.2.48 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=e60df945 -nbproject/build-impl.xml.script.CRC32=4fa004f7 -nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 +nbproject/build-impl.xml.script.CRC32=18800575 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/private/private.properties b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/private/private.properties index e59ac1df6..eda34e66d 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/private/private.properties +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/private/private.properties @@ -1,2 +1,2 @@ compile.on.save=true -user.properties.file=/home/charitha/.netbeans/8.0.2/build.properties +user.properties.file=/home/lahiru/.netbeans/8.2/build.properties diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/private/private.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/private/private.xml index 97b7e92bd..21b090f78 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/private/private.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/nbproject/private/private.xml @@ -3,7 +3,8 @@ - file:/home/charitha/NetBeansProjects/VirtualAgentUI/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.java + file:/home/lahiru/WSO2IOT/carbon-device-mgt-plugins/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.java + file:/home/lahiru/WSO2IOT/carbon-device-mgt-plugins/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/VirtualAgentUI.java diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.form b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.form index 0778bef15..55a99b0a9 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.form +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.form @@ -367,11 +367,7 @@ - - - - - + @@ -380,12 +376,8 @@ - - - - - - + + @@ -399,22 +391,6 @@ - - - - - - - - - - - - - - - - diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.java index 27a177492..851d572cb 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.java @@ -47,8 +47,6 @@ public class AgentUI extends javax.swing.JFrame { chkbxTemperatureSmooth = new javax.swing.JCheckBox(); jPanel6 = new javax.swing.JPanel(); jLabel20 = new javax.swing.JLabel(); - btnView = new javax.swing.JButton(); - btnControl = new javax.swing.JButton(); lblStatus = new javax.swing.JLabel(); jPanel8 = new javax.swing.JPanel(); jLabel23 = new javax.swing.JLabel(); @@ -274,20 +272,6 @@ public class AgentUI extends javax.swing.JFrame { jLabel20.setText("Connection Status:"); jLabel20.setVerticalTextPosition(javax.swing.SwingConstants.TOP); - btnView.setText("View Device Data"); - btnView.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - btnViewMouseClicked(evt); - } - }); - - btnControl.setText("Control Device"); - btnControl.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - btnControlMouseClicked(evt); - } - }); - lblStatus.setFont(new java.awt.Font("Cantarell", 1, 15)); // NOI18N lblStatus.setText("Not Connected"); @@ -300,22 +284,15 @@ public class AgentUI extends javax.swing.JFrame { .addComponent(jLabel20) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnControl) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnView) - .addContainerGap()) + .addGap(273, 273, 273)) ); jPanel6Layout.setVerticalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(jLabel20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(btnView, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(btnControl) - .addComponent(lblStatus))) + .addComponent(jLabel20, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE) + .addComponent(lblStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); @@ -465,7 +442,7 @@ public class AgentUI extends javax.swing.JFrame { jLabel7.setText("Data Push Interval:"); - spinnerInterval.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(5), Integer.valueOf(1), null, Integer.valueOf(1))); + spinnerInterval.setModel(new javax.swing.SpinnerNumberModel(5, 1, null, 1)); spinnerInterval.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { spinnerIntervalStateChanged(evt); @@ -627,14 +604,6 @@ public class AgentUI extends javax.swing.JFrame { pack(); }// //GEN-END:initComponents - private void btnControlMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnControlMouseClicked - // TODO add your handling code here: - }//GEN-LAST:event_btnControlMouseClicked - - private void btnViewMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnViewMouseClicked - // TODO add your handling code here: - }//GEN-LAST:event_btnViewMouseClicked - private void chkbxTemperatureRandomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkbxTemperatureRandomActionPerformed // TODO add your handling code here: }//GEN-LAST:event_chkbxTemperatureRandomActionPerformed @@ -704,8 +673,6 @@ public class AgentUI extends javax.swing.JFrame { }//GEN-LAST:event_chkbxEmulateActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnControl; - private javax.swing.JButton btnView; private javax.swing.JCheckBox chkbxEmulate; private javax.swing.JCheckBox chkbxHumidityRandom; private javax.swing.JCheckBox chkbxHumiditySmooth; 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/AgentConfiguration.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/AgentConfiguration.java index d5db8993c..7d8f1dc57 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/AgentConfiguration.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/AgentConfiguration.java @@ -28,15 +28,12 @@ public class AgentConfiguration { private String deviceOwner; private String deviceId; private String deviceName; - private String controllerContext; - private String scepContext; private String HTTPS_ServerEndpoint; private String HTTP_ServerEndpoint; private String apimGatewayEndpoint; private String mqttBrokerEndpoint; private String xmppServerEndpoint; private String apiApplicationKey; - private String authMethod; private String authToken; private String refreshToken; private int dataPushInterval; @@ -83,14 +80,6 @@ public class AgentConfiguration { this.deviceName = deviceName; } - public String getControllerContext() { - return controllerContext; - } - - public void setControllerContext(String controllerContext) { - this.controllerContext = controllerContext; - } - public String getHTTPS_ServerEndpoint() { return HTTPS_ServerEndpoint; } @@ -139,14 +128,6 @@ public class AgentConfiguration { this.apiApplicationKey = apiApplicationKey; } - public String getAuthMethod() { - return authMethod; - } - - public void setAuthMethod(String authMethod) { - this.authMethod = authMethod; - } - public String getAuthToken() { return authToken; } @@ -170,15 +151,7 @@ public class AgentConfiguration { public void setDataPushInterval(int dataPushInterval) { this.dataPushInterval = dataPushInterval; } - - public String getScepContext() { - return scepContext; - } - - public void setScepContext(String scepContext) { - this.scepContext = scepContext; - } - + public String getXmppServerName() { return xmppServerName; } 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 f1372b25a..bfa29ca58 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 @@ -27,6 +27,8 @@ public class AgentConstants { /* --------------------------------------------------------------------------------------- IoT-Server specific information --------------------------------------------------------------------------------------- */ + public static final String DEVICE_CONTROLLER_API_EP = "/virtual_firealarm/device"; + public static final String DEVICE_SCEP_API_EP = "/virtual_firealarm_scep"; public static final String DEVICE_ENROLLMENT_API_EP = "/scep"; public static final String DEVICE_REGISTER_API_EP = "/register"; public static final String DEVICE_PUSH_TEMPERATURE_API_EP = "/temperature"; @@ -73,8 +75,6 @@ public class AgentConstants { public static final String DEVICE_ID_PROPERTY = "deviceId"; public static final String SERVER_JID_PROPERTY = "server-jid"; public static final String DEVICE_NAME_PROPERTY = "device-name"; - public static final String DEVICE_CONTROLLER_CONTEXT_PROPERTY = "controller-context"; - public static final String DEVICE_SCEP_CONTEXT_PROPERTY = "scep-context"; public static final String SERVER_HTTPS_EP_PROPERTY = "https-ep"; public static final String SERVER_HTTP_EP_PROPERTY = "http-ep"; public static final String APIM_GATEWAY_EP_PROPERTY = "apim-ep"; @@ -82,7 +82,6 @@ public class AgentConstants { public static final String XMPP_SERVER_EP_PROPERTY = "xmpp-ep"; public static final String XMPP_SERVER_NAME_PROPERTY = "xmpp-server-name"; public static final String API_APPLICATION_KEY = "application-key"; - public static final String AUTH_METHOD_PROPERTY = "auth-method"; public static final String AUTH_TOKEN_PROPERTY = "auth-token"; public static final String REFRESH_TOKEN_PROPERTY = "refresh-token"; public static final String NETWORK_INTERFACE_PROPERTY = "network-interface"; 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 6ee95dceb..4ad7f0037 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 @@ -44,7 +44,6 @@ public class AgentManager { private boolean deviceReady = false; private boolean isAlarmOn = false; - private String deviceMgtControlUrl, deviceMgtAnalyticUrl; private String deviceName, agentStatus; private int pushInterval; // seconds @@ -96,9 +95,6 @@ public class AgentManager { AgentConstants.DEVICE_TYPE, agentConfigs.getDeviceId()); - this.deviceMgtAnalyticUrl = agentConfigs.getHTTPS_ServerEndpoint() + analyticsPageContext; - this.deviceMgtControlUrl = agentConfigs.getHTTPS_ServerEndpoint() + controlPageContext; - this.agentStatus = AgentConstants.NOT_REGISTERED; this.deviceName = this.agentConfigs.getDeviceName(); @@ -234,14 +230,6 @@ public class AgentManager { this.deviceReady = deviceReady; } - public String getDeviceMgtControlUrl() { - return deviceMgtControlUrl; - } - - public String getDeviceMgtAnalyticUrl() { - return deviceMgtAnalyticUrl; - } - public AgentConfiguration getAgentConfigs() { return agentConfigs; } 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 8f6fe409b..fa2a59275 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 @@ -108,10 +108,6 @@ public class AgentUtilOperations { AgentConstants.SERVER_JID_PROPERTY)); iotServerConfigs.setDeviceName(properties.getProperty( AgentConstants.DEVICE_NAME_PROPERTY)); - iotServerConfigs.setControllerContext(properties.getProperty( - AgentConstants.DEVICE_CONTROLLER_CONTEXT_PROPERTY)); - iotServerConfigs.setScepContext(properties.getProperty( - AgentConstants.DEVICE_SCEP_CONTEXT_PROPERTY)); iotServerConfigs.setHTTPS_ServerEndpoint(properties.getProperty( AgentConstants.SERVER_HTTPS_EP_PROPERTY)); iotServerConfigs.setHTTP_ServerEndpoint(properties.getProperty( @@ -126,8 +122,6 @@ public class AgentUtilOperations { AgentConstants.XMPP_SERVER_NAME_PROPERTY)); iotServerConfigs.setApiApplicationKey(properties.getProperty( AgentConstants.API_APPLICATION_KEY)); - iotServerConfigs.setAuthMethod(properties.getProperty( - AgentConstants.AUTH_METHOD_PROPERTY)); iotServerConfigs.setAuthToken(properties.getProperty( AgentConstants.AUTH_TOKEN_PROPERTY)); iotServerConfigs.setRefreshToken(properties.getProperty( @@ -139,11 +133,10 @@ public class AgentUtilOperations { iotServerConfigs.getTenantDomain()); log.info(AgentConstants.LOG_APPENDER + "Device Owner: " + iotServerConfigs.getDeviceOwner()); - log.info(AgentConstants.LOG_APPENDER + "Device ID: " + iotServerConfigs.getDeviceId()); + log.info(AgentConstants.LOG_APPENDER + "Device ID: " + + iotServerConfigs.getDeviceId()); log.info(AgentConstants.LOG_APPENDER + "Device Name: " + iotServerConfigs.getDeviceName()); - log.info(AgentConstants.LOG_APPENDER + "Device Controller Context: " + - iotServerConfigs.getControllerContext()); log.info(AgentConstants.LOG_APPENDER + "IoT Server HTTPS EndPoint: " + iotServerConfigs.getHTTPS_ServerEndpoint()); log.info(AgentConstants.LOG_APPENDER + "IoT Server HTTP EndPoint: " + @@ -154,8 +147,6 @@ public class AgentUtilOperations { iotServerConfigs.getMqttBrokerEndpoint()); log.info(AgentConstants.LOG_APPENDER + "XMPP Server EndPoint: " + iotServerConfigs.getXmppServerEndpoint()); - log.info(AgentConstants.LOG_APPENDER + "Authentication Method: " + - iotServerConfigs.getAuthMethod()); log.info(AgentConstants.LOG_APPENDER + "Base64Encoded API Application Key: " + iotServerConfigs.getApiApplicationKey()); log.info(AgentConstants.LOG_APPENDER + "Authentication Token: " + @@ -202,8 +193,8 @@ public class AgentUtilOperations { AgentManager agentManager = AgentManager.getInstance(); String serverSecureEndpoint = agentManager.getAgentConfigs().getHTTPS_ServerEndpoint(); String serverUnSecureEndpoint = agentManager.getAgentConfigs().getHTTP_ServerEndpoint(); - String backEndContext = agentManager.getAgentConfigs().getControllerContext(); - String scepBackEndContext = agentManager.getAgentConfigs().getScepContext(); + String backEndContext =AgentConstants.DEVICE_CONTROLLER_API_EP; + String scepBackEndContext = AgentConstants.DEVICE_SCEP_API_EP; String deviceControllerAPIEndpoint = serverSecureEndpoint + backEndContext; @@ -312,7 +303,7 @@ public class AgentUtilOperations { } public static String getAuthenticationMethod() { - String authMethod = AgentManager.getInstance().getAgentConfigs().getAuthMethod(); + String authMethod = "token"; switch (authMethod) { case AgentConstants.TOKEN_AUTHENTICATION_METHOD: return AgentConstants.TOKEN_AUTHENTICATION_METHOD; 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/virtual/ui/AgentUI.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/virtual/ui/AgentUI.java index 4a9b76c86..4a8e3dda9 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/virtual/ui/AgentUI.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/virtual/ui/AgentUI.java @@ -37,8 +37,6 @@ public class AgentUI extends JFrame { private JLabel picLabelBulbOn, picLabelBulbOff; // Variables declaration - do not modify - private JButton btnControl; - private JButton btnView; private JCheckBox chkbxEmulate; private JCheckBox chkbxHumidityRandom; private JCheckBox chkbxHumiditySmooth; @@ -158,8 +156,6 @@ public class AgentUI extends JFrame { chkbxTemperatureSmooth = new JCheckBox(); jPanel6 = new JPanel(); jLabel20 = new JLabel(); - btnView = new JButton(); - btnControl = new JButton(); lblStatus = new JLabel(); jPanel8 = new JPanel(); jLabel23 = new JLabel(); @@ -387,20 +383,6 @@ public class AgentUI extends JFrame { jLabel20.setText("Connection Status:"); jLabel20.setVerticalTextPosition(SwingConstants.TOP); - btnView.setText("View Device Data"); - btnView.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - btnViewMouseClicked(evt); - } - }); - - btnControl.setText("Control Device"); - btnControl.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - btnControlMouseClicked(evt); - } - }); - lblStatus.setFont(new Font("Cantarell", 1, 15)); // NOI18N lblStatus.setText("Not Connected"); @@ -414,9 +396,6 @@ public class AgentUI extends JFrame { .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblStatus, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnControl) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnView) .addContainerGap()) ); jPanel6Layout.setVerticalGroup( @@ -426,8 +405,6 @@ public class AgentUI extends JFrame { .addGroup(jPanel6Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(jLabel20, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel6Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(btnView, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(btnControl) .addComponent(lblStatus))) .addContainerGap()) ); @@ -763,29 +740,6 @@ public class AgentUI extends JFrame { AgentManager.getInstance().setDeviceReady(true); } - private void btnControlMouseClicked(java.awt.event.MouseEvent evt) { - Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; - if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { - try { - URI uri = new URI(AgentManager.getInstance().getDeviceMgtControlUrl()); - desktop.browse(uri); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - private void btnViewMouseClicked(java.awt.event.MouseEvent evt) { - Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null; - if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { - try { - URI uri = new URI(AgentManager.getInstance().getDeviceMgtAnalyticUrl()); - desktop.browse(uri); - } catch (Exception e) { - e.printStackTrace(); - } - } - } private void chkbxTemperatureRandomActionPerformed(java.awt.event.ActionEvent evt) { isTemperatureRandomized = chkbxTemperatureRandom.isSelected(); diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/build-impl.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/build-impl.xml index 112454207..67a63a7f4 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/build-impl.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/build-impl.xml @@ -46,8 +46,8 @@ is divided into following sections: - - + + @@ -76,7 +76,7 @@ is divided into following sections: - + @@ -156,6 +156,7 @@ is divided into following sections: + @@ -191,7 +192,12 @@ is divided into following sections: - + + + + + + @@ -217,6 +223,7 @@ is divided into following sections: + @@ -693,7 +700,7 @@ is divided into following sections: - + @@ -768,7 +775,7 @@ is divided into following sections: - + @@ -795,7 +802,7 @@ is divided into following sections: - + @@ -834,7 +841,7 @@ is divided into following sections: - + @@ -846,7 +853,7 @@ is divided into following sections: - + @@ -969,15 +976,15 @@ is divided into following sections: - + - + - + @@ -985,7 +992,7 @@ is divided into following sections: - + @@ -1180,7 +1187,7 @@ is divided into following sections: Must select one file in the IDE or set run.class - + Must select one file in the IDE or set applet.url diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/genfiles.properties b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/genfiles.properties index a6df38fd8..1a7c9fdef 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/genfiles.properties +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/genfiles.properties @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=8064a381@1.75.2.48 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=e60df945 -nbproject/build-impl.xml.script.CRC32=4fa004f7 -nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 +nbproject/build-impl.xml.script.CRC32=18800575 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/private/private.properties b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/private/private.properties index e59ac1df6..eda34e66d 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/private/private.properties +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/private/private.properties @@ -1,2 +1,2 @@ compile.on.save=true -user.properties.file=/home/charitha/.netbeans/8.0.2/build.properties +user.properties.file=/home/lahiru/.netbeans/8.2/build.properties diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/private/private.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/private/private.xml index 2f9a6910b..9009411f0 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/private/private.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/nbproject/private/private.xml @@ -3,7 +3,7 @@ - file:/home/charitha/git/IoT/iot-server-agents/FireAlarmVirtualAgent/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.java + file:/home/lahiru/WSO2IOT/carbon-device-mgt-plugins/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/VirtualAgentUI.java diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.form b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.form index 23b70e036..43bc3e62e 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.form +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.form @@ -364,11 +364,7 @@ - - - - - + @@ -377,12 +373,8 @@ - - - - - - + + @@ -396,22 +388,6 @@ - - - - - - - - - - - - - - - - diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.java index 470a7d8fe..e3b4e89f6 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/ui/src/org/wso2/carbon/device/mgt/iot/agent/virtual/ui/AgentUI.java @@ -47,8 +47,6 @@ public class AgentUI extends javax.swing.JFrame { chkbxTemperatureSmooth = new javax.swing.JCheckBox(); jPanel6 = new javax.swing.JPanel(); jLabel20 = new javax.swing.JLabel(); - btnView = new javax.swing.JButton(); - btnControl = new javax.swing.JButton(); lblStatus = new javax.swing.JLabel(); jPanel8 = new javax.swing.JPanel(); jLabel23 = new javax.swing.JLabel(); @@ -272,20 +270,6 @@ public class AgentUI extends javax.swing.JFrame { jLabel20.setText("Connection Status:"); jLabel20.setVerticalTextPosition(javax.swing.SwingConstants.TOP); - btnView.setText("View Device Data"); - btnView.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - btnViewMouseClicked(evt); - } - }); - - btnControl.setText("Control Device"); - btnControl.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - btnControlMouseClicked(evt); - } - }); - lblStatus.setFont(new java.awt.Font("Cantarell", 1, 15)); // NOI18N lblStatus.setText("Not Connected"); @@ -298,22 +282,15 @@ public class AgentUI extends javax.swing.JFrame { .addComponent(jLabel20) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnControl) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnView) - .addContainerGap()) + .addGap(273, 273, 273)) ); jPanel6Layout.setVerticalGroup( jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(jLabel20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(btnView, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(btnControl) - .addComponent(lblStatus))) + .addComponent(jLabel20, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE) + .addComponent(lblStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); @@ -463,7 +440,7 @@ public class AgentUI extends javax.swing.JFrame { jLabel7.setText("Data Push Interval:"); - spinnerInterval.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(5), Integer.valueOf(1), null, Integer.valueOf(1))); + spinnerInterval.setModel(new javax.swing.SpinnerNumberModel(5, 1, null, 1)); spinnerInterval.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { spinnerIntervalStateChanged(evt); @@ -615,14 +592,6 @@ public class AgentUI extends javax.swing.JFrame { pack(); }// //GEN-END:initComponents - private void btnControlMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnControlMouseClicked - // TODO add your handling code here: - }//GEN-LAST:event_btnControlMouseClicked - - private void btnViewMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnViewMouseClicked - // TODO add your handling code here: - }//GEN-LAST:event_btnViewMouseClicked - private void chkbxTemperatureRandomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkbxTemperatureRandomActionPerformed // TODO add your handling code here: }//GEN-LAST:event_chkbxTemperatureRandomActionPerformed @@ -692,8 +661,6 @@ public class AgentUI extends javax.swing.JFrame { }//GEN-LAST:event_chkbxEmulateActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnControl; - private javax.swing.JButton btnView; private javax.swing.JCheckBox chkbxEmulate; private javax.swing.JCheckBox chkbxHumidityRandom; private javax.swing.JCheckBox chkbxHumiditySmooth; diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/public/js/device-stats.js b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/public/js/device-stats.js index 2805d0c4d..dbf6d2006 100755 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/public/js/device-stats.js +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/public/js/device-stats.js @@ -74,9 +74,11 @@ $(window).load(function () { connect(websocketUrl) }); -$(window).unload(function () { +// close websocket when page is about to be unloaded +// fixes broken pipe issue +window.onbeforeunload = function() { disconnect(); -}); +}; //websocket connection function connect(target) { diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/advanced_agent/deviceConfig.properties b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/advanced_agent/deviceConfig.properties index 54b6792e5..80bee115a 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/advanced_agent/deviceConfig.properties +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/advanced_agent/deviceConfig.properties @@ -20,14 +20,11 @@ tenantDomain=${TENANT_DOMAIN} owner=${DEVICE_OWNER} deviceId=${DEVICE_ID} device-name=${DEVICE_NAME} -controller-context=/virtual_firealarm/device -scep-context=/virtual_firealarm_scep https-ep=${HTTPS_EP} http-ep=${HTTP_EP} apim-ep=${APIM_EP} mqtt-ep=${MQTT_EP} xmpp-ep=${XMPP_EP} -auth-method=token application-key=${API_APPLICATION_KEY} auth-token=${DEVICE_TOKEN} refresh-token=${DEVICE_REFRESH_TOKEN} diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/agent/deviceConfig.properties b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/agent/deviceConfig.properties index 54b6792e5..80bee115a 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/agent/deviceConfig.properties +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.backend.feature/src/main/resources/agent/deviceConfig.properties @@ -20,14 +20,11 @@ tenantDomain=${TENANT_DOMAIN} owner=${DEVICE_OWNER} deviceId=${DEVICE_ID} device-name=${DEVICE_NAME} -controller-context=/virtual_firealarm/device -scep-context=/virtual_firealarm_scep https-ep=${HTTPS_EP} http-ep=${HTTP_EP} apim-ep=${APIM_EP} mqtt-ep=${MQTT_EP} xmpp-ep=${XMPP_EP} -auth-method=token application-key=${API_APPLICATION_KEY} auth-token=${DEVICE_TOKEN} refresh-token=${DEVICE_REFRESH_TOKEN}