Package org.xmldb.api.modules

Examples of org.xmldb.api.modules.CollectionManagementService


    @After
    public void tearDown() throws XMLDBException {
        //delete the test collection
        Collection root = DatabaseManager.getCollection(ROOT_URI, ADMIN_UID, ADMIN_PWD);
        CollectionManagementService cms = (CollectionManagementService)root.getService("CollectionManagementService", "1.0");
        cms.removeCollection(TEST_COLLECTION);

        //shutdownDB the db
        DatabaseInstanceManager dim = (DatabaseInstanceManager) root.getService("DatabaseInstanceManager", "1.0");
        dim.shutdown();
    }
View Full Code Here


                    database.setProperty("create-database", "true");
                    DatabaseManager.registerDatabase(database);
                    col = DatabaseManager.getCollection(URI + "/" + XUPDATE_COLLECTION);
                    if(col == null) {
                        Collection root = DatabaseManager.getCollection(URI, "admin", "");
                        CollectionManagementService mgtService = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
                        col = mgtService.createCollection(XUPDATE_COLLECTION);
                        UserManagementService ums = (UserManagementService) col.getService("UserManagementService", "1.0");
                        // change ownership to guest
                        Account guest = ums.getAccount("guest");
                        ums.chown(guest, guest.getPrimaryGroup());
                        ums.chmod(Permission.DEFAULT_COLLECTION_PERM);
View Full Code Here

            database.setProperty("create-database", "true");
            DatabaseManager.registerDatabase(database);
           
            Collection root =
                DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
            CollectionManagementService service =
                (CollectionManagementService) root.getService(
                    "CollectionManagementService",
                    "1.0");
            testCollection = service.createCollection(TEST_COLLECTION_NAME);
            assertNotNull(testCollection);
           
            XMLResource res = (XMLResource)
              testCollection.createResource("defaultns.xml", "XMLResource");
            res.setContent(XML);
View Full Code Here

     */
    protected void tearDown() {
      try {
          Collection root =
              DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
          CollectionManagementService service =
              (CollectionManagementService) root.getService(
                  "CollectionManagementService",
                  "1.0");
          service.removeCollection(TEST_COLLECTION_NAME);
         
          DatabaseManager.deregisterDatabase(database);
          DatabaseInstanceManager dim =
              (DatabaseInstanceManager) testCollection.getService(
                  "DatabaseInstanceManager", "1.0");
View Full Code Here

    public void execute(Connection connection) throws XMLDBException, EXistException {
        Collection col = connection.getCollection(parentCol);
        if (col == null)
            throw new EXistException("Collection " + parentCol + " not found.");
        CollectionManagementService mgr = (CollectionManagementService)
                col.getService("CollectionManagementService", "1.0");
        mgr.createCollection(name);
    }
View Full Code Here

    public void execute(Connection connection) throws XMLDBException, EXistException {
        Collection collection = connection.getCollection(parentPath);
        if (collection == null)
            throw new EXistException(RemoveCollection.class.getName() + ": collection " + parentPath + " not found");
        CollectionManagementService mgr = (CollectionManagementService)
                collection.getService("CollectionManagementService", "1.0");
        mgr.removeCollection(collectionPath);
    }
View Full Code Here

        return resourceType;
    }

    private Collection makeColl(Collection parentColl, String relPath)
    throws XMLDBException {
        CollectionManagementService mgtService;
        Collection current = parentColl, c;
        String token;
        StringTokenizer tok = new StringTokenizer(relPath, "/");
        while (tok.hasMoreTokens()) {
            token = tok.nextToken();
            c = current.getChildCollection(token);
            if (c == null) {
                mgtService = (CollectionManagementService) current.getService("CollectionManagementService", "1.0");
                current = mgtService.createCollection(token);
            } else
                current = c;
        }
        return current;
    }
View Full Code Here

        Collection root =
                DatabaseManager.getCollection(
                uri,
                "admin",
                "");
        CollectionManagementService service =
                (CollectionManagementService) root.getService(
                "CollectionManagementService",
                "1.0");
        testCollection = service.createCollection("test");
        assertNotNull(testCollection);
    }
View Full Code Here

    }
   
    @Test
    public void idsOnEmptyCollection() throws XMLDBException {
        final Collection root = DatabaseManager.getCollection(uri, "admin", null);
        final CollectionManagementService service = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
    final Collection emptyCollection = service.createCollection("empty");
        final XQueryService queryService = (XQueryService) emptyCollection.getService("XPathQueryService", "1.0");
       queryAndAssert(queryService, "/*", 0, null);
       queryAndAssert(queryService, "/id('foo')", 0, null);
    }
View Full Code Here

        Database database = (Database) cl.newInstance();
        database.setProperty("create-database", "true");
        DatabaseManager.registerDatabase(database);
       
        Collection root = DatabaseManager.getCollection(ROOT_URI, ADMIN_UID, ADMIN_PWD);
        CollectionManagementService service = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");

        Collection testCollection = service.createCollection(TEST_COLLECTION);
        UserManagementService ums = (UserManagementService) testCollection.getService("UserManagementService", "1.0");
        // change ownership to guest
        Account guest = ums.getAccount(GUEST_UID);
        ums.chown(guest, guest.getPrimaryGroup());
        ums.chmod("rwxr-xr-x");

        Collection testConfCollection = service.createCollection(CONF_COLL_URI.toString());
        ums = (UserManagementService) testConfCollection.getService("UserManagementService", "1.0");
        // change ownership to guest
        ums.chown(guest, guest.getPrimaryGroup());
        ums.chmod("rwxr-xr-x");
View Full Code Here

TOP

Related Classes of org.xmldb.api.modules.CollectionManagementService

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.