org.eclipse.ecf.provider.dnssd
Class DnsSdDiscoveryContainerAdapter

java.lang.Object
  extended by org.eclipse.ecf.core.AbstractContainer
      extended by org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapter
          extended by org.eclipse.ecf.provider.dnssd.DnsSdDiscoveryContainerAdapter
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IContainer, IIdentifiable, IDiscoveryAdvertiser, IDiscoveryLocator
Direct Known Subclasses:
DnsSdDiscoveryAdvertiser, DnsSdDiscoveryLocator

public abstract class DnsSdDiscoveryContainerAdapter
extends AbstractDiscoveryContainerAdapter


Nested Class Summary
protected  class DnsSdDiscoveryContainerAdapter.SRVRecordComparator
           
 
Field Summary
protected  org.xbill.DNS.Resolver resolver
           
protected  DnsSdServiceTypeID targetID
           
 
Fields inherited from class org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapter
allServiceListeners, serviceListeners, servicesNamespaceName, serviceTypeListeners
 
Fields inherited from interface org.eclipse.ecf.discovery.IDiscoveryLocator
CONTAINER_NAME
 
Fields inherited from interface org.eclipse.ecf.discovery.IDiscoveryAdvertiser
CONTAINER_NAME
 
Constructor Summary
DnsSdDiscoveryContainerAdapter(java.lang.String aNamespaceName, DiscoveryContainerConfig aConfig)
           
 
Method Summary
abstract  void connect(ID targetID, IConnectContext connectContext)
          Connect to a target remote process or process group.
 void disconnect()
          Disconnect.
protected  java.util.Collection getBrowsingOrRegistrationDomains(IServiceTypeID aServiceTypeId, java.lang.String[] rrs)
           
 ID getConnectedID()
          Get the target ID that this container instance has connected to.
protected  org.xbill.DNS.Record[] getRecords(DnsSdServiceTypeID serviceTypeId)
           
 java.lang.String[] getSearchPath()
           
 IServiceInfo getServiceInfo(IServiceID aServiceId)
          Synchronously retrieve info about the service
 IServiceInfo[] getServices()
          Synchronously get service info about all known services
 IServiceInfo[] getServices(IServiceTypeID aServiceTypeId)
          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
protected  java.util.SortedSet getSRVRecord(org.xbill.DNS.Lookup query, java.util.Comparator aComparator)
           
protected  java.util.SortedSet getSRVRecords(org.xbill.DNS.Lookup[] queries)
           
protected  java.util.SortedSet getSRVRecords(org.xbill.DNS.Lookup[] queries, java.util.Comparator aComparator)
           
 void registerService(IServiceInfo serviceInfo)
          Register the given service.
 void setResolver(java.lang.String aResolver)
           
 void setSearchPath(java.lang.String[] searchPaths)
           
 void setTsigKey(java.lang.String tsigKeyName, java.lang.String tsigKey)
           
 void unregisterService(IServiceInfo serviceInfo)
          Unregister a previously registered service defined by serviceInfo.
 
Methods inherited from class org.eclipse.ecf.discovery.AbstractDiscoveryContainerAdapter
addServiceListener, addServiceListener, addServiceTypeListener, clearListeners, dispose, fireServiceDiscovered, fireServiceTypeDiscovered, fireServiceUndiscovered, getAsyncServiceInfo, getAsyncServices, getAsyncServices, getAsyncServiceTypes, getConfig, getConnectNamespace, getContainerName, getID, getListeners, getServicesNamespace, purgeCache, 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.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

resolver

protected org.xbill.DNS.Resolver resolver

targetID

protected DnsSdServiceTypeID targetID
Constructor Detail

DnsSdDiscoveryContainerAdapter

public DnsSdDiscoveryContainerAdapter(java.lang.String aNamespaceName,
                                      DiscoveryContainerConfig aConfig)
Method Detail

getServiceInfo

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

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

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

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

getServices

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

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

registerService

public void registerService(IServiceInfo serviceInfo)
Description copied from interface: IDiscoveryAdvertiser
Register 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.

unregisterService

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

Parameters:
serviceInfo - IServiceInfo defining the service to unregister. Must not be null.

connect

public abstract void connect(ID targetID,
                             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.

Parameters:
targetID - 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.

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.

Returns:
ID of the target we are connected to. Returns null if container not 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.


getBrowsingOrRegistrationDomains

protected java.util.Collection getBrowsingOrRegistrationDomains(IServiceTypeID aServiceTypeId,
                                                                java.lang.String[] rrs)

getRecords

protected org.xbill.DNS.Record[] getRecords(DnsSdServiceTypeID serviceTypeId)

getSRVRecords

protected java.util.SortedSet getSRVRecords(org.xbill.DNS.Lookup[] queries)

getSRVRecords

protected java.util.SortedSet getSRVRecords(org.xbill.DNS.Lookup[] queries,
                                            java.util.Comparator aComparator)

getSRVRecord

protected java.util.SortedSet getSRVRecord(org.xbill.DNS.Lookup query,
                                           java.util.Comparator aComparator)

setSearchPath

public void setSearchPath(java.lang.String[] searchPaths)
Parameters:
searchPaths - The default search path used for discovery

getSearchPath

public java.lang.String[] getSearchPath()
Returns:
The default search path used by this discovery provider

setResolver

public void setResolver(java.lang.String aResolver)
Parameters:
aResolver - The resolver to use
Throws:
DnsSdDiscoveryException - if hostname cannot be resolved

setTsigKey

public void setTsigKey(java.lang.String tsigKeyName,
                       java.lang.String tsigKey)
Parameters:
tsigKeyName - A key name/user name for dns dynamic update
tsigKey - A string representation of the shared key