Package org.xmldb.api.modules

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


    @Test(expected=XMLDBException.class) // fails since guest has no write permissions
    public void worldCreateCollection() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "guest", "guest");
        final CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");
        cms.createCollection("createdByGuest");
    }

    @Test(expected=XMLDBException.class) // fails since guest has no write permissions
    public void worldAddResource() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "guest", "guest");
View Full Code Here


    @Test
    public void groupCreateSubColl() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "test2", "test2");
        final CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");
        final Collection newCol = cms.createCollection("createdByTest2");
        assertNotNull(newCol);
    }

    @Test
    public void groupCreateResource() throws XMLDBException {
View Full Code Here

        resSource.setContent("<test/>");
        source.storeResource(resSource);
       
        //create sub-collection "sub" owned by "test1", and group "users" in /db/securityTest3/source
        CollectionManagementService cms1 = (CollectionManagementServiceImpl)source.getService("CollectionManagementService", "1.0");
        Collection sub = cms1.createCollection("sub");
       
        //create resource owned by "test1", and group "users" in /db/securityTest3/source/sub1
        Resource resSub = sub.createResource("sub1.xml", XMLResource.RESOURCE_TYPE);
        resSub.setContent("<test-sub/>");
        sub.storeResource(resSub);
View Full Code Here

        resSource.setContent("<test/>");
        source.storeResource(resSource);
       
        //create sub-collection "sub" owned by "test1", and group "users" in /db/securityTest3/source
        CollectionManagementService cms1 = (CollectionManagementServiceImpl)source.getService("CollectionManagementService", "1.0");
        Collection sub = cms1.createCollection("sub");
       
        //create resource owned by "test1", and group "users" in /db/securityTest3/source/sub1
        Resource resSub = sub.createResource("sub1.xml", XMLResource.RESOURCE_TYPE);
        resSub.setContent("<test-sub/>");
        sub.storeResource(resSub);
View Full Code Here

        xqueryResource = test.getResource("setuid.xquery");
        ums.chmod(xqueryResource, 04750);

        //create a collection for the XQuery to write into
        final CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");
        final Collection colForSetUid = cms.createCollection("forSetUidWrite");

        //only allow the user 'test1' to write into the collection
        ums = (UserManagementService)colForSetUid.getService("UserManagementService", "1.0");
        ums.chmod(0700);
View Full Code Here

        xqueryResource = test.getResource("not_setuid.xquery");
        ums.chmod(xqueryResource, 00750); //NOT SETUID

        //create a collection for the XQuery to write into
        final CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");
        final Collection colForSetUid = cms.createCollection("forSetUidWrite");

        //only allow the user 'test1' to write into the collection
        ums = (UserManagementService)colForSetUid.getService("UserManagementService", "1.0");
        ums.chmod(0700);
View Full Code Here

        ums.chown(xqueryResource, ums.getAccount("test1"), "users");
        ums.chmod(xqueryResource, 02705); //setgid

        //create a collection for the XQuery to write into
        final CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");
        final Collection colForSetUid = cms.createCollection("forSetGidWrite");

        //only allow the group 'users' to write into the collection
        ums = (UserManagementService)colForSetUid.getService("UserManagementService", "1.0");
        ums.chmod(0570);
View Full Code Here

        xqueryResource = test.getResource("not_setgid.xquery");
        ums.chmod(xqueryResource, 00705); //NOT setgid

        //create a collection for the XQuery to write into
        final CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");
        final Collection colForSetUid = cms.createCollection("forSetGidWrite");

        //only allow the group 'users' to write into the collection
        ums = (UserManagementService)colForSetUid.getService("UserManagementService", "1.0");
        ums.chmod(0070);
View Full Code Here

  throws XMLDBException
  {
    CollectionManagementService service = getCollectionManagementService(
        parent);
   
    return service.createCollection(name);
  }
 
  public static void removeCollection(Collection parent, String name) throws XMLDBException {
    CollectionManagementService service = getCollectionManagementService(
        parent);
View Full Code Here

         
          Collection childCollection = rootCollection.getChildCollection(COLLECTION_NAME);
          if (childCollection == null) {
              CollectionManagementService cms = (CollectionManagementService) rootCollection.getService(
                      "CollectionManagementService", "1.0");
              this.collection = cms.createCollection(COLLECTION_NAME);
          } else {
              this.collection = childCollection;
          }
         
                String existHome = System.getProperty("exist.home");
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.