Search in sources :

Example 61 with SettableBlobMeta

use of org.apache.storm.generated.SettableBlobMeta in project storm by apache.

the class TopoCache method addTopoConf.

/**
 * Add a new topology config.
 * @param topoId the id of the topology
 * @param who who is doing it
 * @param topoConf the topology conf itself
 * @throws AuthorizationException if who is not allowed to add a topology conf
 * @throws KeyAlreadyExistsException if the toplogy conf already exists in the blob store
 * @throws IOException on any error interacting with the blob store.
 */
public void addTopoConf(final String topoId, final Subject who, final Map<String, Object> topoConf) throws AuthorizationException, KeyAlreadyExistsException, IOException {
    final String key = ConfigUtils.masterStormConfKey(topoId);
    final List<AccessControl> acl = BlobStoreAclHandler.DEFAULT;
    SettableBlobMeta meta = new SettableBlobMeta(acl);
    store.createBlob(key, Utils.toCompressedJsonConf(topoConf), meta, who);
    confs.put(topoId, new WithAcl<>(meta.get_acl(), topoConf));
}
Also used : SettableBlobMeta(org.apache.storm.generated.SettableBlobMeta) AccessControl(org.apache.storm.generated.AccessControl)

Aggregations

SettableBlobMeta (org.apache.storm.generated.SettableBlobMeta)61 Test (org.junit.Test)20 ReadableBlobMeta (org.apache.storm.generated.ReadableBlobMeta)18 IOException (java.io.IOException)16 File (java.io.File)14 AccessControl (org.apache.storm.generated.AccessControl)12 AtomicOutputStream (org.apache.storm.blobstore.AtomicOutputStream)10 HashMap (java.util.HashMap)9 Subject (javax.security.auth.Subject)8 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)7 LocalAssignment (org.apache.storm.generated.LocalAssignment)7 TmpPath (org.apache.storm.testing.TmpPath)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 BlobStore (org.apache.storm.blobstore.BlobStore)5 BlobStoreFile (org.apache.storm.blobstore.BlobStoreFile)5 FileInputStream (java.io.FileInputStream)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 KeyNotFoundException (org.apache.storm.generated.KeyNotFoundException)3