org.eclipse.ecf.provider.jslp.container
Class JSLPDiscoveryContainer

java.lang.Object
  extended by org.eclipse.ecf.core.AbstractContainer
      extended by org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapter
          extended by org.eclipse.ecf.provider.jslp.container.JSLPDiscoveryContainer
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IContainer, IIdentifiable, IDiscoveryAdvertiser, IDiscoveryContainerAdapter, IDiscoveryLocator, IDiscoveryService

public class JSLPDiscoveryContainer
extends AbstractDiscoveryContainerAdapter
implements IDiscoveryService


Field Summary
static java.lang.String NAME
           
static long REDISCOVER
           
 
Fields inherited from class org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapter
allServiceListeners, serviceListeners, servicesNamespaceName, serviceTypeListeners
 
Fields inherited from interface org.eclipse.ecf.discovery.service.IDiscoveryService
CONTAINER_ID, CONTAINER_NAME
 
Constructor Summary
JSLPDiscoveryContainer()
           
 
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.
 void connect(ID aTargetID, IConnectContext connectContext)
          Connect to a target remote process or process group.
 void disconnect()
          Disconnect.
 void fireServiceDiscovered(IServiceInfo iinfo)
           
 void fireServiceTypeDiscovered(IServiceTypeID serviceTypeID)
           
 void fireServiceUndiscovered(IServiceInfo iinfo)
           
 ID getConnectedID()
          Get the target ID that this container instance has connected to.
 java.lang.String getContainerName()
           
 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
 IServiceTypeID[] getServiceTypes()
          Synchronously get service info about all known services of given service type
 IServiceInfo[] purgeCache()
          Purges the underlying IServiceInfo cache if available in the current provider
 void registerService(IServiceInfo aServiceInfo)
          Register the given service.
 void unregisterService(IServiceInfo aServiceInfo)
          Unregister a previously registered service defined by serviceInfo.
 
Methods inherited from class org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapter
clearListeners, dispose, fireServiceDiscovered, fireServiceTypeDiscovered, fireServiceUndiscovered, getAsyncServiceInfo, getAsyncServices, getAsyncServices, getAsyncServiceTypes, getConfig, getConnectNamespace, getID, getListeners, getServicesNamespace, removeServiceListener, removeServiceListener, removeServiceTypeListener, 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
getAsyncServiceInfo, getAsyncServices, getAsyncServices, getAsyncServiceTypes, getServicesNamespace, removeServiceListener, removeServiceListener, removeServiceTypeListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.ecf.discovery.IDiscoveryAdvertiser
getServicesNamespace, unregisterAllServices
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

NAME

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

REDISCOVER

public static long REDISCOVER
Constructor Detail

JSLPDiscoveryContainer

public JSLPDiscoveryContainer()
Method Detail

connect

public void connect(ID aTargetID,
                    IConnectContext connectContext)
             throws ContainerConnectException
Description copied from interface: IContainer
Connect to a target remote process or process group. The target identified by the first parameter (targetID) is connected the implementation class. If authentication information is required, the required information is given via via the second parameter (connectContext). Callers note that depending upon the provider implementation this method may block. It is suggested that callers use a separate thread to call this method. This method provides an implementation independent way for container implementations to connect, authenticate, and communicate with a remote service or group of services. Providers are responsible for implementing this operation in a way appropriate to the given remote service (or group) via expected protocol.

Specified by:
connect in interface IContainer
Parameters:
aTargetID - the ID of the remote server or group to connect to. See IContainer.getConnectNamespace() for a explanation of the constraints upon this parameter.
connectContext - any required context to allow this container to authenticate. May be null if underlying provider does not have any authentication requirements for connection.
Throws:
ContainerConnectException - thrown if communication cannot be established with remote service. Causes can include network connection failure, authentication failure, server error, or if container is already connected.

disconnect

public void disconnect()
Description copied from interface: IContainer
Disconnect. This operation will disconnect the local container instance from any previously joined target or group. Subsequent calls to getConnectedID() will return null.

Specified by:
disconnect in interface IContainer

fireServiceDiscovered

public void fireServiceDiscovered(IServiceInfo iinfo)

fireServiceTypeDiscovered

public void fireServiceTypeDiscovered(IServiceTypeID serviceTypeID)

fireServiceUndiscovered

public void fireServiceUndiscovered(IServiceInfo iinfo)

getConnectedID

public ID getConnectedID()
Description copied from interface: IContainer
Get the target ID that this container instance has connected to. Returns null if not connected.

Specified by:
getConnectedID in interface IContainer
Returns:
ID of the target we are connected to. Returns null if container not connected.

getServiceInfo

public IServiceInfo getServiceInfo(IServiceID service)
Description copied from interface: IDiscoveryLocator
Synchronously retrieve info about the service

Specified by:
getServiceInfo in interface IDiscoveryLocator
Returns:
IServiceInfo the service info retrieved. null if no information retrievable.

getServiceTypes

public IServiceTypeID[] getServiceTypes()
Description copied from interface: IDiscoveryLocator
Synchronously get service info about all known services of given service type

Specified by:
getServiceTypes in interface IDiscoveryLocator
Returns:
IServiceTypeID[] the resulting array of service type IDs. Will not be null. May be of length 0.

getServices

public IServiceInfo[] getServices()
Description copied from interface: IDiscoveryLocator
Synchronously get service info about all known services

Specified by:
getServices in interface IDiscoveryLocator
Returns:
IServiceInfo[] the resulting array of service info instances. Will not be null. May be of length 0.

getServices

public IServiceInfo[] getServices(IServiceTypeID type)
Description copied from interface: IDiscoveryLocator
Synchronously get service info about all known services of given service type

Specified by:
getServices in interface IDiscoveryLocator
Returns:
IServiceInfo[] the resulting array of service info instances. Will not be null. May be of length 0.

registerService

public void registerService(IServiceInfo aServiceInfo)
Description copied from interface: IDiscoveryAdvertiser
Register the given service. This publishes the service defined by the serviceInfo to the underlying publishing mechanism

Specified by:
registerService in interface IDiscoveryAdvertiser
Parameters:
aServiceInfo - IServiceInfo of the service to be published. Must not be null.

unregisterService

public void unregisterService(IServiceInfo aServiceInfo)
Description copied from interface: IDiscoveryAdvertiser
Unregister a previously registered service defined by serviceInfo.

Specified by:
unregisterService in interface IDiscoveryAdvertiser
Parameters:
aServiceInfo - IServiceInfo defining the service to unregister. Must not be null.

purgeCache

public IServiceInfo[] purgeCache()
Description copied from interface: IDiscoveryLocator
Purges the underlying IServiceInfo cache if available in the current provider

Specified by:
purgeCache in interface IDiscoveryLocator
Overrides:
purgeCache in class AbstractDiscoveryContainerAdapter
Returns:
The previous cache content
See Also:
IDiscoveryLocator.purgeCache()

addServiceListener

public void addServiceListener(IServiceListener listener)
Description copied from interface: IDiscoveryLocator
Add a service listener. The given listener will have its method called when a service is discovered.

Specified by:
addServiceListener in interface IDiscoveryLocator
Overrides:
addServiceListener in class AbstractDiscoveryContainerAdapter
Parameters:
listener - IServiceListener to be notified. Must not be null .

addServiceListener

public void addServiceListener(IServiceTypeID type,
                               IServiceListener listener)
Description copied from interface: IDiscoveryLocator
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.

Specified by:
addServiceListener in interface IDiscoveryLocator
Overrides:
addServiceListener in class AbstractDiscoveryContainerAdapter
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

public void addServiceTypeListener(IServiceTypeListener listener)
Description copied from interface: IDiscoveryLocator
Add a service type listener. The given listener will have its method called when a service type is discovered.

Specified by:
addServiceTypeListener in interface IDiscoveryLocator
Overrides:
addServiceTypeListener in class AbstractDiscoveryContainerAdapter
Parameters:
listener - the listener to be notified. Must not be null.

getContainerName

public java.lang.String getContainerName()
Specified by:
getContainerName in class AbstractDiscoveryContainerAdapter
Returns:
The name of this discovery container