Package org.apache.jackrabbit.core.retention

Examples of org.apache.jackrabbit.core.retention.RetentionRegistryImpl


            if (!isInitialized()) {
                throw new IllegalStateException("workspace '" + getName() + "' not initialized");
            }
            synchronized (this) {
                if (retentionReg == null) {
                    retentionReg = new RetentionRegistryImpl(getSystemSession(), fs);
                }
                return retentionReg;
            }
        }
View Full Code Here


            if (!isInitialized()) {
                throw new IllegalStateException("workspace '" + getName() + "' not initialized");
            }
            synchronized (this) {
                if (retentionReg == null) {
                    retentionReg = new RetentionRegistryImpl(getSystemSession(), fs);
                }
                return retentionReg;
            }
        }
View Full Code Here

            if (!isInitialized()) {
                throw new IllegalStateException("workspace '" + getName() + "' not initialized");
            }
            synchronized (this) {
                if (retentionReg == null) {
                    retentionReg = new RetentionRegistryImpl(getSystemSession(), fs);
                }
                return retentionReg;
            }
        }
View Full Code Here

            if (!isInitialized()) {
                throw new IllegalStateException("workspace '" + getName() + "' not initialized");
            }
            synchronized (this) {
                if (retentionReg == null) {
                    retentionReg = new RetentionRegistryImpl(getSystemSession(), fs);
                }
                return retentionReg;
            }
        }
View Full Code Here

            if (!isInitialized()) {
                throw new IllegalStateException("workspace '" + getName() + "' not initialized");
            }
            synchronized (this) {
                if (retentionReg == null) {
                    retentionReg = new RetentionRegistryImpl(getSystemSession(), fs);
                }
                return retentionReg;
            }
        }
View Full Code Here

        return fs;
    }
   
    public void testReadHoldFromFile() throws RepositoryException {
        PathResolver resolver = (SessionImpl) superuser;
        RetentionRegistryImpl re = new RetentionRegistryImpl((SessionImpl) superuser, createFileSystem());
        try {
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childN3.getPath()), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath + "/somechild"), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath + "/hold/is/deep"), false));

            assertFalse(re.hasEffectiveHold(resolver.getQPath(testNodePath), false));
            assertFalse(re.hasEffectiveHold(resolver.getQPath(childN2.getPath()), false));

        } finally {
            re.close();
        }
    }
View Full Code Here

        }
    }

    public void testReadRetentionFromFile() throws RepositoryException {
        SessionImpl s = (SessionImpl) helper.getSuperuserSession();
        RetentionRegistryImpl re = new RetentionRegistryImpl(s, createFileSystem());
        try {
            assertTrue(re.hasEffectiveRetention(s.getQPath(childNPath), false));
            assertTrue(re.hasEffectiveRetention(s.getQPath(childNPath + "/somechild"), true));

            assertFalse(re.hasEffectiveRetention(s.getQPath(testNodePath), false));
            assertFalse(re.hasEffectiveRetention(s.getQPath(childNPath + "/somechild"), false));
            assertFalse(re.hasEffectiveRetention(s.getQPath(childNPath + "/somechild/deepchild"), true));
            assertFalse(re.hasEffectiveRetention(s.getQPath(childP.getPath()), false));

        } finally {
            re.close();
            s.logout();
        }
    }
View Full Code Here

    }

    public void testWriteFile() throws RepositoryException {
        PathResolver resolver = (SessionImpl) superuser;
        FileSystem fs = createFileSystem();
        RetentionRegistryImpl re = new RetentionRegistryImpl((SessionImpl) superuser, fs);

        try {
            // write the changes to the fs
            re.close();

            // create a new dummy registry again.
            re = new RetentionRegistryImpl((SessionImpl) superuser, fs);

            // test holds
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childN3.getPath()), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath + "/somechild"), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath + "/hold/is/deep"), false));

            // test policies
            assertTrue(re.hasEffectiveRetention(resolver.getQPath(childNPath), false));
            assertTrue(re.hasEffectiveRetention(resolver.getQPath(childNPath + "/somechild"), true));
        } finally {
            re.close();
        }
    }
View Full Code Here

    }

    public void testWriteFileWithChanges() throws RepositoryException, NotExecutableException {
        PathResolver resolver = (SessionImpl) superuser;
        FileSystem fs = createFileSystem();
        RetentionRegistryImpl re = new RetentionRegistryImpl((SessionImpl) superuser, fs);
        String childN3Path = childN3.getPath();
        try {
            retentionMgr.removeRetentionPolicy(childNPath);
            retentionMgr.removeHold(childNPath, retentionMgr.getHolds(childNPath)[0]);
            superuser.save();
           
            retentionMgr.setRetentionPolicy(childN3Path, getApplicableRetentionPolicy("retentionOnChild2"));
            retentionMgr.addHold(childNPath, "holdOnChild", false);
            superuser.save();

            // write the changes to the fs
            re.close();

            // create a new dummy registry again.
            re = new RetentionRegistryImpl((SessionImpl) superuser, fs);

            // test holds
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath), false));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath), true));
            assertTrue(re.hasEffectiveHold(resolver.getQPath(childN3Path), true));

            assertFalse(re.hasEffectiveHold(resolver.getQPath(childN3Path), false));
            assertFalse(re.hasEffectiveHold(resolver.getQPath(childN3Path + "/child"), false));
            assertFalse(re.hasEffectiveHold(resolver.getQPath(childN3Path + "/child"), true));

            // test policies
            assertTrue(re.hasEffectiveRetention(resolver.getQPath(childN3Path), false));
            assertTrue(re.hasEffectiveRetention(resolver.getQPath(childN3Path + "/child"), true));

            assertFalse(re.hasEffectiveRetention(resolver.getQPath(childN3Path + "/child/more"), true));
            assertFalse(re.hasEffectiveRetention(resolver.getQPath(childNPath), true));
            assertFalse(re.hasEffectiveRetention(resolver.getQPath(childNPath), false));
        } finally {
            re.close();
            // remove the extra policy that is not cleared upon teardown
            if (retentionMgr.getRetentionPolicy(childN3Path) != null) {
                retentionMgr.removeRetentionPolicy(childN3.getPath());
            }
            superuser.save();
View Full Code Here

            if (!isInitialized()) {
                throw new IllegalStateException("workspace '" + getName() + "' not initialized");
            }
            synchronized (this) {
                if (retentionReg == null) {
                    retentionReg = new RetentionRegistryImpl(getSystemSession(), fs);
                }
                return retentionReg;
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.retention.RetentionRegistryImpl

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.