org.eclipse.ecf.discovery
Interface IDiscoveryContainerAdapter

All Superinterfaces:
org.eclipse.core.runtime.IAdaptable
All Known Subinterfaces:
IDiscoveryService
All Known Implementing Classes:
AbstractDiscoveryContainerAdapter, CompositeDiscoveryContainer, JMDNSDiscoveryContainer, JSLPDiscoveryContainer, SingletonDiscoveryContainer

public interface IDiscoveryContainerAdapter
extends org.eclipse.core.runtime.IAdaptable

Entry point discovery container adapter. This interface exposes the ability to add/remove listeners for newly discovered services and service types, register and unregister locally provided services, and get (synch) and request (asynchronous) service info from a remote service provider.

This interface can be used by container provider implementations as an adapter so that calls to IContainer.getAdapter(IDiscoveryContainerAdapter.class) will return a non-null instance of a class that implements this interface. Clients can then proceed to use this interface to interact with the given discovery implementation.


Field Summary
static java.lang.String CONTAINER_CONNECT_REQUIRES_PASSWORD
           
static java.lang.String CONTAINER_CONNECT_TARGET
           
static java.lang.String CONTAINER_CONNECT_TARGET_PATH
           
static java.lang.String CONTAINER_CONNECT_TARGET_PROTOCOL
           
static java.lang.String CONTAINER_FACTORY_NAME_PROPERTY
          ECF Service Property Names
 
Method Summary
 void addServiceListener(IServiceListener listener)
          Add a service listener.
 void addServiceListener(IServiceTypeID type, IServiceListener listener)
          Add a service listener.
 void addServiceTypeListener(IServiceTypeListener listener)
          Add a service type listener.
 IServiceInfo getServiceInfo(IServiceID service)
          Synchronously retrieve info about the service
 IServiceInfo[] getServices()
          Synchronously get service info about all known services
 IServiceInfo[] getServices(IServiceTypeID type)
          Synchronously get service info about all known services of given service type
 Namespace getServicesNamespace()
          Get a Namespace for services associated with this discovery container adapter.
 IServiceTypeID[] getServiceTypes()
          Synchronously get service info about all known services of given service type
 void registerService(IServiceInfo serviceInfo)
          Register the given service.
 void removeServiceListener(IServiceListener listener)
          Remove a service listener.
 void removeServiceListener(IServiceTypeID type, IServiceListener listener)
          Remove a service listener.
 void removeServiceTypeListener(IServiceTypeListener listener)
          Remove a service type listener.
 void unregisterService(IServiceInfo serviceInfo)
          Unregister a previously registered service defined by serviceInfo.
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

CONTAINER_FACTORY_NAME_PROPERTY

static final java.lang.String CONTAINER_FACTORY_NAME_PROPERTY
ECF Service Property Names

See Also:
Constant Field Values

CONTAINER_CONNECT_TARGET

static final java.lang.String CONTAINER_CONNECT_TARGET
See Also:
Constant Field Values

CONTAINER_CONNECT_TARGET_PROTOCOL

static final java.lang.String CONTAINER_CONNECT_TARGET_PROTOCOL
See Also:
Constant Field Values

CONTAINER_CONNECT_TARGET_PATH

static final java.lang.String CONTAINER_CONNECT_TARGET_PATH
See Also:
Constant Field Values

CONTAINER_CONNECT_REQUIRES_PASSWORD

static final java.lang.String CONTAINER_CONNECT_REQUIRES_PASSWORD
See Also:
Constant Field Values
Method Detail

addServiceListener

void addServiceListener(IServiceListener listener)
Add a service listener. The given listener will have its method called when a service is discovered.

Parameters:
listener - IServiceListener to be notified. Must not be null.

addServiceListener

void addServiceListener(IServiceTypeID type,
                        IServiceListener listener)
Add a service listener. The given listener will have its method called when a service with a type matching that specified by the first parameter is discovered.

Parameters:
type - String type to listen for. Must not be null. Must be formatted according to this specific IDiscoveryContainer
listener - IServiceListener to be notified. Must not be null.

addServiceTypeListener

void addServiceTypeListener(IServiceTypeListener listener)
Add a service type listener. The given listener will have its method called when a service type is discovered.

Parameters:
listener - the listener to be notified. Must not be null.

getServiceInfo

IServiceInfo getServiceInfo(IServiceID service)
Synchronously retrieve info about the service

Parameters:
service - IServiceID of the service to get info about. Must not be null.
Returns:
IServiceInfo the service info retrieved. null if no information retrievable.

getServices

IServiceInfo[] getServices()
Synchronously get service info about all known services

Returns:
IServiceInfo[] the resulting array of service info instances. Will not be null. May be of length 0.

getServices

IServiceInfo[] getServices(IServiceTypeID type)
Synchronously get service info about all known services of given service type

Parameters:
type - IServiceTypeID defining the type of service we are interested in getting service info about. Must not be null
Returns:
IServiceInfo[] the resulting array of service info instances. Will not be null. May be of length 0.

getServicesNamespace

Namespace getServicesNamespace()
Get a Namespace for services associated with this discovery container adapter. The given Namespace may be used via ServiceIDFactory to create IServiceIDs rather than simple IDs. For example:
 IServiceID serviceID = ServiceIDFactory.getDefault().createServiceID(container.getServicesNamespace(),serviceType,serviceName);
 

Returns:
Namespace for creating service IDs. Will not be null.

getServiceTypes

IServiceTypeID[] getServiceTypes()
Synchronously get service info about all known services of given service type

Returns:
IServiceTypeID[] the resulting array of service type IDs. Will not be null. May be of length 0.

registerService

void registerService(IServiceInfo serviceInfo)
                     throws ECFException
Register the given service. This publishes the service defined by the first parameter to the underlying publishing mechanism

Parameters:
serviceInfo - IServiceInfo of the service to be published. Must not be null.
Throws:
ECFException - if service info cannot be registered with this service

removeServiceListener

void removeServiceListener(IServiceListener listener)
Remove a service listener. Remove the listener from this container

Parameters:
listener - IServiceListener listener to be removed. Must not be null.

removeServiceListener

void removeServiceListener(IServiceTypeID type,
                           IServiceListener listener)
Remove a service listener. Remove the listener associated with the type specified by the first parameter.

Parameters:
type - String of the desired type to remove the listener. Must not be null. Must be formatted according to this specific IDiscoveryContainer
listener - IServiceListener listener to be removed. Must not be null.

removeServiceTypeListener

void removeServiceTypeListener(IServiceTypeListener listener)
Remove a service type listener. Remove the type listener.

Parameters:
listener - IServiceTypeListener to be removed. Must not be null.

unregisterService

void unregisterService(IServiceInfo serviceInfo)
                       throws ECFException
Unregister a previously registered service defined by serviceInfo.

Parameters:
serviceInfo - IServiceInfo defining the service to unregister. Must not be null.
Throws:
ECFException - if service info cannot be unregistered with this service