chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r921337 - in /incubator/chemistry/trunk/opencmis/opencmis-client: opencmis-client-api/src/main/java/org/apache/opencmis/client/api/ opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ opencmis-client-impl/src/main/j...
Date Wed, 10 Mar 2010 13:09:55 GMT
Author: fmui
Date: Wed Mar 10 13:09:55 2010
New Revision: 921337

URL: http://svn.apache.org/viewvc?rev=921337&view=rev
Log:
added repository discovery to SessionFactory

Added:
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/Repository.java
  (with props)
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/CmisProviderHelper.java
  (with props)
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryImpl.java
  (with props)
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryInfoImpl.java
  (with props)
Removed:
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/RepositoryInfoImpl.java
Modified:
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/SessionFactory.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/SessionFactoryImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryCapabilitiesImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/SessionFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/SessionFactory.java?rev=921337&r1=921336&r2=921337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/SessionFactory.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/SessionFactory.java
Wed Mar 10 13:09:55 2010
@@ -18,22 +18,23 @@
  */
 package org.apache.opencmis.client.api;
 
+import java.util.List;
 import java.util.Map;
 
+import org.apache.opencmis.client.api.repository.Repository;
+
 /**
- * Entry point into the OpenCMIS Client API. The <code>SessionFactory</code>
- * class implementation needs to be retrieved by any runtime lookup call. This
- * can for instance be a J2EE JNDI lookup or an OSGi service lookup.
+ * Entry point into the OpenCMIS Client API. The <code>SessionFactory</code>
class implementation
+ * needs to be retrieved by any runtime lookup call. This can for instance be a J2EE JNDI
lookup or
+ * an OSGi service lookup.
  * <p>
- * The entries of parameter map are defined by <code>SessionParameter</code>
- * class which is part of the commons package. Parameters specify connection
- * settings (user name, authentication, connection url, binding type (soap or
- * atom pub) ...).
+ * The entries of parameter map are defined by <code>SessionParameter</code>
class which is part of
+ * the commons package. Parameters specify connection settings (user name, authentication,
+ * connection url, binding type (soap or atom pub) ...).
  * <p>
- * The <code>Session</code> class which is constructed is either the
- * <code>session</code> base class which is the default implementation or it
can
- * be derived from that implementing special behavior for the session. Which
- * session finally is returned can be controlled by the
+ * The <code>Session</code> class which is constructed is either the <code>session</code>
base class
+ * which is the default implementation or it can be derived from that implementing special
behavior
+ * for the session. Which session finally is returned can be controlled by the
  * <code>SessionParameter.SESSION_TYPE</code> parameter.
  * <p>
  * Example Coding:
@@ -50,21 +51,27 @@ import java.util.Map;
  * <br>TransientSession s = factory.createSession(parameters);
  * </code>
  *<p>
- * If the <code>SessionType</code> parameter is not specified then the default
- * persistent session is returned.
+ * If the <code>SessionType</code> parameter is not specified then the default
persistent session is
+ * returned.
  * 
  */
 public interface SessionFactory {
 
-	/**
-	 * Obtain a new session using parameter configuration.
-	 * 
-	 * @param T A from the {@code Session} interface derived sub type 
-	 * @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}. 
-	 */
-	<T extends Session> T createSession(Map<String, String> parameters);
+  /**
+   * Obtain a new session using parameter configuration.
+   * 
+   * @param T
+   *          A from the {@code Session} interface derived sub type
+   * @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}.
+   */
+  <T extends Session> T 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.
+   */
+  List<Repository> getRepositories(Map<String, String> parameters);
 }

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/Repository.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/Repository.java?rev=921337&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/Repository.java
(added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/Repository.java
Wed Mar 10 13:09:55 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.opencmis.client.api.repository;
+
+import org.apache.opencmis.client.api.Session;
+
+/**
+ * Represents a repository.
+ */
+public interface Repository extends RepositoryInfo {
+
+  /**
+   * Creates a session for this repository.
+   */
+  <T extends Session> T createSession();
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/Repository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/CmisProviderHelper.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/CmisProviderHelper.java?rev=921337&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/CmisProviderHelper.java
(added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/CmisProviderHelper.java
Wed Mar 10 13:09:55 2010
@@ -0,0 +1,88 @@
+/*
+ * 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.opencmis.client.runtime;
+
+import java.util.Map;
+
+import org.apache.opencmis.client.provider.factory.CmisProviderFactory;
+import org.apache.opencmis.commons.SessionParameter;
+import org.apache.opencmis.commons.enums.BindingType;
+import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.opencmis.commons.provider.CmisProvider;
+
+/**
+ * Helper methods for provider handling.
+ */
+public class CmisProviderHelper {
+  /**
+   * Creates a {@link CmisProvider} object.
+   */
+  public static CmisProvider createProvider(Map<String, String> parameters) {
+    if (parameters == null || parameters.isEmpty()) {
+      throw new CmisRuntimeException("Session parameter not set!");
+    }
+
+    if (!parameters.containsKey(SessionParameter.BINDING_TYPE)) {
+      parameters.put(SessionParameter.BINDING_TYPE, BindingType.CUSTOM.value());
+    }
+
+    BindingType bt = BindingType.fromValue(parameters.get(SessionParameter.BINDING_TYPE));
+
+    switch (bt) {
+    case ATOMPUB:
+      return createAtomPubProvider(parameters);
+    case WEBSERVICES:
+      return createWebServiceProvider(parameters);
+    case CUSTOM:
+      return createCustomProvider(parameters);
+    default:
+      throw new CmisRuntimeException("Ambiguous session parameter: " + parameters);
+    }
+  }
+
+  /**
+   * Creates a provider with custom parameters.
+   */
+  private static CmisProvider createCustomProvider(Map<String, String> parameters)
{
+    CmisProviderFactory factory = CmisProviderFactory.newInstance();
+    CmisProvider provider = factory.createCmisProvider(parameters);
+
+    return provider;
+  }
+
+  /**
+   * Creates a Web Services provider.
+   */
+  private static CmisProvider createWebServiceProvider(Map<String, String> parameters)
{
+    CmisProviderFactory factory = CmisProviderFactory.newInstance();
+    CmisProvider provider = factory.createCmisWebServicesProvider(parameters);
+
+    return provider;
+  }
+
+  /**
+   * Creates an AtomPub provider.
+   */
+  private static CmisProvider createAtomPubProvider(Map<String, String> parameters)
{
+    CmisProviderFactory factory = CmisProviderFactory.newInstance();
+    CmisProvider provider = factory.createCmisAtomPubProvider(parameters);
+
+    return provider;
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/CmisProviderHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java?rev=921337&r1=921336&r2=921337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentSessionImpl.java
Wed Mar 10 13:09:55 2010
@@ -46,17 +46,16 @@ import org.apache.opencmis.client.api.re
 import org.apache.opencmis.client.api.repository.RepositoryInfo;
 import org.apache.opencmis.client.api.util.Container;
 import org.apache.opencmis.client.api.util.PagingList;
-import org.apache.opencmis.client.provider.factory.CmisProviderFactory;
 import org.apache.opencmis.client.runtime.cache.Cache;
 import org.apache.opencmis.client.runtime.cache.CacheImpl;
 import org.apache.opencmis.client.runtime.repository.PersistentObjectFactoryImpl;
+import org.apache.opencmis.client.runtime.repository.RepositoryInfoImpl;
 import org.apache.opencmis.client.runtime.util.AbstractPagingList;
 import org.apache.opencmis.client.runtime.util.ContainerImpl;
 import org.apache.opencmis.commons.SessionParameter;
 import org.apache.opencmis.commons.api.TypeDefinition;
 import org.apache.opencmis.commons.api.TypeDefinitionContainer;
 import org.apache.opencmis.commons.api.TypeDefinitionList;
-import org.apache.opencmis.commons.enums.BindingType;
 import org.apache.opencmis.commons.enums.IncludeRelationships;
 import org.apache.opencmis.commons.enums.VersioningState;
 import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
@@ -65,6 +64,7 @@ import org.apache.opencmis.commons.provi
 import org.apache.opencmis.commons.provider.NavigationService;
 import org.apache.opencmis.commons.provider.ObjectData;
 import org.apache.opencmis.commons.provider.ObjectList;
+import org.apache.opencmis.commons.provider.RepositoryInfoData;
 import org.apache.opencmis.commons.provider.RepositoryService;
 
 /**
@@ -437,9 +437,16 @@ public class PersistentSessionImpl imple
     if (this.repositoryInfo == null) {
       /* get initial repository id from session parameter */
       String repositoryId = this.determineRepositoryId(this.parameters);
-      RepositoryInfoImpl rii = new RepositoryInfoImpl(this, repositoryId);
-      this.repositoryInfo = rii;
+      if (repositoryId == null) {
+        throw new IllegalStateException("Repository Id is not set!");
+      }
+
+      RepositoryInfoData data = getProvider().getRepositoryService().getRepositoryInfo(
+          repositoryId, null);
+
+      this.repositoryInfo = new RepositoryInfoImpl(data);
     }
+
     return this.repositoryInfo;
   }
 
@@ -626,59 +633,7 @@ public class PersistentSessionImpl imple
    * InMemory} provider is selected.
    */
   public void connect() {
-    if (this.parameters == null || this.parameters.isEmpty()) {
-      throw new CmisRuntimeException("Session parameter not set!");
-    }
-
-    if (!this.parameters.containsKey(SessionParameter.BINDING_TYPE)) {
-      this.parameters.put(SessionParameter.BINDING_TYPE, BindingType.CUSTOM.value());
-    }
-
-    BindingType bt = BindingType.fromValue(this.parameters.get(SessionParameter.BINDING_TYPE));
-
-    switch (bt) {
-    case ATOMPUB:
-      this.provider = this.createAtomPubProvider(this.parameters);
-      break;
-    case WEBSERVICES:
-      this.provider = this.createWebServiceProvider(this.parameters);
-      break;
-    case CUSTOM:
-      this.provider = this.createCustomProvider(this.parameters);
-      break;
-    default:
-      throw new CmisRuntimeException("Ambiguous session parameter: " + this.parameters);
-    }
-  }
-
-  /**
-   * Creates a provider with custom parameters.
-   */
-  private CmisProvider createCustomProvider(Map<String, String> parameters) {
-    CmisProviderFactory factory = CmisProviderFactory.newInstance();
-    CmisProvider provider = factory.createCmisProvider(parameters);
-
-    return provider;
-  }
-
-  /**
-   * Creates a Web Services provider.
-   */
-  private CmisProvider createWebServiceProvider(Map<String, String> parameters) {
-    CmisProviderFactory factory = CmisProviderFactory.newInstance();
-    CmisProvider provider = factory.createCmisWebServicesProvider(parameters);
-
-    return provider;
-  }
-
-  /**
-   * Creates an AtomPub provider.
-   */
-  private CmisProvider createAtomPubProvider(Map<String, String> parameters) {
-    CmisProviderFactory factory = CmisProviderFactory.newInstance();
-    CmisProvider provider = factory.createCmisAtomPubProvider(parameters);
-
-    return provider;
+    this.provider = CmisProviderHelper.createProvider(this.parameters);
   }
 
   public CmisProvider getProvider() {

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/SessionFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/SessionFactoryImpl.java?rev=921337&r1=921336&r2=921337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/SessionFactoryImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/SessionFactoryImpl.java
Wed Mar 10 13:09:55 2010
@@ -18,18 +18,24 @@
  */
 package org.apache.opencmis.client.runtime;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.opencmis.client.api.Session;
 import org.apache.opencmis.client.api.SessionFactory;
+import org.apache.opencmis.client.api.repository.Repository;
+import org.apache.opencmis.client.runtime.repository.RepositoryImpl;
 import org.apache.opencmis.commons.SessionParameter;
 import org.apache.opencmis.commons.enums.SessionType;
 import org.apache.opencmis.commons.exceptions.CmisNotSupportedException;
 import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.opencmis.commons.provider.CmisProvider;
+import org.apache.opencmis.commons.provider.RepositoryInfoData;
 
 /**
- * Default implementation of a session factory. Used by unit tests or
- * applications that depend directly on runtime implementation.
+ * Default implementation of a session factory. Used by unit tests or applications that depend
+ * directly on runtime implementation.
  * <p>
  * <code>
  * SessionFactory sf = new SessionFactoryImpl();<br>
@@ -46,42 +52,65 @@ import org.apache.opencmis.commons.excep
  */
 public class SessionFactoryImpl implements SessionFactory {
 
-	protected SessionFactoryImpl() {
+  protected SessionFactoryImpl() {
 
-	}
+  }
 
-	public static SessionFactory newInstance() {
-		return new SessionFactoryImpl();
-	}
-
-	@SuppressWarnings("unchecked")
-	public <T extends Session> T createSession(Map<String, String> parameters) {
-		Session s = null;
-		SessionType t = null;
-
-		// determine session type
-		if (parameters.containsKey(SessionParameter.SESSION_TYPE)) {
-			t = SessionType.fromValue(parameters
-					.get(SessionParameter.SESSION_TYPE));
-		} else {
-			// default session type if type is not set
-			t = SessionType.PERSISTENT;
-		}
-
-		switch (t) {
-		case PERSISTENT:
-			PersistentSessionImpl ps = new PersistentSessionImpl(parameters);
-			ps.connect(); // connect session with provider
-			s = ps;
-			break;
-		case TRANSIENT:
-			throw new CmisNotSupportedException("SessionType " + t
-					+ "not implemented!");
-		default:
-			throw new CmisRuntimeException("SessionType " + t + "not known!");
-		}
+  public static SessionFactory newInstance() {
+    return new SessionFactoryImpl();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.SessionFactory#createSession(java.util.Map)
+   */
+  @SuppressWarnings("unchecked")
+  public <T extends Session> T createSession(Map<String, String> parameters)
{
+    Session s = null;
+    SessionType t = null;
+
+    // determine session type
+    if (parameters.containsKey(SessionParameter.SESSION_TYPE)) {
+      t = SessionType.fromValue(parameters.get(SessionParameter.SESSION_TYPE));
+    }
+    else {
+      // default session type if type is not set
+      t = SessionType.PERSISTENT;
+    }
+
+    switch (t) {
+    case PERSISTENT:
+      PersistentSessionImpl ps = new PersistentSessionImpl(parameters);
+      ps.connect(); // connect session with provider
+      s = ps;
+      break;
+    case TRANSIENT:
+      throw new CmisNotSupportedException("SessionType " + t + "not implemented!");
+    default:
+      throw new CmisRuntimeException("SessionType " + t + "not known!");
+    }
+
+    return (T) s;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.SessionFactory#getRepositories(java.util.Map)
+   */
+  public List<Repository> getRepositories(Map<String, String> parameters) {
+    CmisProvider provider = CmisProviderHelper.createProvider(parameters);
+
+    List<RepositoryInfoData> repositoryInfos = provider.getRepositoryService().getRepositoryInfos(
+        null);
+
+    List<Repository> result = new ArrayList<Repository>();
+    for (RepositoryInfoData data : repositoryInfos) {
+      result.add(new RepositoryImpl(data, parameters, this));
+    }
 
-		return (T) s;
-	}
+    return result;
+  }
 
 }

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryCapabilitiesImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryCapabilitiesImpl.java?rev=921337&r1=921336&r2=921337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryCapabilitiesImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryCapabilitiesImpl.java
Wed Mar 10 13:09:55 2010
@@ -18,6 +18,8 @@
  */
 package org.apache.opencmis.client.runtime.repository;
 
+import java.io.Serializable;
+
 import org.apache.opencmis.client.api.repository.RepositoryCapabilities;
 import org.apache.opencmis.commons.enums.CapabilityAcl;
 import org.apache.opencmis.commons.enums.CapabilityChanges;
@@ -27,68 +29,70 @@ import org.apache.opencmis.commons.enums
 import org.apache.opencmis.commons.enums.CapabilityRendition;
 import org.apache.opencmis.commons.provider.RepositoryCapabilitiesData;
 
-public class RepositoryCapabilitiesImpl implements RepositoryCapabilities {
+public class RepositoryCapabilitiesImpl implements RepositoryCapabilities, Serializable {
+
+  private static final long serialVersionUID = 1L;
+
+  private RepositoryCapabilitiesData capabilities = null;
+
+  public RepositoryCapabilitiesImpl(RepositoryCapabilitiesData rcd) {
+    this.capabilities = rcd;
+  }
+
+  public CapabilityAcl getAclSupport() {
+    return this.capabilities.getCapabilityAcl();
+  }
+
+  public CapabilityChanges getChangesSupport() {
+    return this.capabilities.getCapabilityChanges();
+  }
+
+  public CapabilityContentStreamUpdates getContentStreamUpdatabilitySupport() {
+    return this.capabilities.getCapabilityContentStreamUpdatability();
+  }
+
+  public CapabilityJoin getJoinSupport() {
+    return this.capabilities.getCapabilityJoin();
+  }
+
+  public CapabilityQuery getQuerySupport() {
+    return this.capabilities.getCapabilityQuery();
+  }
+
+  public CapabilityRendition getRenditionsSupport() {
+    return this.capabilities.getCapabilityRenditions();
+  }
+
+  public boolean isAllVersionsSearchableSupported() {
+    return this.capabilities.allVersionsSearchable();
+  }
+
+  public boolean isGetDescendantsSupported() {
+    return this.capabilities.supportsGetDescendants();
+  }
+
+  public boolean isGetFolderTreeSupported() {
+    return this.capabilities.supportsGetFolderTree();
+  }
+
+  public boolean isMultifilingSupported() {
+    return this.capabilities.supportsMultifiling();
+  }
+
+  public boolean isPwcSearchableSupported() {
+    return this.capabilities.isPwcSearchable();
+  }
+
+  public boolean isPwcUpdatableSupported() {
+    return this.capabilities.isPwcUpdatable();
+  }
+
+  public boolean isUnfilingSupported() {
+    return this.capabilities.supportsUnfiling();
+  }
 
-	private RepositoryCapabilitiesData capabilities = null;
-	
-	public RepositoryCapabilitiesImpl(RepositoryCapabilitiesData rcd) {
-		this.capabilities = rcd;
-	}
-
-	public CapabilityAcl getAclSupport() {
-		return this.capabilities.getCapabilityAcl();
-	}
-
-	public CapabilityChanges getChangesSupport() {
-		return this.capabilities.getCapabilityChanges();
-	}
-
-	public CapabilityContentStreamUpdates getContentStreamUpdatabilitySupport() {
-		return this.capabilities.getCapabilityContentStreamUpdatability();
-	}
-
-	public CapabilityJoin getJoinSupport() {
-		return this.capabilities.getCapabilityJoin();
-	}
-
-	public CapabilityQuery getQuerySupport() {
-		return this.capabilities.getCapabilityQuery();
-	}
-
-	public CapabilityRendition getRenditionsSupport() {
-		return this.capabilities.getCapabilityRenditions();
-	}
-
-	public boolean isAllVersionsSearchableSupported() {
-		return this.capabilities.allVersionsSearchable();
-	}
-
-	public boolean isGetDescendantsSupported() {
-		return this.capabilities.supportsGetDescendants();
-	}
-
-	public boolean isGetFolderTreeSupported() {
-		return this.capabilities.supportsGetFolderTree();
-	}
-
-	public boolean isMultifilingSupported() {
-		return this.capabilities.supportsMultifiling();
-	}
-
-	public boolean isPwcSearchableSupported() {
-		return this.capabilities.isPwcSearchable();
-	}
-
-	public boolean isPwcUpdatableSupported() {
-		return this.capabilities.isPwcUpdatable();
-	}
-
-	public boolean isUnfilingSupported() {
-		return this.capabilities.supportsUnfiling();
-	}
-
-	public boolean isVersionSpecificFilingSupported() {
-		return this.capabilities.supportsVersionSpecificFiling();
-	}
+  public boolean isVersionSpecificFilingSupported() {
+    return this.capabilities.supportsVersionSpecificFiling();
+  }
 
 }

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryImpl.java?rev=921337&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryImpl.java
(added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryImpl.java
Wed Mar 10 13:09:55 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.opencmis.client.runtime.repository;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.opencmis.client.api.Session;
+import org.apache.opencmis.client.api.SessionFactory;
+import org.apache.opencmis.client.api.repository.Repository;
+import org.apache.opencmis.commons.SessionParameter;
+import org.apache.opencmis.commons.provider.RepositoryInfoData;
+
+public class RepositoryImpl extends RepositoryInfoImpl implements Repository {
+
+  private static final long serialVersionUID = 1L;
+
+  private final Map<String, String> parameters;
+  private final SessionFactory sessionFactory;
+
+  /**
+   * Constructor.
+   */
+  public RepositoryImpl(RepositoryInfoData data, Map<String, String> parameters,
+      SessionFactory sessionFactory) {
+    super(data);
+
+    this.parameters = new HashMap<String, String>(parameters);
+    this.parameters.put(SessionParameter.REPOSITORY_ID, getId());
+
+    this.sessionFactory = sessionFactory;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.repository.Repository#createSession()
+   */
+  @SuppressWarnings("unchecked")
+  public <T extends Session> T createSession() {
+    return (T) sessionFactory.createSession(parameters);
+  }
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryInfoImpl.java?rev=921337&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryInfoImpl.java
(added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryInfoImpl.java
Wed Mar 10 13:09:55 2010
@@ -0,0 +1,137 @@
+/*
+ * 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.opencmis.client.runtime.repository;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.opencmis.client.api.repository.RepositoryAclCapabilities;
+import org.apache.opencmis.client.api.repository.RepositoryCapabilities;
+import org.apache.opencmis.client.api.repository.RepositoryInfo;
+import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
+import org.apache.opencmis.commons.provider.RepositoryInfoData;
+
+public class RepositoryInfoImpl implements RepositoryInfo, Serializable {
+
+  /**
+   * serialization
+   */
+  private static final long serialVersionUID = -1297274972722405445L;
+
+  /*
+   * provider data (serializable)
+   */
+  private RepositoryInfoData riData;
+
+  /*
+   * Capabilities (serializable)
+   */
+  private RepositoryCapabilities capabilites = null;
+
+  /*
+   * ACL capabilities (serializable)
+   */
+  private RepositoryAclCapabilities aclCapabilites = null;
+
+  /**
+   * Constructor.
+   */
+  public RepositoryInfoImpl(RepositoryInfoData data) {
+    setRepositoryInfoData(data);
+  }
+
+  /**
+   * Sets the data object.
+   */
+  protected void setRepositoryInfoData(RepositoryInfoData data) {
+    this.riData = data;
+  }
+
+  public boolean changesIncomplete() {
+    return this.riData.changesIncomplete();
+  }
+
+  public RepositoryAclCapabilities getAclCapabilities() {
+    if (this.aclCapabilites == null) {
+      this.aclCapabilites = new RepositoryAclCapabilitiesImpl(this.riData.getAclCapabilities());
+    }
+    return this.aclCapabilites;
+  }
+
+  public RepositoryCapabilities getCapabilities() {
+    if (this.capabilites == null) {
+      capabilites = new RepositoryCapabilitiesImpl(this.riData.getRepositoryCapabilities());
+    }
+
+    return this.capabilites;
+  }
+
+  public List<BaseObjectTypeIds> getChangesOnType() {
+    return this.riData.getChangesOnType();
+  }
+
+  public String getCmisVersionSupported() {
+    return this.riData.getCmisVersionSupported();
+  }
+
+  public String getDescription() {
+    return this.riData.getRepositoryDescription();
+  }
+
+  public String getId() {
+    return this.riData.getRepositoryId();
+  }
+
+  public String getLatestChangeLogToken() {
+    return this.riData.getLatestChangeLogToken();
+  }
+
+  public String getName() {
+    return this.riData.getRepositoryName();
+  }
+
+  public String getPrincipalIdAnonymous() {
+    return this.riData.getPrincipalAnonymous();
+  }
+
+  public String getPrincipalIdAnyone() {
+    return this.riData.getPrincipalAnyone();
+  }
+
+  public String getProductName() {
+    return this.riData.getProductName();
+  }
+
+  public String getProductVersion() {
+    return this.riData.getProductVersion();
+  }
+
+  public String getRootFolderId() {
+    return this.riData.getRootFolderId();
+  }
+
+  public String getThinClientUri() {
+    return this.riData.getThinClientUri();
+  }
+
+  public String getVendorName() {
+    return this.riData.getVendorName();
+  }
+
+}

Propchange: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/RepositoryInfoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java?rev=921337&r1=921336&r2=921337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/mock/MockSessionFactory.java
Wed Mar 10 13:09:55 2010
@@ -26,6 +26,7 @@ import java.io.ByteArrayInputStream;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.GregorianCalendar;
@@ -54,6 +55,7 @@ import org.apache.opencmis.client.api.ob
 import org.apache.opencmis.client.api.objecttype.PolicyType;
 import org.apache.opencmis.client.api.objecttype.RelationshipType;
 import org.apache.opencmis.client.api.repository.ObjectFactory;
+import org.apache.opencmis.client.api.repository.Repository;
 import org.apache.opencmis.client.api.repository.RepositoryCapabilities;
 import org.apache.opencmis.client.api.repository.RepositoryInfo;
 import org.apache.opencmis.client.api.util.Container;
@@ -737,4 +739,8 @@ public class MockSessionFactory implemen
 	private interface BooleanProperty extends Property<Boolean> {
 	}
 
+  public List<Repository> getRepositories(Map<String, String> parameters) {
+    return null;
+  }
+
 }



Mime
View raw message