Package org.jgroups.protocols

Examples of org.jgroups.protocols.S3_PING$AWSAuthConnection


  }

  @Override
  public void deleteAttachment(ERS3Attachment attachment)
      throws MalformedURLException, IOException {
    AWSAuthConnection conn = attachment.awsConnection();
    String bucket = attachment.bucket();
    String key = attachment.key();
    Response response = conn.delete(bucket, key, null);
    if (failed(response)) {
      throw new IOException("Failed to delete '" + bucket + "/" + key
          + "' to S3: Error " + response.connection.getResponseCode()
          + ": " + response.connection.getResponseMessage());
    }
View Full Code Here


  public void performUpload(File uploadedFile, String originalFileName,
      String bucket, String key, String mimeType,
      ERS3Attachment attachment) throws MalformedURLException,
      IOException {
    try {
      AWSAuthConnection conn = attachment.awsConnection();
      FileInputStream attachmentFileInputStream = new FileInputStream(
          uploadedFile);
      BufferedInputStream attachmentInputStream = new BufferedInputStream(
          attachmentFileInputStream);
      try {
        S3StreamObject attachmentStreamObject = new S3StreamObject(
            attachmentInputStream, null);

        Map<String, List<String>> headers = new TreeMap<String, List<String>>();
        headers.put("Content-Type",
            Arrays.asList(new String[] { mimeType }));
        headers.put("Content-Length", Arrays
            .asList(new String[] { String.valueOf(uploadedFile
                .length()) }));
        headers.put("x-amz-acl",
            Arrays.asList(new String[] { attachment.acl() }));

        if (originalFileName != null) {
          headers.put("Content-Disposition", Arrays
              .asList(new String[] { "attachment; filename="
                  + originalFileName }));
        }

        Response response = conn.putStream(bucket, key,
            attachmentStreamObject, headers);
        if (failed(response)) {
          throw new IOException("Failed to write '" + bucket + "/"
              + key + "' to S3: Error "
              + response.connection.getResponseCode() + ": "
View Full Code Here

    String host = ERXProperties.stringForKey("er.attachment." + configurationName() + ".s3.host");
    if (host == null) {
      host = ERXProperties.stringForKey("er.attachment.s3.host");
    }
    if (host == null)
      return new AWSAuthConnection(accessKeyID(), secretAccessKey(), true);
    else
      return new AWSAuthConnection(accessKeyID(), secretAccessKey(), true, host);
  }
View Full Code Here

TOP

Related Classes of org.jgroups.protocols.S3_PING$AWSAuthConnection

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.