Package org.jclouds.atmos.domain

Examples of org.jclouds.atmos.domain.AtmosObject


public class AtmosObjectName implements Function<Object, String> {
   @Override
   public String apply(Object input) {
      checkArgument(checkNotNull(input, "input") instanceof AtmosObject,
            "this function is only valid for AtmosObjects!");
      AtmosObject object = AtmosObject.class.cast(input);

      return checkNotNull(object.getContentMetadata().getName() != null ? object.getContentMetadata().getName()
            : object.getSystemMetadata().getObjectName(), "objectName");
   }
View Full Code Here


   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object input) {
      checkArgument(checkNotNull(input, "input") instanceof AtmosObject, "this binder is only valid for AtmosObject!");
      checkNotNull(request, "request");

      AtmosObject object = AtmosObject.class.cast(input);
      checkNotNull(object.getPayload(), "object payload");
      checkArgument(object.getPayload().getContentMetadata().getContentLength() != null,
            "contentLength must be set, streaming not supported");
      byte[] contentMD5 = object.getContentMetadata().getContentMD5();
      if (contentMD5 != null) {
         request = (R) request.toBuilder()
               .addHeader(AtmosHeaders.CHECKSUM, "MD5/0/" +
                     BaseEncoding.base16().encode(contentMD5))
               .build();
      }
      return metaBinder.bindToRequest(request, object.getUserMetadata());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.atmos.domain.AtmosObject

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.