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


Java LocationBuilder类代码示例

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


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

示例1: apply

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Override
public NodeMetadata apply(Instance input) {
   NodeMetadataBuilder builder = new NodeMetadataBuilder();
   builder.id(api.encodeToId(input.getRegionId(), input.getInstanceId()));
   builder.providerId(input.getInstanceId());
   builder.name(input.getInstanceName());
   builder.group(input.getRegionId());
   builder.status(status.get(input.getStatus()));
   builder.imageId(input.getImageId());
   Hardware hardware = new HardwareBuilder()
         .id(input.getInstanceType())
         .build();
   builder.hardware(hardware);
   Location location = new LocationBuilder()
         .scope(LocationScope.REGION)
         .id(input.getRegionId())
         .description(input.getRegionId())
         .build();
   builder.location(location);
   builder.publicAddresses(input.getPublicIpAddress());
   builder.privateAddresses(input.getInnerIpAddress());
   return builder.build();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:24,代码来源:InstanceToNodeMetadata.java

示例2: getLoadBalancer

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Override
public LoadBalancerMetadata getLoadBalancer(String id) {
   IAcsClient client = api.getAcsClient(SLBApi.DEFAULT_REGION);
   DescribeLoadBalancerAttributeRequest req = new DescribeLoadBalancerAttributeRequest();
   req.setLoadBalancerId(id);
   LoadBalancerMetadata lbm = null;
   try {
      DescribeLoadBalancerAttributeResponse resp = client.getAcsResponse(req);
      LocationBuilder location = new LocationBuilder()
            .scope(LocationScope.REGION)
            .id(resp.getRegionId())
            .description(resp.getRegionId());
      lbm = new LoadBalancerMetadataImpl(
            loadBalancerTypes.get(resp.getAddressType()),
            resp.getLoadBalancerId(),
            resp.getLoadBalancerName(),
            resp.getLoadBalancerId(),
            location.build(),
            null,
            ImmutableMap.<String, String>builder().build(),
            ImmutableSet.<String> builder().add(resp.getAddress()).build());
   } catch (Exception e) {
      logger.warn(e.getMessage());
   }
   return lbm;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:27,代码来源:SLBLoadBalancerServiceAdapter.java

示例3: apply

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Override
public LoadBalancerMetadata apply(LoadBalancer input) {
   DescribeLoadBalancerAttributeRequest req = new DescribeLoadBalancerAttributeRequest();
   req.setLoadBalancerId(input.getLoadBalancerId());
   DescribeLoadBalancerAttributeResponse resp = null;
   try {
      resp = client.getAcsResponse(req);
   } catch (Exception e) {
      logger.warn(e.getMessage());
   }
   LocationBuilder location = new LocationBuilder()
         .scope(LocationScope.REGION)
         .id(resp.getRegionId())
         .description(resp.getRegionId());
   return new LoadBalancerMetadataImpl(
         loadBalancerTypes.get(resp.getAddressType()),
         input.getLoadBalancerId(),
         input.getLoadBalancerName(),
         input.getLoadBalancerId(),
         location.build(),
         null,
         ImmutableMap.<String, String>builder().build(),
         ImmutableSet.<String> builder().add(resp.getAddress()).build());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:25,代码来源:LoadBalancerToLoadBalancerMetadata.java

示例4: beforeClass

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@BeforeClass
public void beforeClass() {
   LocationBuilder location = new LocationBuilder()
         .scope(LocationScope.REGION)
         .id(testRegion)
         .description(testRegion);
   Set<NodeMetadata> nodes = ImmutableSet.<NodeMetadata> builder()
         .add(new NodeMetadataBuilder()
               .status(Status.RUNNING)
               .id("cn-hangzhou:i-233ehfkdv")
               .build())
         .build();
   lbm = loadBalancerService
         .createLoadBalancerInLocation(
               location.build(),
               testLoadBalancer,
               "http", 80, 80, nodes);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:19,代码来源:SLBTest.java

示例5: setUp

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Before
public void setUp(){
    indexShardRepository = mock(BlobStoreIndexShardRepository.class);
    cloudFilesService = mock(CloudFilesService.class);

    RegionScopedBlobStoreContext blobStoreContext = mock(RegionScopedBlobStoreContext.class);

    BlobStore blobStore = mock(BlobStore.class);
    Set<Location> locations = new HashSet<Location>();
    Set<String> isoCodes = new HashSet<String>();
    isoCodes.add("US-IL");
    locations.add(new LocationBuilder().id("ORD").description("ORD").scope(LocationScope.REGION).iso3166Codes(isoCodes).build());
    when(blobStore.listAssignableLocations()).thenReturn((Set) locations);

    when(blobStoreContext.getBlobStore(anyString())).thenReturn(blobStore);

    when(cloudFilesService.context()).thenReturn(blobStoreContext);
}
 
开发者ID:jlinn,项目名称:elasticsearch-cloud-rackspace,代码行数:19,代码来源:CloudFilesRepositoryTest.java

示例6: list

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Override
public PageSet<? extends StorageMetadata> list() {
   OSS oss = api.getOSSClient(OSSApi.DEFAULT_REGION);
   PageSetImpl<StorageMetadata> pageSet = new PageSetImpl<StorageMetadata>(
         transform(oss.listBuckets(), new Function<Bucket, StorageMetadata>() {
               @Override
               public StorageMetadata apply(Bucket input) {
                  String bucketLocation = input.getLocation();
                  Location location = new LocationBuilder()
                        .id(bucketLocation)
                        .scope(LocationScope.REGION)
                        .description(bucketLocation)
                        .build();
                  StorageMetadata storageMetadata = new StorageMetadataImpl(
                        StorageType.CONTAINER,
                        input.getName(),
                        input.getName(),
                        location,
                        null,
                        null,
                        input.getCreationDate(),
                        input.getCreationDate(),
                        ImmutableMap.<String, String>builder().build(),
                        0L);
                  return storageMetadata;
               }
            }), null);
   return pageSet;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:30,代码来源:OSSBlobStore.java

示例7: apply

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Override
public Location apply(String input) {
   LocationBuilder builder = new LocationBuilder();
   builder.scope(LocationScope.REGION);
   builder.id(input);
   builder.description(input);
   return builder.build();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:9,代码来源:RegionToLocation.java

示例8: beforeClass

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@BeforeClass
public void beforeClass() {
   LocationBuilder location = new LocationBuilder()
         .scope(LocationScope.REGION)
         .id(testRegion)
         .description(testRegion);
   blobStore.createContainerInLocation(
         location.build(), testBucket);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:10,代码来源:OSSTest.java

示例9: createContainerInLocation

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Test
public void createContainerInLocation() {
   LocationBuilder location = new LocationBuilder()
         .scope(LocationScope.REGION)
         .id(testRegion)
         .description(testRegion);
   blobStore.createContainerInLocation(location.build(), "bucket-to-delete", CreateContainerOptions.NONE);
   blobStore.createDirectory("bucket-to-delete", "test-directory");
   blobStore.clearContainer("bucket-to-delete");
   blobStore.deleteContainerIfEmpty("bucket-to-delete");
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:12,代码来源:OSSTest.java

示例10: apply

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Override
public Location apply(final Datacenter datacenter) {
    return new LocationBuilder()
            .id(datacenter.id())
            .description(datacenter.displayName())
            .parent(getOnlyElement(justProvider.get()))
            .scope(LocationScope.ZONE)
            .iso3166Codes(ImmutableSet.of(datacenter.country()))
            .metadata(ImmutableMap.<String, Object>of("name", datacenter.displayName()))
            .build();
}
 
开发者ID:cloudsoft,项目名称:amp-dimensiondata,代码行数:12,代码来源:DatacenterToLocation.java

示例11: createRegionLocation

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
private static Location createRegionLocation( BlobStoreProperties config, Location provider )
{
    return config.location != null ?
        new LocationBuilder()
            .scope( LocationScope.REGION )
            .id( config.location )
            .description( config.location )
            .parent( provider )
            .build() : null;
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:11,代码来源:JCloudsAppStorageService.java

示例12: getRunningNodeMetaDataAtLocation

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
private NodeMetadata getRunningNodeMetaDataAtLocation(LocationScope scope, String id) {
    Location location = new LocationBuilder()
            .scope(scope)
            .id(id)
            .description("desc")
            .build();
    return new NodeMetadataBuilder()
            .location(location)
            .id(newSecureUuidString())
            .status(NodeMetadata.Status.RUNNING)
            .build();
}
 
开发者ID:hazelcast,项目名称:hazelcast-jclouds,代码行数:13,代码来源:ComputeServiceBuilderTest.java

示例13: CloudFilesRepository

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Inject
protected CloudFilesRepository(String repositoryName, RepositorySettings repositorySettings, IndexShardRepository indexShardRepository, CloudFilesService cloudFilesService) {
    super(repositoryName, repositorySettings, indexShardRepository);

    final String container = repositorySettings.settings().get("container", componentSettings.get("container"));
    if(container == null || container.equals("")){
        throw new RepositoryException(repositoryName, "No container defined for cloud files gateway.");
    }

    final String dataCenter = repositorySettings.settings().get("region", componentSettings.get("region", "ORD"));
    final int concurrentStreams = repositorySettings.settings().getAsInt("concurrent_streams", componentSettings.getAsInt("concurrent_streams", 5));
    ExecutorService concurrentStreamPool = EsExecutors.newScaling(1, concurrentStreams, 5, TimeUnit.SECONDS, EsExecutors.daemonThreadFactory(settings, "[cloudfiles_stream]"));
    final Location location = new LocationBuilder()
            .scope(LocationScope.REGION)
            .id(dataCenter)
            .description(String.format("Rackspace's %s datacenter.", dataCenter))
            .build();

    blobStore = new CloudFilesBlobStore(settings, cloudFilesService.context(), container, location, concurrentStreamPool);
    this.chunkSize = repositorySettings.settings().getAsBytesSize("chunk_size", componentSettings.getAsBytesSize("chunk_size", new ByteSizeValue(100, ByteSizeUnit.MB)));
    this.compress = repositorySettings.settings().getAsBoolean("compress", componentSettings.getAsBoolean("compress", false));
    logger.debug("using container [{}], data center [{}], chunk_size [{}], concurrent_streams [{}]", container, dataCenter, chunkSize, concurrentStreams);
    String basePath = repositorySettings.settings().get("base_path", null);
    if (Strings.hasLength(basePath)) {
        BlobPath path = new BlobPath();
        for(String elem : Strings.splitStringToArray(basePath, '/')) {
            path = path.add(elem);
        }
        this.basePath = path;
    } else {
        this.basePath = BlobPath.cleanPath();
    }
}
 
开发者ID:jlinn,项目名称:elasticsearch-cloud-rackspace,代码行数:34,代码来源:CloudFilesRepository.java

示例14: location

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
public synchronized Location location(){
    if(location != null){
        return location;
    }

    final String dataCenter = componentSettings.get("region", "ORD");

    location = new LocationBuilder().scope(LocationScope.REGION).id(dataCenter).description("A Rackspace data center.").build();

    return location;
}
 
开发者ID:jlinn,项目名称:elasticsearch-cloud-rackspace,代码行数:12,代码来源:CloudFilesService.java

示例15: setUp

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
    settings = SettingsLoader.getSettingsFromResource("/elasticsearch.yml");

    String account = settings.get("rackspace.account");
    String key = settings.get("rackspace.key");
    blobStoreContext = ContextBuilder.newBuilder("rackspace-cloudfiles-us").credentials(account, key)
            .buildView(RegionScopedBlobStoreContext.class);
    location = new LocationBuilder().scope(LocationScope.REGION).id("ORD").description("ORD").build();
}
 
开发者ID:jlinn,项目名称:elasticsearch-cloud-rackspace,代码行数:11,代码来源:AbstractBlobStoreTest.java


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