use of com.amazonaws.services.s3.model.S3Object in project XRTB by benmfaul.
the class AwsCommander method load.
/**
* Load the file or s3 object.
* @param parts String[]. An array of tokens.
* @return String. The message returned from the load command.
* @throws Exception on I/O errirs.
*/
String load(String[] parts) throws Exception {
String otype = null;
String symbolName = null;
String name;
// file or S3
String type = parts[1];
//}
if (type.equalsIgnoreCase("S3")) {
// bloom, cache, cuckoo.
otype = parts[2];
name = parts[4];
// name of the object
symbolName = parts[3];
if (!symbolName.startsWith("$"))
symbolName = "$" + symbolName;
} else
// file name
name = parts[2];
if (type.equals("file")) {
return Configuration.getInstance().readData(parts[2]);
}
S3Object object = Configuration.s3.getObject(new GetObjectRequest(Configuration.s3_bucket, name));
long size = Configuration.s3.getObjectMetadata(Configuration.s3_bucket, name).getContentLength();
return Configuration.getInstance().readData(otype, symbolName, object, size);
}
Aggregations