Package org.jclouds.domain

Examples of org.jclouds.domain.LocationBuilder


   @Override
   public Location apply(Network from) {
      Matcher matcher = netPattern.matcher(from.getHref().toASCIIString());
      if (matcher.find()) {
         Location provider = new LocationBuilder().scope(LocationScope.PROVIDER).id(providerName).description(
                  endpoint.get().toASCIIString()).iso3166Codes(isoCodes).build();

         Org org = api.getBrowsingApi().getOrg(matcher.group(1));

         Location orgLocation = new LocationBuilder().scope(LocationScope.REGION).id(org.getId()).description(
                  org.getDescription()).parent(provider).build();

         VDC vdc = api.getBrowsingApi().getVDCInOrg(org.getId(), matcher.group(2));

         Location vdcLocation = new LocationBuilder().scope(LocationScope.ZONE).id(vdc.getId()).description(
                  vdc.getDescription()).parent(orgLocation).build();

         return new LocationBuilder().scope(LocationScope.NETWORK).id(from.getId()).description(from.getName()).parent(
                  vdcLocation).build();
      } else {
         throw new IllegalArgumentException("network unparsable: " + from);
      }
View Full Code Here


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

   @Override
   public Location apply(SmartOSHostController from) {
      return new LocationBuilder().scope(LocationScope.ZONE).id(from.getHostname() + "")
               .description(from.getDescription()).parent(provider.get().get()).build();
   }
View Full Code Here

      for (VSystem system : api.getVirtualDCApi().listVirtualSystems()) {

         VSystemWithDetails systemWithDetails = api.getVirtualSystemApi().getDetails(system.getId());

         Location systemLocation = new LocationBuilder().scope(LocationScope.SYSTEM)
               .parent(Iterables.getOnlyElement(regionProvider.get())).description(system.getName()).id(system.getId())
               .build();

         for (VNet net : systemWithDetails.getNetworks()) {

            locations.add(new LocationBuilder().scope(LocationScope.NETWORK).parent(systemLocation)
                  .description(net.getNetworkId().replaceFirst(".+-N-", "")).id(net.getNetworkId())
                  .build());
         }
      }
View Full Code Here

                                                                    .description(System.getProperty("os.name"))
                                                                    .arch(System.getProperty("os.arch"))
                                                                    .version(System.getProperty("os.version"))
                                                                    .build())
                                    .status(Status.RUNNING)
                                    .location(new LocationBuilder().id(HOST_ID)
                                                                   .scope(LocationScope.HOST)
                                                                   .description(HOSTNAME)
                                                                   .build())
                                    .credentials(LoginCredentials.builder()
                                        .user(System.getProperty("user.name"))
View Full Code Here

      }
     
      NodeMetadataBuilder nodeMetadataBuilder = new NodeMetadataBuilder();
      nodeMetadataBuilder.name(name).ids(vm.getName()).group(group);
      // TODO Set up location properly
      LocationBuilder locationBuilder = new LocationBuilder();
      locationBuilder.description("");
      locationBuilder.id("");
      locationBuilder.scope(LocationScope.HOST);
      nodeMetadataBuilder.location(locationBuilder.build());
      nodeMetadataBuilder.hostname(vm.getName());

      MachineState vmState = vm.getState();
      NodeMetadata.Status nodeState = toPortableNodeStatus.get(vmState);
      if (nodeState == null)
View Full Code Here

*/
public class ZoneToLocation implements Function<Zone, Location> {

   @Override
   public Location apply(Zone input) {
      return new LocationBuilder()
              .description(input.getDescription().orNull())
              .metadata(ImmutableMap.of("selfLink", (Object) checkNotNull(input.getSelfLink(), "zone URI")))
              .id(input.getName())
              .scope(LocationScope.ZONE)
              .parent(GOOGLE_PROVIDER_LOCATION)
View Full Code Here

   public ListenableFuture<Boolean> putBucketInRegion(@Nullable String region, String name,
            PutBucketOptions... optionsList) {
      region = region == null ? Region.US_STANDARD : region;
      final PutBucketOptions options = (optionsList.length == 0) ? new PutBucketOptions() : optionsList[0];
      keyToAcl.put(name, options.getAcl());
      return blobStore.createContainerInLocation(new LocationBuilder().scope(LocationScope.REGION).id(region)
               .description(region).build(), name);
   }
View Full Code Here

               }), Predicates.notNull()));
      if (zones.size() == 0)
         return locations.add(provider).build();
      else
         for (String zone : zones) {
            locations.add(new LocationBuilder().scope(LocationScope.ZONE).id(zone).description(zone).parent(provider)
                     .build());
         }
      return locations.build();
   }
View Full Code Here

      NodeMetadataBuilder builder = new NodeMetadataBuilder();
      builder.id(serverInZone.slashEncode());
      builder.providerId(from.getId());
      builder.name(from.getName());
      builder.hostname(from.getName());
      builder.location(from.getHostId() != null ? new LocationBuilder().scope(LocationScope.HOST).id(from.getHostId())
            .description(from.getHostId()).parent(zone).build() : zone);
      addMetadataAndParseTagsFromCommaDelimitedValue(builder, from.getMetadata());
      builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getName()));
      builder.imageId(ZoneAndId.fromZoneAndId(serverInZone.getZone(), from.getImage().getId()).slashEncode());
      builder.operatingSystem(findOperatingSystemForServerOrNull(serverInZone));
View Full Code Here

   public NodeMetadata apply(Server from) {
      NodeMetadataBuilder builder = new NodeMetadataBuilder();
      builder.ids(from.getId() + "");
      builder.name(from.getName());
      builder.hostname(from.getName());
      builder.location(new LocationBuilder().scope(LocationScope.HOST).id(from.getHostId()).description(
               from.getHostId()).parent(location.get()).build());
      addMetadataAndParseTagsFromCommaDelimitedValue(builder, from.getMetadata());
      builder.group(nodeNamingConvention.groupInUniqueNameOrNull(from.getName()));
      builder.imageId(from.getImageId() + "");
      builder.operatingSystem(parseOperatingSystem(from));
View Full Code Here

TOP

Related Classes of org.jclouds.domain.LocationBuilder

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.