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

Java LocationScope类代码示例

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

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



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

示例1: apply

import org.jclouds.domain.LocationScope; //导入依赖的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.LocationScope; //导入依赖的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.LocationScope; //导入依赖的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.LocationScope; //导入依赖的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: testShouldFetchHostMetadataWithoutDiscoverNodes

import org.jclouds.domain.LocationScope; //导入依赖的package包/类
@Test
public void testShouldFetchHostMetadataWithoutDiscoverNodes() {
    ComputeServiceBuilder mockComputeServiceBuilder = mock(ComputeServiceBuilder.class);
    JCloudsDiscoveryStrategy jCloudsDiscoveryStrategy = new JCloudsDiscoveryStrategy(mockComputeServiceBuilder);
    Set<NodeMetadata> nodes = new HashSet<NodeMetadata>();
    HashSet<String> privateAddresses = new HashSet<String>();
    privateAddresses.add(jCloudsDiscoveryStrategy.getLocalHostAddress());
    LocationImpl location = new LocationImpl(LocationScope.ZONE, "eu-west-1", "dummy", null, new ArrayList<String>(),
            new HashMap<String, Object>());
    nodes.add(new NodeMetadataImpl("", "", "dummy",
            location,
            null,
            new HashMap<String, String>(),
            new HashSet<String>(),
            null, null, null, null,
            NodeMetadata.Status.RUNNING, "",
            99999, privateAddresses, privateAddresses, null, "dummyHostName"));
    doReturn(nodes).when(mockComputeServiceBuilder).getFilteredNodes();

    Map<String, Object> localMetadata = jCloudsDiscoveryStrategy.discoverLocalMetadata();
    assertEquals(localMetadata.get(PARTITION_GROUP_HOST), "dummyHostName");
    assertEquals(localMetadata.get(PARTITION_GROUP_ZONE), "eu-west-1");
}
 
开发者ID:hazelcast,项目名称:hazelcast-jclouds,代码行数:24,代码来源:JCloudsDiscoveryStrategyTest.java


示例6: getClusters

import org.jclouds.domain.LocationScope; //导入依赖的package包/类
private Set<? extends Location> getClusters() {
   Set<Location> hosts = Sets.newHashSet();
   try (VSphereServiceInstance instance = serviceInstance.get();) {

      ManagedEntity[] clusterEntities = new InventoryNavigator(instance.getInstance().getRootFolder()).searchManagedEntities("ClusterComputeResource");

      for (ManagedEntity cluster : clusterEntities) {
         Location location = new LocationImpl(LocationScope.ZONE, cluster.getName(), cluster.getName(), null, ImmutableSet.of(""), Maps.<String, Object>newHashMap());
         hosts.add(location);
      }

      hosts.add(new LocationImpl(LocationScope.ZONE, "default", "default", null, ImmutableSet.of(""), Maps.<String, Object>newHashMap()));

      return hosts;
   } catch (Exception e) {
      logger.error("Problem in finding a valid cluster", e);
      Throwables.propagateIfPossible(e);
   }
   return hosts;
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:21,代码来源:VSphereLocationSupplier.java


示例7: setUp

import org.jclouds.domain.LocationScope; //导入依赖的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


示例8: listLocations

import org.jclouds.domain.LocationScope; //导入依赖的package包/类
@Override
public Set<? extends AssignableLocation> listLocations() {
  Set<AssignableLocation> locations = new HashSet<>();

  for (AssignableLocation location : delegate.listLocations()) {
    locations.add(location);
    if (location.getScope().equals(LocationScope.REGION)) {
      final Set<AssignableLocation> availabilityZones =
          new AvailabilityZoneSupplierForRegion(location).get();
      locations.addAll(availabilityZones);
      for (Location availabilityZone : availabilityZones) {
        locations.addAll(new HostSupplierForAvailabilityZone(availabilityZone).get());
      }
    }
  }
  return locations;
}
 
开发者ID:cloudiator,项目名称:sword,代码行数:18,代码来源:OpenstackComputeClientImpl.java


示例9: getRegion

import org.jclouds.domain.LocationScope; //导入依赖的package包/类
/**
 * Returns the region as string for the given {@link Location}.
 *
 * @param location the location
 *
 * @return the region or null if the region cannot be found
 */
private static String getRegion(Location location) {

   // Just to be safe
   if (location == null) {
      return null;
   }

   String region = null;
   while(region == null && location.getParent() != null) {
      if (location.getScope() == LocationScope.REGION) {
         region = location.getId();
      } else {
         location = location.getParent();
      }
   }
   return region;

}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:26,代码来源:MainApp.java


示例10: acceptLocation

import org.jclouds.domain.LocationScope; //导入依赖的package包/类
private boolean acceptLocation(Location location, Set<String> names, LocationScope scope) {
    if (names.isEmpty()) {
        return true;
    }

    while (location != null) {
        if (location.getScope() == scope && names.contains(location.getId())) {
            return true;
        }

        location = location.getParent();
    }

    return false;
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:16,代码来源:CloudSeedNodeProvider.java


示例11: list

import org.jclouds.domain.LocationScope; //导入依赖的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


示例12: apply

import org.jclouds.domain.LocationScope; //导入依赖的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


示例13: beforeClass

import org.jclouds.domain.LocationScope; //导入依赖的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


示例14: createContainerInLocation

import org.jclouds.domain.LocationScope; //导入依赖的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


示例15: apply

import org.jclouds.domain.LocationScope; //导入依赖的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


示例16: createRegionLocation

import org.jclouds.domain.LocationScope; //导入依赖的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


示例17: fetchMemberMetaData

import org.jclouds.domain.LocationScope; //导入依赖的package包/类
private void fetchMemberMetaData(NodeMetadata metadata) {
    Location location = metadata.getLocation();
    while (location != null) {
        String id = location.getId();
        if (location.getScope().equals(LocationScope.ZONE)) {
            if (id != null) {
                memberMetaData.put(PARTITION_GROUP_ZONE, id);
            }
        }
        location = location.getParent();
    }
    memberMetaData.put(PARTITION_GROUP_HOST, metadata.getHostname());
}
 
开发者ID:hazelcast,项目名称:hazelcast-jclouds,代码行数:14,代码来源:JCloudsDiscoveryStrategy.java


示例18: isNodeInsideZones

import org.jclouds.domain.LocationScope; //导入依赖的package包/类
public boolean isNodeInsideZones(NodeMetadata metadata) {
    Location location = metadata.getLocation();
    while (location != null) {
        String id = location.getId();
        if (location.getScope().equals(LocationScope.ZONE)) {
            if (id != null && !zonesSet.isEmpty() && !zonesSet.contains(id)) {
                return false;
            }
        }
        location = location.getParent();
    }
    return true;
}
 
开发者ID:hazelcast,项目名称:hazelcast-jclouds,代码行数:14,代码来源:ComputeServiceBuilder.java


示例19: isNodeInsideRegions

import org.jclouds.domain.LocationScope; //导入依赖的package包/类
public boolean isNodeInsideRegions(NodeMetadata metadata) {
    Location location = metadata.getLocation();
    while (location != null) {
        String id = location.getId();
        if (location.getScope().equals(LocationScope.REGION)) {
            if (id != null && !regionsSet.isEmpty() && !regionsSet.contains(id)) {
                return false;
            }
        }
        location = location.getParent();
    }
    return true;
}
 
开发者ID:hazelcast,项目名称:hazelcast-jclouds,代码行数:14,代码来源:ComputeServiceBuilder.java


示例20: test_isNodeInsideZones_when_zone_set_is_empty

import org.jclouds.domain.LocationScope; //导入依赖的package包/类
@Test
public void test_isNodeInsideZones_when_zone_set_is_empty() {
    ComputeServiceBuilder builder = new ComputeServiceBuilder(new HashMap<String, Comparable>());
    builder.buildRegionZonesConfig();

    assertTrue(builder.isNodeInsideZones(getRunningNodeMetaDataAtLocation(LocationScope.ZONE, "testZone")));
}
 
开发者ID:hazelcast,项目名称:hazelcast-jclouds,代码行数:8,代码来源:ComputeServiceBuilderTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java SPacketSetSlot类代码示例发布时间:2022-05-22
下一篇:
Java ResponseWaitingRoom类代码示例发布时间: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