• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LocationBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: apply

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Override
public AssignableLocation apply(AvailabilityZone availabilityZone) {
  //todo: do we need to check the zone state?
  return new AssignableLocationImpl(new LocationBuilder().scope(LocationScope.ZONE)
      .id(RegionAndId.fromRegionAndId(region.getId(), availabilityZone.getName())
          .slashEncode()).parent(region).description(availabilityZone.getName())
      .build(), true);
}
 
开发者ID:cloudiator,项目名称:sword,代码行数:9,代码来源:OpenstackComputeClientImpl.java


示例17: createContainer

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
private void createContainer() throws IOException {
   // Ensure that the container exists
   Location location = new LocationBuilder().scope(LocationScope.REGION).id(REGION).description("region").build();
   if (!blobStore.containerExists(CONTAINER)) {
         blobStore.createContainerInLocation(location, CONTAINER);
      System.out.format("Created container in %s%n", REGION);
   }
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:9,代码来源:GenerateTempURL.java


示例18: testJCloudsMetadataTest

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Test
public void testJCloudsMetadataTest() throws IOException {
   String blobName = "myBlob";
   String containerName = (csBucket + "MetadataTest").toLowerCase();
   BlobStore blobStore = ((CloudStore) cl).getBlobStore();
      
   if (!blobStore.containerExists(containerName)) {
      Location location = new LocationBuilder().scope(LocationScope.REGION).description("test").id(csLocation).build();
      blobStore.createContainerInLocation(location, containerName);
      TestingUtil.sleepThread(10000);
   }

   String payload = "Hello world";
   Blob blob = blobStore.blobBuilder(blobName)
         .payload(payload)
         .contentLength(payload.length())
         .contentType(MediaType.OCTET_STREAM)
         .userMetadata(Collections.singletonMap("hello", "world"))
         .build();
   blobStore.putBlob(containerName, blob);

   blob = blobStore.getBlob(containerName, blobName);
   assertEquals(blob.getMetadata().getUserMetadata().get("hello"), "world");

   PageSet<? extends StorageMetadata> ps = blobStore.list(containerName, ListContainerOptions.Builder.withDetails());
   for (StorageMetadata sm : ps) {
      assertEquals(sm.getUserMetadata().get("hello"), "world");
   }
   
   blobStore.deleteContainer(containerName);
}
 
开发者ID:infinispan,项目名称:infinispan-cachestore-cloud,代码行数:32,代码来源:CloudCacheStoreIT.java


示例19: blobMetadata

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Override
public BlobMetadata blobMetadata(String container, String name) {
   OSS oss = api.getOSSClient(OSSApi.DEFAULT_REGION);
   String region = oss.getBucketLocation(container);
   oss = api.getOSSClient(region);
   OSSObject object = oss.getObject(container, name);
   Calendar time = Calendar.getInstance();
   time.set(Calendar.HOUR, time.get(Calendar.HOUR) + 1);
   Date expires = time.getTime();
   URL url = oss.generatePresignedUrl(container, name, expires);
   URI uri = null;
   try {
      uri = url.toURI();
   } catch (URISyntaxException e) {
      logger.warn(e, e.getMessage());
   }
   Location location = new LocationBuilder()
         .id(region)
         .scope(LocationScope.REGION)
         .description(region)
         .build();
   ContentMetadata cm = ContentMetadataBuilder.create()
         .expires(expires)
         .contentDisposition(object.getObjectMetadata().getContentDisposition())
         .contentEncoding(object.getObjectMetadata().getContentEncoding())
         .contentLength(object.getObjectMetadata().getContentLength())
         .contentType(object.getObjectMetadata().getContentType())
         .build();
   return new BlobMetadataImpl(
         object.getKey(),
         object.getKey(),
         location,
         uri,
         object.getObjectMetadata().getETag(),
         object.getObjectMetadata().getLastModified(),
         object.getObjectMetadata().getLastModified(),
         object.getObjectMetadata().getUserMetadata(),
         uri,
         object.getBucketName(),
         cm);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-jclouds,代码行数:42,代码来源:OSSBlobStore.java


示例20: start

import org.jclouds.domain.LocationBuilder; //导入依赖的package包/类
@Override
public void start() {
   key2StringMapper = Util.getInstance(configuration.key2StringMapper(), initializationContext.getCache()
         .getAdvancedCache().getClassLoader());
   key2StringMapper.setMarshaller(initializationContext.getMarshaller());

   ContextBuilder contextBuilder = ContextBuilder.newBuilder(configuration.provider()).credentials(configuration.identity(), configuration.credential());
   if(configuration.overrides() != null)
      contextBuilder.overrides(configuration.overrides());
   if(configuration.endpoint() != null && !configuration.endpoint().isEmpty())
      contextBuilder.endpoint(configuration.endpoint());

   blobStoreContext = contextBuilder.buildView(BlobStoreContext.class);

   blobStore = blobStoreContext.getBlobStore();
   String cacheName = configuration.normalizeCacheNames() ? 
         initializationContext.getCache().getName().replaceAll("[^a-zA-Z0-9-]", "-") 
         : initializationContext.getCache().getName();
   containerName = String.format("%s-%s", configuration.container(), cacheName);

   if (!blobStore.containerExists(containerName)) {
      Location location = null;
      if (configuration.location() != null ) {
         location = new LocationBuilder()
            .scope(LocationScope.REGION)
            .id(configuration.location())
            .description(String.format("Infinispan cache store for %s", containerName))
            .build();
      }
      blobStore.createContainerInLocation(location, containerName);

      //make sure container is created
      if(!blobStore.containerExists(containerName)) {
         try {
            log.waitingForContainer();
            TimeUnit.SECONDS.sleep(10);
         } catch (InterruptedException e) {
            throw new PersistenceException(String.format("Aborted when creating blob container %s", containerName));
         }
         if(!blobStore.containerExists(containerName)) {
            throw new PersistenceException(String.format("Unable to create blob container %s", containerName));
         }
      }
   }
}
 
开发者ID:infinispan,项目名称:infinispan-cachestore-cloud,代码行数:46,代码来源:CloudStore.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XmlUtils类代码示例发布时间:2022-05-22
下一篇:
Java DatabaseMetaDataCallback类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap