use of org.apache.storm.generated.SettableBlobMeta in project storm by apache.
the class ClientBlobStoreTest method validatedBlobAcls.
private void validatedBlobAcls(String testKey) throws KeyNotFoundException, AuthorizationException {
ReadableBlobMeta blobMeta = client.getBlobMeta(testKey);
Assert.assertNotNull("The blob" + testKey + "does not have any readable blobMeta.", blobMeta);
SettableBlobMeta settableBlob = blobMeta.get_settable();
Assert.assertNotNull("The blob" + testKey + "does not have any settable blobMeta.", settableBlob);
}
use of org.apache.storm.generated.SettableBlobMeta in project storm by apache.
the class ClientBlobStoreTest method testDuplicateACLsForCreate.
@Test(expected = AuthorizationException.class)
public void testDuplicateACLsForCreate() throws Exception {
SettableBlobMeta meta = new SettableBlobMeta();
AccessControl submitterAcl = BlobStoreAclHandler.parseAccessControl("u:tester:rwa");
meta.add_to_acl(submitterAcl);
AccessControl duplicateAcl = BlobStoreAclHandler.parseAccessControl("u:tester:r--");
meta.add_to_acl(duplicateAcl);
String testKey = "testDuplicateACLsBlobKey";
client.createBlob(testKey, meta);
}
use of org.apache.storm.generated.SettableBlobMeta in project storm by apache.
the class BlobStoreAPIWordCountTopology method createBlobWithContent.
// Equivalent create command on command line
// storm blobstore create --file blacklist.txt --acl o::rwa key
private static void createBlobWithContent(String blobKey, ClientBlobStore clientBlobStore, File file) throws AuthorizationException, KeyAlreadyExistsException, IOException, KeyNotFoundException {
String stringBlobACL = "o::rwa";
AccessControl blobACL = BlobStoreAclHandler.parseAccessControl(stringBlobACL);
List<AccessControl> acls = new LinkedList<AccessControl>();
// more ACLs can be added here
acls.add(blobACL);
SettableBlobMeta settableBlobMeta = new SettableBlobMeta(acls);
AtomicOutputStream blobStream = clientBlobStore.createBlob(blobKey, settableBlobMeta);
blobStream.write(readFile(file).toString().getBytes());
blobStream.close();
}
use of org.apache.storm.generated.SettableBlobMeta in project storm by apache.
the class HdfsBlobStore method setBlobMeta.
@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);
}
use of org.apache.storm.generated.SettableBlobMeta in project storm by apache.
the class HdfsBlobStore method getBlobReplication.
@Override
public int getBlobReplication(String key, Subject who) throws AuthorizationException, KeyNotFoundException {
who = checkAndGetSubject(who);
validateKey(key);
SettableBlobMeta meta = getStoredBlobMeta(key);
_aclHandler.hasAnyPermissions(meta.get_acl(), READ | WRITE | ADMIN, who, key);
try {
return _hbs.getBlobReplication(DATA_PREFIX + key);
} catch (IOException exp) {
throw new RuntimeException(exp);
}
}
Aggregations