Package org.jclouds.domain

Examples of org.jclouds.domain.JsonBall


      userMetaDataIn = Maps.newHashMap();
      systemMetaDataIn = Maps.newHashMap();
      aclMetaDataIn = Lists.newArrayList();
      for (Map.Entry<String, JsonBall> entry : metadata.entrySet()) {
         String key = entry.getKey();
         JsonBall value = entry.getValue();
         if (key.startsWith("cdmi")) {
            if (key.matches("cdmi_acl")) {
               String[] cdmi_acl_array = value.toString().split("[{}]");
               for (int i = 0; i < cdmi_acl_array.length; i++) {
                  if (!(cdmi_acl_array[i].startsWith("[") || cdmi_acl_array[i].startsWith("]") || cdmi_acl_array[i]
                           .startsWith(","))) {
                     Map<String, String> aclMap = Maps.newHashMap();
                     String[] cdmi_acl_member = cdmi_acl_array[i].split(",");
                     for (String s : cdmi_acl_member) {
                        String cdmi_acl_key = s.substring(0, s.indexOf(":"));
                        String cdmi_acl_value = s.substring(s.indexOf(":") + 1);
                        cdmi_acl_value = cdmi_acl_value.replace('"', ' ').trim();
                        aclMap.put(cdmi_acl_key, cdmi_acl_value);
                     }
                     aclMetaDataIn.add(aclMap);
                  }
               }
            } else {
               systemMetaDataIn.put(key, value.toString().replace('"', ' ').trim());
            }
         } else {
            userMetaDataIn.put(key, value.toString().replace('"', ' ').trim());
         }
      }
   }
View Full Code Here


   @Override
   @Consumes(MediaType.APPLICATION_JSON)
   public Container expected() {
      return Container.builder().objectType("application/cdmi-container").objectID("00007E7F00102E230ED82694DAA975D2")
               .objectName("MyContainer/").parentURI("/")
               .metadata(ImmutableMap.<String, JsonBall> builder().put("cdmi_size", new JsonBall("\"83\"")).build())
               .children(ImmutableSet.<String> builder().add("MyDataObject.txt").build()).build();
   }
View Full Code Here

            .ips(ImmutableSet.<String> builder().add("37.153.96.62").add("10.224.0.63").build())
            .memorySizeMb(1024)
            .diskSizeGb(61440)
            .metadata(
                  ImmutableMap.<String, JsonBall> builder()
                        .put("root_authorized_keys", new JsonBall("ssh-rsa XXXXXX== test@xxxx.ovh.net\n")).build())
            .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-09T13:32:46+00:00"))
            .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-11T08:44:53+00:00")).build();
   }
View Full Code Here

            .ips(ImmutableSet. <String>builder().add("37.153.96.62").add("10.224.0.63").build())
            .memorySizeMb(1024)
            .diskSizeGb(61440)
            .metadata(
                  ImmutableMap.<String, JsonBall> builder()
                        .put("root_authorized_keys", new JsonBall("ssh-rsa XXXXXX== test@xxxx.ovh.net\n")).build())
            .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-09T13:32:46+00:00"))
            .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-11T08:44:53+00:00"))
            .build();
   }
View Full Code Here

                  .ips(ImmutableSet.<String> builder().add("37.153.96.62").add("10.224.0.63").build())
                  .memorySizeMb(1024)
                  .diskSizeGb(61440)
                  .metadata(
                        ImmutableMap.<String, JsonBall> builder()
                              .put("root_authorized_keys", new JsonBall("ssh-rsa XXXXXX== test@xxxx.ovh.net\n")).build())
                  .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-09T13:32:46+00:00"))
                  .updated(new SimpleDateFormatDateService().iso8601SecondsDateParse("2012-05-11T09:00:33+00:00"))
                  .build()
      );
   }
View Full Code Here

   public Statement apply(String group) {
      checkNotNull(group, "group");
      String validatorClientName = validatorName.get();
      PrivateKey validatorKey = validatorCredential.get();

      JsonBall bootstrapConfig = null;
      try {
         bootstrapConfig = bootstrapConfigForGroup.load(group);
      } catch (Exception e) {
         throw propagate(e);
      }
View Full Code Here

   public static class NullHackJsonBallAdapter extends NullHackJsonLiteralAdapter<JsonBall> {

      @Override
      protected JsonBall createJsonLiteralFromRawJson(String json) {
         return new JsonBall(json);
      }
View Full Code Here

      AsyncJob<?> expects = AsyncJob.builder()
         .id("860")
         .status(Status.IN_PROGRESS)
         .progress(0)
         .resultCode(ResultCode.SUCCESS)
         .result(ImmutableMap.of("foo", new JsonBall("{\"bar\":1}"), "foo2", new JsonBall("{\"bar2\":2}"))).build();

      ParseAsyncJobFromHttpResponse parser = i.getInstance(ParseAsyncJobFromHttpResponse.class);
      @SuppressWarnings("unchecked")
      AsyncJob<PublicIPAddress> response = (AsyncJob<PublicIPAddress>) parser.apply(HttpResponse.builder()
                                                                                                .statusCode(200).message("ok")
View Full Code Here

      userMetaDataIn = Maps.newHashMap();
      systemMetaDataIn = Maps.newHashMap();
      aclMetaDataIn = Lists.newArrayList();
      for (Map.Entry<String, JsonBall> entry : metadata.entrySet()) {
         String key = entry.getKey();
         JsonBall value = entry.getValue();
         if (key.startsWith("cdmi")) {
            if (key.matches("cdmi_acl")) {
               String[] cdmi_acl_array = value.toString().split("[{}]");
               for (int i = 0; i < cdmi_acl_array.length; i++) {
                  if (!(cdmi_acl_array[i].startsWith("[") || cdmi_acl_array[i].startsWith("]") || cdmi_acl_array[i]
                           .startsWith(","))) {
                     Map<String, String> aclMap = Maps.newHashMap();
                     String[] cdmi_acl_member = cdmi_acl_array[i].split(",");
                     for (String s : cdmi_acl_member) {
                        String cdmi_acl_key = s.substring(0, s.indexOf(":"));
                        String cdmi_acl_value = s.substring(s.indexOf(":") + 1);
                        cdmi_acl_value = cdmi_acl_value.replace('"', ' ').trim();
                        aclMap.put(cdmi_acl_key, cdmi_acl_value);
                     }
                     aclMetaDataIn.add(aclMap);
                  }
               }
            } else {
               systemMetaDataIn.put(key, value.toString().replace('"', ' ').trim());
            }
         } else {
            userMetaDataIn.put(key, value.toString().replace('"', ' ').trim());
         }
      }
   }
View Full Code Here

       *             The size of the message allowed in one message is configurable by your cloud provider. Consult
       *             your cloud provider documentation to learn the valid range.
       */
      public Builder body(String json) {
         checkNotNull(json, "body required");
         this.body = new JsonBall(json).toString();
         return self();
      }
View Full Code Here

TOP

Related Classes of org.jclouds.domain.JsonBall

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.