| | |
| | | import org.opends.server.types.operation.PostResponseModifyDNOperation; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.Debug.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.server.loggers.Error.*; |
| | | import static org.opends.server.messages.ConfigMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | |
| | | implements ConfigChangeListener, ConfigAddListener, ConfigDeleteListener, |
| | | BackendInitializationListener, ChangeNotificationListener |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.core.GroupManager"; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | public GroupManager() |
| | | { |
| | | assert debugConstructor(CLASS_NAME); |
| | | |
| | | configHandler = DirectoryServer.getConfigHandler(); |
| | | groupImplementations = new ConcurrentHashMap<DN,Group>(); |
| | |
| | | public void initializeGroupImplementations() |
| | | throws ConfigException, InitializationException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "initializeGroupImplementations"); |
| | | |
| | | |
| | | // First, get the configuration base entry. |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeGroupImplementations", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_CANNOT_GET_BASE; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | |
| | | */ |
| | | public void finalizeGroupManager() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "finalizeGroupManager"); |
| | | |
| | | deregisterAllGroups(); |
| | | |
| | |
| | | */ |
| | | public Iterable<Group> getGroupImplementations() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getGroupImplementations"); |
| | | |
| | | return groupImplementations.values(); |
| | | } |
| | |
| | | */ |
| | | public Iterable<Group> getGroupInstances() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getGroupInstances"); |
| | | |
| | | return groupInstances.values(); |
| | | } |
| | |
| | | */ |
| | | public Group getGroupInstance(DN entryDN) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getGroupInstance", String.valueOf(entryDN)); |
| | | |
| | | Group group = groupInstances.get(entryDN); |
| | | if (group == null) |
| | |
| | | public boolean configChangeIsAcceptable(ConfigEntry configEntry, |
| | | StringBuilder unacceptableReason) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "configChangeIsAcceptable", |
| | | String.valueOf(configEntry), "java.lang.StringBuilder"); |
| | | |
| | | |
| | | // Make sure that the entry has an appropriate objectclass for an extended |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "configChangeIsAcceptable", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_CLASS_NAME; |
| | | String message = getMessage(msgID, configEntry.getDN().toString(), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "configChangeIsAcceptable", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_CLASS_NAME; |
| | | String message = getMessage(msgID, configEntry.getDN().toString(), |
| | |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "configChangeIsAcceptable", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_CLASS; |
| | | String message = getMessage(msgID, groupClass.getName(), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "configChangeIsAcceptable", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_ENABLED_VALUE; |
| | | String message = getMessage(msgID, configEntry.getDN().toString(), |
| | |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange(ConfigEntry configEntry) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "applyConfigurationChange", |
| | | String.valueOf(configEntry)); |
| | | |
| | | |
| | | DN configEntryDN = configEntry.getDN(); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyConfigurationChange", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_ENABLED_VALUE; |
| | | messages.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyConfigurationChange", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_CLASS_NAME; |
| | | messages.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyConfigurationChange", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_CLASS; |
| | | messages.add(getMessage(msgID, className, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyConfigurationChange", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INITIALIZATION_FAILED; |
| | | messages.add(getMessage(msgID, className, |
| | |
| | | public boolean configAddIsAcceptable(ConfigEntry configEntry, |
| | | StringBuilder unacceptableReason) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "configAddIsAcceptable", |
| | | String.valueOf(configEntry), "java.lang.StringBuilder"); |
| | | |
| | | |
| | | // Make sure that no entry already exists with the specified DN. |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "configAddIsAcceptable", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_CLASS_NAME; |
| | | String message = getMessage(msgID, configEntry.getDN().toString(), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "configAddIsAcceptable", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_CLASS_NAME; |
| | | String message = getMessage(msgID, configEntry.getDN().toString(), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "configAddIsAcceptable", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_CLASS; |
| | | String message = getMessage(msgID, groupClass.getName(), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "configAddIsAcceptable", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_ENABLED_VALUE; |
| | | String message = getMessage(msgID, configEntry.getDN().toString(), |
| | |
| | | */ |
| | | public ConfigChangeResult applyConfigurationAdd(ConfigEntry configEntry) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "applyConfigurationAdd", |
| | | String.valueOf(configEntry)); |
| | | |
| | | |
| | | DN configEntryDN = configEntry.getDN(); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyConfigurationAdd", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_ENABLED_VALUE; |
| | | messages.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyConfigurationAdd", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_CLASS_NAME; |
| | | messages.add(getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyConfigurationAdd", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INVALID_CLASS; |
| | | messages.add(getMessage(msgID, className, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "applyConfigurationAdd", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_GROUP_INITIALIZATION_FAILED; |
| | | messages.add(getMessage(msgID, className, String.valueOf(configEntryDN), |
| | |
| | | public boolean configDeleteIsAcceptable(ConfigEntry configEntry, |
| | | StringBuilder unacceptableReason) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "configDeleteIsAcceptable", |
| | | String.valueOf(configEntry), "java.lang.StringBuilder"); |
| | | |
| | | |
| | | // A delete should always be acceptable, so just return true. |
| | |
| | | */ |
| | | public ConfigChangeResult applyConfigurationDelete(ConfigEntry configEntry) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "applyConfigurationDelete", |
| | | String.valueOf(configEntry)); |
| | | |
| | | |
| | | DN configEntryDN = configEntry.getDN(); |
| | |
| | | */ |
| | | public void performBackendInitializationProcessing(Backend backend) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "performBackendInitializationProcessing", |
| | | String.valueOf(backend)); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, |
| | | "performBackendInitializationProcessing", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | // FIXME -- Is there anything that we need to do here? |
| | | continue; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, |
| | | "performBackendInitializationProcessing", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | // FIXME -- Is there anything that we need to do here? |
| | | continue; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, |
| | | "performBackendInitializationProcessing", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | // FIXME -- Is there anything that we need to do here? |
| | | continue; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, |
| | | "performBackendInitializationProcessing", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | // FIXME -- Handle this. |
| | | continue; |
| | |
| | | */ |
| | | public void performBackendFinalizationProcessing(Backend backend) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "performBackendFinalizationProcessing", |
| | | String.valueOf(backend)); |
| | | |
| | | Iterator<Map.Entry<DN,Group>> iterator = |
| | | groupInstances.entrySet().iterator(); |
| | |
| | | public void handleAddOperation(PostResponseAddOperation addOperation, |
| | | Entry entry) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "handleAddOperation", |
| | | String.valueOf(addOperation), String.valueOf(entry)); |
| | | |
| | | List<Control> requestControls = addOperation.getRequestControls(); |
| | | if (requestControls != null) |
| | |
| | | public void handleDeleteOperation(PostResponseDeleteOperation deleteOperation, |
| | | Entry entry) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "handleDeleteOperation", |
| | | String.valueOf(deleteOperation), String.valueOf(entry)); |
| | | |
| | | List<Control> requestControls = deleteOperation.getRequestControls(); |
| | | if (requestControls != null) |
| | |
| | | public void handleModifyOperation(PostResponseModifyOperation modifyOperation, |
| | | Entry oldEntry, Entry newEntry) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "handleModifyOperation", |
| | | String.valueOf(modifyOperation), String.valueOf(oldEntry), |
| | | String.valueOf(newEntry)); |
| | | |
| | | List<Control> requestControls = modifyOperation.getRequestControls(); |
| | | if (requestControls != null) |
| | |
| | | PostResponseModifyDNOperation modifyDNOperation, |
| | | Entry oldEntry, Entry newEntry) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "handleModifyDNOperation", |
| | | String.valueOf(modifyDNOperation), |
| | | String.valueOf(oldEntry), String.valueOf(newEntry)); |
| | | |
| | | List<Control> requestControls = modifyDNOperation.getRequestControls(); |
| | | if (requestControls != null) |
| | |
| | | */ |
| | | private void createAndRegisterGroup(Entry entry) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "createAndRegisterGroup", |
| | | String.valueOf(entry)); |
| | | |
| | | for (Group groupImplementation : groupImplementations.values()) |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "createAndRegisterGroup", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | // FIXME -- Do we need to do anything else? |
| | | } |