uk.org.ogsadai.activity.xmldb
Class XMLDBUtilities
java.lang.Object
|
+--uk.org.ogsadai.activity.xmldb.XMLDBUtilities
- public class XMLDBUtilities
- extends java.lang.Object
This contains some utility methods for accessing and interacting with XMLDB database collections.
- Author:
- The OGSA-DAI Project Team
Field Summary |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement |
Method Summary |
static void |
addResource(org.xmldb.api.base.Collection collection, java.lang.String resourceName, java.lang.String resourcePath)
Adds a named resource to the specified parent collection. |
static void |
addResource(java.lang.String url, java.io.File file)
Adds the new resource at the specified location to the specified collection. |
static org.xmldb.api.base.Collection |
createCollection(org.xmldb.api.base.Collection parent, java.lang.String name)
Creates the specified collection. |
static void |
createCollection(java.lang.String url)
Creates the collection at the specified URL. |
static void |
removeCollection(org.xmldb.api.base.Collection parent, java.lang.String name)
Removes the named collection from the specified parent collection. |
static void |
removeCollection(java.lang.String url)
Removes the collection at the specified URL. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COPYRIGHT_NOTICE
private static final java.lang.String COPYRIGHT_NOTICE
-
Copyright statement
- See Also:
- Constant Field Values
XMLDBUtilities
public XMLDBUtilities()
createCollection
public static org.xmldb.api.base.Collection createCollection(org.xmldb.api.base.Collection parent,
java.lang.String name)
throws org.xmldb.api.base.XMLDBException
-
Creates the specified collection. If it already exists then the existing collection is deleted and the new collection created.
-
- Parameters:
parent
- Parent collection
name
- Name of new collection
- Returns:
- new collection
- Throws:
org.xmldb.api.base.XMLDBException
- If any problems arise
addResource
public static void addResource(org.xmldb.api.base.Collection collection,
java.lang.String resourceName,
java.lang.String resourcePath)
throws org.xmldb.api.base.XMLDBException,
XMLFileException,
XMLDocumentException,
XMLParseException
-
Adds a named resource to the specified parent collection.
-
- Parameters:
collection
- Parent collection
resourceName
- Name of new resource
resourcePath
- Path to XML file containing resource content.
- Throws:
org.xmldb.api.base.XMLDBException
- If any problems arise
XMLFileException
- If there are problems accessing the file.
XMLDocumentException
- If the file does not contain valid XML.
XMLParseException
- If there are internal problems when parsing the file.
removeCollection
public static void removeCollection(org.xmldb.api.base.Collection parent,
java.lang.String name)
throws org.xmldb.api.base.XMLDBException
-
Removes the named collection from the specified parent collection.
-
- Parameters:
parent
- Parent collection
name
- Name of collection to remove
- Throws:
org.xmldb.api.base.XMLDBException
- If any problems arise
createCollection
public static void createCollection(java.lang.String url)
throws org.xmldb.api.base.XMLDBException
-
Creates the collection at the specified URL. Note that the new collection name will be the part to the right of the last "/" in the collection URL.
-
- Parameters:
url
- The full URL to the new collection.
- Throws:
org.xmldb.api.base.XMLDBException
- If any problems arise
addResource
public static void addResource(java.lang.String url,
java.io.File file)
throws org.xmldb.api.base.XMLDBException,
DAIFileNotFoundException,
DAIFileNotFileException,
DAIFileReadIOException
-
Adds the new resource at the specified location to the specified collection.
-
- Parameters:
url
- The URL of the collection to add the resource to.
file
- The file containing the new XML resource content. The name of the resource is determined using the file name without the extension.
- Throws:
org.xmldb.api.base.XMLDBException
- If any problems arise
DAIFileNotFoundException
- The file is not found
DAIFileNotFileException,
- The file is not a file (e.g. it's a directory)
DAIFileReadIOException
- There is a problem in reading the file.
DAIFileNotFileException
removeCollection
public static void removeCollection(java.lang.String url)
throws org.xmldb.api.base.XMLDBException
-
Removes the collection at the specified URL.
-
- Parameters:
url
- The URL of the collection to remove.
- Throws:
org.xmldb.api.base.XMLDBException
- If any problems arise