Package org.jets3t.service.model

Examples of org.jets3t.service.model.S3Object


    log.logDetailed(toString(),"==>You will send the file [" + _FileNm + "] to the bucket [" + _S3Buck + "]" );
   
    String TargetBucket = _S3Buck;
     
    File fileData = new File(_FileNm);
    S3Object fileObject = new S3Object(fileData);
    log.logDetailed(toString(),"==>Hash value: " + fileObject.getMd5HashAsHex());
    log.logDetailed(toString(),"==>S3Object before upload: " + fileObject);
    log.logDetailed(toString(),"_____________________________________");

      // Upload the data objects.
    s3Service.putObject(TargetBucket, fileObject);
View Full Code Here


          newStore.getVersion() + ".");
      Store oldStore = new UnversionedStore();
      migrate(oldStore, newStore);
      return 0;
    } else {
      S3Object root = get("/");
      if (root != null) {
        String version = (String) root.getMetadata("fs-version");
        if (version == null) {
          System.err.println("Can't detect version - exiting.");
        } else {
          String newVersion = newStore.getVersion();
          System.err.println("Current version number is " + version + ".");
View Full Code Here

      return INode.deserialize(get(pathToKey(path)));
    }

    private InputStream get(String key) throws IOException {
      try {
        S3Object object = s3Service.getObject(bucket, key);
        return object.getDataInputStream();
      } catch (S3ServiceException e) {
        if (e.getS3ErrorCode().equals("NoSuchKey")) {
          return null;
        }
        if (e.getCause() instanceof IOException) {
View Full Code Here

  private InputStream get(String key, boolean checkMetadata)
      throws IOException {
   
    try {
      S3Object object = s3Service.getObject(bucket, key);
      if (checkMetadata) {
        checkMetadata(object);
      }
      return object.getDataInputStream();
    } catch (S3ServiceException e) {
      if (e.getS3ErrorCode().equals("NoSuchKey")) {
        return null;
      }
      if (e.getCause() instanceof IOException) {
View Full Code Here

    }
  }

  private InputStream get(String key, long byteRangeStart) throws IOException {
    try {
      S3Object object = s3Service.getObject(bucket, key, null, null, null,
                                            null, byteRangeStart, null);
      return object.getDataInputStream();
    } catch (S3ServiceException e) {
      if (e.getS3ErrorCode().equals("NoSuchKey")) {
        return null;
      }
      if (e.getCause() instanceof IOException) {
View Full Code Here

  private void put(String key, InputStream in, long length, boolean storeMetadata)
      throws IOException {
   
    try {
      S3Object object = new S3Object(key);
      object.setDataInputStream(in);
      object.setContentType("binary/octet-stream");
      object.setContentLength(length);
      if (storeMetadata) {
        object.addAllMetadata(METADATA);
      }
      s3Service.putObject(bucket, object);
    } catch (S3ServiceException e) {
      if (e.getCause() instanceof IOException) {
        throw (IOException) e.getCause();
View Full Code Here

  private InputStream get(String key, boolean checkMetadata)
      throws IOException {
   
    try {
      S3Object object = s3Service.getObject(bucket, key);
      if (checkMetadata) {
        checkMetadata(object);
      }
      return object.getDataInputStream();
    } catch (S3ServiceException e) {
      if (e.getS3ErrorCode().equals("NoSuchKey")) {
        return null;
      }
      if (e.getCause() instanceof IOException) {
View Full Code Here

    }
  }

  private InputStream get(String key, long byteRangeStart) throws IOException {
    try {
      S3Object object = s3Service.getObject(bucket, key, null, null, null,
                                            null, byteRangeStart, null);
      return object.getDataInputStream();
    } catch (S3ServiceException e) {
      if (e.getS3ErrorCode().equals("NoSuchKey")) {
        return null;
      }
      if (e.getCause() instanceof IOException) {
View Full Code Here

  private void put(String key, InputStream in, long length, boolean storeMetadata)
      throws IOException {
   
    try {
      S3Object object = new S3Object(key);
      object.setDataInputStream(in);
      object.setContentType("binary/octet-stream");
      object.setContentLength(length);
      if (storeMetadata) {
        object.addAllMetadata(METADATA);
      }
      s3Service.putObject(bucket, object);
    } catch (S3ServiceException e) {
      if (e.getCause() instanceof IOException) {
        throw (IOException) e.getCause();
View Full Code Here

    }

    BufferedInputStream in = null;
    try {
      in = new BufferedInputStream(new FileInputStream(file));
      S3Object object = new S3Object(key);
      object.setDataInputStream(in);
      object.setContentType("binary/octet-stream");
      object.setContentLength(file.length());
      object.setServerSideEncryptionAlgorithm(serverSideEncryptionAlgorithm);
      if (md5Hash != null) {
        object.setMd5Hash(md5Hash);
      }
      s3Service.putObject(bucket, object);
    } catch (ServiceException e) {
      handleException(e, key);
    } finally {
View Full Code Here

TOP

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

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.