org.eclipse.ecf.osgi.services.remoteserviceadmin
Class ServiceInfoFactory

java.lang.Object
  extended by org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractMetadataFactory
      extended by org.eclipse.ecf.osgi.services.remoteserviceadmin.ServiceInfoFactory
All Implemented Interfaces:
IServiceInfoFactory

public class ServiceInfoFactory
extends AbstractMetadataFactory
implements IServiceInfoFactory

Default implementation of IServiceInfoFactory.


Nested Class Summary
protected  class ServiceInfoFactory.ServiceInfoKey
           
 
Field Summary
protected  java.util.Map<ServiceInfoFactory.ServiceInfoKey,IServiceInfo> serviceInfos
           
 
Fields inherited from class org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractMetadataFactory
LIST_SEPARATOR
 
Constructor Summary
ServiceInfoFactory()
           
 
Method Summary
 void close()
           
protected  java.lang.String createDefaultServiceName(EndpointDescription endpointDescription, IDiscoveryAdvertiser advertiser, IServiceTypeID serviceTypeID)
           
 IServiceInfo createServiceInfo(IDiscoveryAdvertiser advertiser, EndpointDescription endpointDescription)
          Create an service info instance to represent the given endpointDescription for discovery using the given discovery advertiser.
protected  IServiceInfo createServiceInfo(java.net.URI uri, java.lang.String serviceName, IServiceTypeID serviceTypeID, IServiceProperties serviceProperties)
           
protected  java.lang.String createServiceName(EndpointDescription endpointDescription, IDiscoveryAdvertiser advertiser, IServiceTypeID serviceTypeID)
           
protected  IServiceProperties createServiceProperties(EndpointDescription endpointDescription, IDiscoveryAdvertiser advertiser, IServiceTypeID serviceTypeID, java.lang.String serviceName, java.net.URI uri)
           
protected  IServiceTypeID createServiceTypeID(EndpointDescription endpointDescription, IDiscoveryAdvertiser advertiser)
           
protected  java.net.URI createURI(EndpointDescription endpointDescription, IDiscoveryAdvertiser advertiser, IServiceTypeID serviceTypeID, java.lang.String serviceName)
           
 IServiceInfo removeServiceInfo(IDiscoveryAdvertiser advertiser, EndpointDescription endpointDescription)
          Remove any previously created service info that is associated with the given endpointDescription (and advertiser).
 
Methods inherited from class org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractMetadataFactory
decodeEndpointDescription, decodeList, decodeLong, decodeNonStandardServiceProperties, decodeOSGiProperties, decodeString, encodeList, encodeLong, encodeNonStandardServiceProperties, encodeOSGiServiceProperties, encodeServiceProperties, encodeString, logError, logWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serviceInfos

protected java.util.Map<ServiceInfoFactory.ServiceInfoKey,IServiceInfo> serviceInfos
Constructor Detail

ServiceInfoFactory

public ServiceInfoFactory()
Method Detail

createServiceInfo

public IServiceInfo createServiceInfo(IDiscoveryAdvertiser advertiser,
                                      EndpointDescription endpointDescription)
Description copied from interface: IServiceInfoFactory
Create an service info instance to represent the given endpointDescription for discovery using the given discovery advertiser.

Specified by:
createServiceInfo in interface IServiceInfoFactory
Parameters:
advertiser - the advertiser to use for creating the service info result. Must not be null.
endpointDescription - the endpoint description that the service info is to represent. Must not be null.
Returns:
IServiceInfo to use to publish the endpointDescription for discovery (via IDiscoveryAdvertiser.registerService(IServiceInfo). If a service info instance has previously been created for the given endpointDescription by this service info factory, then that serviceInfo will be returned in favor of creating a new one. Otherwise, a new service info will be created and returned. If some error occurs in the creation of the serviceInfo, null will be returned.

createServiceInfo

protected IServiceInfo createServiceInfo(java.net.URI uri,
                                         java.lang.String serviceName,
                                         IServiceTypeID serviceTypeID,
                                         IServiceProperties serviceProperties)

createServiceProperties

protected IServiceProperties createServiceProperties(EndpointDescription endpointDescription,
                                                     IDiscoveryAdvertiser advertiser,
                                                     IServiceTypeID serviceTypeID,
                                                     java.lang.String serviceName,
                                                     java.net.URI uri)

createURI

protected java.net.URI createURI(EndpointDescription endpointDescription,
                                 IDiscoveryAdvertiser advertiser,
                                 IServiceTypeID serviceTypeID,
                                 java.lang.String serviceName)
                          throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

createServiceName

protected java.lang.String createServiceName(EndpointDescription endpointDescription,
                                             IDiscoveryAdvertiser advertiser,
                                             IServiceTypeID serviceTypeID)

createDefaultServiceName

protected java.lang.String createDefaultServiceName(EndpointDescription endpointDescription,
                                                    IDiscoveryAdvertiser advertiser,
                                                    IServiceTypeID serviceTypeID)

createServiceTypeID

protected IServiceTypeID createServiceTypeID(EndpointDescription endpointDescription,
                                             IDiscoveryAdvertiser advertiser)

removeServiceInfo

public IServiceInfo removeServiceInfo(IDiscoveryAdvertiser advertiser,
                                      EndpointDescription endpointDescription)
Description copied from interface: IServiceInfoFactory
Remove any previously created service info that is associated with the given endpointDescription (and advertiser).

Specified by:
removeServiceInfo in interface IServiceInfoFactory
Parameters:
advertiser - the advertiser associated with the service info previously created. Must not be null.
endpointDescription - the endpoint description that the service info was previously created for. Must not be null.
Returns:
IServiceInfo to use to unpublish the endpointDescription for discovery (via {@link IDiscoveryAdvertiser#unregisterService(IServiceInfo)). If null no service info exists that had previously been created for the given endpointDescription and advertiser.

close

public void close()
Overrides:
close in class AbstractMetadataFactory