public abstract class AbstractDiscoveryContainerAdapter extends AbstractContainer implements IDiscoveryLocator, IDiscoveryAdvertiser
Modifier and Type | Field and Description |
---|---|
protected java.util.Set |
allServiceListeners
Collection of service listeners.
|
protected java.util.Map |
serviceListeners
Map of service type to collection of service listeners.
|
protected java.lang.String |
servicesNamespaceName |
protected java.util.Collection |
serviceTypeListeners
Collection of service type listeners.
|
CONTAINER_NAME
CONTAINER_NAME
Constructor and Description |
---|
AbstractDiscoveryContainerAdapter(java.lang.String aNamespaceName,
DiscoveryContainerConfig aConfig) |
Modifier and Type | Method and Description |
---|---|
void |
addServiceListener(IServiceListener aListener)
Add a service listener.
|
void |
addServiceListener(IServiceTypeID aType,
IServiceListener aListener)
Add a service listener.
|
void |
addServiceTypeListener(IServiceTypeListener aListener)
Add a service type listener.
|
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)
Asynchronously retrieve info about the service
|
org.eclipse.equinox.concurrent.future.IFuture |
getAsyncServices()
Asynchronously get service info about all known services
|
org.eclipse.equinox.concurrent.future.IFuture |
getAsyncServices(IServiceTypeID type)
Asynchronously get service info about all known services of given service
type
|
org.eclipse.equinox.concurrent.future.IFuture |
getAsyncServiceTypes()
Asynchronously get service info about all known services of given service
type
|
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) . |
abstract java.lang.String |
getContainerName() |
ID |
getID()
Return the ID for this 'identifiable' object.
|
protected java.util.Collection |
getListeners(IServiceTypeID aServiceType)
Joins the
Collection of IServiceListener s interested in
any IServiceTypeID with the Collection of the
IServiceListener registered for the given IServiceTypeID |
protected IServiceEvent |
getServiceEvent(IServiceInfo iServiceInfo,
ID id) |
Namespace |
getServicesNamespace()
Get a Namespace for services associated with this discovery container
adapter.
|
IServiceInfo[] |
purgeCache()
Purges the underlying IServiceInfo cache if available in the current
provider
|
void |
removeServiceListener(IServiceListener aListener)
Remove a service listener.
|
void |
removeServiceListener(IServiceTypeID aType,
IServiceListener aListener)
Remove a service listener.
|
void |
removeServiceTypeListener(IServiceTypeListener aListener)
Remove a service type listener.
|
void |
unregisterAllServices()
Unregister all previously registered service.
|
addListener, fireContainerEvent, getAdapter, getPasswordFromConnectContext, removeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getServiceInfo, getServices, getServices, getServiceTypes
registerService, unregisterService
connect, disconnect, getConnectedID
protected final java.util.Set allServiceListeners
protected final java.util.Map serviceListeners
protected final java.lang.String servicesNamespaceName
protected final java.util.Collection serviceTypeListeners
public AbstractDiscoveryContainerAdapter(java.lang.String aNamespaceName, DiscoveryContainerConfig aConfig)
aNamespaceName
- namespace nameaConfig
- discovery container configpublic void addServiceListener(IServiceListener aListener)
IDiscoveryLocator
addServiceListener
in interface IDiscoveryLocator
aListener
- IServiceListener to be notified. Must not be null
.protected IServiceEvent getServiceEvent(IServiceInfo iServiceInfo, ID id)
iServiceInfo
- service infoid
- idpublic void addServiceListener(IServiceTypeID aType, IServiceListener aListener)
IDiscoveryLocator
addServiceListener
in interface IDiscoveryLocator
aType
- String type to listen for. Must not be null
. Must
be formatted according to this specific IDiscoveryContaineraListener
- IServiceListener to be notified. Must not be null
.public void addServiceTypeListener(IServiceTypeListener aListener)
IDiscoveryLocator
addServiceTypeListener
in interface IDiscoveryLocator
aListener
- the listener to be notified. Must not be null
.protected void clearListeners()
public void dispose()
IContainer
dispose
in interface IContainer
dispose
in class AbstractContainer
protected void fireServiceDiscovered(IServiceEvent aServiceEvent)
IServiceListener.serviceDiscovered(IServiceEvent)
for all
registered IServiceListener
aServiceEvent
- The IServiceEvent
to send along the callprotected void fireServiceTypeDiscovered(IServiceTypeEvent aServiceTypeEvent)
IServiceTypeListener.serviceTypeDiscovered(IServiceTypeEvent)
for
all registered IServiceTypeListener
aServiceTypeEvent
- The IServiceTypeEvent
to send along the callprotected void fireServiceUndiscovered(IServiceEvent aServiceEvent)
IServiceListener.serviceUndiscovered(IServiceEvent)
for all
registered IServiceListener
aServiceEvent
- The IServiceEvent
to send along the callprotected DiscoveryContainerConfig getConfig()
DiscoveryContainerConfig
of this
IDiscoveryContainerAdapter
public Namespace getConnectNamespace()
IContainer
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.getConnectNamespace
in interface IContainer
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.public ID getID()
IIdentifiable
null
.getID
in interface IIdentifiable
null
.public abstract java.lang.String getContainerName()
protected java.util.Collection getListeners(IServiceTypeID aServiceType)
Collection
of IServiceListener
s interested in
any IServiceTypeID
with the Collection
of the
IServiceListener
registered for the given IServiceTypeID
aServiceType
- The IServiceTypeID
for which the
IServiceListener
s are returnedIServiceListener
s interested in the given
IServiceTypeID
public Namespace getServicesNamespace()
IDiscoveryLocator
IServiceID serviceID = ServiceIDFactory.getDefault().createServiceID(container.getServicesNamespace(), serviceType, serviceName);
getServicesNamespace
in interface IDiscoveryAdvertiser
getServicesNamespace
in interface IDiscoveryLocator
null
.public void removeServiceListener(IServiceListener aListener)
IDiscoveryLocator
removeServiceListener
in interface IDiscoveryLocator
aListener
- IServiceListener listener to be removed. Must not be
null
.public void removeServiceListener(IServiceTypeID aType, IServiceListener aListener)
IDiscoveryLocator
removeServiceListener
in interface IDiscoveryLocator
aType
- String of the desired type to remove the listener. Must not be
null
. Must be formatted according to this
specific IDiscoveryContaineraListener
- IServiceListener listener to be removed. Must not be
null
.public void removeServiceTypeListener(IServiceTypeListener aListener)
IDiscoveryLocator
removeServiceTypeListener
in interface IDiscoveryLocator
aListener
- IServiceTypeListener to be removed. Must not be
null
.public void unregisterAllServices()
IDiscoveryAdvertiser
unregisterAllServices
in interface IDiscoveryAdvertiser
IDiscoveryAdvertiser.unregisterAllServices()
public IServiceInfo[] purgeCache()
IDiscoveryLocator
purgeCache
in interface IDiscoveryLocator
IDiscoveryLocator.purgeCache()
public org.eclipse.equinox.concurrent.future.IFuture getAsyncServiceInfo(IServiceID service)
IDiscoveryLocator
getAsyncServiceInfo
in interface IDiscoveryLocator
service
- IServiceID of the service to get info about. Must not be
null
.null
if no information retrievable.IDiscoveryLocator.getAsyncServiceInfo(org.eclipse.ecf.discovery.identity.IServiceID)
public org.eclipse.equinox.concurrent.future.IFuture getAsyncServiceTypes()
IDiscoveryLocator
getAsyncServiceTypes
in interface IDiscoveryLocator
null
. May be of length
0.IDiscoveryLocator.getAsyncServiceTypes()
public org.eclipse.equinox.concurrent.future.IFuture getAsyncServices()
IDiscoveryLocator
getAsyncServices
in interface IDiscoveryLocator
null
. May be of length
0.IDiscoveryLocator.getAsyncServices()
public org.eclipse.equinox.concurrent.future.IFuture getAsyncServices(IServiceTypeID type)
IDiscoveryLocator
getAsyncServices
in interface IDiscoveryLocator
type
- IServiceTypeID defining the type of service we are interested
in getting service info about. Must not be null
null
. May be of length
0.IDiscoveryLocator.getAsyncServices(org.eclipse.ecf.discovery.identity.IServiceTypeID)