Package org.jclouds.openstack.swift.domain.internal

Examples of org.jclouds.openstack.swift.domain.internal.MutableObjectInfoWithMetadataImpl


public class ResourceToObjectInfo implements Function<StorageMetadata, MutableObjectInfoWithMetadata> {

   public MutableObjectInfoWithMetadata apply(StorageMetadata from) {
      if (from == null)
         return null;
      MutableObjectInfoWithMetadata to = new MutableObjectInfoWithMetadataImpl();
      if (from.getType() == StorageType.BLOB) {
         to.setContentType(((BlobMetadata) from).getContentMetadata().getContentType());
         to.setBytes(((BlobMetadata) from).getContentMetadata().getContentLength());
         to.setHash(((BlobMetadata) from).getContentMetadata().getContentMD5());
      } else if (from.getType() == StorageType.RELATIVE_PATH) {
         to.setContentType("application/directory");
      }
      if (from.getETag() != null && to.getHash() == null)
         to.setHash(base16().lowerCase().decode(from.getETag()));
      to.setName(from.getName());
      to.setLastModified(from.getLastModified());
      if (from.getUserMetadata() != null) {
         for (Entry<String, String> entry : from.getUserMetadata().entrySet())
            to.getMetadata().put(entry.getKey().toLowerCase(), entry.getValue());
      }
      return to;
   }
View Full Code Here


public class ResourceToObjectInfo implements Function<StorageMetadata, MutableObjectInfoWithMetadata> {

   public MutableObjectInfoWithMetadata apply(StorageMetadata from) {
      if (from == null)
         return null;
      MutableObjectInfoWithMetadata to = new MutableObjectInfoWithMetadataImpl();
      if (from.getType() == StorageType.BLOB) {
         to.setContentType(((BlobMetadata) from).getContentMetadata().getContentType());
         to.setBytes(((BlobMetadata) from).getContentMetadata().getContentLength());
         to.setHash(((BlobMetadata) from).getContentMetadata().getContentMD5());
      } else if (from.getType() == StorageType.RELATIVE_PATH) {
         to.setContentType("application/directory");
      }
      if (from.getETag() != null && to.getHash() == null)
         to.setHash(ETagUtils.convertHexETagToByteArray(from.getETag()));
      to.setName(from.getName());
      to.setLastModified(from.getLastModified());
      if (from.getUserMetadata() != null) {
         for (Entry<String, String> entry : from.getUserMetadata().entrySet())
            to.getMetadata().put(entry.getKey().toLowerCase(), entry.getValue());
      }
      return to;
   }
View Full Code Here

public class ResourceToObjectInfo implements Function<StorageMetadata, MutableObjectInfoWithMetadata> {

   public MutableObjectInfoWithMetadata apply(StorageMetadata from) {
      if (from == null)
         return null;
      MutableObjectInfoWithMetadata to = new MutableObjectInfoWithMetadataImpl();
      if (from.getType() == StorageType.BLOB) {
         to.setContentType(((BlobMetadata) from).getContentMetadata().getContentType());
         to.setBytes(((BlobMetadata) from).getContentMetadata().getContentLength());
         to.setHash(((BlobMetadata) from).getContentMetadata().getContentMD5());
      } else if (from.getType() == StorageType.RELATIVE_PATH) {
         to.setContentType("application/directory");
      }
      if (from.getETag() != null && to.getHash() == null)
         to.setHash(ETagUtils.convertHexETagToByteArray(from.getETag()));
      to.setName(from.getName());
      to.setLastModified(from.getLastModified());
      if (from.getUserMetadata() != null) {
         for (Entry<String, String> entry : from.getUserMetadata().entrySet())
            to.getMetadata().put(entry.getKey().toLowerCase(), entry.getValue());
      }
      return to;
   }
View Full Code Here

public class ResourceToObjectInfo implements Function<StorageMetadata, MutableObjectInfoWithMetadata> {

   public MutableObjectInfoWithMetadata apply(StorageMetadata from) {
      if (from == null)
         return null;
      MutableObjectInfoWithMetadata to = new MutableObjectInfoWithMetadataImpl();
      if (from.getType() == StorageType.BLOB) {
         to.setContentType(((BlobMetadata) from).getContentMetadata().getContentType());
         to.setBytes(((BlobMetadata) from).getContentMetadata().getContentLength());
         to.setHash(((BlobMetadata) from).getContentMetadata().getContentMD5());
      } else if (from.getType() == StorageType.RELATIVE_PATH) {
         to.setContentType("application/directory");
      }
      if (from.getETag() != null && to.getHash() == null)
         to.setHash(base16().lowerCase().decode(from.getETag()));
      to.setName(from.getName());
      to.setLastModified(from.getLastModified());
      if (from.getUserMetadata() != null) {
         for (Entry<String, String> entry : from.getUserMetadata().entrySet())
            to.getMetadata().put(entry.getKey().toLowerCase(), entry.getValue());
      }
      return to;
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.swift.domain.internal.MutableObjectInfoWithMetadataImpl

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.