Package org.xmldb.api.base

Examples of org.xmldb.api.base.XMLDBException


            params.put(RPCDefaultMessage.COLLECTION, collPath);
            // TODO: In case of error get error code. Current XMLPRC does not provide place for detailed error code.
            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 (XMLDBException x) {
            throw x;  // propagate any xmldb exception.
        } catch (IOException e) {
            client = null;
            throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, FaultCodes.GEN_GENERAL_ERROR,
                                     "Cannot communicate with the server: " + xmlRpcURL, e);
        } catch (Exception e) {
            client = null;
            throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, FaultCodes.JAVA_RUNTIME_ERROR,
                                     "Collection not found: " + collPath, e);
        }
    }
View Full Code Here


            //       See also RPCMessageInterface.run()
            StringTokenizer st = new StringTokenizer(e.getMessage(), ":");
            if (st.countTokens() >= 4) {
                try {
                    st.nextToken();
                    throw new XMLDBException(Integer.parseInt(st.nextToken().trim()),
                                             Integer.parseInt(st.nextToken().trim()),
                                             st.nextToken("").trim());
                } catch (NumberFormatException e1) {
                    // Ignore
                }
View Full Code Here

        } catch (XMLDBException x) {

            throw x;  // propagate any xmldb exception.
        } catch (Exception e) {

            throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e);
        }
    }
View Full Code Here

    public Collection createCollection(String childCollName)
            throws XMLDBException {

        if (coll == null) {

            throw new XMLDBException(ErrorCodes.INVALID_COLLECTION,
                                     "Must set collection for this service");
        }

        return ((XindiceCollection) coll).createCollection(childCollName);
    }
View Full Code Here

        } catch (XMLDBException x) {

            throw x;  // propagate any xmldb exception.
        } catch (Exception e) {

            throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e);
        }
    }
View Full Code Here

     * @param childCollName name of child collection to remove
     */
    public void removeCollection(String childCollName) throws XMLDBException {
        if (coll == null) {

            throw new XMLDBException(ErrorCodes.INVALID_COLLECTION,
                                     "Must set collection for this service");
        }

        ((XindiceCollection) coll).removeCollection(childCollName);
    }
View Full Code Here

     *  method has been called on the <code>Collection</code><br />
     */
    public void storeResource(Resource res) throws XMLDBException {

        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("InsertResource", params);
            if (res instanceof XMLResource) {
                ((XMLResourceImpl) res).setId(name);
            } else {
                ((BinaryResourceImpl) res).setId(name);
            }

        } catch (XMLDBException x) {

            throw x;  // propagate any xmldb exception.
        } catch (Exception e) {

            throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e);
        }
    }
View Full Code Here

     * @exception XMLDBException
     */
    public Collection createCollection(String path, Document configuration)
            throws XMLDBException {
        if (coll == null) {
            throw new XMLDBException(ErrorCodes.INVALID_COLLECTION,
                                     "Must set collection for this service");
        }

        return ((XindiceCollection) coll).createCollection(path, configuration);
    }
View Full Code Here

     *  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, collPath + "/" + name);
        } catch (XMLDBException e) {
View Full Code Here

        } catch (XMLDBException x) {

            throw x;  // propagate any xmldb exception.
        } catch (Exception e) {

            throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e);
        }
    }
View Full Code Here

TOP

Related Classes of org.xmldb.api.base.XMLDBException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.