few changes to resolve the error on matt

application-manager-new
ayyoob 9 years ago
parent 183d53eea6
commit ecd8c75660

@ -114,46 +114,46 @@ public class VirtualFireAlarmService {
private static final String mqttServerSubscribeTopic = "wso2/iot/+/" + VirtualFireAlarmConstants.DEVICE_TYPE + "/+/reply"; private static final String mqttServerSubscribeTopic = "wso2/iot/+/" + VirtualFireAlarmConstants.DEVICE_TYPE + "/+/reply";
private static final String iotServerSubscriber = "IoT-Server"; private static final String iotServerSubscriber = "IoT-Server";
static{ // static{
String xmppServer = XmppConfig.getInstance().getXmppControlQueue().getServerURL(); // String xmppServer = XmppConfig.getInstance().getXmppControlQueue().getServerURL();
int indexOfChar = xmppServer.lastIndexOf('/'); // int indexOfChar = xmppServer.lastIndexOf('/');
if (indexOfChar != -1) { // if (indexOfChar != -1) {
xmppServer = xmppServer.substring((indexOfChar + 1), xmppServer.length()); // xmppServer = xmppServer.substring((indexOfChar + 1), xmppServer.length());
} // }
//
int xmppPort = Integer.parseInt(XmppConfig.getInstance().getSERVER_CONNECTION_PORT()); // int xmppPort = Integer.parseInt(XmppConfig.getInstance().getSERVER_CONNECTION_PORT());
xmppClient = new XMPPClient(xmppServer, xmppPort) { // xmppClient = new XMPPClient(xmppServer, xmppPort) {
@Override // @Override
protected void processXMPPMessage(Message xmppMessage) { // protected void processXMPPMessage(Message xmppMessage) {
//
} // }
}; // };
//
String xmppUsername = XmppConfig.getInstance().getXmppUsername(); // String xmppUsername = XmppConfig.getInstance().getXmppUsername();
String xmppPassword = XmppConfig.getInstance().getXmppPassword(); // String xmppPassword = XmppConfig.getInstance().getXmppPassword();
//
try { // try {
xmppClient.connectAndLogin(xmppUsername, xmppPassword, "iotServer"); // xmppClient.connectAndLogin(xmppUsername, xmppPassword, "iotServer");
} catch (DeviceManagementException e) { // } catch (DeviceManagementException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
//
xmppClient.setMessageFilterAndListener(""); // xmppClient.setMessageFilterAndListener("");
//
String mqttEndpoint = MqttConfig.getInstance().getMqttQueueEndpoint(); // String mqttEndpoint = MqttConfig.getInstance().getMqttQueueEndpoint();
mqttClient = new MQTTClient(iotServerSubscriber, VirtualFireAlarmConstants.DEVICE_TYPE, mqttEndpoint, mqttServerSubscribeTopic) { // mqttClient = new MQTTClient(iotServerSubscriber, VirtualFireAlarmConstants.DEVICE_TYPE, mqttEndpoint, mqttServerSubscribeTopic) {
@Override // @Override
protected void postMessageArrived(String topic, MqttMessage message) { // protected void postMessageArrived(String topic, MqttMessage message) {
//
} // }
}; // };
//
try { // try {
mqttClient.connectAndSubscribe(); // mqttClient.connectAndSubscribe();
} catch (DeviceManagementException e) { // } catch (DeviceManagementException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
@Path("manager/device/register") @Path("manager/device/register")

Loading…
Cancel
Save