Package org.jclouds.domain

Examples of org.jclouds.domain.LocationBuilder


      }
     
      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


                                                                    .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

      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

     * @param json the JSON that should represent a location
     *
     * @return the location
     */
    private Location buildLocationFromJSON(JSONObject json) {
        LocationBuilder builder = new LocationBuilder();
        Set<String> iso3166Codes = new HashSet<>();
        Map<String, Object> metadata = new HashMap<>();

        if (json.containsKey("iso3166Codes")) {
            for (Object rawCode : json.getJSONArray("iso3166Codes")) {
                iso3166Codes.add((String)rawCode);
            }
        }

        if (json.containsKey("metadata")) {
            JSONObject rawMetadata = json.getJSONObject("metadata");

            for (Object rawKey : rawMetadata.keySet()) {
                metadata.put((String)rawKey, rawMetadata.get(rawKey));
            }
        }


        builder.description(json.containsKey("description") ? json.getString("description") : null)
               .iso3166Codes(iso3166Codes)
               .id(json.containsKey("id") ? json.getString("id") : null)
               .scope(json.containsKey("scope") ? LocationScope.valueOf(json.getString("scope")) : null)
               .metadata(metadata);

        return builder.build();
    }
View Full Code Here

        BlobStore s3BlobStore = getBlobStoreContext().getBlobStore();
        String bucketName = convertOutboundConnectionToBucketName(outboundConfiguration);

        Location location = null;
        if (StringUtils.hasText(outboundConfiguration.getDestination())) {
            LocationBuilder builder = new LocationBuilder();
            builder.id(outboundConfiguration.getDestination());
            builder.scope(LocationScope.REGION);
            builder.description(outboundConfiguration.getDestination());

            location = builder.build();
        }

        s3BlobStore.createContainerInLocation(location ,bucketName); //defaults to us-standard if location is null
        return bucketName;
    }
View Full Code Here

     * @throws Exception if anything goes wrong
     */
    @Test
    public void testBucketsInEURegion() throws Exception {
        BlobStore store = awsClient.getBlobStoreContext().getBlobStore();
        LocationBuilder lb = new LocationBuilder();
        String bucketName = "euregiontest" + new Date().getTime();
        StorageMetadata bucket = null;

        try {
            lb.id(Region.EU_WEST_1)
              .scope(LocationScope.REGION)
              .description("Superfluous description to appease jclouds.");

            store.createContainerInLocation(lb.build(), bucketName);

            for (StorageMetadata sm : store.list()) {
                if (sm.getName().equals(bucketName)) {
                    bucket = sm;
                    break;
View Full Code Here

      expect(server.getName()).andReturn("group-ff").atLeastOnce();
      expect(server.getState()).andReturn(ServerState.ON).atLeastOnce();

      expect(serverStateToNodeStatus.get(ServerState.ON)).andReturn(Status.RUNNING);

      Location location = new LocationBuilder().scope(LocationScope.ZONE).id("1").description("US-West-1").build();
      Set< ? extends Location> locations = ImmutableSet.< Location> of( location);
     
      expect(server.getIp()).andReturn(Ip.builder().ip("127.0.0.1").build());

      ServerImage image = createMock(ServerImage.class);
View Full Code Here

* @author Adrian Cole
*/
@Test(singleThreaded = true, testName = "NodeToNodeMetadataTest")
public class NodeToNodeMetadataTest {
   public static Location expectedProviderLocationFromResource(String resource) {
      return new LocationBuilder().scope(LocationScope.PROVIDER).id("byon").description(resource).build();
   }
View Full Code Here

   public static Location expectedProviderLocationFromResource(String resource) {
      return new LocationBuilder().scope(LocationScope.PROVIDER).id("byon").description(resource).build();
   }

   public static Location zoneCalled(String zone, Location parent) {
      return new LocationBuilder().scope(LocationScope.ZONE).id(zone).description(zone).parent(parent).build();
   }
View Full Code Here

            }

         }));
      } catch (NoSuchElementException e) {
         logger.error("unknown region %s for image %s; not in %s", from.getRegion(), from.getId(), locations);
         builder.location(new LocationBuilder().scope(LocationScope.REGION).id(from.getRegion()).description(
                  from.getRegion()).parent(defaultLocation.get()).build());
      }
      builder.operatingSystem(osBuilder.build());
      builder.status(toPortableImageStatus.get(from.getImageState()));
      builder.backendStatus(from.getRawState());
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.