jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r925218 [2/2] - in /jackrabbit/commons/jcr-rmi/trunk: ./ 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/ap...
Date Fri, 19 Mar 2010 13:55:07 GMT
Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java?rev=925218&r1=925217&r2=925218&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java Fri Mar 19 13:55:06 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;
@@ -41,6 +43,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 +74,11 @@ import org.apache.jackrabbit.rmi.remote.
 import org.apache.jackrabbit.rmi.remote.RemoteVersion;
 import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
 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.
@@ -361,4 +373,103 @@ public interface RemoteAdapterFactory {
     RemoteIterator getRemoteRowIterator(RowIterator 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
+     */
+    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/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java?rev=925218&r1=925217&r2=925218&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java Fri Mar 19 13:55:06 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;
@@ -45,6 +48,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;
@@ -74,22 +83,35 @@ import org.apache.jackrabbit.rmi.remote.
 import org.apache.jackrabbit.rmi.remote.RemoteVersion;
 import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
 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 {
 
@@ -100,13 +122,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.
@@ -154,11 +176,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)
@@ -171,8 +191,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 {
@@ -181,22 +200,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);
     }
 
@@ -205,22 +221,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 {
@@ -228,18 +241,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);
     }
 
@@ -247,14 +259,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 {
@@ -280,17 +291,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);
@@ -300,14 +310,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);
@@ -334,8 +343,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();
@@ -343,32 +352,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.
      *
@@ -392,8 +401,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));
     }
 
     /**
@@ -401,8 +410,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));
     }
 
     /**
@@ -410,8 +419,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));
     }
 
     /**
@@ -419,8 +428,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));
     }
 
     /**
@@ -428,8 +437,85 @@ 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));
+    }
+
+    /**
+     * 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/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java?rev=925218&r1=925217&r2=925218&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java Fri Mar 19 13:55:06 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/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java?rev=925218&r1=925217&r2=925218&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java (original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java Fri Mar 19 13:55:06 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);
+        }
+    }
 }

Added: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerGroup.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerGroup.java?rev=925218&view=auto
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerGroup.java (added)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerGroup.java Fri Mar 19 13:55:06 2010
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.rmi.server.principal;
+
+import java.rmi.RemoteException;
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.Enumeration;
+import java.util.Iterator;
+
+import org.apache.jackrabbit.rmi.remote.RemoteIterator;
+import org.apache.jackrabbit.rmi.remote.principal.RemoteGroup;
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+
+public class ServerGroup extends ServerPrincipal implements RemoteGroup {
+
+    public ServerGroup(final Group principal, final RemoteAdapterFactory factory)
+            throws RemoteException {
+        super(principal, factory);
+    }
+
+    public boolean isMember(String member) {
+        return isMember(member, (Group) getPrincipal());
+    }
+
+    public RemoteIterator members() throws RemoteException {
+        Iterator<Principal> members = new Iterator<Principal>() {
+            final Enumeration<? extends Principal> base = ((Group) getPrincipal()).members();
+
+            public boolean hasNext() {
+                return base.hasMoreElements();
+            }
+
+            public Principal next() {
+                return base.nextElement();
+            }
+
+            public void remove() {
+                throw new UnsupportedOperationException("remove");
+            }
+        };
+        return getFactory().getRemotePrincipalIterator(members);
+    }
+
+    private static boolean isMember(final String memberName, final Group group) {
+        Enumeration<? extends Principal> pe = group.members();
+        while (pe.hasMoreElements()) {
+            Principal p = pe.nextElement();
+            if (memberName.equals(p.getName())) {
+                return true;
+            }
+
+            if ((p instanceof Group) && isMember(memberName, (Group) p)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerGroup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerGroup.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipal.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipal.java?rev=925218&view=auto
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipal.java (added)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipal.java Fri Mar 19 13:55:06 2010
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.rmi.server.principal;
+
+import java.rmi.RemoteException;
+import java.security.Principal;
+
+import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal;
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerObject;
+
+public class ServerPrincipal extends ServerObject implements RemotePrincipal {
+
+    private final Principal principal;
+
+    public ServerPrincipal(final Principal principal,
+            final RemoteAdapterFactory factory) throws RemoteException {
+        super(factory);
+        this.principal = principal;
+    }
+
+    public String getName() {
+        return principal.getName();
+    }
+
+    /**
+     * Returns the {@link Principal} encapsulated in this instance.
+     * <p>
+     * NOTE: This method is intended to only be used in the JCR RMI
+     * implementation to be able to "send back" remote principals to the server
+     * for implementation of the remote JCR API.
+     *
+     * @return the {@link Principal} encapsulated in this instance.
+     */
+    public Principal getPrincipal() {
+        return principal;
+    }
+}

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipal.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipalIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipalIterator.java?rev=925218&view=auto
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipalIterator.java (added)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipalIterator.java Fri Mar 19 13:55:06 2010
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.rmi.server.principal;
+
+import java.rmi.RemoteException;
+import java.security.Principal;
+import java.util.Iterator;
+import org.apache.jackrabbit.commons.iterator.RangeIteratorAdapter;
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.iterator.ServerIterator;
+
+public class ServerPrincipalIterator extends ServerIterator {
+
+    public ServerPrincipalIterator(Iterator<Principal> iterator,
+            RemoteAdapterFactory factory, int maxBufferSize)
+            throws RemoteException {
+        super(new RangeIteratorAdapter(iterator), factory, maxBufferSize);
+    }
+
+    /** @{inheritDoc */
+    protected Object getRemoteObject(Object object) throws RemoteException {
+        return getFactory().getRemotePrincipal((Principal) object);
+    }
+}

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipalIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/principal/ServerPrincipalIterator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlEntry.java?rev=925218&view=auto
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlEntry.java (added)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlEntry.java Fri Mar 19 13:55:06 2010
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server.security;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.security.AccessControlEntry;
+
+import org.apache.jackrabbit.rmi.remote.principal.RemotePrincipal;
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlEntry;
+import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege;
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerObject;
+
+public class ServerAccessControlEntry extends ServerObject implements
+        RemoteAccessControlEntry {
+
+    private final AccessControlEntry ace;
+
+    public ServerAccessControlEntry(final AccessControlEntry ace,
+            final RemoteAdapterFactory factory) throws RemoteException {
+        super(factory);
+        this.ace = ace;
+    }
+
+    public RemotePrincipal getPrincipal() throws RemoteException {
+        return getFactory().getRemotePrincipal(ace.getPrincipal());
+    }
+
+    public RemotePrivilege[] getPrivileges() throws RemoteException {
+        return getFactory().getRemotePrivilege(ace.getPrivileges());
+    }
+
+    AccessControlEntry getAccessControlEntry() {
+        return ace;
+    }
+}

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlEntry.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlList.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlList.java?rev=925218&view=auto
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlList.java (added)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlList.java Fri Mar 19 13:55:06 2010
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server.security;
+
+import java.rmi.RemoteException;
+import java.security.Principal;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.security.AccessControlEntry;
+import javax.jcr.security.AccessControlList;
+import javax.jcr.security.Privilege;
+
+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.RemotePrivilege;
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.principal.ServerPrincipal;
+
+public class ServerAccessControlList extends ServerAccessControlPolicy
+        implements RemoteAccessControlList {
+
+    public ServerAccessControlList(final AccessControlList acl,
+            final RemoteAdapterFactory factory) throws RemoteException {
+        super(acl, factory);
+    }
+
+    public RemoteAccessControlEntry[] getAccessControlEntries()
+            throws RepositoryException, RemoteException {
+        return getFactory().getRemoteAccessControlEntry(
+            ((AccessControlList) getAccessControlPolicy()).getAccessControlEntries());
+    }
+
+    public boolean addAccessControlEntry(RemotePrincipal principal,
+            RemotePrivilege[] privileges) throws RepositoryException {
+
+        Principal p = null;
+        if (principal instanceof ServerPrincipal) {
+            p = ((ServerPrincipal) principal).getPrincipal();
+        }
+        Privilege[] privs = new Privilege[privileges.length];
+        for (int i = 0; privs != null && i < privs.length; i++) {
+            if (privileges[i] instanceof ServerPrivilege) {
+                privs[i] = ((ServerPrivilege) privileges[i]).getPrivilege();
+            } else {
+                // not a compatible remote privilege, abort
+                privs = null;
+            }
+        }
+
+        if (p != null && privs != null) {
+            return ((AccessControlList) getAccessControlPolicy()).addAccessControlEntry(
+                p, privs);
+        }
+
+        throw new RepositoryException("Unsupported Remote types");
+    }
+
+    public void removeAccessControlEntry(RemoteAccessControlEntry ace)
+            throws RepositoryException {
+        if (ace instanceof ServerAccessControlEntry) {
+            AccessControlEntry lace = ((ServerAccessControlEntry) ace).getAccessControlEntry();
+            ((AccessControlList) getAccessControlPolicy()).removeAccessControlEntry(lace);
+        } else {
+            throw new RepositoryException(
+                "Unsupported RemoteAccessControlEntry type " + ace.getClass());
+        }
+    }
+}

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlList.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlManager.java?rev=925218&view=auto
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlManager.java (added)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlManager.java Fri Mar 19 13:55:06 2010
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.rmi.server.security;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.security.AccessControlManager;
+import javax.jcr.security.Privilege;
+
+import org.apache.jackrabbit.rmi.remote.RemoteIterator;
+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.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerObject;
+
+public class ServerAccessControlManager extends ServerObject implements
+        RemoteAccessControlManager {
+
+    private final AccessControlManager acm;
+
+    public ServerAccessControlManager(AccessControlManager acm,
+            RemoteAdapterFactory factory) throws RemoteException {
+        super(factory);
+        this.acm = acm;
+    }
+
+    public RemoteIterator getApplicablePolicies(String absPath)
+            throws RepositoryException, RemoteException {
+        return getFactory().getRemoteAccessControlPolicyIterator(
+            acm.getApplicablePolicies(absPath));
+    }
+
+    public RemoteAccessControlPolicy[] getEffectivePolicies(String absPath)
+            throws RepositoryException, RemoteException {
+        return getFactory().getRemoteAccessControlPolicy(
+            acm.getEffectivePolicies(absPath));
+    }
+
+    public RemoteAccessControlPolicy[] getPolicies(String absPath)
+            throws RepositoryException, RemoteException {
+        return getFactory().getRemoteAccessControlPolicy(
+            acm.getPolicies(absPath));
+    }
+
+    public RemotePrivilege[] getPrivileges(String absPath)
+            throws RepositoryException, RemoteException {
+        return getFactory().getRemotePrivilege(acm.getPrivileges(absPath));
+    }
+
+    public RemotePrivilege[] getSupportedPrivileges(String absPath)
+            throws RepositoryException, RemoteException {
+        return getFactory().getRemotePrivilege(
+            acm.getSupportedPrivileges(absPath));
+    }
+
+    public boolean hasPrivileges(String absPath, String[] privileges)
+            throws RepositoryException {
+        Privilege[] privs = new Privilege[privileges.length];
+        for (int i = 0; i < privs.length; i++) {
+            privs[i] = acm.privilegeFromName(privileges[i]);
+        }
+
+        return acm.hasPrivileges(absPath, privs);
+    }
+
+    public RemotePrivilege privilegeFromName(String privilegeName)
+            throws RepositoryException, RemoteException {
+        return getFactory().getRemotePrivilege(
+            acm.privilegeFromName(privilegeName));
+    }
+}

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlManager.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicy.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicy.java?rev=925218&view=auto
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicy.java (added)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicy.java Fri Mar 19 13:55:06 2010
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server.security;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.security.AccessControlPolicy;
+
+import org.apache.jackrabbit.rmi.remote.security.RemoteAccessControlPolicy;
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerObject;
+
+public class ServerAccessControlPolicy extends ServerObject implements
+        RemoteAccessControlPolicy {
+
+    private final AccessControlPolicy acp;
+
+    public ServerAccessControlPolicy(final AccessControlPolicy acp,
+            final RemoteAdapterFactory factory)
+
+    throws RemoteException {
+        super(factory);
+        this.acp = acp;
+    }
+
+    AccessControlPolicy getAccessControlPolicy() {
+        return acp;
+    }
+
+}

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicy.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicyIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicyIterator.java?rev=925218&view=auto
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicyIterator.java (added)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicyIterator.java Fri Mar 19 13:55:06 2010
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server.security;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.security.AccessControlPolicy;
+import javax.jcr.security.AccessControlPolicyIterator;
+
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.iterator.ServerIterator;
+
+/**
+ * A ServerIterator for iterating rows.
+ */
+public class ServerAccessControlPolicyIterator extends ServerIterator {
+
+    /**
+     * Creates a ServerRowIterator instance.
+     *
+     * @param iterator local row iterator
+     * @param factory remote adapter factory
+     * @param maxBufferSize maximum size of the element buffer
+     * @throws RemoteException on RMI errors
+     */
+    public ServerAccessControlPolicyIterator(
+            AccessControlPolicyIterator iterator, RemoteAdapterFactory factory,
+            int maxBufferSize) throws RemoteException {
+        super(iterator, factory, maxBufferSize);
+    }
+
+    /**
+     * Creates and returns a remote adapter for the given row.
+     *
+     * @param object local object
+     * @return remote adapter
+     * @throws RemoteException on RMI errors
+     * @see ServerIterator#getRemoteObject(Object)
+     */
+    protected Object getRemoteObject(Object object) throws RemoteException {
+        return getFactory().getRemoteAccessControlPolicy(
+            (AccessControlPolicy) object);
+    }
+
+}

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicyIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerAccessControlPolicyIterator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerPrivilege.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerPrivilege.java?rev=925218&view=auto
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerPrivilege.java (added)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerPrivilege.java Fri Mar 19 13:55:06 2010
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server.security;
+
+import java.rmi.RemoteException;
+import java.rmi.server.RemoteStub;
+
+import javax.jcr.security.Privilege;
+
+import org.apache.jackrabbit.rmi.remote.security.RemotePrivilege;
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerObject;
+
+public class ServerPrivilege extends ServerObject implements RemotePrivilege {
+
+    private final Privilege privilege;
+
+    public ServerPrivilege(final Privilege privilege,
+            final RemoteAdapterFactory factory) throws RemoteException {
+        super(factory);
+        this.privilege = privilege;
+    }
+
+    public RemotePrivilege[] getAggregatePrivileges() throws RemoteException {
+        return getFactory().getRemotePrivilege(
+            privilege.getAggregatePrivileges());
+    }
+
+    public RemotePrivilege[] getDeclaredAggregatePrivileges()
+            throws RemoteException {
+        return getFactory().getRemotePrivilege(
+            privilege.getDeclaredAggregatePrivileges());
+    }
+
+    public String getName() {
+        return privilege.getName();
+    }
+
+    public boolean isAbstract() {
+        return privilege.isAbstract();
+    }
+
+    public boolean isAggregate() {
+        return privilege.isAggregate();
+    }
+
+    Privilege getPrivilege() {
+        return privilege;
+    }
+}

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerPrivilege.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/security/ServerPrivilege.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url



Mime
View raw message