| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | |
| | | 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 static org.opends.server.messages.ConfigMessages.*; |
| | | import static org.opends.server.messages.ExtensionsMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | |
| | | implements AlertHandler, DynamicMBean, DirectoryServerMBean |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | * The fully-qualified name of this class. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.JMXAlertHandler"; |
| | |
| | | { |
| | | super(); |
| | | |
| | | assert debugConstructor(CLASS_NAME); |
| | | } |
| | | |
| | | |
| | |
| | | public void initializeAlertHandler(ConfigEntry configEntry) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "initializeAlertHandler", |
| | | String.valueOf(configEntry)); |
| | | |
| | | sequenceNumber = new AtomicLong(1); |
| | | |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "initializeAlertHandler", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_JMX_ALERT_HANDLER_CANNOT_REGISTER; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | |
| | | */ |
| | | public void finalizeAlertHandler() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "finalizeAlertHandler"); |
| | | |
| | | // No action is required. |
| | | } |
| | |
| | | */ |
| | | public ObjectName getObjectName() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getObjectName"); |
| | | |
| | | return objectName; |
| | | } |
| | |
| | | public void sendAlertNotification(AlertGenerator generator, String alertType, |
| | | int alertID, String alertMessage) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "sendAlertNotification", |
| | | String.valueOf(generator), String.valueOf(alertID), |
| | | String.valueOf(alertMessage)); |
| | | |
| | | sendNotification(new Notification(alertType, generator.getClassName(), |
| | | sequenceNumber.getAndIncrement(), |
| | |
| | | */ |
| | | public MBeanNotificationInfo[] getNotificationInfo() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getNotificationInfo"); |
| | | |
| | | ArrayList<MBeanNotificationInfo> notifications = |
| | | new ArrayList<MBeanNotificationInfo>(); |
| | |
| | | public Attribute getAttribute(String attribute) |
| | | throws AttributeNotFoundException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getAttribute"); |
| | | |
| | | // There are no attributes for this MBean. |
| | | int msgID = MSGID_CONFIG_JMX_ATTR_NO_ATTR; |
| | |
| | | public void setAttribute(Attribute attribute) |
| | | throws AttributeNotFoundException, InvalidAttributeValueException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setAttribute", String.valueOf(attribute)); |
| | | |
| | | |
| | | // There are no attributes for this MBean. |
| | |
| | | */ |
| | | public AttributeList getAttributes(String[] attributes) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getAttributes", String.valueOf(attributes)); |
| | | |
| | | |
| | | // There are no attributes for this MBean. |
| | |
| | | */ |
| | | public AttributeList setAttributes(AttributeList attributes) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setAttributes", String.valueOf(attributes)); |
| | | |
| | | // There are no attributes for this MBean. |
| | | return new AttributeList(); |
| | |
| | | public Object invoke(String actionName, Object[] params, String[] signature) |
| | | throws MBeanException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "invoke", String.valueOf(actionName), |
| | | String.valueOf(params), String.valueOf(signature)); |
| | | |
| | | // There are no invokable components for this MBean. |
| | | StringBuilder buffer = new StringBuilder(); |
| | |
| | | */ |
| | | public MBeanInfo getMBeanInfo() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getMBeanInfo"); |
| | | |
| | | return new MBeanInfo(CLASS_NAME, "JMX Alert Handler", |
| | | new MBeanAttributeInfo[0], new MBeanConstructorInfo[0], |