Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jpos.config
Class DefaultCompositeRegPopulator

    java.lang.Object
      |
      +--jpos.config.DefaultCompositeRegPopulator

All Implemented Interfaces:
  CompositeRegPopulator, JposRegPopulator

public class DefaultCompositeRegPopulator
extends java.lang.Object
implements CompositeRegPopulator

Default implementation of the CompositeRegPopulator interface

Since:
  1.3 (Washington DC 2001 meeting)
Author:
  E. Michael Maximilien (maxim@us.ibm.com)

Fields inherited from interface jpos.config.CompositeRegPopulator
`COMPOSITE_REG_POPULATOR_STRING`

Constructor Summary
`DefaultCompositeRegPopulator()` Creates a CompositePopulator with a null default populator NOTE: you must set the default populator before this is usable or call the load() method which will set the default populator from the multi-property in the jpos.properties file if that file exist
`DefaultCompositeRegPopulator(JposRegPopulator populator)` Creates a CompositePopulator with a default populator

Method Summary
`void` | `add(JposRegPopulator populator)` Adds this JposRegPopulator to the composite
`java.lang.String` | `getClassName()`
`JposRegPopulator` | `getDefaultPopulator()`
`java.util.Enumeration` | `getEntries()`
`java.net.URL` | `getEntriesURL()`
`java.lang.Exception` | `getLastLoadException()`
`java.lang.String` | `getName()`
`JposRegPopulator` | `getPopulator(java.lang.String uniqueId)`
`java.util.Iterator` | `getPopulators()`
`java.lang.String` | `getUniqueId()`
`boolean` | `isComposite()`
`void` | `load()` Tell the populator to load the entries.
`void` | `load(java.lang.String fileName)` Loads the entries specified in the fileName for the default populator
`void` | `remove(JposRegPopulator populator)` Removes this JposRegPopulator from the composite
`void` | `save(java.util.Enumeration entries)` Tell the populator to save the current entries
`void` | `save(java.util.Enumeration entries, java.lang.String fileName)` Tell the populator to save the current entries in the file specified using the default JposRegPopulator
`protected void` | `setDefaultPopulator(JposRegPopulator populator)` Sets the default JposRegPopulator.
`int` | `size()`
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### DefaultCompositeRegPopulator

    public DefaultCompositeRegPopulator()

  Creates a CompositePopulator with a null default populator NOTE: you must set the default populator before this is usable or call the load() method which will set the default populator from the multi-property in the jpos.properties file if that file exist

### DefaultCompositeRegPopulator

    public DefaultCompositeRegPopulator(JposRegPopulator populator)

  Creates a CompositePopulator with a default populator
  Parameters:
    `populator` - the default populator for this composite

Method Detail

### setDefaultPopulator

    protected void setDefaultPopulator(JposRegPopulator populator)
                                throws java.lang.IllegalArgumentException

  Sets the default JposRegPopulator. Orphan JposEntry objects (that is the ones that do not have a JposRegPopulator) are automatically assign to this one.
  Parameters:
    `populator` - the JposRegPopulator
  Throws:
    `java.lang.IllegalArgumentException` - if the argument is null or not a valid JposRegPopulator

### getUniqueId

    public java.lang.String getUniqueId()

  Specified by:
    `getUniqueId` in interface `JposRegPopulator`
  Returns:
    a unique String ID for this JposRegPopulator instance Can be implemented in terms of the getClassName() method

### getClassName

    public java.lang.String getClassName()

  Specified by:
    `getClassName` in interface `JposRegPopulator`
  Returns:
    the fully qualified class name implementing the JposRegPopulator interface

### save

    public void save(java.util.Enumeration entries)
              throws java.lang.Exception

  Tell the populator to save the current entries
  Specified by:
    `save` in interface `JposRegPopulator`
  Parameters:
    `entries` - an enumeration of JposEntry objects
  Throws:
    `java.lang.Exception` - if any error occurs while saving

### save

    public void save(java.util.Enumeration entries,
                     java.lang.String fileName)
              throws java.lang.Exception

  Tell the populator to save the current entries in the file specified using the default JposRegPopulator
  Specified by:
    `save` in interface `JposRegPopulator`
  Parameters:
    `entries` - an enumeration of JposEntry objects
    `fileName` - the file name to save entries
  Throws:
    `java.lang.Exception` - if any error occurs while saving

### load

    public void load()

  Tell the populator to load the entries. Looks for 2 multi-properties for the populator class and populator file name called: jpos.config.populator.class.0 jpos.config.populator.file.0 All entries are loaded by using the file name in the properties file for each populator defined in the JposEntryProperties.
  Specified by:
    `load` in interface `JposRegPopulator`

### load

    public void load(java.lang.String fileName)

  Loads the entries specified in the fileName for the default populator
  Specified by:
    `load` in interface `JposRegPopulator`
  Parameters:
    `fileName` - the entries file name

### getEntriesURL

    public java.net.URL getEntriesURL()

  Specified by:
    `getEntriesURL` in interface `JposRegPopulator`
  Returns:
    the URL pointing to the entries file loaded or saved

### getEntries

    public java.util.Enumeration getEntries()

  Specified by:
    `getEntries` in interface `JposRegPopulator`
  Returns:
    an Enumeration of JposEntry objects NOTE: this method is O(nm) where n == number of populators and m == average number of entries in populator. Could do better by keeping more data structure but not worth it if n and m are small (as expected in typical system)

### isComposite

    public boolean isComposite()

  Specified by:
    `isComposite` in interface `JposRegPopulator`
  Since:
    1.3 (Washington DC 2001 meeting)

### getName

    public java.lang.String getName()

  Specified by:
    `getName` in interface `JposRegPopulator`
  Returns:
    the name of this populator. This should be a short descriptive name
  Since:
    1.3 (Washington DC 2001 meeting)

### getLastLoadException

    public java.lang.Exception getLastLoadException()

  Specified by:
    `getLastLoadException` in interface `JposRegPopulator`
  Returns:
    the last exception (if any) during the last load or null if no exception occurred
  Since:
    2.0.0

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a String representation of this JposRegPopulator
  Since:
    1.3 (Washington DC 2001 meeting)

### getDefaultPopulator

    public JposRegPopulator getDefaultPopulator()

  Specified by:
    `getDefaultPopulator` in interface `CompositeRegPopulator`
  Returns:
    the default JposRegPopulator

### add

    public void add(JposRegPopulator populator)

  Adds this JposRegPopulator to the composite
  Specified by:
    `add` in interface `CompositeRegPopulator`
  Parameters:
    `populator` - adds the populator to the composite reg populator. Does nothing if the popualator already is in the composite

### remove

    public void remove(JposRegPopulator populator)

  Removes this JposRegPopulator from the composite
  Specified by:
    `remove` in interface `CompositeRegPopulator`
  Parameters:
    `populator` - removes the populator to the composite reg populator

### getPopulators

    public java.util.Iterator getPopulators()

  Specified by:
    `getPopulators` in interface `CompositeRegPopulator`
  Returns:
    an iterator over all populators in this composite

### getPopulator

    public JposRegPopulator getPopulator(java.lang.String uniqueId)

  Specified by:
    `getPopulator` in interface `CompositeRegPopulator`
  Parameters:
    `uniqueId` - the populator unique ID
  Returns:
    the populator with unique ID passed
  See Also:
    `JposRegPopulator.getUniqueId()`

### size

    public int size()

  Specified by:
    `size` in interface `CompositeRegPopulator`
  Returns:
    the number of populator in this composite

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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