コード例 #1
0
 @Override
 public StreamDefinition findOne(String id) {
   try {
     byte[] bytes = zkConnection.getClient().getData().forPath(Paths.build(Paths.STREAMS, id));
     if (bytes == null) {
       return null;
     }
     Map<String, String> map = ZooKeeperUtils.bytesToMap(bytes);
     StreamDefinition streamDefinition = new StreamDefinition(id, map.get(DEFINITION_KEY));
     if (map.get(MODULE_DEFINITIONS_KEY) != null) {
       List<ModuleDefinition> moduleDefinitions =
           objectReader.readValue(map.get(MODULE_DEFINITIONS_KEY));
       streamDefinition.setModuleDefinitions(moduleDefinitions);
     }
     return streamDefinition;
   } catch (Exception e) {
     // NoNodeException - the definition does not exist
     ZooKeeperUtils.wrapAndThrowIgnoring(e, NoNodeException.class);
   }
   return null;
 }
コード例 #2
0
 @Override
 public void delete(StreamDefinition entity) {
   StreamDefinitionRepositoryUtils.deleteDependencies(moduleDependencyRepository, entity);
   this.delete(entity.getName());
 }