Java Code Examples for org.fourthline.cling.model.types.UDN#equals()
The following examples show how to use
org.fourthline.cling.model.types.UDN#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RemoteItems.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
boolean remove(final RemoteDevice remoteDevice, boolean shuttingDown) throws RegistrationException { final RemoteDevice registeredDevice = get(remoteDevice.getIdentity().getUdn(), true); if (registeredDevice != null) { log.fine("Removing remote device from registry: " + remoteDevice); // Resources for (Resource deviceResource : getResources(registeredDevice)) { if (registry.removeResource(deviceResource)) { log.fine("Unregistered resource: " + deviceResource); } } // Active subscriptions Iterator<RegistryItem<String, RemoteGENASubscription>> it = getSubscriptionItems().iterator(); while (it.hasNext()) { final RegistryItem<String, RemoteGENASubscription> outgoingSubscription = it.next(); UDN subscriptionForUDN = outgoingSubscription.getItem().getService().getDevice().getIdentity().getUdn(); if (subscriptionForUDN.equals(registeredDevice.getIdentity().getUdn())) { log.fine("Removing outgoing subscription: " + outgoingSubscription.getKey()); it.remove(); if (!shuttingDown) { registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { outgoingSubscription.getItem().end(CancelReason.DEVICE_WAS_REMOVED, null); } } ); } } } // Only notify listeners if we are NOT in the process of shutting down the registry if (!shuttingDown) { for (final RegistryListener listener : registry.getListeners()) { registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { listener.remoteDeviceRemoved(registry, registeredDevice); } } ); } } // Finally, remove the device from the registry getDeviceItems().remove(new RegistryItem(registeredDevice.getIdentity().getUdn())); return true; } return false; }
Example 2
Source File: LocalItems.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
boolean remove(final LocalDevice localDevice, boolean shuttingDown) throws RegistrationException { LocalDevice registeredDevice = get(localDevice.getIdentity().getUdn(), true); if (registeredDevice != null) { log.fine("Removing local device from registry: " + localDevice); setDiscoveryOptions(localDevice.getIdentity().getUdn(), null); getDeviceItems().remove(new RegistryItem(localDevice.getIdentity().getUdn())); for (Resource deviceResource : getResources(localDevice)) { if (registry.removeResource(deviceResource)) { log.fine("Unregistered resource: " + deviceResource); } } // Active subscriptions Iterator<RegistryItem<String, LocalGENASubscription>> it = getSubscriptionItems().iterator(); while (it.hasNext()) { final RegistryItem<String, LocalGENASubscription> incomingSubscription = it.next(); UDN subscriptionForUDN = incomingSubscription.getItem().getService().getDevice().getIdentity().getUdn(); if (subscriptionForUDN.equals(registeredDevice.getIdentity().getUdn())) { log.fine("Removing incoming subscription: " + incomingSubscription.getKey()); it.remove(); if (!shuttingDown) { registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { incomingSubscription.getItem().end(CancelReason.DEVICE_WAS_REMOVED); } } ); } } } if (isAdvertised(localDevice.getIdentity().getUdn())) advertiseByebye(localDevice, !shuttingDown); if (!shuttingDown) { for (final RegistryListener listener : registry.getListeners()) { registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { listener.localDeviceRemoved(registry, localDevice); } } ); } } return true; } return false; }
Example 3
Source File: RemoteItems.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
boolean remove(final RemoteDevice remoteDevice, boolean shuttingDown) throws RegistrationException { final RemoteDevice registeredDevice = get(remoteDevice.getIdentity().getUdn(), true); if (registeredDevice != null) { log.fine("Removing remote device from registry: " + remoteDevice); // Resources for (Resource deviceResource : getResources(registeredDevice)) { if (registry.removeResource(deviceResource)) { log.fine("Unregistered resource: " + deviceResource); } } // Active subscriptions Iterator<RegistryItem<String, RemoteGENASubscription>> it = getSubscriptionItems().iterator(); while (it.hasNext()) { final RegistryItem<String, RemoteGENASubscription> outgoingSubscription = it.next(); UDN subscriptionForUDN = outgoingSubscription.getItem().getService().getDevice().getIdentity().getUdn(); if (subscriptionForUDN.equals(registeredDevice.getIdentity().getUdn())) { log.fine("Removing outgoing subscription: " + outgoingSubscription.getKey()); it.remove(); if (!shuttingDown) { registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { outgoingSubscription.getItem().end(CancelReason.DEVICE_WAS_REMOVED, null); } } ); } } } // Only notify listeners if we are NOT in the process of shutting down the registry if (!shuttingDown) { for (final RegistryListener listener : registry.getListeners()) { registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { listener.remoteDeviceRemoved(registry, registeredDevice); } } ); } } // Finally, remove the device from the registry getDeviceItems().remove(new RegistryItem(registeredDevice.getIdentity().getUdn())); return true; } return false; }
Example 4
Source File: LocalItems.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
boolean remove(final LocalDevice localDevice, boolean shuttingDown) throws RegistrationException { LocalDevice registeredDevice = get(localDevice.getIdentity().getUdn(), true); if (registeredDevice != null) { log.fine("Removing local device from registry: " + localDevice); setDiscoveryOptions(localDevice.getIdentity().getUdn(), null); getDeviceItems().remove(new RegistryItem(localDevice.getIdentity().getUdn())); for (Resource deviceResource : getResources(localDevice)) { if (registry.removeResource(deviceResource)) { log.fine("Unregistered resource: " + deviceResource); } } // Active subscriptions Iterator<RegistryItem<String, LocalGENASubscription>> it = getSubscriptionItems().iterator(); while (it.hasNext()) { final RegistryItem<String, LocalGENASubscription> incomingSubscription = it.next(); UDN subscriptionForUDN = incomingSubscription.getItem().getService().getDevice().getIdentity().getUdn(); if (subscriptionForUDN.equals(registeredDevice.getIdentity().getUdn())) { log.fine("Removing incoming subscription: " + incomingSubscription.getKey()); it.remove(); if (!shuttingDown) { registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { incomingSubscription.getItem().end(CancelReason.DEVICE_WAS_REMOVED); } } ); } } } if (isAdvertised(localDevice.getIdentity().getUdn())) advertiseByebye(localDevice, !shuttingDown); if (!shuttingDown) { for (final RegistryListener listener : registry.getListeners()) { registry.getConfiguration().getRegistryListenerExecutor().execute( new Runnable() { public void run() { listener.localDeviceRemoved(registry, localDevice); } } ); } } return true; } return false; }