Class ZooDiscoveryContainer
- java.lang.Object
- 
- org.eclipse.ecf.core.AbstractContainer
- 
- org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapter
- 
- org.eclipse.ecf.provider.zookeeper.core.ZooDiscoveryContainer
 
 
 
- 
- All Implemented Interfaces:
- org.eclipse.core.runtime.IAdaptable,- IContainer,- IIdentifiable,- IDiscoveryAdvertiser,- IDiscoveryLocator
 
 public class ZooDiscoveryContainer extends AbstractDiscoveryContainerAdapter 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classZooDiscoveryContainer.FLAVOR
 - 
Field SummaryFields Modifier and Type Field Description protected org.eclipse.ecf.provider.zookeeper.core.internal.Advertiseradvertiserstatic ExecutorServiceCACHED_THREAD_POOLprotected booleanisQuorumPeerReadyprotected org.eclipse.ecf.provider.zookeeper.core.internal.Localizerlocalizer- 
Fields inherited from class org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapterallServiceListeners, serviceListeners, servicesNamespaceName, serviceTypeListeners
 - 
Fields inherited from interface org.eclipse.ecf.discovery.IDiscoveryAdvertiserCONTAINER_NAME
 - 
Fields inherited from interface org.eclipse.ecf.discovery.IDiscoveryLocatorCONTAINER_NAME
 
- 
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanautoStart()voidconnect(ID id, IConnectContext connectContext)Connect to a target remote process or process group.voiddisconnect()Disconnect.voiddispose()Dispose this IContainer instance.Collection<IServiceListener>getAllServiceListeners()IDgetConnectedID()Get the target ID that this container instance has connected to.NamespacegetConnectNamespace()Get the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls toIContainer.connect(ID, IConnectContext).StringgetContainerName()PropertiesgetDiscoveryProperties()IDgetID()Return the ID for this 'identifiable' object.org.apache.zookeeper.server.ZooKeeperServergetLocalServer()IServiceInfogetServiceInfo(IServiceID serviceID)Synchronously retrieve info about the serviceCollection<IServiceListener>getServiceListenersForType(IServiceTypeID type)IServiceInfo[]getServices()Synchronously get service info about all known servicesIServiceInfo[]getServices(IServiceTypeID type)Synchronously get service info about all known services of given service typeNamespacegetServicesNamespace()Get a Namespace for services associated with this discovery container adapter.Collection<IServiceTypeListener>getServiceTypeListeners()IServiceTypeID[]getServiceTypes()Synchronously get service info about all known services of given service typestatic ZooDiscoveryContainergetSingleton()voidinit(ServiceReference reference)booleanisDisposed()voidregisterService(IServiceInfo serviceInfo)Register the given service.voidsetDiscoveryProperties(Properties discoveryProperties)voidshutdown()voidunregisterAllServices()Unregister all previously registered service.voidunregisterService(IServiceInfo serviceInfo)Unregister a previously registered service defined by serviceInfo.- 
Methods inherited from class org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapteraddServiceListener, addServiceListener, addServiceTypeListener, clearListeners, fireServiceDiscovered, fireServiceTypeDiscovered, fireServiceUndiscovered, getAsyncServiceInfo, getAsyncServices, getAsyncServices, getAsyncServiceTypes, getConfig, getListeners, getServiceEvent, purgeCache, removeServiceListener, removeServiceListener, removeServiceTypeListener
 - 
Methods inherited from class org.eclipse.ecf.core.AbstractContaineraddListener, fireContainerEvent, getAdapter, getPasswordFromConnectContext, removeListener
 
- 
 
- 
- 
- 
Field Detail- 
CACHED_THREAD_POOLpublic static ExecutorService CACHED_THREAD_POOL 
 - 
advertiserprotected org.eclipse.ecf.provider.zookeeper.core.internal.Advertiser advertiser 
 - 
localizerprotected org.eclipse.ecf.provider.zookeeper.core.internal.Localizer localizer 
 - 
isQuorumPeerReadyprotected boolean isQuorumPeerReady 
 
- 
 - 
Method Detail- 
autoStartpublic static boolean autoStart() - Returns:
- true if the service is in autoStart mode.
 
 - 
getSingletonpublic static ZooDiscoveryContainer getSingleton() 
 - 
initpublic void init(ServiceReference reference) 
 - 
setDiscoveryPropertiespublic void setDiscoveryProperties(Properties discoveryProperties) 
 - 
getDiscoveryPropertiespublic Properties getDiscoveryProperties() 
 - 
shutdownpublic void shutdown() 
 - 
getLocalServerpublic org.apache.zookeeper.server.ZooKeeperServer getLocalServer() 
 - 
connectpublic void connect(ID id, IConnectContext connectContext) throws ContainerConnectException Description copied from interface:IContainerConnect 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.- Parameters:
- id- 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- nullif 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.
 
 - 
disconnectpublic void disconnect() Description copied from interface:IContainerDisconnect. This operation will disconnect the local container instance from any previously joined target or group. Subsequent calls to getConnectedID() will returnnull.
 - 
getConnectNamespacepublic Namespace getConnectNamespace() Description copied from interface:IContainerGet the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls toIContainer.connect(ID, IConnectContext). If this method returnsnull, then it means thatnullis expected as a valid parameter in subsequent calls toIContainer.connect(ID, IConnectContext). If this method returns a non-nullNamespace, then thetargetIDparameter inIContainer.connect(ID, IConnectContext)must be non-nullinstance created of the returned Namespace.- Specified by:
- getConnectNamespacein interface- IContainer
- Overrides:
- getConnectNamespacein class- AbstractDiscoveryContainerAdapter
- Returns:
- Namespace the namespace associated with subsequent calls to
         IContainer.connect(ID, IConnectContext). Ifnull, then thetargetIDinstances passed toIContainer.connect(ID, IConnectContext)may benull. If notnull, thentargetIDinstances passed toIContainer.connect(ID, IConnectContext)must be instances of the returned Namespace.
 
 - 
getConnectedIDpublic ID getConnectedID() Description copied from interface:IContainerGet the target ID that this container instance has connected to. Returns null if not connected.- Returns:
- ID of the target we are connected to. Returns nullif container not connected.
 
 - 
getServiceInfopublic IServiceInfo getServiceInfo(IServiceID serviceID) Description copied from interface:IDiscoveryLocatorSynchronously retrieve info about the service- Parameters:
- serviceID- IServiceID of the service to get info about. Must not be- null.
- Returns:
- IServiceInfo the service info retrieved. nullif no information retrievable.
 
 - 
getServiceTypespublic IServiceTypeID[] getServiceTypes() Description copied from interface:IDiscoveryLocatorSynchronously 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.
 
 - 
getServicespublic IServiceInfo[] getServices() Description copied from interface:IDiscoveryLocatorSynchronously 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.
 
 - 
getServicespublic IServiceInfo[] getServices(IServiceTypeID type) Description copied from interface:IDiscoveryLocatorSynchronously 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.
 
 - 
getServicesNamespacepublic Namespace getServicesNamespace() Description copied from interface:IDiscoveryLocatorGet a Namespace for services associated with this discovery container adapter. The given Namespace may be used via IServiceIDFactory to create IServiceIDs rather than simple IDs. For example:IServiceID serviceID = ServiceIDFactory.getDefault().createServiceID(container.getServicesNamespace(), serviceType, serviceName);- Specified by:
- getServicesNamespacein interface- IDiscoveryAdvertiser
- Specified by:
- getServicesNamespacein interface- IDiscoveryLocator
- Overrides:
- getServicesNamespacein class- AbstractDiscoveryContainerAdapter
- Returns:
- Namespace for creating service IDs. Will not be null.
 
 - 
registerServicepublic void registerService(IServiceInfo serviceInfo) Description copied from interface:IDiscoveryAdvertiserRegister the given service. This publishes the service defined by the serviceInfo to the underlying publishing mechanism- Parameters:
- serviceInfo- IServiceInfo of the service to be published. Must not be- null.
 
 - 
unregisterAllServicespublic void unregisterAllServices() Description copied from interface:IDiscoveryAdvertiserUnregister all previously registered service.- Specified by:
- unregisterAllServicesin interface- IDiscoveryAdvertiser
- Overrides:
- unregisterAllServicesin class- AbstractDiscoveryContainerAdapter
- See Also:
- IDiscoveryAdvertiser.unregisterAllServices()
 
 - 
unregisterServicepublic void unregisterService(IServiceInfo serviceInfo) Description copied from interface:IDiscoveryAdvertiserUnregister a previously registered service defined by serviceInfo.- Parameters:
- serviceInfo- IServiceInfo defining the service to unregister. Must not be- null.
 
 - 
getAllServiceListenerspublic Collection<IServiceListener> getAllServiceListeners() 
 - 
getServiceListenersForTypepublic Collection<IServiceListener> getServiceListenersForType(IServiceTypeID type) 
 - 
getServiceTypeListenerspublic Collection<IServiceTypeListener> getServiceTypeListeners() 
 - 
disposepublic void dispose() Description copied from interface:IContainerDispose 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:
- disposein interface- IContainer
- Overrides:
- disposein class- AbstractDiscoveryContainerAdapter
 
 - 
getIDpublic ID getID() Description copied from interface:IIdentifiableReturn the ID for this 'identifiable' object. The returned ID should be unique within its namespace. May returnnull.- Specified by:
- getIDin interface- IIdentifiable
- Overrides:
- getIDin class- AbstractDiscoveryContainerAdapter
- Returns:
- the ID for this identifiable object.  May return null.
 
 - 
isDisposedpublic boolean isDisposed() 
 - 
getContainerNamepublic String getContainerName() - Specified by:
- getContainerNamein class- AbstractDiscoveryContainerAdapter
- Returns:
- The name of this discovery container
 
 
- 
 
-