chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1129182 - in /chemistry/opencmis/trunk/chemistry-opencmis-client: chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runti...
Date Mon, 30 May 2011 14:06:56 GMT
Author: fmui
Date: Mon May 30 14:06:55 2011
New Revision: 1129182

URL: http://svn.apache.org/viewvc?rev=1129182&view=rev
Log:
CMIS-379: Second step: added object factory, authentication provider and cache parameters
to session factory

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/SessionFactory.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionFactoryImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/SessionFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/SessionFactory.java?rev=1129182&r1=1129181&r2=1129182&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/SessionFactory.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/SessionFactory.java
Mon May 30 14:06:55 2011
@@ -21,6 +21,9 @@ package org.apache.chemistry.opencmis.cl
 import java.util.List;
 import java.util.Map;
 
+import org.apache.chemistry.opencmis.commons.SessionParameter;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
+
 /**
  * Entry point into the OpenCMIS Client API. The <code>SessionFactory</code>
  * class implementation needs to be retrieved by any runtime lookup call. This
@@ -54,22 +57,25 @@ import java.util.Map;
 public interface SessionFactory {
 
     /**
-     * Obtain a new session using parameter configuration.
+     * Creates a new session.
      * 
      * @param T
-     *            A from the {@code Session} interface derived sub type
+     *            a class implementing the {@link Session} interface
      * @param parameters
      *            a {@code Map} of name/value pairs with parameters for the
-     *            session. See class {@code SessionParameter}.
-     * @return a {@code Session} to the CMIS repository specified by the {@code
-     *         parameters}.
+     *            session
+     * @return a {@link Session} connected to the CMIS repository
+     * @throws CmisBaseException
+     *             if the connection could not be established
+     * 
+     * @see SessionParameter
      */
-    <T extends Session> T createSession(Map<String, String> parameters);
+    Session createSession(Map<String, String> parameters);
 
     /**
      * Returns all repositories that are available at the endpoint. See
-     * {@link #createSession(Map)} for parameter details. The parameter {@code
-     * SessionParameter.REPOSITORY_ID} should not be set.
+     * {@link #createSession(Map)} for parameter details. The parameter
+     * {@code SessionParameter.REPOSITORY_ID} should not be set.
      */
     List<Repository> getRepositories(Map<String, String> parameters);
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionFactoryImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionFactoryImpl.java?rev=1129182&r1=1129181&r2=1129182&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionFactoryImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionFactoryImpl.java
Mon May 30 14:06:55 2011
@@ -22,11 +22,16 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.chemistry.opencmis.client.api.ObjectFactory;
 import org.apache.chemistry.opencmis.client.api.Repository;
 import org.apache.chemistry.opencmis.client.api.Session;
 import org.apache.chemistry.opencmis.client.api.SessionFactory;
+import org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider;
+import org.apache.chemistry.opencmis.client.runtime.cache.Cache;
 import org.apache.chemistry.opencmis.client.runtime.repository.RepositoryImpl;
+import org.apache.chemistry.opencmis.commons.SessionParameter;
 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
 import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
 
 /**
@@ -55,22 +60,59 @@ public class SessionFactoryImpl implemen
         return new SessionFactoryImpl();
     }
 
-    @SuppressWarnings("unchecked")
-    public <T extends Session> T createSession(Map<String, String> parameters)
{
-        SessionImpl session = new SessionImpl(parameters, null, null, null);
+    public Session createSession(Map<String, String> parameters) {
+        return createSession(parameters, null, null, null);
+    }
+
+    /**
+     * Creates a new session. The provided object factory, authentication
+     * provider and cache instance override the values in the session parameters
+     * if they are not <code>null</code>.
+     * 
+     * @param T
+     *            a class implementing the {@link Session} interface
+     * @param parameters
+     *            a {@code Map} of name/value pairs with parameters for the
+     *            session
+     * @param objectFactory
+     *            an object factory instance
+     * @param authenticationProvider
+     *            an authentication provider instance
+     * @param cache
+     *            a cache instance
+     * @return a {@link Session} connected to the CMIS repository
+     * @throws CmisBaseException
+     *             if the connection could not be established
+     * 
+     * @see SessionParameter
+     */
+    public Session createSession(Map<String, String> parameters, ObjectFactory objectFactory,
+            AbstractAuthenticationProvider authenticationProvider, Cache cache) {
+        SessionImpl session = new SessionImpl(parameters, objectFactory, authenticationProvider,
cache);
         session.connect();
 
-        return (T) session;
+        return session;
     }
 
     public List<Repository> getRepositories(Map<String, String> parameters) {
+        return getRepositories(parameters, null, null, null);
+    }
+
+    /**
+     * Returns all repositories that are available at the endpoint. See
+     * {@link #createSession(Map, ObjectFactory, AbstractAuthenticationProvider, Cache)}
+     * for parameter details. The parameter
+     * {@code SessionParameter.REPOSITORY_ID} should not be set.
+     */
+    public List<Repository> getRepositories(Map<String, String> parameters, ObjectFactory
objectFactory,
+            AbstractAuthenticationProvider authenticationProvider, Cache cache) {
         CmisBinding binding = CmisBindingHelper.createBinding(parameters, null);
 
         List<RepositoryInfo> repositoryInfos = binding.getRepositoryService().getRepositoryInfos(null);
 
         List<Repository> result = new ArrayList<Repository>();
         for (RepositoryInfo data : repositoryInfos) {
-            result.add(new RepositoryImpl(data, parameters, this));
+            result.add(new RepositoryImpl(data, parameters, this, objectFactory, authenticationProvider,
cache));
         }
 
         return result;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.java?rev=1129182&r1=1129181&r2=1129182&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.java
Mon May 30 14:06:55 2011
@@ -21,9 +21,12 @@ package org.apache.chemistry.opencmis.cl
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.chemistry.opencmis.client.api.ObjectFactory;
 import org.apache.chemistry.opencmis.client.api.Repository;
 import org.apache.chemistry.opencmis.client.api.Session;
-import org.apache.chemistry.opencmis.client.api.SessionFactory;
+import org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider;
+import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
+import org.apache.chemistry.opencmis.client.runtime.cache.Cache;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
@@ -33,22 +36,29 @@ public class RepositoryImpl extends Repo
     private static final long serialVersionUID = 1L;
 
     private final Map<String, String> parameters;
-    private final SessionFactory sessionFactory;
+    private final SessionFactoryImpl sessionFactory;
+    private final ObjectFactory objectFactory;
+    private final AbstractAuthenticationProvider authenticationProvider;
+    private final Cache cache;
 
     /**
      * Constructor.
      */
-    public RepositoryImpl(RepositoryInfo data, Map<String, String> parameters, SessionFactory
sessionFactory) {
+    public RepositoryImpl(RepositoryInfo data, Map<String, String> parameters, SessionFactoryImpl
sessionFactory,
+            ObjectFactory objectFactory, AbstractAuthenticationProvider authenticationProvider,
Cache cache) {
         super(data);
 
         this.parameters = new HashMap<String, String>(parameters);
         this.parameters.put(SessionParameter.REPOSITORY_ID, getId());
 
         this.sessionFactory = sessionFactory;
+        this.objectFactory = objectFactory;
+        this.authenticationProvider = authenticationProvider;
+        this.cache = cache;
     }
 
     @SuppressWarnings("unchecked")
     public <T extends Session> T createSession() {
-        return (T) sessionFactory.createSession(parameters);
+        return (T) sessionFactory.createSession(parameters, objectFactory, authenticationProvider,
cache);
     }
 }



Mime
View raw message