Package org.xmldb.api.modules

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


                            try {
                                // Cut trailing '/'
                                String k = this.key.substring(0, this.key.length() - 1);
                                CollectionManagementService service =
                                        (CollectionManagementService) collection.getService("CollectionManagementService", "1.0");
                                service.createCollection(k);
                                result = "success";
                            } catch (XMLDBException e) {
                                message = "Failed to create collection " + this.key + ": " + e.errorCode;
                                getLogger().error(message, e);
                            }
View Full Code Here


                            try {
                                // Cut trailing '/'
                                String k = this.key.substring(0, this.key.length() - 1);
                                CollectionManagementService service =
                                        (CollectionManagementService) collection.getService("CollectionManagementService", "1.0");
                                service.createCollection(k);
                                result = "success";
                            } catch (XMLDBException e) {
                                message = "Failed to create collection " + this.key + ": " + e.errorCode;
                                getLogger().error(message, e);
                            }
View Full Code Here

        Collection parentColl = createCollection(path.substring(0, pos));
       
        // And create the child collection
        CollectionManagementService mgtService = (CollectionManagementService)
            parentColl.getService("CollectionManagementService", "1.0");
        coll = mgtService.createCollection(path.substring(pos+1));

        return coll;
    }
   
   
View Full Code Here

            Collection root =
                    DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
            CollectionManagementService service =
                    (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
            Collection testCollection = service.createCollection("test");
            assertNotNull(testCollection);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

     
    InputStream in = null;
    try
    {
      final CollectionManagementService service = (CollectionManagementService)systemCollection.getService("CollectionManagementService", "1.0");
      policyCollection = service.createCollection(XACMLConstants.POLICY_COLLECTION_NAME);
      final Collection confCol = service.createCollection("config" + XACMLConstants.POLICY_COLLECTION);
     
      final String confName = XACMLConstants.POLICY_COLLECTION_NAME + ".xconf";
      final XMLResource res = (XMLResource)confCol.createResource(confName, "XMLResource");
     
View Full Code Here

    InputStream in = null;
    try
    {
      final CollectionManagementService service = (CollectionManagementService)systemCollection.getService("CollectionManagementService", "1.0");
      policyCollection = service.createCollection(XACMLConstants.POLICY_COLLECTION_NAME);
      final Collection confCol = service.createCollection("config" + XACMLConstants.POLICY_COLLECTION);
     
      final String confName = XACMLConstants.POLICY_COLLECTION_NAME + ".xconf";
      final XMLResource res = (XMLResource)confCol.createResource(confName, "XMLResource");
     
      in = DatabaseInterface.class.getResourceAsStream(confName);
View Full Code Here

    public void noSetGid_createSubCollection_subCollectionGroupIsUsersPrimaryGroup() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest2", "test1", "test1");
        CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");

        //create /db/securityTest2/parentCollection with owner "test1:users" and mode "rwxr--rwx"
        Collection parentCollection = cms.createCollection("parentCollection");
        UserManagementService ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");
        ums.chmod("rwxr--rwx");

        //now create the sub-collection /db/securityTest2/parentCollection/subCollection1
        //as "user3:guest", it should have it's group set to the primary group of user3 i.e. 'guest'
View Full Code Here

        //as "user3:guest", it should have it's group set to the primary group of user3 i.e. 'guest'
        //as the collection is NOT setUid and it should NOT have the setGid bit set
        parentCollection = DatabaseManager.getCollection(baseUri + "/db/securityTest2/parentCollection", "test3", "test3");
        ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");
        cms = (CollectionManagementService)parentCollection.getService("CollectionManagementService", "1.0");
        final Collection subCollection = cms.createCollection("subCollection1");

        final Permission permissions = ums.getPermissions(subCollection);
        assertEquals("guest", permissions.getGroup().getName());
        assertFalse(permissions.isSetGid());
    }
View Full Code Here

    public void setGid_createSubCollection_subCollectionGroupInheritedFromParent() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest2", "test1", "test1");
        CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");

        //create /db/securityTest2/parentCollection with owner "test1:users" and mode "rwxrwsrwx"
        Collection parentCollection = cms.createCollection("parentCollection");
        UserManagementService ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");
        ums.chmod("rwxrwsrwx");

        //now create the sub-collection /db/securityTest2/parentCollection/subCollection1
        //it should inherit the group ownership 'users' from the parent collection which is setGid
View Full Code Here

        //it should inherit the group ownership 'users' from the parent collection which is setGid
        //and it should inherit the setGid bit
        parentCollection = DatabaseManager.getCollection(baseUri + "/db/securityTest2/parentCollection", "test3", "test3");
        ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");
        cms = (CollectionManagementService)parentCollection.getService("CollectionManagementService", "1.0");
        final Collection subCollection = cms.createCollection("subCollection1");

        final Permission permissions = ums.getPermissions(subCollection);
        assertEquals("users", permissions.getGroup().getName());
        assertTrue(permissions.isSetGid());
    }
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.