chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r1005481 - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-client: chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/cl...
Date Thu, 07 Oct 2010 15:03:28 GMT
Author: fguillaume
Date: Thu Oct  7 15:03:28 2010
New Revision: 1005481

URL: http://svn.apache.org/viewvc?rev=1005481&view=rev
Log:
Internal renamings: AbstractPageFetch -> AbstractPageFetcher, AbstractPageFetch.PageFetchResult
-> AbstractPageFetcher.Page, PageFetchResult.getPage -> Page.getItems

Added:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetcher.java
  (contents, props changed)
      - copied, changed from r1005185, incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetch.java
Removed:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetch.java
Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ItemIterable.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/util/AbstractIterable.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterator.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterable.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterator.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterable.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterator.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/ItemIterableTest.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ItemIterable.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/ItemIterable.java?rev=1005481&r1=1005480&r2=1005481&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ItemIterable.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ItemIterable.java
Thu Oct  7 15:03:28 2010
@@ -23,59 +23,60 @@ import java.util.Iterator;
 /**
  * Iterable for CMIS collections that allows ability to skip to specific
  * position or return a sub collection.
- * 
- * @param <T>
+ *
+ * @param <T> the type of the items
  */
 public interface ItemIterable<T> extends Iterable<T> {
 
     /**
      * Skip to position within CMIS collection
-     * 
+     *
      * @param position
-     * @return iterable whose starting point is the specified skip to position
+     * @return iterable whose starting point is the specified skip to position.
+     *         This iterable <em>may</em> be the same as {@code this}
      */
     ItemIterable<T> skipTo(long position);
 
     /**
      * Gets an iterable for the current sub collection within the CMIS collection using
-     * default maximum number of items 
-     * 
+     * default maximum number of items
+     *
      * @return iterable for current page
      */
     ItemIterable<T> getPage();
 
     /**
      * Gets an iterable for the current sub collection within the CMIS collection
-     * 
+     *
      * @param maxNumItems
      *            maximum number of items the sub collection will contain
-     * 
+     *
      * @return iterable for current page
      */
     ItemIterable<T> getPage(int maxNumItems);
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.lang.Iterable#iterator()
      */
     Iterator<T> iterator();
 
     /**
      * Returns the number of items fetched for the current page.
-     * 
+     *
      * @return number of items for currently fetched collection
      */
     long getPageNumItems();
-    
+
     /**
      * Returns whether the repository contains additional items beyond the page of
      * items already fetched.
-     * 
+     *
      * @return true => further page requests will be made to the repository
      */
     boolean getHasMoreItems();
-    
+
     /**
      * Returns the total number of items. If the repository knows the total
      * number of items in a result set, the repository SHOULD include the number
@@ -83,7 +84,7 @@ public interface ItemIterable<T> extends
      * set, this parameter SHOULD not be set. The value in the parameter MAY NOT
      * be accurate the next time the client retrieves the result set or the next
      * page in the result set.
-     * 
+     *
      * @return total number of items or (-1)
      */
     long getTotalNumItems();

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=1005481&r1=1005480&r2=1005481&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 Oct  7 15:03:28 2010
@@ -40,7 +40,7 @@ import org.apache.chemistry.opencmis.cli
 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.AbstractPageFetch;
+import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetcher;
 import org.apache.chemistry.opencmis.client.runtime.util.CollectionIterable;
 import org.apache.chemistry.opencmis.commons.PropertyIds;
 import org.apache.chemistry.opencmis.commons.data.Ace;
@@ -582,10 +582,10 @@ public abstract class AbstractPersistent
         final RelationshipService relationshipService = getBinding().getRelationshipService();
         final OperationContext ctxt = new OperationContextImpl(context);
 
-        return new CollectionIterable<Relationship>(new AbstractPageFetch<Relationship>(ctxt.getMaxItemsPerPage())
{
+        return new CollectionIterable<Relationship>(new AbstractPageFetcher<Relationship>(ctxt.getMaxItemsPerPage())
{
 
             @Override
-            protected AbstractPageFetch.PageFetchResult<Relationship> fetchPage(long
skipCount) {
+            protected AbstractPageFetcher.Page<Relationship> fetchPage(long skipCount)
{
 
                 // fetch the relationships
                 ObjectList relList = relationshipService.getObjectRelationships(getRepositoryId(),
objectId,
@@ -604,7 +604,7 @@ public abstract class AbstractPersistent
                     }
                 }
 
-                return new AbstractPageFetch.PageFetchResult<Relationship>(page, relList.getNumItems(),
+                return new AbstractPageFetcher.Page<Relationship>(page, relList.getNumItems(),
                         relList.hasMoreItems());
             }
         });

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=1005481&r1=1005480&r2=1005481&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 Oct  7 15:03:28 2010
@@ -37,7 +37,7 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.ItemIterable;
 import org.apache.chemistry.opencmis.client.api.Policy;
 import org.apache.chemistry.opencmis.client.api.Tree;
-import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetch;
+import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetcher;
 import org.apache.chemistry.opencmis.client.runtime.util.CollectionIterable;
 import org.apache.chemistry.opencmis.client.runtime.util.TreeImpl;
 import org.apache.chemistry.opencmis.commons.PropertyIds;
@@ -246,10 +246,10 @@ public class PersistentFolderImpl extend
         final ObjectFactory objectFactory = getSession().getObjectFactory();
         final OperationContext ctxt = new OperationContextImpl(context);
 
-        return new CollectionIterable<Document>(new AbstractPageFetch<Document>(ctxt.getMaxItemsPerPage())
{
+        return new CollectionIterable<Document>(new AbstractPageFetcher<Document>(ctxt.getMaxItemsPerPage())
{
 
             @Override
-            protected AbstractPageFetch.PageFetchResult<Document> fetchPage(long skipCount)
{
+            protected AbstractPageFetcher.Page<Document> fetchPage(long skipCount)
{
 
                 // get checked out documents for this folder
                 ObjectList checkedOutDocs = navigationService.getCheckedOutDocs(getRepositoryId(),
objectId, ctxt
@@ -271,7 +271,7 @@ public class PersistentFolderImpl extend
                     }
                 }
 
-                return new AbstractPageFetch.PageFetchResult<Document>(page, checkedOutDocs.getNumItems(),
+                return new AbstractPageFetcher.Page<Document>(page, checkedOutDocs.getNumItems(),
                         checkedOutDocs.hasMoreItems());
             }
         });
@@ -287,10 +287,10 @@ public class PersistentFolderImpl extend
         final ObjectFactory objectFactory = getSession().getObjectFactory();
         final OperationContext ctxt = new OperationContextImpl(context);
 
-        return new CollectionIterable<CmisObject>(new AbstractPageFetch<CmisObject>(ctxt.getMaxItemsPerPage())
{
+        return new CollectionIterable<CmisObject>(new AbstractPageFetcher<CmisObject>(ctxt.getMaxItemsPerPage())
{
 
             @Override
-            protected AbstractPageFetch.PageFetchResult<CmisObject> fetchPage(long
skipCount) {
+            protected AbstractPageFetcher.Page<CmisObject> fetchPage(long skipCount)
{
 
                 // get the children
                 ObjectInFolderList children = navigationService.getChildren(getRepositoryId(),
objectId, ctxt
@@ -309,7 +309,7 @@ public class PersistentFolderImpl extend
                     }
                 }
 
-                return new AbstractPageFetch.PageFetchResult<CmisObject>(page, children.getNumItems(),
children
+                return new AbstractPageFetcher.Page<CmisObject>(page, children.getNumItems(),
children
                         .hasMoreItems());
             }
         });

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=1005481&r1=1005480&r2=1005481&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 Oct  7 15:03:28 2010
@@ -45,7 +45,7 @@ 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.AbstractPageFetch;
+import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetcher;
 import org.apache.chemistry.opencmis.client.runtime.util.CollectionIterable;
 import org.apache.chemistry.opencmis.client.runtime.util.TreeImpl;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
@@ -229,10 +229,10 @@ public class PersistentSessionImpl imple
         final ObjectFactory objectFactory = getObjectFactory();
         final OperationContext ctxt = new OperationContextImpl(context);
 
-        return new CollectionIterable<Document>(new AbstractPageFetch<Document>(ctxt.getMaxItemsPerPage())
{
+        return new CollectionIterable<Document>(new AbstractPageFetcher<Document>(ctxt.getMaxItemsPerPage())
{
 
             @Override
-            protected AbstractPageFetch.PageFetchResult<Document> fetchPage(long skipCount)
{
+            protected AbstractPageFetcher.Page<Document> fetchPage(long skipCount)
{
 
                 // get all checked out documents
                 ObjectList checkedOutDocs = navigationService.getCheckedOutDocs(getRepositoryId(),
null,
@@ -254,7 +254,7 @@ public class PersistentSessionImpl imple
                     }
                 }
 
-                return new AbstractPageFetch.PageFetchResult<Document>(page, checkedOutDocs.getNumItems(),
+                return new AbstractPageFetcher.Page<Document>(page, checkedOutDocs.getNumItems(),
                         checkedOutDocs.hasMoreItems());
             }
         });
@@ -420,11 +420,11 @@ public class PersistentSessionImpl imple
         final RepositoryService repositoryService = getBinding().getRepositoryService();
         final ObjectFactory objectFactory = this.getObjectFactory();
 
-        return new CollectionIterable<ObjectType>(new AbstractPageFetch<ObjectType>(this.getDefaultContext()
+        return new CollectionIterable<ObjectType>(new AbstractPageFetcher<ObjectType>(this.getDefaultContext()
                 .getMaxItemsPerPage()) {
 
             @Override
-            protected AbstractPageFetch.PageFetchResult<ObjectType> fetchPage(long
skipCount) {
+            protected AbstractPageFetcher.Page<ObjectType> fetchPage(long skipCount)
{
 
                 // fetch the data
                 TypeDefinitionList tdl = repositoryService.getTypeChildren(
@@ -437,7 +437,7 @@ public class PersistentSessionImpl imple
                     page.add(objectFactory.convertTypeDefinition(typeDefinition));
                 }
 
-                return new AbstractPageFetch.PageFetchResult<ObjectType>(page, tdl.getNumItems(),
tdl.hasMoreItems()) {
+                return new AbstractPageFetcher.Page<ObjectType>(page, tdl.getNumItems(),
tdl.hasMoreItems()) {
                 };
             }
         });
@@ -484,10 +484,10 @@ public class PersistentSessionImpl imple
         final ObjectFactory objectFactory = this.getObjectFactory();
         final OperationContext ctxt = new OperationContextImpl(context);
 
-        return new CollectionIterable<QueryResult>(new AbstractPageFetch<QueryResult>(ctxt.getMaxItemsPerPage())
{
+        return new CollectionIterable<QueryResult>(new AbstractPageFetcher<QueryResult>(ctxt.getMaxItemsPerPage())
{
 
             @Override
-            protected AbstractPageFetch.PageFetchResult<QueryResult> fetchPage(long
skipCount) {
+            protected AbstractPageFetcher.Page<QueryResult> fetchPage(long skipCount)
{
 
                 // fetch the data
                 ObjectList resultList = discoveryService.query(getRepositoryId(), statement,
searchAllVersions,
@@ -507,7 +507,7 @@ public class PersistentSessionImpl imple
                     }
                 }
 
-                return new AbstractPageFetch.PageFetchResult<QueryResult>(page, resultList.getNumItems(),
+                return new AbstractPageFetcher.Page<QueryResult>(page, resultList.getNumItems(),
                         resultList.hasMoreItems());
             }
         });

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterable.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/AbstractIterable.java?rev=1005481&r1=1005480&r2=1005481&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterable.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterable.java
Thu Oct  7 15:03:28 2010
@@ -18,126 +18,82 @@
  */
 package org.apache.chemistry.opencmis.client.runtime.util;
 
-import java.util.Iterator;
-
 import org.apache.chemistry.opencmis.client.api.ItemIterable;
 
 /**
  * Abstract <code>ItemIterable</code> implementation.
- * 
- * @param <T>
+ *
+ * @param <T> the type returned by the iterable's iterator
  */
 public abstract class AbstractIterable<T> implements ItemIterable<T> {
 
-    private AbstractPageFetch<T> pageFetch;
+    private AbstractPageFetcher<T> pageFetcher;
     private long skipCount;
     private AbstractIterator<T> iterator;
 
-    /**
-     * Construct
-     * 
-     * @param pageFetch
-     */
-    public AbstractIterable(AbstractPageFetch<T> pageFetch) {
-        this(0, pageFetch);
+    public AbstractIterable(AbstractPageFetcher<T> pageFetcher) {
+        this(0, pageFetcher);
     }
 
-    /**
-     * Construct
-     * 
-     * @param position
-     * @param pageFetch
-     */
-    protected AbstractIterable(long position, AbstractPageFetch<T> pageFetch) {
-        this.pageFetch = pageFetch;
+    protected AbstractIterable(long position, AbstractPageFetcher<T> pageFetcher) {
+        this.pageFetcher = pageFetcher;
         this.skipCount = position;
     }
 
     /**
-     * Gets skip count
+     * Gets the skip count
+     *
      * @return  skip count
      */
     protected long getSkipCount() {
         return skipCount;
     }
-    
+
     /**
      * Gets the page fetcher
-     * 
+     *
      * @return  page fetcher
      */
-    protected AbstractPageFetch<T> getPageFetch() {
-        return pageFetch;
+    protected AbstractPageFetcher<T> getPageFetcher() {
+        return pageFetcher;
     }
-    
+
     /**
-     * Construct Iterator
-     * 
+     * Construct the iterator
+     *
      * @return  iterator
      */
     protected abstract AbstractIterator<T> createIterator();
-    
-    /*
-     * (non-Javadoc)
-     * 
-     * @see java.lang.Iterable#iterator()
-     */
-    public Iterator<T> iterator() {
+
+    public AbstractIterator<T> iterator() {
         return getIterator();
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.chemistry.opencmis.client.api.util.PagingIterable#skipTo(long)
-     */
     public ItemIterable<T> skipTo(long position) {
-        return new CollectionIterable<T>(position, pageFetch);
+        return new CollectionIterable<T>(position, pageFetcher);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.chemistry.opencmis.client.api.ItemIterable#getPage()
-     */
     public ItemIterable<T> getPage() {
-        return new CollectionPageIterable<T>(skipCount, pageFetch);
+        return new CollectionPageIterable<T>(skipCount, pageFetcher);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.chemistry.opencmis.client.api.ItemIterable#getPage(int)
-     */
     public ItemIterable<T> getPage(int maxNumItems) {
-        this.pageFetch.setMaxNumItems(maxNumItems);
-        return new CollectionPageIterable<T>(skipCount, pageFetch);
+        this.pageFetcher.setMaxNumItems(maxNumItems);
+        return new CollectionPageIterable<T>(skipCount, pageFetcher);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.chemistry.opencmis.client.api.ItemIterable#getPageNumItems()
-     */
     public long getPageNumItems() {
         return getIterator().getPageNumItems();
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.chemistry.opencmis.client.api.ItemIterable#getHasMoreItems()
-     */
     public boolean getHasMoreItems() {
         return getIterator().getHasMoreItems();
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.chemistry.opencmis.client.api.ItemIterable#getTotalNumItems()
-     */
     public long getTotalNumItems() {
         return getIterator().getTotalNumItems();
     }
-    
+
     private AbstractIterator<T> getIterator() {
         if (this.iterator == null) {
             this.iterator = createIterator();

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterator.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/AbstractIterator.java?rev=1005481&r1=1005480&r2=1005481&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterator.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterator.java
Thu Oct  7 15:03:28 2010
@@ -21,124 +21,101 @@ package org.apache.chemistry.opencmis.cl
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetch.PageFetchResult;
-
+import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetcher.Page;
 
 /**
  * Abstract <code>Iterator</code> implementation.
- * 
- * @param <T>
+ *
+ * @param <T> the type returned by the iterator
  */
 public abstract class AbstractIterator<T> implements Iterator<T> {
 
     private long skipCount;
     private int skipOffset;
-    private AbstractPageFetch<T> pageFetch;
+    private AbstractPageFetcher<T> pageFetcher;
 
-    private PageFetchResult<T> page = null;
-    private Long totalItems = null;
+    private Page<T> page = null;
+    private Long totalNumItems = null;
     private Boolean hasMoreItems = null;
 
     /**
      * Construct
-     * 
+     *
      * @param skipCount
-     * @param pageFetch
+     * @param pageFetcher
      */
-    public AbstractIterator(long skipCount, AbstractPageFetch<T> pageFetch) {
+    public AbstractIterator(long skipCount, AbstractPageFetcher<T> pageFetcher) {
         this.skipCount = skipCount;
-        this.pageFetch = pageFetch;
+        this.pageFetcher = pageFetcher;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.chemistry.opencmis.client.api.util.PagingIterator#getPosition
-     * ()
-     */
     public long getPosition() {
         return skipCount + skipOffset;
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.apache.chemistry.opencmis.client.api.ItemIterator#getPageNumItems()
-     */
     public long getPageNumItems() {
-        PageFetchResult<T> page = getCurrentPage();
+        Page<T> page = getCurrentPage();
         if (page != null) {
-            List<T> items = page.getPage();
+            List<T> items = page.getItems();
             if (items != null) {
                 return items.size();
             }
         }
         return 0L;
     }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.apache.chemistry.opencmis.client.api.ItemIterator#getTotalNumItems()
-     */
+
     public long getTotalNumItems() {
-        if (totalItems == null) {
-            totalItems = -1L;
-            PageFetchResult<T> page = getCurrentPage();
+        if (totalNumItems == null) {
+            totalNumItems = Long.valueOf(-1);
+            Page<T> page = getCurrentPage();
             if (page != null) {
                 // set number of items
-                if (page.getTotalItems() != null) {
-                    totalItems = page.getTotalItems().longValue();
+                if (page.getTotalNumItems() != null) {
+                    totalNumItems = page.getTotalNumItems();
                 }
             }
         }
-        return totalItems;
+        return totalNumItems.longValue();
     }
-    
-    /*
-     * (non-Javadoc)
-     * @see org.apache.chemistry.opencmis.client.api.ItemIterator#getHasMoreItems()
-     */
+
     public boolean getHasMoreItems() {
         if (hasMoreItems == null) {
-            hasMoreItems = false;
-            PageFetchResult<T> page = getCurrentPage();
+            hasMoreItems = Boolean.FALSE;
+            Page<T> page = getCurrentPage();
             if (page != null) {
                 if (page.getHasMoreItems() != null) {
-                    hasMoreItems = page.getHasMoreItems().booleanValue();
+                    hasMoreItems = page.getHasMoreItems();
                 }
             }
         }
-        return hasMoreItems;
+        return hasMoreItems.booleanValue();
     }
 
-    /*
-     * (non-Javadoc)
-     * @see java.util.Iterator#remove()
-     */
     public void remove() {
         throw new UnsupportedOperationException();
     }
 
     /**
      * Gets current skip count
-     * 
+     *
      * @return skip count
      */
     protected long getSkipCount() {
         return skipCount;
     }
-    
+
     /**
      * Gets current skip offset (from skip count)
-     * 
+     *
      * @return skip offset
      */
     protected int getSkipOffset() {
         return skipOffset;
     }
-    
+
     /**
      * Increment the skip offset by one
-     * 
+     *
      * @return incremented skip offset
      */
     protected int incrementSkipOffset() {
@@ -147,27 +124,27 @@ public abstract class AbstractIterator<T
 
     /**
      * Gets the current page of items within collection
-     * 
+     *
      * @return current page
      */
-    protected PageFetchResult<T> getCurrentPage() {
+    protected Page<T> getCurrentPage() {
         if (page == null) {
-            page = pageFetch.fetchPage(skipCount);
+            page = pageFetcher.fetchPage(skipCount);
         }
         return page;
     }
 
     /**
      * Skip to the next page of items within collection
-     * 
+     *
      * @return next page
      */
-    protected PageFetchResult<T> incrementPage() {
+    protected Page<T> incrementPage() {
         skipCount += skipOffset;
         skipOffset = 0;
-        totalItems = null;
+        totalNumItems = null;
         hasMoreItems = null;
-        page = pageFetch.fetchPage(skipCount);
+        page = pageFetcher.fetchPage(skipCount);
         return page;
     }
 

Copied: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetcher.java
(from r1005185, 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/AbstractPageFetcher.java?p2=incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetcher.java&p1=incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetch.java&r1=1005185&r2=1005481&rev=1005481&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/AbstractPageFetcher.java
Thu Oct  7 15:03:28 2010
@@ -22,15 +22,15 @@ import java.math.BigInteger;
 import java.util.List;
 
 /**
- * Abstract page fetch.
+ * Abstract page fetcher.
  *
- * @param <T>
+ * @param <T> the type of items fetched
  */
-public abstract class AbstractPageFetch<T> {
+public abstract class AbstractPageFetcher<T> {
 
     protected long maxNumItems;
 
-    public AbstractPageFetch(long maxNumItems) {
+    public AbstractPageFetcher(long maxNumItems) {
         this.maxNumItems = maxNumItems;
     }
 
@@ -39,27 +39,37 @@ public abstract class AbstractPageFetch<
      *
      * @param skipCount initial offset where to start fetching
      */
-    protected abstract PageFetchResult<T> fetchPage(long skipCount);
+    protected abstract Page<T> fetchPage(long skipCount);
 
-    // --- fetch result class ---
-
-    public static class PageFetchResult<T> {
-        private List<T> page;
-        private BigInteger totalItems;
+    /**
+     * A fetched page.
+     *
+     * @param <T> the type of items fetched
+     */
+    public static class Page<T> {
+        private List<T> items;
+        private Long totalNumItems;
         private Boolean hasMoreItems;
 
-        public PageFetchResult(List<T> page, BigInteger totalItems, Boolean hasMoreItems)
{
-            this.page = page;
-            this.totalItems = totalItems;
+        public Page(List<T> items, BigInteger totalNumItems, Boolean hasMoreItems)
{
+            this.items = items;
+            this.totalNumItems = totalNumItems == null ? null
+                    : Long.valueOf(totalNumItems.longValue());
             this.hasMoreItems = hasMoreItems;
         }
 
-        public List<T> getPage() {
-            return page;
+        public Page(List<T> items, long totalNumItems, boolean hasMoreItems) {
+            this.items = items;
+            this.totalNumItems = Long.valueOf(totalNumItems);
+            this.hasMoreItems = Boolean.valueOf(hasMoreItems);
+        }
+
+        public List<T> getItems() {
+            return items;
         }
 
-        public BigInteger getTotalItems() {
-            return totalItems;
+        public Long getTotalNumItems() {
+            return totalNumItems;
         }
 
         public Boolean getHasMoreItems() {

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

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterable.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/CollectionIterable.java?rev=1005481&r1=1005480&r2=1005481&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterable.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterable.java
Thu Oct  7 15:03:28 2010
@@ -26,25 +26,25 @@ public class CollectionIterable<T> exten
 
     /**
      * Construct
-     * 
-     * @param pageFetch
+     *
+     * @param pageFetcher
      */
-    public CollectionIterable(AbstractPageFetch<T> pageFetch) {
-        this(0, pageFetch);
+    public CollectionIterable(AbstractPageFetcher<T> pageFetcher) {
+        this(0, pageFetcher);
     }
 
     /**
      * Construct
-     * 
+     *
      * @param position
-     * @param pageFetch
+     * @param pageFetcher
      */
-    protected CollectionIterable(long position, AbstractPageFetch<T> pageFetch) {
-        super(position, pageFetch);
+    protected CollectionIterable(long position, AbstractPageFetcher<T> pageFetcher)
{
+        super(position, pageFetcher);
     }
 
     @Override
     protected AbstractIterator<T> createIterator() {
-        return new CollectionIterator<T>(getSkipCount(), getPageFetch());
+        return new CollectionIterator<T>(getSkipCount(), getPageFetcher());
     }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterator.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/CollectionIterator.java?rev=1005481&r1=1005480&r2=1005481&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterator.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterator.java
Thu Oct  7 15:03:28 2010
@@ -20,41 +20,41 @@ package org.apache.chemistry.opencmis.cl
 
 import java.util.List;
 
-import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetch.PageFetchResult;
+import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetcher.Page;
 
 /**
- * Iterator for iterating over all items in a CMIS Collection. 
- * 
+ * Iterator for iterating over all items in a CMIS Collection.
+ *
  * @param <T>
  */
 public class CollectionIterator<T> extends AbstractIterator<T> {
 
     /**
      * Construct
-     * 
+     *
      * @param skipCount
-     * @param pageFetch
+     * @param pageFetcher
      */
-    public CollectionIterator(long skipCount, AbstractPageFetch<T> pageFetch) {
-        super(skipCount, pageFetch);
+    public CollectionIterator(long skipCount, AbstractPageFetcher<T> pageFetcher) {
+        super(skipCount, pageFetcher);
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.util.Iterator#hasNext()
      */
     public boolean hasNext() {
-        PageFetchResult<T> page = getCurrentPage();
+        Page<T> page = getCurrentPage();
         if (page == null) {
             return false;
         }
-        
-        List<T> items = page.getPage();
+
+        List<T> items = page.getItems();
         if (items != null && getSkipOffset() < items.size()) {
             return true;
         }
-        
+
         if (!getHasMoreItems()) {
             return false;
         }
@@ -70,23 +70,23 @@ public class CollectionIterator<T> exten
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.util.Iterator#next()
      */
     public T next() {
-        PageFetchResult<T> page = getCurrentPage();
+        Page<T> page = getCurrentPage();
         if (page == null) {
             return null;
         }
 
-        List<T> items = page.getPage();
+        List<T> items = page.getItems();
         if (items == null || items.isEmpty()) {
             return null;
         }
 
         if (getSkipOffset() == items.size()) {
             page = incrementPage();
-            items = page == null ? null : page.getPage();
+            items = page == null ? null : page.getItems();
         }
 
         if (items == null || items.isEmpty() || getSkipOffset() == items.size()) {

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterable.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/CollectionPageIterable.java?rev=1005481&r1=1005480&r2=1005481&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterable.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterable.java
Thu Oct  7 15:03:28 2010
@@ -26,25 +26,25 @@ public class CollectionPageIterable<T> e
 
     /**
      * Construct
-     * 
-     * @param pageFetch
+     *
+     * @param pageFetcher
      */
-    public CollectionPageIterable(AbstractPageFetch<T> pageFetch) {
-        this(0, pageFetch);
+    public CollectionPageIterable(AbstractPageFetcher<T> pageFetcher) {
+        this(0, pageFetcher);
     }
 
     /**
      * Construct
-     * 
+     *
      * @param position
-     * @param pageFetch
+     * @param pageFetcher
      */
-    protected CollectionPageIterable(long position, AbstractPageFetch<T> pageFetch)
{
-        super(position, pageFetch);
+    protected CollectionPageIterable(long position, AbstractPageFetcher<T> pageFetcher)
{
+        super(position, pageFetcher);
     }
 
     @Override
     protected AbstractIterator<T> createIterator() {
-        return new CollectionPageIterator<T>(getSkipCount(), getPageFetch());
+        return new CollectionPageIterator<T>(getSkipCount(), getPageFetcher());
     }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterator.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/CollectionPageIterator.java?rev=1005481&r1=1005480&r2=1005481&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterator.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterator.java
Thu Oct  7 15:03:28 2010
@@ -20,56 +20,56 @@ package org.apache.chemistry.opencmis.cl
 
 import java.util.List;
 
-import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetch.PageFetchResult;
+import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetcher.Page;
 
 /**
- * Iterator for iterating over a page of items in a CMIS Collection. 
- * 
+ * Iterator for iterating over a page of items in a CMIS Collection.
+ *
  * @param <T>
  */
 public class CollectionPageIterator<T> extends AbstractIterator<T> {
 
     /**
      * Construct
-     * 
+     *
      * @param skipCount
-     * @param pageFetch
+     * @param pageFetcher
      */
-    public CollectionPageIterator(long skipCount, AbstractPageFetch<T> pageFetch) {
-        super(skipCount, pageFetch);
+    public CollectionPageIterator(long skipCount, AbstractPageFetcher<T> pageFetcher)
{
+        super(skipCount, pageFetcher);
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.util.Iterator#hasNext()
      */
     public boolean hasNext() {
-        PageFetchResult<T> page = getCurrentPage();
+        Page<T> page = getCurrentPage();
         if (page == null) {
             return false;
         }
-        
-        List<T> items = page.getPage();
+
+        List<T> items = page.getItems();
         if (items == null || getSkipOffset() >= items.size()) {
             return false;
         }
-        
+
         return true;
     }
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.util.Iterator#next()
      */
     public T next() {
-        PageFetchResult<T> page = getCurrentPage();
+        Page<T> page = getCurrentPage();
         if (page == null) {
             return null;
         }
-        
-        List<T> items = page.getPage();
+
+        List<T> items = page.getItems();
         if (items == null || items.isEmpty() || getSkipOffset() == items.size()) {
             return null;
         }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/ItemIterableTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/ItemIterableTest.java?rev=1005481&r1=1005480&r2=1005481&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/ItemIterableTest.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/ItemIterableTest.java
Thu Oct  7 15:03:28 2010
@@ -23,14 +23,13 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 
 import org.apache.chemistry.opencmis.client.api.ItemIterable;
-import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetch;
+import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetcher;
 import org.apache.chemistry.opencmis.client.runtime.util.CollectionIterable;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -55,11 +54,11 @@ public class ItemIterableTest {
     private String[] data0 = {};
 
     private ItemIterable<String> getIterable(final String[] data, long pageSize) {
-        return new CollectionIterable<String>(new AbstractPageFetch<String>(pageSize)
{
+        return new CollectionIterable<String>(new AbstractPageFetcher<String>(pageSize)
{
 
             @Override
-            protected PageFetchResult<String> fetchPage(long skipCount) {
-                Boolean hasMoreItems = Boolean.TRUE;
+            protected Page<String> fetchPage(long skipCount) {
+                boolean hasMoreItems = true;
                 List<String> page = new ArrayList<String>();
 
                 ItemIterableTest.log.info("(" + skipCount + "|" + this.maxNumItems + ") ");
@@ -69,7 +68,7 @@ public class ItemIterableTest {
 
                 if (to >= data.length) {
                     to = data.length;
-                    hasMoreItems = Boolean.FALSE;
+                    hasMoreItems = false;
                 }
 
                 // . simulate rolling total number of items (for repositories
@@ -80,8 +79,8 @@ public class ItemIterableTest {
                     page.add(data[i]);
                 }
 
-                PageFetchResult<String> result = new AbstractPageFetch.PageFetchResult<String>(page,
BigInteger
-                        .valueOf(totalItems), hasMoreItems);
+                Page<String> result = new AbstractPageFetcher.Page<String>(
+                        page, totalItems, hasMoreItems);
 
                 return result;
             }



Mime
View raw message