|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.di.server.FileConfig
public class FileConfig
This class parses configurations from .inf files. The parsed configurations are being accumulated in the state of the FileConfig object. (Some time ago, this class was used to load TDI configurations (configurations were stored in .inf format rather than in XML). That is why some of the features (such as encryption) exist.) The configurations are represented by TreeMap objects and are organized into a hierarchy. The hierarchy is composed by embedding TreeMap objects as values inside other TreeMap objects. Navigation through the configuration hierarchy is performed via the key names. Several keys can be combined to form a compound key, which identifies a configuration (i.e. TreeMap object) in the hierarchy. The individual parts of a compound key are delimited by a forward slash : '/'. For example: "connectors/ibmdi.URLConnector/connectorConfig". There are some predefined keys for objects in the configuration hierarchy. These predefined keys are used to logically organize configurations into categories such as Connectors, Parsers, Forms, ... The predefined keys are available as String constants (C_CONNECTOR, C_PARSER, C_FORMDEF, ...) in the FileConfig class.
Field Summary | |
---|---|
static java.lang.String |
C_CONNECTOR
Connector configurations are stored under this key. |
static java.lang.String |
C_FORMDEF
Form configurations are stored under this key. |
static java.lang.String |
C_INCLUDE
Includes configurations are stored under this key. |
static java.lang.String |
C_INCLUDEFILES
Includes configurations are stored under this key. |
static java.lang.String |
C_JAVALIBRARIES
Java libraries configurations are stored under this key. |
static java.lang.String |
C_JAVAPROPERTIES
Java properties configurations are stored under this key. |
static java.lang.String |
C_LIBRARIES
Library configurations are stored under this key. |
static java.lang.String |
C_LISTENER
Listener configurations are stored under this key. |
static java.lang.String |
C_MBUS
Message bus configurations are stored under this key. |
static java.lang.String |
C_PARSER
ParserTypes configurations are stored under this key. |
static java.lang.String |
C_PROPERTIES
Properties configurations are stored under this key. |
static java.lang.String |
C_SCRIPTS
Script configurations are stored under this key. |
static java.lang.String |
C_SECURITY
Security configurations are stored under this key. |
static java.lang.String |
C_SHAREDCONN
Shared Connector configurations are stored under this key. |
static java.lang.String |
C_TASK
AssemblyLine configurations are stored under this key. |
static java.lang.String |
C_TRIGGER
Trigger configurations are stored under this key. |
boolean |
dontOverwriteConfig
Whether newly read configurations are allowed to overwrite previously stored configurations. |
java.util.Vector |
includedFiles
All include configuration files (the absolute file system paths). |
boolean |
isInclude
Whether the configuration currently being parsed is read from an include configuration file. |
java.lang.String |
password
Password (key) for decrypting the configuration input stream/file. |
Constructor Summary | |
---|---|
FileConfig(java.lang.String path)
Constructor for the FileConfig object |
Method Summary | |
---|---|
void |
addAttribute(java.util.TreeMap h,
java.lang.String name)
Reads attribute values from the configuration stream which is currently open for reading. |
void |
addMap(java.util.TreeMap h,
java.lang.String name)
Adds an empty TreeMap to the specified TreeMap under the specified key name. |
void |
addSection(java.util.TreeMap config,
java.lang.String name)
Parses a configuration section (TreeMap) from the configuration stream which is currently open for reading. |
void |
addVector(java.util.TreeMap h,
java.lang.String name)
Reads a configuration Vector from the configuration stream which is currenlty open for reading. |
boolean |
fireError(java.lang.Exception error)
The method tells whether a specified error should be raised or is internally handled. |
java.util.TreeMap |
getConfig(java.lang.String key)
Gets the config attribute of the FileConfig object |
java.lang.String |
getConfigPath()
Gets the configPath attribute of the FileConfig object |
java.util.TreeMap |
getConnector(java.lang.String name)
Gets the connector attribute of the FileConfig object |
java.util.TreeMap |
getForm(java.lang.String name)
Gets the form attribute of the FileConfig object |
java.util.TreeMap |
getInclude(java.lang.String name)
Gets the include attribute of the FileConfig object |
java.util.Vector |
getIncludes()
Gets the includes attribute of the FileConfig object |
java.lang.Object |
getKey(java.util.TreeMap map,
java.lang.String key)
Gets the key attribute of the FileConfig object |
java.util.TreeMap |
getLibrary(java.lang.String name)
Gets the library attribute of the FileConfig object |
java.lang.String |
getLine()
Gets the line attribute of the FileConfig object |
java.util.TreeMap |
getListener(java.lang.String name)
Gets the listener attribute of the FileConfig object |
java.util.TreeMap |
getParser(java.lang.String name)
Gets the parser attribute of the FileConfig object |
java.util.TreeMap |
getProperty(java.lang.String type)
Gets the property attribute of the FileConfig object |
java.util.TreeMap |
getScript(java.lang.String name)
Gets the script attribute of the FileConfig object |
java.util.TreeMap |
getTables()
Gets the tables attribute of the FileConfig object |
java.util.TreeMap |
getTask(java.lang.String name)
Gets the task attribute of the FileConfig object |
java.lang.String |
getVersion()
Returns the version string. |
void |
includeFile(java.lang.String path,
boolean overwrite)
Parses the configurations from the specified include file. |
void |
includeFiles(boolean first)
Parses the configurations from the include files, which are currently accumulated for reading. |
java.util.TreeMap |
loadConfig()
Parses the currently set configuration file. |
java.util.TreeMap |
loadConfig(java.io.BufferedReader input)
Parses the specified configuration input stream. |
java.util.TreeMap |
loadConfig(byte[] data)
Parses the specified configuration data. |
java.util.TreeMap |
loadConfig(java.lang.String urlPath)
Parses the specified configuration file. |
java.util.TreeMap |
loadConfig2(java.lang.String urlPath)
Parses the specified configuration data. |
java.util.TreeMap |
loadConfig3()
Parses the configuration stream, which is currently open for reading. |
void |
loadEncrypted()
A NOOP method. |
void |
openInputFile(java.lang.String path)
Opens the specified configuration file for reading. |
void |
removeIncludedComponents()
Removes included components from our tables. |
void |
saveArray(java.io.BufferedWriter out,
java.lang.String prefix,
java.util.TreeMap cf)
Writes the contents of the specified configuration TreeMap into the specified output stream. |
void |
saveConfig()
Writes the internally accumulated configurations to the currently set configuration file. |
void |
saveConfig(java.io.BufferedWriter out)
Writes the internally accumulated configurations to the specified output stream. |
void |
saveConfig(java.io.BufferedWriter out,
java.lang.String type,
java.util.TreeMap cf)
Writes the configurations from the specified TreeMap into the specified output stream. |
void |
saveConfig(java.io.OutputStream output)
Saves the configuration to an output stream. |
void |
saveConfig(java.util.TreeMap config)
Overwrites the currently set configuration file with the configurations from the specified TreeMap. |
void |
saveConfig(java.util.TreeMap config,
java.lang.String path)
Overwrites the specified file with the configurations from the specified TreeMap. |
void |
saveVector(java.io.BufferedWriter out,
java.lang.String prefix,
java.util.Vector v)
Writes the specified Vector with configurations to the specified output stream. |
void |
setConfig(java.lang.String key,
java.lang.Object data)
Sets the config attribute of the FileConfig object |
void |
setConfigPath(java.lang.String path)
Sets the configPath attribute of the FileConfig object |
void |
setErrorListener(ErrorListener listener)
Sets the errorListener attribute of the FileConfig object |
void |
setImport(java.util.Vector v)
Sets the import attribute of the FileConfig object |
void |
setPassword(java.lang.String pwd)
Sets the password attribute of the FileConfig object |
void |
setTables(java.util.TreeMap tables)
Sets the tables attribute of the FileConfig object |
void |
setVersion(java.lang.String version)
Sets the version string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String C_TASK
public static final java.lang.String C_CONNECTOR
public static final java.lang.String C_TRIGGER
public static final java.lang.String C_LISTENER
public static final java.lang.String C_LIBRARIES
public static final java.lang.String C_PROPERTIES
public static final java.lang.String C_PARSER
public static final java.lang.String C_SCRIPTS
public static final java.lang.String C_FORMDEF
public static final java.lang.String C_JAVAPROPERTIES
public static final java.lang.String C_JAVALIBRARIES
public static final java.lang.String C_MBUS
public static final java.lang.String C_INCLUDE
public static final java.lang.String C_SECURITY
public static final java.lang.String C_SHAREDCONN
public static final java.lang.String C_INCLUDEFILES
public java.lang.String password
public boolean dontOverwriteConfig
public boolean isInclude
public java.util.Vector includedFiles
Constructor Detail |
---|
public FileConfig(java.lang.String path) throws java.io.IOException
path
- the file system path or URL for the configuration file (the
file is not actually parsed at this time)
java.io.IOException
- a problem while constructing the objectMethod Detail |
---|
public java.lang.String getVersion()
public void setVersion(java.lang.String version)
version
- a new version string to be setpublic void setPassword(java.lang.String pwd)
pwd
- The new password valuepublic void setErrorListener(ErrorListener listener)
listener
- The new errorListener valuepublic void setConfig(java.lang.String key, java.lang.Object data)
key
- The new config valuedata
- The new config valuepublic void setConfigPath(java.lang.String path)
path
- The new configPath valuepublic void setTables(java.util.TreeMap tables)
tables
- The new tables valuepublic void setImport(java.util.Vector v)
v
- The new import valuepublic java.util.TreeMap getConfig(java.lang.String key)
key
- compound key, which identifies an object in the configuration
hierarchy
public java.lang.String getConfigPath()
public java.util.TreeMap getTables()
public java.lang.String getLine() throws java.io.IOException
java.io.IOException
- problem while reading the current line from the
configuration filepublic java.util.TreeMap getTask(java.lang.String name)
name
- the key (simple key, not a compound one) of the desired
AssemblyLine configuration object
public java.util.Vector getIncludes()
public java.util.TreeMap getConnector(java.lang.String name)
name
- the key (simple key, not a compound one) of the desired
Connector configuration object
public java.util.TreeMap getParser(java.lang.String name)
name
- the key (simple key, not a compound one) of the desired Parser
configuration object
public java.util.TreeMap getLibrary(java.lang.String name)
name
- the key (simple key, not a compound one) of the desired
Library configuration object
public java.util.TreeMap getListener(java.lang.String name)
name
- the key (simple key, not a compound one) of the desired
Listener configuration object
public java.util.TreeMap getScript(java.lang.String name)
name
- the key (simple key, not a compound one) of the desired Script
configuration object
public java.util.TreeMap getProperty(java.lang.String type)
type
- the key (simple key, not a compound one) of the desired
Properties configuration object
public java.util.TreeMap getForm(java.lang.String name)
name
- the key (simple key, not a compound one) of the desired Form
configuration object
public java.util.TreeMap getInclude(java.lang.String name)
name
- the key (simple key, not a compound one) of the desired
Includes configuration object
public java.lang.Object getKey(java.util.TreeMap map, java.lang.String key)
map
- the root configuration object of the configuration hierarchykey
- a compound key, which identifies the searched configuration
object in the hierarchy
public java.util.TreeMap loadConfig() throws java.lang.Exception
java.lang.Exception
- problem while parsing the configuration filepublic void openInputFile(java.lang.String path) throws java.lang.Exception
path
- file system path or URL for the configuration file; if the
parameter is set to " java.lang.Exception
- problem while opening the configuration file for readingpublic java.util.TreeMap loadConfig(java.lang.String urlPath) throws java.lang.Exception
urlPath
- file system path or URL for the configuration file if the
parameter is set to " java.lang.Exception
- problem while parsing the configuration filepublic java.util.TreeMap loadConfig(java.io.BufferedReader input) throws java.lang.Exception
input
- the configuration input stream
java.lang.Exception
- problem while parsing the configuration input streampublic java.util.TreeMap loadConfig(byte[] data) throws java.lang.Exception
data
- the configuration data
java.lang.Exception
- problem while parsing the configuration datapublic java.util.TreeMap loadConfig2(java.lang.String urlPath) throws java.lang.Exception
urlPath
- file system path or URL for the configuration file; if the
parameter is set to " java.lang.Exception
- problem while parsing the configuration filepublic java.util.TreeMap loadConfig3() throws java.lang.Exception
java.lang.Exception
- problem while parsing the configuration filepublic void includeFiles(boolean first) throws java.lang.Exception
first
- whether this is the first include file for the currently
parsed configuration stream
java.lang.Exception
- problem while parsing the configurationspublic void includeFile(java.lang.String path, boolean overwrite) throws java.lang.Exception
path
- the include configuration fileoverwrite
- whether to overwrite existing configurations
java.lang.Exception
- problem while parsing the configurationspublic void addSection(java.util.TreeMap config, java.lang.String name) throws java.io.IOException
config
- the TreeMap where the parsed section will be addedname
- key name for the parsed section
java.io.IOException
- problem while parsing the configurationspublic void addVector(java.util.TreeMap h, java.lang.String name) throws java.io.IOException
h
- the TreeMap configuration object, where the parsed Vector with
configurations will be addedname
- the key name for the configurations Vector
java.io.IOException
- problem while parsing the configurationspublic void addMap(java.util.TreeMap h, java.lang.String name) throws java.io.IOException
h
- the TreeMap where where the addition will happenname
- the key name
java.io.IOException
- problempublic void addAttribute(java.util.TreeMap h, java.lang.String name) throws java.io.IOException
h
- the TreeMap where the attrbute will be addedname
- the name of the attribute
java.io.IOException
- problem while parsing the configurationspublic void saveConfig() throws java.lang.Exception
java.lang.Exception
- if a problem occurspublic void saveConfig(java.io.OutputStream output) throws java.io.IOException
output
- the output stream
java.io.IOException
- problem while writing the configurationspublic void saveConfig(java.util.TreeMap config, java.lang.String path) throws java.io.IOException
config
- the configuration TreeMappath
- the file path
java.io.IOException
- problem while writing the configurationspublic void saveConfig(java.io.BufferedWriter out) throws java.io.IOException
out
- the output stream
java.io.IOException
- problem while writing the configurationspublic void saveConfig(java.util.TreeMap config) throws java.io.IOException
config
- the configuration TreeMap
java.io.IOException
- problem while writing the configurationspublic void saveConfig(java.io.BufferedWriter out, java.lang.String type, java.util.TreeMap cf) throws java.io.IOException
out
- the output streamtype
- the name of the categorycf
- the configurations TreeMap
java.io.IOException
- problem while writing the configurationspublic void saveVector(java.io.BufferedWriter out, java.lang.String prefix, java.util.Vector v) throws java.io.IOException
out
- the output streamprefix
- indentation prefixv
- the configuration Vector
java.io.IOException
- problem while writing the configurationspublic void saveArray(java.io.BufferedWriter out, java.lang.String prefix, java.util.TreeMap cf) throws java.io.IOException
out
- the output streamprefix
- indentation prefixcf
- the configuration TreeMap
java.io.IOException
- problem while writing the configurationspublic void loadEncrypted() throws java.io.IOException
java.io.IOException
- problempublic boolean fireError(java.lang.Exception error) throws java.lang.Exception
error
- the error object
java.lang.Exception
- problempublic void removeIncludedComponents()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |