All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iBus.iBusURL

java.lang.Object
   |
   +----iBus.iBusURL

public final class iBusURL
extends Object
implements Serializable
Class to represent iBus URLs. This is a constant object, once it is created, its fields cannot be changed. iBus URLs obey the following format:
ibus://network_address[:port]subject
e.g.:
ibus://225.4.5.6/sys/groupware/teleconference1
ibus://225.4.5.6:9917/sys/groupware/teleconference1
ibus://193.72.83.116:1332/sys/services/ftp_server
ibus://warp.foobar.com:1332/sys/services/ftp_server

pt2pt URLs must contain a port number, ibus URLs may not. Symbolic addresses are converted to numeric addresses when the URL is created.

IMPORTANT: we strongly recommend using iBus.URLFactory for creating iBus URLs since the factory enforces a well-defined format on the subject part of an URL.


Variable Index

 o NULL_URL
The NULL URL

Constructor Index

 o iBusURL(String)
Creates a URL out of a string.
 o iBusURL(String, String)
Creates a URL from the specified network address and subject.
 o iBusURL(String, String, int)
Creates a URL from the specified network address and subject.

Method Index

 o checkInetAddr(String)
Checks whether inetAddr is a legal internet address.
 o equals(Object)
Compares two URLs.
 o getAddress()
Gets the network address part of the URL.
 o getDefaultPort()
Returns the default iBus port number (UDP and TCP).
 o getHostName()
Attempts to reverse lookup the network address of the URL.
 o getPort()
Gets the port number.
 o getSubject()
Gets the subject.
 o hashCode()
Returns a hashcode for this URL.
 o hierarchicalMatch(iBusURL)
Performs a hierarchical match with a given url.
 o ibusProto()
return the prefix for ibus URLs, ie.
 o isMulticastURL()
Returns true if it is a multicast URL, false if it is an unicast URL:
 o parseURL(String)
Initializes url out of a string.
 o replySubject()
return the subject for reply messages
 o setPort(int)
Sets the port number.
 o toString()
Convert to a human readable form.

Variables

 o NULL_URL
 public static iBusURL NULL_URL
The NULL URL

Constructors

 o iBusURL
 public iBusURL(String inetAddr,
                String subject) throws MalformedURLException
Creates a URL from the specified network address and subject.

Parameters:
inetAddr - the network address
subject - the subject
Throws: MalformedURLException
if the URL is malformed.
 o iBusURL
 public iBusURL(String inetAddr,
                String subject,
                int port) throws MalformedURLException
Creates a URL from the specified network address and subject. This constructor may be used only with point-to-point addresses.

Parameters:
inetAddr - the point-to-point network address
subject - the subject
port - the port number
Throws: MalformedURLException
if the URL is malformed.
 o iBusURL
 public iBusURL(String url) throws MalformedURLException
Creates a URL out of a string.

Parameters:
url - the iBus URL string to parse
Throws: MalformedURLException
if the URL is malformed.

Methods

 o toString
 public String toString()
Convert to a human readable form.

Returns:
the textual representation
Overrides:
toString in class Object
 o getAddress
 public String getAddress()
Gets the network address part of the URL.

Returns:
the network address part of the URL
 o getHostName
 public String getHostName()
Attempts to reverse lookup the network address of the URL.

Returns:
the host name of the URL or its network address of reverse lookup fails
 o getSubject
 public String getSubject()
Gets the subject.

Returns:
the subject of the URL
 o getPort
 public int getPort()
Gets the port number.

Returns:
the port number of the URL.
 o setPort
 public void setPort(int port)
Sets the port number. This is used by protocol objects such as TCP when a server socket is created and the port was 0.

Parameters:
port - the port number of the URL.
 o isMulticastURL
 public boolean isMulticastURL()
Returns true if it is a multicast URL, false if it is an unicast URL:

Returns:
true if it is a multicast URL, false if it is an unicast URL
 o equals
 public boolean equals(Object url)
Compares two URLs. Overrides Object.equals, necessary for Hashtable and Vector search operations.

Parameters:
url - the iBusURL to compare with
Returns:
true if they are equal, false otherwise.
Overrides:
equals in class Object
 o hierarchicalMatch
 public boolean hierarchicalMatch(iBusURL url)
Performs a hierarchical match with a given url. Returns true if this URL represents the given url. match: this: /a/b url: /a/b this: /a url: /a/b no match: this: /a/b url: /b this: /a/b url: /a

Parameters:
url - the URL to match against
Returns:
true if this URL represents the given url
 o hashCode
 public int hashCode()
Returns a hashcode for this URL. The hashcode is a number that is usually different for different URLs. It is used when storing Objects in hashtables. Overwrites Object.hashCode to make the hashcode depend on the string representation of the URL.

Returns:
a hashcode for this URL
Overrides:
hashCode in class Object
 o ibusProto
 public static String ibusProto()
return the prefix for ibus URLs, ie. "ibus://"

Returns:
the prefix for ibus URLs, ie. "ibus://"
 o replySubject
 public static String replySubject()
return the subject for reply messages

Returns:
the subject for reply messages
 o getDefaultPort
 public static int getDefaultPort()
Returns the default iBus port number (UDP and TCP). The default port is used for URLs that do not provide any port number.

Returns:
the default iBus port number (UDP and TCP)
 o checkInetAddr
 protected static boolean checkInetAddr(String inetAddr) throws MalformedURLException
Checks whether inetAddr is a legal internet address. Returns true if its a multicast address. Class D addresses range from 224.0.0.0 to 239.255.255.255, although 224.x.x.x addresses are reserved for routers and such.

NOTE PORTING: If you are planning to port iBus to run on a multicast protocol other than IP multicast, you will have to create a subclass of iBusURL and to overwrite method checkInetAddr.

Parameters:
inetAddr - the internet address
Returns:
true if it is a multicast address, false if it is an unicast address
Throws: MalformedURLException
if the address is malformed.
 o parseURL
 protected void parseURL(String url) throws MalformedURLException
Initializes url out of a string.

Parameters:
url - a string representing an iBus url.

All Packages  Class Hierarchy  This Package  Previous  Next  Index