Hello! Thought I should share my experience: Below is a simple Java application that prints out the number of 'buckets' you have on Walrus and their names :-)
import org.jets3t.service.Jets3tProperties;
import org.jets3t.service.S3Service;
import org.jets3t.service.S3ServiceException;
import org.jets3t.service.impl.rest.httpclient.RestS3Service;
import org.jets3t.service.model.S3Bucket;
import org.jets3t.service.model.S3Object;
import org.jets3t.service.security.AWSCredentials;
/**
*
* @author thoba
*/
public class ConnectWalrus {
public static void main(String[] args) throws S3ServiceException {
String awsAccessKey = "VKPK98DL9HEUUTISURTRS";
String awsSecretKey = "0R4Af2nVDeUYjiEzb52zX9MGCU3MCyCqAi7R4bHw";
AWSCredentials awsCredentials =
new AWSCredentials(awsAccessKey, awsSecretKey);
Jets3tProperties props = new Jets3tProperties();
String endPoint = "
172.20.56.90:8773";
props.setProperty("s3service.s3-endpoint", endPoint);
props.setProperty("s3service.s3-endpoint-virtual-path",
"/services/Walrus");
props.setProperty("s3service.https-only", "false");
S3Service s3Service = new RestS3Service(awsCredentials, null, null,
props);
System.out.println("My EndPoint: " + s3Service.getEndpoint());
S3Bucket[] myBuckets = s3Service.listAllBuckets();
System.out.println("How many buckets do I have in Walrus? You have: "
+ myBuckets.length + " buckets");
for (int i = 0; i < myBuckets.length; i++) {
System.out.println("Bucket [" + i + "] is '" + myBuckets[i].getName()+"'");
}
System.out.println("My EndPoint: " + s3Service.getEndpoint());
}
}