System.out.println("Found the following implementations:");
String filename = "foo.txt";
String sourcePath = "/tmp/" + filename;
File sourceFile = new File(sourcePath);
MicrobaseFS fs = MicrobaseFSFactory.getDefaultProvider();
System.out.println("Classname: " + fs.getClass().toString());
String bucketName = "bucket1";
String path = "a/file/path";
try
{
fs.upload(sourceFile, bucketName, path, sourceFile.getName(), null);
System.out.println("Uploaded file successfully");
System.out.println("Bucket root directory list:");
System.out.println(fs.listFiles(bucketName));
System.out.println("Bucket/path directory list");
System.out.println(fs.listFiles(bucketName, path));
System.out.println(filename + " exists? " + fs.exists(bucketName, path, filename));
System.out.println("bar.txt" + " exists? " + fs.exists(bucketName, path, "bar.txt"));
System.out.println("baz.txt" + " exists? " + fs.exists(bucketName, path, "baz.txt"));
System.out.println("Bucket list for bucket2: "+fs.listFiles("bucket2"));
}
catch (Exception e)
{
e.printStackTrace();