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.
-
NULL_URL
- The NULL URL
-
iBusURL(String)
- Creates a URL out of a string.
-
iBusURL(String, String)
- Creates a URL from the specified network address and subject.
-
iBusURL(String, String, int)
- Creates a URL from the specified network address and subject.
-
checkInetAddr(String)
- Checks whether inetAddr is a legal internet address.
-
equals(Object)
- Compares two URLs.
-
getAddress()
- Gets the network address part of the URL.
-
getDefaultPort()
- Returns the default iBus port number (UDP and TCP).
-
getHostName()
- Attempts to reverse lookup the network address of the URL.
-
getPort()
- Gets the port number.
-
getSubject()
- Gets the subject.
-
hashCode()
- Returns a hashcode for this URL.
-
hierarchicalMatch(iBusURL)
- Performs a hierarchical match with a given url.
-
ibusProto()
- return the prefix for ibus URLs, ie.
-
isMulticastURL()
- Returns true if it is a multicast URL, false if it is an unicast URL:
-
parseURL(String)
- Initializes url out of a string.
-
replySubject()
- return the subject for reply messages
-
setPort(int)
- Sets the port number.
-
toString()
- Convert to a human readable form.
NULL_URL
public static iBusURL NULL_URL
- The NULL URL
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.
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.
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.
toString
public String toString()
- Convert to a human readable form.
- Returns:
- the textual representation
- Overrides:
- toString in class Object
getAddress
public String getAddress()
- Gets the network address part of the URL.
- Returns:
- the network address part of the URL
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
getSubject
public String getSubject()
- Gets the subject.
- Returns:
- the subject of the URL
getPort
public int getPort()
- Gets the port number.
- Returns:
- the port number of the URL.
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.
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
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
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
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
ibusProto
public static String ibusProto()
- return the prefix for ibus URLs, ie. "ibus://"
- Returns:
- the prefix for ibus URLs, ie. "ibus://"
replySubject
public static String replySubject()
- return the subject for reply messages
- Returns:
- the subject for reply messages
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)
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.
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