org.apache.activemq.jmdns
Class ServiceInfo

java.lang.Object
  extended by org.apache.activemq.jmdns.ServiceInfo

public class ServiceInfo
extends java.lang.Object

JmDNS service information.

Version:
%I%, %G%
Author:
Arthur van Hoff, Jeff Sonstein, Werner Randelshofer

Field Summary
static byte[] NO_VALUE
           
 
Constructor Summary
ServiceInfo(java.lang.String type, java.lang.String name, int port, int weight, int priority, byte[] text)
          Construct a service description for registrating with JmDNS.
ServiceInfo(java.lang.String type, java.lang.String name, int port, int weight, int priority, java.util.Hashtable props)
          Construct a service description for registrating with JmDNS.
ServiceInfo(java.lang.String type, java.lang.String name, int port, int weight, int priority, java.lang.String text)
          Construct a service description for registrating with JmDNS.
ServiceInfo(java.lang.String type, java.lang.String name, int port, java.lang.String text)
          Construct a service description for registrating with JmDNS.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.net.InetAddress getAddress()
           
 java.lang.String getHostAddress()
          Get the host address of the service (ie X.X.X.X).
 java.net.InetAddress getInetAddress()
          Get the InetAddress of the service.
 java.lang.String getName()
          Unqualified service instance 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.
 java.lang.String getQualifiedName()
          Fully qualified service name, such as foobar._http._tcp.local. .
 java.lang.String getServer()
          Get the name of the server.
 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()
           
 void updateRecord(JmDNS jmdns, long now, org.apache.activemq.jmdns.DNSRecord rec)
          JmDNS callback to update a DNS record.
 
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,
                   int port,
                   java.lang.String text)
Construct a service description for registrating with JmDNS.

Parameters:
type - fully qualified service type name, such as _http._tcp.local..
name - unqualified service instance name, such as foobar
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,
                   int port,
                   int weight,
                   int priority,
                   java.lang.String text)
Construct a service description for registrating with JmDNS.

Parameters:
type - fully qualified service type name, such as _http._tcp.local..
name - unqualified service instance name, such as foobar
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,
                   int port,
                   int weight,
                   int priority,
                   java.util.Hashtable props)
Construct a service description for registrating with JmDNS. The properties hashtable must map property names to either Strings or byte arrays describing the property values.

Parameters:
type - fully qualified service type name, such as _http._tcp.local..
name - unqualified service instance name, such as foobar
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,
                   int port,
                   int weight,
                   int priority,
                   byte[] text)
Construct a service description for registrating with JmDNS.

Parameters:
type - fully qualified service type name, such as _http._tcp.local..
name - unqualified service instance name, such as foobar
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()
Unqualified service instance name, such as foobar .


getQualifiedName

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


getServer

public java.lang.String getServer()
Get the name of the server.


getHostAddress

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


getAddress

public java.net.InetAddress getAddress()

getInetAddress

public java.net.InetAddress getInetAddress()
Get the InetAddress of the service.


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 address, 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, address, 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.


updateRecord

public void updateRecord(JmDNS jmdns,
                         long now,
                         org.apache.activemq.jmdns.DNSRecord rec)
JmDNS callback to update a DNS record.


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 © 2005-2011 FuseSource, Corp.. All Rights Reserved.