Package org.xmldb.api.base

Examples of org.xmldb.api.base.XMLDBException


                //System.out.println("CollectionImpl.getResource() - created new XMLResourceImpl");
                return resource;
            }

        } catch (Exception e) {
            throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.toString());
        }
    }
View Full Code Here


        if (database instanceof ExternalDatabase) {
            try {
                ((ExternalDatabase)database).close();
                System.out.println("CollectionImpl.close() - connection closed");
            } catch (Exception e) {
                throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage());
            }
        }
    }
View Full Code Here

            }
            catch (SAXException e) {
                try {
                    if (tx.getStatus() == tx.STATUS_ACTIVE)
                        tx.rollback();
                    throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, e.getMessage())
                }
                catch (Exception rollbackException) {
                    throw new XMLDBException(ErrorCodes.VENDOR_ERROR, rollbackException.toString())
                }
            }
            catch (Exception e) {
                try {
                    if (tx.getStatus() == tx.STATUS_ACTIVE)
                        tx.rollback();
                    throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage())
                }
                catch (Exception rollbackException) {
                    throw new XMLDBException(ErrorCodes.VENDOR_ERROR, rollbackException.toString())
                }
            }
        }
        else if (value instanceof Node) {
            setContentAsDOM((Node)value);
        }
        else
            throw new XMLDBException( ErrorCodes.VENDOR_ERROR, ErrorCodes.UNKNOWN_RESOURCE_TYPE );
    }
View Full Code Here

    public Object getContent() throws XMLDBException {          
        try {                      
            return toString( "xml", "UTF-8", true );
        }
        catch (Exception e) {       
            throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage());     
        }
    }
View Full Code Here

        }
        catch (Exception e) {
            try {
                if (tx.getStatus() == tx.STATUS_ACTIVE)
                    tx.rollback();
                throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage());
            }
            catch (Exception rollbackException) {
                throw new XMLDBException(ErrorCodes.VENDOR_ERROR, rollbackException.toString())
            }           
        }
    }
View Full Code Here

    public void setContentAsDOM( Node content ) throws XMLDBException {  
        ExternalTransaction tx = database.newTransaction();            
        try {           
            if (content == null) {
                System.out.println("XMLResourceImpl.setContentAsDOM() - Content is null");
                throw new XMLDBException(ErrorCodes.INVALID_RESOURCE);
            }
            if (content instanceof Document) {
                Document doc = (Document)content; 
                tx.begin();      
                container.storeDOM(doc);               
                tx.commit();
            }
            else {
                System.out.println("Cannot store Nodes right now, must be a Document");
            }                           
        }
        catch (Exception e) {
            e.printStackTrace();           
            try {
                System.out.println("XMLResourceImpl.setContentAsDOM() - Transaction status is " + tx.getStatus());
                if (tx.getStatus() == tx.STATUS_ACTIVE)
                    tx.rollback();
                throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage());
            }
            catch (Exception rollbackException) {
                throw new XMLDBException(ErrorCodes.VENDOR_ERROR, rollbackException.getMessage())
            }           
        }           
    }
View Full Code Here

        }
        catch (Exception e) {
            try {
                if (tx.getStatus() == tx.STATUS_ACTIVE)
                    tx.rollback();           
                throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage());
            }
            catch (Exception rollbackException) {
                throw new XMLDBException(ErrorCodes.VENDOR_ERROR, rollbackException.toString())
            }           
        }
    }
View Full Code Here

        }
        catch (Exception e) {
            try {
                if (tx.getStatus() == tx.STATUS_ACTIVE)
                    tx.rollback();
                throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage());
            }
            catch (Exception rollbackException) {
                throw new XMLDBException(ErrorCodes.VENDOR_ERROR, rollbackException.toString())
            }           
        }
    }
View Full Code Here

            throw FaultCodes.createXMLDBException(ErrorCodes.INVALID_COLLECTION,
                                                  "Collection not available: " + collPath, e);
        }

        if (this.col == null) {
            throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION,
                                     "Collection not found: " + collPath);
        }
    }
View Full Code Here

                case Entry.BINARY:
                    return new BinaryResourceImpl(id, this, (byte[]) entry.getValue());

                default:
                    throw new XMLDBException(ErrorCodes.UNKNOWN_RESOURCE_TYPE,
                                             "Internal error: Unexpected resource type " + entry.getEntryType());
            }

        } catch (Exception e) {
            throw FaultCodes.createXMLDBException("Resource not available: " + id, 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.