| | |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | import org.opends.messages.Message; |
| | | |
| | | |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.ErrorLogger.logError; |
| | | import static org.opends.server.messages.ExtensionsMessages.*; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | |
| | | import org.opends.server.types.AccountStatusNotificationType; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.ErrorLogCategory; |
| | | import org.opends.server.types.ErrorLogSeverity; |
| | | |
| | | |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.ResultCode; |
| | | |
| | |
| | | * The set of names for the account status notification types that may be |
| | | * logged by this notification handler. |
| | | */ |
| | | private static final HashSet<String> NOTIFICATION_TYPE_NAMES = |
| | | new HashSet<String>(); |
| | | private static final HashSet<Message> NOTIFICATION_TYPE_NAMES = |
| | | new HashSet<Message>(); |
| | | |
| | | static |
| | | { |
| | | for (AccountStatusNotificationType t : |
| | | AccountStatusNotificationType.values()) |
| | | { |
| | | NOTIFICATION_TYPE_NAMES.add(t.getNotificationTypeName()); |
| | | NOTIFICATION_TYPE_NAMES.add(t.getNotificationName()); |
| | | } |
| | | } |
| | | |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | public void handleStatusNotification(AccountStatusNotificationType |
| | | notificationType, |
| | | DN userDN, int messageID, String message) |
| | | notificationType, |
| | | DN userDN, Message message) |
| | | { |
| | | if (notificationTypes.contains(notificationType)) |
| | | { |
| | | int msgID = MSGID_ERRORLOG_ACCTNOTHANDLER_NOTIFICATION; |
| | | logError(ErrorLogCategory.PASSWORD_POLICY, ErrorLogSeverity.NOTICE, |
| | | msgID, notificationType.getNotificationTypeName(), |
| | | String.valueOf(userDN), messageID, message); |
| | | logError(NOTE_ERRORLOG_ACCTNOTHANDLER_NOTIFICATION.get( |
| | | notificationType.getNotificationName(), |
| | | String.valueOf(userDN), |
| | | message.getDescriptor().getId(), message)); |
| | | } |
| | | } |
| | | |
| | |
| | | @Override() |
| | | public boolean isConfigurationAcceptable( |
| | | AccountStatusNotificationHandlerCfg configuration, |
| | | List<String> unacceptableReasons) |
| | | List<Message> unacceptableReasons) |
| | | { |
| | | ErrorLogAccountStatusNotificationHandlerCfg config = |
| | | (ErrorLogAccountStatusNotificationHandlerCfg) configuration; |
| | |
| | | */ |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ErrorLogAccountStatusNotificationHandlerCfg configuration, |
| | | List<String> unacceptableReasons |
| | | List<Message> unacceptableReasons |
| | | ) |
| | | { |
| | | // Make sure that we can process the defined notification handler. |
| | |
| | | { |
| | | ResultCode resultCode = ResultCode.SUCCESS; |
| | | boolean adminActionRequired = false; |
| | | ArrayList<String> messages = new ArrayList<String>(); |
| | | ArrayList<Message> messages = new ArrayList<Message>(); |
| | | ConfigChangeResult changeResult = new ConfigChangeResult( |
| | | resultCode, adminActionRequired, messages |
| | | ); |
| | |
| | | * Gets the OpenDS notification type object that corresponds to the |
| | | * configuration counterpart. |
| | | * |
| | | * @param notificationType The configuration notification type for which |
| | | * to retrieve the OpenDS notification type. |
| | | * @param configNotificationType The configuration notification type for |
| | | * which to retrieve the OpenDS notification |
| | | * type. |
| | | */ |
| | | private AccountStatusNotificationType getNotificationType( |
| | | ErrorLogAccountStatusNotificationHandlerCfgDefn. |