public void unregister(Jid registry, NodeInfo nodeInfo) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { interactWithRegistry(registry); IoTUnregister iotUnregister = new IoTUnregister(nodeInfo); iotUnregister.setTo(registry); connection().createStanzaCollectorAndSend(iotUnregister).nextResultOrThrow(); ThingState state = getStateFor(nodeInfo); state.setUnregistered(); final XMPPConnection connection = connection(); IoTDataManager.getInstanceFor(connection).uninstallThing(nodeInfo); IoTControlManager.getInstanceFor(connection).uninstallThing(nodeInfo); }
public ThingState registerThing(Jid registry, Thing thing) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException, IoTClaimedException { final XMPPConnection connection = connection(); IoTRegister iotRegister = new IoTRegister(thing.getMetaTags(), thing.getNodeInfo(), thing.isSelfOwened()); iotRegister.setTo(registry); IQ result = connection.createStanzaCollectorAndSend(iotRegister).nextResultOrThrow(); if (result instanceof IoTClaimed) { IoTClaimed iotClaimedResult = (IoTClaimed) result; throw new IoTClaimedException(iotClaimedResult); } ThingState state = getStateFor(thing.getNodeInfo()); state.setRegistry(registry.asBareJid()); interactWithRegistry(registry); IoTDataManager.getInstanceFor(connection).installThing(thing); IoTControlManager.getInstanceFor(connection).installThing(thing); return state; }
public void unregister(Jid registry, NodeInfo nodeInfo) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { interactWithRegistry(registry); IoTUnregister iotUnregister = new IoTUnregister(nodeInfo); iotUnregister.setTo(registry); connection().createStanzaCollectorAndSend(iotUnregister).nextResultOrThrow(); ThingState state = getStateFor(nodeInfo); state.setUnregistered(); final XMPPConnection connection = connection(); IoTDataManager.getInstanceFor(connection).uninstallThing(nodeInfo); IoTControlManager.getInstanceFor(connection).uninstallThing(nodeInfo); }
public ThingState registerThing(Jid registry, Thing thing) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException, IoTClaimedException { final XMPPConnection connection = connection(); IoTRegister iotRegister = new IoTRegister(thing.getMetaTags(), thing.getNodeInfo(), thing.isSelfOwened()); iotRegister.setTo(registry); IQ result = connection.createStanzaCollectorAndSend(iotRegister).nextResultOrThrow(); if (result instanceof IoTClaimed) { IoTClaimed iotClaimedResult = (IoTClaimed) result; throw new IoTClaimedException(iotClaimedResult); } ThingState state = getStateFor(thing.getNodeInfo()); state.setRegistry(registry.asBareJid()); interactWithRegistry(registry); IoTDataManager.getInstanceFor(connection).installThing(thing); IoTControlManager.getInstanceFor(connection).installThing(thing); return state; }