PUT Bucket

Function Signatures
/**
* Creates a new fds bucket with the specified name.
*
* @param bucketName The name of the bucket to create
* @throws GalaxyFDSClientException
*/
public void createBucket(String bucketName) throws GalaxyFDSClientException;
Example
fdsClient.createBucket(BUCKET_NAME);

DELETE Bucket

Function Signatures
/**
* Deletes a fds bucket with the specified name.
*
* @param bucketName The name of the bucket to delete
* @throws GalaxyFDSClientException
*/
public void deleteBucket(String bucketName) throws GalaxyFDSClientException;
Example
fdsClient.deleteBucket(BUCKET_NAME);

HEAD Bucket

Function Signatures
/**
* Checks if the specified bucket exists.
*
* @param bucketName The name of the bucket to check
* @return The value true if the specified bucket exists, otherwise false
* @throws GalaxyFDSClientException
*/
public boolean doesBucketExist(String bucketName)
  throws GalaxyFDSClientException;
Example
boolean exist = fdsClient.doesBucketExist(BUCKET_NAME);

PUT Bucket ACL

Function Signatures
/**
* Sets the AccessControlList(ACL) of the specified fds bucket.
*
* @param bucketName The name of the bucket whoses acl is being set
* @param acl        The new AccessControlList for the specified bucket
* @throws GalaxyFDSClientException
*/
public void setBucketAcl(String bucketName, AccessControlList acl)
  throws GalaxyFDSClientException;
Example
AccessControlList acl = new AccessControlList();
Grant grant = new Grant("12346", Permission.READ, GrantType.USER);
acl.addGrant(grant);
fdsClient.setBucketAcl(BUCKET_NAME, acl);

GET Bucket ACL

Function Signatures
/**
* Gets the AccessControlList(ACL) of the specified fds bucket.
*
* @param bucketName The name of the bucket whose ACL is being retrieved
* @return The AccessControlList for the specified bucket
* @throws GalaxyFDSClientException
*/
public AccessControlList getBucketAcl(String bucketName)
  throws GalaxyFDSClientException;
Example
AccessControlList acl = fdsClient.getBucketAcl(BUCKET_NAME);
for (Grant grant : acl.getGrantList()) {
  System.out.println("grantee: " + grant.getGranteeId() + ", permission: "

      + grant.getPermission() + ", type: " + grant.getType());
}

List Objects

Function Signatures
/**
* Returns a list of summary information about the objects in the specified
* fds bucket.
* <p/>
* Because buckets can contain a virtually unlimited number of keys, the
* complete results of a list query can be extremely large. To manage large
* result sets, galaxy fds uses pagination to split them into multiple
* responses. Always check the {@link #FDSObjectListing.isTruncated()} method
* to see if the returned listing is complete or if additional calls are
* needed to get more results. Alternatively, use the
* {@link #listNextBatchOfObjects(FDSObjectListing)} method as an easy way to
* get the next page of object listings.
*
* @param bucketName The name of the bucket to list
* @return A listing of the objects in the specified bucket
* @throws GalaxyFDSClientException
*/
public FDSObjectListing listObjects(String bucketName)
  throws GalaxyFDSClientException;

/**
* Returns a list of summary information about the objects in the specified
* fds bucket.
*
* @param bucketName The name of the bucket to list
* @param prefix     An optional parameter restricting the response to keys
*                   beginning with the specified prefix.
* @return A listing of the objects in the specified bucket
* @throws GalaxyFDSClientException
*/
public FDSObjectListing listObjects(String bucketName, String prefix)
  throws GalaxyFDSClientException;

/**
* Returns a list of summary information about the objects in the specified
* fds bucket.
*
* @param bucketName The name of the bucket to list
* @param prefix     An optional parameter restricting the response to keys
*                   beginning with the specified prefix.
* @param delimiter  delimiter to separate path
* @return A listing of the objects in the specified bucket
* @throws GalaxyFDSClientException
*/
public FDSObjectListing listObjects(String bucketName, String prefix,
  String delimiter) throws GalaxyFDSClientException;

/**
* Provides an easy way to continue a truncated object listing and retrieve
* the next page of results.
*
* @param previousObjectListing The previous truncated ObjectListing
* @return The next set of ObjectListing results, beginning immediately after
*         the last result in the specified previous ObjectListing.
* @throws GalaxyFDSClientException
*/
public FDSObjectListing listNextBatchOfObjects(
  FDSObjectListing previousObjectListing) throws GalaxyFDSClientException;
Example
FDSObjectListing listing = null;
do {
  if (listing == null) {
    listing = fdsClient.listObjects(bucketName, "", "/");
  } else {
    listing = fdsClient.listNextBatchOfObjects(listing);
  }
  if (listing != null) {
    List<String> commonPrefixes = listing.getCommonPrefixes();
    for (String commonPrefix : commonPrefixes) {
      System.out.println(commonPrefix);
    }
    List<FDSObjectSummary> objectSummaries = listing.getObjectSummaries();
    for (FDSObjectSummary objectSummary : objectSummaries) {
      System.out.println(objectSummary.getObjectName());
    }
  }
}
while (listing != null && listing.isTruncated());

Note

For more examples, refer to the List Objects REST API

results matching ""

    No results matching ""