当前位置: 首页>>代码示例>>Java>>正文


Java DbxClient.getMetadataWithChildren方法代码示例

本文整理汇总了Java中com.dropbox.core.DbxClient.getMetadataWithChildren方法的典型用法代码示例。如果您正苦于以下问题:Java DbxClient.getMetadataWithChildren方法的具体用法?Java DbxClient.getMetadataWithChildren怎么用?Java DbxClient.getMetadataWithChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.dropbox.core.DbxClient的用法示例。


在下文中一共展示了DbxClient.getMetadataWithChildren方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ls

import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
public static DbxEntry[] ls(String query, DbxClient client) throws DbxException {
	DbxEntry.WithChildren listing = client.getMetadataWithChildren(query);
       if(listing == null) {
       	return new DbxEntry[]{};
       }
	if(listing.entry.isFile()) {
       	return new DbxEntry[]{listing.entry};
       }
	
	DbxEntry[] dirents = new DbxEntry[listing.children.size()];
	int idx = 0;
	for (DbxEntry child : listing.children) {
           dirents[idx++] = child;
       }
	return dirents;
}
 
开发者ID:kd0kfo,项目名称:dropboxconnector,代码行数:17,代码来源:FileUtils.java

示例2: listFilesAndDirectories

import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
@Override
public FileInstanceAbstract[] listFilesAndDirectories() throws URISyntaxException, IOException {
	try {
		DbxClient dbxClient = connect();
		DbxEntry.WithChildren entries;
		entries = dbxClient.getMetadataWithChildren(getPath());
		if (entries == null || entries.children == null)
			return null;
		FileInstanceAbstract[] fileInstances = new FileInstanceAbstract[entries.children.size()];
		int i = 0;
		for (DbxEntry entry : entries.children)
			fileInstances[i++] = new DropboxFileInstance(filePathItem, this, entry);
		return fileInstances;
	} catch (DbxException e) {
		throw new IOException(e);
	}
}
 
开发者ID:jaeksoft,项目名称:opensearchserver,代码行数:18,代码来源:DropboxFileInstance.java

示例3: collectDropboxEntries

import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
private void collectDropboxEntries(DbxClient client, Map<String, Long> dropboxEntries, String path) throws DbxException {
	WithChildren entries = client.getMetadataWithChildren(path);
	for (DbxEntry entry : entries.children) {
		if (entry.isFolder()) {
			collectDropboxEntries(client, dropboxEntries, entry.path);
		} else {
			dropboxEntries.put(entry.path, entry.asFile().lastModified.getTime());
		}
	}
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:11,代码来源:DropboxSynchronizer.java

示例4: collectDropboxEntries

import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
private void collectDropboxEntries(DbxClient client, Map<String, Long> dropboxEntries, String path)
        throws DbxException {
    WithChildren entries = client.getMetadataWithChildren(path);
    for (DbxEntry entry : entries.children) {
        if (entry.isFolder()) {
            collectDropboxEntries(client, dropboxEntries, entry.path);
        } else {
            dropboxEntries.put(entry.path, entry.asFile().lastModified.getTime());
        }
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:12,代码来源:DropboxSynchronizer.java

示例5: dropboxImport

import com.dropbox.core.DbxClient; //导入方法依赖的package包/类
public void dropboxImport() throws DCMAException {
	DropboxHelper helper = new DropboxHelper(getProperties());
	helper.setPluginName("dcma-dropboximport-plugin");
	DbxClient client = helper.authenticateApp();

	String[] bcs = getBatchClassConfig().split(";");
	for (String batchClassIdentifier : bcs) {

		LOGGER.debug("Importing the batch class " + batchClassIdentifier);

		try {
			String dropboxFolder = getProperty(batchClassIdentifier, "folder");
			String filePattern = getProperty(batchClassIdentifier, "pattern");
			String action = getProperty(batchClassIdentifier, "action");
			String actionName = action.split("\\|")[0];

			LOGGER.debug(" - Dropbox folder: " + dropboxFolder);
			LOGGER.debug(" - File pattern: " + filePattern);

			DbxEntry.WithChildren listing = client.getMetadataWithChildren(dropboxFolder);
			LOGGER.debug(" - Files in the folder:");
			if (listing != null) {
				for (DbxEntry child : listing.children) {
					System.out.println(" -- " + child.name);

					if (child.name.matches(filePattern)) {
						System.out.println(" -- Import file");
						importFilesFromDropbox(child, batchClassIdentifier, client);

						if (actionName.equalsIgnoreCase("moveTo")) {
							String targetFolder = action.split("\\|")[1];
							client.move(child.path, targetFolder + "/" + child.name);
						} else if (actionName.equalsIgnoreCase("delete"))
							client.delete(child.path);

					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:bchevallereau,项目名称:ephesoft-extension,代码行数:44,代码来源:DropboxImporter.java


注:本文中的com.dropbox.core.DbxClient.getMetadataWithChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。