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

Constructor Summary
XMLDBUtilities()
           
 
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 loadDriver(java.lang.String driver)
           
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
 

Constructor Detail

XMLDBUtilities

public XMLDBUtilities()
Method Detail

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.

org.xmldb.api.base.XMLDBException

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,
                               CommonSystemException,
                               CommonUserException
Adds a named resource to the specified parent collection.

org.xmldb.api.base.XMLDBException
CommonSystemException
CommonUserException

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.

org.xmldb.api.base.XMLDBException

createCollection

public static void createCollection(java.lang.String url)
                             throws CommonSystemException
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.
CommonSystemException

addResource

public static void addResource(java.lang.String url,
                               java.io.File file)
                        throws CommonSystemException
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.
CommonSystemException

removeCollection

public static void removeCollection(java.lang.String url)
                             throws CommonSystemException
Removes the collection at the specified URL.

Parameters:
url - the URL of the collection to remove.
CommonSystemException

loadDriver

public static void loadDriver(java.lang.String driver)
                       throws CommonSystemException
CommonSystemException