本文整理汇总了Java中com.dropbox.core.DbxClient.getDelta方法的典型用法代码示例。如果您正苦于以下问题:Java DbxClient.getDelta方法的具体用法?Java DbxClient.getDelta怎么用?Java DbxClient.getDelta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.dropbox.core.DbxClient
的用法示例。
在下文中一共展示了DbxClient.getDelta方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
@Override
protected final void call(final DbxClient client, final ProgressMonitor pm) throws DbxException {
pm.begin(1);
final DbxDelta<DbxEntry> delta = client.getDelta(cursor);
// we need to unroll this manually because of a NullPointerException when metadata is null
getLog().info("reset=" + delta.reset);
getLog().info("hasMore=" + delta.hasMore);
getLog().info("cursor=\"" + delta.cursor + "\"");
for (final Entry<DbxEntry> entry : delta.entries) {
getLog().info("(lcPath=\"" + entry.lcPath + "\", metadata=" + entry.metadata + ")");
}
}
示例2: syncDropboxToLocal
import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
/**
* Synchronizes all changes from Dropbox to the local file system. Changes are
* identified by the Dropbox delta mechanism which takes the <code>lastCursor</code>
* field into account. If <code>lastCursor</code> is <code>null</code> it
* tries to recreate it from the file <code>deltacursor.dbx</code>. If
* it is still <code>null</code> all files are downloaded from the specified
* location.
*
* Note: Since we define Dropbox as data master we do not care about local
* changes while downloading files!
*
* @throws DbxException if there are technical or application level
* errors in the Dropbox communication
* @throws IOException
*/
public void syncDropboxToLocal(DbxClient client) throws DbxException, IOException {
logger.debug("Started synchronization from Dropbox to local ...");
lastCursor = readDeltaCursor();
if (StringUtils.isBlank(lastCursor)) {
logger.trace("Last cursor was NULL and has now been recreated from the filesystem '{}'", lastCursor);
}
DbxDelta<DbxEntry> deltaPage = client.getDelta(lastCursor);
if (deltaPage.entries != null && deltaPage.entries.size() == 0) {
logger.debug("There are no deltas to download from Dropbox ...");
} else {
do {
logger.debug("There are '{}' deltas to process ...", deltaPage.entries.size());
int processedDelta = 0;
for (Entry<DbxEntry> entry : deltaPage.entries) {
boolean matches = false;
for (String filter : downloadFilterElements) {
matches |= entry.lcPath.matches(filter);
}
if (matches) {
if (entry.metadata != null) {
downloadFile(client, entry);
} else {
String fqPath = contentDir + entry.lcPath;
deleteLocalFile(fqPath);
}
processedDelta++;
} else {
logger.trace("skipped file '{}' since it doesn't match the given filter arguments.", entry.lcPath);
}
}
logger.debug("'{}' deltas met the given downloadFilter {}", processedDelta, downloadFilterElements);
// query again to check if there more entries to process!
deltaPage = client.getDelta(lastCursor);
} while (deltaPage.hasMore);
}
writeDeltaCursor(deltaPage.cursor);
}
示例3: syncDropboxToLocal
import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
/**
* Synchronizes all changes from Dropbox to the local file system. Changes are
* identified by the Dropbox delta mechanism which takes the <code>lastCursor</code>
* field into account. If <code>lastCursor</code> is <code>null</code> it
* tries to recreate it from the file <code>deltacursor.dbx</code>. If
* it is still <code>null</code> all files are downloaded from the specified
* location.
*
* Note: Since we define Dropbox as data master we do not care about local
* changes while downloading files!
*
* @throws DbxException if there are technical or application level
* errors in the Dropbox communication
* @throws IOException
*/
public void syncDropboxToLocal(DbxClient client) throws DbxException, IOException {
logger.debug("Started synchronization from Dropbox to local ...");
lastCursor = readDeltaCursor();
if (StringUtils.isBlank(lastCursor)) {
logger.trace("Last cursor was NULL and has now been recreated from the filesystem '{}'", lastCursor);
}
DbxDelta<DbxEntry> deltaPage = client.getDelta(lastCursor);
if (deltaPage.entries != null && deltaPage.entries.size() == 0) {
logger.debug("There are no deltas to download from Dropbox ...");
} else {
do {
logger.debug("There are '{}' deltas to process ...", deltaPage.entries.size());
int processedDelta = 0;
for (Entry<DbxEntry> entry : deltaPage.entries) {
boolean matches = false;
for (String filter : downloadFilterElements) {
matches |= entry.lcPath.matches(filter);
}
if (matches) {
if (entry.metadata != null) {
downloadFile(client, entry);
} else {
String fqPath = contentDir + entry.lcPath;
deleteLocalFile(fqPath);
}
processedDelta++;
} else {
logger.trace("skipped file '{}' since it doesn't match the given filter arguments.",
entry.lcPath);
}
}
logger.debug("'{}' deltas met the given downloadFilter {}", processedDelta, downloadFilterElements);
// query again to check if there more entries to process!
deltaPage = client.getDelta(lastCursor);
} while (deltaPage.hasMore);
}
writeDeltaCursor(deltaPage.cursor);
}