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


Java ApiMetadata类代码示例

本文整理汇总了Java中org.jclouds.apis.ApiMetadata的典型用法代码示例。如果您正苦于以下问题:Java ApiMetadata类的具体用法?Java ApiMetadata怎么用?Java ApiMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createDirectory

import org.jclouds.apis.ApiMetadata; //导入依赖的package包/类
/**
 * Directory access is checked using {@link #checkAccess(BlobStoreContext, CloudPath, Set)}
 * with {@link AclEntryPermission#ADD_SUBDIRECTORY}.
 */
@Override
public void createDirectory(BlobStoreContext context, CloudPath dir, FileAttribute<?>... attrs) throws IOException {
	if (dir.exists()) {
		throw new FileAlreadyExistsException("The directory '" + dir.toAbsolutePath().toString() +
				"' cannot be created as it already exists");
	}

	// This is a container
	if (dir.getPathName() == null) {
		LOG.debug("Creating container '{}'...", dir.getContainerName());
		ApiMetadata apiMetadata = context.unwrap().getProviderMetadata().getApiMetadata();
		Location location = null;
        if (apiMetadata instanceof SwiftApiMetadata) {
            location = Iterables.getFirst(context.getBlobStore().listAssignableLocations(), null);
        }

		if (!context.getBlobStore().createContainerInLocation(location, dir.getContainerName())) {
			throw new IOException("Could not create container '" + dir.toAbsolutePath().toString() + "'");
		}

		LOG.debug("Created container '{}' OK", dir.getContainerName());
	} else {
		LOG.debug("Creating directory '{}'...", dir);

		// Check the directory has a parent
		CloudPath parent = dir.getParent();
		if (!parent.exists()) {
			throw new IOException("Could not create directory '" + dir.toAbsolutePath().toString() +
					"', the parent directory does not exist");
		}
		
		checkAccess(context, parent, CREATE_DIRECTORY_STREAM_PERMS);

		// File attributes don't apply here, directories are just placeholders with no access
		context.getBlobStore().createDirectory(dir.getContainerName(), dir.getPathName());
		LOG.debug("Created directory '{}' OK", dir);
	}
}
 
开发者ID:brdara,项目名称:java-cloud-filesystem-provider,代码行数:43,代码来源:DefaultCloudFileSystemImplementation.java

示例2: createApiMetadata

import org.jclouds.apis.ApiMetadata; //导入依赖的package包/类
@Override
protected ApiMetadata createApiMetadata() {
    if (apiMetadata == null) {
        apiMetadata = new DimensionDataCloudControllerApiMetadata();
    }
    return apiMetadata;
}
 
开发者ID:cloudsoft,项目名称:amp-dimensiondata,代码行数:8,代码来源:DimensionDataTemplateBuilderLiveTest.java

示例3: testBitbucketApiRegistered

import org.jclouds.apis.ApiMetadata; //导入依赖的package包/类
public void testBitbucketApiRegistered() {
    final ApiMetadata api = Apis.withId("bitbucket");

    assertThat(api).isNotNull();
    assertThat(api instanceof BitbucketApiMetadata).isTrue();
    assertThat("bitbucket").isEqualTo(api.getId());
}
 
开发者ID:cdancy,项目名称:bitbucket-rest,代码行数:8,代码来源:BitbucketApiMetadataTest.java

示例4: setUp

import org.jclouds.apis.ApiMetadata; //导入依赖的package包/类
/**
 * <ul>
 * <li>Creates a {@link #blobStoreContext} using the {@link CloudFileSystemLiveTestHelper} class.
 * <li>Creates the {@link #CONTAINER_NAME container}.
 * </ul>
 */
@Before
public final void setUp() {
	preSetUp();
	cloudPathCounter.set(0);
	cloudHostSettings = CloudFileSystemLiveTestHelper.getCloudHostSettings();
	blobStoreContext = CloudFileSystemLiveTestHelper.createBlobStoreContext(cloudHostSettings);
	fileSystem = context.mock(CloudFileSystem.class);
	provider = new CloudFileSystemProviderDelegate();

	// If Swift get a location
	ApiMetadata apiMetadata = blobStoreContext.unwrap().getProviderMetadata().getApiMetadata();
	location = null;
       if (apiMetadata instanceof SwiftApiMetadata) {
           location = Iterables.getFirst(blobStoreContext.getBlobStore().listAssignableLocations(), null);
       }

	if (!blobStoreContext.getBlobStore().createContainerInLocation(location, CONTAINER_NAME)) {
		blobStoreContext.getBlobStore().deleteContainer(CONTAINER_NAME);
		Assert.assertTrue("Could not create container " + CONTAINER_NAME,
				blobStoreContext.getBlobStore().createContainerInLocation(location, CONTAINER_NAME));
	}
       
       context.checking(new Expectations() {{
       	allowing(fileSystem).provider();
       	will(returnValue(provider));
       	
       	allowing(fileSystem).getCloudHostConfiguration();
       	will(returnValue(cloudHostSettings));
       	
       	allowing(fileSystem).getBlobStoreContext();
       	will(returnValue(blobStoreContext));
       	
       	allowing(fileSystem).getSeparator();
       	will(returnValue(CloudPath.DEFAULT_PATH_SEPARATOR));
       }});
       
	containerPath = new CloudPath(fileSystem, true, CONTAINER_NAME);

       postSetUp();
}
 
开发者ID:brdara,项目名称:java-cloud-filesystem-provider,代码行数:47,代码来源:AbstractJCloudsIntegrationTest.java

示例5: build

import org.jclouds.apis.ApiMetadata; //导入依赖的package包/类
@Override
public ApiMetadata build() {
   return new OSSApiMetadata(this);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:5,代码来源:OSSApiMetadata.java

示例6: build

import org.jclouds.apis.ApiMetadata; //导入依赖的package包/类
@Override
public ApiMetadata build() {
   return new ECSApiMetadata(this);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:5,代码来源:ECSApiMetadata.java

示例7: build

import org.jclouds.apis.ApiMetadata; //导入依赖的package包/类
@Override
public ApiMetadata build() {
   return new SLBApiMetadata(this);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:5,代码来源:SLBApiMetadata.java

示例8: fromApiMetadata

import org.jclouds.apis.ApiMetadata; //导入依赖的package包/类
@Override
public Builder fromApiMetadata(ApiMetadata in) {
   return this;
}
 
开发者ID:cloudsoft,项目名称:amp-dimensiondata,代码行数:5,代码来源:DimensionDataCloudControllerApiMetadata.java

示例9: fromApiMetadata

import org.jclouds.apis.ApiMetadata; //导入依赖的package包/类
@Override
public Builder fromApiMetadata(final ApiMetadata in) {
    return this;
}
 
开发者ID:cdancy,项目名称:bitbucket-rest,代码行数:5,代码来源:BitbucketApiMetadata.java

示例10: toBuilder

import org.jclouds.apis.ApiMetadata; //导入依赖的package包/类
@Override
public ApiMetadata.Builder<?> toBuilder() {
    return new Builder().fromApiMetadata(this);
}
 
开发者ID:bouncestorage,项目名称:bouncestorage,代码行数:5,代码来源:NullApiMetadata.java

示例11: build

import org.jclouds.apis.ApiMetadata; //导入依赖的package包/类
@Override
public ApiMetadata build() {
    return new GridFSApiMetadata(this);
}
 
开发者ID:mhurne,项目名称:jclouds-gridfs-blobstore,代码行数:5,代码来源:GridFSApiMetadata.java

示例12: fromApiMetadata

import org.jclouds.apis.ApiMetadata; //导入依赖的package包/类
@Override
public Builder fromApiMetadata(ApiMetadata in) {
	super.fromApiMetadata(in);
	return this;
}
 
开发者ID:timur-han,项目名称:orion-jclouds,代码行数:6,代码来源:OrionApiMetadata.java


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