com.strangeberry.rendezvous
Class ServiceInfo

java.lang.Object
  extended by com.strangeberry.rendezvous.ServiceInfo

public class ServiceInfo
extends java.lang.Object

Rendezvous service information.

Version:
1.24, 03/05/2003
Author:
Arthur van Hoff

Field Summary
static byte[] NO_VALUE
           
 
Constructor Summary
ServiceInfo(java.lang.String type, java.lang.String name, java.net.InetAddress addr, int port, java.util.Hashtable props)
          Construct a service description for registrating with Rendezvous.
ServiceInfo(java.lang.String type, java.lang.String name, java.net.InetAddress addr, int port, int weight, int priority, byte[] text)
          Construct a service description for registrating with Rendezvous.
ServiceInfo(java.lang.String type, java.lang.String name, java.net.InetAddress addr, int port, int weight, int priority, java.util.Hashtable props)
          Construct a service description for registrating with Rendezvous.
ServiceInfo(java.lang.String type, java.lang.String name, java.net.InetAddress addr, int port, int weight, int priority, java.lang.String text)
          Construct a service description for registrating with Rendezvous.
ServiceInfo(java.lang.String type, java.lang.String name, java.net.InetAddress addr, int port, java.lang.String text)
          Construct a service description for registrating with Rendezvous.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAddress()
          Get the host address of the service (ie X.X.X.X).
 java.lang.String getName()
          Service name, such as foobar.
 java.lang.String getNiceTextString()
           
 int getPort()
          Get the port for the service.
 int getPriority()
          Get the priority of the service.
 byte[] getPropertyBytes(java.lang.String name)
          Get a property of the service.
 java.util.Enumeration getPropertyNames()
          Enumeration of the property names.
 java.lang.String getPropertyString(java.lang.String name)
          Get a property of the service.
 byte[] getTextBytes()
          Get the text for the serivce as raw bytes.
 java.lang.String getTextString()
          Get the text for the service.
 java.lang.String getType()
          Fully qualified service type name, such as _http._tcp.local..
 java.lang.String getURL()
          Get the URL for this service.
 java.lang.String getURL(java.lang.String protocol)
          Get the URL for this service.
 int getWeight()
          Get the weight of the service.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_VALUE

public static final byte[] NO_VALUE
Constructor Detail

ServiceInfo

public ServiceInfo(java.lang.String type,
                   java.lang.String name,
                   java.net.InetAddress addr,
                   int port,
                   java.lang.String text)
Construct a service description for registrating with Rendezvous.

Parameters:
type - fully qualified service type name
name - fully qualified service name
addr - the address to which the service is bound
port - the local port on which the service runs
text - string describing the service

ServiceInfo

public ServiceInfo(java.lang.String type,
                   java.lang.String name,
                   java.net.InetAddress addr,
                   int port,
                   int weight,
                   int priority,
                   java.lang.String text)
Construct a service description for registrating with Rendezvous.

Parameters:
type - fully qualified service type name
name - fully qualified service name
addr - the address to which the service is bound
port - the local port on which the service runs
weight - weight of the service
priority - priority of the service
text - string describing the service

ServiceInfo

public ServiceInfo(java.lang.String type,
                   java.lang.String name,
                   java.net.InetAddress addr,
                   int port,
                   java.util.Hashtable props)
Construct a service description for registrating with Rendezvous. The properties hashtable must map property names to either Strings or byte arrays describing the property values.

Parameters:
type - fully qualified service type name
name - fully qualified service name
addr - the address to which the service is bound
port - the local port on which the service runs
props - properties describing the service

ServiceInfo

public ServiceInfo(java.lang.String type,
                   java.lang.String name,
                   java.net.InetAddress addr,
                   int port,
                   int weight,
                   int priority,
                   java.util.Hashtable props)
Construct a service description for registrating with Rendezvous. The properties hashtable must map property names to either Strings or byte arrays describing the property values.

Parameters:
type - fully qualified service type name
name - fully qualified service name
addr - the address to which the service is bound
port - the local port on which the service runs
weight - weight of the service
priority - priority of the service
props - properties describing the service

ServiceInfo

public ServiceInfo(java.lang.String type,
                   java.lang.String name,
                   java.net.InetAddress addr,
                   int port,
                   int weight,
                   int priority,
                   byte[] text)
Construct a service description for registrating with Rendezvous.

Parameters:
type - fully qualified service type name
name - fully qualified service name
addr - the address to which the service is bound
port - the local port on which the service runs
weight - weight of the service
priority - priority of the service
text - bytes describing the service
Method Detail

getType

public java.lang.String getType()
Fully qualified service type name, such as _http._tcp.local..


getName

public java.lang.String getName()
Service name, such as foobar.


getAddress

public java.lang.String getAddress()
Get the host address of the service (ie X.X.X.X).


getPort

public int getPort()
Get the port for the service.


getPriority

public int getPriority()
Get the priority of the service.


getWeight

public int getWeight()
Get the weight of the service.


getTextBytes

public byte[] getTextBytes()
Get the text for the serivce as raw bytes.


getTextString

public java.lang.String getTextString()
Get the text for the service. This will interpret the text bytes as a UTF8 encoded string. Will return null if the bytes are not a valid UTF8 encoded string.


getURL

public java.lang.String getURL()
Get the URL for this service. An http URL is created by combining the addres, port, and path properties.


getURL

public java.lang.String getURL(java.lang.String protocol)
Get the URL for this service. An URL is created by combining the protocol, addres, port, and path properties.


getPropertyBytes

public byte[] getPropertyBytes(java.lang.String name)
Get a property of the service. This involves decoding the text bytes into a property list. Returns null if the property is not found or the text data could not be decoded correctly.


getPropertyString

public java.lang.String getPropertyString(java.lang.String name)
Get a property of the service. This involves decoding the text bytes into a property list. Returns null if the property is not found, the text data could not be decoded correctly, or the resulting bytes are not a valid UTF8 string.


getPropertyNames

public java.util.Enumeration getPropertyNames()
Enumeration of the property names.


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getNiceTextString

public java.lang.String getNiceTextString()

toString

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


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.