public java.lang.Object getFieldValue(_Fields field) { switch (field) { case ACL: return get_acl(); case REPLICATION_FACTOR: return get_replication_factor(); } throw new java.lang.IllegalStateException(); }
@Override public OutputStream getOutputStream() throws IOException { checkIsNotTmp(); OutputStream out = null; FsPermission fileperms = new FsPermission(BLOBSTORE_FILE_PERMISSION); try { out = _fs.create(_path, (short)this.getMetadata().get_replication_factor()); _fs.setPermission(_path, fileperms); _fs.setReplication(_path, (short)this.getMetadata().get_replication_factor()); } catch (IOException e) { //Try to create the parent directory, may not work FsPermission dirperms = new FsPermission(HdfsBlobStoreImpl.BLOBSTORE_DIR_PERMISSION); if (!_fs.mkdirs(_path.getParent(), dirperms)) { LOG.warn("error creating parent dir: " + _path.getParent()); } out = _fs.create(_path, (short)this.getMetadata().get_replication_factor()); _fs.setPermission(_path, dirperms); _fs.setReplication(_path, (short)this.getMetadata().get_replication_factor()); } if (out == null) { throw new IOException("Error in creating: " + _path); } return out; }
@Override public void setBlobMeta(String key, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyNotFoundException { if (meta.get_replication_factor() <= 0) { meta.set_replication_factor((int)conf.get(Config.STORM_BLOBSTORE_REPLICATION_FACTOR)); } who = checkAndGetSubject(who); validateKey(key); aclHandler.normalizeSettableBlobMeta(key, meta, who, ADMIN); BlobStoreAclHandler.validateSettableACLs(key, meta.get_acl()); SettableBlobMeta orig = getStoredBlobMeta(key); aclHandler.hasPermissions(orig.get_acl(), ADMIN, who, key); BlobStoreFileOutputStream mOut = null; writeMetadata(key, meta); }
@Override public AtomicOutputStream createBlob(String key, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyAlreadyExistsException { if (meta.get_replication_factor() <= 0) { meta.set_replication_factor((int)conf.get(Config.STORM_BLOBSTORE_REPLICATION_FACTOR));
public Object getFieldValue(_Fields field) { switch (field) { case ACL: return get_acl(); case REPLICATION_FACTOR: return get_replication_factor(); } throw new IllegalStateException(); }
@Override public OutputStream getOutputStream() throws IOException { checkIsNotTmp(); OutputStream out = null; FsPermission fileperms = new FsPermission(BLOBSTORE_FILE_PERMISSION); try { out = _fs.create(_path, (short)this.getMetadata().get_replication_factor()); _fs.setPermission(_path, fileperms); _fs.setReplication(_path, (short)this.getMetadata().get_replication_factor()); } catch (IOException e) { //Try to create the parent directory, may not work FsPermission dirperms = new FsPermission(HdfsBlobStoreImpl.BLOBSTORE_DIR_PERMISSION); if (!_fs.mkdirs(_path.getParent(), dirperms)) { LOG.warn("error creating parent dir: " + _path.getParent()); } out = _fs.create(_path, (short)this.getMetadata().get_replication_factor()); _fs.setPermission(_path, dirperms); _fs.setReplication(_path, (short)this.getMetadata().get_replication_factor()); } if (out == null) { throw new IOException("Error in creating: " + _path); } return out; }
@Override public void setBlobMeta(String key, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyNotFoundException { if (meta.get_replication_factor() <= 0) { meta.set_replication_factor((int)conf.get(Config.STORM_BLOBSTORE_REPLICATION_FACTOR)); } who = checkAndGetSubject(who); validateKey(key); aclHandler.normalizeSettableBlobMeta(key, meta, who, ADMIN); BlobStoreAclHandler.validateSettableACLs(key, meta.get_acl()); SettableBlobMeta orig = getStoredBlobMeta(key); aclHandler.hasPermissions(orig.get_acl(), ADMIN, who, key); BlobStoreFileOutputStream mOut = null; writeMetadata(key, meta); }
@Override public AtomicOutputStream createBlob(String key, SettableBlobMeta meta, Subject who) throws AuthorizationException, KeyAlreadyExistsException { if (meta.get_replication_factor() <= 0) { meta.set_replication_factor((int)conf.get(Config.STORM_BLOBSTORE_REPLICATION_FACTOR));