public void removeThing(BareJid thing) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { removeThing(thing, NodeInfo.EMPTY); }
public ThingState registerThing(Thing thing) throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException, IoTClaimedException { Jid registry = findRegistry(); return registerThing(registry, thing); }
public void disownThing(Jid thing, NodeInfo nodeInfo) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Jid registry = findRegistry(); disownThing(registry, thing, nodeInfo); }
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 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(); }
static void checkPrerequisites(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException { IoTDiscoveryManager discoveryManager = IoTDiscoveryManager.getInstanceFor(connection); Jid registry = discoveryManager.findRegistry(); if (registry == null) { throw new TestNotPossibleException("Could not find IoT Registry"); } }
public void unregister(NodeInfo nodeInfo) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Jid registry = findRegistry(); unregister(registry, nodeInfo); }
public IoTClaimed claimThing(Collection<Tag> metaTags, boolean publicThing) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Jid registry = findRegistry(); return claimThing(registry, metaTags, publicThing); }
public static ThingState registerThing(IoTDiscoveryManager iotDiscoveryManager, Thing thing) throws XMPPErrorException, InterruptedException, SmackException { int attempts = 0; while (true) { try { return iotDiscoveryManager.registerThing(thing); } catch (IoTClaimedException e) { iotDiscoveryManager.unregister(); } if (attempts++ > 3) { throw new SmackException("Could no register thing"); } } }
public void removeThing(BareJid thing, NodeInfo nodeInfo) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Jid registry = findRegistry(); removeThing(registry, thing, nodeInfo); }
public IoTDiscoveryIntegrationTest(SmackIntegrationTestEnvironment environment) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException { super(environment); discoveryManagerOne = IoTDiscoveryManager.getInstanceFor(conOne); discoveryManagerTwo = IoTDiscoveryManager.getInstanceFor(conTwo); checkPrerequisites(conOne); }
public void unregister() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { unregister(NodeInfo.EMPTY); }
public IoTClaimed claimThing(Collection<Tag> metaTags) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return claimThing(metaTags, true); }
public void disownThing(Jid thing) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { disownThing(thing, NodeInfo.EMPTY); }
@Override public void run() { for (ThingStateChangeListener thingStateChangeListener : listeners) { thingStateChangeListener.owned(owner); } } });
private ThingState getStateFor(NodeInfo nodeInfo) { ThingState state = things.get(nodeInfo); if (state == null) { state = new ThingState(nodeInfo); things.put(nodeInfo, state); } return state; }
/** * Get the manger instance responsible for the given connection. * * @param connection the XMPP connection. * @return a manager instance. */ public static synchronized IoTDiscoveryManager getInstanceFor(XMPPConnection connection) { IoTDiscoveryManager manager = INSTANCES.get(connection); if (manager == null) { manager = new IoTDiscoveryManager(connection); INSTANCES.put(connection, manager); } return manager; }
public boolean isRegistry(Jid jid) { try { return isRegistry(jid.asBareJid()); } catch (NoResponseException | XMPPErrorException | NotConnectedException | InterruptedException e) { LOGGER.log(Level.WARNING, "Could not determine if " + jid + " is a registry", e); return false; } }
@Override public void connectionCreated(XMPPConnection connection) { if (!IoTManager.isAutoEnableActive()) return; getInstanceFor(connection); } });