|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ls.util.xml.XMLConfigLoader
This class loads a XML config file into a map. The config file can be either an URL or a file on the harddisk.
Field Summary | |
static String |
ARCHIVE_STRING
constant for the String 'archive' |
static String |
FILE_STRING
constant for the String 'file' |
static String |
IP_ADDRESS_STRING
constant for the String 'ipAddress' |
protected ILogger |
logger
the reference to the owning agent's log file (initally set to SystemLogger.getLogger() ) |
static String |
NAME_STRING
constant for the String 'name' |
static String |
PATH_STRING
constant for the String 'path' |
static String |
PORT_STRING
constant for the String 'port' |
static String |
PROTOCOL_STRING
constant for the String 'protocol' |
Constructor Summary | |
XMLConfigLoader()
constructor that initializes a XMLHandler to be used for reading config files |
|
XMLConfigLoader(String protocol)
constructor that initializes a XMLHandler as the ConfigHandler to be used for reading config files |
|
XMLConfigLoader(String protocol,
IXMLHandler iXMLHandler)
constructor that takes an IXMLHandler as the ConfigHandler to be used for reading config files |
Method Summary | |
static String |
getGlobalConfigPath()
Returns the path where the config files, that are not addressed via an absolute path, will be found. |
Map |
parseFile(List configFileNames)
Reads the XML data from the config file and parses it to an hash object. |
Map |
parseFile(Map configFileName)
Reads the XML data from the config file and parses it to an hash object. |
Map |
parseFile(String configFileName)
Reads the XML data from the config file and parses it to an hash object. |
static void |
setGlobalConfigPath(Map configPath)
Sets the path where the config files, that are not addressed via an absolute path, will be found. |
static void |
setGlobalConfigPath(String path)
Sets the path where the config files, that are not addressed via an absolute path, will be found. |
void |
setLog(ILogger logger)
Sets the ILogger for the ConfigLoader. |
void |
setProtocol(String protocol)
sets the protocol for the URL to read the config file from. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String FILE_STRING
public static final String PROTOCOL_STRING
public static final String IP_ADDRESS_STRING
public static final String PATH_STRING
public static final String ARCHIVE_STRING
public static final String NAME_STRING
public static final String PORT_STRING
protected ILogger logger
SystemLogger.getLogger()
)Constructor Detail |
public XMLConfigLoader()
XMLHandler
public XMLConfigLoader(String protocol)
protocol
- the protocol to use for loading the config fileXMLHandler
public XMLConfigLoader(String protocol, IXMLHandler iXMLHandler)
protocol
- the protocol to use for loading the config fileXMLHandler
Method Detail |
public void setLog(ILogger logger)
logger
- reference to the ILogger of the owning agentpublic static String getGlobalConfigPath()
public static void setGlobalConfigPath(String path) throws ProgrammingException
path
- config file pathProgrammingException
- If global config path was already set beforepublic static void setGlobalConfigPath(Map configPath) throws ProgrammingException
configPath
- config file pathProgrammingException
- If global config path was already set beforepublic Map parseFile(String configFileName)
configFileName
- one file names specifying the config file to be readpublic Map parseFile(List configFileNames)
configFileNames
- one or more file names specifying the config file(s) to be readpublic Map parseFile(Map configFileName)
configFileName
- one file name specifying the config file to be readpublic void setProtocol(String protocol)
protocol
- the protocol to read from (e.g.: 'file:///', 'http:///', 'ftp:///', ...)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |