public void removeThing(Jid registry, BareJid thing, NodeInfo nodeInfo) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { interactWithRegistry(registry); IoTRemove iotRemove = new IoTRemove(thing, nodeInfo); iotRemove.setTo(registry); connection().createStanzaCollectorAndSend(iotRemove).nextResultOrThrow(); // We no not update the ThingState here, as this is done in the <removed/> IQ handler above.; }
public void disownThing(Jid registry, Jid thing, NodeInfo nodeInfo) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { interactWithRegistry(registry); IoTDisown iotDisown = new IoTDisown(thing, nodeInfo); iotDisown.setTo(registry); connection().createStanzaCollectorAndSend(iotDisown).nextResultOrThrow(); }
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); }
/** * Claim a thing by providing a collection of meta tags. If the claim was successful, then a {@link IoTClaimed} * instance will be returned, which contains the XMPP address of the thing. Use {@link IoTClaimed#getJid()} to * retrieve this address. * * @param registry the registry use to claim the thing. * @param metaTags a collection of meta tags used to identify the thing. * @param publicThing if this is a public thing. * @return a {@link IoTClaimed} if successful. * @throws NoResponseException * @throws XMPPErrorException * @throws NotConnectedException * @throws InterruptedException */ public IoTClaimed claimThing(Jid registry, Collection<Tag> metaTags, boolean publicThing) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { interactWithRegistry(registry); IoTMine iotMine = new IoTMine(metaTags, publicThing); iotMine.setTo(registry); IoTClaimed iotClaimed = connection().createStanzaCollectorAndSend(iotMine).nextResultOrThrow(); // The 'jid' attribute of the <claimed/> response now represents the XMPP address of the thing we just successfully claimed. Jid thing = iotClaimed.getJid(); IoTProvisioningManager.getInstanceFor(connection()).sendFriendshipRequest(thing.asBareJid()); return iotClaimed; }
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 disownThing(Jid registry, Jid thing, NodeInfo nodeInfo) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { interactWithRegistry(registry); IoTDisown iotDisown = new IoTDisown(thing, nodeInfo); iotDisown.setTo(registry); connection().createStanzaCollectorAndSend(iotDisown).nextResultOrThrow(); }
public void removeThing(Jid registry, BareJid thing, NodeInfo nodeInfo) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { interactWithRegistry(registry); IoTRemove iotRemove = new IoTRemove(thing, nodeInfo); iotRemove.setTo(registry); connection().createStanzaCollectorAndSend(iotRemove).nextResultOrThrow(); // We no not update the ThingState here, as this is done in the <removed/> IQ handler above.; }
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); }
/** * Claim a thing by providing a collection of meta tags. If the claim was successful, then a {@link IoTClaimed} * instance will be returned, which contains the XMPP address of the thing. Use {@link IoTClaimed#getJid()} to * retrieve this address. * * @param registry the registry use to claim the thing. * @param metaTags a collection of meta tags used to identify the thing. * @param publicThing if this is a public thing. * @return a {@link IoTClaimed} if successful. * @throws NoResponseException * @throws XMPPErrorException * @throws NotConnectedException * @throws InterruptedException */ public IoTClaimed claimThing(Jid registry, Collection<Tag> metaTags, boolean publicThing) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { interactWithRegistry(registry); IoTMine iotMine = new IoTMine(metaTags, publicThing); iotMine.setTo(registry); IoTClaimed iotClaimed = connection().createStanzaCollectorAndSend(iotMine).nextResultOrThrow(); // The 'jid' attribute of the <claimed/> response now represents the XMPP address of the thing we just successfully claimed. Jid thing = iotClaimed.getJid(); IoTProvisioningManager.getInstanceFor(connection()).sendFriendshipRequest(thing.asBareJid()); return iotClaimed; }
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; }