chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sklev...@apache.org
Subject svn commit: r936836 [1/2] - in /incubator/chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/o...
Date Thu, 22 Apr 2010 13:27:22 GMT
Author: sklevenz
Date: Thu Apr 22 13:27:21 2010
New Revision: 936836

URL: http://svn.apache.org/viewvc?rev=936836&view=rev
Log:
Implementation of PagingIterable Interface
JUnit Test implementations

Removed:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/PagingList.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractPagingList.java
Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Folder.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectType.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentFolderImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentSessionImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/DocumentTypeImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/FolderTypeImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ObjectTypeHelper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/PolicyTypeImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetch.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/DefaultPagingIterator.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/PagingListTest.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyDiscoverIT.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyNavigationIT.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyTypeIT.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/WriteObjectIT.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/sample/AbstractSampleIT.java

Modified: incubator/chemistry/opencmis/trunk/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/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/CmisObject.java Thu Apr 22 13:27:21 2010
@@ -123,7 +123,7 @@ public interface CmisObject extends Obje
 
 	// relationship service
 
-	PagingList<Relationship> getRelationships(boolean includeSubRelationshipTypes,
+	PagingIterable<Relationship> getRelationships(boolean includeSubRelationshipTypes,
 			RelationshipDirection relationshipDirection, ObjectType type, OperationContext context, int itemsPerPage);
 
 	// renditions

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Folder.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Folder.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Folder.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Folder.java Thu Apr 22 13:27:21 2010
@@ -59,9 +59,9 @@ public interface Folder extends Fileable
 
 	List<Tree<FileableCmisObject>> getDescendants(int depth, OperationContext context);
 
-	PagingList<CmisObject> getChildren(int itemsPerPage);
+	PagingIterable<CmisObject> getChildren(int itemsPerPage);
 
-	PagingList<CmisObject> getChildren(OperationContext context, int itemsPerPage);
+	PagingIterable<CmisObject> getChildren(OperationContext context, int itemsPerPage);
 
 	boolean isRootFolder();
 
@@ -72,9 +72,9 @@ public interface Folder extends Fileable
 	/**
 	 * Returns all checked out documents of this folder.
 	 */
-	PagingList<Document> getCheckedOutDocs(int itemsPerPage);
+	PagingIterable<Document> getCheckedOutDocs(int itemsPerPage);
 
-	PagingList<Document> getCheckedOutDocs(OperationContext context, int itemsPerPage);
+	PagingIterable<Document> getCheckedOutDocs(OperationContext context, int itemsPerPage);
 
 	// folder specific properties
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectType.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectType.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectType.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ObjectType.java Thu Apr 22 13:27:21 2010
@@ -72,7 +72,7 @@ public interface ObjectType extends Type
 	 * @return a {@code List} of types which are directly derived from this
 	 *         type. @
 	 */
-	PagingList<ObjectType> getChildren(int itemsPerPage);
+	PagingIterable<ObjectType> getChildren(int itemsPerPage);
 
 	/**
 	 * Get the list of all types somehow derived from this type.

Modified: incubator/chemistry/opencmis/trunk/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/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java Thu Apr 22 13:27:21 2010
@@ -123,7 +123,7 @@ public interface Session {
 	/**
 	 * Returns the type children of the given type id.
 	 */
-	PagingList<ObjectType> getTypeChildren(String typeId, boolean includePropertyDefinitions, int itemsPerPage);
+	PagingIterable<ObjectType> getTypeChildren(String typeId, boolean includePropertyDefinitions, int itemsPerPage);
 
 	/**
 	 * Returns the type descendants of the given type id.
@@ -144,9 +144,9 @@ public interface Session {
 	 * 
 	 * @see Folder#getCheckedOutDocs(int)
 	 */
-	PagingList<Document> getCheckedOutDocs(int itemsPerPage);
+	PagingIterable<Document> getCheckedOutDocs(int itemsPerPage);
 
-	PagingList<Document> getCheckedOutDocs(OperationContext context, int itemsPerPage);
+	PagingIterable<Document> getCheckedOutDocs(OperationContext context, int itemsPerPage);
 
 	/**
 	 * Object service <code>getObject</code>.
@@ -167,15 +167,15 @@ public interface Session {
 	/**
 	 * Discovery service <code>query</code>.
 	 */
-	PagingList<QueryResult> query(String statement, boolean searchAllVersions, int itemsPerPage);
+	PagingIterable<QueryResult> query(String statement, boolean searchAllVersions, int itemsPerPage);
 
-	PagingList<QueryResult> query(String statement, boolean searchAllVersions, OperationContext context,
+	PagingIterable<QueryResult> query(String statement, boolean searchAllVersions, OperationContext context,
 			int itemsPerPage);
 
 	/**
 	 * Discovery service <code>getContentChanges</code>.
 	 */
-	PagingList<ChangeEvent> getContentChanges(String changeLogToken, int itemsPerPage);
+	PagingIterable<ChangeEvent> getContentChanges(String changeLogToken, int itemsPerPage);
 
 	// create
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractPersistentCmisObject.java Thu Apr 22 13:27:21 2010
@@ -34,12 +34,11 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.ObjectId;
 import org.apache.chemistry.opencmis.client.api.ObjectType;
 import org.apache.chemistry.opencmis.client.api.OperationContext;
-import org.apache.chemistry.opencmis.client.api.PagingList;
+import org.apache.chemistry.opencmis.client.api.PagingIterable;
 import org.apache.chemistry.opencmis.client.api.Policy;
 import org.apache.chemistry.opencmis.client.api.Property;
 import org.apache.chemistry.opencmis.client.api.Relationship;
 import org.apache.chemistry.opencmis.client.api.Rendition;
-import org.apache.chemistry.opencmis.client.runtime.util.AbstractPagingList;
 import org.apache.chemistry.opencmis.commons.PropertyIds;
 import org.apache.chemistry.opencmis.commons.api.Ace;
 import org.apache.chemistry.opencmis.commons.api.Acl;
@@ -47,9 +46,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.api.CmisBinding;
 import org.apache.chemistry.opencmis.commons.api.Holder;
 import org.apache.chemistry.opencmis.commons.api.ObjectData;
-import org.apache.chemistry.opencmis.commons.api.ObjectList;
 import org.apache.chemistry.opencmis.commons.api.PropertyDefinition;
-import org.apache.chemistry.opencmis.commons.api.RelationshipService;
 import org.apache.chemistry.opencmis.commons.api.RenditionData;
 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
@@ -725,51 +722,52 @@ public abstract class AbstractPersistent
 	 * org.apache.opencmis.client.api.objecttype.ObjectType,
 	 * org.apache.opencmis.client.api.OperationContext, int)
 	 */
-	public PagingList<Relationship> getRelationships(final boolean includeSubRelationshipTypes,
+	public PagingIterable<Relationship> getRelationships(final boolean includeSubRelationshipTypes,
 			final RelationshipDirection relationshipDirection, ObjectType type, OperationContext context,
 			final int itemsPerPage) {
-		if (itemsPerPage < 1) {
-			throw new IllegalArgumentException("itemsPerPage must be > 0!");
-		}
-
-		final String objectId = getObjectId();
-		final String typeId = (type == null ? null : type.getId());
-		final RelationshipService relationshipService = getBinding().getRelationshipService();
-		final OperationContext ctxt = (context != null ? context : new OperationContextImpl(getSession()
-				.getDefaultContext()));
-
-		return new AbstractPagingList<Relationship>() {
-
-			@Override
-			protected FetchResult fetchPage(int pageNumber) {
-				int skipCount = pageNumber * getMaxItemsPerPage();
-
-				// fetch the relationships
-				ObjectList relList = relationshipService.getObjectRelationships(getRepositoryId(), objectId,
-						includeSubRelationshipTypes, relationshipDirection, typeId, ctxt.getFilterString(), ctxt
-								.isIncludeAllowableActions(), BigInteger.valueOf(getMaxItemsPerPage()), BigInteger
-								.valueOf(skipCount), null);
-
-				// convert relationship objects
-				List<Relationship> page = new ArrayList<Relationship>();
-				if (relList.getObjects() != null) {
-					for (ObjectData rod : relList.getObjects()) {
-						Relationship relationship = new PersistentRelationshipImpl(getSession(), getObjectFactory()
-								.getTypeFromObjectData(rod), rod, ctxt);
-
-						page.add(relationship);
-					}
-				}
-
-				return new FetchResult(page, relList.getNumItems(), relList.hasMoreItems());
-			}
-
-			@Override
-			public int getMaxItemsPerPage() {
-				return itemsPerPage;
-			}
-		};
-	}
+//		if (itemsPerPage < 1) {
+//			throw new IllegalArgumentException("itemsPerPage must be > 0!");
+//		}
+//
+//		final String objectId = getObjectId();
+//		final String typeId = (type == null ? null : type.getId());
+//		final RelationshipService relationshipService = getBinding().getRelationshipService();
+//		final OperationContext ctxt = (context != null ? context : new OperationContextImpl(getSession()
+//				.getDefaultContext()));
+//
+//		return new AbstractPagingList<Relationship>() {
+//
+//			@Override
+//			protected FetchResult fetchPage(int pageNumber) {
+//				int skipCount = pageNumber * getMaxItemsPerPage();
+//
+//				// fetch the relationships
+//				ObjectList relList = relationshipService.getObjectRelationships(getRepositoryId(), objectId,
+//						includeSubRelationshipTypes, relationshipDirection, typeId, ctxt.getFilterString(), ctxt
+//								.isIncludeAllowableActions(), BigInteger.valueOf(getMaxItemsPerPage()), BigInteger
+//								.valueOf(skipCount), null);
+//
+//				// convert relationship objects
+//				List<Relationship> page = new ArrayList<Relationship>();
+//				if (relList.getObjects() != null) {
+//					for (ObjectData rod : relList.getObjects()) {
+//						Relationship relationship = new PersistentRelationshipImpl(getSession(), getObjectFactory()
+//								.getTypeFromObjectData(rod), rod, ctxt);
+//
+//						page.add(relationship);
+//					}
+//				}
+//
+//				return new FetchResult(page, relList.getNumItems(), relList.hasMoreItems());
+//			}
+//
+//			@Override
+//			public int getMaxItemsPerPage() {
+//				return itemsPerPage;
+//			}
+//		};
+			return null;
+}
 
 	// --- other ---
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentFolderImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentFolderImpl.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentFolderImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentFolderImpl.java Thu Apr 22 13:27:21 2010
@@ -34,11 +34,12 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.ObjectId;
 import org.apache.chemistry.opencmis.client.api.ObjectType;
 import org.apache.chemistry.opencmis.client.api.OperationContext;
-import org.apache.chemistry.opencmis.client.api.PagingList;
+import org.apache.chemistry.opencmis.client.api.PagingIterable;
 import org.apache.chemistry.opencmis.client.api.Policy;
 import org.apache.chemistry.opencmis.client.api.Tree;
-import org.apache.chemistry.opencmis.client.runtime.util.AbstractPagingList;
+import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetch;
 import org.apache.chemistry.opencmis.client.runtime.util.ContainerImpl;
+import org.apache.chemistry.opencmis.client.runtime.util.DefaultPagingIterable;
 import org.apache.chemistry.opencmis.commons.PropertyIds;
 import org.apache.chemistry.opencmis.commons.api.Ace;
 import org.apache.chemistry.opencmis.commons.api.ContentStream;
@@ -48,7 +49,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.api.ObjectInFolderContainer;
 import org.apache.chemistry.opencmis.commons.api.ObjectInFolderData;
 import org.apache.chemistry.opencmis.commons.api.ObjectInFolderList;
-import org.apache.chemistry.opencmis.commons.api.ObjectList;
 import org.apache.chemistry.opencmis.commons.api.PropertyData;
 import org.apache.chemistry.opencmis.commons.api.PropertyString;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
@@ -58,7 +58,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 
-public class PersistentFolderImpl extends AbstractPersistentFilableCmisObject implements Folder {
+public class PersistentFolderImpl extends AbstractPersistentFilableCmisObject
+		implements Folder {
 
 	private static final Set<Updatability> CREATE_UPDATABILITY = new HashSet<Updatability>();
 	static {
@@ -69,7 +70,8 @@ public class PersistentFolderImpl extend
 	/**
 	 * Constructor.
 	 */
-	public PersistentFolderImpl(PersistentSessionImpl session, ObjectType objectType, ObjectData objectData,
+	public PersistentFolderImpl(PersistentSessionImpl session,
+			ObjectType objectType, ObjectData objectData,
 			OperationContext context) {
 		initialize(session, objectType, objectData, context);
 	}
@@ -83,16 +85,19 @@ public class PersistentFolderImpl extend
 	 * java.util.List, java.util.List,
 	 * org.apache.opencmis.client.api.OperationContext)
 	 */
-	public Document createDocument(Map<String, ?> properties, ContentStream contentStream,
-			VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
+	public Document createDocument(Map<String, ?> properties,
+			ContentStream contentStream, VersioningState versioningState,
+			List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
 			OperationContext context) {
 		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),
+		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);
 
 		// if no context is provided the object will not be fetched
@@ -101,9 +106,11 @@ public class PersistentFolderImpl extend
 		}
 
 		// get the new object
-		CmisObject object = getSession().getObject(getSession().createObjectId(newId), context);
+		CmisObject object = getSession().getObject(
+				getSession().createObjectId(newId), context);
 		if (!(object instanceof Document)) {
-			throw new CmisRuntimeException("Newly created object is not a document! New id: " + newId);
+			throw new CmisRuntimeException(
+					"Newly created object is not a document! New id: " + newId);
 		}
 
 		return (Document) object;
@@ -119,8 +126,9 @@ public class PersistentFolderImpl extend
 	 * java.util.List, java.util.List,
 	 * org.apache.opencmis.client.api.OperationContext)
 	 */
-	public Document createDocumentFromSource(ObjectId source, Map<String, ?> properties,
-			VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
+	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!");
@@ -138,7 +146,8 @@ public class PersistentFolderImpl extend
 		}
 
 		if (type.getBaseTypeId() != BaseTypeId.CMIS_DOCUMENT) {
-			throw new IllegalArgumentException("Source object must be a document!");
+			throw new IllegalArgumentException(
+					"Source object must be a document!");
 		}
 
 		ObjectFactory of = getObjectFactory();
@@ -146,9 +155,12 @@ public class PersistentFolderImpl extend
 		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);
+		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);
 
 		// if no context is provided the object will not be fetched
 		if ((context == null) || (newId == null)) {
@@ -156,9 +168,11 @@ public class PersistentFolderImpl extend
 		}
 
 		// get the new object
-		CmisObject object = getSession().getObject(getSession().createObjectId(newId), context);
+		CmisObject object = getSession().getObject(
+				getSession().createObjectId(newId), context);
 		if (!(object instanceof Document)) {
-			throw new CmisRuntimeException("Newly created object is not a document! New id: " + newId);
+			throw new CmisRuntimeException(
+					"Newly created object is not a document! New id: " + newId);
 		}
 
 		return (Document) object;
@@ -171,14 +185,17 @@ public class PersistentFolderImpl extend
 	 * java.util.List, java.util.List, java.util.List,
 	 * org.apache.opencmis.client.api.OperationContext)
 	 */
-	public Folder createFolder(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
-			List<Ace> removeAces, OperationContext context) {
+	public Folder createFolder(Map<String, ?> properties,
+			List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
+			OperationContext context) {
 		String objectId = getObjectId();
 
 		ObjectFactory of = getObjectFactory();
 
-		String newId = getBinding().getObjectService().createFolder(getRepositoryId(),
-				of.convertProperties(properties, null, CREATE_UPDATABILITY), objectId, of.convertPolicies(policies),
+		String newId = getBinding().getObjectService().createFolder(
+				getRepositoryId(),
+				of.convertProperties(properties, null, CREATE_UPDATABILITY),
+				objectId, of.convertPolicies(policies),
 				of.convertAces(addAces), of.convertAces(removeAces), null);
 
 		// if no context is provided the object will not be fetched
@@ -187,9 +204,11 @@ public class PersistentFolderImpl extend
 		}
 
 		// get the new object
-		CmisObject object = getSession().getObject(getSession().createObjectId(newId), context);
+		CmisObject object = getSession().getObject(
+				getSession().createObjectId(newId), context);
 		if (!(object instanceof Folder)) {
-			throw new CmisRuntimeException("Newly created object is not a folder! New id: " + newId);
+			throw new CmisRuntimeException(
+					"Newly created object is not a folder! New id: " + newId);
 		}
 
 		return (Folder) object;
@@ -202,14 +221,17 @@ public class PersistentFolderImpl extend
 	 * java.util.List, java.util.List, java.util.List,
 	 * org.apache.opencmis.client.api.OperationContext)
 	 */
-	public Policy createPolicy(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
-			List<Ace> removeAces, OperationContext context) {
+	public Policy createPolicy(Map<String, ?> properties,
+			List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
+			OperationContext context) {
 		String objectId = getObjectId();
 
 		ObjectFactory of = getObjectFactory();
 
-		String newId = getBinding().getObjectService().createPolicy(getRepositoryId(),
-				of.convertProperties(properties, null, CREATE_UPDATABILITY), objectId, of.convertPolicies(policies),
+		String newId = getBinding().getObjectService().createPolicy(
+				getRepositoryId(),
+				of.convertProperties(properties, null, CREATE_UPDATABILITY),
+				objectId, of.convertPolicies(policies),
 				of.convertAces(addAces), of.convertAces(removeAces), null);
 
 		// if no context is provided the object will not be fetched
@@ -218,9 +240,11 @@ public class PersistentFolderImpl extend
 		}
 
 		// get the new object
-		CmisObject object = getSession().getObject(getSession().createObjectId(newId), context);
+		CmisObject object = getSession().getObject(
+				getSession().createObjectId(newId), context);
 		if (!(object instanceof Policy)) {
-			throw new CmisRuntimeException("Newly created object is not a policy! New id: " + newId);
+			throw new CmisRuntimeException(
+					"Newly created object is not a policy! New id: " + newId);
 		}
 
 		return (Policy) object;
@@ -232,12 +256,14 @@ public class PersistentFolderImpl extend
 	 * @see org.apache.opencmis.client.api.Folder#deleteTree(boolean,
 	 * org.apache.opencmis.commons.enums.UnfileObjects, boolean)
 	 */
-	public List<String> deleteTree(boolean allVersions, UnfileObject unfile, boolean continueOnFailure) {
+	public List<String> deleteTree(boolean allVersions, UnfileObject unfile,
+			boolean continueOnFailure) {
 		String repositoryId = getRepositoryId();
 		String objectId = getObjectId();
 
-		FailedToDeleteData failed = getBinding().getObjectService().deleteTree(repositoryId, objectId, allVersions,
-				unfile, continueOnFailure, null);
+		FailedToDeleteData failed = getBinding().getObjectService().deleteTree(
+				repositoryId, objectId, allVersions, unfile, continueOnFailure,
+				null);
 
 		return failed.getIds();
 	}
@@ -272,7 +298,7 @@ public class PersistentFolderImpl extend
 	 * 
 	 * @see org.apache.opencmis.client.api.Folder#getCheckedOutDocs(int)
 	 */
-	public PagingList<Document> getCheckedOutDocs(int itemsPerPage) {
+	public PagingIterable<Document> getCheckedOutDocs(int itemsPerPage) {
 		return getCheckedOutDocs(getSession().getDefaultContext(), itemsPerPage);
 	}
 
@@ -282,50 +308,57 @@ public class PersistentFolderImpl extend
 	 * @seeorg.apache.opencmis.client.api.Folder#getCheckedOutDocs(org.apache.
 	 * opencmis.client.api. OperationContext, int)
 	 */
-	public PagingList<Document> getCheckedOutDocs(OperationContext context, final int itemsPerPage) {
-		if (itemsPerPage < 1) {
-			throw new IllegalArgumentException("itemsPerPage must be > 0!");
-		}
-
-		final String objectId = getObjectId();
-		final NavigationService nagivationService = getBinding().getNavigationService();
-		final ObjectFactory objectFactory = getSession().getObjectFactory();
-		final OperationContext ctxt = new OperationContextImpl(context);
-
-		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, ctxt
-						.getFilterString(), ctxt.getOrderBy(), ctxt.isIncludeAllowableActions(), ctxt
-						.getIncludeRelationships(), ctxt.getRenditionFilterString(), 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, ctxt);
-						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;
-			}
-		};
+	public PagingIterable<Document> getCheckedOutDocs(OperationContext context,
+			final int itemsPerPage) {
+		// if (itemsPerPage < 1) {
+		// throw new IllegalArgumentException("itemsPerPage must be > 0!");
+		// }
+		//
+		// final String objectId = getObjectId();
+		// final NavigationService nagivationService =
+		// getBinding().getNavigationService();
+		// final ObjectFactory objectFactory = getSession().getObjectFactory();
+		// final OperationContext ctxt = new OperationContextImpl(context);
+		//
+		// 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, ctxt
+		// .getFilterString(), ctxt.getOrderBy(),
+		// ctxt.isIncludeAllowableActions(), ctxt
+		// .getIncludeRelationships(), ctxt.getRenditionFilterString(),
+		// 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, ctxt);
+		// 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;
+		// }
+		// };
+		return null;
 	}
 
 	/*
@@ -333,7 +366,7 @@ public class PersistentFolderImpl extend
 	 * 
 	 * @see org.apache.opencmis.client.api.Folder#getChildren(int)
 	 */
-	public PagingList<CmisObject> getChildren(int itemsPerPage) {
+	public PagingIterable<CmisObject> getChildren(int itemsPerPage) {
 		return getChildren(getSession().getDefaultContext(), itemsPerPage);
 	}
 
@@ -344,47 +377,55 @@ public class PersistentFolderImpl extend
 	 * org.apache.opencmis.client.api.Folder#getChildren(org.apache.opencmis
 	 * .client.api.OperationContext , int)
 	 */
-	public PagingList<CmisObject> getChildren(OperationContext context, final int itemsPerPage) {
+	public PagingIterable<CmisObject> getChildren(OperationContext context,
+			final int itemsPerPage) {
+
 		if (itemsPerPage < 1) {
 			throw new IllegalArgumentException("itemsPerPage must be > 0!");
 		}
 
 		final String objectId = getObjectId();
-		final NavigationService navigationService = getBinding().getNavigationService();
+		final NavigationService navigationService = getBinding()
+				.getNavigationService();
 		final ObjectFactory objectFactory = getSession().getObjectFactory();
 		final OperationContext ctxt = new OperationContextImpl(context);
 
-		return new AbstractPagingList<CmisObject>() {
+		return new DefaultPagingIterable<CmisObject>(
+				new AbstractPageFetch<CmisObject>() {
 
-			@Override
-			protected FetchResult fetchPage(int pageNumber) {
-				int skipCount = pageNumber * getMaxItemsPerPage();
-
-				// get the children
-				ObjectInFolderList children = navigationService.getChildren(getRepositoryId(), objectId, ctxt
-						.getFilterString(), ctxt.getOrderBy(), ctxt.isIncludeAllowableActions(), ctxt
-						.getIncludeRelationships(), ctxt.getRenditionFilterString(), ctxt.isIncludePathSegments(),
-						BigInteger.valueOf(getMaxItemsPerPage()), BigInteger.valueOf(skipCount), null);
-
-				// convert objects
-				List<CmisObject> page = new ArrayList<CmisObject>();
-				List<ObjectInFolderData> childObjects = children.getObjects();
-				if (childObjects != null) {
-					for (ObjectInFolderData objectData : childObjects) {
-						if (objectData.getObject() != null) {
-							page.add(objectFactory.convertObject(objectData.getObject(), ctxt));
+					@Override
+					protected AbstractPageFetch.PageFetchResult<CmisObject> fetchPage(
+							long skipCount) {
+
+						// get the children
+						ObjectInFolderList children = navigationService
+								.getChildren(getRepositoryId(), objectId, ctxt
+										.getFilterString(), ctxt.getOrderBy(),
+										ctxt.isIncludeAllowableActions(), ctxt
+												.getIncludeRelationships(),
+										ctxt.getRenditionFilterString(), ctxt
+												.isIncludePathSegments(),
+										BigInteger.valueOf(itemsPerPage),
+										BigInteger.valueOf(skipCount), null);
+
+						// convert objects
+						List<CmisObject> page = new ArrayList<CmisObject>();
+						List<ObjectInFolderData> childObjects = children
+								.getObjects();
+						if (childObjects != null) {
+							for (ObjectInFolderData objectData : childObjects) {
+								if (objectData.getObject() != null) {
+									page.add(objectFactory.convertObject(
+											objectData.getObject(), ctxt));
+								}
+							}
 						}
-					}
-				}
 
-				return new FetchResult(page, children.getNumItems(), children.hasMoreItems());
-			}
-
-			@Override
-			public int getMaxItemsPerPage() {
-				return itemsPerPage;
-			}
-		};
+						return new AbstractPageFetch.PageFetchResult<CmisObject>(
+								page, children.getNumItems(), children.hasMoreItems()) {
+						};
+					}
+				});
 	}
 
 	/*
@@ -402,14 +443,19 @@ public class PersistentFolderImpl extend
 	 * @see org.apache.opencmis.client.api.Folder#getDescendants(int,
 	 * org.apache.opencmis.client.api.OperationContext)
 	 */
-	public List<Tree<FileableCmisObject>> getDescendants(int depth, OperationContext context) {
+	public List<Tree<FileableCmisObject>> getDescendants(int depth,
+			OperationContext context) {
 		String objectId = getObjectId();
 
 		// get the descendants
-		List<ObjectInFolderContainer> providerContainerList = getBinding().getNavigationService().getDescendants(
-				getRepositoryId(), objectId, BigInteger.valueOf(depth), context.getFilterString(),
-				context.isIncludeAllowableActions(), context.getIncludeRelationships(),
-				context.getRenditionFilterString(), context.isIncludePathSegments(), null);
+		List<ObjectInFolderContainer> providerContainerList = getBinding()
+				.getNavigationService().getDescendants(getRepositoryId(),
+						objectId, BigInteger.valueOf(depth),
+						context.getFilterString(),
+						context.isIncludeAllowableActions(),
+						context.getIncludeRelationships(),
+						context.getRenditionFilterString(),
+						context.isIncludePathSegments(), null);
 
 		return convertProviderContainer(providerContainerList, context);
 	}
@@ -429,14 +475,19 @@ public class PersistentFolderImpl extend
 	 * @see org.apache.opencmis.client.api.Folder#getFolderTree(int,
 	 * org.apache.opencmis.client.api.OperationContext)
 	 */
-	public List<Tree<FileableCmisObject>> getFolderTree(int depth, OperationContext context) {
+	public List<Tree<FileableCmisObject>> getFolderTree(int depth,
+			OperationContext context) {
 		String objectId = getObjectId();
 
 		// get the folder tree
-		List<ObjectInFolderContainer> providerContainerList = getBinding().getNavigationService().getFolderTree(
-				getRepositoryId(), objectId, BigInteger.valueOf(depth), context.getFilterString(),
-				context.isIncludeAllowableActions(), context.getIncludeRelationships(),
-				context.getRenditionFilterString(), context.isIncludePathSegments(), null);
+		List<ObjectInFolderContainer> providerContainerList = getBinding()
+				.getNavigationService().getFolderTree(getRepositoryId(),
+						objectId, BigInteger.valueOf(depth),
+						context.getFilterString(),
+						context.isIncludeAllowableActions(),
+						context.getIncludeRelationships(),
+						context.getRenditionFilterString(),
+						context.isIncludePathSegments(), null);
 
 		return convertProviderContainer(providerContainerList, context);
 	}
@@ -445,7 +496,8 @@ public class PersistentFolderImpl extend
 	 * Converts a provider container into an API container.
 	 */
 	private List<Tree<FileableCmisObject>> convertProviderContainer(
-			List<ObjectInFolderContainer> providerContainerList, OperationContext context) {
+			List<ObjectInFolderContainer> providerContainerList,
+			OperationContext context) {
 		if (providerContainerList == null) {
 			return null;
 		}
@@ -454,13 +506,15 @@ public class PersistentFolderImpl extend
 
 		List<Tree<FileableCmisObject>> result = new ArrayList<Tree<FileableCmisObject>>();
 		for (ObjectInFolderContainer oifc : providerContainerList) {
-			if ((oifc.getObject() == null) || (oifc.getObject().getObject() == null)) {
+			if ((oifc.getObject() == null)
+					|| (oifc.getObject().getObject() == null)) {
 				// shouldn't happen ...
 				continue;
 			}
 
 			// convert the object
-			CmisObject object = of.convertObject(oifc.getObject().getObject(), context);
+			CmisObject object = of.convertObject(oifc.getObject().getObject(),
+					context);
 			if (!(object instanceof FileableCmisObject)) {
 				// the repository must not return objects that are not fileable,
 				// but you never know...
@@ -468,10 +522,12 @@ public class PersistentFolderImpl extend
 			}
 
 			// convert the children
-			List<Tree<FileableCmisObject>> children = convertProviderContainer(oifc.getChildren(), context);
+			List<Tree<FileableCmisObject>> children = convertProviderContainer(
+					oifc.getChildren(), context);
 
 			// add both to current container
-			result.add(new ContainerImpl<FileableCmisObject>((FileableCmisObject) object, children));
+			result.add(new ContainerImpl<FileableCmisObject>(
+					(FileableCmisObject) object, children));
 		}
 
 		return result;
@@ -484,7 +540,8 @@ public class PersistentFolderImpl extend
 	 */
 	public boolean isRootFolder() {
 		String objectId = getObjectId();
-		String rootFolderId = getSession().getRepositoryInfo().getRootFolderId();
+		String rootFolderId = getSession().getRepositoryInfo()
+				.getRootFolderId();
 
 		return objectId.equals(rootFolderId);
 	}
@@ -523,11 +580,16 @@ public class PersistentFolderImpl extend
 			// if the path property isn't set, get it
 			if (path == null) {
 				String objectId = getObjectId();
-				ObjectData objectData = getBinding().getObjectService().getObject(getRepositoryId(), objectId,
-						PropertyIds.PATH, false, IncludeRelationships.NONE, "cmis:none", false, false, null);
-
-				if ((objectData.getProperties() != null) && (objectData.getProperties().getProperties() != null)) {
-					PropertyData<?> pathProperty = objectData.getProperties().getProperties().get(PropertyIds.PATH);
+				ObjectData objectData = getBinding().getObjectService()
+						.getObject(getRepositoryId(), objectId,
+								PropertyIds.PATH, false,
+								IncludeRelationships.NONE, "cmis:none", false,
+								false, null);
+
+				if ((objectData.getProperties() != null)
+						&& (objectData.getProperties().getProperties() != null)) {
+					PropertyData<?> pathProperty = objectData.getProperties()
+							.getProperties().get(PropertyIds.PATH);
 
 					if (pathProperty instanceof PropertyString) {
 						path = ((PropertyString) pathProperty).getFirstValue();
@@ -540,7 +602,8 @@ public class PersistentFolderImpl extend
 
 		// we still don't know the path ... it's not a CMIS compliant repository
 		if (path == null) {
-			throw new CmisRuntimeException("Repository didn't return " + PropertyIds.PATH + "!");
+			throw new CmisRuntimeException("Repository didn't return "
+					+ PropertyIds.PATH + "!");
 		}
 
 		return path;

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentSessionImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentSessionImpl.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentSessionImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/PersistentSessionImpl.java Thu Apr 22 13:27:21 2010
@@ -37,7 +37,7 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.ObjectId;
 import org.apache.chemistry.opencmis.client.api.ObjectType;
 import org.apache.chemistry.opencmis.client.api.OperationContext;
-import org.apache.chemistry.opencmis.client.api.PagingList;
+import org.apache.chemistry.opencmis.client.api.PagingIterable;
 import org.apache.chemistry.opencmis.client.api.Policy;
 import org.apache.chemistry.opencmis.client.api.QueryResult;
 import org.apache.chemistry.opencmis.client.api.Session;
@@ -45,8 +45,9 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.runtime.cache.Cache;
 import org.apache.chemistry.opencmis.client.runtime.cache.CacheImpl;
 import org.apache.chemistry.opencmis.client.runtime.repository.PersistentObjectFactoryImpl;
-import org.apache.chemistry.opencmis.client.runtime.util.AbstractPagingList;
+import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetch;
 import org.apache.chemistry.opencmis.client.runtime.util.ContainerImpl;
+import org.apache.chemistry.opencmis.client.runtime.util.DefaultPagingIterable;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
 import org.apache.chemistry.opencmis.commons.api.Ace;
 import org.apache.chemistry.opencmis.commons.api.CmisBinding;
@@ -54,6 +55,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.api.DiscoveryService;
 import org.apache.chemistry.opencmis.commons.api.NavigationService;
 import org.apache.chemistry.opencmis.commons.api.ObjectData;
+import org.apache.chemistry.opencmis.commons.api.ObjectInFolderData;
+import org.apache.chemistry.opencmis.commons.api.ObjectInFolderList;
 import org.apache.chemistry.opencmis.commons.api.ObjectList;
 import org.apache.chemistry.opencmis.commons.api.RepositoryInfo;
 import org.apache.chemistry.opencmis.commons.api.RepositoryService;
@@ -73,8 +76,9 @@ import org.apache.commons.logging.LogFac
  */
 public class PersistentSessionImpl implements Session, Serializable {
 
-	private static final OperationContext DEFAULT_CONTEXT = new OperationContextImpl(null, false, true, false,
-			IncludeRelationships.NONE, null, true, null, true);
+	private static final OperationContext DEFAULT_CONTEXT = new OperationContextImpl(
+			null, false, true, false, IncludeRelationships.NONE, null, true,
+			null, true);
 
 	private static final Set<Updatability> CREATE_UPDATABILITY = new HashSet<Updatability>();
 	static {
@@ -120,7 +124,8 @@ public class PersistentSessionImpl imple
 	/*
 	 * helper factory (non serializable)
 	 */
-	private final ObjectFactory objectFactory = PersistentObjectFactoryImpl.newInstance(this);
+	private final ObjectFactory objectFactory = PersistentObjectFactoryImpl
+			.newInstance(this);
 
 	/**
 	 * required for serialization
@@ -135,7 +140,8 @@ public class PersistentSessionImpl imple
 		PersistentSessionImpl.log.info("Session Parameters: " + parameters);
 
 		this.locale = this.determineLocale(parameters);
-		PersistentSessionImpl.log.info("Session Locale: " + this.locale.toString());
+		PersistentSessionImpl.log.info("Session Locale: "
+				+ this.locale.toString());
 
 		int cacheSize = this.determineCacheSize(parameters);
 
@@ -144,7 +150,8 @@ public class PersistentSessionImpl imple
 		} else {
 			this.cache = CacheImpl.newInstance(cacheSize);
 		}
-		PersistentSessionImpl.log.info("Session Cache Size: " + this.cache.getCacheSize());
+		PersistentSessionImpl.log.info("Session Cache Size: "
+				+ this.cache.getCacheSize());
 	}
 
 	private int determineCacheSize(Map<String, String> parameters) {
@@ -162,8 +169,10 @@ public class PersistentSessionImpl imple
 	private Locale determineLocale(Map<String, String> parameters) {
 		Locale locale = null;
 
-		String language = parameters.get(SessionParameter.LOCALE_ISO639_LANGUAGE);
-		String country = parameters.get(SessionParameter.LOCALE_ISO3166_COUNTRY);
+		String language = parameters
+				.get(SessionParameter.LOCALE_ISO639_LANGUAGE);
+		String country = parameters
+				.get(SessionParameter.LOCALE_ISO3166_COUNTRY);
 		String variant = parameters.get(SessionParameter.LOCALE_VARIANT);
 
 		if (variant != null) {
@@ -200,7 +209,8 @@ public class PersistentSessionImpl imple
 			} else {
 				this.cache = CacheImpl.newInstance(cacheSize);
 			}
-			PersistentSessionImpl.log.info("Session Cache Size: " + this.cache.getCacheSize());
+			PersistentSessionImpl.log.info("Session Cache Size: "
+					+ this.cache.getCacheSize());
 
 			/*
 			 * clear provider cache
@@ -233,7 +243,7 @@ public class PersistentSessionImpl imple
 	 * 
 	 * @see org.apache.opencmis.client.api.Session#getCheckedOutDocs(int)
 	 */
-	public PagingList<Document> getCheckedOutDocs(int itemsPerPage) {
+	public PagingIterable<Document> getCheckedOutDocs(int itemsPerPage) {
 		return getCheckedOutDocs(getDefaultContext(), itemsPerPage);
 	}
 
@@ -243,49 +253,57 @@ public class PersistentSessionImpl imple
 	 * @seeorg.apache.opencmis.client.api.Session#getCheckedOutDocs(org.apache.
 	 * opencmis.client.api. OperationContext, int)
 	 */
-	public PagingList<Document> getCheckedOutDocs(OperationContext context, final int itemsPerPage) {
+	public PagingIterable<Document> getCheckedOutDocs(OperationContext context,
+			final int itemsPerPage) {
 		if (itemsPerPage < 1) {
 			throw new IllegalArgumentException("itemsPerPage must be > 0!");
 		}
 
-		final NavigationService nagivationService = getBinding().getNavigationService();
+		final NavigationService navigationService = getBinding()
+				.getNavigationService();
 		final ObjectFactory objectFactory = getObjectFactory();
 		final OperationContext ctxt = new OperationContextImpl(context);
 
-		return new AbstractPagingList<Document>() {
+		return new DefaultPagingIterable<Document>(
+				new AbstractPageFetch<Document>() {
+
+					@Override
+					protected AbstractPageFetch.PageFetchResult<Document> fetchPage(
+							long skipCount) {
+
+						// get all checked out documents
+						ObjectList checkedOutDocs = navigationService
+								.getCheckedOutDocs(getRepositoryId(), null,
+										ctxt.getFilterString(), ctxt
+												.getOrderBy(), ctxt
+												.isIncludeAllowableActions(),
+										ctxt.getIncludeRelationships(), ctxt
+												.getRenditionFilterString(),
+										BigInteger.valueOf(itemsPerPage),
+										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, ctxt);
+								if (!(doc instanceof Document)) {
+									// should not happen...
+									continue;
+								}
 
-			@Override
-			protected FetchResult fetchPage(int pageNumber) {
-				int skipCount = pageNumber * getMaxItemsPerPage();
-
-				// get all checked out documents
-				ObjectList checkedOutDocs = nagivationService.getCheckedOutDocs(getRepositoryId(), null, ctxt
-						.getFilterString(), ctxt.getOrderBy(), ctxt.isIncludeAllowableActions(), ctxt
-						.getIncludeRelationships(), ctxt.getRenditionFilterString(), 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, ctxt);
-						if (!(doc instanceof Document)) {
-							// should not happen...
-							continue;
+								page.add((Document) doc);
+							}
 						}
 
-						page.add((Document) doc);
+						return new AbstractPageFetch.PageFetchResult<Document>(
+								page, checkedOutDocs.getNumItems(),
+								checkedOutDocs.hasMoreItems()) {
+						};
 					}
-				}
-
-				return new FetchResult(page, checkedOutDocs.getNumItems(), checkedOutDocs.hasMoreItems());
-			}
-
-			@Override
-			public int getMaxItemsPerPage() {
-				return itemsPerPage;
-			}
-		};
+				});
 	}
 
 	/*
@@ -295,7 +313,8 @@ public class PersistentSessionImpl imple
 	 * org.apache.opencmis.client.api.Session#getContentChanges(java.lang.String
 	 * , int)
 	 */
-	public PagingList<ChangeEvent> getContentChanges(String changeLogToken, int itemsPerPage) {
+	public PagingIterable<ChangeEvent> getContentChanges(String changeLogToken,
+			int itemsPerPage) {
 		throw new CmisRuntimeException("not implemented");
 	}
 
@@ -337,11 +356,14 @@ public class PersistentSessionImpl imple
 	 * org.apache.opencmis.commons.enums.IncludeRelationships, java.util.Set,
 	 * boolean, java.lang.String, boolean)
 	 */
-	public OperationContext createOperationContext(Set<String> filter, boolean includeAcls,
-			boolean includeAllowableActions, boolean includePolicies, IncludeRelationships includeRelationships,
-			Set<String> renditionFilter, boolean includePathSegments, String orderBy, boolean cacheEnabled) {
-		return new OperationContextImpl(filter, includeAcls, includeAllowableActions, includePolicies,
-				includeRelationships, renditionFilter, includePathSegments, orderBy, cacheEnabled);
+	public OperationContext createOperationContext(Set<String> filter,
+			boolean includeAcls, boolean includeAllowableActions,
+			boolean includePolicies, IncludeRelationships includeRelationships,
+			Set<String> renditionFilter, boolean includePathSegments,
+			String orderBy, boolean cacheEnabled) {
+		return new OperationContextImpl(filter, includeAcls,
+				includeAllowableActions, includePolicies, includeRelationships,
+				renditionFilter, includePathSegments, orderBy, cacheEnabled);
 	}
 
 	/*
@@ -385,16 +407,20 @@ public class PersistentSessionImpl imple
 
 		// ask the cache first
 		if (context.isCacheEnabled()) {
-			result = this.cache.getById(objectId.getId(), context.getCacheKey());
+			result = this.cache
+					.getById(objectId.getId(), context.getCacheKey());
 			if (result != null) {
 				return result;
 			}
 		}
 
 		// get the object
-		ObjectData objectData = this.binding.getObjectService().getObject(getRepositoryId(), objectId.getId(),
-				context.getFilterString(), context.isIncludeAllowableActions(), context.getIncludeRelationships(),
-				context.getRenditionFilterString(), context.isIncludePolicies(), context.isIncludeAcls(), null);
+		ObjectData objectData = this.binding.getObjectService().getObject(
+				getRepositoryId(), objectId.getId(), context.getFilterString(),
+				context.isIncludeAllowableActions(),
+				context.getIncludeRelationships(),
+				context.getRenditionFilterString(),
+				context.isIncludePolicies(), context.isIncludeAcls(), null);
 
 		result = getObjectFactory().convertObject(objectData, context);
 
@@ -442,9 +468,14 @@ public class PersistentSessionImpl imple
 		}
 
 		// get the object
-		ObjectData objectData = this.binding.getObjectService().getObjectByPath(getRepositoryId(), path,
-				context.getFilterString(), context.isIncludeAllowableActions(), context.getIncludeRelationships(),
-				context.getRenditionFilterString(), context.isIncludePolicies(), context.isIncludeAcls(), null);
+		ObjectData objectData = this.binding.getObjectService()
+				.getObjectByPath(getRepositoryId(), path,
+						context.getFilterString(),
+						context.isIncludeAllowableActions(),
+						context.getIncludeRelationships(),
+						context.getRenditionFilterString(),
+						context.isIncludePolicies(), context.isIncludeAcls(),
+						null);
 
 		result = getObjectFactory().convertObject(objectData, context);
 
@@ -483,6 +514,11 @@ public class PersistentSessionImpl imple
 	 * (non-Javadoc)
 	 * 
 	 * 
+	 * 
+	 * 
+	 * 
+	 * 
+	 * 
 	 * @seeorg.apache.opencmis.client.api.Session#getRootFolder(org.apache.opencmis
 	 * .client.api. OperationContext)
 	 */
@@ -491,7 +527,8 @@ public class PersistentSessionImpl imple
 
 		CmisObject rootFolder = getObject(createObjectId(rootFolderId), context);
 		if (!(rootFolder instanceof Folder)) {
-			throw new CmisRuntimeException("Root folder object is not a folder!");
+			throw new CmisRuntimeException(
+					"Root folder object is not a folder!");
 		}
 
 		return (Folder) rootFolder;
@@ -504,41 +541,45 @@ public class PersistentSessionImpl imple
 	 * org.apache.opencmis.client.api.Session#getTypeChildren(java.lang.String,
 	 * boolean, int)
 	 */
-	public PagingList<ObjectType> getTypeChildren(final String typeId, final boolean includePropertyDefinitions,
-			final int itemsPerPage) {
+	public PagingIterable<ObjectType> getTypeChildren(final String typeId,
+			final boolean includePropertyDefinitions, final int itemsPerPage) {
 		if (itemsPerPage < 1) {
 			throw new IllegalArgumentException("itemsPerPage must be > 0!");
 		}
 
-		final String repositoryId = getRepositoryId();
-		final RepositoryService repositoryService = getBinding().getRepositoryService();
-
-		// set up PagingList object
-		return new AbstractPagingList<ObjectType>() {
+		final RepositoryService repositoryService = getBinding()
+				.getRepositoryService();
+		final ObjectFactory objectFactory = this.getObjectFactory();
+		final OperationContext ctxt = new OperationContextImpl(context);
 
-			@Override
-			protected FetchResult fetchPage(int pageNumber) {
-				int skipCount = pageNumber * getMaxItemsPerPage();
-
-				// fetch the data
-				TypeDefinitionList tdl = repositoryService.getTypeChildren(repositoryId, typeId,
-						includePropertyDefinitions, BigInteger.valueOf(getMaxItemsPerPage()), BigInteger
-								.valueOf(skipCount), null);
-
-				// convert type definitions
-				List<ObjectType> page = new ArrayList<ObjectType>(tdl.getList().size());
-				for (TypeDefinition typeDefinition : tdl.getList()) {
-					page.add(objectFactory.convertTypeDefinition(typeDefinition));
-				}
+		return new DefaultPagingIterable<ObjectType>(
+				new AbstractPageFetch<ObjectType>() {
 
-				return new FetchResult(page, tdl.getNumItems(), tdl.hasMoreItems());
-			}
+					@Override
+					protected AbstractPageFetch.PageFetchResult<ObjectType> fetchPage(
+							long skipCount) {
+
+						// fetch the data
+						TypeDefinitionList tdl = repositoryService
+								.getTypeChildren(PersistentSessionImpl.this
+										.getRepositoryId(), typeId,
+										includePropertyDefinitions, BigInteger
+												.valueOf(itemsPerPage),
+										BigInteger.valueOf(skipCount), null);
+
+						// convert type definitions
+						List<ObjectType> page = new ArrayList<ObjectType>(tdl
+								.getList().size());
+						for (TypeDefinition typeDefinition : tdl.getList()) {
+							page.add(objectFactory
+									.convertTypeDefinition(typeDefinition));
+						}
 
-			@Override
-			public int getMaxItemsPerPage() {
-				return itemsPerPage;
-			}
-		};
+						return new AbstractPageFetch.PageFetchResult<ObjectType>(
+								page, tdl.getNumItems(), tdl.hasMoreItems()) {
+						};
+					}
+				});
 	}
 
 	/*
@@ -549,8 +590,8 @@ public class PersistentSessionImpl imple
 	 * )
 	 */
 	public ObjectType getTypeDefinition(String typeId) {
-		TypeDefinition typeDefinition = getBinding().getRepositoryService().getTypeDefinition(getRepositoryId(),
-				typeId, null);
+		TypeDefinition typeDefinition = getBinding().getRepositoryService()
+				.getTypeDefinition(getRepositoryId(), typeId, null);
 		return objectFactory.convertTypeDefinition(typeDefinition);
 	}
 
@@ -561,9 +602,12 @@ public class PersistentSessionImpl imple
 	 * org.apache.opencmis.client.api.Session#getTypeDescendants(java.lang.String
 	 * , int, boolean)
 	 */
-	public List<Tree<ObjectType>> getTypeDescendants(String typeId, int depth, boolean includePropertyDefinitions) {
-		List<TypeDefinitionContainer> descendants = getBinding().getRepositoryService().getTypeDescendants(
-				getRepositoryId(), typeId, BigInteger.valueOf(depth), includePropertyDefinitions, null);
+	public List<Tree<ObjectType>> getTypeDescendants(String typeId, int depth,
+			boolean includePropertyDefinitions) {
+		List<TypeDefinitionContainer> descendants = getBinding()
+				.getRepositoryService().getTypeDescendants(getRepositoryId(),
+						typeId, BigInteger.valueOf(depth),
+						includePropertyDefinitions, null);
 
 		return convertTypeDescendants(descendants);
 	}
@@ -572,12 +616,15 @@ public class PersistentSessionImpl imple
 	 * Converts provider <code>TypeDefinitionContainer</code> to API
 	 * <code>Container</code>.
 	 */
-	private List<Tree<ObjectType>> convertTypeDescendants(List<TypeDefinitionContainer> descendantsList) {
+	private List<Tree<ObjectType>> convertTypeDescendants(
+			List<TypeDefinitionContainer> descendantsList) {
 		List<Tree<ObjectType>> result = new ArrayList<Tree<ObjectType>>();
 
 		for (TypeDefinitionContainer container : descendantsList) {
-			ObjectType objectType = objectFactory.convertTypeDefinition(container.getTypeDefinition());
-			List<Tree<ObjectType>> children = convertTypeDescendants(container.getChildren());
+			ObjectType objectType = objectFactory
+					.convertTypeDefinition(container.getTypeDefinition());
+			List<Tree<ObjectType>> children = convertTypeDescendants(container
+					.getChildren());
 
 			result.add(new ContainerImpl<ObjectType>(objectType, children));
 		}
@@ -591,8 +638,10 @@ public class PersistentSessionImpl imple
 	 * @see org.apache.opencmis.client.api.Session#query(java.lang.String,
 	 * boolean, int)
 	 */
-	public PagingList<QueryResult> query(final String statement, final boolean searchAllVersions, final int itemsPerPage) {
-		return query(statement, searchAllVersions, getDefaultContext(), itemsPerPage);
+	public PagingIterable<QueryResult> query(final String statement,
+			final boolean searchAllVersions, final int itemsPerPage) {
+		return query(statement, searchAllVersions, getDefaultContext(),
+				itemsPerPage);
 	}
 
 	/*
@@ -601,52 +650,64 @@ public class PersistentSessionImpl imple
 	 * @see org.apache.opencmis.client.api.Session#query(java.lang.String,
 	 * boolean, org.apache.opencmis.client.api.OperationContext, int)
 	 */
-	public PagingList<QueryResult> query(final String statement, final boolean searchAllVersions,
-			OperationContext context, final int itemsPerPage) {
+	public PagingIterable<QueryResult> query(final String statement,
+			final boolean searchAllVersions, OperationContext context,
+			final int itemsPerPage) {
 
-		final DiscoveryService discoveryService = getBinding().getDiscoveryService();
-		final ObjectFactory of = getObjectFactory();
+		if (itemsPerPage < 1) {
+			throw new IllegalArgumentException("itemsPerPage must be > 0!");
+		}
+
+		final DiscoveryService discoveryService = getBinding()
+				.getDiscoveryService();
+		final ObjectFactory objectFactory = this.getObjectFactory();
 		final OperationContext ctxt = new OperationContextImpl(context);
 
-		// set up PagingList object
-		return new AbstractPagingList<QueryResult>() {
+		return new DefaultPagingIterable<QueryResult>(
+				new AbstractPageFetch<QueryResult>() {
 
-			@Override
-			protected FetchResult fetchPage(int pageNumber) {
-				int skipCount = pageNumber * getMaxItemsPerPage();
-
-				// fetch the data
-				ObjectList resultList = discoveryService.query(getRepositoryId(), statement, searchAllVersions, ctxt
-						.isIncludeAllowableActions(), ctxt.getIncludeRelationships(), ctxt.getRenditionFilterString(),
-						BigInteger.valueOf(getMaxItemsPerPage()), BigInteger.valueOf(skipCount), null);
-
-				// convert type definitions
-				List<QueryResult> page = new ArrayList<QueryResult>();
-				if (resultList.getObjects() != null) {
-					for (ObjectData objectData : resultList.getObjects()) {
-						if (objectData == null) {
-							continue;
+					@Override
+					protected AbstractPageFetch.PageFetchResult<QueryResult> fetchPage(
+							long skipCount) {
+
+						// fetch the data
+						ObjectList resultList = discoveryService.query(
+								getRepositoryId(), statement,
+								searchAllVersions, ctxt
+										.isIncludeAllowableActions(), ctxt
+										.getIncludeRelationships(), ctxt
+										.getRenditionFilterString(), BigInteger
+										.valueOf(itemsPerPage), BigInteger
+										.valueOf(skipCount), null);
+
+						// convert type definitions
+						List<QueryResult> page = new ArrayList<QueryResult>();
+						if (resultList.getObjects() != null) {
+							for (ObjectData objectData : resultList
+									.getObjects()) {
+								if (objectData == null) {
+									continue;
+								}
+
+								page.add(objectFactory
+										.convertQueryResult(objectData));
+							}
 						}
 
-						page.add(of.convertQueryResult(objectData));
+						return new AbstractPageFetch.PageFetchResult<QueryResult>(
+								page, resultList.getNumItems(), resultList.hasMoreItems()) {
+						};
 					}
-				}
+				});
 
-				return new FetchResult(page, resultList.getNumItems(), resultList.hasMoreItems());
-			}
-
-			@Override
-			public int getMaxItemsPerPage() {
-				return itemsPerPage;
-			}
-		};
 	}
 
 	public String setExtensionContext(String context) {
 		throw new CmisRuntimeException("not implemented");
 	}
 
-	public ExtensionHandler setExtensionHandler(String context, ExtensionHandler extensionHandler) {
+	public ExtensionHandler setExtensionHandler(String context,
+			ExtensionHandler extensionHandler) {
 		throw new CmisRuntimeException("not implemented");
 	}
 
@@ -668,7 +729,8 @@ public class PersistentSessionImpl imple
 				throw new IllegalStateException("Repository Id is not set!");
 			}
 
-			repositoryInfo = getBinding().getRepositoryService().getRepositoryInfo(repositoryId, null);
+			repositoryInfo = getBinding().getRepositoryService()
+					.getRepositoryInfo(repositoryId, null);
 		} finally {
 			fLock.writeLock().unlock();
 		}
@@ -715,16 +777,22 @@ public class PersistentSessionImpl imple
 	 * org.apache.opencmis.commons.enums.VersioningState, java.util.List,
 	 * java.util.List, java.util.List)
 	 */
-	public ObjectId createDocument(Map<String, ?> properties, ObjectId folderId, ContentStream contentStream,
-			VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
+	public ObjectId createDocument(Map<String, ?> properties,
+			ObjectId folderId, ContentStream contentStream,
+			VersioningState versioningState, List<Policy> policies,
+			List<Ace> addAces, List<Ace> removeAces) {
 		if ((folderId != null) && (folderId.getId() == null)) {
 			throw new IllegalArgumentException("Folder Id must be set!");
 		}
 
-		String newId = getBinding().getObjectService().createDocument(getRepositoryId(),
-				objectFactory.convertProperties(properties, null, CREATE_UPDATABILITY),
-				(folderId == null ? null : folderId.getId()), objectFactory.convertContentStream(contentStream),
-				versioningState, objectFactory.convertPolicies(policies), objectFactory.convertAces(addAces),
+		String newId = getBinding().getObjectService().createDocument(
+				getRepositoryId(),
+				objectFactory.convertProperties(properties, null,
+						CREATE_UPDATABILITY),
+				(folderId == null ? null : folderId.getId()),
+				objectFactory.convertContentStream(contentStream),
+				versioningState, objectFactory.convertPolicies(policies),
+				objectFactory.convertAces(addAces),
 				objectFactory.convertAces(removeAces), null);
 
 		if (newId == null) {
@@ -744,8 +812,10 @@ public class PersistentSessionImpl imple
 	 * org.apache.opencmis.commons.enums.VersioningState, java.util.List,
 	 * java.util.List, java.util.List)
 	 */
-	public ObjectId createDocumentFromSource(ObjectId source, Map<String, ?> properties, ObjectId folderId,
-			VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
+	public ObjectId createDocumentFromSource(ObjectId source,
+			Map<String, ?> properties, ObjectId folderId,
+			VersioningState versioningState, List<Policy> policies,
+			List<Ace> addAces, List<Ace> removeAces) {
 		if ((folderId != null) && (folderId.getId() == null)) {
 			throw new IllegalArgumentException("Folder Id must be set!");
 		}
@@ -760,13 +830,21 @@ public class PersistentSessionImpl imple
 		}
 
 		if (type.getBaseTypeId() != BaseTypeId.CMIS_DOCUMENT) {
-			throw new IllegalArgumentException("Source object must be a document!");
+			throw new IllegalArgumentException(
+					"Source object must be a document!");
 		}
 
-		String newId = getBinding().getObjectService().createDocumentFromSource(getRepositoryId(), source.getId(),
-				objectFactory.convertProperties(properties, type, CREATE_UPDATABILITY),
-				(folderId == null ? null : folderId.getId()), versioningState, objectFactory.convertPolicies(policies),
-				objectFactory.convertAces(addAces), objectFactory.convertAces(removeAces), null);
+		String newId = getBinding().getObjectService()
+				.createDocumentFromSource(
+						getRepositoryId(),
+						source.getId(),
+						objectFactory.convertProperties(properties, type,
+								CREATE_UPDATABILITY),
+						(folderId == null ? null : folderId.getId()),
+						versioningState,
+						objectFactory.convertPolicies(policies),
+						objectFactory.convertAces(addAces),
+						objectFactory.convertAces(removeAces), null);
 
 		if (newId == null) {
 			return null;
@@ -782,16 +860,20 @@ public class PersistentSessionImpl imple
 	 * org.apache.opencmis.client.api.ObjectId, java.util.List, java.util.List,
 	 * java.util.List)
 	 */
-	public ObjectId createFolder(Map<String, ?> properties, ObjectId folderId, List<Policy> policies,
-			List<Ace> addAces, List<Ace> removeAces) {
+	public ObjectId createFolder(Map<String, ?> properties, ObjectId folderId,
+			List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
 		if ((folderId != null) && (folderId.getId() == null)) {
 			throw new IllegalArgumentException("Folder Id must be set!");
 		}
 
-		String newId = getBinding().getObjectService().createFolder(getRepositoryId(),
-				objectFactory.convertProperties(properties, null, CREATE_UPDATABILITY),
-				(folderId == null ? null : folderId.getId()), objectFactory.convertPolicies(policies),
-				objectFactory.convertAces(addAces), objectFactory.convertAces(removeAces), null);
+		String newId = getBinding().getObjectService().createFolder(
+				getRepositoryId(),
+				objectFactory.convertProperties(properties, null,
+						CREATE_UPDATABILITY),
+				(folderId == null ? null : folderId.getId()),
+				objectFactory.convertPolicies(policies),
+				objectFactory.convertAces(addAces),
+				objectFactory.convertAces(removeAces), null);
 
 		if (newId == null) {
 			return null;
@@ -807,16 +889,20 @@ public class PersistentSessionImpl imple
 	 * org.apache.opencmis.client.api.ObjectId, java.util.List, java.util.List,
 	 * java.util.List)
 	 */
-	public ObjectId createPolicy(Map<String, ?> properties, ObjectId folderId, List<Policy> policies,
-			List<Ace> addAces, List<Ace> removeAces) {
+	public ObjectId createPolicy(Map<String, ?> properties, ObjectId folderId,
+			List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
 		if ((folderId != null) && (folderId.getId() == null)) {
 			throw new IllegalArgumentException("Folder Id must be set!");
 		}
 
-		String newId = getBinding().getObjectService().createPolicy(getRepositoryId(),
-				objectFactory.convertProperties(properties, null, CREATE_UPDATABILITY),
-				(folderId == null ? null : folderId.getId()), objectFactory.convertPolicies(policies),
-				objectFactory.convertAces(addAces), objectFactory.convertAces(removeAces), null);
+		String newId = getBinding().getObjectService().createPolicy(
+				getRepositoryId(),
+				objectFactory.convertProperties(properties, null,
+						CREATE_UPDATABILITY),
+				(folderId == null ? null : folderId.getId()),
+				objectFactory.convertPolicies(policies),
+				objectFactory.convertAces(addAces),
+				objectFactory.convertAces(removeAces), null);
 
 		if (newId == null) {
 			return null;
@@ -832,11 +918,14 @@ public class PersistentSessionImpl imple
 	 * org.apache.opencmis.client.api.Session#createRelationship(java.util.Map,
 	 * java.util.List, java.util.List, java.util.List)
 	 */
-	public ObjectId createRelationship(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
-			List<Ace> removeAces) {
-		String newId = getBinding().getObjectService().createRelationship(getRepositoryId(),
-				objectFactory.convertProperties(properties, null, CREATE_UPDATABILITY),
-				objectFactory.convertPolicies(policies), objectFactory.convertAces(addAces),
+	public ObjectId createRelationship(Map<String, ?> properties,
+			List<Policy> policies, List<Ace> addAces, List<Ace> removeAces) {
+		String newId = getBinding().getObjectService().createRelationship(
+				getRepositoryId(),
+				objectFactory.convertProperties(properties, null,
+						CREATE_UPDATABILITY),
+				objectFactory.convertPolicies(policies),
+				objectFactory.convertAces(addAces),
 				objectFactory.convertAces(removeAces), null);
 
 		if (newId == null) {

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/DocumentTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/DocumentTypeImpl.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/DocumentTypeImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/DocumentTypeImpl.java Thu Apr 22 13:27:21 2010
@@ -22,7 +22,7 @@ import java.util.List;
 
 import org.apache.chemistry.opencmis.client.api.DocumentType;
 import org.apache.chemistry.opencmis.client.api.ObjectType;
-import org.apache.chemistry.opencmis.client.api.PagingList;
+import org.apache.chemistry.opencmis.client.api.PagingIterable;
 import org.apache.chemistry.opencmis.client.api.Session;
 import org.apache.chemistry.opencmis.client.api.Tree;
 import org.apache.chemistry.opencmis.commons.api.DocumentTypeDefinition;
@@ -46,7 +46,7 @@ public class DocumentTypeImpl extends Do
 		return helper.getBaseType();
 	}
 
-	public PagingList<ObjectType> getChildren(int itemsPerPage) {
+	public PagingIterable<ObjectType> getChildren(int itemsPerPage) {
 		return helper.getChildren(itemsPerPage);
 	}
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/FolderTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/FolderTypeImpl.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/FolderTypeImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/FolderTypeImpl.java Thu Apr 22 13:27:21 2010
@@ -22,7 +22,7 @@ import java.util.List;
 
 import org.apache.chemistry.opencmis.client.api.FolderType;
 import org.apache.chemistry.opencmis.client.api.ObjectType;
-import org.apache.chemistry.opencmis.client.api.PagingList;
+import org.apache.chemistry.opencmis.client.api.PagingIterable;
 import org.apache.chemistry.opencmis.client.api.Session;
 import org.apache.chemistry.opencmis.client.api.Tree;
 import org.apache.chemistry.opencmis.commons.api.FolderTypeDefinition;
@@ -46,7 +46,7 @@ public class FolderTypeImpl extends Fold
 		return helper.getBaseType();
 	}
 
-	public PagingList<ObjectType> getChildren(int itemsPerPage) {
+	public PagingIterable<ObjectType> getChildren(int itemsPerPage) {
 		return helper.getChildren(itemsPerPage);
 	}
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ObjectTypeHelper.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ObjectTypeHelper.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ObjectTypeHelper.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ObjectTypeHelper.java Thu Apr 22 13:27:21 2010
@@ -21,7 +21,7 @@ package org.apache.chemistry.opencmis.cl
 import java.util.List;
 
 import org.apache.chemistry.opencmis.client.api.ObjectType;
-import org.apache.chemistry.opencmis.client.api.PagingList;
+import org.apache.chemistry.opencmis.client.api.PagingIterable;
 import org.apache.chemistry.opencmis.client.api.Session;
 import org.apache.chemistry.opencmis.client.api.Tree;
 
@@ -75,7 +75,7 @@ public class ObjectTypeHelper {
 		return parentType;
 	}
 
-	public PagingList<ObjectType> getChildren(int itemsPerPage) {
+	public PagingIterable<ObjectType> getChildren(int itemsPerPage) {
 		return session.getTypeChildren(objectType.getId(), true, itemsPerPage);
 	}
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/PolicyTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/PolicyTypeImpl.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/PolicyTypeImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/PolicyTypeImpl.java Thu Apr 22 13:27:21 2010
@@ -21,7 +21,7 @@ package org.apache.chemistry.opencmis.cl
 import java.util.List;
 
 import org.apache.chemistry.opencmis.client.api.ObjectType;
-import org.apache.chemistry.opencmis.client.api.PagingList;
+import org.apache.chemistry.opencmis.client.api.PagingIterable;
 import org.apache.chemistry.opencmis.client.api.PolicyType;
 import org.apache.chemistry.opencmis.client.api.Session;
 import org.apache.chemistry.opencmis.client.api.Tree;
@@ -46,7 +46,7 @@ public class PolicyTypeImpl extends Poli
 		return helper.getBaseType();
 	}
 
-	public PagingList<ObjectType> getChildren(int itemsPerPage) {
+	public PagingIterable<ObjectType> getChildren(int itemsPerPage) {
 		return helper.getChildren(itemsPerPage);
 	}
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java Thu Apr 22 13:27:21 2010
@@ -22,7 +22,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.chemistry.opencmis.client.api.ObjectType;
-import org.apache.chemistry.opencmis.client.api.PagingList;
+import org.apache.chemistry.opencmis.client.api.PagingIterable;
 import org.apache.chemistry.opencmis.client.api.RelationshipType;
 import org.apache.chemistry.opencmis.client.api.Session;
 import org.apache.chemistry.opencmis.client.api.Tree;
@@ -49,7 +49,7 @@ public class RelationshipTypeImpl extend
 		return helper.getBaseType();
 	}
 
-	public PagingList<ObjectType> getChildren(int itemsPerPage) {
+	public PagingIterable<ObjectType> getChildren(int itemsPerPage) {
 		return helper.getChildren(itemsPerPage);
 	}
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetch.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetch.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetch.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetch.java Thu Apr 22 13:27:21 2010
@@ -43,7 +43,8 @@ public abstract class AbstractPageFetch<
 		private BigInteger totalItems;
 		private Boolean hasMoreItems;
 
-		public PageFetchResult(List<T> page, BigInteger totalItems, Boolean hasMoreItems) {
+		public PageFetchResult(List<T> page, BigInteger totalItems,
+				Boolean hasMoreItems) {
 			this.page = page;
 			this.totalItems = totalItems;
 			this.hasMoreItems = hasMoreItems;

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/DefaultPagingIterator.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/DefaultPagingIterator.java?rev=936836&r1=936835&r2=936836&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/DefaultPagingIterator.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/DefaultPagingIterator.java Thu Apr 22 13:27:21 2010
@@ -98,7 +98,7 @@ public class DefaultPagingIterator<T> im
 			return true;
 		}
 
-		return (skipCount + skipOffset) < totalItems - 1;
+		return (skipCount + skipOffset) < totalItems;
 	}
 
 	/*
@@ -108,7 +108,7 @@ public class DefaultPagingIterator<T> im
 	 */
 	public T next() {
 		PageFetchResult<T> currentPage = getPage();
-		skipOffset++;
+//		skipOffset++;
 
 		List<T> items = currentPage.getPage();
 		if (items == null || items.isEmpty()) {
@@ -129,7 +129,7 @@ public class DefaultPagingIterator<T> im
 			return null;
 		}
 
-		return items.get(skipOffset);
+		return items.get(skipOffset++);
 	}
 
 	/*
@@ -146,6 +146,9 @@ public class DefaultPagingIterator<T> im
 		if (page == null) {
 			return false;
 		}
+		if (skipOffset < page.getPage().size()) {
+			return true;
+		}
 		if (page.getHasMoreItems() != null) {
 			return page.getHasMoreItems().booleanValue();
 		}



Mime
View raw message