jpos.config.simple
Class SimpleEntryRegistry

java.lang.Object
  |
  +--jpos.config.simple.SimpleEntryRegistry
All Implemented Interfaces:
JposEntryRegistry

public class SimpleEntryRegistry
extends java.lang.Object
implements JposEntryRegistry

This is a simple implementation for the JposEntryRegistry using a Hashtable to collect the entries. The entry's logicalName property value is used as the key to the table and the entry itself as the value

Since:
0.1 (Philly 99 meeting)
Author:
E. Michael Maximilien (maxim@us.ibm.com)

Field Summary
 java.util.Hashtable jposEntries
           
 
Constructor Summary
SimpleEntryRegistry()
          Deprecated. no longer used, see the 1 argument ctor
SimpleEntryRegistry(JposRegPopulator populator)
          One-argument constructor
 
Method Summary
 void addJposEntry(JposEntry entry)
          Add an JposEntry for the service.
 void addJposEntry(java.lang.String logicalName, JposEntry entry)
          Add an JposEntry for the service with logical name specified
 void addJposEntryRegistryListener(JposEntryRegistryListener l)
          Adds a new JposEntryRegistryListener to the list of listeners
protected  void fireJposEntryRegistryEventAdded(JposEntryRegistryEvent e)
          Fires a new JposEntryRegistry event when a new JposEntry is added
protected  void fireJposEntryRegistryEventModified(JposEntryRegistryEvent e)
          Fires a new JposEntryRegistry event when a JposEntry is modified
protected  void fireJposEntryRegistryEventRemoved(JposEntryRegistryEvent e)
          Fires a new JposEntryRegistry event when a new JposEntry is added
 java.util.Enumeration getEntries()
           
 JposEntry getJposEntry(java.lang.String logicalName)
           
 JposRegPopulator getRegPopulator()
           
 int getSize()
           
 boolean hasJposEntry(java.lang.String logicalName)
           
 boolean isLoaded()
           
 void load()
          Loads the JposEntryRegistry using the current populator NOTE: if no entries are found or an error occurs then the registry is empty
 void modifyJposEntry(java.lang.String logicalName, JposEntry newEntry)
          Modify the JposEntry with logicalName with the new entry indicated
 void removeJposEntry(JposEntry entry)
          Removes the specified JposEntry
 void removeJposEntry(java.lang.String logicalName)
          Removes the JposEntry with the logicalName specified
 void removeJposEntryRegistryListener(JposEntryRegistryListener l)
          Removes a new JposEntryRegistryListener to the list of listeners
 void save()
          Tell the JposEntryRegistry to save the current entries NOTE: the actual implementation will save it in dependent manner
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jposEntries

public java.util.Hashtable jposEntries
Constructor Detail

SimpleEntryRegistry

public SimpleEntryRegistry()
Deprecated. no longer used, see the 1 argument ctor

Default ctor
Since:
0.1 (Philly 99 meeting)

SimpleEntryRegistry

public SimpleEntryRegistry(JposRegPopulator populator)
One-argument constructor
Parameters:
populator - the JposRegPopulator used by the registry
Since:
1.2 (NY 2K meeting)
Method Detail

hasJposEntry

public boolean hasJposEntry(java.lang.String logicalName)
Specified by:
hasJposEntry in interface JposEntryRegistry
Parameters:
logicalName - the logical name for the service
Returns:
true if there is an JposEntry with the specified logical name
Since:
0.1 (Philly 99 meeting)

getEntries

public java.util.Enumeration getEntries()
Specified by:
getEntries in interface JposEntryRegistry
Returns:
an enumeration of JposEntry objects
Since:
0.1 (Philly 99 meeting)

getJposEntry

public JposEntry getJposEntry(java.lang.String logicalName)
Specified by:
getJposEntry in interface JposEntryRegistry
Parameters:
logicalName - the logical name of the JposEntry to find
Returns:
the JposEntry for the logicalName specified
Since:
0.1 (Philly 99 meeting)

modifyJposEntry

public void modifyJposEntry(java.lang.String logicalName,
                            JposEntry newEntry)
Modify the JposEntry with logicalName with the new entry indicated
Specified by:
modifyJposEntry in interface JposEntryRegistry
Parameters:
logicalName - the JposEntry's logical name
newEntry - the new JposEntry
Since:
0.1 (Philly 99 meeting)

addJposEntry

public void addJposEntry(java.lang.String logicalName,
                         JposEntry entry)
Add an JposEntry for the service with logical name specified
Specified by:
addJposEntry in interface JposEntryRegistry
Parameters:
logicalName - the logicalName of the service
Since:
0.1 (Philly 99 meeting)

addJposEntry

public void addJposEntry(JposEntry entry)
Add an JposEntry for the service. The logical name is obtained from the entry
Specified by:
addJposEntry in interface JposEntryRegistry
Parameters:
entry - the JposEntry to add
Since:
1.3 (Washington DC 2001 meeting)
See Also:
JposEntry.getLogicalName()

removeJposEntry

public void removeJposEntry(JposEntry entry)
Removes the specified JposEntry
Specified by:
removeJposEntry in interface JposEntryRegistry
Parameters:
entry - the entry to remove
Since:
0.1 (Philly 99 meeting)

removeJposEntry

public void removeJposEntry(java.lang.String logicalName)
Removes the JposEntry with the logicalName specified
Specified by:
removeJposEntry in interface JposEntryRegistry
Parameters:
logicalName - the JposEntry's logical name
Since:
0.1 (Philly 99 meeting)

addJposEntryRegistryListener

public void addJposEntryRegistryListener(JposEntryRegistryListener l)
Adds a new JposEntryRegistryListener to the list of listeners
Specified by:
addJposEntryRegistryListener in interface JposEntryRegistry
Parameters:
l - the JposEntryRegistryListener object
Since:
0.1 (Philly 99 meeting)

removeJposEntryRegistryListener

public void removeJposEntryRegistryListener(JposEntryRegistryListener l)
Removes a new JposEntryRegistryListener to the list of listeners
Specified by:
removeJposEntryRegistryListener in interface JposEntryRegistry
Parameters:
l - the JposEntryRegistryListener object
Since:
0.1 (Philly 99 meeting)

save

public void save()
          throws java.lang.Exception
Tell the JposEntryRegistry to save the current entries NOTE: the actual implementation will save it in dependent manner
Specified by:
save in interface JposEntryRegistry
Throws:
java.lang.Exception - if any error occurs while saving
Since:
0.1 (Philly 99 meeting)

getRegPopulator

public JposRegPopulator getRegPopulator()
Specified by:
getRegPopulator in interface JposEntryRegistry
Returns:
the JposRegPopulator for this registry
Since:
1.2 (NY 2K meeting)

load

public void load()
Loads the JposEntryRegistry using the current populator NOTE: if no entries are found or an error occurs then the registry is empty
Specified by:
load in interface JposEntryRegistry
Since:
1.2 (NY 2K meeting)

getSize

public int getSize()
Specified by:
getSize in interface JposEntryRegistry
Returns:
the current size of the registry
Since:
1.3 (Tokyo 2001 meeting)

isLoaded

public boolean isLoaded()
Specified by:
isLoaded in interface JposEntryRegistry
Returns:
true if the registry has already been loaded or false otherwise
Since:
1.3 (Washington DC 2001 meeting)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a String with a list of all logical name of entries in the registry as well as the registry size and populator name

fireJposEntryRegistryEventAdded

protected void fireJposEntryRegistryEventAdded(JposEntryRegistryEvent e)
Fires a new JposEntryRegistry event when a new JposEntry is added
Parameters:
e - the JposEntryRegistryEvent object to fire
Since:
0.1 (Philly 99 meeting)

fireJposEntryRegistryEventRemoved

protected void fireJposEntryRegistryEventRemoved(JposEntryRegistryEvent e)
Fires a new JposEntryRegistry event when a new JposEntry is added
Parameters:
e - the JposEntryRegistryEvent object to fire
Since:
0.1 (Philly 99 meeting)

fireJposEntryRegistryEventModified

protected void fireJposEntryRegistryEventModified(JposEntryRegistryEvent e)
Fires a new JposEntryRegistry event when a JposEntry is modified
Parameters:
e - the JposEntryRegistryEvent object to fire
Since:
0.1 (Philly 99 meeting)


This API and code belongs to the JavaPOS committee please see LISCENCE file for details