Package org.apache.jackrabbit.core

Examples of org.apache.jackrabbit.core.NodeImpl$SetPropertyOperation


                        "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>0120a4f9-196a-3f9e-b9f5-23f31f914da7</sv:value></sv:property>" +
                        "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
                        "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +id+ "</sv:value></sv:property>" +
                        "</sv:node>" +
                    "</sv:node>";
            NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getGroupsPath());
            try {
                // there should be no exception during import,
                // but invalid members must be ignored.
                doImport(target, xml, UserImporter.ImportBehavior.IGNORE);
                Authorizable a = umgr.getAuthorizable("g1");
View Full Code Here


                        "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>0120a4f9-196a-3f9e-b9f5-23f31f914da7</sv:value></sv:property>" +
                        "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
                        "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +id+ "</sv:value></sv:property>" +
                        "</sv:node>" +
                    "</sv:node>";
            NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getGroupsPath());
            try {
                doImport(target, xml, UserImporter.ImportBehavior.ABORT);
                // importbehavior ABORT -> should throw.
                fail("importing invalid members -> must throw.");
            } catch (SAXException e) {
View Full Code Here

                        "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>0120a4f9-196a-3f9e-b9f5-23f31f914da7</sv:value></sv:property>" +
                        "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
                        "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +id+ "</sv:value></sv:property>" +
                        "</sv:node>" +
                    "</sv:node>";
            NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getGroupsPath());
            try {
                // BESTEFFORT behavior -> must import non-existing members.
                doImport(target, xml, UserImporter.ImportBehavior.BESTEFFORT);
                Authorizable a = umgr.getAuthorizable("g1");
                if (a.isGroup()) {
                    // the rep:members property must contain the invalid value
                    boolean found = false;
                    NodeImpl grNode = ((AuthorizableImpl) a).getNode();
                    for (Value memberValue : grNode.getProperty(UserConstants.P_MEMBERS).getValues()) {
                        if (id.equals(memberValue.getString())) {
                            found = true;
                            break;
                        }
                    }
View Full Code Here

                "       <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>" + nonExistingId + "</sv:value></sv:property>" +
                "       <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
                "       <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" + g1Id + "</sv:value></sv:property>" +
                "   </sv:node>";

        NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getGroupsPath());
        try {
            // BESTEFFORT behavior -> must import non-existing members.
            doImport(target, xml, UserImporter.ImportBehavior.BESTEFFORT);
            Authorizable g1 = umgr.getAuthorizable("g1");
            if (g1.isGroup()) {
                // the rep:members property must contain the invalid value
                boolean found = false;
                NodeImpl grNode = ((AuthorizableImpl) g1).getNode();
                for (Value memberValue : grNode.getProperty(UserConstants.P_MEMBERS).getValues()) {
                    if (nonExistingId.equals(memberValue.getString())) {
                        found = true;
                        break;
                    }
                }
View Full Code Here

                "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>"+invalidId+"</sv:value></sv:property>" +
                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
                "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +invalidId+ "</sv:value></sv:property>" +
                "</sv:node>" +
                "</sv:node>";
        NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getGroupsPath());
        try {
            doImport(target, xml, UserImporter.ImportBehavior.IGNORE);
            // no exception during import -> member must have been ignored though.
            Authorizable a = umgr.getAuthorizable("g1");
            if (a.isGroup()) {
View Full Code Here

                "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>"+invalidId+"</sv:value></sv:property>" +
                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
                "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +invalidId+ "</sv:value></sv:property>" +
                "</sv:node>" +
                "</sv:node>";
        NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getGroupsPath());
        try {
            doImport(target, xml, UserImporter.ImportBehavior.ABORT);
            fail("Importing self as group with ImportBehavior.ABORT must fail.");
        } catch (SAXException e) {
            // success.
View Full Code Here

                    "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>b2f5ff47-4366-31b6-a533-d8dc3614845d</sv:value></sv:property>" +
                    "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
                    "</sv:node>" +
                "</sv:node>";

        NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getUsersPath());
        try {
            doImport(target, xml);

            Authorizable newUser = umgr.getAuthorizable("t");
            assertNotNull(newUser);
View Full Code Here

                    "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property><sv:property sv:name=\"rep:impersonators\" sv:type=\"String\"><sv:value>" +principalName+ "</sv:value></sv:property>" +
                    "</sv:node>";
            Subject subj = new Subject();
            subj.getPrincipals().add(new PrincipalImpl(principalName));

            NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getUsersPath());
            try {
                doImport(target, xml, UserImporter.ImportBehavior.IGNORE);
                // no exception during import: no impersonation must be granted
                // for the invalid principal name
                Authorizable a = umgr.getAuthorizable("t");
View Full Code Here

                    "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property><sv:property sv:name=\"rep:impersonators\" sv:type=\"String\"><sv:value>" +principalName+ "</sv:value></sv:property>" +
                    "</sv:node>";
            Subject subj = new Subject();
            subj.getPrincipals().add(new PrincipalImpl(principalName));

            NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getUsersPath());
            try {
                doImport(target, xml, UserImporter.ImportBehavior.ABORT);
                fail("UserImporter.ImportBehavior.ABORT -> importing invalid impersonators must throw.");
            } catch (SAXException e) {
                // success
View Full Code Here

        // load the entries:
        AccessControlManager acMgr = sImpl.getAccessControlManager();
        NodeIterator itr = aclNode.getNodes();
        while (itr.hasNext()) {
            NodeImpl aceNode = (NodeImpl) itr.nextNode();
            try {
                String principalName = aceNode.getProperty(AccessControlConstants.P_PRINCIPAL_NAME).getString();
                Principal princ = principalMgr.getPrincipal(principalName);
                if (princ == null) {
                    log.debug("Principal with name " + principalName + " unknown to PrincipalManager.");
                    princ = new PrincipalImpl(principalName);
                }

                Value[] privValues = aceNode.getProperty(AccessControlConstants.P_PRIVILEGES).getValues();
                Privilege[] privs = new Privilege[privValues.length];
                for (int i = 0; i < privValues.length; i++) {
                    privs[i] = acMgr.privilegeFromName(privValues[i].getString());
                }
                // create a new ACEImpl (omitting validation check)
                Entry ace = new Entry(
                        princ,
                        privs,
                        aceNode.isNodeType(AccessControlConstants.NT_REP_GRANT_ACE),
                        valueFactory);
                // add the entry
                internalAdd(ace);
            } catch (RepositoryException e) {
                log.debug("Failed to build ACE from content.", e.getMessage());
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.NodeImpl$SetPropertyOperation

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.