com.jmrosengard.xmlbroker.broker
Class PortRegistry

java.lang.Object
  |
  +--com.jmrosengard.xmlbroker.broker.PortRegistry

public final class PortRegistry
extends java.lang.Object

Registers and deregisters Port implementations. Each port represents an HTTP-level view of a service. All threads access a single instance. This is efforced using an adaptation of the Singleton Pattern [Gamma,E. et al. 1995]. Note that the methods are not synchronized since Hashtable is itself synchronized.


Field Summary
protected  java.util.Hashtable ports
           
private static PortRegistry reg
           
 
Constructor Summary
private PortRegistry()
           
 
Method Summary
 void deregister(PortKey portKey)
          Deregisters a port.
static PortRegistry getDefaultRegistry()
          The only way to create an instance of PortRegistry is to use this method.
 Port getPort(PortKey portKey)
          Returns a reference to the instance Port of port matching the string in portKey.
 void register(PortKey portKey, Port port)
          Registers a port
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

ports

protected java.util.Hashtable ports

reg

private static PortRegistry reg
Constructor Detail

PortRegistry

private PortRegistry()
Method Detail

register

public void register(PortKey portKey,
                     Port port)
Registers a port

deregister

public void deregister(PortKey portKey)
Deregisters a port. Does nothing if the key does not exist in the Hashtable.

getDefaultRegistry

public static PortRegistry getDefaultRegistry()
The only way to create an instance of PortRegistry is to use this method.

getPort

public Port getPort(PortKey portKey)
Returns a reference to the instance Port of port matching the string in portKey.