You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2010/11/15 13:32:07 UTC

svn commit: r1035246 [1/3] - in /incubator/chemistry/opencmis/branches/client-api-refactoring: chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-client/chemistry-opencmis-...

Author: fmui
Date: Mon Nov 15 12:32:05 2010
New Revision: 1035246

URL: http://svn.apache.org/viewvc?rev=1035246&view=rev
Log:
- more refactoring and code clean up

Modified:
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectFactory.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectId.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/OperationContext.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractFilableCmisObject.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientFileableCmisObject.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ObjectIdImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PolicyImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RelationshipImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientDocumentImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientFolderImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientPolicyImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientRelationshipImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/Cache.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CacheTest.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/CmisObjectMock.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/SessionParameter.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/data/CmisExtensionElement.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/data/ExtensionsData.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractExtensionData.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractPropertyData.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AccessControlEntryImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AccessControlListImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AccessControlPrincipalDataImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AllowableActionsImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ChangeEventInfoDataImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ChoiceImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/CmisExtensionElementImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ContentStreamImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ExtensionDataImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/FailedToDeleteDataImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ObjectDataImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ObjectInFolderContainerImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ObjectInFolderDataImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ObjectInFolderListImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ObjectListImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ObjectParentDataImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/PolicyIdListImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/PropertiesImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/PropertyBooleanImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/PropertyDateTimeImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/PropertyDecimalImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/PropertyHtmlImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/PropertyIdImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/PropertyIntegerImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/PropertyStringImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/PropertyUriImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RenditionDataImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/TypeDefinitionContainerImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/TypeDefinitionListImpl.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java
    incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractServiceFactory.java

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java Mon Nov 15 12:32:05 2010
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.api;
 
+import java.io.Serializable;
 import java.util.GregorianCalendar;
 import java.util.List;
 import java.util.Map;
@@ -35,7 +36,7 @@ import org.apache.chemistry.opencmis.com
  * 
  * See CMIS Domain Model - section 2.1.2.
  */
-public interface CmisObject extends ObjectId {
+public interface CmisObject extends ObjectId, Serializable {
 
     // common properties
 
@@ -165,13 +166,14 @@ public interface CmisObject extends Obje
      * 
      * @param properties
      *            the properties to update
+     * @param refresh
+     *            indicates if the object should be refresh after the update
      * 
      * @return the object id of the updated object (a repository might have
      *         created a new object)
-     *         
+     * 
      */
-    // TODO: change name
-    ObjectId updatePropertiesOnly(Map<String, ?> properties);
+    ObjectId updateProperties(Map<String, ?> properties, boolean refresh);
 
     // renditions
 

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java Mon Nov 15 12:32:05 2010
@@ -64,8 +64,7 @@ public interface Document extends Fileab
     /**
      * Sets a new content stream for the document.
      */
-    // TODO: change name
-    ObjectId setContentStreamOnly(ContentStream contentStream, boolean overwrite);
+    ObjectId setContentStream(ContentStream contentStream, boolean overwrite, boolean refresh);
 
     /**
      * Removes the current content stream from the document.
@@ -75,8 +74,7 @@ public interface Document extends Fileab
     /**
      * Removes the current content stream from the document.
      */
-    // TODO: change name
-    ObjectId deleteContentStreamOnly();
+    ObjectId deleteContentStream(boolean refresh);
 
     // versioning service
 

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectFactory.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectFactory.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectFactory.java Mon Nov 15 12:32:05 2010
@@ -19,6 +19,7 @@
 package org.apache.chemistry.opencmis.client.api;
 
 import java.io.InputStream;
+import java.io.Serializable;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -37,10 +38,12 @@ import org.apache.chemistry.opencmis.com
 
 /**
  * A factory to create CMIS objects.
- *
+ * 
  * @see org.apache.chemistry.opencmis.client.api.Session#getObjectFactory()
  */
-public interface ObjectFactory {
+public interface ObjectFactory extends Serializable {
+
+    void initialize(Session session, Map<String, String> parameters);
 
     // ACL and ACE
 

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectId.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectId.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectId.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectId.java Mon Nov 15 12:32:05 2010
@@ -18,10 +18,12 @@
  */
 package org.apache.chemistry.opencmis.client.api;
 
+import java.io.Serializable;
+
 /**
  * Holds an object id.
  */
-public interface ObjectId {
+public interface ObjectId extends Serializable {
 
     /**
      * Returns the id.

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/OperationContext.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/OperationContext.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/OperationContext.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/OperationContext.java Mon Nov 15 12:32:05 2010
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.api;
 
+import java.io.Serializable;
 import java.util.Set;
 
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
@@ -26,7 +27,7 @@ import org.apache.chemistry.opencmis.com
  * An <code>OperationContext</code> object defines the filtering, paging and
  * caching of an operation.
  */
-public interface OperationContext {
+public interface OperationContext extends Serializable {
 
     /**
      * Returns the current filter.

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java Mon Nov 15 12:32:05 2010
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.api;
 
+import java.io.Serializable;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -57,7 +58,7 @@ import org.apache.chemistry.opencmis.com
  * ids and query names, query language, etc.)
  * </p>
  */
-public interface Session {
+public interface Session extends Serializable {
 
     /**
      * Clears all cached data. This implies that all data will be reloaded from

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java Mon Nov 15 12:32:05 2010
@@ -59,6 +59,8 @@ import org.apache.chemistry.opencmis.com
  */
 public abstract class AbstractCmisObject implements CmisObject {
 
+    private static final long serialVersionUID = 1L;
+
     private SessionImpl session;
     private ObjectType objectType;
     private Map<String, Property<?>> properties;
@@ -262,35 +264,35 @@ public abstract class AbstractCmisObject
     // --- properties ---
 
     public void delete(boolean allVersions) {
-        String objectId = getObjectId();
-        getBinding().getObjectService().deleteObject(getRepositoryId(), objectId, allVersions, null);
-    }
-
-    public CmisObject updateProperties(Map<String, ?> properties) {
         readLock();
         try {
-            ObjectId objectId = updatePropertiesOnly(properties);
-            if (objectId == null) {
-                return null;
-            }
-
-            if (!getObjectId().equals(objectId.getId())) {
-                return getSession().getObject(objectId, getCreationContext());
-            }
+            String objectId = getObjectId();
+            getBinding().getObjectService().deleteObject(getRepositoryId(), objectId, allVersions, null);
         } finally {
             readUnlock();
         }
+    }
 
-        refresh();
+    public CmisObject updateProperties(Map<String, ?> properties) {
+        ObjectId objectId = updateProperties(properties, true);
+        if (objectId == null) {
+            return null;
+        }
+
+        if (!getObjectId().equals(objectId.getId())) {
+            return getSession().getObject(objectId, getCreationContext());
+        }
 
         return this;
     }
 
-    public ObjectId updatePropertiesOnly(Map<String, ?> properties) {
+    public ObjectId updateProperties(Map<String, ?> properties, boolean refresh) {
         if ((properties == null) || (properties.isEmpty())) {
             throw new IllegalArgumentException("Properties must not be empty!");
         }
 
+        String newObjectId = null;
+
         readLock();
         try {
             String objectId = getObjectId();
@@ -312,14 +314,20 @@ public abstract class AbstractCmisObject
             getBinding().getObjectService().updateProperties(getRepositoryId(), objectIdHolder, changeTokenHolder,
                     getObjectFactory().convertProperties(properties, this.objectType, updatebility), null);
 
-            if (objectIdHolder.getValue() == null) {
-                return null;
-            }
-
-            return getSession().createObjectId(objectIdHolder.getValue());
+            newObjectId = objectIdHolder.getValue();
         } finally {
             readUnlock();
         }
+
+        if (refresh) {
+            refresh();
+        }
+
+        if (newObjectId == null) {
+            return null;
+        }
+
+        return getSession().createObjectId(newObjectId);
     }
 
     // --- properties ---

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractFilableCmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractFilableCmisObject.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractFilableCmisObject.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractFilableCmisObject.java Mon Nov 15 12:32:05 2010
@@ -40,6 +40,8 @@ import org.apache.chemistry.opencmis.com
 public abstract class AbstractFilableCmisObject extends AbstractCmisObject implements
         FileableCmisObject {
 
+    private static final long serialVersionUID = 1L;
+
     public List<Folder> getParents() {
         String objectId = getObjectId();
 

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientCmisObject.java Mon Nov 15 12:32:05 2010
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.runtime;
 
+import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
@@ -59,6 +60,8 @@ import org.apache.chemistry.opencmis.com
 
 public abstract class AbstractTransientCmisObject implements TransientCmisObject {
 
+    private static final long serialVersionUID = 1L;
+
     protected Session session;
     protected CmisObject object;
 
@@ -399,16 +402,16 @@ public abstract class AbstractTransientC
     protected String getLatestChangeToken(String objectId) {
         // determine the object id query name
         PropertyDefinition<?> objectIdPropDef = getCmisObject().getType().getPropertyDefinitions()
-        .get(PropertyIds.OBJECT_ID);
-if (objectIdPropDef == null) {
-    return null;
-}
+                .get(PropertyIds.OBJECT_ID);
+        if (objectIdPropDef == null) {
+            return null;
+        }
+
+        String objectIdQueryName = objectIdPropDef.getQueryName();
+        if (objectIdQueryName == null) {
+            return null;
+        }
 
-String objectIdQueryName = objectIdPropDef.getQueryName();
-if (objectIdQueryName == null) {
-    return null;
-}
-        
         // determine the change token query name
         PropertyDefinition<?> changeTokenPropDef = getCmisObject().getType().getPropertyDefinitions()
                 .get(PropertyIds.CHANGE_TOKEN);
@@ -423,7 +426,7 @@ if (objectIdQueryName == null) {
 
         // get the change token property
         Properties properties = getBinding().getObjectService().getProperties(getRepositoryId(), objectId,
-                objectIdQueryName +","+changeTokenQueryName, null);
+                objectIdQueryName + "," + changeTokenQueryName, null);
 
         // if a change token is set, return it
         PropertyData<?> changeToken = properties.getProperties().get(PropertyIds.CHANGE_TOKEN);
@@ -609,7 +612,9 @@ if (objectIdQueryName == null) {
 
     // --- ACE helper class ---
 
-    public class AceChangeHolder {
+    public class AceChangeHolder implements Serializable {
+        private static final long serialVersionUID = 1L;
+
         private String principalId;
         private List<String> permissions;
         private AclPropagation aclPropagation;

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientFileableCmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientFileableCmisObject.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientFileableCmisObject.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractTransientFileableCmisObject.java Mon Nov 15 12:32:05 2010
@@ -28,6 +28,8 @@ import org.apache.chemistry.opencmis.cli
 public abstract class AbstractTransientFileableCmisObject extends AbstractTransientCmisObject implements
         TransientFileableCmisObject {
 
+    private static final long serialVersionUID = 1L;
+
     public FileableCmisObject move(ObjectId sourceFolderId, ObjectId targetFolderId) {
         return ((FileableCmisObject) getCmisObject()).move(sourceFolderId, targetFolderId);
     }

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ChangeEventImpl.java Mon Nov 15 12:32:05 2010
@@ -32,6 +32,8 @@ import org.apache.chemistry.opencmis.com
  */
 public class ChangeEventImpl extends ChangeEventInfoDataImpl implements ChangeEvent {
 
+    private static final long serialVersionUID = 1L;
+
     private String objectId;
     private Map<String, List<?>> properties;
     private List<String> policyIds;

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java Mon Nov 15 12:32:05 2010
@@ -41,12 +41,13 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.enums.Updatability;
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.spi.Holder;
 
 public class DocumentImpl extends AbstractFilableCmisObject implements Document {
 
+    private static final long serialVersionUID = 1L;
+
     /**
      * Constructor.
      */
@@ -128,29 +129,21 @@ public class DocumentImpl extends Abstra
     // operations
 
     public Document copy(ObjectId targetFolderId, Map<String, ?> properties, VersioningState versioningState,
-            List<Policy> policies, List<Ace> addACEs, List<Ace> removeACEs, OperationContext context) {
-        if (targetFolderId == null || targetFolderId.getId() == null) {
-            throw new CmisInvalidArgumentException("Target must be set");
-        }
+            List<Policy> policies, List<Ace> addAces, List<Ace> removeAces, OperationContext context) {
 
-        ObjectFactory factory = getObjectFactory();
-        Set<Updatability> updatability = new HashSet<Updatability>();
-        updatability.add(Updatability.READWRITE);
-
-        String newId = getBinding().getObjectService().createDocumentFromSource(getRepositoryId(), getId(),
-                factory.convertProperties(properties, getType(), updatability), targetFolderId.getId(),
-                versioningState, factory.convertPolicies(policies), factory.convertAces(addACEs),
-                factory.convertAces(removeACEs), null);
+        ObjectId newId = getSession().createDocumentFromSource(this, properties, targetFolderId, versioningState,
+                policies, addAces, removeAces);
 
         // if no context is provided the object will not be fetched
         if (context == null || newId == null) {
             return null;
         }
         // get the new object
-        CmisObject object = getSession().getObject(getSession().createObjectId(newId), context);
+        CmisObject object = getSession().getObject(newId, context);
         if (!(object instanceof Document)) {
             throw new CmisRuntimeException("Newly created object is not a document! New id: " + newId);
         }
+
         return (Document) object;
     }
 
@@ -165,16 +158,24 @@ public class DocumentImpl extends Abstra
     // versioning
 
     public ObjectId checkOut() {
-        String objectId = getObjectId();
-        Holder<String> objectIdHolder = new Holder<String>(objectId);
+        String newObjectId = null;
 
-        getBinding().getVersioningService().checkOut(getRepositoryId(), objectIdHolder, null, null);
+        readLock();
+        try {
+            String objectId = getObjectId();
+            Holder<String> objectIdHolder = new Holder<String>(objectId);
 
-        if (objectIdHolder.getValue() == null) {
+            getBinding().getVersioningService().checkOut(getRepositoryId(), objectIdHolder, null, null);
+            newObjectId = objectIdHolder.getValue();
+        } finally {
+            readUnlock();
+        }
+
+        if (newObjectId == null) {
             return null;
         }
 
-        return getSession().createObjectId(objectIdHolder.getValue());
+        return getSession().createObjectId(newObjectId);
     }
 
     public void cancelCheckOut() {
@@ -185,35 +186,33 @@ public class DocumentImpl extends Abstra
 
     public ObjectId checkIn(boolean major, Map<String, ?> properties, ContentStream contentStream,
             String checkinComment, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
-        String objectId;
-        ObjectType type;
+        String newObjectId = null;
+
         readLock();
         try {
-            objectId = getObjectId();
-            type = getType();
-        } finally {
-            readUnlock();
-        }
+            Holder<String> objectIdHolder = new Holder<String>(getObjectId());
 
-        Holder<String> objectIdHolder = new Holder<String>(objectId);
+            ObjectFactory of = getObjectFactory();
 
-        ObjectFactory of = getObjectFactory();
+            Set<Updatability> updatebility = new HashSet<Updatability>();
+            updatebility.add(Updatability.READWRITE);
+            updatebility.add(Updatability.WHENCHECKEDOUT);
 
-        Set<Updatability> updatebility = new HashSet<Updatability>();
-        updatebility.add(Updatability.READWRITE);
-        updatebility.add(Updatability.WHENCHECKEDOUT);
+            getBinding().getVersioningService().checkIn(getRepositoryId(), objectIdHolder, major,
+                    of.convertProperties(properties, getType(), updatebility), of.convertContentStream(contentStream),
+                    checkinComment, of.convertPolicies(policies), of.convertAces(addAces), of.convertAces(removeAces),
+                    null);
 
-        getBinding().getVersioningService()
-                .checkIn(getRepositoryId(), objectIdHolder, major,
-                        of.convertProperties(properties, type, updatebility), of.convertContentStream(contentStream),
-                        checkinComment, of.convertPolicies(policies), of.convertAces(addAces),
-                        of.convertAces(removeAces), null);
+            newObjectId = objectIdHolder.getValue();
+        } finally {
+            readUnlock();
+        }
 
-        if (objectIdHolder.getValue() == null) {
+        if (newObjectId == null) {
             return null;
         }
 
-        return getSession().createObjectId(objectIdHolder.getValue());
+        return getSession().createObjectId(newObjectId);
 
     }
 
@@ -316,7 +315,6 @@ public class DocumentImpl extends Abstra
             filename = getContentStreamFileName();
         }
 
-        // TODO: what should happen if the length is not set?
         long length = (contentStream.getBigLength() == null ? -1 : contentStream.getBigLength().longValue());
 
         // convert and return stream object
@@ -325,92 +323,83 @@ public class DocumentImpl extends Abstra
     }
 
     public Document setContentStream(ContentStream contentStream, boolean overwrite) {
-        readLock();
-        try {
-            ObjectId objectId = setContentStreamOnly(contentStream, overwrite);
-            if (objectId == null) {
-                return null;
-            }
-
-            if (!getObjectId().equals(objectId.getId())) {
-                return (Document) getSession().getObject(objectId, getCreationContext());
-            }
-        } finally {
-            readUnlock();
+        ObjectId objectId = setContentStream(contentStream, overwrite, true);
+        if (objectId == null) {
+            return null;
         }
 
-        refresh();
+        if (!getObjectId().equals(objectId.getId())) {
+            return (Document) getSession().getObject(objectId, getCreationContext());
+        }
 
         return this;
     }
 
-    public ObjectId setContentStreamOnly(ContentStream contentStream, boolean overwrite) {
-        String objectId;
-        String changeToken;
+    public ObjectId setContentStream(ContentStream contentStream, boolean overwrite, boolean refresh) {
+        String newObjectId = null;
 
         readLock();
         try {
-            objectId = getObjectId();
-            changeToken = getPropertyValue(PropertyIds.CHANGE_TOKEN);
+            Holder<String> objectIdHolder = new Holder<String>(getObjectId());
+            Holder<String> changeTokenHolder = new Holder<String>((String) getPropertyValue(PropertyIds.CHANGE_TOKEN));
+
+            getBinding().getObjectService().setContentStream(getRepositoryId(), objectIdHolder, overwrite,
+                    changeTokenHolder, getObjectFactory().convertContentStream(contentStream), null);
+
+            newObjectId = objectIdHolder.getValue();
         } finally {
             readUnlock();
         }
 
-        Holder<String> objectIdHolder = new Holder<String>(objectId);
-        Holder<String> changeTokenHolder = new Holder<String>(changeToken);
-
-        getBinding().getObjectService().setContentStream(getRepositoryId(), objectIdHolder, overwrite,
-                changeTokenHolder, getObjectFactory().convertContentStream(contentStream), null);
+        if (refresh) {
+            refresh();
+        }
 
-        if (objectIdHolder.getValue() == null) {
+        if (newObjectId == null) {
             return null;
         }
 
-        return getSession().createObjectId(objectIdHolder.getValue());
+        return getSession().createObjectId(newObjectId);
     }
 
     public Document deleteContentStream() {
-        readLock();
-        try {
-            ObjectId objectId = deleteContentStreamOnly();
-            if (objectId == null) {
-                return null;
-            }
-
-            if (!getObjectId().equals(objectId.getId())) {
-                return (Document) getSession().getObject(objectId, getCreationContext());
-            }
-        } finally {
-            readUnlock();
+        ObjectId objectId = deleteContentStream(true);
+        if (objectId == null) {
+            return null;
         }
 
-        refresh();
+        if (!getObjectId().equals(objectId.getId())) {
+            return (Document) getSession().getObject(objectId, getCreationContext());
+        }
 
         return this;
     }
 
-    public ObjectId deleteContentStreamOnly() {
-        String objectId;
-        String changeToken;
+    public ObjectId deleteContentStream(boolean refresh) {
+        String newObjectId = null;
 
         readLock();
         try {
-            objectId = getObjectId();
-            changeToken = getPropertyValue(PropertyIds.CHANGE_TOKEN);
+            Holder<String> objectIdHolder = new Holder<String>(getObjectId());
+            Holder<String> changeTokenHolder = new Holder<String>((String) getPropertyValue(PropertyIds.CHANGE_TOKEN));
+
+            getBinding().getObjectService().deleteContentStream(getRepositoryId(), objectIdHolder, changeTokenHolder,
+                    null);
+
+            newObjectId = objectIdHolder.getValue();
         } finally {
             readUnlock();
         }
 
-        Holder<String> objectIdHolder = new Holder<String>(objectId);
-        Holder<String> changeTokenHolder = new Holder<String>(changeToken);
-
-        getBinding().getObjectService().deleteContentStream(getRepositoryId(), objectIdHolder, changeTokenHolder, null);
+        if (refresh) {
+            refresh();
+        }
 
-        if (objectIdHolder.getValue() == null) {
+        if (newObjectId == null) {
             return null;
         }
 
-        return getSession().createObjectId(objectIdHolder.getValue());
+        return getSession().createObjectId(newObjectId);
     }
 
     public ObjectId checkIn(boolean major, Map<String, ?> properties, ContentStream contentStream, String checkinComment) {

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java Mon Nov 15 12:32:05 2010
@@ -53,7 +53,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.ObjectList;
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
 import org.apache.chemistry.opencmis.commons.data.PropertyString;
-import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
 import org.apache.chemistry.opencmis.commons.enums.Updatability;
@@ -63,6 +62,8 @@ import org.apache.chemistry.opencmis.com
 
 public class FolderImpl extends AbstractFilableCmisObject implements Folder {
 
+    private static final long serialVersionUID = 1L;
+
     private static final Set<Updatability> CREATE_UPDATABILITY = new HashSet<Updatability>();
     static {
         CREATE_UPDATABILITY.add(Updatability.ONCREATE);
@@ -91,18 +92,9 @@ public class FolderImpl extends Abstract
     public Document createDocument(Map<String, ?> properties, ContentStream contentStream,
             VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
             OperationContext context) {
-        if ((properties == null) || (properties.isEmpty())) {
-            throw new IllegalArgumentException("Properties must not be empty!");
-        }
-
-        String objectId = getObjectId();
-
-        ObjectFactory of = getObjectFactory();
 
-        String newId = getBinding().getObjectService().createDocument(getRepositoryId(),
-                of.convertProperties(properties, null, CREATE_UPDATABILITY), objectId,
-                of.convertContentStream(contentStream), versioningState, of.convertPolicies(policies),
-                of.convertAces(addAces), of.convertAces(removeAces), null);
+        ObjectId newId = getSession().createDocument(properties, this, contentStream, versioningState, policies,
+                addAces, removeAces);
 
         // if no context is provided the object will not be fetched
         if ((context == null) || (newId == null)) {
@@ -110,7 +102,7 @@ public class FolderImpl extends Abstract
         }
 
         // get the new object
-        CmisObject object = getSession().getObject(getSession().createObjectId(newId), context);
+        CmisObject object = getSession().getObject(newId, context);
         if (!(object instanceof Document)) {
             throw new CmisRuntimeException("Newly created object is not a document! New id: " + newId);
         }
@@ -121,33 +113,9 @@ public class FolderImpl extends Abstract
     public Document createDocumentFromSource(ObjectId source, Map<String, ?> properties,
             VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
             OperationContext context) {
-        if ((source == null) || (source.getId() == null)) {
-            throw new IllegalArgumentException("Source must be set!");
-        }
-
-        String objectId = getObjectId();
-
-        // get the type of the source document
-        ObjectType type = null;
-        if (source instanceof CmisObject) {
-            type = ((CmisObject) source).getType();
-        } else {
-            CmisObject sourceObj = getSession().getObject(source);
-            type = sourceObj.getType();
-        }
-
-        if (type.getBaseTypeId() != BaseTypeId.CMIS_DOCUMENT) {
-            throw new IllegalArgumentException("Source object must be a document!");
-        }
-
-        ObjectFactory of = getObjectFactory();
-
-        Set<Updatability> updatebility = new HashSet<Updatability>();
-        updatebility.add(Updatability.READWRITE);
 
-        String newId = getBinding().getObjectService().createDocumentFromSource(getRepositoryId(), source.getId(),
-                of.convertProperties(properties, type, updatebility), objectId, versioningState,
-                of.convertPolicies(policies), of.convertAces(addAces), of.convertAces(removeAces), null);
+        ObjectId newId = getSession().createDocumentFromSource(source, properties, this, versioningState, policies,
+                addAces, removeAces);
 
         // if no context is provided the object will not be fetched
         if ((context == null) || (newId == null)) {
@@ -155,7 +123,7 @@ public class FolderImpl extends Abstract
         }
 
         // get the new object
-        CmisObject object = getSession().getObject(getSession().createObjectId(newId), context);
+        CmisObject object = getSession().getObject(newId, context);
         if (!(object instanceof Document)) {
             throw new CmisRuntimeException("Newly created object is not a document! New id: " + newId);
         }
@@ -165,17 +133,8 @@ public class FolderImpl extends Abstract
 
     public Folder createFolder(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
             List<Ace> removeAces, OperationContext context) {
-        if ((properties == null) || (properties.isEmpty())) {
-            throw new IllegalArgumentException("Properties must not be empty!");
-        }
-
-        String objectId = getObjectId();
 
-        ObjectFactory of = getObjectFactory();
-
-        String newId = getBinding().getObjectService().createFolder(getRepositoryId(),
-                of.convertProperties(properties, null, CREATE_UPDATABILITY), objectId, of.convertPolicies(policies),
-                of.convertAces(addAces), of.convertAces(removeAces), null);
+        ObjectId newId = getSession().createFolder(properties, this, policies, addAces, removeAces);
 
         // if no context is provided the object will not be fetched
         if ((context == null) || (newId == null)) {
@@ -183,7 +142,7 @@ public class FolderImpl extends Abstract
         }
 
         // get the new object
-        CmisObject object = getSession().getObject(getSession().createObjectId(newId), context);
+        CmisObject object = getSession().getObject(newId, context);
         if (!(object instanceof Folder)) {
             throw new CmisRuntimeException("Newly created object is not a folder! New id: " + newId);
         }
@@ -193,17 +152,8 @@ public class FolderImpl extends Abstract
 
     public Policy createPolicy(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
             List<Ace> removeAces, OperationContext context) {
-        if ((properties == null) || (properties.isEmpty())) {
-            throw new IllegalArgumentException("Properties must not be empty!");
-        }
-
-        String objectId = getObjectId();
-
-        ObjectFactory of = getObjectFactory();
 
-        String newId = getBinding().getObjectService().createPolicy(getRepositoryId(),
-                of.convertProperties(properties, null, CREATE_UPDATABILITY), objectId, of.convertPolicies(policies),
-                of.convertAces(addAces), of.convertAces(removeAces), null);
+        ObjectId newId = getSession().createPolicy(properties, this, policies, addAces, removeAces);
 
         // if no context is provided the object will not be fetched
         if ((context == null) || (newId == null)) {
@@ -211,7 +161,7 @@ public class FolderImpl extends Abstract
         }
 
         // get the new object
-        CmisObject object = getSession().getObject(getSession().createObjectId(newId), context);
+        CmisObject object = getSession().getObject(newId, context);
         if (!(object instanceof Policy)) {
             throw new CmisRuntimeException("Newly created object is not a policy! New id: " + newId);
         }

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ObjectIdImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ObjectIdImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ObjectIdImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ObjectIdImpl.java Mon Nov 15 12:32:05 2010
@@ -25,6 +25,8 @@ import org.apache.chemistry.opencmis.cli
  */
 public class ObjectIdImpl implements ObjectId {
 
+    private static final long serialVersionUID = 1L;
+
     private String id;
 
     /**
@@ -34,11 +36,6 @@ public class ObjectIdImpl implements Obj
         setId(id);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.opencmis.client.api.ObjectId#getId()
-     */
     public String getId() {
         return id;
     }

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PolicyImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PolicyImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PolicyImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PolicyImpl.java Mon Nov 15 12:32:05 2010
@@ -28,6 +28,8 @@ import org.apache.chemistry.opencmis.com
 
 public class PolicyImpl extends AbstractFilableCmisObject implements Policy {
 
+    private static final long serialVersionUID = 1L;
+
     /**
      * Constructor.
      */

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RelationshipImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RelationshipImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RelationshipImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RelationshipImpl.java Mon Nov 15 12:32:05 2010
@@ -30,6 +30,8 @@ import org.apache.chemistry.opencmis.com
 
 public class RelationshipImpl extends AbstractCmisObject implements Relationship {
 
+    private static final long serialVersionUID = 1L;
+
     /**
      * Constructor.
      */

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java Mon Nov 15 12:32:05 2010
@@ -33,6 +33,8 @@ import org.apache.chemistry.opencmis.com
  */
 public class RenditionImpl extends RenditionDataImpl implements Rendition {
 
+    private static final long serialVersionUID = 1L;
+
     private Session session;
     private String objectId;
 
@@ -48,15 +50,15 @@ public class RenditionImpl extends Rendi
     }
 
     public long getLength() {
-        return fLength == null ? -1 : fLength.longValue();
+        return length == null ? -1 : length.longValue();
     }
 
     public long getHeight() {
-        return fHeight == null ? -1 : fHeight.longValue();
+        return height == null ? -1 : height.longValue();
     }
 
     public long getWidth() {
-        return fWidth == null ? -1 : fWidth.longValue();
+        return width == null ? -1 : width.longValue();
     }
 
     public Document getRenditionDocument() {
@@ -64,10 +66,10 @@ public class RenditionImpl extends Rendi
     }
 
     public Document getRenditionDocument(OperationContext context) {
-        if (fRenditionDocumentId == null) {
+        if (renditionDocumentId == null) {
             return null;
         }
-        CmisObject rendDoc = session.getObject(session.createObjectId(fRenditionDocumentId), context);
+        CmisObject rendDoc = session.getObject(session.createObjectId(renditionDocumentId), context);
         if (!(rendDoc instanceof Document)) {
             return null;
         }
@@ -76,12 +78,12 @@ public class RenditionImpl extends Rendi
     }
 
     public ContentStream getContentStream() {
-        if ((objectId == null) || (fStreamId == null)) {
+        if ((objectId == null) || (streamId == null)) {
             return null;
         }
 
-        ContentStream contentStream = session.getBinding().getObjectService().getContentStream(
-                session.getRepositoryInfo().getId(), objectId, fStreamId, null, null, null);
+        ContentStream contentStream = session.getBinding().getObjectService()
+                .getContentStream(session.getRepositoryInfo().getId(), objectId, streamId, null, null, null);
         if (contentStream == null) {
             return null;
         }

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java Mon Nov 15 12:32:05 2010
@@ -18,7 +18,6 @@
  */
 package org.apache.chemistry.opencmis.client.runtime;
 
-import java.io.Serializable;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -72,13 +71,11 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.spi.NavigationService;
 import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
 import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * Persistent model session.
  */
-public class SessionImpl implements Session, Serializable {
+public class SessionImpl implements Session {
 
     private static final OperationContext DEFAULT_CONTEXT = new OperationContextImpl(null, false, true, false,
             IncludeRelationships.NONE, null, true, null, true, 100);
@@ -89,7 +86,7 @@ public class SessionImpl implements Sess
         CREATE_UPDATABILITY.add(Updatability.READWRITE);
     }
 
-    private static Log log = LogFactory.getLog(SessionImpl.class);
+    // private static Log log = LogFactory.getLog(SessionImpl.class);
 
     private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
 
@@ -114,20 +111,19 @@ public class SessionImpl implements Sess
     private Locale locale = null;
 
     /*
-     * Object cache (serializable)
+     * helper factory (serializable)
      */
-    private Cache cache = null;
+    private ObjectFactory objectFactory;
 
     /*
-     * Lazy loaded repository info. Will be invalid after clear(). Access by
-     * getter always. (serializable)
+     * Object cache (serializable)
      */
-    private RepositoryInfo repositoryInfo;
+    private Cache cache;
 
     /*
-     * helper factory (non serializable)
+     * Repository info (serializable)
      */
-    private final ObjectFactory objectFactory = ObjectFactoryImpl.newInstance(this);
+    private RepositoryInfo repositoryInfo;
 
     /**
      * required for serialization
@@ -138,28 +134,15 @@ public class SessionImpl implements Sess
      * Constructor.
      */
     public SessionImpl(Map<String, String> parameters) {
-        this.parameters = parameters;
-        SessionImpl.log.info("Session Parameters: " + parameters);
+        if (parameters == null) {
+            throw new IllegalArgumentException("No parameters provided!");
+        }
 
+        this.parameters = parameters;
         this.locale = this.determineLocale(parameters);
-        SessionImpl.log.info("Session Locale: " + this.locale.toString());
-
-        int cacheSize = this.determineCacheSize(parameters);
-
-        if (cacheSize == -1) {
-            this.cache = CacheImpl.newInstance();
-        } else {
-            this.cache = CacheImpl.newInstance(cacheSize);
-        }
-        SessionImpl.log.info("Session Cache Size: " + this.cache.getCacheSize());
-    }
 
-    private int determineCacheSize(Map<String, String> parameters) {
-        try {
-            return Integer.valueOf(parameters.get(SessionParameter.CACHE_SIZE_OBJECTS));
-        } catch (NumberFormatException e) {
-            return -1;
-        }
+        this.objectFactory = createObjectFactory();
+        this.cache = createCache();
     }
 
     private String determineRepositoryId(Map<String, String> parameters) {
@@ -195,20 +178,61 @@ public class SessionImpl implements Sess
         return locale;
     }
 
-    public void clear() {
-        lock.writeLock().lock();
+    private ObjectFactory createObjectFactory() {
+        try {
+            String classname = parameters.get(SessionParameter.OBJECT_FACTORY_CLASS);
+
+            Class<?> objectFactoryClass;
+            if (classname == null) {
+                objectFactoryClass = ObjectFactoryImpl.class;
+            } else {
+                objectFactoryClass = Class.forName(classname);
+            }
+
+            Object of = objectFactoryClass.newInstance();
+            if (!(of instanceof ObjectFactory)) {
+                throw new Exception("Class does not implement ObjectFactory!");
+            }
+
+            ((ObjectFactory) of).initialize(this, parameters);
+
+            return (ObjectFactory) of;
+        } catch (Exception e) {
+            throw new IllegalArgumentException("Unable to create object factory: " + e, e);
+        }
+    }
+
+    private Cache createCache() {
         try {
-            int cacheSize = this.determineCacheSize(this.parameters);
-            if (cacheSize == -1) {
-                this.cache = CacheImpl.newInstance();
+            String classname = parameters.get(SessionParameter.CACHE_CLASS);
+
+            Class<?> cacheClass;
+            if (classname == null) {
+                cacheClass = CacheImpl.class;
             } else {
-                this.cache = CacheImpl.newInstance(cacheSize);
+                cacheClass = Class.forName(classname);
+            }
+
+            Object of = cacheClass.newInstance();
+            if (!(of instanceof Cache)) {
+                throw new Exception("Class does not implement Cache!");
             }
-            SessionImpl.log.info("Session Cache Size: " + this.cache.getCacheSize());
 
-            /*
-             * clear provider cache
-             */
+            ((Cache) of).initialize(this, parameters);
+
+            return (Cache) of;
+        } catch (Exception e) {
+            throw new IllegalArgumentException("Unable to create cache: " + e, e);
+        }
+    }
+
+    public void clear() {
+        lock.writeLock().lock();
+        try {
+            // create new object cache
+            this.cache = createCache();
+
+            // clear provider cache
             getBinding().clearAllCaches();
         } finally {
             lock.writeLock().unlock();
@@ -596,10 +620,14 @@ public class SessionImpl implements Sess
 
     public ObjectId createDocumentFromSource(ObjectId source, Map<String, ?> properties, ObjectId folderId,
             VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
+        if ((source == null) || (source.getId() == null)) {
+            throw new IllegalArgumentException("Source must be set!");
+        }
+
         // get the type of the source document
         ObjectType type = null;
         if (source instanceof CmisObject) {
-            type = ((CmisObject) source).getBaseType();
+            type = ((CmisObject) source).getType();
         } else {
             CmisObject sourceObj = getObject(source);
             type = sourceObj.getType();

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientDocumentImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientDocumentImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientDocumentImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientDocumentImpl.java Mon Nov 15 12:32:05 2010
@@ -40,6 +40,8 @@ import org.apache.chemistry.opencmis.com
 
 public class TransientDocumentImpl extends AbstractTransientFileableCmisObject implements TransientDocument {
 
+    private static final long serialVersionUID = 1L;
+
     private ContentStream contentStream;
     private boolean contentOverwrite;
     private boolean deleteContent;

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientFolderImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientFolderImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientFolderImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientFolderImpl.java Mon Nov 15 12:32:05 2010
@@ -44,6 +44,8 @@ import org.apache.chemistry.opencmis.com
 
 public class TransientFolderImpl extends AbstractTransientFileableCmisObject implements TransientFolder {
 
+    private static final long serialVersionUID = 1L;
+
     private boolean isMarkedForDeleteTree;
     private boolean deleteTreeAllVersions;
     private UnfileObject deleteTreeUnfile;

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientPolicyImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientPolicyImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientPolicyImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientPolicyImpl.java Mon Nov 15 12:32:05 2010
@@ -23,6 +23,8 @@ import org.apache.chemistry.opencmis.com
 
 public class TransientPolicyImpl extends AbstractTransientFileableCmisObject implements TransientPolicy {
 
+    private static final long serialVersionUID = 1L;
+
     public String getPolicyText() {
         return getPropertyValue(PropertyIds.POLICY_TEXT);
     }

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientRelationshipImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientRelationshipImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientRelationshipImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/TransientRelationshipImpl.java Mon Nov 15 12:32:05 2010
@@ -26,6 +26,8 @@ import org.apache.chemistry.opencmis.com
 
 public class TransientRelationshipImpl extends AbstractTransientCmisObject implements TransientRelationship {
 
+    private static final long serialVersionUID = 1L;
+
     public CmisObject getSource() {
         return getSource(getSession().getDefaultContext());
     }

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/Cache.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/Cache.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/Cache.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/Cache.java Mon Nov 15 12:32:05 2010
@@ -18,7 +18,11 @@
  */
 package org.apache.chemistry.opencmis.client.runtime.cache;
 
+import java.io.Serializable;
+import java.util.Map;
+
 import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.client.api.Session;
 
 /**
  * Implements a session cache providing following capabilities:
@@ -28,7 +32,9 @@ import org.apache.chemistry.opencmis.cli
  * <li>access CmisObject by object path</li>
  * </ul>
  */
-public interface Cache {
+public interface Cache extends Serializable {
+
+    void initialize(Session session, Map<String, String> parameters);
 
     boolean containsId(String objectId, String cacheKey);
 

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java Mon Nov 15 12:32:05 2010
@@ -18,20 +18,21 @@
  */
 package org.apache.chemistry.opencmis.client.runtime.cache;
 
-import java.io.Serializable;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.client.api.Session;
 import org.apache.chemistry.opencmis.commons.PropertyIds;
+import org.apache.chemistry.opencmis.commons.SessionParameter;
 
 /**
  * Non synchronized cache implementation. The cache is limited to a specific
  * size of entries and works in a LRU mode.
  */
-public class CacheImpl implements Cache, Serializable {
+public class CacheImpl implements Cache {
 
     private static final long serialVersionUID = 1L;
 
@@ -45,38 +46,30 @@ public class CacheImpl implements Cache,
     private final ReentrantReadWriteLock fLock = new ReentrantReadWriteLock();
 
     /**
-     * Creates a new cache instance with a default size.
-     */
-    public static Cache newInstance() {
-        return new CacheImpl();
-    }
-
-    /**
-     * Creates a new cache instance with the given size.
-     */
-    public static Cache newInstance(int cacheSize) {
-        return new CacheImpl(cacheSize);
-    }
-
-    /**
      * Default constructor.
      */
-    protected CacheImpl() {
-        this(1000); // default cache size
+    public CacheImpl() {
     }
 
-    /**
-     * Constructor taking a cache size.
-     */
-    protected CacheImpl(int cacheSize) {
-        this.cacheSize = cacheSize;
-        initialize();
+    public void initialize(Session session, Map<String, String> parameters) {
+        fLock.writeLock().lock();
+        try {
+            try {
+                cacheSize = Integer.valueOf(parameters.get(SessionParameter.CACHE_SIZE_OBJECTS));
+            } catch (Exception e) {
+                cacheSize = 1000;
+            }
+
+            initializeInternals();
+        } finally {
+            fLock.writeLock().unlock();
+        }
     }
 
     /**
      * Sets up the internal objects.
      */
-    protected void initialize() {
+    private void initializeInternals() {
         fLock.writeLock().lock();
         try {
             int hashTableCapacity = (int) Math.ceil(cacheSize / HASHTABLE_LOAD_FACTOR) + 1;
@@ -99,20 +92,10 @@ public class CacheImpl implements Cache,
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.opencmis.client.runtime.cache.Cache#clear()
-     */
     public void clear() {
-        initialize();
+        initializeInternals();
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.opencmis.client.runtime.cache.Cache#resetPathCache()
-     */
     public void resetPathCache() {
         fLock.writeLock().lock();
         try {
@@ -122,13 +105,6 @@ public class CacheImpl implements Cache,
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.runtime.cache.Cache#containsId(java.lang.String
-     * , java.lang.String)
-     */
     public boolean containsId(String objectId, String cacheKey) {
         fLock.readLock().lock();
         try {
@@ -142,13 +118,6 @@ public class CacheImpl implements Cache,
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.runtime.cache.Cache#containsPath(java.lang
-     * .String, java.lang.String)
-     */
     public boolean containsPath(String path, String cacheKey) {
         fLock.readLock().lock();
         try {
@@ -162,13 +131,6 @@ public class CacheImpl implements Cache,
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.runtime.cache.Cache#getById(java.lang.String,
-     * java.lang.String)
-     */
     public CmisObject getById(String objectId, String cacheKey) {
         fLock.readLock().lock();
         try {
@@ -183,13 +145,6 @@ public class CacheImpl implements Cache,
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.runtime.cache.Cache#getByPath(java.lang.String
-     * , java.lang.String)
-     */
     public CmisObject getByPath(String path, String cacheKey) {
         fLock.readLock().lock();
         try {
@@ -217,13 +172,6 @@ public class CacheImpl implements Cache,
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.runtime.cache.Cache#put(org.apache.opencmis
-     * .client.api.CmisObject, java.lang.String)
-     */
     public void put(CmisObject object, String cacheKey) {
         // no object, no cache key - no cache
         if ((object == null) || (cacheKey == null)) {
@@ -257,13 +205,6 @@ public class CacheImpl implements Cache,
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.runtime.cache.Cache#putPath(java.lang.String,
-     * org.apache.opencmis.client.api.CmisObject, java.lang.String)
-     */
     public void putPath(String path, CmisObject object, String cacheKey) {
         fLock.writeLock().lock();
         try {
@@ -277,11 +218,6 @@ public class CacheImpl implements Cache,
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.opencmis.client.runtime.cache.Cache#getCacheSize()
-     */
     public int getCacheSize() {
         return this.cacheSize;
     }

Modified: incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java?rev=1035246&r1=1035245&r2=1035246&view=diff
==============================================================================
--- incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java (original)
+++ incubator/chemistry/opencmis/branches/client-api-refactoring/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java Mon Nov 15 12:32:05 2010
@@ -41,16 +41,17 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.Property;
 import org.apache.chemistry.opencmis.client.api.QueryResult;
 import org.apache.chemistry.opencmis.client.api.Rendition;
+import org.apache.chemistry.opencmis.client.api.Session;
 import org.apache.chemistry.opencmis.client.runtime.ChangeEventImpl;
 import org.apache.chemistry.opencmis.client.runtime.ChangeEventsImpl;
 import org.apache.chemistry.opencmis.client.runtime.DocumentImpl;
 import org.apache.chemistry.opencmis.client.runtime.FolderImpl;
 import org.apache.chemistry.opencmis.client.runtime.PolicyImpl;
 import org.apache.chemistry.opencmis.client.runtime.PropertyImpl;
-import org.apache.chemistry.opencmis.client.runtime.RelationshipImpl;
-import org.apache.chemistry.opencmis.client.runtime.SessionImpl;
 import org.apache.chemistry.opencmis.client.runtime.QueryResultImpl;
+import org.apache.chemistry.opencmis.client.runtime.RelationshipImpl;
 import org.apache.chemistry.opencmis.client.runtime.RenditionImpl;
+import org.apache.chemistry.opencmis.client.runtime.SessionImpl;
 import org.apache.chemistry.opencmis.client.runtime.objecttype.DocumentTypeImpl;
 import org.apache.chemistry.opencmis.client.runtime.objecttype.FolderTypeImpl;
 import org.apache.chemistry.opencmis.client.runtime.objecttype.PolicyTypeImpl;
@@ -93,24 +94,16 @@ public class ObjectFactoryImpl implement
 
     private static final long serialVersionUID = 1L;
 
-    private SessionImpl session = null;
+    private Session session = null;
 
     /**
-     * Constructor.
+     * Default constructor.
      */
-    protected ObjectFactoryImpl(SessionImpl session) {
-        if (session == null) {
-            throw new IllegalArgumentException("Session must be set!");
-        }
-
-        this.session = session;
+    public ObjectFactoryImpl() {
     }
 
-    /**
-     * Creates a new factory instance.
-     */
-    public static ObjectFactory newInstance(SessionImpl session) {
-        return new ObjectFactoryImpl(session);
+    public void initialize(Session session, Map<String, String> parameters) {
+        this.session = session;
     }
 
     /**
@@ -178,7 +171,6 @@ public class ObjectFactoryImpl implement
             throw new IllegalArgumentException("Rendition must be set!");
         }
 
-        // TODO: what should happen if the length is not set?
         long length = (rendition.getBigLength() == null ? -1 : rendition.getBigLength().longValue());
         int height = (rendition.getBigHeight() == null ? -1 : rendition.getBigHeight().intValue());
         int width = (rendition.getBigWidth() == null ? -1 : rendition.getBigWidth().intValue());
@@ -241,14 +233,11 @@ public class ObjectFactoryImpl implement
     }
 
     @SuppressWarnings("unchecked")
-    protected <T> Property<T> convertProperty(ObjectType objectType,
-            PropertyData<T> pd) {
-        PropertyDefinition<T> definition = (PropertyDefinition<T>) objectType.getPropertyDefinitions().get(
-                pd.getId());
+    protected <T> Property<T> convertProperty(ObjectType objectType, PropertyData<T> pd) {
+        PropertyDefinition<T> definition = (PropertyDefinition<T>) objectType.getPropertyDefinitions().get(pd.getId());
         if (definition == null) {
             // property without definition
-            throw new CmisRuntimeException("Property '" + pd.getId()
-                    + "' doesn't exist!");
+            throw new CmisRuntimeException("Property '" + pd.getId() + "' doesn't exist!");
         }
         return createProperty(definition, pd.getValues());
     }
@@ -471,13 +460,13 @@ public class ObjectFactoryImpl implement
         /* determine type */
         switch (objectData.getBaseTypeId()) {
         case CMIS_DOCUMENT:
-            return new DocumentImpl(this.session, type, objectData, context);
+            return new DocumentImpl((SessionImpl) this.session, type, objectData, context);
         case CMIS_FOLDER:
-            return new FolderImpl(this.session, type, objectData, context);
+            return new FolderImpl((SessionImpl) this.session, type, objectData, context);
         case CMIS_POLICY:
-            return new PolicyImpl(this.session, type, objectData, context);
+            return new PolicyImpl((SessionImpl) this.session, type, objectData, context);
         case CMIS_RELATIONSHIP:
-            return new RelationshipImpl(this.session, type, objectData, context);
+            return new RelationshipImpl((SessionImpl) this.session, type, objectData, context);
         default:
             throw new CmisRuntimeException("unsupported type: " + objectData.getBaseTypeId());
         }
@@ -550,5 +539,4 @@ public class ObjectFactoryImpl implement
 
         return new ChangeEventsImpl(changeLogToken, events, hasMoreItems, totalNumItems);
     }
-
 }