jpos.config.simple
Class AbstractRegPopulator

java.lang.Object
  |
  +--jpos.config.simple.AbstractRegPopulator
All Implemented Interfaces:
JposRegPopulator
Direct Known Subclasses:
SimpleRegPopulator, SimpleXmlRegPopulator, XercesRegPopulator

public abstract class AbstractRegPopulator
extends java.lang.Object
implements JposRegPopulator

Common abstract superclass to help in the implementation of the JposRegPopulator

Since:
1.2 (NY 2K 99 meeting)
Author:
E. Michael Maximilien (maxim@us.ibm.com)
See Also:
JposPropertiesConst.JPOS_REG_POPULATOR_CLASS_PROP_NAME

Field Summary
protected  java.lang.Exception lastLoadException
           
 
Constructor Summary
AbstractRegPopulator(java.lang.String id)
          Creates a AbstractRegPopulator and sets the uniqueId with the string passed
 
Method Summary
protected  java.net.URL createURLFromFile(java.io.File file)
           
protected  java.net.URL createURLFromFile(java.util.zip.ZipFile zipFile)
           
protected  java.io.InputStream findFileInClasspath(java.lang.String fileName)
          Finds the first file matching the fileName in the CLASSPATH directory or each JAR or Zip file in the CLASSPATH NOTE:Decorated the FileInputStream with a BufferedInputStream to improve load time...
protected  java.io.InputStream findFileInJarZipFiles(java.lang.String fileName, java.util.Vector jarZipFilesVector)
          Finds the occurrence of the fileName in the JAR or Zip files
 java.util.Enumeration getEntries()
           
abstract  java.net.URL getEntriesURL()
           
protected  java.util.Hashtable getJposEntries()
           
 java.lang.Exception getLastLoadException()
           
abstract  java.lang.String getName()
           
protected  java.io.InputStream getPopulatorFileIS()
           
protected  java.lang.String getPopulatorFileName()
           
protected  java.io.OutputStream getPopulatorFileOS()
           
protected  java.lang.String getPopulatorFileURL()
           
 java.lang.String getUniqueId()
           
 boolean isComposite()
           
protected  boolean isPopulatorFileDefined()
           
abstract  void load()
          Tell the populator to load the entries
abstract  void load(java.lang.String fileName)
          Loads the entries specified in the fileName
abstract  void save(java.util.Enumeration entries)
          Tell the populator to save the current entries
abstract  void save(java.util.Enumeration entries, java.lang.String fileName)
          Tell the populator to save the current entries in the file specified
protected  void setUniqueId(java.lang.String s)
          Sets the unique ID for this populator
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jpos.config.JposRegPopulator
getClassName
 

Field Detail

lastLoadException

protected java.lang.Exception lastLoadException
Constructor Detail

AbstractRegPopulator

public AbstractRegPopulator(java.lang.String id)
Creates a AbstractRegPopulator and sets the uniqueId with the string passed
Parameters:
id - the String ID
Since:
1.3 (Washington DC 20001)
Method Detail

save

public abstract 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
Since:
1.2 (NY 2K meeting)

save

public abstract 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
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
Since:
1.3 (SF 2K meeting)

load

public abstract void load()
Tell the populator to load the entries
Specified by:
load in interface JposRegPopulator
Since:
1.2 (NY 2K meeting)

load

public abstract void load(java.lang.String fileName)
Loads the entries specified in the fileName
Specified by:
load in interface JposRegPopulator
Parameters:
fileName - the entries file name
Since:
1.3 (SF 2K meeting)

getEntriesURL

public abstract java.net.URL getEntriesURL()
Specified by:
getEntriesURL in interface JposRegPopulator
Returns:
the URL pointing to the entries file loaded or saved
Since:
1.2 (NY 2K meeting)

getName

public abstract 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)

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
Since:
1.3 (Washington DC 2001 meeting)

getEntries

public java.util.Enumeration getEntries()
Specified by:
getEntries in interface JposRegPopulator
Returns:
an Enumeration of JposEntry objects
Since:
1.2 (NY 2K meeting)

isComposite

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

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)

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

createURLFromFile

protected java.net.URL createURLFromFile(java.io.File file)
Parameters:
file - the File that this URL will point to
Returns:
a URL pointing to the entries file
Since:
1.2 (NY 2K meeting)

createURLFromFile

protected java.net.URL createURLFromFile(java.util.zip.ZipFile zipFile)
Parameters:
zipFile - the ZipFile that this URL will point to
Returns:
a URL pointing to the entries file
Since:
1.2 (NY 2K meeting)

getJposEntries

protected java.util.Hashtable getJposEntries()
Returns:
the jposEntries Hashtable to allow access to subclasses
Since:
1.2 (NY 2K meeting)

isPopulatorFileDefined

protected boolean isPopulatorFileDefined()
Returns:
true if a populator file (or URL) is defined
Since:
1.2 (NY 2K meeting)

getPopulatorFileIS

protected java.io.InputStream getPopulatorFileIS()
                                          throws java.lang.Exception
Returns:
an InputStream object to the populator file (multiple calls will return a new stream each time)
Throws:
java.lang.Exception - if an error ocurs while getting the InputStream object
Since:
1.2 (NY 2K meeting)

getPopulatorFileOS

protected java.io.OutputStream getPopulatorFileOS()
                                           throws java.lang.Exception
Returns:
an OutputStream object to the populator file (multiple calls will return a new stream each time)
Throws:
java.lang.Exception - if an error ocurs while getting the InputStream object
Since:
1.2 (NY 2K meeting)

getPopulatorFileName

protected java.lang.String getPopulatorFileName()
Returns:
the populatorFile names property value (returns "" if not defined)
Since:
1.2 (NY 2K meeting)

getPopulatorFileURL

protected java.lang.String getPopulatorFileURL()
Returns:
the populatorURLFile names property value (returns "" if not defined)
Since:
1.2 (NY 2K meeting)

setUniqueId

protected void setUniqueId(java.lang.String s)
Sets the unique ID for this populator
Parameters:
s - the String object. Needs to be unique
Since:
1.3 (Washington DC 2001)

findFileInClasspath

protected java.io.InputStream findFileInClasspath(java.lang.String fileName)
Finds the first file matching the fileName in the CLASSPATH directory or each JAR or Zip file in the CLASSPATH NOTE:Decorated the FileInputStream with a BufferedInputStream to improve load time...
Parameters:
fileName - the fileName to find
Since:
2.0 (Long Beach 2001)

findFileInJarZipFiles

protected java.io.InputStream findFileInJarZipFiles(java.lang.String fileName,
                                                    java.util.Vector jarZipFilesVector)
Finds the occurrence of the fileName in the JAR or Zip files
Parameters:
fileName - the file to find
jarFilesVector - a vector of JAR/Zip file names
Since:
2.0 (Long Beach 2001)


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