org.eclipse.ecf.discovery
Class AbstractDiscoveryContainerAdapter

java.lang.Object
  extended by org.eclipse.ecf.core.AbstractContainer
      extended by org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapter
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IContainer, IIdentifiable, org.eclipse.ecf.discovery.IDiscoveryAdvertiser, org.eclipse.ecf.discovery.IDiscoveryLocator
Direct Known Subclasses:
CompositeDiscoveryContainer, JMDNSDiscoveryContainer, JSLPDiscoveryContainer

public abstract class AbstractDiscoveryContainerAdapter
extends AbstractContainer
implements org.eclipse.ecf.discovery.IDiscoveryLocator, org.eclipse.ecf.discovery.IDiscoveryAdvertiser


Field Summary
protected  java.util.Set allServiceListeners
          Collection of service listeners i.e.
protected  java.util.Map serviceListeners
          Map of service type to collection of service listeners i.e.
protected  java.lang.String servicesNamespaceName
           
protected  java.util.Collection serviceTypeListeners
          Collection of service type listeners i.e.
 
Fields inherited from interface org.eclipse.ecf.discovery.IDiscoveryLocator
CONTAINER_NAME
 
Fields inherited from interface org.eclipse.ecf.discovery.IDiscoveryAdvertiser
CONTAINER_NAME
 
Constructor Summary
AbstractDiscoveryContainerAdapter(java.lang.String aNamespaceName, DiscoveryContainerConfig aConfig)
           
 
Method Summary
 void addServiceListener(IServiceListener aListener)
           
 void addServiceListener(IServiceTypeID aType, IServiceListener aListener)
           
 void addServiceTypeListener(IServiceTypeListener aListener)
           
protected  void clearListeners()
           
 void dispose()
          Dispose this IContainer instance.
protected  void fireServiceDiscovered(IServiceEvent aServiceEvent)
          Calls IServiceListener.serviceDiscovered(IServiceEvent) for all registered IServiceListener
protected  void fireServiceTypeDiscovered(IServiceTypeEvent aServiceTypeEvent)
          Calls IServiceTypeListener.serviceTypeDiscovered(IServiceTypeEvent) for all registered IServiceTypeListener
protected  void fireServiceUndiscovered(IServiceEvent aServiceEvent)
          Calls IServiceListener.serviceUndiscovered(IServiceEvent) for all registered IServiceListener
 org.eclipse.equinox.concurrent.future.IFuture getAsyncServiceInfo(IServiceID service)
           
 org.eclipse.equinox.concurrent.future.IFuture getAsyncServices()
           
 org.eclipse.equinox.concurrent.future.IFuture getAsyncServices(IServiceTypeID type)
           
 org.eclipse.equinox.concurrent.future.IFuture getAsyncServiceTypes()
           
protected  DiscoveryContainerConfig getConfig()
           
 Namespace getConnectNamespace()
          Get the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls to IContainer.connect(ID, IConnectContext).
 ID getID()
          Return the ID for this 'identifiable' object.
protected  java.util.Collection getListeners(IServiceTypeID aServiceType)
          Joins the Collection of IServiceListeners interested in any IServiceTypeID with the Collection of the IServiceListener registered for the given IServiceTypeID
 Namespace getServicesNamespace()
           
 IServiceInfo[] purgeCache()
           
 void removeServiceListener(IServiceListener aListener)
           
 void removeServiceListener(IServiceTypeID aType, IServiceListener aListener)
           
 void removeServiceTypeListener(IServiceTypeListener aListener)
           
 void unregisterAllServices()
           
 
Methods inherited from class org.eclipse.ecf.core.AbstractContainer
addListener, fireContainerEvent, getAdapter, getPasswordFromConnectContext, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ecf.discovery.IDiscoveryLocator
getServiceInfo, getServices, getServices, getServiceTypes
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.ecf.discovery.IDiscoveryAdvertiser
registerService, unregisterService
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.ecf.core.IContainer
connect, disconnect, getConnectedID
 

Field Detail

allServiceListeners

protected final java.util.Set allServiceListeners
Collection of service listeners i.e. Collection. NOTE: Access to this collection is synchronized, so subclasses should take this into account.


serviceListeners

protected final java.util.Map serviceListeners
Map of service type to collection of service listeners i.e. >. NOTE: Access to this map is synchronized, so subclasses should take this into account.


servicesNamespaceName

protected final java.lang.String servicesNamespaceName

serviceTypeListeners

protected final java.util.Collection serviceTypeListeners
Collection of service type listeners i.e. Collection. NOTE: Access to this collection is synchronized, so subclasses should take this into account.

Constructor Detail

AbstractDiscoveryContainerAdapter

public AbstractDiscoveryContainerAdapter(java.lang.String aNamespaceName,
                                         DiscoveryContainerConfig aConfig)
Parameters:
aNamespaceName -
aConfig -
Method Detail

addServiceListener

public void addServiceListener(IServiceListener aListener)
Specified by:
addServiceListener in interface org.eclipse.ecf.discovery.IDiscoveryLocator

addServiceListener

public void addServiceListener(IServiceTypeID aType,
                               IServiceListener aListener)
Specified by:
addServiceListener in interface org.eclipse.ecf.discovery.IDiscoveryLocator

addServiceTypeListener

public void addServiceTypeListener(IServiceTypeListener aListener)
Specified by:
addServiceTypeListener in interface org.eclipse.ecf.discovery.IDiscoveryLocator

clearListeners

protected void clearListeners()

dispose

public void dispose()
Description copied from interface: IContainer
Dispose this IContainer instance. The container instance will be made inactive after the completion of this method and will be unavailable for subsequent usage.

Specified by:
dispose in interface IContainer
Overrides:
dispose in class AbstractContainer

fireServiceDiscovered

protected void fireServiceDiscovered(IServiceEvent aServiceEvent)
Calls IServiceListener.serviceDiscovered(IServiceEvent) for all registered IServiceListener

Parameters:
aServiceEvent - The IServiceEvent to send along the call

fireServiceTypeDiscovered

protected void fireServiceTypeDiscovered(IServiceTypeEvent aServiceTypeEvent)
Calls IServiceTypeListener.serviceTypeDiscovered(IServiceTypeEvent) for all registered IServiceTypeListener

Parameters:
aServiceTypeEvent - The IServiceTypeEvent to send along the call

fireServiceUndiscovered

protected void fireServiceUndiscovered(IServiceEvent aServiceEvent)
Calls IServiceListener.serviceUndiscovered(IServiceEvent) for all registered IServiceListener

Parameters:
aServiceEvent - The IServiceEvent to send along the call

getConfig

protected DiscoveryContainerConfig getConfig()
Returns:
The DiscoveryContainerConfig of this IDiscoveryContainerAdapter

getConnectNamespace

public Namespace getConnectNamespace()
Description copied from interface: IContainer
Get the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls to IContainer.connect(ID, IConnectContext). If this method returns null, then it means that null is expected as a valid parameter in subsequent calls to IContainer.connect(ID, IConnectContext). If this method returns a non-null Namespace, then the targetID parameter in IContainer.connect(ID, IConnectContext) must be non-null instance created of the returned Namespace.

Specified by:
getConnectNamespace in interface IContainer
Returns:
Namespace the namespace associated with subsequent calls to IContainer.connect(ID, IConnectContext). If null, then the targetID instances passed to IContainer.connect(ID, IConnectContext) may be null. If not null, then targetID instances passed to IContainer.connect(ID, IConnectContext) must be instances of the returned Namespace.

getID

public ID getID()
Description copied from interface: IIdentifiable
Return the ID for this 'identifiable' object. The returned ID should be unique within its namespace. May return null.

Specified by:
getID in interface IIdentifiable
Returns:
the ID for this identifiable object. May return null.

getListeners

protected java.util.Collection getListeners(IServiceTypeID aServiceType)
Joins the Collection of IServiceListeners interested in any IServiceTypeID with the Collection of the IServiceListener registered for the given IServiceTypeID

Parameters:
aServiceType - The IServiceTypeID for which the IServiceListeners are returned
Returns:
All IServiceListeners interested in the given IServiceTypeID

getServicesNamespace

public Namespace getServicesNamespace()
Specified by:
getServicesNamespace in interface org.eclipse.ecf.discovery.IDiscoveryAdvertiser
Specified by:
getServicesNamespace in interface org.eclipse.ecf.discovery.IDiscoveryLocator

removeServiceListener

public void removeServiceListener(IServiceListener aListener)
Specified by:
removeServiceListener in interface org.eclipse.ecf.discovery.IDiscoveryLocator

removeServiceListener

public void removeServiceListener(IServiceTypeID aType,
                                  IServiceListener aListener)
Specified by:
removeServiceListener in interface org.eclipse.ecf.discovery.IDiscoveryLocator

removeServiceTypeListener

public void removeServiceTypeListener(IServiceTypeListener aListener)
Specified by:
removeServiceTypeListener in interface org.eclipse.ecf.discovery.IDiscoveryLocator

unregisterAllServices

public void unregisterAllServices()
Specified by:
unregisterAllServices in interface org.eclipse.ecf.discovery.IDiscoveryAdvertiser
Since:
3.0
See Also:
IDiscoveryAdvertiser.unregisterAllServices()

purgeCache

public IServiceInfo[] purgeCache()
Specified by:
purgeCache in interface org.eclipse.ecf.discovery.IDiscoveryLocator
Since:
3.0
See Also:
IDiscoveryLocator.purgeCache()

getAsyncServiceInfo

public org.eclipse.equinox.concurrent.future.IFuture getAsyncServiceInfo(IServiceID service)
Specified by:
getAsyncServiceInfo in interface org.eclipse.ecf.discovery.IDiscoveryLocator
Since:
3.0
See Also:
IDiscoveryLocator.getAsyncServiceInfo(org.eclipse.ecf.discovery.identity.IServiceID)

getAsyncServiceTypes

public org.eclipse.equinox.concurrent.future.IFuture getAsyncServiceTypes()
Specified by:
getAsyncServiceTypes in interface org.eclipse.ecf.discovery.IDiscoveryLocator
Since:
3.0
See Also:
IDiscoveryLocator.getAsyncServiceTypes()

getAsyncServices

public org.eclipse.equinox.concurrent.future.IFuture getAsyncServices()
Specified by:
getAsyncServices in interface org.eclipse.ecf.discovery.IDiscoveryLocator
Since:
3.0
See Also:
IDiscoveryLocator.getAsyncServices()

getAsyncServices

public org.eclipse.equinox.concurrent.future.IFuture getAsyncServices(IServiceTypeID type)
Specified by:
getAsyncServices in interface org.eclipse.ecf.discovery.IDiscoveryLocator
Since:
3.0
See Also:
IDiscoveryLocator.getAsyncServices(org.eclipse.ecf.discovery.identity.IServiceTypeID)