Package org.jclouds.domain

Examples of org.jclouds.domain.Location


   private Location findLocationWithId(final String locationId) {
      if (locationId == null)
         return null;
      try {
         Location location = Iterables.find(locations.get(), new Predicate<Location>() {

            @Override
            public boolean apply(Location input) {
               return input.getId().equals(locationId);
            }
View Full Code Here


   private Location findLocationWithId(final String locationId) {
      if (locationId == null)
         return location.get();
      try {
         Location location = Iterables.find(locations.get(), new Predicate<Location>() {

            @Override
            public boolean apply(Location input) {
               return input.getId().equals(locationId);
            }

         });
         return location;

      } catch (NoSuchElementException e) {
         logger.debug("couldn't match instance location %s in: %s", locationId, locations.get());
         return location.get();
      }
   }
View Full Code Here

      return objectProvider.create(null);
   }

   @Override
   public ListenableFuture<String> getBucketLocation(String bucketName) {
      Location location = containerToLocation.get(bucketName);
      return immediateFuture(location.getId());
   }
View Full Code Here

   }

   @Override
   public Iterable<Location> listLocations() {
      Builder<Location> locations = ImmutableSet.builder();
      Location provider = getOnlyElement(locationSupplier.get());
      Set<String> zones = ImmutableSet.copyOf(filter(transform(nodes.get().asMap().values(),
               new Function<Node, String>() {

                  @Override
                  public String apply(Node arg0) {
View Full Code Here

      Set<String> addresses = addressesBuilder.build();

      builder.publicAddresses(filter(addresses, not(IsPrivateIPAddress.INSTANCE)));
      builder.privateAddresses(filter(addresses, IsPrivateIPAddress.INSTANCE));
      builder.hardware(parseHardware(instance));
      Location location = getLocationForAvailabilityZoneOrRegion(instance);
      builder.location(location);
      builder.imageId(instance.getRegion() + "/" + instance.getImageId());

      // extract the operating system from the image
      RegionAndName regionAndName = new RegionAndName(instance.getRegion(), instance.getImageId());
View Full Code Here

      this.hardwares = checkNotNull(hardwares, "hardwares");
   }

   @Override
   public NodeMetadata apply(ServerInZone serverInZone) {
      Location zone = locationIndex.get().get(serverInZone.getZone());
      checkState(zone != null, "location %s not in locationIndex: %s", serverInZone.getZone(), locationIndex.get());
      Server from = serverInZone.getServer();

      NodeMetadataBuilder builder = new NodeMetadataBuilder();
      builder.id(serverInZone.slashEncode());
View Full Code Here

            .<Location> of(region));
      Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of());
      Supplier<Set<? extends Hardware>> sizes = Suppliers.<Set<? extends Hardware>> ofInstance(ImmutableSet
            .<Hardware> of(c1_medium().build()));

      Location defaultLocation = createMock(Location.class);
      Provider<TemplateOptions> optionsProvider = createMock(Provider.class);
      Provider<TemplateBuilder> templateBuilderProvider = createMock(Provider.class);
      TemplateOptions defaultOptions = createMock(TemplateOptions.class);
      Image knownImage = createMock(Image.class);
      expect(knownImage.getId()).andReturn("region/ami").anyTimes();
      expect(knownImage.getProviderId()).andReturn("ami").anyTimes();
      expect(knownImage.getLocation()).andReturn(region).anyTimes();

      expect(defaultLocation.getId()).andReturn("region");
      expect(optionsProvider.get()).andReturn(defaultOptions);

      replay(knownImage);
      replay(defaultOptions);
      replay(defaultLocation);
View Full Code Here

      String group = this.group + "e";
      int volumeSize = 8;
     
      final Template template = view.getComputeService().templateBuilder().from(ebsTemplate).build();

      Location zone = Iterables.find(view.getComputeService().listAssignableLocations(), new Predicate<Location>() {

         @Override
         public boolean apply(Location arg0) {
            return arg0.getScope() == LocationScope.ZONE
                     && arg0.getParent().getId().equals(template.getLocation().getId());
         }

      });

      // create volume only to make a snapshot
      Volume volume = ebsClient.createVolumeInAvailabilityZone(zone.getId(), 4);
      Snapshot snapshot = ebsClient.createSnapshotInRegion(volume.getRegion(), volume.getId());
      ebsClient.deleteVolumeInRegion(volume.getRegion(), volume.getId());

      template.getOptions().as(EC2TemplateOptions.class)//
               // .unmapDeviceNamed("/dev/foo)
View Full Code Here

@Test(groups = "unit", singleThreaded = true, testName = "EC2CreateNodesInGroupThenAddToSetTest")
public class EC2CreateNodesInGroupThenAddToSetTest {

   @SuppressWarnings("unchecked")
   public void testIpAllocationThenAfterNodeRunningAssignThenUpdateCache() {
      Location location = ZONE_AP_SOUTHEAST_1A;
      String region = "ap-southeast-1";
      String zone = "ap-southeast-1a";

      String imageId = "ami1";
      String instanceCreatedId = "instance1";
View Full Code Here

      return virtualMachineTemplateToHardware;
   }

   private VirtualDatacenterToLocation virtualDatacenterToLocation() {
      VirtualDatacenterToLocation datacenterToLocation = EasyMock.createMock(VirtualDatacenterToLocation.class);
      Location location = EasyMock.createMock(Location.class);

      expect(location.getId()).andReturn("1");
      expect(location.getDescription()).andReturn("Mock Location");

      expect(datacenterToLocation.apply(anyObject(VirtualDatacenter.class))).andReturn(location);

      replay(location);
      replay(datacenterToLocation);
View Full Code Here

TOP

Related Classes of org.jclouds.domain.Location

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.