You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by md...@apache.org on 2013/07/30 16:42:15 UTC
svn commit: r1508469 - in /jackrabbit/trunk:
jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepository.java
jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractRepository.java
Author: mduerig
Date: Tue Jul 30 14:42:15 2013
New Revision: 1508469
URL: http://svn.apache.org/r1508469
Log:
JCR-3634: New method: JackrabbitRepository.login(Credentials, Map<String, Object>)
Initial implementation
Modified:
jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepository.java
jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractRepository.java
Modified: jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepository.java?rev=1508469&r1=1508468&r2=1508469&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepository.java (original)
+++ jackrabbit/trunk/jackrabbit-api/src/main/java/org/apache/jackrabbit/api/JackrabbitRepository.java Tue Jul 30 14:42:15 2013
@@ -16,7 +16,14 @@
*/
package org.apache.jackrabbit.api;
+import java.util.Map;
+
+import javax.jcr.Credentials;
+import javax.jcr.LoginException;
+import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
/**
* The Jackrabbit repository interface. This interface contains the
@@ -25,6 +32,34 @@ import javax.jcr.Repository;
public interface JackrabbitRepository extends Repository {
/**
+ * Equivalent to {@code login(credentials, workspaceName)} except that the returned
+ * Session instance contains the given extra session attributes in addition to any
+ * included in the given Credentials instance. Attribute names from the credentials
+ * and the attribute map must not overlap. In case of an overlap implementation
+ * may throw an <code>RepositoryException</code>.
+ * <p>
+ * The attributes are implementation-specific and may affect the behavior of the returned
+ * session. Unlike credentials attributes, these separately passed session attributes
+ * are guaranteed not to affect the authentication of the client.
+ * <p>
+ * An implementation that does not support a particular session attribute is expected
+ * to ignore it and not make it available through the returned session. A client that
+ * depends on specific behavior defined by a particular attribute can check whether
+ * the returned session contains that attribute to verify whether the underlying
+ * repository implementation supports that feature.
+ *
+ * @param credentials the credentials of the user
+ * @param workspaceName the name of a workspace
+ * @param attributes implementation-specific session attributes
+ * @return a valid session for the user to access the repository
+ * @throws LoginException if authentication or authorization for the specified workspace fails
+ * @throws NoSuchWorkspaceException if the specified workspace is not recognized
+ * @throws RepositoryException if another error occurs
+ */
+ Session login(Credentials credentials, String workspaceName, Map<String, Object> attributes)
+ throws LoginException, NoSuchWorkspaceException, RepositoryException;
+
+ /**
* Shuts down the repository. A Jackrabbit repository instance contains
* a acquired resources and cached data that needs to be released and
* persisted when the repository is no longer used. This method handles
Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractRepository.java?rev=1508469&r1=1508468&r2=1508469&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractRepository.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/AbstractRepository.java Tue Jul 30 14:42:15 2013
@@ -17,9 +17,12 @@
package org.apache.jackrabbit.commons;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import javax.jcr.Credentials;
+import javax.jcr.LoginException;
+import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
@@ -101,6 +104,24 @@ public abstract class AbstractRepository
}
/**
+ * This implementation directly delegates to {@link #login(javax.jcr.Credentials, String)}
+ * not supporting any attributes.
+ *
+ * @param credentials the credentials of the user
+ * @param workspaceName the name of a workspace
+ * @param attributes implementation-specific session attributes
+ * @return a valid session for the user to access the repository.
+ * @throws javax.jcr.LoginException
+ * @throws javax.jcr.NoSuchWorkspaceException
+ * @throws RepositoryException
+ */
+ public Session login(
+ Credentials credentials, String workspaceName, Map<String, Object> attributes)
+ throws LoginException, NoSuchWorkspaceException, RepositoryException {
+ return login(credentials, workspaceName);
+ }
+
+ /**
* Calls {@link Repository#login(Credentials, String)} with
* <code>null</code> arguments.
*