org.exoplatform.clouddrive.box
Class JCRLocalBoxDrive.EventsSync

java.lang.Object
  extended by org.exoplatform.clouddrive.box.JCRLocalBoxDrive.EventsSync
All Implemented Interfaces:
org.exoplatform.clouddrive.CloudDrive.Command
Enclosing class:
JCRLocalBoxDrive

protected class JCRLocalBoxDrive.EventsSync
extends Object

Sync algorithm for Box drive based on drive changes obtained from Events service http://developers.box.com/docs/#events.


Field Summary
protected  BoxAPI api
          Box API.
protected  Map<String,org.exoplatform.clouddrive.jcr.JCRLocalCloudFile> applied
          Applied items in latest state mapped by item id.
protected  int appliedCounter
          Counter of applied events in this Sync.
protected  org.exoplatform.clouddrive.box.BoxAPI.EventsIterator events
          Events from Box to apply.
protected  Set<String> history
          Currently applied history of the drive storage.
protected  com.box.boxjavalibv2.dao.BoxEvent lastPostponed
           
protected  Set<String> newHistory
          New history with currently applied event ids.
protected  com.box.boxjavalibv2.dao.BoxEvent nextEvent
           
protected  LinkedList<com.box.boxjavalibv2.dao.BoxEvent> postponed
          Queue of events postponed due to not existing parent or source.
protected  int postponedNumber
           
protected  int prevPostponedNumber
           
protected  int readCounter
          Counter of events read from Box service.
protected  Set<String> removedIds
          Ids of removed items.
protected  Map<String,com.box.boxjavalibv2.dao.BoxItem> undeleted
          Undeleted events by item id.
 
Fields inherited from interface org.exoplatform.clouddrive.CloudDrive.Command
COMPLETE
 
Constructor Summary
protected JCRLocalBoxDrive.EventsSync()
          Create command for Box synchronization.
 
Method Summary
protected  org.exoplatform.clouddrive.jcr.JCRLocalCloudFile applied(String itemId)
           
protected  void apply(org.exoplatform.clouddrive.jcr.JCRLocalCloudFile local)
           
protected  com.box.boxjavalibv2.dao.BoxFolder fetchChilds(String fileId, javax.jcr.Node parent)
           
protected  boolean hasNextEvent()
           
protected  boolean hasPostponed()
           
protected  boolean isRemoved(String itemId)
           
protected  com.box.boxjavalibv2.dao.BoxEvent nextEvent()
           
protected  void postpone(com.box.boxjavalibv2.dao.BoxEvent event)
           
protected  com.box.boxjavalibv2.dao.BoxEvent readEvent()
           
protected  org.exoplatform.clouddrive.jcr.JCRLocalCloudFile remove(String itemId, String itemPath)
           
protected  void syncFiles()
          
protected  void undelete(com.box.boxjavalibv2.dao.BoxItem item)
           
protected  com.box.boxjavalibv2.dao.BoxItem undeleted(String itemId)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

api

protected final BoxAPI api
Box API.


history

protected final Set<String> history
Currently applied history of the drive storage.


newHistory

protected final Set<String> newHistory
New history with currently applied event ids.


postponed

protected final LinkedList<com.box.boxjavalibv2.dao.BoxEvent> postponed
Queue of events postponed due to not existing parent or source.


applied

protected final Map<String,org.exoplatform.clouddrive.jcr.JCRLocalCloudFile> applied
Applied items in latest state mapped by item id.


undeleted

protected final Map<String,com.box.boxjavalibv2.dao.BoxItem> undeleted
Undeleted events by item id.


removedIds

protected final Set<String> removedIds
Ids of removed items.


events

protected org.exoplatform.clouddrive.box.BoxAPI.EventsIterator events
Events from Box to apply.


nextEvent

protected com.box.boxjavalibv2.dao.BoxEvent nextEvent

lastPostponed

protected com.box.boxjavalibv2.dao.BoxEvent lastPostponed

prevPostponedNumber

protected int prevPostponedNumber

postponedNumber

protected int postponedNumber

appliedCounter

protected int appliedCounter
Counter of applied events in this Sync. Used for multi-pass looping over the events.


readCounter

protected int readCounter
Counter of events read from Box service. Used for multi-pass looping over the events.

Constructor Detail

JCRLocalBoxDrive.EventsSync

protected JCRLocalBoxDrive.EventsSync()
                               throws javax.jcr.RepositoryException,
                                      org.exoplatform.clouddrive.DriveRemovedException
Create command for Box synchronization.

Throws:
javax.jcr.RepositoryException
org.exoplatform.clouddrive.DriveRemovedException
Method Detail

syncFiles

protected void syncFiles()
                  throws org.exoplatform.clouddrive.CloudDriveException,
                         javax.jcr.RepositoryException

Throws:
org.exoplatform.clouddrive.CloudDriveException
javax.jcr.RepositoryException

fetchChilds

protected com.box.boxjavalibv2.dao.BoxFolder fetchChilds(String fileId,
                                                         javax.jcr.Node parent)
                                                  throws org.exoplatform.clouddrive.CloudDriveException,
                                                         javax.jcr.RepositoryException
Throws:
org.exoplatform.clouddrive.CloudDriveException
javax.jcr.RepositoryException

readEvent

protected com.box.boxjavalibv2.dao.BoxEvent readEvent()
                                               throws org.exoplatform.clouddrive.CloudDriveException
Throws:
org.exoplatform.clouddrive.CloudDriveException

hasNextEvent

protected boolean hasNextEvent()
                        throws org.exoplatform.clouddrive.CloudDriveException
Throws:
org.exoplatform.clouddrive.CloudDriveException

nextEvent

protected com.box.boxjavalibv2.dao.BoxEvent nextEvent()
                                               throws NoSuchElementException,
                                                      org.exoplatform.clouddrive.CloudDriveException
Throws:
NoSuchElementException
org.exoplatform.clouddrive.CloudDriveException

postpone

protected void postpone(com.box.boxjavalibv2.dao.BoxEvent event)

hasPostponed

protected boolean hasPostponed()

undeleted

protected com.box.boxjavalibv2.dao.BoxItem undeleted(String itemId)

undelete

protected void undelete(com.box.boxjavalibv2.dao.BoxItem item)

apply

protected void apply(org.exoplatform.clouddrive.jcr.JCRLocalCloudFile local)

applied

protected org.exoplatform.clouddrive.jcr.JCRLocalCloudFile applied(String itemId)

remove

protected org.exoplatform.clouddrive.jcr.JCRLocalCloudFile remove(String itemId,
                                                                  String itemPath)

isRemoved

protected boolean isRemoved(String itemId)


Copyright © 2003–2015 eXo Platform SAS. All rights reserved.