gr.uoa.di.madgik.grs.registry
Class GRSRegistry

java.lang.Object
  extended by gr.uoa.di.madgik.grs.registry.GRSRegistry

public class GRSRegistry
extends java.lang.Object

The GRSRegistry utility class is a statically initialized single instance per JVM that can uniquely register and reference items registered to it using a unique identifier. The items that can be registered are IBuffer and IBufferStore instances. In addition to instantiating the registry, during the static initialization, a LifecycleManager is also initialize and set to monitor the lifecycle properties of the registered items

Author:
gpapanikos

Field Summary
static GRSRegistry Registry
          The registry instance used
 
Method Summary
 java.lang.String add(IBuffer buffer)
          Registers the provided IBuffer in the registry and assigns it with a unique id with which it can be referenced
 java.lang.String add(IBufferStore store)
          Registers the provided IBufferStore in the registry and assigns it with a unique id with which it can be referenced
 IBuffer getBuffer(java.lang.String key)
          Retrieves the IBuffer entry that is associated with the provided key
 IBufferStore getStore(java.lang.String key)
          Retrieves the IBufferStore entry that is associated with the provided key
 void remove(java.lang.String key)
          Removes the entry with the specific key from the registry if found and calls IBuffer.dispose() or IBufferStore.dispose() depending on the nature of the respective entry
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Registry

public static final GRSRegistry Registry
The registry instance used

Method Detail

add

public java.lang.String add(IBuffer buffer)
Registers the provided IBuffer in the registry and assigns it with a unique id with which it can be referenced

Parameters:
buffer - the IBuffer to register
Returns:
the key the IBuffer was assigned

add

public java.lang.String add(IBufferStore store)
Registers the provided IBufferStore in the registry and assigns it with a unique id with which it can be referenced

Parameters:
store - the IBufferStore to register
Returns:
the key the IBufferStore was assigned

getBuffer

public IBuffer getBuffer(java.lang.String key)
Retrieves the IBuffer entry that is associated with the provided key

Parameters:
key - the key of the entry to retrieve
Returns:
the IBuffer associated with the key or null if no IBuffer is associated with the key

getStore

public IBufferStore getStore(java.lang.String key)
Retrieves the IBufferStore entry that is associated with the provided key

Parameters:
key - the key of the entry to retrieve
Returns:
the IBufferStore associated with the key or null if no IBufferStore is associated with the key

remove

public void remove(java.lang.String key)
Removes the entry with the specific key from the registry if found and calls IBuffer.dispose() or IBufferStore.dispose() depending on the nature of the respective entry

Parameters:
key - the key of the entry to remove and dispose