Package org.xmldb.api.modules

Examples of org.xmldb.api.modules.CollectionManagementService


        Collection test = DatabaseManager.getCollection(ROOT_URI, ADMIN_UID, ADMIN_PWD);
        assertNotNull(test);
        Collection root = DatabaseManager.getCollection(ROOT_URI, ADMIN_UID, ADMIN_PWD);
        test = root.getChildCollection(TestConstants.SPECIAL_NAME);
        assertNotNull(test);
        CollectionManagementService service = (CollectionManagementService)root.getService("CollectionManagementService", "1.0");
        service.removeCollection(TestConstants.SPECIAL_NAME);
    }
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(Permission.DEFAULT_COLLECTION_PERM);
View Full Code Here

    @After
    public void tearDown() throws XMLDBException {

        //delete the test collection
        Collection root = DatabaseManager.getCollection(ROOT_URI, ADMIN_UID, ADMIN_PWD);
        CollectionManagementService service = (CollectionManagementService)root.getService("CollectionManagementService", "1.0");
        service.removeCollection(TEST_COLLECTION);

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

          assertNotNull(database);
          DatabaseManager.registerDatabase(database);
          //Get the root collection...
          Collection rootCollection = DatabaseManager.getCollection(URI + XmldbURI.ROOT_COLLECTION, "admin", "");
          assertNotNull(rootCollection)
            CollectionManagementService cms = (CollectionManagementService) rootCollection.getService(
                    "CollectionManagementService", "1.0");
            //Creates the child collection
            Collection childCollection = cms.createCollection(CHILD_COLLECTION);
            assertNotNull(childCollection);
            //... and work from it
            setCollection((RemoteCollection) childCollection);
            assertNotNull(childCollection);
        } catch (Exception e) {           
View Full Code Here

    protected void removeCollection() {
      try {
          Collection rootCollection = DatabaseManager.getCollection(URI + XmldbURI.ROOT_COLLECTION, "admin", "");
          assertNotNull(rootCollection);
          CollectionManagementService cms = (CollectionManagementService) rootCollection.getService(
                  "CollectionManagementService", "1.0");
          cms.removeCollection(CHILD_COLLECTION);
        } catch (Exception e) {           
            fail(e.getMessage());
        }
    }
View Full Code Here

    @Before
    public void setUp() throws XMLDBException {
        //create a test collection
        Collection root = DatabaseManager.getCollection(ROOT_URI, ADMIN_UID, ADMIN_PWD);
        CollectionManagementService cms = (CollectionManagementService)root.getService("CollectionManagementService", "1.0");
        Collection test = cms.createCollection(TEST_COLLECTION);
        UserManagementService ums = (UserManagementService) test.getService("UserManagementService", "1.0");
        // change ownership to guest
        Account guest = ums.getAccount(GUEST_UID);
        ums.chown(guest, guest.getPrimaryGroup());
        ums.chmod("rwxrwxrwx");
View Full Code Here

    @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);
    }
View Full Code Here

    }

    @Test
    public void createCollection_hasNoSubCollections_andIsOpen() throws XMLDBException {
        final Collection colTest = DatabaseManager.getCollection(ROOT_URI + "/" + TEST_COLLECTION);
        final CollectionManagementService service = (CollectionManagementService) colTest.getService("CollectionManagementService", "1.0");
        final Collection testCollection = service.createCollection("test");
        assertNotNull(testCollection);

        assertEquals("Created Collection has zero child collections", 0, testCollection.getChildCollectionCount());
        assertTrue("Created Collection state should be Open after creation", testCollection.isOpen());
    }
View Full Code Here

    }

    @Test
    public void storeSamplesShakespeare() throws XMLDBException, IOException {
        final Collection colTest = DatabaseManager.getCollection(ROOT_URI + "/" + TEST_COLLECTION);
        final CollectionManagementService service = (CollectionManagementService) colTest.getService("CollectionManagementService", "1.0");
        final Collection testCollection = service.createCollection("test");
        UserManagementService ums = (UserManagementService) testCollection.getService("UserManagementService", "1.0");
        ums.chmod("rwxr-xr-x");

        final File files[] = getShakespeareSamplesDirectory().listFiles(new XMLFilenameFilter());
View Full Code Here

    }

    @Test
    public void storeRemoveStoreResource() throws XMLDBException, IOException {
        final Collection colTest = DatabaseManager.getCollection(ROOT_URI + "/" + TEST_COLLECTION);
        final CollectionManagementService service = (CollectionManagementService) colTest.getService("CollectionManagementService", "1.0");
        final Collection testCollection = service.createCollection("test");
        UserManagementService ums = (UserManagementService) testCollection.getService("UserManagementService", "1.0");
        ums.chmod("rwxr-xr-x");

        final String testFile = "macbeth.xml";
        storeResourceFromFile(new File(getShakespeareSamplesDirectory(), testFile), testCollection);
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.