Package org.exist.xmldb

Examples of org.exist.xmldb.CollectionManagementServiceImpl


                    log( msg, Project.MSG_ERR );
                }
            }

            log( "Create collection management service for collection " + base.getName(), Project.MSG_DEBUG );
            final CollectionManagementServiceImpl service = (CollectionManagementServiceImpl)base.getService( "CollectionManagementService", "1.0" );

            if( resource != null ) {
                log( "Moving resource: " + resource, Project.MSG_INFO );
                final Resource res = base.getResource( resource );

                if( res == null ) {
                    final String msg = "Resource " + resource + " not found.";

                    if( failonerror ) {
                        throw( new BuildException( msg ) );
                    } else {
                        log( msg, Project.MSG_ERR );
                    }

                } else {
                    service.moveResource( XmldbURI.xmldbUriFor( resource ), XmldbURI.xmldbUriFor( destination ), XmldbURI.xmldbUriFor( name ) );
                }

            } else {
                log( "Moving collection: " + collection, Project.MSG_INFO );
                service.move( XmldbURI.xmldbUriFor( collection ), XmldbURI.xmldbUriFor( destination ), XmldbURI.xmldbUriFor( name ) );
            }

        }
        catch( final XMLDBException e ) {
            final String msg = "XMLDB exception during move: " + e.getMessage();
View Full Code Here


    @Test
    public void move() throws XMLDBException, EXistException, PermissionDeniedException {

        //create /db/testCollectionTrigger/srcCollection
        final CollectionManagementServiceImpl colMgmtSrv = (CollectionManagementServiceImpl)testCollection.getService("CollectionManagementService", "1.0");
        final Collection srcCollection = colMgmtSrv.createCollection("col1");

        final XmldbURI baseUri = XmldbURI.create(testCollection.getName());
        final XmldbURI srcUri = XmldbURI.create(srcCollection.getName());
        final XmldbURI newDest = XmldbURI.create("moved");

        //perform the move
        colMgmtSrv.move(srcUri, baseUri, newDest);


        //get the trigger and check its count
        CountingCollectionTrigger.CountingCollectionTriggerState triggerState = CountingCollectionTrigger.CountingCollectionTriggerState.getInstance();
View Full Code Here

        idxConf.configureCollection(COLLECTION_CONFIG);

        final XmldbURI srcURI = XmldbURI.xmldbUriFor("/db/testXQueryTrigger/test");
        final XmldbURI dstURI = XmldbURI.xmldbUriFor("/db/testXQueryTrigger/test-dst");

        final CollectionManagementServiceImpl service = (CollectionManagementServiceImpl) testCollection.getService("CollectionManagementService", "1.0");
        final Collection src = service.createCollection("test");
        assertNotNull(src);

        final Collection dst = service.createCollection("test-dst");
        assertNotNull(dst);

        service.copy(srcURI, dstURI, null);

        // remove the trigger for the Collection under test
        idxConf.configureCollection(EMPTY_COLLECTION_CONFIG);

        final XPathQueryService query = (XPathQueryService) root.getService("XPathQueryService", "1.0");
View Full Code Here

        idxConf.configureCollection(COLLECTION_CONFIG);

        XmldbURI srcURI = XmldbURI.xmldbUriFor("/db/testXQueryTrigger/test");
        XmldbURI dstURI = XmldbURI.xmldbUriFor("/db/testXQueryTrigger/test-dst");

        final CollectionManagementServiceImpl service = (CollectionManagementServiceImpl) testCollection.getService("CollectionManagementService", "1.0");
        final Collection src = service.createCollection("test");
        assertNotNull(src);

        final Collection dst = service.createCollection("test-dst");
        assertNotNull(dst);

        service.move(srcURI, dstURI, null);

        // remove the trigger for the Collection under test
        idxConf.configureCollection(EMPTY_COLLECTION_CONFIG);

        final XPathQueryService query = (XPathQueryService) root.getService("XPathQueryService", "1.0");
View Full Code Here

      Resource res = test.getResource("new_test3.xml");
      assertNotNull("Document should not be null", res);
      System.out.println(res.getContent());

        org.xmldb.api.base.Collection root = DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
      CollectionManagementServiceImpl mgr = (CollectionManagementServiceImpl)
        root.getService("CollectionManagementService", "1.0");
        mgr.removeCollection(XmldbURI.create("test"));
        mgr.removeCollection(XmldbURI.create("test2"));
    }
View Full Code Here

    BrokerPool.FORCE_CORRUPTION = true;
      @SuppressWarnings("unused")
    BrokerPool pool = startDB();

      org.xmldb.api.base.Collection root = DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
      CollectionManagementServiceImpl mgr = (CollectionManagementServiceImpl)
        root.getService("CollectionManagementService", "1.0");
      org.xmldb.api.base.Collection test = root.getChildCollection("test");
      if (test == null)
        test = mgr.createCollection("test");
      org.xmldb.api.base.Collection test2 = test.getChildCollection("test2");
      if (test2 == null)
        test2 = mgr.createCollection("test2");

      String existHome = System.getProperty("exist.home");
        File existDir = existHome==null ? new File(".") : new File(existHome);
        File f = new File(existDir,"samples/shakespeare/r_and_j.xml");
        assertNotNull(f);
      Resource res = test2.createResource("test3.xml", "XMLResource");
      res.setContent(f);
      test2.storeResource(res);

      mgr.moveResource(XmldbURI.create(XmldbURI.ROOT_COLLECTION +  "/test2/test3.xml"),
                TestConstants.TEST_COLLECTION_URI, XmldbURI.create("new_test3.xml"));
  }
View Full Code Here

        try {
          pool = startDB();
          assertNotNull(pool);       
          org.xmldb.api.base.Collection root = DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
          assertNotNull(root);
          CollectionManagementServiceImpl mgr = (CollectionManagementServiceImpl)
              root.getService("CollectionManagementService", "1.0");
          assertNotNull(mgr);
          org.xmldb.api.base.Collection test = root.getChildCollection("test");
          if (test == null)
            test = mgr.createCollection(TestConstants.TEST_COLLECTION_URI.toString());
          assertNotNull(test);
          org.xmldb.api.base.Collection test2 = test.getChildCollection("test2");
          if (test2 == null)
            test2 = mgr.createCollection(TestConstants.TEST_COLLECTION_URI2.toString());
          assertNotNull(test2);       
          Resource res = test2.createResource("test_xmldb.xml", "XMLResource");
          assertNotNull(res);
          res.setContent(TEST_XML);
          test2.storeResource(res);
View Full Code Here

          assertNotNull("Document should not be null", res);
          System.out.println(res.getContent());
         
          org.xmldb.api.base.Collection root = DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
          assertNotNull(root);
          CollectionManagementServiceImpl mgr = (CollectionManagementServiceImpl)
              root.getService("CollectionManagementService", "1.0");
          assertNotNull(mgr);
          mgr.removeCollection("test");
         
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());  
        }
View Full Code Here

        try {
          pool = startDB();
          assertNotNull(pool);
          org.xmldb.api.base.Collection root = DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
          assertNotNull(root);         
          CollectionManagementServiceImpl mgr = (CollectionManagementServiceImpl)
              root.getService("CollectionManagementService", "1.0");
          assertNotNull(mgr);
         
          org.xmldb.api.base.Collection test = root.getChildCollection("test");         
          if (test == null)
              test = mgr.createCollection("test");
          assertNotNull(test);
         
          org.xmldb.api.base.Collection test2 = test.getChildCollection("test2");
          if (test2 == null)
              test2 = mgr.createCollection("test2");
          assertNotNull(test2);
         
                String existHome = System.getProperty("exist.home");
                File existDir = existHome==null ? new File(".") : new File(existHome);
          File f = new File(existDir,"samples/biblio.rdf");
          assertNotNull(f);
          Resource res = test2.createResource("test_xmldb.xml", "XMLResource");
          assertNotNull(res);
          res.setContent(f);
          test2.storeResource(res);
         
          org.xmldb.api.base.Collection dest = root.getChildCollection("destination3");
          if (dest == null)         
              dest = mgr.createCollection("destination3");
          assertNotNull(dest);
         
          mgr.move(TestConstants.TEST_COLLECTION_URI2, TestConstants.DESTINATION_COLLECTION_URI3, XmldbURI.create("test3"));
      } catch (Exception e) {           
          fail(e.getMessage());     
      }
    }
View Full Code Here

        try {
          pool = startDB();
          assertNotNull(pool);
          org.xmldb.api.base.Collection root = DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
          assertNotNull(root);
          CollectionManagementServiceImpl mgr = (CollectionManagementServiceImpl)
              root.getService("CollectionManagementService", "1.0");
          assertNotNull(mgr);
          org.xmldb.api.base.Collection test = root.getChildCollection("test");
          if (test == null)
              test = mgr.createCollection(TestConstants.TEST_COLLECTION_URI.toString());
          assertNotNull(test);
          org.xmldb.api.base.Collection test2 = test.getChildCollection("test2");
          if (test2 == null)
              test2 = mgr.createCollection(TestConstants.TEST_COLLECTION_URI.append("test2").toString());
          assertNotNull(test2);
         
                String existHome = System.getProperty("exist.home");
                File existDir = existHome==null ? new File(".") : new File(existHome);
          File f = new File(existDir,"samples/biblio.rdf");
          assertNotNull(f);
          Resource res = test2.createResource("test_xmldb.xml", "XMLResource");
          assertNotNull(res);
          res.setContent(f);
          test2.storeResource(res);
         
          org.xmldb.api.base.Collection dest = root.getChildCollection("destination");         
          if (dest == null)
              dest = mgr.createCollection("destination");
          assertNotNull(dest);
         
          mgr.copy(TestConstants.TEST_COLLECTION_URI2, XmldbURI.ROOT_COLLECTION_URI.append("destination"), XmldbURI.create("test3"));
      } catch (Exception e) {           
          fail(e.getMessage());
      }
    }
View Full Code Here

TOP

Related Classes of org.exist.xmldb.CollectionManagementServiceImpl

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.