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


Java BlobStore.list方法代码示例

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


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

示例1: directoryContentsToString

import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
public final String directoryContentsToString(String path) {
	BlobStore blobStore = blobStoreContext.getBlobStore();
	String marker = null;
	ListContainerOptions opts = new ListContainerOptions().recursive();
	if (StringUtils.isNotBlank(path)) {
		opts.inDirectory(path);
	}

	StringBuilder ret = new StringBuilder((path == null ? "Container '" : "Directory '" + path)).append("' contains: [ ");
	do {
		if (marker != null) {
			opts.afterMarker(marker);
		}

		PageSet<? extends StorageMetadata> page = blobStore.list(CONTAINER_NAME, opts);
		page.forEach(
				m -> ret.append('{').append(m.getName()).append(" (")
						.append(m.getType() == StorageType.BLOB ? "FILE" : "DIRECTORY").append(")} "));
		marker = page.getNextMarker();
	} while (marker != null);
	
	return ret.append(']').toString();
}
 
开发者ID:brdara,项目名称:java-cloud-filesystem-provider,代码行数:24,代码来源:AbstractJCloudsIntegrationTest.java

示例2: getContainerList

import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
@GET
@Timed
public List<Container> getContainerList(@PathParam("id") int providerId) {
    BlobStore blobStore = app.getBlobStore(providerId);
    ObjectStore store = getStoreById(providerId, app.getConfiguration());
    if (blobStore == null) {
        throw new WebApplicationException(Response.Status.NOT_FOUND);
    }
    Map<String, ContainerMapEntry> containerMap = createVirtualContainerMap(providerId);
    if (store.getStorageClass() == null) {
        PageSet<? extends StorageMetadata> pageSet = blobStore.list();
        return pageSet.stream()
                .filter(sm -> true)
                .map(sm -> createContainerObject(sm.getName(), containerMap))
                .collect(Collectors.toList());
    }

    GoogleCloudStorageApi googleApi = blobStore.getContext().unwrapApi(GoogleCloudStorageApi.class);
    ListPage<Bucket> listPage = googleApi.getBucketApi().listBucket(store.translateIdentity());
    return listPage.stream()
            .filter(bucket -> bucket.storageClass() ==
                    DomainResourceReferences.StorageClass.valueOf(store.translateStorageClass()))
            .filter(bucket -> bucket.location().name().equalsIgnoreCase(store.getRegion()))
            .map(bucket -> createContainerObject(bucket.name(), containerMap))
            .collect(Collectors.toList());
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:27,代码来源:ContainerResource.java

示例3: testS3ProxyStartup

import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
@Test
public void testS3ProxyStartup() throws Exception {
    initializeDefaultProperties();
    startApp();

    String identity = app.getConfiguration().getString(S3ProxyConstants.PROPERTY_IDENTITY);
    String credential = app.getConfiguration().getString(S3ProxyConstants.PROPERTY_CREDENTIAL);
    configureBlobStore(identity, credential);
    BlobStoreContext context = ContextBuilder.newBuilder("s3")
            .endpoint("http://127.0.0.1:" + app.getS3ProxyPort())
            .credentials(app.getConfiguration().getString(S3ProxyConstants.PROPERTY_IDENTITY),
                    app.getConfiguration().getString(S3ProxyConstants.PROPERTY_CREDENTIAL))
            .build(BlobStoreContext.class);
    BlobStore blobStore = context.getBlobStore();
    PageSet<? extends StorageMetadata> res = blobStore.list();
    assertThat(res).isEmpty();
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:18,代码来源:BounceApplicationTest.java

示例4: testSwiftProxyStartup

import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
@Test
public void testSwiftProxyStartup() throws Exception {
    app = new BounceApplication();
    BounceConfiguration config = app.getConfiguration();
    config.setProperty(SwiftProxy.PROPERTY_ENDPOINT, "http://127.0.0.1:0");
    startApp();

    String identity = "foo";
    String credential = "bar";
    configureBlobStore(identity, credential);
    Properties swiftProperties = new Properties();
    swiftProperties.setProperty("jclouds.keystone.credential-type", "tempAuthCredentials");
    BlobStoreContext context = ContextBuilder.newBuilder("openstack-swift")
            .endpoint("http://127.0.0.1:" + app.getSwiftPort() + "/auth/v1.0")
            .overrides(swiftProperties)
            .credentials("foo", "bar")
            .build(BlobStoreContext.class);
    BlobStore blobStore = context.getBlobStore();
    PageSet<? extends StorageMetadata> res = blobStore.list();
    assertThat(res).isEmpty();
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:22,代码来源:BounceApplicationTest.java

示例5: readNextListing

import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
void readNextListing() throws IOException {
	BlobStore blobStore = dirPath.getFileSystem().getBlobStoreContext().getBlobStore();
	List<CloudPath> paths = new ArrayList<>();

	// Set next page marker
	if (pageSetMarker != null) {
		listContainerOptions.afterMarker(pageSetMarker);
	}

	// Perform a file listing
	PageSet<? extends StorageMetadata> pageSet =
			blobStore.list(dirPath.getContainerName(), listContainerOptions);

	for (StorageMetadata meta : pageSet) {
		String filename = dirPathName == null ? meta.getName() :
			StringUtils.substringAfter(meta.getName(), dirPathName);

		// The listing returns the directory name as part of the listing, don't return this
		if (StringUtils.isNotBlank(filename)) {
			CloudBasicFileAttributes cloudFileAttributes = new CloudBasicFileAttributes(meta);
			CloudPath path =
					new CloudPathWithAttributes(dirPath.getFileSystem(), false, dirPath, filename, cloudFileAttributes);
	
			if (filter == null || filter.accept(path)) {
				paths.add(path);
			}
		}
	}

	currentPage = paths.iterator();
	pageSetMarker = pageSet.getNextMarker();
	readNextPage = pageSetMarker != null;
}
 
开发者ID:brdara,项目名称:java-cloud-filesystem-provider,代码行数:34,代码来源:CloudDirectoryStream.java

示例6: validateObjectStore

import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
private void validateObjectStore(String provider, Properties properties) {
    ContextBuilder builder = ContextBuilder.newBuilder(provider).overrides(properties);
    try (BlobStoreContext context = builder.build(BlobStoreContext.class)) {
        BlobStore store = context.getBlobStore();
        store.list();
    }
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:8,代码来源:ObjectStoreResource.java

示例7: handleContainerList

import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
private void handleContainerList(HttpServletResponse response,
        BlobStore blobStore) throws IOException {
    PageSet<? extends StorageMetadata> buckets = blobStore.list();

    try (Writer writer = response.getWriter()) {
        response.setContentType(XML_CONTENT_TYPE);
        XMLStreamWriter xml = xmlOutputFactory.createXMLStreamWriter(
                writer);
        xml.writeStartDocument();
        xml.writeStartElement("ListAllMyBucketsResult");
        xml.writeDefaultNamespace(AWS_XMLNS);

        writeOwnerStanza(xml);

        xml.writeStartElement("Buckets");
        for (StorageMetadata metadata : buckets) {
            xml.writeStartElement("Bucket");

            writeSimpleElement(xml, "Name", metadata.getName());

            Date creationDate = metadata.getCreationDate();
            if (creationDate == null) {
                // Some providers, e.g., Swift, do not provide container
                // creation date.  Emit a bogus one to satisfy clients like
                // s3cmd which require one.
                creationDate = new Date(0);
            }
            writeSimpleElement(xml, "CreationDate",
                    blobStore.getContext().utils().date()
                            .iso8601DateFormat(creationDate).trim());

            xml.writeEndElement();
        }
        xml.writeEndElement();

        xml.writeEndElement();
        xml.flush();
    } catch (XMLStreamException xse) {
        throw new IOException(xse);
    }
}
 
开发者ID:gaul,项目名称:s3proxy,代码行数:42,代码来源:S3ProxyHandler.java


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