Tabnine Logo
StorageService
Code IndexAdd Tabnine to your IDE (free)

How to use
StorageService
in
org.jets3t.service

Best Java code snippets using org.jets3t.service.StorageService (Showing top 20 results out of 315)

origin: net.java.dev.jets3t/jets3t

/**
 * Returns an object representing the details and data of an item in a service,
 * without applying any preconditions.
 * <p>
 * This method can be performed by anonymous services. Anonymous services
 * can get a publicly-readable object.
 * <p>
 * <b>Important:</b> It is the caller's responsibility to close the object's data input stream.
 * The data stream should be consumed and closed as soon as is practical as network connections
 * may be held open until the streams are closed. Excessive unclosed streams can lead to
 * connection starvation.
 *
 * @param bucketName
 * the name of the bucket containing the object.
 * @param objectKey
 * the key identifying the object.
 * @return
 * the object with the given key, including the object's data input stream.
 * @throws ServiceException
 */
public StorageObject getObject(String bucketName, String objectKey) throws ServiceException {
  return getObject(bucketName, objectKey,
    null, null, null, null, null, null);
}
origin: net.java.dev.jets3t/jets3t

/**
 * Returns an object representing the details of an item in without the object's data, and
 * without applying any preconditions.
 * <p>
 * This method can be performed by anonymous services. Anonymous services
 * can get a publicly-readable object's details.
 *
 * @param bucketName
 * the name of the bucket containing the object.
 * @param objectKey
 * the key identifying the object.
 * @return
 * the object with the given key, including only general details and metadata
 * (not the data input stream)
 * @throws ServiceException
 */
public StorageObject getObjectDetails(String bucketName, String objectKey)
  throws ServiceException
{
  return getObjectDetails(bucketName, objectKey, null, null, null, null);
}
origin: net.java.dev.jets3t/jets3t

/**
 * Returns the owner of an account, using information available in the
 * bucket listing response.
 * <p>
 * This method cannot be performed by anonymous services, and will fail with an exception
 * if the service is not authenticated.
 *
 * @return
 * the owner of the account.
 * @throws ServiceException
 */
public StorageOwner getAccountOwner() throws ServiceException {
  assertAuthenticatedConnection("List all buckets to find account owner");
  return getAccountOwnerImpl();
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

/**
 * Returns a bucket in your account, and creates the bucket if
 * it does not yet exist.
 *
 * @param bucketName
 * the name of the bucket to retrieve or create.
 * @return
 * the bucket in your account.
 *
 * @throws ServiceException
 */
public StorageBucket getOrCreateBucket(String bucketName) throws ServiceException {
  StorageBucket bucket = getBucket(bucketName);
  if (bucket == null) {
    // Bucket does not exist in this user's account, create it.
    bucket = createBucket(bucketName);
  }
  return bucket;
}
origin: net.java.dev.jets3t/jets3t

/**
 * Deletes a bucket. Only the owner of a bucket may delete it.
 * <p>
 * This method cannot be performed by anonymous services.
 *
 * @param bucket
 * the bucket to delete.
 * @throws ServiceException
 */
public void deleteBucket(StorageBucket bucket) throws ServiceException {
  assertValidBucket(bucket, "Delete bucket");
  deleteBucketImpl(bucket.getName());
}
origin: net.java.dev.jets3t/jets3t

if (storageService.getProviderCredentials() == null) {
    bucket = storageService.getBucket(bucketName);
  } catch (ServiceException e) {
      bucket = storageService.createBucket(new StorageBucket(bucketName));
    } catch (ServiceException e) {
        storageService.listObjectsChunked(bucketName, null, null, 1, null, false);
origin: net.java.dev.jets3t/jets3t

public void run() {
  try {
    if (headOnly) {
      result = storageService.getObjectDetails(
        bucketName, objectKey, null, null, null, null);
    } else {
      result = storageService.getObject(
        bucketName, objectKey);
    }
  } catch (ServiceException e) {
    if (this.errorPermitter != null && this.errorPermitter.isPermitted(e)) {
      result = new ThrowableBearingStorageObject(this.objectKey, e);
    } else {
      result = e;
    }
  }
}
origin: net.java.dev.jets3t/jets3t

service.createBucket(bucketName[0]);
service.putObject(bucketName[0], encryptedCredentialsObject);
origin: net.java.dev.jets3t/jets3t

/**
 * Lists the buckets belonging to the service user.
 * <p>
 * This method cannot be performed by anonymous services, and will fail with an exception
 * if the service is not authenticated.
 *
 * @return
 * the list of buckets owned by the service user.
 * @throws ServiceException
 */
public StorageBucket[] listAllBuckets() throws ServiceException {
  assertAuthenticatedConnection("List all buckets");
  StorageBucket[] buckets = listAllBucketsImpl();
  MxDelegate.getInstance().registerStorageBucketMBeans(buckets);
  return buckets;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

/**
 * Deletes an object from a bucket.
 * <p>
 * This method can be performed by anonymous services. Anonymous services
 * can delete objects from publicly-writable buckets.
 *
 * @param bucketName
 * the name of the bucket containing the object to be deleted.
 * @param objectKey
 * the key representing the object
 * @throws ServiceException
 */
public void deleteObject(String bucketName, String objectKey) throws ServiceException {
  assertValidObject(objectKey, "deleteObject");
  MxDelegate.getInstance().registerStorageObjectDeleteEvent(bucketName, objectKey);
  deleteObjectImpl(bucketName, objectKey, null, null, null);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

/**
 * Applies access control settings to a bucket. The ACL settings must be included
 * inside the bucket.
 *
 * This method can be performed by anonymous services, but can only succeed if the
 * bucket's existing ACL already allows write access by the anonymous user.
 * In general, you can only access the ACL of a bucket if the ACL already in place
 * for that bucket allows you to do so.
 *
 * @param bucket
 * a bucket with ACL settings to apply.
 * @throws ServiceException
 */
public void putBucketAcl(StorageBucket bucket) throws ServiceException {
  assertValidBucket(bucket, "Put Bucket Access Control List");
  putBucketAcl(bucket.getName(), bucket.getAcl());
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

/**
 * Applies access control settings to an object. The ACL settings must be included
 * with the object.
 *
 * This method can be performed by anonymous services, but can only succeed if the
 * object's existing ACL already allows write access by the anonymous user.
 * In general, you can only access the ACL of an object if the ACL already in place
 * for that object allows you to do so.
 *
 * @param bucketName
 * the name of the bucket containing the object to modify.
 * @param object
 * the object with ACL settings that will be applied.
 * @throws ServiceException
 */
public void putObjectAcl(String bucketName, StorageObject object) throws ServiceException {
  assertValidObject(object, "Put Object Access Control List");
  putObjectAcl(bucketName, object.getKey(), object.getAcl());
}
origin: net.java.dev.jets3t/jets3t

/**
 * Returns a bucket in your account by listing all your buckets
 * (using {@link #listAllBuckets()}), and looking for the named bucket in
 * this list.
 * <p>
 * This method cannot be performed by anonymous services.
 *
 * @param bucketName
 * @return
 * the bucket in your account, or null if you do not own the named bucket.
 *
 * @throws ServiceException
 */
public StorageBucket getBucket(String bucketName) throws ServiceException {
  assertAuthenticatedConnection("Get Bucket");
  // List existing buckets and return the named bucket if it exists.
  StorageBucket[] existingBuckets = listAllBuckets();
  for (int i = 0; i < existingBuckets.length; i++) {
    if (existingBuckets[i].getName().equals(bucketName)) {
      return existingBuckets[i];
    }
  }
  return null;
}
origin: net.java.dev.jets3t/jets3t

/**
 * Puts an object inside an existing bucket, creating a new object or overwriting
 * an existing one with the same key. The Access Control List settings of the object
 * (if any) will also be applied.
 * <p>
 * This method can be performed by anonymous services. Anonymous services
 * can put objects into a publicly-writable bucket.
 *
 * @param bucketName
 * the name of the bucket inside which the object will be put.
 * @param object
 * the object containing all information that will be written to the service.
 * At very least this object must be valid. Beyond that it may contain: an input stream
 * with the object's data content, metadata, and access control settings.
 * <p>
 * <b>Note:</b> It is very important to set the object's Content-Length to match the size of the
 * data input stream when possible, as this can remove the need to read data into memory to
 * determine its size.
 *
 * @return
 * the object populated with any metadata.
 * @throws ServiceException
 */
public StorageObject putObject(String bucketName, StorageObject object)
  throws ServiceException
{
  assertValidObject(object, "Create Object in bucket " + bucketName);
  MxDelegate.getInstance().registerStorageObjectPutEvent(bucketName, object.getKey());
  return putObjectImpl(bucketName, object);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

boolean replaceMetadata) throws ServiceException
Map<String, Object> copyResult = copyObject(sourceBucketName, sourceObjectKey,
  destinationBucketName, destinationObject, replaceMetadata);
  deleteObject(sourceBucketName, sourceObjectKey);
} catch (Exception e) {
  copyResult.put("DeleteException", e);
origin: net.java.dev.jets3t/jets3t

String[] ifNoneMatchTags) throws ServiceException
assertAuthenticatedConnection("copyObject");
Map<String, Object> destinationMetadata =
  replaceMetadata ? destinationObject.getModifiableMetadata() : null;
return copyObjectImpl(sourceBucketName, sourceObjectKey,
  destinationBucketName, destinationObject.getKey(),
  destinationObject.getAcl(), destinationMetadata,
origin: io.druid.extensions/druid-s3-extensions

 @Override
 public Void call() throws Exception
 {
  final StorageObject object = new StorageObject(logFile);
  object.setKey(taskKey);
  service.putObject(config.getS3Bucket(), object);
  return null;
 }
}
origin: net.java.dev.jets3t/jets3t

public void run() {
  try {
    result = storageService.copyObject(sourceBucketName, sourceObjectKey,
      destinationBucketName, destinationObject, replaceMetadata);
  } catch (ServiceException e) {
    result = e;
  }
}
origin: net.java.dev.jets3t/jets3t

/**
 * Creates a bucket.
 *
 * <b>Caution:</b> Performing this operation unnecessarily when a bucket already
 * exists may cause OperationAborted errors with the message "A conflicting conditional
 * operation is currently in progress against this resource.". To avoid this error, use the
 * {@link #getOrCreateBucket(String)} in situations where the bucket may already exist.
 *
 * This method cannot be performed by anonymous services.
 *
 * @param bucketName
 * the name of the bucket to create.
 * @return
 * the created bucket object. <b>Note:</b> the object returned has minimal information about
 * the bucket that was created, including only the bucket's name.
 * @throws ServiceException
 */
public StorageBucket createBucket(String bucketName) throws ServiceException {
  return createBucketImpl(bucketName, null, null);
}
origin: net.java.dev.jets3t/jets3t

public void run() {
  try {
    result = storageService.createBucket(bucketName);
  } catch (ServiceException e) {
    result = e;
  }
}
org.jets3t.serviceStorageService

Javadoc

A service that handles communication with a storage service, offering all the operations that can be performed on generic storage services.

This class must be extended by implementation classes that perform the communication with a specific service using a specific interface, such as REST or SOAP.

Implementations of StorageService must be thread-safe as they will probably be used by the multi-threaded service class org.jets3t.service.multi.ThreadedStorageService.

This class uses properties obtained through Jets3tProperties. For more information on these properties please refer to JetS3t Configuration

Most used methods

  • getObject
    Returns an object representing the details and data of an item that meets any given preconditions.Im
  • getObjectDetails
    Returns an object representing the details of an item that meets any given preconditions. The object
  • putObject
    Puts an object inside an existing bucket, creating a new object or overwriting an existing one with
  • assertAuthenticatedConnection
    Throws an exception if this service is anonymous (that is, it was created without an ProviderCredent
  • assertValidBucket
    Throws an exception if a bucket is null or contains a null/empty name.
  • assertValidObject
    Throws an exception if an object is null or contains a null/empty key.
  • copyObject
    Copy an object. You can copy an object within a single bucket or between buckets, and can optionally
  • copyObjectImpl
    Copy an object within your account. Copies within a single bucket or between buckets, and optionally
  • createBucket
    Create a bucket with the Access Control List settings of the bucket object (if any).Caution: Perform
  • createBucketImpl
  • deleteBucketImpl
  • deleteObject
    Deletes an object from a bucket. This method can be performed by anonymous services. Anonymous servi
  • deleteBucketImpl,
  • deleteObject,
  • deleteObjectImpl,
  • getAccountOwnerImpl,
  • getBucket,
  • getBucketAclImpl,
  • getHttpsOnly,
  • getJetS3tProperties,
  • getObjectAcl,
  • getObjectAclImpl

Popular in Java

  • Updating database using SQL prepared statement
  • findViewById (Activity)
  • onCreateOptionsMenu (Activity)
  • setContentView (Activity)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • IsNull (org.hamcrest.core)
    Is the value null?
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now