kevinross 2003/07/10 14:45:17
Modified: java/src/org/apache/xindice/client/xmldb/xmlrpc CollectionImpl.java DatabaseImpl.java Log: formatting, organize imports Revision Changes Path 1.22 +619 -635 xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/CollectionImpl.java Index: CollectionImpl.java =================================================================== RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/CollectionImpl.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- CollectionImpl.java 30 May 2003 22:39:16 -0000 1.21 +++ CollectionImpl.java 10 Jul 2003 21:45:17 -0000 1.22 @@ -99,645 +99,629 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Kimbro Staken</a> */ public class CollectionImpl extends XindiceCollection { - /* path to XML-RPC service on database */ - private static String XINDICE_SERVICE_LOCATION = "/Xindice/"; + /* path to XML-RPC service on database */ + private static String XINDICE_SERVICE_LOCATION = "/Xindice/"; + + /* host and port number of server */ + private String hostPort; + + /* location of the XML-RPC service in the web server */ + private String serviceLocation; + + /* SAX parser the XML-RPC service will use */ + private String xmlrpcDriver; + + /* the XML-RPC client stub, connected to server */ + private XmlRpcClient client = null; + + /** + * Creates new <code>CollectionImpl</code> instance representing connection + * to server collection. + * + * @param hostPort hostname and port number in <code>host:port</code> format. + * Port no is optional, in which case HTTP default is assumed. + * @param serviceLocation is the path in the web server's namespace where + * the XML-RPC service is mounted. It is <code>null</code> unless + * the <code>service-location</code> property of + * <code>org.apache.xindice.client.xmlrpc.DatabaseImpl</code> + * is set. + * @param collPath is the name of the collection to open. + * @exception XMLDBException thrown if a connection could not be established, + * because of URL syntax errors, or connection failure, or if no + * collection with path <code>collPath</code> could be located. + */ + public CollectionImpl(String hostPort, String serviceLocation, String xmlrpcDriver, String collPath) throws XMLDBException { + super(collPath); + this.hostPort = hostPort; + this.serviceLocation = serviceLocation; + this.xmlrpcDriver = xmlrpcDriver; + this.collPath = collPath; + + XmlRpc.setEncoding("UTF8"); + + /* + * Determine the SAXparser the xmlrpc client will use. + * In priority order: + * DatabaseImpl xmlrpc-driver property + * (passed in the xmlrpcDriver parameter) + * System property "xindice.xmlrpc.driver" + * Default value "xerces" + */ + if (xmlrpcDriver == null) { + xmlrpcDriver = System.getProperty("xindice.xmlrpc.driver"); + } + if (xmlrpcDriver == null) { + xmlrpcDriver = "xerces"; + } + XmlRpc.setKeepAlive(true); + try { + XmlRpc.setDriver(xmlrpcDriver); + } + catch (Exception e) { + throw new XMLDBException(ErrorCodes.VENDOR_ERROR, "Xerces needed", e); + } + + /* + * Determine the path in the web server to the XML-RPC service. + * In priority order: + * DatabaseImpl service-location property + * (passed in the serviceLocation parameter) + * System property "xindice.xmlrpc.service-location" + * Default value "/Xindice/" + */ + if (serviceLocation == null) { + serviceLocation = System.getProperty("xindice.xmlrpc.service-location"); + } + if (serviceLocation == null) { + serviceLocation = XINDICE_SERVICE_LOCATION; + } + + if (!serviceLocation.startsWith("/")) { + serviceLocation = "/" + serviceLocation; + } + if (!serviceLocation.endsWith("/")) { + serviceLocation = serviceLocation + "/"; + } + System.out.println("serviceLocation=<" + serviceLocation + ">"); + String xmlrpcURI = "http://" + hostPort + serviceLocation; + + try { + + client = new XmlRpcClient(xmlrpcURI); + + /* Just check the collection does actually exist */ + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + String exists = (String) runRemoteCommand("GetCollectionConfiguration", params); + if (!"yes".equals(exists)) { + + throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION, "Collection not found: " + collPath); + } + } + catch (MalformedURLException e) { - /* host and port number of server */ - private String hostPort; - - /* location of the XML-RPC service in the web server */ - private String serviceLocation; - - /* SAX parser the XML-RPC service will use */ - private String xmlrpcDriver; - - /* the XML-RPC client stub, connected to server */ - private XmlRpcClient client = null; - - - /** - * Creates new <code>CollectionImpl</code> instance representing connection - * to server collection. - * - * @param hostPort hostname and port number in <code>host:port</code> format. - * Port no is optional, in which case HTTP default is assumed. - * @param serviceLocation is the path in the web server's namespace where - * the XML-RPC service is mounted. It is <code>null</code> unless - * the <code>service-location</code> property of - * <code>org.apache.xindice.client.xmlrpc.DatabaseImpl</code> - * is set. - * @param collPath is the name of the collection to open. - * @exception XMLDBException thrown if a connection could not be established, - * because of URL syntax errors, or connection failure, or if no - * collection with path <code>collPath</code> could be located. - */ - public CollectionImpl(String hostPort, String serviceLocation, - String xmlrpcDriver, String collPath) - throws XMLDBException { - super(collPath); - - this.hostPort = hostPort; - this.serviceLocation = serviceLocation; - this.xmlrpcDriver = xmlrpcDriver; - this.collPath = collPath; - - XmlRpc.setEncoding("UTF8"); - - /* - * Determine the SAXparser the xmlrpc client will use. - * In priority order: - * DatabaseImpl xmlrpc-driver property - * (passed in the xmlrpcDriver parameter) - * System property "xindice.xmlrpc.driver" - * Default value "xerces" - */ - if (xmlrpcDriver == null) { - xmlrpcDriver = System.getProperty("xindice.xmlrpc.driver"); - } - if (xmlrpcDriver == null) { - xmlrpcDriver = "xerces"; - } - XmlRpc.setKeepAlive(true); - try { - XmlRpc.setDriver(xmlrpcDriver); - } catch (Exception e) { - throw new XMLDBException(ErrorCodes.VENDOR_ERROR, "Xerces needed", e); - } - - /* - * Determine the path in the web server to the XML-RPC service. - * In priority order: - * DatabaseImpl service-location property - * (passed in the serviceLocation parameter) - * System property "xindice.xmlrpc.service-location" - * Default value "/Xindice/" - */ - if (serviceLocation == null) { - serviceLocation = System.getProperty( - "xindice.xmlrpc.service-location"); - } - if (serviceLocation == null) { - serviceLocation = XINDICE_SERVICE_LOCATION; - } - - if (! serviceLocation.startsWith("/")) { - serviceLocation = "/" + serviceLocation; - } - if (! serviceLocation.endsWith("/")) { - serviceLocation = serviceLocation + "/"; - } - System.out.println( "serviceLocation=<" + serviceLocation + ">" ); - String xmlrpcURI = "http://" + hostPort + serviceLocation; - - try { - - client = new XmlRpcClient(xmlrpcURI); - - /* Just check the collection does actually exist */ - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - String exists = - (String) runRemoteCommand("GetCollectionConfiguration", params); - if (!"yes".equals(exists)) { - - throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION, - "Collection not found: " + collPath); - } - } catch (MalformedURLException e) { - client = null; - throw new XMLDBException(ErrorCodes.INVALID_URI, e); - } catch (Exception e) { + throw new XMLDBException(ErrorCodes.INVALID_URI, e); + } + catch (Exception e) { client = null; - throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION, - "Collection not found: " + collPath, e); - } - } - - /** - * Submits a command for RPC to database server - * - * @param cmdName command name - * @param params hashtable containing named parameters to send to server - * @return the return value from the server. Type of return value depends on - * command. - * - * @exception Exception thrown if XML-RPC reports an exception. - */ - private Object runRemoteCommand(String cmdName, Hashtable params) throws Exception { - - params.put(RPCMessageInterface.MESSAGE_PARAM, cmdName); - - Vector v = new Vector(); - v.add(params); - return ((Hashtable) client.execute("run",v)).get(RPCDefaultMessage.RESULT); - } - - /** - * Retrieves a <code>Resource</code> from the database. If the - * <code>Resource</code> could not be - * located a null value will be returned. - * - * @param id the unique id for the requested resource. - * @return The retrieved <code>Resource</code> instance. - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> - * method has been called on the <code>Collection</code><br /> - */ - public Resource getResource(String id) throws XMLDBException { - - checkOpen(); - try { - - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - params.put(RPCDefaultMessage.NAME, id); - params.put(RPCDefaultMessage.COMPRESSED, "true"); - - Object result = runRemoteCommand("GetDocument", params); - /* - * If we get a Hashtable back then the result is compressed. - */ - if ( result instanceof Hashtable ) { - Hashtable compressed = (Hashtable) result; - SymbolDeserializer symbolDeserial = new SymbolDeserializer(); - return new XMLResourceImpl(id, id, this, - symbolDeserial.getSymbols(compressed), - (byte []) compressed.get("document")); - } - else { - return new XMLResourceImpl(id, (String) result, this); - } - - } catch (Exception e) { - return null; - } - } - - /** - * Returns the number of resources currently stored in this collection or 0 - * if the collection is empty. - * - * @return the number of resource in the collection. - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> - * method has been called on the <code>Collection</code><br /> - */ - public int getResourceCount() throws XMLDBException { - - checkOpen(); - try { - - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - return ((Integer) runRemoteCommand( - "GetDocumentCount", params)).intValue(); - } catch (Exception e) { - - throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e); - } - } - - /** - * Stores the provided resource into the database. If the resource does not - * already exist it will be created. If it does already exist it will be - * updated. - * - * @param res the resource to store in the database. - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - * <code>ErrorCodes.INVALID_RESOURCE</code> if the <code>Resource</code> is - * not valid. - * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> - * method has been called on the <code>Collection</code><br /> - */ - public void storeResource(Resource res) throws XMLDBException { - - if (!(res instanceof XMLResource)) { - - throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, - "Only XML resources supported"); - } - - if (res.getContent() == null) { - - throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, - "no resource data"); - } - checkOpen(); - try { - - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - params.put(RPCDefaultMessage.NAME, res.getId()); - params.put(RPCDefaultMessage.DOCUMENT, res.getContent()); - - String name = (String) runRemoteCommand("InsertDocument", params); - ((XMLResourceImpl) res).setId(name); - - } catch (Exception e) { - - throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e); - } - } - - /* see superclass for documentation */ - public boolean isOpen() { - - return (client != null); - } - - /* see superclass for documentation */ - public String getURI() { - - return "xmldb:" + DatabaseImpl.DRIVER_NAME + "://" - + hostPort + collPath; - } - - /** - * Returns a <code>Collection</code> instance for the requested child collection - * if it exists. - * - * @param name the name of the child collection to retrieve. - * @return the requested child collection or null if it couldn't be found. - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> - * method has been called on the <code>Collection</code><br /> - */ - public Collection getChildCollection(String name) throws XMLDBException { - - if (name.indexOf('/') != -1) { - - throw new XMLDBException(ErrorCodes.INVALID_COLLECTION); - } - - try { - return new CollectionImpl(hostPort, serviceLocation, - xmlrpcDriver, collPath + "/" + name); - } - catch (XMLDBException e) { - if (e.errorCode == ErrorCodes.NO_SUCH_COLLECTION) { - // per getChildCollection contract, return null if not found - return null; - } - throw e; - } - } - - /** - * Creates a new unique ID within the context of the <code>Collection</code> - * - * @return the created id as a string. - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> - * method has been called on the <code>Collection</code><br /> - */ - public String createId() throws XMLDBException { - - checkOpen(); - try { - - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - return (String) runRemoteCommand("CreateNewOID", params); - } catch (Exception e) { - - throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e); - } - } - - /** - * Releases all resources consumed by the <code>Collection</code>. - * The <code>close</code> method must - * always be called when use of a <code>Collection</code> is complete. It is - * not safe to use a <code>Collection</code> after the <code>close</code> - * method has been called. - * - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - */ - public void close() throws org.xmldb.api.base.XMLDBException { - - client = null; - } - - /** - * Returns the parent collection for this collection or null if no parent - * collection exists. - * - * @return the parent <code>Collection</code> instance. - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> - * method has been called on the <code>Collection</code><br /> - */ - public Collection getParentCollection() throws XMLDBException { - - // If there's only one slash then it's the root. - if (collPath.lastIndexOf("/") == 0) { - return null; - } - - try { - return new CollectionImpl(hostPort, serviceLocation, - xmlrpcDriver, collPath.substring(0, collPath.lastIndexOf('/'))); - } - catch (XMLDBException e) { - if (e.errorCode == ErrorCodes.NO_SUCH_COLLECTION) { - // per getParentCollection contract, return null if no parent - return null; - } - throw e; - } - } - - /** - * Removes the <code>Resource</code> from the database. - * - * @param res the resource to remove. - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - * <code>ErrorCodes.INVALID_RESOURCE</code> if the <code>Resource</code> is - * not valid.<br /> - * <code>ErrorCodes.NO_SUCH_RESOURCE</code> if the <code>Resource</code> is - * not known to this <code>Collection</code>. - * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> - * method has been called on the <code>Collection</code><br /> - */ - public void removeResource(Resource res) throws XMLDBException { - - if (!(res instanceof XMLResource)) { - - throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, - "Only XML resources supported"); - } - - if (res.getId() == null) { - throw new XMLDBException(ErrorCodes.VENDOR_ERROR, - "This resource is a query result and can " + - "not be removed from the database."); - } - - checkOpen(); - try { - - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - params.put(RPCDefaultMessage.NAME, res.getId()); - runRemoteCommand("RemoveDocument", params); - } catch (Exception e) { - throw new XMLDBException(ErrorCodes.NO_SUCH_RESOURCE, e); - } - } - - /** - * Returns a list of collection names naming all child collections - * of the current collection. If no child collections exist an empty list is - * returned. - * - * @return an array containing collection names for all child - * collections. - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> - * method has been called on the <code>Collection</code><br /> - */ - public String[] listChildCollections() throws XMLDBException { - - checkOpen(); - try { - - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - Vector list = (Vector) runRemoteCommand("ListCollections", params); - - return (String[]) list.toArray(new String[list.size()]); - } catch (Exception e) { - - throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e); - } - } - - /** - * Returns the number of child collections under this - * <code>Collection</code> or 0 if no child collections exist. - * - * @return the number of child collections. - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> - * method has been called on the <code>Collection</code><br /> - */ - public int getChildCollectionCount() throws XMLDBException { - - checkOpen(); - try { - - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - Integer result = (Integer) runRemoteCommand("GetCollectionCount", params); - return result.intValue(); - - } catch (Exception e) { - throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e); - } - } - - /** - * Returns a list of the ids for all resources stored in the collection. - * - * @return a string array containing the names for all - * <code>Resource</code>s in the collection. - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> - * method has been called on the <code>Collection</code><br /> - */ - public String[] listResources() throws XMLDBException { - - checkOpen(); - try { - - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - Vector list = (Vector) runRemoteCommand("ListDocuments", params); - - return (String[]) list.toArray(new String[list.size()]); - } catch (Exception e) { - - throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e); - } - } - - /* see superclass for documentation */ - public ResourceSet query(String name, String queryLang, String query, Hashtable nsMap) - throws XMLDBException { - - checkOpen(); - try { - - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - params.put(RPCDefaultMessage.TYPE, queryLang); - params.put(RPCDefaultMessage.NAMESPACES, nsMap); - params.put(RPCDefaultMessage.QUERY, query); - - if (name != null) { - - params.put(RPCDefaultMessage.NAME, name); - } - - String result = (String) runRemoteCommand("Query", params); - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); - Document resultDoc = dbf.newDocumentBuilder().parse( - new InputSource(new StringReader(result))); - - NodeList nodes = resultDoc.getDocumentElement().getChildNodes(); - ResourceSetImpl rs = new ResourceSetImpl(this, null); - - for (int i = 0; i < nodes.getLength(); i++) { - - Node n = nodes.item(i); - - String documentId = ((Element) n).getAttributeNS( - QUERY_NS, "key"); - XMLResourceImpl resource = new XMLResourceImpl(null, - documentId, this, TextWriter.toString(n)); - rs.addResource(resource); - } - - return rs; - } catch (Exception e) { - + throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION, "Collection not found: " + collPath, e); + } + } + + /** + * Submits a command for RPC to database server + * + * @param cmdName command name + * @param params hashtable containing named parameters to send to server + * @return the return value from the server. Type of return value depends on + * command. + * + * @exception Exception thrown if XML-RPC reports an exception. + */ + private Object runRemoteCommand(String cmdName, Hashtable params) throws Exception { + + params.put(RPCMessageInterface.MESSAGE_PARAM, cmdName); + + Vector v = new Vector(); + v.add(params); + return ((Hashtable) client.execute("run", v)).get(RPCDefaultMessage.RESULT); + } + + /** + * Retrieves a <code>Resource</code> from the database. If the + * <code>Resource</code> could not be + * located a null value will be returned. + * + * @param id the unique id for the requested resource. + * @return The retrieved <code>Resource</code> instance. + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> + * method has been called on the <code>Collection</code><br /> + */ + public Resource getResource(String id) throws XMLDBException { + + checkOpen(); + try { + + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + params.put(RPCDefaultMessage.NAME, id); + params.put(RPCDefaultMessage.COMPRESSED, "true"); + + Object result = runRemoteCommand("GetDocument", params); + /* + * If we get a Hashtable back then the result is compressed. + */ + if (result instanceof Hashtable) { + Hashtable compressed = (Hashtable) result; + SymbolDeserializer symbolDeserial = new SymbolDeserializer(); + return new XMLResourceImpl(id, id, this, symbolDeserial.getSymbols(compressed), (byte[]) compressed.get("document")); + } + else { + return new XMLResourceImpl(id, (String) result, this); + } + + } + catch (Exception e) { + return null; + } + } + + /** + * Returns the number of resources currently stored in this collection or 0 + * if the collection is empty. + * + * @return the number of resource in the collection. + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> + * method has been called on the <code>Collection</code><br /> + */ + public int getResourceCount() throws XMLDBException { + + checkOpen(); + try { + + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + return ((Integer) runRemoteCommand("GetDocumentCount", params)).intValue(); + } + catch (Exception e) { + + throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e); + } + } + + /** + * Stores the provided resource into the database. If the resource does not + * already exist it will be created. If it does already exist it will be + * updated. + * + * @param res the resource to store in the database. + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + * <code>ErrorCodes.INVALID_RESOURCE</code> if the <code>Resource</code> is + * not valid. + * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> + * method has been called on the <code>Collection</code><br /> + */ + public void storeResource(Resource res) throws XMLDBException { + + if (!(res instanceof XMLResource)) { + + throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "Only XML resources supported"); + } + + if (res.getContent() == null) { + + throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "no resource data"); + } + checkOpen(); + try { + + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + params.put(RPCDefaultMessage.NAME, res.getId()); + params.put(RPCDefaultMessage.DOCUMENT, res.getContent()); + + String name = (String) runRemoteCommand("InsertDocument", params); + ((XMLResourceImpl) res).setId(name); + + } + catch (Exception e) { + + throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e); + } + } + + /* see superclass for documentation */ + public boolean isOpen() { + + return (client != null); + } + + /* see superclass for documentation */ + public String getURI() { + + return "xmldb:" + DatabaseImpl.DRIVER_NAME + "://" + hostPort + collPath; + } + + /** + * Returns a <code>Collection</code> instance for the requested child collection + * if it exists. + * + * @param name the name of the child collection to retrieve. + * @return the requested child collection or null if it couldn't be found. + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> + * method has been called on the <code>Collection</code><br /> + */ + public Collection getChildCollection(String name) throws XMLDBException { + + if (name.indexOf('/') != -1) { + + throw new XMLDBException(ErrorCodes.INVALID_COLLECTION); + } + + try { + return new CollectionImpl(hostPort, serviceLocation, xmlrpcDriver, collPath + "/" + name); + } + catch (XMLDBException e) { + if (e.errorCode == ErrorCodes.NO_SUCH_COLLECTION) { + // per getChildCollection contract, return null if not found + return null; + } + throw e; + } + } + + /** + * Creates a new unique ID within the context of the <code>Collection</code> + * + * @return the created id as a string. + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> + * method has been called on the <code>Collection</code><br /> + */ + public String createId() throws XMLDBException { + + checkOpen(); + try { + + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + return (String) runRemoteCommand("CreateNewOID", params); + } + catch (Exception e) { + + throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e); + } + } + + /** + * Releases all resources consumed by the <code>Collection</code>. + * The <code>close</code> method must + * always be called when use of a <code>Collection</code> is complete. It is + * not safe to use a <code>Collection</code> after the <code>close</code> + * method has been called. + * + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + */ + public void close() throws org.xmldb.api.base.XMLDBException { + + client = null; + } + + /** + * Returns the parent collection for this collection or null if no parent + * collection exists. + * + * @return the parent <code>Collection</code> instance. + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> + * method has been called on the <code>Collection</code><br /> + */ + public Collection getParentCollection() throws XMLDBException { + + // If there's only one slash then it's the root. + if (collPath.lastIndexOf("/") == 0) { + return null; + } + + try { + return new CollectionImpl(hostPort, serviceLocation, xmlrpcDriver, collPath.substring(0, collPath.lastIndexOf('/'))); + } + catch (XMLDBException e) { + if (e.errorCode == ErrorCodes.NO_SUCH_COLLECTION) { + // per getParentCollection contract, return null if no parent + return null; + } + throw e; + } + } + + /** + * Removes the <code>Resource</code> from the database. + * + * @param res the resource to remove. + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + * <code>ErrorCodes.INVALID_RESOURCE</code> if the <code>Resource</code> is + * not valid.<br /> + * <code>ErrorCodes.NO_SUCH_RESOURCE</code> if the <code>Resource</code> is + * not known to this <code>Collection</code>. + * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> + * method has been called on the <code>Collection</code><br /> + */ + public void removeResource(Resource res) throws XMLDBException { + + if (!(res instanceof XMLResource)) { + + throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "Only XML resources supported"); + } + + if (res.getId() == null) { + throw new XMLDBException(ErrorCodes.VENDOR_ERROR, "This resource is a query result and can " + "not be removed from the database."); + } + + checkOpen(); + try { + + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + params.put(RPCDefaultMessage.NAME, res.getId()); + runRemoteCommand("RemoveDocument", params); + } + catch (Exception e) { + throw new XMLDBException(ErrorCodes.NO_SUCH_RESOURCE, e); + } + } + + /** + * Returns a list of collection names naming all child collections + * of the current collection. If no child collections exist an empty list is + * returned. + * + * @return an array containing collection names for all child + * collections. + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> + * method has been called on the <code>Collection</code><br /> + */ + public String[] listChildCollections() throws XMLDBException { + + checkOpen(); + try { + + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + Vector list = (Vector) runRemoteCommand("ListCollections", params); + + return (String[]) list.toArray(new String[list.size()]); + } + catch (Exception e) { + + throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e); + } + } + + /** + * Returns the number of child collections under this + * <code>Collection</code> or 0 if no child collections exist. + * + * @return the number of child collections. + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> + * method has been called on the <code>Collection</code><br /> + */ + public int getChildCollectionCount() throws XMLDBException { + + checkOpen(); + try { + + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + Integer result = (Integer) runRemoteCommand("GetCollectionCount", params); + return result.intValue(); + + } + catch (Exception e) { + throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e); + } + } + + /** + * Returns a list of the ids for all resources stored in the collection. + * + * @return a string array containing the names for all + * <code>Resource</code>s in the collection. + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + * <code>ErrorCodes.COLLECTION_CLOSED</code> if the <code>close</code> + * method has been called on the <code>Collection</code><br /> + */ + public String[] listResources() throws XMLDBException { + + checkOpen(); + try { + + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + Vector list = (Vector) runRemoteCommand("ListDocuments", params); + + return (String[]) list.toArray(new String[list.size()]); + } + catch (Exception e) { + + throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e); + } + } + + /* see superclass for documentation */ + public ResourceSet query(String name, String queryLang, String query, Hashtable nsMap) throws XMLDBException { + + checkOpen(); + try { + + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + params.put(RPCDefaultMessage.TYPE, queryLang); + params.put(RPCDefaultMessage.NAMESPACES, nsMap); + params.put(RPCDefaultMessage.QUERY, query); + + if (name != null) { + + params.put(RPCDefaultMessage.NAME, name); + } + + String result = (String) runRemoteCommand("Query", params); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + Document resultDoc = dbf.newDocumentBuilder().parse(new InputSource(new StringReader(result))); + + NodeList nodes = resultDoc.getDocumentElement().getChildNodes(); + ResourceSetImpl rs = new ResourceSetImpl(this, null); + + for (int i = 0; i < nodes.getLength(); i++) { + + Node n = nodes.item(i); + + String documentId = ((Element) n).getAttributeNS(QUERY_NS, "key"); + XMLResourceImpl resource = new XMLResourceImpl(null, documentId, this, TextWriter.toString(n)); + rs.addResource(resource); + } + + return rs; + } + catch (Exception e) { + throw FaultCodes.createXMLDBException(FaultCodes.QRY_PROCESSING_ERROR, "Query error", e); - } - } + } + } - /* see superclass for documentation */ - public Collection createCollection(String name) - throws XMLDBException { - return createCollection(name, null); - } - - /* see superclass for documentation */ - public Collection createCollection(String name, Document configuration) throws XMLDBException { - checkOpen(); - try { - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - params.put(RPCDefaultMessage.NAME, name); - if (configuration != null) { - params.put(RPCDefaultMessage.CONFIGURATION, - TextWriter.toString( configuration ) ); - } - - runRemoteCommand("CreateCollection", params); - - return getChildCollection(name); - } - catch (Exception e) { - throw new XMLDBException(ErrorCodes.INVALID_COLLECTION, - "Cannot create child collection", e); - } - } - - /* see superclass for documentation */ - public void removeCollection(String childName) throws XMLDBException { - - checkOpen(); - try { - - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - params.put(RPCDefaultMessage.NAME, childName); - String result = (String) runRemoteCommand("RemoveCollection", params); - - if (!result.equals("yes")) { - - throw new XMLDBException(ErrorCodes.INVALID_COLLECTION, - "Cannot remove child collection"); - } - } catch (Exception e) { - - throw new XMLDBException(ErrorCodes.INVALID_COLLECTION, - "Cannot remove child collection", e); - } - } - - /* see superclass for documentation */ - public String[] listIndexers() throws XMLDBException { - checkOpen(); - try { - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - Vector list = (Vector) runRemoteCommand("ListIndexers", params); - - return (String[]) list.toArray(new String[list.size()]); - } - catch (Exception e) { - throw FaultCodes.createXMLDBException(e); - } - } - - /* see superclass for documentation */ - public void createIndexer(Document configuration) throws XMLDBException { - checkOpen(); - try { - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - params.put(RPCDefaultMessage.CONFIGURATION, - TextWriter.toString( configuration ) ); - - runRemoteCommand("CreateIndexer", params); - } - catch (Exception e) { - throw FaultCodes.createXMLDBException(e); - } - } - - /* see superclass for documentation */ - public void dropIndexer(String name) throws XMLDBException { - checkOpen(); - try { - Hashtable params = new Hashtable(); - params.put(RPCDefaultMessage.COLLECTION, collPath); - params.put(RPCDefaultMessage.NAME, name); - - runRemoteCommand("RemoveIndexer", params); - } - catch (Exception e) { - throw FaultCodes.createXMLDBException(e); - } - } - - /* see superclass for documentation */ - public void shutdown() throws XMLDBException { - checkOpen(); - try { - Hashtable params = new Hashtable(); - - runRemoteCommand("Shutdown", params); - } - catch (Exception e) { - throw FaultCodes.createXMLDBException(e); - } - } + /* see superclass for documentation */ + public Collection createCollection(String name) throws XMLDBException { + return createCollection(name, null); + } + + /* see superclass for documentation */ + public Collection createCollection(String name, Document configuration) throws XMLDBException { + checkOpen(); + try { + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + params.put(RPCDefaultMessage.NAME, name); + if (configuration != null) { + params.put(RPCDefaultMessage.CONFIGURATION, TextWriter.toString(configuration)); + } + + runRemoteCommand("CreateCollection", params); + + return getChildCollection(name); + } + catch (Exception e) { + throw new XMLDBException(ErrorCodes.INVALID_COLLECTION, "Cannot create child collection", e); + } + } + + /* see superclass for documentation */ + public void removeCollection(String childName) throws XMLDBException { + + checkOpen(); + try { + + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + params.put(RPCDefaultMessage.NAME, childName); + String result = (String) runRemoteCommand("RemoveCollection", params); + + if (!result.equals("yes")) { + + throw new XMLDBException(ErrorCodes.INVALID_COLLECTION, "Cannot remove child collection"); + } + } + catch (Exception e) { + + throw new XMLDBException(ErrorCodes.INVALID_COLLECTION, "Cannot remove child collection", e); + } + } + + /* see superclass for documentation */ + public String[] listIndexers() throws XMLDBException { + checkOpen(); + try { + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + Vector list = (Vector) runRemoteCommand("ListIndexers", params); + + return (String[]) list.toArray(new String[list.size()]); + } + catch (Exception e) { + throw FaultCodes.createXMLDBException(e); + } + } + + /* see superclass for documentation */ + public void createIndexer(Document configuration) throws XMLDBException { + checkOpen(); + try { + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + params.put(RPCDefaultMessage.CONFIGURATION, TextWriter.toString(configuration)); + + runRemoteCommand("CreateIndexer", params); + } + catch (Exception e) { + throw FaultCodes.createXMLDBException(e); + } + } + + /* see superclass for documentation */ + public void dropIndexer(String name) throws XMLDBException { + checkOpen(); + try { + Hashtable params = new Hashtable(); + params.put(RPCDefaultMessage.COLLECTION, collPath); + params.put(RPCDefaultMessage.NAME, name); + + runRemoteCommand("RemoveIndexer", params); + } + catch (Exception e) { + throw FaultCodes.createXMLDBException(e); + } + } + + /* see superclass for documentation */ + public void shutdown() throws XMLDBException { + checkOpen(); + try { + Hashtable params = new Hashtable(); + + runRemoteCommand("Shutdown", params); + } + catch (Exception e) { + throw FaultCodes.createXMLDBException(e); + } + } } 1.9 +138 -142 xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/DatabaseImpl.java Index: DatabaseImpl.java =================================================================== RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/DatabaseImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- DatabaseImpl.java 30 May 2003 22:39:16 -0000 1.8 +++ DatabaseImpl.java 10 Jul 2003 21:45:17 -0000 1.9 @@ -74,147 +74,143 @@ * @author <a href="mailto:[EMAIL PROTECTED]">James Bates</a> */ public class DatabaseImpl extends CommonConfigurable implements Database { - - /* prefix used to denote XML:DB URI's that should use this driver */ - static String DRIVER_NAME = "xindice"; - - /* XML:DB conformance level of this driver */ - private String CONFORMANCE_LEVEL = "0"; - - /* Property name for the xml-rpc service location. */ - private static final String PROP_SERVICE_LOCATION = "service-location"; - - /* Property name for the SAX parser xml-rpc will use. */ - private static final String PROP_XMLRPC_DRIVER = "xmlrpc-driver"; - - /** - * Create a new DatabaseImpl object. - */ - public DatabaseImpl() { - super(); - } - - /** - * Create a new DatabaseImpl object with a copy of the properties - * from the DatabaseImpl parameter. - * - * @param commonConfigurable from which the initial parameters for this - * DatabaseImpl object are copied. - */ - public DatabaseImpl(CommonConfigurable commonConfigurable) { - super(commonConfigurable); - } - - /** - * Determines whether this <code>Database</code> implementation can handle - * the URI. It should return true if the Database instance knows how to - * handle the URI and false otherwise. - * - * @param uri the URI to check for. - * @return true if the URI can be handled, false otherwise. - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - * <code>ErrroCodes.INVALID_URI</code> If the URI is not in a valid format. <br /> - */ - public boolean acceptsURI(String uri) throws XMLDBException { - - return ((uri != null) && uri.startsWith(getName() + "://")); - } - - /** - * Retrieves a <code>Collection</code> instance based on the URI provided - * in the <code>uri</code> parameter. The format of the URI is defined in the - * documentation for DatabaseManager.getCollection().<p/> - * - * Authentication is handled via username and password however it is not - * required that the database support authentication. Databases that do not - * support authentication MUST ignore the - * <code>username</code> and <code>password</code> if those provided are not - * null. - * - * @param uri the URI to use to locate the collection. - * @param password The password to use for authentication to the database or - * null if the database does not support authentication. - * @return A <code>Collection</code> instance for the requested collection or - * null if the collection could not be found. - * @return The <code>Collection</code> instance - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - * <code>ErrroCodes.INVALID_URI</code> If the URI is not in a valid format. <br /> - * <code>ErrroCodes.PERMISSION_DENIED</code> If the <code>username</code> - * and <code>password</code> were not accepted by the database. - */ - public Collection getCollection(String uri, String userName, String password) - throws XMLDBException { - - /* TODO: introduce authentication some day */ - - if (!acceptsURI(uri)) { - - throw new XMLDBException(ErrorCodes.INVALID_URI); - } - - /* Chop off driver prefix, and '://' */ - uri = uri.substring(getName().length() + 3); - - /* Extract host name & port, if present */ - int firstSlash = uri.indexOf('/'); - if (firstSlash == -1) { - - throw new XMLDBException(ErrorCodes.INVALID_URI); - } - - String hostPort = uri.substring(0, firstSlash); - String collPath = uri.substring(firstSlash); - - /* Absent host defaults to localhost and standard Xindice HTTP port */ - if (hostPort.equals("")) { - hostPort = "127.0.0.1:8080"; - } - + + /* prefix used to denote XML:DB URI's that should use this driver */ + static String DRIVER_NAME = "xindice"; + + /* XML:DB conformance level of this driver */ + private String CONFORMANCE_LEVEL = "0"; + + /* Property name for the xml-rpc service location. */ + private static final String PROP_SERVICE_LOCATION = "service-location"; + + /* Property name for the SAX parser xml-rpc will use. */ + private static final String PROP_XMLRPC_DRIVER = "xmlrpc-driver"; + + /** + * Create a new DatabaseImpl object. + */ + public DatabaseImpl() { + super(); + } + + /** + * Create a new DatabaseImpl object with a copy of the properties + * from the DatabaseImpl parameter. + * + * @param commonConfigurable from which the initial parameters for this + * DatabaseImpl object are copied. + */ + public DatabaseImpl(CommonConfigurable commonConfigurable) { + super(commonConfigurable); + } + + /** + * Determines whether this <code>Database</code> implementation can handle + * the URI. It should return true if the Database instance knows how to + * handle the URI and false otherwise. + * + * @param uri the URI to check for. + * @return true if the URI can be handled, false otherwise. + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + * <code>ErrroCodes.INVALID_URI</code> If the URI is not in a valid format. <br /> + */ + public boolean acceptsURI(String uri) throws XMLDBException { + + return ((uri != null) && uri.startsWith(getName() + "://")); + } + + /** + * Retrieves a <code>Collection</code> instance based on the URI provided + * in the <code>uri</code> parameter. The format of the URI is defined in the + * documentation for DatabaseManager.getCollection().<p/> + * + * Authentication is handled via username and password however it is not + * required that the database support authentication. Databases that do not + * support authentication MUST ignore the + * <code>username</code> and <code>password</code> if those provided are not + * null. + * + * @param uri the URI to use to locate the collection. + * @param password The password to use for authentication to the database or + * null if the database does not support authentication. + * @return A <code>Collection</code> instance for the requested collection or + * null if the collection could not be found. + * @return The <code>Collection</code> instance + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + * <code>ErrroCodes.INVALID_URI</code> If the URI is not in a valid format. <br /> + * <code>ErrroCodes.PERMISSION_DENIED</code> If the <code>username</code> + * and <code>password</code> were not accepted by the database. + */ + public Collection getCollection(String uri, String userName, String password) throws XMLDBException { + + /* TODO: introduce authentication some day */ + if (!acceptsURI(uri)) { + + throw new XMLDBException(ErrorCodes.INVALID_URI); + } + + /* Chop off driver prefix, and '://' */ + uri = uri.substring(getName().length() + 3); + + /* Extract host name & port, if present */ + int firstSlash = uri.indexOf('/'); + if (firstSlash == -1) { + + throw new XMLDBException(ErrorCodes.INVALID_URI); + } + + String hostPort = uri.substring(0, firstSlash); + String collPath = uri.substring(firstSlash); + + /* Absent host defaults to localhost and standard Xindice HTTP port */ + if (hostPort.equals("")) { + hostPort = "127.0.0.1:8080"; + } + try { - return new CollectionImpl(hostPort, - this.getProperty(PROP_SERVICE_LOCATION), - this.getProperty(PROP_XMLRPC_DRIVER), - collPath); - } catch(XMLDBException e) { - if(e.errorCode == ErrorCodes.NO_SUCH_COLLECTION) { - // per getCollection contract, return null if not found - return null; - } - throw e; + return new CollectionImpl(hostPort, this.getProperty(PROP_SERVICE_LOCATION), this.getProperty(PROP_XMLRPC_DRIVER), collPath); } - } - - /** - * Returns the prefix used in XML:DB to denote URI's that this driver can - * handle. - * - * @return the prefix driver name - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - */ - public String getName() throws XMLDBException { - - return DRIVER_NAME; - } - - /** - * Returns the XML:DB API Conformance level for the implementation. This can - * be used by client programs to determine what functionality is available to - * them. - * - * @return the XML:DB API conformance level for this implementation. - * @exception XMLDBException with expected error codes.<br /> - * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor - * specific errors that occur.<br /> - */ - public String getConformanceLevel() throws XMLDBException { - - return CONFORMANCE_LEVEL; - } - + catch (XMLDBException e) { + if (e.errorCode == ErrorCodes.NO_SUCH_COLLECTION) { + // per getCollection contract, return null if not found + return null; + } + throw e; + } + } + + /** + * Returns the prefix used in XML:DB to denote URI's that this driver can + * handle. + * + * @return the prefix driver name + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + */ + public String getName() throws XMLDBException { + + return DRIVER_NAME; + } + + /** + * Returns the XML:DB API Conformance level for the implementation. This can + * be used by client programs to determine what functionality is available to + * them. + * + * @return the XML:DB API conformance level for this implementation. + * @exception XMLDBException with expected error codes.<br /> + * <code>ErrorCodes.VENDOR_ERROR</code> for any vendor + * specific errors that occur.<br /> + */ + public String getConformanceLevel() throws XMLDBException { + + return CONFORMANCE_LEVEL; + } + }