Package org.exoplatform.clouddrive.cmis
Class CMISAPI.ChangesIterator
- java.lang.Object
-
- org.exoplatform.services.cms.clouddrives.utils.ChunkIterator<org.apache.chemistry.opencmis.client.api.ChangeEvent>
-
- org.exoplatform.clouddrive.cmis.CMISAPI.ChangesIterator
-
- Enclosing class:
- CMISAPI
protected class CMISAPI.ChangesIterator extends org.exoplatform.services.cms.clouddrives.utils.ChunkIterator<org.apache.chemistry.opencmis.client.api.ChangeEvent>Iterator over set of drive change events from CMIS Change Log. The iterator will fetch all available events since a given start token.This iterator hides next-chunk logic on request to the service.
Iterator methods can throwCMISExceptionin case of remote or communication errors.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<org.apache.chemistry.opencmis.client.api.ChangeEvent>changesThe changes.protected CMISAPI.ChangeTokenchangeTokenThe latest chunk token.protected booleancleanNextThe clean next.protected booleanfirstRunThe first run.protected booleanhasMoreItemsThe has more items.protected CMISAPI.ChangeTokenlastFetchedTokenThe latest chunk token.protected CMISAPI.ChangeTokenlatestChunkTokenThe latest chunk token.
-
Constructor Summary
Constructors Modifier Constructor Description protectedChangesIterator(CMISAPI.ChangeToken startChangeToken)Instantiates a new changes iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CMISAPI.ChangeTokengetLastChangeToken()Last consumed event change token.booleanhasNext()protected booleanhasNextChunk()org.apache.chemistry.opencmis.client.api.ChangeEventnext()protected Iterator<org.apache.chemistry.opencmis.client.api.ChangeEvent>nextChunk()
-
-
-
Field Detail
-
changeToken
protected CMISAPI.ChangeToken changeToken
The latest chunk token.
-
lastFetchedToken
protected CMISAPI.ChangeToken lastFetchedToken
The latest chunk token.
-
latestChunkToken
protected CMISAPI.ChangeToken latestChunkToken
The latest chunk token.
-
changes
protected List<org.apache.chemistry.opencmis.client.api.ChangeEvent> changes
The changes.
-
firstRun
protected boolean firstRun
The first run.
-
hasMoreItems
protected boolean hasMoreItems
The has more items.
-
cleanNext
protected boolean cleanNext
The clean next.
-
-
Constructor Detail
-
ChangesIterator
protected ChangesIterator(CMISAPI.ChangeToken startChangeToken) throws CMISException, org.exoplatform.services.cms.clouddrives.CloudDriveAccessException
Instantiates a new changes iterator.- Parameters:
startChangeToken- the start change token- Throws:
CMISException- the CMIS exceptionorg.exoplatform.services.cms.clouddrives.CloudDriveAccessException- the cloud drive access exception
-
-
Method Detail
-
nextChunk
protected Iterator<org.apache.chemistry.opencmis.client.api.ChangeEvent> nextChunk() throws CMISException, org.exoplatform.services.cms.clouddrives.CloudDriveAccessException
- Specified by:
nextChunkin classorg.exoplatform.services.cms.clouddrives.utils.ChunkIterator<org.apache.chemistry.opencmis.client.api.ChangeEvent>- Throws:
CMISExceptionorg.exoplatform.services.cms.clouddrives.CloudDriveAccessException
-
hasNextChunk
protected boolean hasNextChunk()
- Specified by:
hasNextChunkin classorg.exoplatform.services.cms.clouddrives.utils.ChunkIterator<org.apache.chemistry.opencmis.client.api.ChangeEvent>
-
hasNext
public boolean hasNext() throws org.exoplatform.services.cms.clouddrives.CloudDriveException- Overrides:
hasNextin classorg.exoplatform.services.cms.clouddrives.utils.ChunkIterator<org.apache.chemistry.opencmis.client.api.ChangeEvent>- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveException
-
next
public org.apache.chemistry.opencmis.client.api.ChangeEvent next() throws NoSuchElementException, org.exoplatform.services.cms.clouddrives.CloudDriveException- Overrides:
nextin classorg.exoplatform.services.cms.clouddrives.utils.ChunkIterator<org.apache.chemistry.opencmis.client.api.ChangeEvent>- Throws:
NoSuchElementExceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException
-
getLastChangeToken
protected CMISAPI.ChangeToken getLastChangeToken()
Last consumed event change token. Can be the same as start token. Can be empty if no data received by fetching and if CMIS service doesn't return the chunk latest token.- Returns:
CMISAPI.ChangeTokenlast fetched change token, token of last fetched events portion ornull
-
-