public void removeSource(String name) throws Exception {

    Partition partition = getPartition();

    Directory directory = partition.getDirectory();
    Collection<Entry> entries = directory.getEntriesBySourceName(name);
    if (entries != null && !entries.isEmpty()) {
      throw new Exception("Source " + name + " is in use.");
    }

    SourceManager sourceManager = partition.getSourceManager();
    sourceManager.stopSource(name);

    SourceConfigManager sourceConfigManager = sourceManager.getSourceConfigManager();
    sourceConfigManager.removeSourceConfig(name);

    removeSourceService(name);
  }
예제 #2
0
 public Directory getDirectory() {
   Partition partition = getPartition();
   if (partition == null) return null;
   return partition.getDirectory();
 }