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());
  }
  public void init() throws Exception {
    jmxService.register(getObjectName(), this);

    DirectoryConfig directoryConfig = getDirectoryConfig();

    for (String entryName : directoryConfig.getEntryNames()) {
      createEntryService(entryName);
    }
  }
  public void destroy() throws Exception {

    DirectoryConfig directoryConfig = getDirectoryConfig();

    for (String entryName : directoryConfig.getEntryNames()) {
      removeEntryService(entryName);
    }

    jmxService.unregister(getObjectName());
  }
  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 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();
  }
 public void setChildNames(String entryName, List<String> childNames) throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   directoryConfig.setChildNames(entryName, childNames);
 }
 public List<String> getChildNames(String entryName) throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   return directoryConfig.getChildNames(entryName);
 }
 public String getParentName(String entryName) throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   return directoryConfig.getParentName(entryName);
 }
 public Collection<String> getEntryNames() throws Exception {
   Collection<String> list = new ArrayList<String>();
   DirectoryConfig directoryConfig = getDirectoryConfig();
   list.addAll(directoryConfig.getEntryNames());
   return list;
 }
Esempio n. 10
0
 public Collection<DN> getSuffixes() throws Exception {
   Collection<DN> list = new ArrayList<DN>();
   DirectoryConfig directoryConfig = getDirectoryConfig();
   list.addAll(directoryConfig.getSuffixes());
   return list;
 }
Esempio n. 11
0
 public DN getSuffix() throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   return directoryConfig.getSuffix();
 }
Esempio n. 12
0
 public EntryConfig getEntryConfig(String entryName) throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   return directoryConfig.getEntryConfig(entryName);
 }
Esempio n. 13
0
 public DN getEntryDn(String entryName) throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   EntryConfig entryConfig = directoryConfig.getEntryConfig(entryName);
   if (entryConfig == null) return null;
   return entryConfig.getDn();
 }
Esempio n. 14
0
 public String getEntryName(DN dn) throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   return directoryConfig.getEntryNameByDn(dn);
 }