Skip to content
Browse files

Remove check for bucket existing.

TODO Must be controller by FileSystemOptions
  • Loading branch information...
1 parent dc76bcf commit 38236dde553400633cd9d3d9123b2694a1231f78 @abashev committed Jul 23, 2012
Showing with 15 additions and 24 deletions.
  1. +15 −24 src/main/java/com/intridea/io/vfs/provider/s3/S3FileSystem.java
View
39 src/main/java/com/intridea/io/vfs/provider/s3/S3FileSystem.java
@@ -11,7 +11,6 @@
import org.apache.commons.vfs2.provider.AbstractFileName;
import org.apache.commons.vfs2.provider.AbstractFileSystem;
import org.jets3t.service.S3Service;
-import org.jets3t.service.ServiceException;
import org.jets3t.service.model.S3Bucket;
/**
@@ -21,31 +20,24 @@
* @author Matthias L. Jugel
*/
public class S3FileSystem extends AbstractFileSystem {
+ private final Log log = LogFactory.getLog(S3FileSystem.class);
private S3Service service;
- private S3Bucket bucket;
+ private String bucketId;
- private Log logger = LogFactory.getLog(S3FileSystem.class);
-
- public S3FileSystem(S3FileName fileName, S3Service service,
- FileSystemOptions fileSystemOptions) throws FileSystemException {
+ public S3FileSystem(
+ S3FileName fileName, S3Service service, FileSystemOptions fileSystemOptions
+ ) throws FileSystemException {
super(fileName, null, fileSystemOptions);
- String bucketId = fileName.getBucketId();
- try {
- this.service = service;
- bucket = new S3Bucket(bucketId);
- if (!service.isBucketAccessible(bucketId)) {
- bucket = service.createBucket(bucketId);
- }
- logger.info(String.format("Created new S3 FileSystem %s", bucketId));
- } catch (ServiceException e) {
- String s3message = e.getErrorMessage();
-
- if (s3message != null) {
- throw new FileSystemException(s3message);
- } else {
- throw new FileSystemException(e);
- }
+
+ this.bucketId = fileName.getBucketId();
+ this.service = service;
+// TODO Must be controller by FileSystemOptions
+// if (!service.isBucketAccessible(bucketId)) {
+// bucket = service.createBucket(bucketId);
+// }
+ if (log.isInfoEnabled()) {
+ log.info("Created new S3 FileSystem " + bucketId);
}
}
@@ -56,7 +48,6 @@ protected void addCapabilities(Collection<Capability> caps) {
@Override
protected FileObject createFile(AbstractFileName fileName) throws Exception {
- return new S3FileObject(fileName, this, service, bucket);
+ return new S3FileObject(fileName, this, service, new S3Bucket(bucketId));
}
-
}

0 comments on commit 38236dd

Please sign in to comment.
Something went wrong with that request. Please try again.