|
DLESE Tools v1.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.xml.SimpleXMLDirectory
Straightforward implementaion of the XMLDirectory interface for a file-based system, using a TreeMap for optimal sorting of keys.
Proper invocation tests init and calls setDirectory as shown in the following example.
SimpleXMLDirectory directory = new SimpleXMLDirectory(myDirectory); if (directory.init()) { directory.setDirectory(XMLFactory.DLESE, "ID"); }
The example creates a TreeMap directory of DLESE XMLMap types hashed on the DLESE "ID" metadata field.
Field Summary | |
---|---|
protected boolean |
isValid
boolean value indicates success of initialization |
protected TreeMap |
map
local map containing an XMLMap object for each well-formed XML record in directory |
protected File |
xmlDirectory
file directory containing the raw XML records |
Constructor Summary | |
---|---|
SimpleXMLDirectory(File directory)
Constructor for accepting a File argument. |
|
SimpleXMLDirectory(String directoryPath)
Constructor for accepting a String directory path argument. |
Method Summary | |
---|---|
void |
destroy()
Releases all resources and calls finalize method. |
XMLMap |
getXMLMap(Object key)
Getter method to retrieve a specific XMLMap. |
List |
getXMLMapKeys()
Retrieves a sorted list of the keys contained in the directory. |
List |
getXMLMaps()
Retrieves the list of XMLMaps making up the directory. |
boolean |
init()
Tests directory for validity and initialzes the local TreeMap. |
void |
setDirectory(int xmlMapType,
String keyField)
After successful initialization, this method creates the directory of XMLMap types using the given key. |
void |
setXMLMap(Object key,
XMLMap values)
Setter method for storing or updating a specific XMLMap. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean isValid
protected File xmlDirectory
protected TreeMap map
Constructor Detail |
public SimpleXMLDirectory(File directory)
directory
- The File directory containing XML records to be mapped.public SimpleXMLDirectory(String directoryPath)
directoryPath
- The path to the directory containing XML records to be mapped.Method Detail |
public boolean init()
init
in interface XMLDirectory
public void destroy()
destroy
in interface XMLDirectory
public XMLMap getXMLMap(Object key)
getXMLMap
in interface XMLDirectory
key
- The key value identifying the specific XMLmap to retrieve.
public void setXMLMap(Object key, XMLMap values)
setXMLMap
in interface XMLDirectory
key
- The key value identifying the specific XMLmap to update.values
- The XMLMap to store in the directory.public void setDirectory(int xmlMapType, String keyField)
setDirectory
in interface XMLDirectory
xmlMapType
- integer constant references predefined mapping in XMLMapFactory.keyField
- Name of field used in the XMLMaps being created, to use as map key in directory.public List getXMLMapKeys()
getXMLMapKeys
in interface XMLDirectory
public List getXMLMaps()
getXMLMaps
in interface XMLDirectory
|
DLESE Tools v1.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |