public class XmlResourceCollection extends ResourceCollection
ResourceCollection that handles xml documents.ResourceCollection.Resourcedescription, id, idToPath, pathToId, writableIndex, writableResource| Constructor and Description |
|---|
XmlResourceCollection(java.lang.String id)
Construct a new object with the given id (The id is simply a name, not one of the resources).
|
XmlResourceCollection(java.lang.String id,
java.util.List resources)
Construct a new object with the given id and list of resource paths.
|
XmlResourceCollection(java.lang.String id,
java.lang.String description)
Construct a new object with the given id (The id is simply a name, not one of the resources)
and description.
|
XmlResourceCollection(java.lang.String id,
java.lang.String writableResource,
java.util.List resources)
Deprecated.
not good anymore
|
XmlResourceCollection(java.lang.String id,
XmlResourceCollection that)
copy ctor
|
| Modifier and Type | Method and Description |
|---|---|
void |
clearCache()
clear the cache
|
org.w3c.dom.Element |
getRoot(int resourceIndex)
Create (if not already) and return the xml Element root of the xml resource
at the given index.
|
org.w3c.dom.Element |
getRoot(int resourceIndex,
boolean lookAtCache)
Create (if not already) and return the xml Element root of the xml resource
at the given index.
|
org.w3c.dom.Document |
getWritableDocument(java.lang.String dfltXml)
Return the Document which is the user's writable xml document.
|
org.w3c.dom.Element |
getWritableRoot(java.lang.String dfltXml)
Create (if not created) and return the root of the user's writable xml.
|
void |
removeWritable()
Remove the writable resource from the list
|
void |
setWritableDocument(org.w3c.dom.Document d,
org.w3c.dom.Element root)
Set the document and root element which represent the user's writable xml document.
|
void |
writeWritable()
Write out the user's writable xml into the writable resource path.
|
void |
writeWritableResource(java.lang.String contents)
Write the given contents into the writable resource file.
|
addLabels, addResource, addResource, addResourceAtStart, addResourceAtStart, addResourceAtStart, addResources, contains, deleteAllFiles, get, getCanLoadMore, getDescription, getId, getLabel, getPathFromId, getProperty, getResourceId, getResources, getShortName, getWritable, hasWritableResource, isHttp, isHttp, isValid, isWritable, isWritableResource, read, read, read, readWritableResource, removeAll, removeResource, setCanLoadMore, setDescription, setId, setIdForPath, size, toStringpublic XmlResourceCollection(java.lang.String id)
id - The id or name of this collection.public XmlResourceCollection(java.lang.String id,
XmlResourceCollection that)
id - new idthat - resourcecollection to copy frompublic XmlResourceCollection(java.lang.String id,
java.lang.String description)
id - The id or name of this collection.description - A human readable description of this collectionpublic XmlResourceCollection(java.lang.String id,
java.util.List resources)
id - The id or name of this collection.resources - The list of resource paths.public XmlResourceCollection(java.lang.String id,
java.lang.String writableResource,
java.util.List resources)
id - The id or name of this collection.writableResource - The resource path that the user can write to.resources - The list of resource paths.public void clearCache()
clearCache in class ResourceCollectionpublic void writeWritableResource(java.lang.String contents)
throws java.io.FileNotFoundException,
java.io.IOException
writeWritableResource in class ResourceCollectioncontents - java.io.FileNotFoundExceptionjava.io.IOExceptionpublic void writeWritable()
throws java.io.FileNotFoundException,
java.io.IOException
java.io.FileNotFoundException - When the write fails.java.io.IOException - When the write fails.public org.w3c.dom.Element getWritableRoot(java.lang.String dfltXml)
dfltXml - If the user's document does not exist then use this xml to create the document.public org.w3c.dom.Document getWritableDocument(java.lang.String dfltXml)
dfltXml - If the user's document does not exist then use this xml to create the document.public void setWritableDocument(org.w3c.dom.Document d,
org.w3c.dom.Element root)
d - The new document.root - The root of the writable xml.public void removeWritable()
removeWritable in class ResourceCollectionpublic org.w3c.dom.Element getRoot(int resourceIndex)
resourceIndex - Which resource.public org.w3c.dom.Element getRoot(int resourceIndex,
boolean lookAtCache)
resourceIndex - Which resource.lookAtCache - SHould we check the cache first