jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r927849 - in /jackrabbit/trunk/jackrabbit-jcr-rmi: ./ src/main/java/org/apache/jackrabbit/rmi/client/ src/main/java/org/apache/jackrabbit/rmi/client/principal/ src/main/java/org/apache/jackrabbit/rmi/client/security/ src/main/java/org/apach...
Date Fri, 26 Mar 2010 13:47:00 GMT
Author: jukka
Date: Fri Mar 26 13:46:59 2010
New Revision: 927849

URL: http://svn.apache.org/viewvc?rev=927849&view=rev
Log:
JCRRMI-27: JSR-283: Support AccessControlManager

Merged revisions 925218 and 925223 (by Felix) from commons/jcr-rmi/trunk to trunk/jackrabbit-jcr-rmi.

Added:
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/
      - copied from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/principal/
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientGroup.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientGroup.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientPrincipal.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientPrincipal.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientPrincipalIterator.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/principal/ClientPrincipalIterator.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/
      - copied from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/security/
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlEntry.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlEntry.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlList.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlList.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlManager.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlManager.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlPolicy.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlPolicy.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlPolicyIterator.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientAccessControlPolicyIterator.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientPrivilege.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/security/ClientPrivilege.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/principal/
      - copied from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/principal/
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/principal/RemoteGroup.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/principal/RemoteGroup.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/principal/RemotePrincipal.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/principal/RemotePrincipal.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/
      - copied from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/security/
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlEntry.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlEntry.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlList.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlList.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlManager.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlManager.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlPolicy.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemoteAccessControlPolicy.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemotePrivilege.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/security/RemotePrivilege.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/
      - copied from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerGroup.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerGroup.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipal.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipal.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipalIterator.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipalIterator.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/
      - copied from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlEntry.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlEntry.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlList.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlList.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlManager.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlManager.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicy.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicy.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicyIterator.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicyIterator.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerPrivilege.java
      - copied unchanged from r925218, jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerPrivilege.java
Modified:
    jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml?rev=927849&r1=927848&r2=927849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml Fri Mar 26 13:46:59 2010
@@ -81,6 +81,10 @@
             <Import-Package>
               javax.transaction.xa;resolution:=optional,*
             </Import-Package>
+            <!-- inline RangeIterator adapt to not add library dependency -->
+            <Embed-Dependency>
+              jackrabbit-jcr-commons;inline=org/apache/jackrabbit/commons/iterator/RangeIteratorAdapter*
+            </Embed-Dependency>
           </instructions>
         </configuration>
       </plugin>
@@ -112,7 +116,7 @@
                   <value>true</value>
                 </property>
                 <property>
-                  <name>known.issues</name>
+                  <name>unknown.issues</name>
                   <value>
 org.apache.jackrabbit.test.api.LifecycleTest#testFollowLifecycleTransition
 org.apache.jackrabbit.test.api.LifecycleTest#testGetAllowedLifecycleTransitions
@@ -486,6 +490,27 @@ org.apache.jackrabbit.test.api.query.XPa
 org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testPathColumn
 org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testRange
 org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testScoreColumn
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAbstractPrivilege
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntry
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryAgain
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryAndSetPolicy
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryEmptyPrivilegeArray
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryInvalidPrincipal
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryInvalidPrivilege
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryIsTransient
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryTwice
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAggregatedPrivilegesSeparately
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAggregatePrivilege
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddPrivilegesPresentInEntries
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testExtendPrivileges
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testGetAccessControlEntries
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveAccessControlEntry
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveAccessControlEntryAndSetPolicy
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveAccessControlEntryIsTransient
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveAddedAccessControlEntry
+org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveIllegalAccessControlEntry
+org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testSetIllegalPolicy
+org.apache.jackrabbit.test.api.security.RSessionAccessControlPolicyTest#testSetInvalidPolicy
 org.apache.jackrabbit.test.api.SerializationTest#testLockExceptionSessionWithHandler
 org.apache.jackrabbit.test.api.SerializationTest#testLockExceptionWorkspaceWithHandler
 org.apache.jackrabbit.test.api.SerializationTest#testVersioningExceptionFileChildSessionContentHandler
@@ -642,6 +667,25 @@ org.apache.jackrabbit.test.api.version.W
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>
+    <!--
+      We use the RangeIteratorAdapter but include it in the library thus
+      users of the jackrabbit-jcr-rmi library do not need to get the
+      jackrabbit-jcr-commons library
+    -->
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-jcr-commons</artifactId>
+      <version>2.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+    
+    <!-- Jackrabbit API extensions -->
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-api</artifactId>
+      <version>2.0.0</version>
+      <scope>provided</scope>
+    </dependency>
 
     <!-- Test dependencies -->
     <dependency>

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java?rev=927849&r1=927848&r2=927849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java Fri Mar 26 13:46:59 2010
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.rmi.client;
 
+import java.security.Principal;
+import java.util.Iterator;
+
 import javax.jcr.Item;
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.Node;
@@ -39,6 +42,11 @@ import javax.jcr.query.QueryManager;
 import javax.jcr.query.QueryResult;
 import javax.jcr.query.Row;
 import javax.jcr.query.RowIterator;
+import javax.jcr.security.AccessControlEntry;
+import javax.jcr.security.AccessControlManager;
+import javax.jcr.security.AccessControlPolicy;
+import javax.jcr.security.AccessControlPolicyIterator;
+import javax.jcr.security.Privilege;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 import javax.jcr.version.VersionIterator;
@@ -49,6 +57,15 @@ import org.apache.jackrabbit.rmi.client.
 import org.apache.jackrabbit.rmi.client.iterator.ClientPropertyIterator;
 import org.apache.jackrabbit.rmi.client.iterator.ClientRowIterator;
 import org.apache.jackrabbit.rmi.client.iterator.ClientVersionIterator;
+import org.apache.jackrabbit.rmi.client.principal.ClientGroup;
+import org.apache.jackrabbit.rmi.client.principal.ClientPrincipal;
+import org.apache.jackrabbit.rmi.client.principal.ClientPrincipalIterator;
+import org.apache.jackrabbit.rmi.client.security.ClientAccessControlEntry;
+import org.apache.jackrabbit.rmi.client.security.ClientAccessControlList;
+import org.apache.jackrabbit.rmi.client.security.ClientAccessControlManager;
+import org.apache.jackrabbit.rmi.client.security.ClientAccessControlPolicy;
+import org.apache.jackrabbit.rmi.client.security.ClientAccessControlPolicyIterator;
+import org.apache.jackrabbit.rmi.client.security.ClientPrivilege;
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
 import org.apache.jackrabbit.rmi.remote.RemoteItemDefinition;
 import org.apache.jackrabbit.rmi.remote.RemoteIterator;
@@ -73,6 +90,13 @@ import org.apache.jackrabbit.rmi.remote.
 import org.apache.jackrabbit.rmi.remote.RemoteVersionManager;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
 import org.apache.jackrabbit.rmi.remote.RemoteXASession;
+import org.apache.jackrabbit.rmi.remote.principal.RemoteGroup;
+import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlList;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy;
+import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege;
 
 /**
  * Default implementation of the
@@ -334,4 +358,100 @@ public class ClientAdapterFactory implem
         return new ClientVersionManager(session, remote, this);
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public AccessControlManager getAccessControlManager(
+            RemoteAccessControlManager remote) {
+        return new ClientAccessControlManager(remote, this);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public AccessControlPolicy getAccessControlPolicy(
+            RemoteAccessControlPolicy remote) {
+        if (remote instanceof RemoteAccessControlList) {
+            return new ClientAccessControlList(
+                (RemoteAccessControlList) remote, this);
+        }
+        return new ClientAccessControlPolicy(remote, this);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public AccessControlPolicy[] getAccessControlPolicy(
+            RemoteAccessControlPolicy[] remote) {
+        final AccessControlPolicy[] local = new AccessControlPolicy[remote.length];
+        for (int i = 0; i < local.length; i++) {
+            local[i] = getAccessControlPolicy(remote[i]);
+        }
+        return local;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public AccessControlPolicyIterator getAccessControlPolicyIterator(
+            RemoteIterator remote) {
+        return new ClientAccessControlPolicyIterator(remote, this);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public AccessControlEntry getAccessControlEntry(
+            RemoteAccessControlEntry remote) {
+        return new ClientAccessControlEntry(remote, this);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public AccessControlEntry[] getAccessControlEntry(
+            RemoteAccessControlEntry[] remote) {
+        final AccessControlEntry[] local = new AccessControlEntry[remote.length];
+        for (int i = 0; i < local.length; i++) {
+            local[i] = getAccessControlEntry(remote[i]);
+        }
+        return local;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Principal getPrincipal(RemotePrincipal remote) {
+        if (remote instanceof RemoteGroup) {
+            return new ClientGroup(remote, this);
+        }
+        return new ClientPrincipal(remote);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public Iterator<Principal> getPrincipalIterator(RemoteIterator remote) {
+        return new ClientPrincipalIterator(remote, this);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Privilege getPrivilege(RemotePrivilege remote) {
+        return new ClientPrivilege(remote, this);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Privilege[] getPrivilege(RemotePrivilege[] remote) {
+        final Privilege[] local = new Privilege[remote.length];
+        for (int i = 0; i < local.length; i++) {
+            local[i] = getPrivilege(remote[i]);
+        }
+        return local;
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java?rev=927849&r1=927848&r2=927849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java Fri Mar 26 13:46:59 2010
@@ -70,7 +70,7 @@ public class ClientSession extends Clien
         LoggerFactory.getLogger(ClientSession.class);
 
     /** The current repository. */
-    private Repository repository;
+    private final Repository repository;
 
     /**
      * Flag indicating whether the session is to be considered live of not.
@@ -81,7 +81,7 @@ public class ClientSession extends Clien
     private boolean live = true;
 
     /** The adapted remote session. */
-    private RemoteSession remote;
+    protected final RemoteSession remote;
 
     /**
      * The adapted workspace of this session. This field is set on the first
@@ -561,8 +561,13 @@ public class ClientSession extends Clien
     }
 
     public AccessControlManager getAccessControlManager()
-            throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
+            throws UnsupportedRepositoryOperationException, RepositoryException {
+        try {
+            return getFactory().getAccessControlManager(
+                remote.getAccessControlManager());
+        } catch (RemoteException ex) {
+            throw new RemoteRepositoryException(ex);
+        }
     }
 
     public RetentionManager getRetentionManager()

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java?rev=927849&r1=927848&r2=927849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java Fri Mar 26 13:46:59 2010
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.rmi.client;
 
+import java.security.Principal;
+import java.util.Iterator;
+
 import javax.jcr.Item;
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.Node;
@@ -39,6 +42,11 @@ import javax.jcr.query.QueryManager;
 import javax.jcr.query.QueryResult;
 import javax.jcr.query.Row;
 import javax.jcr.query.RowIterator;
+import javax.jcr.security.AccessControlEntry;
+import javax.jcr.security.AccessControlManager;
+import javax.jcr.security.AccessControlPolicy;
+import javax.jcr.security.AccessControlPolicyIterator;
+import javax.jcr.security.Privilege;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 import javax.jcr.version.VersionIterator;
@@ -67,6 +75,11 @@ import org.apache.jackrabbit.rmi.remote.
 import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
 import org.apache.jackrabbit.rmi.remote.RemoteVersionManager;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy;
+import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege;
 
 /**
  * Factory interface for creating local adapters for remote references.
@@ -326,4 +339,105 @@ public interface LocalAdapterFactory {
     VersionManager getVersionManager(
             Session session, RemoteVersionManager versionManager);
 
+    /**
+     * Factory method for creating a local adapter for a remote access control
+     * manager
+     *
+     * @param remote remote access control manager
+     * @return local access control manager
+     */
+    AccessControlManager getAccessControlManager(
+            RemoteAccessControlManager remote);
+
+    /**
+     * Factory method for creating a local adapter for a remote access control
+     * policy
+     *
+     * @param remote remote access control policy
+     * @return local access control policy
+     */
+    AccessControlPolicy getAccessControlPolicy(RemoteAccessControlPolicy remote);
+
+    /**
+     * Factory method for creating an array of local adapter for an array of
+     * remote access control policies
+     *
+     * @param remote array of remote access control policies
+     * @return array of local access control policies
+     */
+    AccessControlPolicy[] getAccessControlPolicy(
+            RemoteAccessControlPolicy[] remote);
+
+    /**
+     * Factory method for creating a local adapter for a remote access control
+     * policy iterator
+     *
+     * @param remote access control policy iterator
+     * @return local access control policy iterator
+     */
+    AccessControlPolicyIterator getAccessControlPolicyIterator(
+            RemoteIterator remote);
+
+    /**
+     * Factory method for creating a local adapter for a remote access control
+     * entry
+     *
+     * @param remote remote access control entry
+     * @return local access control entry
+     */
+    AccessControlEntry getAccessControlEntry(RemoteAccessControlEntry remote);
+
+    /**
+     * Factory method for creating an array of local adapter for an array of
+     * remote access control entry
+     *
+     * @param remote array of remote access control entry
+     * @return local array of access control entry
+     */
+    AccessControlEntry[] getAccessControlEntry(RemoteAccessControlEntry[] remote);
+
+    /**
+     * Factory method for creating a local adapter for a remote principal.
+     * <p>
+     * If <code>remote</code> is a
+     * {@link org.apache.jackrabbit.rmi.remote.security.RemoteGroup} the
+     * prinicipal returned implements the <code>java.security.acl.Group</code>
+     * interface.
+     *
+     * @param remote principal
+     * @return local principal
+     */
+    Principal getPrincipal(RemotePrincipal remote);
+
+    /**
+     * Factory method for creating a local adapter for a remote principal
+     * iterator.
+     * <p>
+     * Each entry in the <code>remote</code> iterator which is a
+     * {@link org.apache.jackrabbit.rmi.remote.security.RemoteGroup} will be
+     * provided as a principal implementing the
+     * <code>java.security.acl.Group</code> interface.
+     *
+     * @param remote remote principal iterator
+     * @return local principal iterator
+     */
+    Iterator<Principal> getPrincipalIterator(RemoteIterator remote);
+
+    /**
+     * Factory method for creating a local adapter for a remote privilege
+     *
+     * @param remote remote privilege
+     * @return local privilege
+     */
+    Privilege getPrivilege(RemotePrivilege remote);
+
+    /**
+     * Factory method for creating an array of local adapter for an array of
+     * remote privilege
+     *
+     * @param remote array of remote privilege
+     * @return array of local privilege
+     */
+    Privilege[] getPrivilege(RemotePrivilege[] remote);
+
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java?rev=927849&r1=927848&r2=927849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java Fri Mar 26 13:46:59 2010
@@ -19,10 +19,11 @@ package org.apache.jackrabbit.rmi.remote
 import java.io.IOException;
 import java.rmi.Remote;
 import java.rmi.RemoteException;
-import java.security.AccessControlException;
-
 import javax.jcr.Credentials;
 import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager;
 
 /**
  * Remote version of the JCR {@link javax.jcr.Session Session} interface.
@@ -445,4 +446,17 @@ public interface RemoteSession extends R
     byte[] exportDocumentView(String path, boolean skipBinary, boolean noRecurse)
         throws IOException, RepositoryException, RemoteException;
 
+    /**
+     * Remote version of the {@link javax.jcr.Session#getAccessControlManager()
+     * Session.getAccessControlManager()} method.
+     *
+     * @throws UnsupportedRepositoryOperationException if the remote session
+     *             does not support this method
+     * @throws RepositoryException if an error occurred getting the access
+     *             control manager
+     * @throws RemoteException on RMI errors
+     */
+    RemoteAccessControlManager getAccessControlManager()
+            throws UnsupportedRepositoryOperationException,
+            RepositoryException, RemoteException;
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java?rev=927849&r1=927848&r2=927849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java Fri Mar 26 13:46:59 2010
@@ -17,6 +17,8 @@
 package org.apache.jackrabbit.rmi.server;
 
 import java.rmi.RemoteException;
+import java.security.Principal;
+import java.util.Iterator;
 
 import javax.jcr.Item;
 import javax.jcr.NamespaceRegistry;
@@ -42,6 +44,11 @@ import javax.jcr.query.QueryManager;
 import javax.jcr.query.QueryResult;
 import javax.jcr.query.Row;
 import javax.jcr.query.RowIterator;
+import javax.jcr.security.AccessControlEntry;
+import javax.jcr.security.AccessControlManager;
+import javax.jcr.security.AccessControlPolicy;
+import javax.jcr.security.AccessControlPolicyIterator;
+import javax.jcr.security.Privilege;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 import javax.jcr.version.VersionIterator;
@@ -71,6 +78,11 @@ import org.apache.jackrabbit.rmi.remote.
 import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
 import org.apache.jackrabbit.rmi.remote.RemoteVersionManager;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy;
+import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege;
 
 /**
  * Factory interface for creating remote adapters for local resources.
@@ -371,4 +383,104 @@ public interface RemoteAdapterFactory {
     RemoteVersionManager getRemoteVersionManager(VersionManager versionManager)
         throws RemoteException;
 
+    /**
+     * Returns a remote adapter for the given local access control manager.
+     *
+     * @param acm local access control manager
+     * @return remote access control manager
+     * @throws RemoteException on RMI errors
+     */
+    RemoteAccessControlManager getRemoteAccessControlManager(
+            AccessControlManager acm) throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local access control manager.
+     *
+     * @param acm local access control manager
+     * @return remote access control manager
+     * @throws RemoteException on RMI errors
+     */
+    public RemotePrivilege getRemotePrivilege(final Privilege local)
+            throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local access control manager.
+     *
+     * @param acm local access control manager
+     * @return remote access control manager
+     * @throws RemoteException on RMI errors
+     */
+    public RemotePrivilege[] getRemotePrivilege(final Privilege[] local)
+            throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local access control manager.
+     *
+     * @param acm local access control manager
+     * @return remote access control manager
+     * @throws RemoteException on RMI errors
+     */
+    public RemoteAccessControlPolicy getRemoteAccessControlPolicy(
+            final AccessControlPolicy local) throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local access control manager.
+     *
+     * @param acm local access control manager
+     * @return remote access control manager
+     * @throws RemoteException on RMI errors
+     */
+    public RemoteAccessControlPolicy[] getRemoteAccessControlPolicy(
+            final AccessControlPolicy[] local) throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local access control manager.
+     *
+     * @param acm local access control manager
+     * @return remote access control manager
+     * @throws RemoteException on RMI errors
+     */
+    public RemoteIterator getRemoteAccessControlPolicyIterator(
+            AccessControlPolicyIterator iterator) throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local access control manager.
+     *
+     * @param acm local access control manager
+     * @return remote access control manager
+     * @throws RemoteException on RMI errors
+     */
+    public RemoteAccessControlEntry getRemoteAccessControlEntry(
+            final AccessControlEntry local) throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local access control manager.
+     *
+     * @param acm local access control manager
+     * @return remote access control manager
+     * @throws RemoteException on RMI errors
+     */
+    public RemoteAccessControlEntry[] getRemoteAccessControlEntry(
+            final AccessControlEntry[] local) throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local access control manager.
+     *
+     * @param acm local access control manager
+     * @return remote access control manager
+     * @throws RemoteException on RMI errors
+     */
+    public RemotePrincipal getRemotePrincipal(final Principal principal)
+            throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local access control manager.
+     *
+     * @param acm local access control manager
+     * @return remote access control manager
+     * @throws RemoteException on RMI errors
+     */
+    public RemoteIterator getRemotePrincipalIterator(
+            final Iterator<Principal> principals) throws RemoteException;
+
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java?rev=927849&r1=927848&r2=927849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java Fri Mar 26 13:46:59 2010
@@ -17,7 +17,10 @@
 package org.apache.jackrabbit.rmi.server;
 
 import java.rmi.RemoteException;
+import java.security.Principal;
+import java.security.acl.Group;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import javax.jcr.Item;
@@ -46,6 +49,12 @@ import javax.jcr.query.QueryManager;
 import javax.jcr.query.QueryResult;
 import javax.jcr.query.Row;
 import javax.jcr.query.RowIterator;
+import javax.jcr.security.AccessControlEntry;
+import javax.jcr.security.AccessControlList;
+import javax.jcr.security.AccessControlManager;
+import javax.jcr.security.AccessControlPolicy;
+import javax.jcr.security.AccessControlPolicyIterator;
+import javax.jcr.security.Privilege;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 import javax.jcr.version.VersionIterator;
@@ -78,22 +87,35 @@ import org.apache.jackrabbit.rmi.remote.
 import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
 import org.apache.jackrabbit.rmi.remote.RemoteVersionManager;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy;
+import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege;
 import org.apache.jackrabbit.rmi.server.iterator.ServerNodeIterator;
 import org.apache.jackrabbit.rmi.server.iterator.ServerNodeTypeIterator;
 import org.apache.jackrabbit.rmi.server.iterator.ServerPropertyIterator;
 import org.apache.jackrabbit.rmi.server.iterator.ServerRowIterator;
 import org.apache.jackrabbit.rmi.server.iterator.ServerVersionIterator;
+import org.apache.jackrabbit.rmi.server.principal.ServerGroup;
+import org.apache.jackrabbit.rmi.server.principal.ServerPrincipal;
+import org.apache.jackrabbit.rmi.server.principal.ServerPrincipalIterator;
+import org.apache.jackrabbit.rmi.server.security.ServerAccessControlEntry;
+import org.apache.jackrabbit.rmi.server.security.ServerAccessControlList;
+import org.apache.jackrabbit.rmi.server.security.ServerAccessControlPolicyIterator;
+import org.apache.jackrabbit.rmi.server.security.ServerAccessControlManager;
+import org.apache.jackrabbit.rmi.server.security.ServerAccessControlPolicy;
+import org.apache.jackrabbit.rmi.server.security.ServerPrivilege;
 
 /**
- * Default implementation of the
- * {@link RemoteAdapterFactory RemoteAdapterFactory} interface.
- * This factory uses the server adapters defined in this package as
- * the default adapter implementations. Subclasses can override or extend
- * the default adapters by implementing the corresponding factory methods.
+ * Default implementation of the {@link RemoteAdapterFactory
+ * RemoteAdapterFactory} interface. This factory uses the server adapters
+ * defined in this package as the default adapter implementations. Subclasses
+ * can override or extend the default adapters by implementing the corresponding
+ * factory methods.
  * <p>
- * The <code>bufferSize</code> property can be used to configure the
- * size of the buffer used by iterators to speed up iterator traversal
- * over the network.
+ * The <code>bufferSize</code> property can be used to configure the size of the
+ * buffer used by iterators to speed up iterator traversal over the network.
  */
 public class ServerAdapterFactory implements RemoteAdapterFactory {
 
@@ -104,13 +126,13 @@ public class ServerAdapterFactory implem
     private int bufferSize = DEFAULT_BUFFER_SIZE;
 
     /**
-     * The port number for server objects. Initializes to the value of
-     * the <code>org.apache.jackrabbit.rmi.port</code> system property,
-     * or to 0 if the property is not set. Value 0 means that the server
-     * objects should use a random anonymous port.
+     * The port number for server objects. Initializes to the value of the
+     * <code>org.apache.jackrabbit.rmi.port</code> system property, or to 0 if
+     * the property is not set. Value 0 means that the server objects should use
+     * a random anonymous port.
      */
-    private int portNumber =
-        Integer.getInteger("org.apache.jackrabbit.rmi.port", 0).intValue();
+    private int portNumber = Integer.getInteger(
+        "org.apache.jackrabbit.rmi.port", 0).intValue();
 
     /**
      * Returns the iterator buffer size.
@@ -158,11 +180,9 @@ public class ServerAdapterFactory implem
     }
 
     /**
-     * Creates a {@link ServerSession ServerSession} instance.
-     * In case the underlying session is transaction enabled, the
-     * remote interface is will be transaction enabled too through
-     * the {@link ServerXASession}.
-     *
+     * Creates a {@link ServerSession ServerSession} instance. In case the
+     * underlying session is transaction enabled, the remote interface is will
+     * be transaction enabled too through the {@link ServerXASession}.
      * {@inheritDoc}
      */
     public RemoteSession getRemoteSession(Session session)
@@ -175,8 +195,7 @@ public class ServerAdapterFactory implem
     }
 
     /**
-     * Creates a {@link ServerWorkspace ServerWorkspace} instance.
-     * {@inheritDoc}
+     * Creates a {@link ServerWorkspace ServerWorkspace} instance. {@inheritDoc}
      */
     public RemoteWorkspace getRemoteWorkspace(Workspace workspace)
             throws RemoteException {
@@ -185,22 +204,19 @@ public class ServerAdapterFactory implem
 
     /**
      * Creates a {@link ServerObservationManager ServerObservationManager}
-     * instance.
-     * {@inheritDoc}
+     * instance. {@inheritDoc}
      */
     public RemoteObservationManager getRemoteObservationManager(
-        ObservationManager observationManager) throws RemoteException {
+            ObservationManager observationManager) throws RemoteException {
         return new ServerObservationManager(observationManager, this);
     }
 
     /**
      * Creates a {@link ServerNamespaceRegistry ServerNamespaceRegistry}
-     * instance.
-     * {@inheritDoc}
+     * instance. {@inheritDoc}
      */
     public RemoteNamespaceRegistry getRemoteNamespaceRegistry(
-            NamespaceRegistry registry)
-            throws RemoteException {
+            NamespaceRegistry registry) throws RemoteException {
         return new ServerNamespaceRegistry(registry, this);
     }
 
@@ -209,22 +225,19 @@ public class ServerAdapterFactory implem
      * {@inheritDoc}
      */
     public RemoteNodeTypeManager getRemoteNodeTypeManager(
-            NodeTypeManager manager)
-            throws RemoteException {
+            NodeTypeManager manager) throws RemoteException {
         return new ServerNodeTypeManager(manager, this);
     }
 
     /**
-     * Creates a {@link ServerItem ServerItem} instance.
-     * {@inheritDoc}
+     * Creates a {@link ServerItem ServerItem} instance. {@inheritDoc}
      */
     public RemoteItem getRemoteItem(Item item) throws RemoteException {
         return new ServerItem(item, this);
     }
 
     /**
-     * Creates a {@link ServerProperty ServerProperty} instance.
-     * {@inheritDoc}
+     * Creates a {@link ServerProperty ServerProperty} instance. {@inheritDoc}
      */
     public RemoteProperty getRemoteProperty(Property property)
             throws RemoteException {
@@ -232,18 +245,17 @@ public class ServerAdapterFactory implem
     }
 
     /**
-     * Creates a {@link ServerNode ServerNode} instance.
-     * {@inheritDoc}
+     * Creates a {@link ServerNode ServerNode} instance. {@inheritDoc}
      */
     public RemoteNode getRemoteNode(Node node) throws RemoteException {
         return new ServerNode(node, this);
     }
 
     /**
-     * Creates a {@link ServerVersion ServerVersion} instance.
-     * {@inheritDoc}
+     * Creates a {@link ServerVersion ServerVersion} instance. {@inheritDoc}
      */
-    public RemoteVersion getRemoteVersion(Version version) throws RemoteException {
+    public RemoteVersion getRemoteVersion(Version version)
+            throws RemoteException {
         return new ServerVersion(version, this);
     }
 
@@ -251,14 +263,13 @@ public class ServerAdapterFactory implem
      * Creates a {@link ServerVersionHistory ServerVersionHistory} instance.
      * {@inheritDoc}
      */
-    public RemoteVersionHistory getRemoteVersionHistory(VersionHistory versionHistory)
-            throws RemoteException {
+    public RemoteVersionHistory getRemoteVersionHistory(
+            VersionHistory versionHistory) throws RemoteException {
         return new ServerVersionHistory(versionHistory, this);
     }
 
     /**
-     * Creates a {@link ServerNodeType ServerNodeType} instance.
-     * {@inheritDoc}
+     * Creates a {@link ServerNodeType ServerNodeType} instance. {@inheritDoc}
      */
     public RemoteNodeType getRemoteNodeType(NodeType type)
             throws RemoteException {
@@ -284,17 +295,16 @@ public class ServerAdapterFactory implem
     }
 
     /**
-     * Creates a {@link ServerPropertyDefinition ServerPropertyDefinition} instance.
-     * {@inheritDoc}
+     * Creates a {@link ServerPropertyDefinition ServerPropertyDefinition}
+     * instance. {@inheritDoc}
      */
-    public RemotePropertyDefinition getRemotePropertyDefinition(PropertyDefinition def)
-            throws RemoteException {
+    public RemotePropertyDefinition getRemotePropertyDefinition(
+            PropertyDefinition def) throws RemoteException {
         return new ServerPropertyDefinition(def, this);
     }
 
     /**
-     * Creates a {@link ServerLock ServerLock} instance.
-     * {@inheritDoc}
+     * Creates a {@link ServerLock ServerLock} instance. {@inheritDoc}
      */
     public RemoteLock getRemoteLock(Lock lock) throws RemoteException {
         return new ServerLock(lock, this);
@@ -304,14 +314,13 @@ public class ServerAdapterFactory implem
      * Creates a {@link ServerQueryManager ServerQueryManager} instance.
      * {@inheritDoc}
      */
-    public RemoteQueryManager getRemoteQueryManager(
-            Session session, QueryManager manager) throws RemoteException {
+    public RemoteQueryManager getRemoteQueryManager(Session session,
+            QueryManager manager) throws RemoteException {
         return new ServerQueryManager(session, manager, this);
     }
 
     /**
-     * Creates a {@link ServerQuery ServerQuery} instance.
-     * {@inheritDoc}
+     * Creates a {@link ServerQuery ServerQuery} instance. {@inheritDoc}
      */
     public RemoteQuery getRemoteQuery(Query query) throws RemoteException {
         return new ServerQuery(query, this);
@@ -338,8 +347,8 @@ public class ServerAdapterFactory implem
      * Creates a {@link ServerEventCollection ServerEventCollection} instances.
      * {@inheritDoc}
      */
-    public RemoteEventCollection getRemoteEvent(long listenerId, EventIterator events)
-            throws RemoteException {
+    public RemoteEventCollection getRemoteEvent(long listenerId,
+            EventIterator events) throws RemoteException {
         RemoteEventCollection.RemoteEvent[] remoteEvents;
         if (events != null) {
             List eventList = new ArrayList();
@@ -347,32 +356,32 @@ public class ServerAdapterFactory implem
                 try {
                     Event event = events.nextEvent();
                     eventList.add(new ServerEventCollection.ServerEvent(
-                            event.getType(), event.getPath(), event.getUserID(), this));
+                        event.getType(), event.getPath(), event.getUserID(),
+                        this));
                 } catch (RepositoryException re) {
                     throw new RemoteException(re.getMessage(), re);
                 }
             }
-            remoteEvents = (RemoteEventCollection.RemoteEvent[])
-                eventList.toArray(new RemoteEventCollection.RemoteEvent[eventList.size()]);
+            remoteEvents = (RemoteEventCollection.RemoteEvent[]) eventList.toArray(new RemoteEventCollection.RemoteEvent[eventList.size()]);
         } else {
-            remoteEvents = new RemoteEventCollection.RemoteEvent[0]; // for safety
+            remoteEvents = new RemoteEventCollection.RemoteEvent[0]; // for
+            // safety
         }
 
         return new ServerEventCollection(listenerId, remoteEvents, this);
     }
 
     /**
-     * Optimizes the given remote iterator for transmission across the
-     * network. This method retrieves the first set of elements from
-     * the iterator by calling {@link RemoteIterator#nextObjects()} and
-     * then asks for the total size of the iterator. If the size is unkown
-     * or greater than the length of the retrieved array, then the elements,
-     * the size, and the remote iterator reference are wrapped into a
-     * {@link BufferIterator} instance that gets passed over the network.
-     * If the retrieved array of elements contains all the elements in the
-     * iterator, then the iterator instance is discarded and just the elements
-     * are wrapped into a {@link ArrayIterator} instance to be passed to the
-     * client.
+     * Optimizes the given remote iterator for transmission across the network.
+     * This method retrieves the first set of elements from the iterator by
+     * calling {@link RemoteIterator#nextObjects()} and then asks for the total
+     * size of the iterator. If the size is unkown or greater than the length of
+     * the retrieved array, then the elements, the size, and the remote iterator
+     * reference are wrapped into a {@link BufferIterator} instance that gets
+     * passed over the network. If the retrieved array of elements contains all
+     * the elements in the iterator, then the iterator instance is discarded and
+     * just the elements are wrapped into a {@link ArrayIterator} instance to be
+     * passed to the client.
      * <p>
      * Subclasses can override this method to provide alternative optimizations.
      *
@@ -396,8 +405,8 @@ public class ServerAdapterFactory implem
      */
     public RemoteIterator getRemoteNodeIterator(NodeIterator iterator)
             throws RemoteException {
-        return optimizeIterator(
-                new ServerNodeIterator(iterator, this, bufferSize));
+        return optimizeIterator(new ServerNodeIterator(iterator, this,
+            bufferSize));
     }
 
     /**
@@ -405,8 +414,8 @@ public class ServerAdapterFactory implem
      */
     public RemoteIterator getRemotePropertyIterator(PropertyIterator iterator)
             throws RemoteException {
-        return optimizeIterator(
-                new ServerPropertyIterator(iterator, this, bufferSize));
+        return optimizeIterator(new ServerPropertyIterator(iterator, this,
+            bufferSize));
     }
 
     /**
@@ -414,8 +423,8 @@ public class ServerAdapterFactory implem
      */
     public RemoteIterator getRemoteVersionIterator(VersionIterator iterator)
             throws RemoteException {
-        return optimizeIterator(
-                new ServerVersionIterator(iterator, this, bufferSize));
+        return optimizeIterator(new ServerVersionIterator(iterator, this,
+            bufferSize));
     }
 
     /**
@@ -423,8 +432,8 @@ public class ServerAdapterFactory implem
      */
     public RemoteIterator getRemoteNodeTypeIterator(NodeTypeIterator iterator)
             throws RemoteException {
-        return optimizeIterator(
-                new ServerNodeTypeIterator(iterator, this, bufferSize));
+        return optimizeIterator(new ServerNodeTypeIterator(iterator, this,
+            bufferSize));
     }
 
     /**
@@ -432,8 +441,8 @@ public class ServerAdapterFactory implem
      */
     public RemoteIterator getRemoteRowIterator(RowIterator iterator)
             throws RemoteException {
-        return optimizeIterator(
-                new ServerRowIterator(iterator, this, bufferSize));
+        return optimizeIterator(new ServerRowIterator(iterator, this,
+            bufferSize));
     }
 
     public RemoteLockManager getRemoteLockManager(LockManager lockManager)
@@ -446,4 +455,82 @@ public class ServerAdapterFactory implem
         return new ServerVersionManager(versionManager, this);
     }
 
+    /**
+     * Creates a
+     * {@link org.apache.jackrabbit.rmi.server.security.ServerAccessControlManager}
+     * instance. {@inheritDoc}
+     */
+    public RemoteAccessControlManager getRemoteAccessControlManager(
+            AccessControlManager acm) throws RemoteException {
+        return new ServerAccessControlManager(acm, this);
+    }
+
+    public RemotePrivilege getRemotePrivilege(final Privilege local)
+            throws RemoteException {
+        return new ServerPrivilege(local, this);
+    }
+
+    public RemotePrivilege[] getRemotePrivilege(final Privilege[] local)
+            throws RemoteException {
+        RemotePrivilege[] remote = new RemotePrivilege[local.length];
+        for (int i = 0; i < remote.length; i++) {
+            remote[i] = getRemotePrivilege(local[i]);
+        }
+        return remote;
+    }
+
+    public RemoteAccessControlPolicy getRemoteAccessControlPolicy(
+            final AccessControlPolicy local) throws RemoteException {
+        if (local instanceof AccessControlList) {
+            return new ServerAccessControlList((AccessControlList) local, this);
+        }
+        return new ServerAccessControlPolicy(local, this);
+    }
+
+    public RemoteAccessControlPolicy[] getRemoteAccessControlPolicy(
+            final AccessControlPolicy[] local) throws RemoteException {
+        RemoteAccessControlPolicy[] remote = new RemoteAccessControlPolicy[local.length];
+        for (int i = 0; i < remote.length; i++) {
+            remote[i] = getRemoteAccessControlPolicy(local[i]);
+        }
+        return remote;
+    }
+
+    /**
+     * Creates a {@link ServerNodeIterator} instance. {@inheritDoc}
+     */
+    public RemoteIterator getRemoteAccessControlPolicyIterator(
+            AccessControlPolicyIterator iterator) throws RemoteException {
+        return optimizeIterator(new ServerAccessControlPolicyIterator(iterator,
+            this, bufferSize));
+    }
+
+    public RemoteAccessControlEntry getRemoteAccessControlEntry(
+            final AccessControlEntry local) throws RemoteException {
+        return new ServerAccessControlEntry(local, this);
+    }
+
+    public RemoteAccessControlEntry[] getRemoteAccessControlEntry(
+            final AccessControlEntry[] local) throws RemoteException {
+        RemoteAccessControlEntry[] remote = new RemoteAccessControlEntry[local.length];
+        for (int i = 0; i < remote.length; i++) {
+            remote[i] = getRemoteAccessControlEntry(local[i]);
+        }
+        return remote;
+    }
+
+    public RemotePrincipal getRemotePrincipal(final Principal principal) throws RemoteException {
+        if (principal instanceof Group) {
+            return new ServerGroup((Group) principal, this);
+        }
+
+        return new ServerPrincipal(principal, this);
+    }
+
+    public RemoteIterator getRemotePrincipalIterator(
+            Iterator<Principal> principals) throws RemoteException {
+        return optimizeIterator(new ServerPrincipalIterator(principals, this,
+            bufferSize));
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java?rev=927849&r1=927848&r2=927849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java Fri Mar 26 13:46:59 2010
@@ -45,6 +45,7 @@ import javax.jcr.nodetype.ConstraintViol
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.query.InvalidQueryException;
+import javax.jcr.security.AccessControlException;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionHistory;
@@ -138,6 +139,8 @@ public class ServerObject extends Unicas
             return new ValueFormatException(ex.getMessage());
         } else if (ex instanceof VersionException) {
             return new VersionException(ex.getMessage());
+        } else if (ex instanceof AccessControlException) {
+            return new AccessControlException(ex.getMessage());
         } else {
             return new RepositoryException(ex.getMessage());
         }

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java?rev=927849&r1=927848&r2=927849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java Fri Mar 26 13:46:59 2010
@@ -24,12 +24,14 @@ import java.rmi.RemoteException;
 import javax.jcr.Credentials;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.UnsupportedRepositoryOperationException;
 
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
 import org.apache.jackrabbit.rmi.remote.RemoteNode;
 import org.apache.jackrabbit.rmi.remote.RemoteProperty;
 import org.apache.jackrabbit.rmi.remote.RemoteSession;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlManager;
 
 /**
  * Remote adapter for the JCR {@link javax.jcr.Session Session} interface.
@@ -335,4 +337,15 @@ public class ServerSession extends Serve
         }
     }
 
+    /** {@inheritDoc} */
+    public RemoteAccessControlManager getAccessControlManager()
+            throws UnsupportedRepositoryOperationException,
+            RepositoryException, RemoteException {
+        try {
+            return getFactory().getRemoteAccessControlManager(
+                session.getAccessControlManager());
+        } catch (RepositoryException ex) {
+            throw getRepositoryException(ex);
+        }
+    }
 }



Mime
View raw message