Package org.ozoneDB.xml.util

Examples of org.ozoneDB.xml.util.XMLContainer


    public void testDOMUpdate() {
        insertDocument();
        ExternalTransaction tx = db.newTransaction();
        try {
            XMLContainer container = XMLContainer.forName(db, xmlTestDataFileName);
            assertNotNull(container);
            tx.begin();
            container.storeDOM(null, getTestDocument());
            tx.commit();
            removeDocument();
        } catch (Exception e) {
            try {
                tx.rollback();
View Full Code Here


    private void insertDocument() {
        ExternalTransaction tx = db.newTransaction();
        try {
            tx.begin();
            XMLContainer container = XMLContainer.newContainer(db, xmlTestDataFileName);
            container.storeDOM(getTestDocument());
            tx.commit();
        } catch (Exception e) {
            try {
                tx.rollback();
            } catch (Exception e1) {
View Full Code Here

    }
    private void removeDocument() {
        ExternalTransaction tx = db.newTransaction();
        try {
            tx.begin();
            XMLContainer container = XMLContainer.forName(db, xmlTestDataFileName);
            if (container == null) {
                fail("XML2ObjTest.removeDocument() - No such document " + xmlTestDataFileName);
            }
            container.delete();
            tx.commit();
            assertNull(XMLContainer.forName(db, xmlTestDataFileName));
        } catch (Exception e) {
            try {
                tx.rollback();
View Full Code Here

            if ( ( id == null ) || ( id.length() == 0 ) ) {
                id = createId();
            }
            if ( type.equals(XMLResource.RESOURCE_TYPE) ) {
                //System.out.println("CollectionImpl.createResource() - Creating container");
                XMLContainer container = XMLContainer.forName(database, id);
                if (container != null ) {
                    System.out.println("container exists already");
                    throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "resource " + id + " already exists");
                }
                container = XMLContainer.newContainer(database, id);
View Full Code Here

    *   not known to this <code>Collection</code>.
    */
    public void removeResource( Resource res ) throws XMLDBException {
        try {
            System.out.println("CollectionImpl.removeResource() - Getting XMLContainer");
            XMLContainer container = null;
            String id = res.getId();
            if ( collection.hasResource(id) ) {
                container = XMLContainer.forName(database, id);
                container.delete();
            } else {
                throw new XMLDBException(ErrorCodes.NO_SUCH_RESOURCE, "the resource is not a part of this collection");
            }
        } catch (Exception e) {
            throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.toString());
View Full Code Here

    /**
     */
    public Resource getResource( String id ) throws XMLDBException {
        try {
            //System.out.println("CollectionImpl.getResource() - Getting XMLContainer");
            XMLContainer container = null;
            if ( collection.hasResource(id) )
                container = XMLContainer.forName(database, id);
            else
                return null;
            if (container == null) {
View Full Code Here

TOP

Related Classes of org.ozoneDB.xml.util.XMLContainer

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.