예제 #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 init() throws Exception {
    jmxService.register(getObjectName(), this);

    DirectoryConfig directoryConfig = getDirectoryConfig();

    for (String entryName : directoryConfig.getEntryNames()) {
      createEntryService(entryName);
    }
  }
예제 #3
0
  public void destroy() throws Exception {

    DirectoryConfig directoryConfig = getDirectoryConfig();

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

    jmxService.unregister(getObjectName());
  }
예제 #4
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);
  }
예제 #5
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();
  }
예제 #6
0
 public void setChildNames(String entryName, List<String> childNames) throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   directoryConfig.setChildNames(entryName, childNames);
 }
예제 #7
0
 public List<String> getChildNames(String entryName) throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   return directoryConfig.getChildNames(entryName);
 }
예제 #8
0
 public String getParentName(String entryName) throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   return directoryConfig.getParentName(entryName);
 }
예제 #9
0
 public Collection<String> getEntryNames() throws Exception {
   Collection<String> list = new ArrayList<String>();
   DirectoryConfig directoryConfig = getDirectoryConfig();
   list.addAll(directoryConfig.getEntryNames());
   return list;
 }
예제 #10
0
 public Collection<DN> getSuffixes() throws Exception {
   Collection<DN> list = new ArrayList<DN>();
   DirectoryConfig directoryConfig = getDirectoryConfig();
   list.addAll(directoryConfig.getSuffixes());
   return list;
 }
예제 #11
0
 public DN getSuffix() throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   return directoryConfig.getSuffix();
 }
예제 #12
0
 public EntryConfig getEntryConfig(String entryName) throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   return directoryConfig.getEntryConfig(entryName);
 }
예제 #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();
 }
예제 #14
0
 public String getEntryName(DN dn) throws Exception {
   DirectoryConfig directoryConfig = getDirectoryConfig();
   return directoryConfig.getEntryNameByDn(dn);
 }