Package org.jets3t.service.model

Examples of org.jets3t.service.model.StorageObject


    }
  }

  @Override
  public FileMetadata retrieveMetadata(String key) throws IOException {
    StorageObject object = null;
    try {
      if(LOG.isDebugEnabled()) {
        LOG.debug("Getting metadata for key: " + key + " from bucket:" + bucket.getName());
      }
      object = s3Service.getObjectDetails(bucket.getName(), key);
      return new FileMetadata(key, object.getContentLength(),
          object.getLastModifiedDate().getTime());

    } catch (ServiceException e) {
      // Following is brittle. Is there a better way?
      if ("NoSuchKey".equals(e.getErrorCode())) {
        return null; //return null if key not found
      }
      handleServiceException(e);
      return null; //never returned - keep compiler happy
    } finally {
      if (object != null) {
        object.closeDataInputStream();
      }
    }
  }
View Full Code Here


          prefix, delimiter, maxListingLength, priorLastKey);
     
      FileMetadata[] fileMetadata =
        new FileMetadata[chunk.getObjects().length];
      for (int i = 0; i < fileMetadata.length; i++) {
        StorageObject object = chunk.getObjects()[i];
        fileMetadata[i] = new FileMetadata(object.getKey(),
            object.getContentLength(), object.getLastModifiedDate().getTime());
      }
      return new PartialListing(chunk.getPriorLastKey(), fileMetadata,
          chunk.getCommonPrefixes());
    } catch (S3ServiceException e) {
      handleS3ServiceException(e);
View Full Code Here

TOP

Related Classes of org.jets3t.service.model.StorageObject

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.