public void add(DataSource source) {
    Assert.assertNotNull(source);

    // create data repository
    createDataRepository(source);

    // store source
    dataSourceRepository.add(source);
  }
  @Override
  public void start() {
    // create data repositories
    Map<DataSource, DataRepository> sources = new HashMap<>();
    for (DataSource source : dataSourceRepository.getAll()) {
      sources.put(source, createDataRepository(source));
    }

    // start filter chains
    processorChainManager.startAllProcessorChains(sources);
  }
  public void remove(DataSource source) {
    Assert.assertNotNull(source);

    // delete source
    dataSourceRepository.remove(source);

    // delete source db
    dataRepositoryCache.remove(source.getId());
    processorChainManager.removeAll(source);
    dataViewManager.removeAll(source);
    notificationManager.removeAll(source);
    dbConnectorFactory.deleteDatabase(source.getId());
  }
 public DataSource findBySourceId(String sourceId) throws DocumentNotFoundException {
   return dataSourceRepository.findById(sourceId);
 }
 public List<DataSource> getAll() {
   return dataSourceRepository.getAll();
 }