Пример #1
0
  public void updateEntry(String name, EntryConfig entryConfig) throws Exception {

    log.debug(TextUtil.repeat("-", 70));

    Directory directory = getDirectory();
    List<Entry> children = null;

    if (directory != null) {
      try {
        Entry oldEntry = directory.removeEntry(entryConfig.getName());
        if (oldEntry != null) {
          children = oldEntry.getChildren();
          oldEntry.destroy();
        }
      } catch (Exception e) {
        log.error(e.getMessage(), e);
      }
    }

    removeEntryService(entryConfig.getName());

    DirectoryConfig directoryConfig = getDirectoryConfig();
    directoryConfig.updateEntryConfig(name, entryConfig);

    if (directory != null) {
      try {
        Entry newEntry = directory.createEntry(entryConfig);
        if (children != null) newEntry.addChildren(children);
      } catch (Exception e) {
        log.error(e.getMessage(), e);
      }
    }

    createEntryService(entryConfig.getName());
  }
Пример #2
0
  public void removeEntry(String entryName) throws Exception {

    log.debug(TextUtil.repeat("-", 70));

    Directory directory = getDirectory();
    if (directory != null) {
      try {
        directory.destroy(entryName);
      } catch (Exception e) {
        log.error(e.getMessage(), e);
      }
    }

    DirectoryConfig directoryConfig = getDirectoryConfig();
    directoryConfig.removeEntryConfig(entryName);

    removeEntryService(entryName);
  }
  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);
  }
Пример #4
0
  public String createEntry(EntryConfig entryConfig) throws Exception {

    log.debug(TextUtil.repeat("-", 70));

    DirectoryConfig directoryConfig = getDirectoryConfig();
    directoryConfig.addEntryConfig(entryConfig);

    Directory directory = getDirectory();
    if (directory != null) {
      try {
        directory.createEntry(entryConfig);
      } catch (Exception e) {
        log.error(e.getMessage(), e);
      }
    }

    createEntryService(entryConfig.getName());

    return entryConfig.getName();
  }