Package ucar.unidata.xml
Class XmlResourceCollection
java.lang.Object
ucar.unidata.util.ResourceCollection
ucar.unidata.xml.XmlResourceCollection
An extension of
ResourceCollection
that handles xml documents.- Version:
- $Revision: 1.27 $ $Date: 2006/10/30 18:10:01 $
- Author:
- Metapps development team
-
Nested Class Summary
Nested classes/interfaces inherited from class ucar.unidata.util.ResourceCollection
ResourceCollection.Resource
-
Field Summary
Fields inherited from class ucar.unidata.util.ResourceCollection
description, id, idToPath, pathToId, writableIndex, writableResource
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new object with the given id (The id is simply a name, not one of the resources).XmlResourceCollection
(String id, String description) Construct a new object with the given id (The id is simply a name, not one of the resources) and description.XmlResourceCollection
(String id, String writableResource, List resources) Construct a new object with the given id, user writable resource and list of other resource paths.XmlResourceCollection
(String id, List resources) Construct a new object with the given id and list of resource paths.XmlResourceCollection
(String id, XmlResourceCollection that) copy ctor -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear the cachegetRoot
(int resourceIndex) Create (if not already) and return the xml Element root of the xml resource at the given index.getRoot
(int resourceIndex, boolean lookAtCache) Create (if not already) and return the xml Element root of the xml resource at the given index.getWritableDocument
(String dfltXml) Return the Document which is the user's writable xml document.getWritableRoot
(String dfltXml) Create (if not created) and return the root of the user's writable xml.void
Remove the writable resource from the listvoid
setWritableDocument
(Document d, Element root) Set the document and root element which represent the user's writable xml document.void
Write out the user's writable xml into the writable resource path.void
writeWritableResource
(String contents) Write the given contents into the writable resource file.Methods inherited from class ucar.unidata.util.ResourceCollection
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, toString
-
Constructor Details
-
XmlResourceCollection
Construct a new object with the given id (The id is simply a name, not one of the resources).- Parameters:
id
- The id or name of this collection.
-
XmlResourceCollection
copy ctor- Parameters:
id
- new idthat
- resourcecollection to copy from
-
XmlResourceCollection
Construct a new object with the given id (The id is simply a name, not one of the resources) and description.- Parameters:
id
- The id or name of this collection.description
- A human readable description of this collection
-
XmlResourceCollection
Construct a new object with the given id and list of resource paths.- Parameters:
id
- The id or name of this collection.resources
- The list of resource paths.
-
XmlResourceCollection
Construct a new object with the given id, user writable resource and list of other resource paths.- Parameters:
id
- The id or name of this collection.writableResource
- The resource path that the user can write to.resources
- The list of resource paths. deprecated not good anymore
-
-
Method Details
-
clearCache
public void clearCache()clear the cache- Overrides:
clearCache
in classResourceCollection
-
writeWritableResource
Write the given contents into the writable resource file. This overwrites the base class method to reset the writable xml document and root.- Overrides:
writeWritableResource
in classResourceCollection
- Parameters:
contents
-- Throws:
FileNotFoundException
IOException
-
writeWritable
Write out the user's writable xml into the writable resource path.- Throws:
FileNotFoundException
- When the write fails.IOException
- When the write fails.
-
getWritableRoot
Create (if not created) and return the root of the user's writable xml.- Parameters:
dfltXml
- If the user's document does not exist then use this xml to create the document.- Returns:
- The root of the user's writable xml document.
-
getWritableDocument
Return the Document which is the user's writable xml document.- Parameters:
dfltXml
- If the user's document does not exist then use this xml to create the document.- Returns:
- The writable xml document.
-
setWritableDocument
Set the document and root element which represent the user's writable xml document.- Parameters:
d
- The new document.root
- The root of the writable xml.
-
removeWritable
public void removeWritable()Remove the writable resource from the list- Overrides:
removeWritable
in classResourceCollection
-
getRoot
Create (if not already) and return the xml Element root of the xml resource at the given index.- Parameters:
resourceIndex
- Which resource.- Returns:
- The root Element.
-
getRoot
Create (if not already) and return the xml Element root of the xml resource at the given index.- Parameters:
resourceIndex
- Which resource.lookAtCache
- SHould we check the cache first- Returns:
- The root Element.
-