All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iBus.iBusURLFactory

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

public class iBusURLFactory
extends Object
This class enforces a well-defined structure on iBus URLs. If all URLs are created with this factory then you are able to run multiple "areas" of the same distributed application concurrently, without having one area interfering with the other. Example areas: Production System, Test System, Joe's Development System, etc.

The factory creates URLs with subjects of the form ////Subject For example: ///<1.8>/stockindices

defaults to the iBusURLFactory.DEFAULT_AREA.

Optionally the factory can generate IP multicast addresses by computing a hash on the , and parts.

IP Multicast address allocation:
- 224.0.0.0 to 224.0.1.255 are reserved permanently (RFC 1700)
- 224.0.2.0 to 224.0.4.255 are private addresses reserved by iBus
- 224.0.5.0 to 224.127.255.255 are assigned by iBusURLFactory or by the user.

Note that when mapping an IP mcast address to an Ethernet MAC address only the least significant 23 bits are used. Hence the hardware multiplexed addresses end at 224.127.255.255.

NOTE: must call initSystem() before accessing system_ member.


Variable Index

 o ADDR_FIRST_PRIVATE
first private iBus Class D address: 224.0.2.0
 o ADDR_FIRST_PUBLIC
first public iBus Class D address : 224.0.5.0
 o ADDR_LAST_PRIVATE
last private iBus Class D address : 224.0.4.255
 o ADDR_LAST_PUBLIC
last public iBus Class D address : 224.127.255.255
 o ADDR_NEXT_PRIVATE
the next private class D address that can be assigned
 o DEFAULT_AREA
the name of the default system area
 o DEV_SYSTEM
the area name of the development system
 o privateAddresses_
 o PROD_SYSTEM
the area name of the production system
 o TEST_SYSTEM
the area name of the test system

Method Index

 o addrToString(int)
Convert a 32 bit internet address to x.x.x.x string format.
 o create(String, String, String)
Create a standardized URL out of the specified components for the default system area (see getSystem()).
 o create(String, String, String, String)
Create a standardized URL out of the specified components for the default system area (see getSystem()).
 o create(String, String, String, String, int)
Create a standardized URL out of the specified components for the default system area (see getSystem()).
 o createAddress(String)
Creates a public IP multicast address by computing a hash on a given string.
 o createPrivateAddress(String)
returns a private iBus IP multicast address.
 o getServicePart(iBusURL)
Get the service part of an iBus URL.
 o getSubjectPart(iBusURL)
Get the subject part of an iBus URL.
 o getSubjectParts(iBusURL)
Return a string array of length 4 containing the system name, service name, version, and subject
 o getSystem()
Get the system area name of the factory.
 o getSystemPart(iBusURL)
Get the system part of an iBus URL.
 o getVersionPart(iBusURL)
Get the version part of an iBus URL.

Variables

 o ADDR_FIRST_PRIVATE
 public static final int ADDR_FIRST_PRIVATE
first private iBus Class D address: 224.0.2.0

 o ADDR_LAST_PRIVATE
 public static final int ADDR_LAST_PRIVATE
last private iBus Class D address : 224.0.4.255

 o ADDR_NEXT_PRIVATE
 public static int ADDR_NEXT_PRIVATE
the next private class D address that can be assigned

 o ADDR_FIRST_PUBLIC
 public static final int ADDR_FIRST_PUBLIC
first public iBus Class D address : 224.0.5.0

 o ADDR_LAST_PUBLIC
 public static final int ADDR_LAST_PUBLIC
last public iBus Class D address : 224.127.255.255

 o PROD_SYSTEM
 public static final String PROD_SYSTEM
the area name of the production system

 o DEV_SYSTEM
 public static final String DEV_SYSTEM
the area name of the development system

 o TEST_SYSTEM
 public static final String TEST_SYSTEM
the area name of the test system

 o DEFAULT_AREA
 public static final String DEFAULT_AREA
the name of the default system area

 o privateAddresses_
 protected static Hashtable privateAddresses_

Methods

 o create
 public static iBusURL create(String service,
                              String version,
                              String subject)
Create a standardized URL out of the specified components for the default system area (see getSystem()). An IP multicast address is created by applying a hash algorithm on the subject components. All components are to be provided without the <> delimiters.

Parameters:
service - the name of the service
version - the version of the service
subject - the subject within the service
Returns:
the iBusURL
 o create
 public static iBusURL create(String service,
                              String version,
                              String subject,
                              String address)
Create a standardized URL out of the specified components for the default system area (see getSystem()). Use the specified address. All components are to be provided without the <> delimiters.

Parameters:
service - the name of the service
version - the version of the service
subject - the subject within the service
address - the network address
Returns:
the iBusURL
 o create
 public static iBusURL create(String service,
                              String version,
                              String subject,
                              String address,
                              int port)
Create a standardized URL out of the specified components for the default system area (see getSystem()). Use the specified address and port number. All components are to be provided without the <> delimiters.

Parameters:
service - the name of the service
version - the version of the service
subject - the subject within the service
address - the network address
port - the port number to include in the URL
Returns:
the iBusURL
 o createAddress
 public static String createAddress(String s)
Creates a public IP multicast address by computing a hash on a given string. An IP multicast address in the range ADDR_FIRST_PUBLIC to ADDR_LAST_PUBLIC is returned.

Parameters:
s - the string to hash
Returns:
an IP multicast address
 o createPrivateAddress
 public static String createPrivateAddress(String key)
returns a private iBus IP multicast address. Use this function to obtain your private exclusive IP multicast address. The key/address pair needs to be pre-registered in privateAddresses_. createPrivateAddress is intended for iBus protocol objects that need predefined IP multicast addresses.

Parameters:
key - the key of the address to return. Same key always returns same address.
Returns:
IP multicast address registered for that key.
Throws: RuntimeException
if the key is not registered
 o addrToString
 public static String addrToString(int addr)
Convert a 32 bit internet address to x.x.x.x string format.

Parameters:
addr - a 32 bit internet address
Returns:
the address in string format
 o getSystem
 public static String getSystem()
Get the system area name of the factory.

Returns:
the system area name of the factory
 o getSystemPart
 public static String getSystemPart(iBusURL url) throws MalformedURLException
Get the system part of an iBus URL.

Parameters:
url - the URL to parse
Returns:
the system part
Throws: MalformedURLException
if the URL was not created by the factory
 o getServicePart
 public static String getServicePart(iBusURL url) throws MalformedURLException
Get the service part of an iBus URL.

Parameters:
url - the URL to parse
Returns:
the service part
Throws: MalformedURLException
if the URL was not created by the factory
 o getVersionPart
 public static String getVersionPart(iBusURL url) throws MalformedURLException
Get the version part of an iBus URL.

Parameters:
url - the URL to parse
Returns:
the version part
Throws: MalformedURLException
if the URL was not created by the factory
 o getSubjectPart
 public static String getSubjectPart(iBusURL url) throws MalformedURLException
Get the subject part of an iBus URL.

Parameters:
url - the URL to parse
Returns:
the subject part
Throws: MalformedURLException
if the URL was not created by the factory
 o getSubjectParts
 public static String[] getSubjectParts(iBusURL url) throws MalformedURLException
Return a string array of length 4 containing the system name, service name, version, and subject

Parameters:
url - the URL to parse
Returns:
an array of length 4 containing the system area, service name, version, and the subject
Throws: MalformedURLException
if the URL was not created by the factory

All Packages  Class Hierarchy  This Package  Previous  Next  Index