Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A0230ECC9 for ; Mon, 27 May 2013 17:30:56 +0000 (UTC) Received: (qmail 95917 invoked by uid 500); 27 May 2013 17:30:56 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 95860 invoked by uid 500); 27 May 2013 17:30:55 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 95852 invoked by uid 99); 27 May 2013 17:30:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 May 2013 17:30:55 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 May 2013 17:30:44 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C3F482388C93 for ; Mon, 27 May 2013 17:29:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r863339 [22/24] - in /websites/staging/chemistry/trunk/content: ./ java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/ java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/css/ java/0.9.0/maven/ch... Date: Mon, 27 May 2013 17:29:20 -0000 To: commits@chemistry.apache.org From: buildbot@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130527172925.C3F482388C93@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.html (added) +++ websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.html Mon May 27 17:29:18 2013 @@ -0,0 +1,78 @@ + + + + +RepositoryImpl xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.client.runtime.repository;
+20  
+21  import java.util.HashMap;
+22  import java.util.Map;
+23  
+24  import org.apache.chemistry.opencmis.client.api.ObjectFactory;
+25  import org.apache.chemistry.opencmis.client.api.Repository;
+26  import org.apache.chemistry.opencmis.client.api.Session;
+27  import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
+28  import org.apache.chemistry.opencmis.client.runtime.cache.Cache;
+29  import org.apache.chemistry.opencmis.commons.SessionParameter;
+30  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+31  import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
+32  import org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider;
+33  
+34  public class RepositoryImpl extends RepositoryInfoImpl implements Repository {
+35  
+36      private static final long serialVersionUID = 1L;
+37  
+38      private final Map<String, String> parameters;
+39      private final SessionFactoryImpl sessionFactory;
+40      private final ObjectFactory objectFactory;
+41      private final AuthenticationProvider authenticationProvider;
+42      private final Cache cache;
+43  
+44      /**
+45       * Constructor.
+46       */
+47      public RepositoryImpl(RepositoryInfo data, Map<String, String> parameters, SessionFactoryImpl sessionFactory,
+48              ObjectFactory objectFactory, AuthenticationProvider authenticationProvider, Cache cache) {
+49          super(data);
+50  
+51          this.parameters = new HashMap<String, String>(parameters);
+52          this.parameters.put(SessionParameter.REPOSITORY_ID, getId());
+53  
+54          this.sessionFactory = sessionFactory;
+55          this.objectFactory = objectFactory;
+56          this.authenticationProvider = authenticationProvider;
+57          this.cache = cache;
+58      }
+59  
+60      @SuppressWarnings("unchecked")
+61      public <T extends Session> T createSession() {
+62          return (T) sessionFactory.createSession(parameters, objectFactory, authenticationProvider, cache);
+63      }
+64  }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/repository/package-frame.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/repository/package-frame.html (added) +++ websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/repository/package-frame.html Mon May 27 17:29:18 2013 @@ -0,0 +1,27 @@ + + + + + + OpenCMIS Client Implementation 0.9.0 Reference Package org.apache.chemistry.opencmis.client.runtime.repository + + + + +

+ org.apache.chemistry.opencmis.client.runtime.repository +

+ +

Classes

+ + + + + \ No newline at end of file Added: websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/repository/package-summary.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/repository/package-summary.html (added) +++ websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/repository/package-summary.html Mon May 27 17:29:18 2013 @@ -0,0 +1,72 @@ + + + + + + OpenCMIS Client Implementation 0.9.0 Reference Package org.apache.chemistry.opencmis.client.runtime.repository + + + +
+ +
+
+ +
+ +

Package org.apache.chemistry.opencmis.client.runtime.repository

+ + + + + + + + + + + + + + + +
Class Summary
+ ObjectFactoryImpl +
+ RepositoryImpl +
+ +
+ +
+
+ +
+
+ Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved. + + \ No newline at end of file Added: websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterable.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterable.html (added) +++ websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterable.html Mon May 27 17:29:18 2013 @@ -0,0 +1,118 @@ + + + + +AbstractIterable xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.client.runtime.util;
+20  
+21  import org.apache.chemistry.opencmis.client.api.ItemIterable;
+22  
+23  /**
+24   * Abstract <code>ItemIterable</code> implementation.
+25   *
+26   * @param <T> the type returned by the iterable's iterator
+27   */
+28  public abstract class AbstractIterable<T> implements ItemIterable<T> {
+29  
+30      private final AbstractPageFetcher<T> pageFetcher;
+31      private final long skipCount;
+32      private AbstractIterator<T> iterator;
+33  
+34      protected AbstractIterable(AbstractPageFetcher<T> pageFetcher) {
+35          this(0, pageFetcher);
+36      }
+37  
+38      protected AbstractIterable(long position, AbstractPageFetcher<T> pageFetcher) {
+39          this.pageFetcher = pageFetcher;
+40          this.skipCount = position;
+41      }
+42  
+43      /**
+44       * Gets the skip count
+45       *
+46       * @return  skip count
+47       */
+48      protected long getSkipCount() {
+49          return skipCount;
+50      }
+51  
+52      /**
+53       * Gets the page fetcher
+54       *
+55       * @return  page fetcher
+56       */
+57      protected AbstractPageFetcher<T> getPageFetcher() {
+58          return pageFetcher;
+59      }
+60  
+61      /**
+62       * Construct the iterator
+63       *
+64       * @return  iterator
+65       */
+66      protected abstract AbstractIterator<T> createIterator();
+67  
+68      public AbstractIterator<T> iterator() {
+69          return getIterator();
+70      }
+71  
+72      public ItemIterable<T> skipTo(long position) {
+73          return new CollectionIterable<T>(position, pageFetcher);
+74      }
+75  
+76      public ItemIterable<T> getPage() {
+77          return new CollectionPageIterable<T>(skipCount, pageFetcher);
+78      }
+79  
+80      public ItemIterable<T> getPage(int maxNumItems) {
+81          this.pageFetcher.setMaxNumItems(maxNumItems);
+82          return new CollectionPageIterable<T>(skipCount, pageFetcher);
+83      }
+84  
+85      public long getPageNumItems() {
+86          return getIterator().getPageNumItems();
+87      }
+88  
+89      public boolean getHasMoreItems() {
+90          return getIterator().getHasMoreItems();
+91      }
+92  
+93      public long getTotalNumItems() {
+94          return getIterator().getTotalNumItems();
+95      }
+96  
+97      private AbstractIterator<T> getIterator() {
+98          if (this.iterator == null) {
+99              this.iterator = createIterator();
+100         }
+101         return this.iterator;
+102     }
+103 }
+104 
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterator.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterator.html (added) +++ websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterator.html Mon May 27 17:29:18 2013 @@ -0,0 +1,165 @@ + + + + +AbstractIterator xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.client.runtime.util;
+20  
+21  import java.util.Iterator;
+22  import java.util.List;
+23  
+24  import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetcher.Page;
+25  
+26  /**
+27   * Abstract <code>Iterator</code> implementation.
+28   *
+29   * @param <T> the type returned by the iterator
+30   */
+31  public abstract class AbstractIterator<T> implements Iterator<T> {
+32  
+33      private long skipCount;
+34      private int skipOffset;
+35      private final AbstractPageFetcher<T> pageFetcher;
+36  
+37      private Page<T> page;
+38      private Long totalNumItems;
+39      private Boolean hasMoreItems;
+40  
+41      /**
+42       * Construct
+43       *
+44       * @param skipCount
+45       * @param pageFetcher
+46       */
+47      protected AbstractIterator(long skipCount, AbstractPageFetcher<T> pageFetcher) {
+48          this.skipCount = skipCount;
+49          this.pageFetcher = pageFetcher;
+50      }
+51  
+52      public long getPosition() {
+53          return skipCount + skipOffset;
+54      }
+55  
+56      public long getPageNumItems() {
+57          Page<T> page = getCurrentPage();
+58          if (page != null) {
+59              List<T> items = page.getItems();
+60              if (items != null) {
+61                  return items.size();
+62              }
+63          }
+64          return 0L;
+65      }
+66  
+67      public long getTotalNumItems() {
+68          if (totalNumItems == null) {
+69              totalNumItems = Long.valueOf(-1);
+70              Page<T> page = getCurrentPage();
+71              if (page != null) {
+72                  // set number of items
+73                  if (page.getTotalNumItems() != null) {
+74                      totalNumItems = page.getTotalNumItems();
+75                  }
+76              }
+77          }
+78          return totalNumItems.longValue();
+79      }
+80  
+81      public boolean getHasMoreItems() {
+82          if (hasMoreItems == null) {
+83              hasMoreItems = Boolean.FALSE;
+84              Page<T> page = getCurrentPage();
+85              if (page != null) {
+86                  if (page.getHasMoreItems() != null) {
+87                      hasMoreItems = page.getHasMoreItems();
+88                  }
+89              }
+90          }
+91          return hasMoreItems.booleanValue();
+92      }
+93  
+94      public void remove() {
+95          throw new UnsupportedOperationException();
+96      }
+97  
+98      /**
+99       * Gets current skip count
+100      *
+101      * @return skip count
+102      */
+103     protected long getSkipCount() {
+104         return skipCount;
+105     }
+106 
+107     /**
+108      * Gets current skip offset (from skip count)
+109      *
+110      * @return skip offset
+111      */
+112     protected int getSkipOffset() {
+113         return skipOffset;
+114     }
+115 
+116     /**
+117      * Increment the skip offset by one
+118      *
+119      * @return incremented skip offset
+120      */
+121     protected int incrementSkipOffset() {
+122         return skipOffset++;
+123     }
+124 
+125     /**
+126      * Gets the current page of items within collection
+127      *
+128      * @return current page
+129      */
+130     protected Page<T> getCurrentPage() {
+131         if (page == null) {
+132             page = pageFetcher.fetchPage(skipCount);
+133         }
+134         return page;
+135     }
+136 
+137     /**
+138      * Skip to the next page of items within collection
+139      *
+140      * @return next page
+141      */
+142     protected Page<T> incrementPage() {
+143         skipCount += skipOffset;
+144         skipOffset = 0;
+145         totalNumItems = null;
+146         hasMoreItems = null;
+147         page = pageFetcher.fetchPage(skipCount);
+148         return page;
+149     }
+150 
+151 }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetcher.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetcher.html (added) +++ websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/AbstractPageFetcher.html Mon May 27 17:29:18 2013 @@ -0,0 +1,98 @@ + + + + +AbstractPageFetcher xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.client.runtime.util;
+20  
+21  import java.math.BigInteger;
+22  import java.util.List;
+23  
+24  /**
+25   * Abstract page fetcher.
+26   *
+27   * @param <T> the type of items fetched
+28   */
+29  public abstract class AbstractPageFetcher<T> {
+30  
+31      protected long maxNumItems;
+32  
+33      protected AbstractPageFetcher(long maxNumItems) {
+34          this.maxNumItems = maxNumItems;
+35      }
+36  
+37      /**
+38       * Fetches the given page from the server.
+39       *
+40       * @param skipCount initial offset where to start fetching
+41       */
+42      protected abstract Page<T> fetchPage(long skipCount);
+43  
+44      /**
+45       * A fetched page.
+46       *
+47       * @param <T> the type of items fetched
+48       */
+49      public static class Page<T> {
+50          private final List<T> items;
+51          private final Long totalNumItems;
+52          private final Boolean hasMoreItems;
+53  
+54          public Page(List<T> items, BigInteger totalNumItems, Boolean hasMoreItems) {
+55              this.items = items;
+56              this.totalNumItems = totalNumItems == null ? null
+57                      : Long.valueOf(totalNumItems.longValue());
+58              this.hasMoreItems = hasMoreItems;
+59          }
+60  
+61          public Page(List<T> items, long totalNumItems, boolean hasMoreItems) {
+62              this.items = items;
+63              this.totalNumItems = Long.valueOf(totalNumItems);
+64              this.hasMoreItems = Boolean.valueOf(hasMoreItems);
+65          }
+66  
+67          public List<T> getItems() {
+68              return items;
+69          }
+70  
+71          public Long getTotalNumItems() {
+72              return totalNumItems;
+73          }
+74  
+75          public Boolean getHasMoreItems() {
+76              return hasMoreItems;
+77          }
+78      }
+79  
+80      public void setMaxNumItems(int maxNumItems) {
+81          this.maxNumItems = maxNumItems;
+82      }
+83  
+84  }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterable.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterable.html (added) +++ websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterable.html Mon May 27 17:29:18 2013 @@ -0,0 +1,64 @@ + + + + +CollectionIterable xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.client.runtime.util;
+20  
+21  
+22  /**
+23   * CMIS Collection Iterable
+24   */
+25  public class CollectionIterable<T> extends AbstractIterable<T> {
+26  
+27      /**
+28       * Construct
+29       *
+30       * @param pageFetcher
+31       */
+32      public CollectionIterable(AbstractPageFetcher<T> pageFetcher) {
+33          this(0, pageFetcher);
+34      }
+35  
+36      /**
+37       * Construct
+38       *
+39       * @param position
+40       * @param pageFetcher
+41       */
+42      protected CollectionIterable(long position, AbstractPageFetcher<T> pageFetcher) {
+43          super(position, pageFetcher);
+44      }
+45  
+46      @Override
+47      protected AbstractIterator<T> createIterator() {
+48          return new CollectionIterator<T>(getSkipCount(), getPageFetcher());
+49      }
+50  }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterator.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterator.html (added) +++ websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/CollectionIterator.html Mon May 27 17:29:18 2013 @@ -0,0 +1,113 @@ + + + + +CollectionIterator xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.client.runtime.util;
+20  
+21  import java.util.List;
+22  
+23  import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetcher.Page;
+24  
+25  /**
+26   * Iterator for iterating over all items in a CMIS Collection.
+27   *
+28   * @param <T>
+29   */
+30  public class CollectionIterator<T> extends AbstractIterator<T> {
+31  
+32      /**
+33       * Construct
+34       *
+35       * @param skipCount
+36       * @param pageFetcher
+37       */
+38      public CollectionIterator(long skipCount, AbstractPageFetcher<T> pageFetcher) {
+39          super(skipCount, pageFetcher);
+40      }
+41  
+42      /*
+43       * (non-Javadoc)
+44       *
+45       * @see java.util.Iterator#hasNext()
+46       */
+47      public boolean hasNext() {
+48          Page<T> page = getCurrentPage();
+49          if (page == null) {
+50              return false;
+51          }
+52  
+53          List<T> items = page.getItems();
+54          if (items != null && getSkipOffset() < items.size()) {
+55              return true;
+56          }
+57  
+58          if (!getHasMoreItems()) {
+59              return false;
+60          }
+61  
+62          long totalItems = getTotalNumItems();
+63          if (totalItems < 0) {
+64              // we don't know better
+65              return true;
+66          }
+67  
+68          return (getSkipCount() + getSkipOffset()) < totalItems;
+69      }
+70  
+71      /*
+72       * (non-Javadoc)
+73       *
+74       * @see java.util.Iterator#next()
+75       */
+76      public T next() {
+77          Page<T> page = getCurrentPage();
+78          if (page == null) {
+79              return null;
+80          }
+81  
+82          List<T> items = page.getItems();
+83          if (items == null || items.isEmpty()) {
+84              return null;
+85          }
+86  
+87          if (getSkipOffset() == items.size()) {
+88              page = incrementPage();
+89              items = page == null ? null : page.getItems();
+90          }
+91  
+92          if (items == null || items.isEmpty() || getSkipOffset() == items.size()) {
+93              return null;
+94          }
+95  
+96          return items.get(incrementSkipOffset());
+97      }
+98  
+99  }
+
+
+ + Added: websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterable.html ============================================================================== --- websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterable.html (added) +++ websites/staging/chemistry/trunk/content/java/0.9.0/maven/chemistry-opencmis-client/chemistry-opencmis-client-impl/xref/org/apache/chemistry/opencmis/client/runtime/util/CollectionPageIterable.html Mon May 27 17:29:18 2013 @@ -0,0 +1,64 @@ + + + + +CollectionPageIterable xref + + + +
+
+1   /*
+2    * Licensed to the Apache Software Foundation (ASF) under one
+3    * or more contributor license agreements.  See the NOTICE file
+4    * distributed with this work for additional information
+5    * regarding copyright ownership.  The ASF licenses this file
+6    * to you under the Apache License, Version 2.0 (the
+7    * "License"); you may not use this file except in compliance
+8    * with the License.  You may obtain a copy of the License at
+9    *
+10   * http://www.apache.org/licenses/LICENSE-2.0
+11   *
+12   * Unless required by applicable law or agreed to in writing,
+13   * software distributed under the License is distributed on an
+14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+15   * KIND, either express or implied.  See the License for the
+16   * specific language governing permissions and limitations
+17   * under the License.
+18   */
+19  package org.apache.chemistry.opencmis.client.runtime.util;
+20  
+21  
+22  /**
+23   * Iterable for a CMIS Collection Page
+24   */
+25  public class CollectionPageIterable<T> extends AbstractIterable<T> {
+26  
+27      /**
+28       * Construct
+29       *
+30       * @param pageFetcher
+31       */
+32      public CollectionPageIterable(AbstractPageFetcher<T> pageFetcher) {
+33          this(0, pageFetcher);
+34      }
+35  
+36      /**
+37       * Construct
+38       *
+39       * @param position
+40       * @param pageFetcher
+41       */
+42      protected CollectionPageIterable(long position, AbstractPageFetcher<T> pageFetcher) {
+43          super(position, pageFetcher);
+44      }
+45  
+46      @Override
+47      protected AbstractIterator<T> createIterator() {
+48          return new CollectionPageIterator<T>(getSkipCount(), getPageFetcher());
+49      }
+50  }
+
+
+ +