Examples of ObjectApi


Examples of org.jclouds.openstack.swift.v1.features.ObjectApi

      return list(container, ListContainerOptions.NONE);
   }

   @Override
   public PageSet<? extends StorageMetadata> list(final String container, ListContainerOptions options) {
      ObjectApi objectApi = api.objectApiInRegionForContainer(region.getId(), container);
      ObjectList objects = objectApi.list(toListContainerOptions.apply(options));
      if (objects == null) {
         containerCache.put(container, Optional.<Container> absent());
         return new PageSetImpl<StorageMetadata>(ImmutableList.<StorageMetadata> of(), null);
      } else {
         containerCache.put(container, Optional.of(objects.container()));
View Full Code Here

Examples of org.jclouds.openstack.swift.v1.features.ObjectApi

   @Override
   public String putBlob(String container, Blob blob, PutOptions options) {
      if (options.isMultipart()) {
         throw new UnsupportedOperationException();
      }
      ObjectApi objectApi = api.objectApiInRegionForContainer(region.getId(), container);
      return objectApi.replace(blob.getMetadata().getName(), blob.getPayload(), blob.getMetadata().getUserMetadata());
   }
View Full Code Here

Examples of org.jclouds.openstack.swift.v1.features.ObjectApi

      return getBlob(container, key, GetOptions.NONE);
   }

   @Override
   public Blob getBlob(String container, String name, GetOptions options) {
      ObjectApi objectApi = api.objectApiInRegionForContainer(region.getId(), container);
      SwiftObject object = objectApi.get(name, toGetOptions.apply(options));
      if (object == null) {
         return null;
      }
      Blob blob = new BlobImpl(toBlobMetadata(container).apply(object));
      blob.setPayload(object.payload());
View Full Code Here

Examples of org.jclouds.openstack.swift.v1.features.ObjectApi

      return list(container, ListContainerOptions.NONE);
   }

   @Override
   public PageSet<? extends StorageMetadata> list(final String container, ListContainerOptions options) {
      ObjectApi objectApi = api.getObjectApiForRegionAndContainer(regionId, container);
      ObjectList objects = objectApi.list(toListContainerOptions.apply(options));
      if (objects == null) {
         containerCache.put(container, Optional.<Container> absent());
         return new PageSetImpl<StorageMetadata>(ImmutableList.<StorageMetadata> of(), null);
      } else {
         containerCache.put(container, Optional.of(objects.getContainer()));
View Full Code Here

Examples of org.jclouds.openstack.swift.v1.features.ObjectApi

   @Override
   public String putBlob(String container, Blob blob, PutOptions options) {
      if (options.isMultipart()) {
         throw new UnsupportedOperationException();
      }
      ObjectApi objectApi = api.getObjectApiForRegionAndContainer(regionId, container);
      return objectApi.put(blob.getMetadata().getName(), blob.getPayload(), metadata(blob.getMetadata().getUserMetadata()));
   }
View Full Code Here

Examples of org.jclouds.openstack.swift.v1.features.ObjectApi

      return getBlob(container, key, GetOptions.NONE);
   }

   @Override
   public Blob getBlob(String container, String name, GetOptions options) {
      ObjectApi objectApi = api.getObjectApiForRegionAndContainer(regionId, container);
      SwiftObject object = objectApi.get(name, toGetOptions.apply(options));
      if (object == null) {
         return null;
      }
      Blob blob = new BlobImpl(toBlobMetadata(container).apply(object));
      blob.setPayload(object.getPayload());
View Full Code Here

Examples of org.jclouds.openstack.swift.v1.features.ObjectApi

   public void testPurgeObject() throws Exception {
      for (String regionId : regions) {
         String objectName = "testPurge";
         Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(new byte[] {1, 2, 3}));
         ObjectApi objectApi = api.getObjectApiForRegionAndContainer(regionId, name);
        
         // create a new object
         objectApi.put(objectName, payload);
        
         CDNApi cdnApi = api.getCDNApiForRegion(regionId);
         assertTrue(cdnApi.purgeObject(name, "testPurge", ImmutableList.<String>of()));
        
         // delete the object
         objectApi.delete(objectName);
         assertNull(objectApi.get(objectName, GetOptions.NONE));
      }
   }
View Full Code Here

Examples of org.jclouds.openstack.swift.v1.features.ObjectApi

   public void testPurgeObject() throws Exception {
      for (String regionId : regions) {
         String objectName = "testPurge";
         Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(new byte[] {1,2,3}));
         ObjectApi objectApi = api.objectApiInRegionForContainer(regionId, name);
        
         // create a new object
         objectApi.replace(objectName, payload, ImmutableMap.<String, String>of());
        
         CDNApi cdnApi = api.cdnApiInRegion(regionId);
         assertTrue(cdnApi.purgeObject(name, "testPurge", ImmutableList.<String>of()));
        
         // delete the object
         objectApi.delete(objectName);
         assertNull(objectApi.get(objectName, GetOptions.NONE));
      }
   }
View Full Code Here

Examples of org.jclouds.openstack.swift.v1.features.ObjectApi

      return list(container, ListContainerOptions.NONE);
   }

   @Override
   public PageSet<? extends StorageMetadata> list(final String container, ListContainerOptions options) {
      ObjectApi objectApi = api.objectApiInRegionForContainer(region.getId(), container);
      ObjectList objects = objectApi.list(toListContainerOptions.apply(options));
      if (objects == null) {
         containerCache.put(container, Optional.<Container> absent());
         return new PageSetImpl<StorageMetadata>(ImmutableList.<StorageMetadata> of(), null);
      } else {
         containerCache.put(container, Optional.of(objects.getContainer()));
View Full Code Here

Examples of org.jclouds.openstack.swift.v1.features.ObjectApi

   @Override
   public String putBlob(String container, Blob blob, PutOptions options) {
      if (options.isMultipart()) {
         throw new UnsupportedOperationException();
      }
      ObjectApi objectApi = api.objectApiInRegionForContainer(region.getId(), container);
      return objectApi.replace(blob.getMetadata().getName(), blob.getPayload(), blob.getMetadata().getUserMetadata());
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.