Package org.xmldb.api.modules

Examples of org.xmldb.api.modules.CollectionManagementService.createCollection()


      try {
        Collection testCollection = root.getChildCollection(collectionName);
      if(testCollection == null)
      {
        CollectionManagementService cms = (CollectionManagementService)root.getService("CollectionManagementService", "1.0");
        cms.createCollection(collectionPath);
      }
    } catch(XMLDBException xe) {
      System.err.println("Error determining if test collection already exists:");
      xe.printStackTrace();
      fail(xe.getMessage());
View Full Code Here


     
      try
      {
        //create a test collection
        CollectionManagementService colService = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
      Collection testCollection = colService.createCollection(TEST_BINARY_COLLECTION);
      assertNotNull(testCollection);

      File home = ConfigurationHelper.getExistHome();
            File fLogo;
            if (home != null)
View Full Code Here

            Collection collection = con.getCollection("benchmark");
            if (collection == null) {
                Collection root = con.getCollection();
                CollectionManagementService cmgt =
                    (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
                collection = cmgt.createCollection("benchmark");
            }
            for (Iterator<?> i = FileUtils.iterateFiles(directory, new String[] { "xml" }, false); i.hasNext(); ) {
                File file = (File) i.next();
                Resource resource = collection.createResource(file.getName(), "XMLResource");
                resource.setContent(file);
View Full Code Here

        result = xqs.query(lastAccountIdQuery);
        assertEquals(RealmImpl.INITIAL_LAST_ACCOUNT_ID + 2, Integer.parseInt(result.getResource(0).getContent().toString())); //last account id should be that of 'jack'

        //create a test collection and give everyone access
        final CollectionManagementService cms = (CollectionManagementService)root.getService("CollectionManagementService", "1.0");
        final Collection test = cms.createCollection("test");
        final UserManagementService testUms = (UserManagementService)test.getService("UserManagementService", "1.0");
        testUms.chmod("rwxrwxrwx");

        //create and store a new document as 'frank'
        final Collection frankTest = DatabaseManager.getCollection("xmldb:exist:///db/test", FRANK_USER, FRANK_USER);
View Full Code Here

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

                    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

                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

        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

        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

                "");
        CollectionManagementService service =
                (CollectionManagementService) root.getService(
                "CollectionManagementService",
                "1.0");
        testCollection = service.createCollection("test");
        assertNotNull(testCollection);
    }
   
  private void initServer() {
        if (server == null) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.