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/03/03 14:10:40 UTC

svn commit: r918459 - 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...

Author: fmui
Date: Wed Mar  3 13:10:40 2010
New Revision: 918459

URL: http://svn.apache.org/viewvc?rev=918459&view=rev
Log:
more client API implementation

Added:
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/ContentStreamImpl.java   (with props)
Modified:
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/ContentStream.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.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/repository/PersistentObjectFactoryImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyContentStreamTest.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/ContentStream.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/ContentStream.java?rev=918459&r1=918458&r2=918459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/ContentStream.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/ContentStream.java Wed Mar  3 13:10:40 2010
@@ -27,9 +27,7 @@
  */
 public interface ContentStream {
 
-  String getId();
-
-  int getLength();
+  long getLength();
 
   String getMimeType();
 

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.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/ObjectFactory.java?rev=918459&r1=918458&r2=918459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/repository/ObjectFactory.java Wed Mar  3 13:10:40 2010
@@ -50,7 +50,8 @@
 
   Acl createAcl(List<Ace> aces, Boolean isExact);
 
-  ContentStream createContentStream(int length, String mimetype, String filename, InputStream stream);
+  ContentStream createContentStream(String filename, long length, String mimetype,
+      InputStream stream);
 
   // object service
 

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java?rev=918459&r1=918458&r2=918459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java Wed Mar  3 13:10:40 2010
@@ -43,7 +43,6 @@
 import org.apache.opencmis.commons.enums.BaseObjectTypeIds;
 import org.apache.opencmis.commons.enums.RelationshipDirection;
 import org.apache.opencmis.commons.enums.Updatability;
-import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.opencmis.commons.provider.CmisProvider;
 import org.apache.opencmis.commons.provider.Holder;
 import org.apache.opencmis.commons.provider.ObjectData;
@@ -123,6 +122,8 @@
         }
       }
     }
+
+    isChanged = false;
   }
 
   /**
@@ -648,8 +649,16 @@
    * )
    */
   public void refresh(OperationContext context) {
-    // TODO Auto-generated method stub
-    throw new CmisRuntimeException("not implemented");
+    String objectId = getObjectId();
+
+    // get the latest data from the repository
+    ObjectData objectData = getSession().getProvider().getObjectService().getObject(
+        getRepositoryId(), objectId, context.getFullFilter(), context.getIncludeAllowableActions(),
+        context.getIncludeRelationships(), context.getRenditionFilter(),
+        context.getIncludePolicies(), context.getIncludeAcls(), null);
+
+    // reset this object
+    initialize(getSession(), getObjectType(), objectData);
   }
 
 }

Added: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/ContentStreamImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/ContentStreamImpl.java?rev=918459&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/ContentStreamImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/ContentStreamImpl.java Wed Mar  3 13:10:40 2010
@@ -0,0 +1,58 @@
+/*
+ * 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.io.InputStream;
+
+import org.apache.opencmis.client.api.ContentStream;
+
+/**
+ * Content stream implementation.
+ */
+public class ContentStreamImpl implements ContentStream {
+
+  private String filename;
+  private long length;
+  private String mimetype;
+  private InputStream stream;
+
+  public ContentStreamImpl(String filename, long length, String mimetype, InputStream stream) {
+    this.filename = filename;
+    this.length = length;
+    this.mimetype = mimetype;
+    this.stream = stream;
+  }
+
+  public String getFileName() {
+    return filename;
+  }
+
+  public long getLength() {
+    return length;
+  }
+
+  public String getMimeType() {
+    return mimetype;
+  }
+
+  public InputStream getStream() {
+    return stream;
+  }
+
+}

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

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java?rev=918459&r1=918458&r2=918459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java Wed Mar  3 13:10:40 2010
@@ -18,9 +18,11 @@
  */
 package org.apache.opencmis.client.runtime;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.opencmis.client.api.Ace;
+import org.apache.opencmis.client.api.CmisObject;
 import org.apache.opencmis.client.api.ContentStream;
 import org.apache.opencmis.client.api.Document;
 import org.apache.opencmis.client.api.OperationContext;
@@ -28,9 +30,11 @@
 import org.apache.opencmis.client.api.Property;
 import org.apache.opencmis.client.api.Rendition;
 import org.apache.opencmis.client.api.objecttype.ObjectType;
+import org.apache.opencmis.client.api.repository.ObjectFactory;
 import org.apache.opencmis.commons.PropertyIds;
 import org.apache.opencmis.commons.enums.VersioningState;
 import org.apache.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.opencmis.commons.provider.ContentStreamData;
 import org.apache.opencmis.commons.provider.ObjectData;
 
 public class PersistentDocumentImpl extends AbstractPersistentFilableCmisObject implements Document {
@@ -92,6 +96,11 @@
     throw new CmisRuntimeException("not implemented");
   }
 
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.Document#deleteAllVersions()
+   */
   public void deleteAllVersions() {
     delete(true);
   }
@@ -117,12 +126,38 @@
    * @see org.apache.opencmis.client.api.Document#getAllVersions()
    */
   public List<Document> getAllVersions() {
-    return getAllVersions(null);
+    return getAllVersions(getSession().getDefaultContext());
   }
 
+  /*
+   * (non-Javadoc)
+   * 
+   * @seeorg.apache.opencmis.client.api.Document#getAllVersions(org.apache.opencmis.client.api.
+   * OperationContext)
+   */
   public List<Document> getAllVersions(OperationContext context) {
-    // TODO Auto-generated method stub
-    throw new CmisRuntimeException("not implemented");
+    String objectId = getObjectId();
+
+    List<ObjectData> versions = getProvider().getVersioningService().getAllVersions(
+        getRepositoryId(), objectId, context.getFullFilter(), context.getIncludeAllowableActions(),
+        null);
+
+    ObjectFactory objectFactory = getSession().getObjectFactory();
+
+    List<Document> result = new ArrayList<Document>();
+    if (versions != null) {
+      for (ObjectData objectData : versions) {
+        CmisObject doc = objectFactory.convertObject(objectData);
+        if (!(doc instanceof Document)) {
+          // should not happen...
+          continue;
+        }
+
+        result.add((Document) doc);
+      }
+    }
+
+    return result;
   }
 
   /*
@@ -141,8 +176,24 @@
 
   // content operations
 
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.Document#getContentStream()
+   */
   public ContentStream getContentStream() {
-    throw new CmisRuntimeException("not implemented");
+    String objectId = getObjectId();
+
+    // get the stream
+    ContentStreamData contentStream = getProvider().getObjectService().getContentStream(
+        getRepositoryId(), objectId, null, null, null, null);
+
+    // TODO: what should happen if the length is not set?
+    long length = (contentStream.getLength() == null ? -1 : contentStream.getLength().longValue());
+
+    // convert and return stream object
+    return getSession().getObjectFactory().createContentStream(contentStream.getFilename(), length,
+        contentStream.getMimeType(), contentStream.getStream());
   }
 
   public void setContentStream(boolean overwrite, ContentStream contentStream) {

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java?rev=918459&r1=918458&r2=918459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentFolderImpl.java Wed Mar  3 13:10:40 2010
@@ -38,6 +38,7 @@
 import org.apache.opencmis.client.api.util.Container;
 import org.apache.opencmis.client.api.util.PagingList;
 import org.apache.opencmis.client.runtime.util.AbstractPagingList;
+import org.apache.opencmis.client.runtime.util.ContainerImpl;
 import org.apache.opencmis.commons.PropertyIds;
 import org.apache.opencmis.commons.enums.IncludeRelationships;
 import org.apache.opencmis.commons.enums.UnfileObjects;
@@ -47,8 +48,10 @@
 import org.apache.opencmis.commons.provider.FailedToDeleteData;
 import org.apache.opencmis.commons.provider.NavigationService;
 import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.commons.provider.ObjectInFolderContainer;
 import org.apache.opencmis.commons.provider.ObjectInFolderData;
 import org.apache.opencmis.commons.provider.ObjectInFolderList;
+import org.apache.opencmis.commons.provider.ObjectList;
 import org.apache.opencmis.commons.provider.PropertiesData;
 import org.apache.opencmis.commons.provider.PropertyData;
 import org.apache.opencmis.commons.provider.ProviderObjectFactory;
@@ -142,9 +145,57 @@
     return getCheckedOutDocs(getSession().getDefaultContext(), itemsPerPage);
   }
 
-  public PagingList<Document> getCheckedOutDocs(OperationContext context, int itemsPerPage) {
-    // TODO Auto-generated method stub
-    throw new CmisRuntimeException("not implemented");
+  /*
+   * (non-Javadoc)
+   * 
+   * @seeorg.apache.opencmis.client.api.Folder#getCheckedOutDocs(org.apache.opencmis.client.api.
+   * OperationContext, int)
+   */
+  public PagingList<Document> getCheckedOutDocs(final OperationContext context,
+      final int itemsPerPage) {
+    if (itemsPerPage < 1) {
+      throw new IllegalArgumentException("itemsPerPage must be > 0!");
+    }
+
+    final String objectId = getObjectId();
+    final NavigationService nagivationService = getProvider().getNavigationService();
+    final ObjectFactory objectFactory = getSession().getObjectFactory();
+
+    return new AbstractPagingList<Document>() {
+
+      @Override
+      protected FetchResult fetchPage(int pageNumber) {
+        int skipCount = pageNumber * getMaxItemsPerPage();
+
+        // get checked out documents for this folder
+        ObjectList checkedOutDocs = nagivationService.getCheckedOutDocs(getRepositoryId(),
+            objectId, context.getFullFilter(), context.getOrderBy(), context
+                .getIncludeAllowableActions(), context.getIncludeRelationships(), context
+                .getRenditionFilter(), BigInteger.valueOf(getMaxItemsPerPage()), BigInteger
+                .valueOf(skipCount), null);
+
+        // convert objects
+        List<Document> page = new ArrayList<Document>();
+        if (checkedOutDocs.getObjects() != null) {
+          for (ObjectData objectData : checkedOutDocs.getObjects()) {
+            CmisObject doc = objectFactory.convertObject(objectData);
+            if (!(doc instanceof Document)) {
+              // should not happen...
+              continue;
+            }
+
+            page.add((Document) doc);
+          }
+        }
+
+        return new FetchResult(page, checkedOutDocs.getNumItems(), checkedOutDocs.hasMoreItems());
+      }
+
+      @Override
+      public int getMaxItemsPerPage() {
+        return itemsPerPage;
+      }
+    };
   }
 
   /*
@@ -212,9 +263,23 @@
     return getDescendants(depth, getSession().getDefaultContext());
   }
 
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.Folder#getDescendants(int,
+   * org.apache.opencmis.client.api.OperationContext)
+   */
   public List<Container<FileableCmisObject>> getDescendants(int depth, OperationContext context) {
-    // TODO Auto-generated method stub
-    throw new CmisRuntimeException("not implemented");
+    String objectId = getObjectId();
+
+    // get the descendants
+    List<ObjectInFolderContainer> providerContainerList = getProvider().getNavigationService()
+        .getDescendants(getRepositoryId(), objectId, BigInteger.valueOf(depth),
+            context.getFullFilter(), context.getIncludeAllowableActions(),
+            context.getIncludeRelationships(), context.getRenditionFilter(),
+            context.getIncludePathSegments(), null);
+
+    return convertProviderContainer(providerContainerList);
   }
 
   /*
@@ -227,8 +292,51 @@
   }
 
   public List<Container<FileableCmisObject>> getFolderTree(int depth, OperationContext context) {
-    // TODO Auto-generated method stub
-    throw new CmisRuntimeException("not implemented");
+    String objectId = getObjectId();
+
+    // get the folder tree
+    List<ObjectInFolderContainer> providerContainerList = getProvider().getNavigationService()
+        .getFolderTree(getRepositoryId(), objectId, BigInteger.valueOf(depth),
+            context.getFullFilter(), context.getIncludeAllowableActions(),
+            context.getIncludeRelationships(), context.getRenditionFilter(),
+            context.getIncludePathSegments(), null);
+
+    return convertProviderContainer(providerContainerList);
+  }
+
+  /**
+   * Converts a provider container into an API container.
+   */
+  private List<Container<FileableCmisObject>> convertProviderContainer(
+      List<ObjectInFolderContainer> providerContainerList) {
+    if (providerContainerList == null) {
+      return null;
+    }
+
+    ObjectFactory of = getSession().getObjectFactory();
+
+    List<Container<FileableCmisObject>> result = new ArrayList<Container<FileableCmisObject>>();
+    for (ObjectInFolderContainer oifc : providerContainerList) {
+      if ((oifc.getObject() == null) || (oifc.getObject().getObject() == null)) {
+        // shouldn't happen ...
+        continue;
+      }
+
+      // convert the object
+      CmisObject object = of.convertObject(oifc.getObject().getObject());
+      if (!(object instanceof FileableCmisObject)) {
+        // the repository must not return objects that are not fileable, but you never know...
+        continue;
+      }
+
+      // convert the children
+      List<Container<FileableCmisObject>> children = convertProviderContainer(oifc.getChildren());
+
+      // add both to current container
+      result.add(new ContainerImpl<FileableCmisObject>((FileableCmisObject) object, children));
+    }
+
+    return result;
   }
 
   /*

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=918459&r1=918458&r2=918459&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  3 13:10:40 2010
@@ -63,7 +63,9 @@
 import org.apache.opencmis.commons.impl.dataobjects.PropertyIdDefinitionImpl;
 import org.apache.opencmis.commons.impl.dataobjects.PropertyStringDefinitionImpl;
 import org.apache.opencmis.commons.provider.CmisProvider;
+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.RepositoryService;
 import org.apache.opencmis.util.repository.ObjectGenerator;
 
@@ -227,8 +229,49 @@
    * @seeorg.apache.opencmis.client.api.Session#getCheckedOutDocs(org.apache.opencmis.client.api.
    * OperationContext, int)
    */
-  public PagingList<Document> getCheckedOutDocs(OperationContext context, int itemsPerPage) {
-    throw new CmisRuntimeException("not implemented");
+  public PagingList<Document> getCheckedOutDocs(final OperationContext context,
+      final int itemsPerPage) {
+    if (itemsPerPage < 1) {
+      throw new IllegalArgumentException("itemsPerPage must be > 0!");
+    }
+
+    final NavigationService nagivationService = getProvider().getNavigationService();
+    final ObjectFactory objectFactory = getObjectFactory();
+
+    return new AbstractPagingList<Document>() {
+
+      @Override
+      protected FetchResult fetchPage(int pageNumber) {
+        int skipCount = pageNumber * getMaxItemsPerPage();
+
+        // get all checked out documents
+        ObjectList checkedOutDocs = nagivationService.getCheckedOutDocs(getRepositoryId(), null,
+            context.getFullFilter(), context.getOrderBy(), context.getIncludeAllowableActions(),
+            context.getIncludeRelationships(), context.getRenditionFilter(), BigInteger
+                .valueOf(getMaxItemsPerPage()), BigInteger.valueOf(skipCount), null);
+
+        // convert objects
+        List<Document> page = new ArrayList<Document>();
+        if (checkedOutDocs.getObjects() != null) {
+          for (ObjectData objectData : checkedOutDocs.getObjects()) {
+            CmisObject doc = objectFactory.convertObject(objectData);
+            if (!(doc instanceof Document)) {
+              // should not happen...
+              continue;
+            }
+
+            page.add((Document) doc);
+          }
+        }
+
+        return new FetchResult(page, checkedOutDocs.getNumItems(), checkedOutDocs.hasMoreItems());
+      }
+
+      @Override
+      public int getMaxItemsPerPage() {
+        return itemsPerPage;
+      }
+    };
   }
 
   /*

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.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/PersistentObjectFactoryImpl.java?rev=918459&r1=918458&r2=918459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/repository/PersistentObjectFactoryImpl.java Wed Mar  3 13:10:40 2010
@@ -37,6 +37,7 @@
 import org.apache.opencmis.client.runtime.AceImpl;
 import org.apache.opencmis.client.runtime.AclImpl;
 import org.apache.opencmis.client.runtime.AllowableActionsImpl;
+import org.apache.opencmis.client.runtime.ContentStreamImpl;
 import org.apache.opencmis.client.runtime.PersistentDocumentImpl;
 import org.apache.opencmis.client.runtime.PersistentFolderImpl;
 import org.apache.opencmis.client.runtime.PersistentPolicyImpl;
@@ -72,9 +73,9 @@
     return new AclImpl(aces, isExact);
   }
 
-  public ContentStream createContentStream(int length, String mimetype, String filename,
+  public ContentStream createContentStream(String filename, long length, String mimetype,
       InputStream stream) {
-    throw new CmisRuntimeException("not implemented");
+    return new ContentStreamImpl(filename, length, mimetype, stream);
   }
 
   public Document createDocument(Folder parentfolder, String name) {

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyContentStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyContentStreamTest.java?rev=918459&r1=918458&r2=918459&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyContentStreamTest.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/test/java/org/apache/opencmis/client/runtime/ReadOnlyContentStreamTest.java Wed Mar  3 13:10:40 2010
@@ -38,7 +38,6 @@
 
     ContentStream s = document.getContentStream();
 
-    Assert.assertNotNull(s.getId());
     Assert.assertNotNull(s.getMimeType());
     Assert.assertTrue(s.getLength() > 0);
     Assert.assertNotNull(s.getFileName());

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=918459&r1=918458&r2=918459&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  3 13:10:40 2010
@@ -512,10 +512,9 @@
 		byte[] b = "abc".getBytes();
 		ByteArrayInputStream bais = new ByteArrayInputStream(b);
 
-		expect(cs.getId()).andReturn(UUID.randomUUID().toString()).anyTimes();
 		expect(cs.getFileName()).andReturn("file.txt").anyTimes();
 		expect(cs.getMimeType()).andReturn("text/html").anyTimes();
-		expect(cs.getLength()).andReturn(b.length).anyTimes();
+		expect(cs.getLength()).andReturn((long) b.length).anyTimes();
 		expect(cs.getStream()).andReturn(bais).anyTimes();
 
 		replay(cs);