org.eclipse.ecf.discovery
Class ServiceInfo

java.lang.Object
  extended by org.eclipse.ecf.discovery.ServiceInfo
All Implemented Interfaces:
java.io.Serializable, org.eclipse.core.runtime.IAdaptable, IServiceInfo
Direct Known Subclasses:
AdvertisedService, DiscoverdService, JSLPServiceInfo

public class ServiceInfo
extends java.lang.Object
implements IServiceInfo, java.io.Serializable

Base implementation of IServiceInfo. Subclasses may be created as appropriate.

See Also:
Serialized Form

Field Summary
static int DEFAULT_PRIORITY
           
static long DEFAULT_TTL
           
static int DEFAULT_WEIGHT
           
protected  int priority
           
protected  IServiceProperties properties
           
protected  IServiceID serviceID
           
protected  java.lang.String serviceName
           
protected  long timeToLive
           
static java.lang.String UNKNOWN_PROTOCOL
           
protected  int weight
           
 
Constructor Summary
protected ServiceInfo()
           
  ServiceInfo(java.net.URI anURI, java.lang.String aServiceName, IServiceTypeID aServiceTypeID)
           
  ServiceInfo(java.net.URI anURI, java.lang.String aServiceName, IServiceTypeID aServiceTypeID, int priority, int weight, IServiceProperties props)
           
  ServiceInfo(java.net.URI anURI, java.lang.String aServiceName, IServiceTypeID aServiceTypeID, int priority, int weight, IServiceProperties props, long ttl)
          Create an IServiceInfo instance.
  ServiceInfo(java.net.URI anURI, java.lang.String aServiceName, IServiceTypeID aServiceTypeID, IServiceProperties props)
           
 
Method Summary
 java.lang.Object getAdapter(java.lang.Class adapter)
           
 java.net.URI getLocation()
          Get URI for service
 int getPriority()
          The priority for the service Priority: The priority of this target host.
 IServiceID getServiceID()
          Get ServiceID for service.
 java.lang.String getServiceName()
          (non-Javadoc)
 IServiceProperties getServiceProperties()
          Map with any/all properties associated with the service.
 long getTTL()
          (non-Javadoc)
 int getWeight()
          The weight for the service.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_TTL

public static final long DEFAULT_TTL
Since:
4.0
See Also:
Constant Field Values

DEFAULT_PRIORITY

public static final int DEFAULT_PRIORITY
See Also:
Constant Field Values

DEFAULT_WEIGHT

public static final int DEFAULT_WEIGHT
See Also:
Constant Field Values

UNKNOWN_PROTOCOL

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

serviceName

protected java.lang.String serviceName
Since:
3.0

serviceID

protected IServiceID serviceID

priority

protected int priority

weight

protected int weight

properties

protected IServiceProperties properties

timeToLive

protected long timeToLive
Since:
4.0
Constructor Detail

ServiceInfo

protected ServiceInfo()

ServiceInfo

public ServiceInfo(java.net.URI anURI,
                   java.lang.String aServiceName,
                   IServiceTypeID aServiceTypeID)
Since:
3.0
See Also:
ServiceInfo(URI, String, IServiceTypeID, int, int, IServiceProperties)

ServiceInfo

public ServiceInfo(java.net.URI anURI,
                   java.lang.String aServiceName,
                   IServiceTypeID aServiceTypeID,
                   IServiceProperties props)
Since:
3.0
See Also:
ServiceInfo(URI, String, IServiceTypeID, int, int, IServiceProperties)

ServiceInfo

public ServiceInfo(java.net.URI anURI,
                   java.lang.String aServiceName,
                   IServiceTypeID aServiceTypeID,
                   int priority,
                   int weight,
                   IServiceProperties props)
Since:
3.0
See Also:
ServiceInfo(URI, String, IServiceTypeID, int, int, IServiceProperties)

ServiceInfo

public ServiceInfo(java.net.URI anURI,
                   java.lang.String aServiceName,
                   IServiceTypeID aServiceTypeID,
                   int priority,
                   int weight,
                   IServiceProperties props,
                   long ttl)
Create an IServiceInfo instance.

Parameters:
anURI - The (absolute) location of the service.
aServiceName - a user chosen service name. Only ASCII characters are allowed.
aServiceTypeID - the service type identifier.
priority - the service priority. The priority of this target host. A client MUST attempt to contact the target host with the lowest-numbered priority it can reach; target hosts with the same priority SHOULD be tried in an order defined by the weight field.
weight - the service weight. A server selection mechanism. The weight field specifies a relative weight for entries with the same priority. Larger weights SHOULD be given a proportionately higher probability of being selected. Domain administrators SHOULD use Weight 0 when there isn't any server selection to do. In the presence of records containing weights greater than 0, records with weight 0 should have a very small chance of being selected.
props - generic service properties.
ttl - time to live
Since:
4.0
Method Detail

getLocation

public java.net.URI getLocation()
Description copied from interface: IServiceInfo
Get URI for service

Specified by:
getLocation in interface IServiceInfo
Returns:
URI the location for the service.

getServiceID

public IServiceID getServiceID()
Description copied from interface: IServiceInfo
Get ServiceID for service.

Specified by:
getServiceID in interface IServiceInfo
Returns:
ServiceID the serviceID for the service. Will not be null.

getPriority

public int getPriority()
Description copied from interface: IServiceInfo
The priority for the service Priority: The priority of this target host. A client MUST attempt to contact the target host with the lowest-numbered priority it can reach; target hosts with the same priority SHOULD be tried in an order defined by the weight field.

Specified by:
getPriority in interface IServiceInfo
Returns:
int the priority. 0 if no priority information for service.

getWeight

public int getWeight()
Description copied from interface: IServiceInfo
The weight for the service. 0 if no weight information for service. Weight: A server selection mechanism. The weight field specifies a relative weight for entries with the same priority. Larger weights SHOULD be given a proportionately higher probability of being selected. Domain administrators SHOULD use Weight 0 when there isn't any server selection to do. In the presence of records containing weights greater than 0, records with weight 0 should have a very small chance of being selected.

Specified by:
getWeight in interface IServiceInfo
Returns:
int the weight

getServiceProperties

public IServiceProperties getServiceProperties()
Description copied from interface: IServiceInfo
Map with any/all properties associated with the service. Properties are assumed to be name/value pairs, both of type String.

Specified by:
getServiceProperties in interface IServiceInfo
Returns:
Map the properties associated with this service. Will not be null.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getAdapter

public java.lang.Object getAdapter(java.lang.Class adapter)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable

getServiceName

public java.lang.String getServiceName()
(non-Javadoc)

Specified by:
getServiceName in interface IServiceInfo
Returns:
A human readable service name. Not used for uniqueness!
Since:
3.0
See Also:
IServiceInfo.getServiceName()

getTTL

public long getTTL()
(non-Javadoc)

Specified by:
getTTL in interface IServiceInfo
Returns:
long the time to live in seconds
Since:
4.0
See Also:
IServiceInfo.getTTL()