Package org.exist.xmldb

Examples of org.exist.xmldb.CollectionManagementServiceImpl.copyResource()


        }
        final Resource srcDoc = resolveResource(source);
        if(srcDoc != null) {
            final XmldbURI resourcePath = XmldbURI.create(srcDoc.getParentCollection().getName()).append(srcDoc.getId());
            messageln("Copying resource '" + resourcePath + "' to '" + destination + "'");
            mgtService.copyResource(resourcePath, destination, destName);
        } else {
            messageln("Copying collection '" + source + "' to '" + destination + "'");
            mgtService.copy(source, destination, destName);
        }
    }
View Full Code Here


       
        CollectionManagementServiceImpl mgt = (CollectionManagementServiceImpl)
            col.getService("CollectionManagementService", "1.0");
        Collection copy = DBUtils.addCollection(col, "CC" + collectionCnt);
        for (int i = 0; i < resources.length; i++) {
           mgt.copyResource(target.getName() + '/' + resources[i],
                   copy.getName(), null);
        }
       
        System.out.println("Resources in collection " + copy.getName());
        resources = copy.listResources();
View Full Code Here

        test.storeResource(resSource);

        //as the 'test3' user copy the resource
        test = DatabaseManager.getCollection(baseUri + "/db/securityTest3", "test3", "test3");
        cms = (CollectionManagementServiceImpl) test.getService("CollectionManagementService", "1.0");
        cms.copyResource("/db/securityTest3/source.xml", "/db/securityTest3", "copy-of-source.xml");

        final UserManagementService ums = (UserManagementService) test.getService("UserManagementService", "1.0");
        final Permission permissions = ums.getPermissions(test.getResource("copy-of-source.xml"));

        //resource should be owned by test3:guest, i.e. permissions were not preserved from the test1 users doc /db/securityTest3/source.xml
View Full Code Here

       
        //as the 'test3' user copy the resource
        test = DatabaseManager.getCollection(baseUri + "/db/securityTest3", "test3", "test3");
        cms = (CollectionManagementServiceImpl) test.getService("CollectionManagementService", "1.0");
        cms.copyResource("/db/securityTest3/source.xml", "/db/securityTest3", "copy-of-source.xml");

        //as test3 user!
        ums = (UserManagementService) test.getService("UserManagementService", "1.0");
        final Permission permissions = ums.getPermissions(test.getResource("copy-of-source.xml"));
View Full Code Here

        //now copy /db/securityTest2/test.xml to /db/securityTest2/parentCollection/test.xml
        //as user3, it should have it's group set to the primary group of user3 i.e. 'guest'
        //as the collection is NOT setGid and it should not have the setGid bit
        test = DatabaseManager.getCollection(baseUri + "/db/securityTest2", "test3", "test3");
        cms = (CollectionManagementServiceImpl)test.getService("CollectionManagementService", "1.0");
        cms.copyResource("test.xml", "/db/securityTest2/parentCollection", "test.xml");
        ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");

        parentCollection = test.getChildCollection("parentCollection");
        resource = parentCollection.getResource("test.xml");
View Full Code Here

        //now copy /db/securityTest2/test.xml to /db/securityTest2/parentCollection/test.xml
        //as "user3:guest", it should inherit the group ownership 'users' from the parent collection which is setGid
        //and it should NOT have its setGid bit set as it is a resource
        test = DatabaseManager.getCollection(baseUri + "/db/securityTest2", "test3", "test3");
        cms = (CollectionManagementServiceImpl)test.getService("CollectionManagementService", "1.0");
        cms.copyResource("test.xml", "/db/securityTest2/parentCollection", "test.xml");
        ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");

        parentCollection = test.getChildCollection("parentCollection");
        resource = parentCollection.getResource("test.xml");
View Full Code Here

                            log( msg, Project.MSG_ERR );
                        }
                    } else {

                        //XmldbURI resource = XmldbURI.create(resource);
                        service.copyResource( XmldbURI.xmldbUriFor( resource ), XmldbURI.xmldbUriFor( destination ), XmldbURI.xmldbUriFor( name ) );
                    }

                } else {
                    log( "Copying collection: " + collection, Project.MSG_INFO );
                    service.copy( XmldbURI.xmldbUriFor( collection ), XmldbURI.xmldbUriFor( destination ), XmldbURI.xmldbUriFor( name ) );
View Full Code Here

                if (resource == null) {
        logger.error("Resource " + doc + " not found");
                    throw new XPathException(this, "Resource " + doc + " not found");
                }
                final CollectionManagementServiceImpl service = (CollectionManagementServiceImpl) collection.getService("CollectionManagementService", "1.0");
                service.copyResource(doc, destination, null);
            } catch (final XMLDBException e) {
    logger.error("XMLDB exception caught: ", e);
                throw new XPathException(this, "XMLDB exception caught: " + e.getMessage(), e);
            }
           
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.