| | |
| | | import org.opends.server.types.InvokableMethod; |
| | | import org.opends.server.types.ResultCode; |
| | | import org.opends.server.types.SearchScope; |
| | | 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.loggers.Error.*; |
| | | import static org.opends.server.messages.ConfigMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | |
| | | implements 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.config.JMXMBean"; |
| | | |
| | |
| | | nameStr = MBEAN_BASE_DOMAIN + ":" + "Name=rootDSE" + typeStr; |
| | | } catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "<init>", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_JMX_CANNOT_REGISTER_MBEAN; |
| | | String message = getMessage(msgID, configEntryDN.toString(), |
| | |
| | | */ |
| | | public JMXMBean(DN configEntryDN) |
| | | { |
| | | assert debugConstructor(CLASS_NAME); |
| | | |
| | | this.configEntryDN = configEntryDN; |
| | | |
| | |
| | | } |
| | | } catch(Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "<init>", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | |
| | | mBeanServer.registerMBean(this, objectName); |
| | | |
| | | } catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "<init>", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | e.printStackTrace(); |
| | | |
| | | int msgID = MSGID_CONFIG_JMX_CANNOT_REGISTER_MBEAN; |
| | |
| | | */ |
| | | public ObjectName getObjectName() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getObjectName"); |
| | | |
| | | return objectName; |
| | | } |
| | |
| | | */ |
| | | public CopyOnWriteArrayList<AlertGenerator> getAlertGenerators() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getAlertGenerators"); |
| | | |
| | | return alertGenerators; |
| | | } |
| | |
| | | */ |
| | | public void addAlertGenerator(AlertGenerator generator) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addAlertGenerator", |
| | | String.valueOf(generator)); |
| | | |
| | | synchronized (alertGenerators) |
| | | { |
| | |
| | | */ |
| | | public boolean removeAlertGenerator(AlertGenerator generator) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeAlertGenerator", |
| | | String.valueOf(generator)); |
| | | |
| | | synchronized (alertGenerators) |
| | | { |
| | |
| | | */ |
| | | public CopyOnWriteArrayList<ConfigurableComponent> getConfigurableComponents() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConfigurableComponents"); |
| | | |
| | | return configurableComponents; |
| | | } |
| | |
| | | */ |
| | | public void addConfigurableComponent(ConfigurableComponent component) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addConfigurableComponent", |
| | | String.valueOf(component)); |
| | | |
| | | synchronized (configurableComponents) |
| | | { |
| | |
| | | */ |
| | | public boolean removeConfigurableComponent(ConfigurableComponent component) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeConfigurableComponent", |
| | | String.valueOf(component)); |
| | | |
| | | synchronized (configurableComponents) |
| | | { |
| | |
| | | */ |
| | | public CopyOnWriteArrayList<InvokableComponent> getInvokableComponents() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getInvokableComponents"); |
| | | |
| | | return invokableComponents; |
| | | } |
| | |
| | | */ |
| | | public void addInvokableComponent(InvokableComponent component) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addInvokableComponent", |
| | | String.valueOf(component)); |
| | | |
| | | synchronized (invokableComponents) |
| | | { |
| | |
| | | */ |
| | | public boolean removeInvokableComponent(InvokableComponent component) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeInvokableComponent", |
| | | String.valueOf(component)); |
| | | |
| | | synchronized (invokableComponents) |
| | | { |
| | |
| | | */ |
| | | public CopyOnWriteArrayList<MonitorProvider> getMonitorProviders() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getMonitorProviders"); |
| | | |
| | | return monitorProviders; |
| | | } |
| | |
| | | */ |
| | | public void addMonitorProvider(MonitorProvider component) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "addMonitorProvider", |
| | | String.valueOf(component)); |
| | | |
| | | synchronized (monitorProviders) |
| | | { |
| | |
| | | */ |
| | | public boolean removeMonitorProvider(MonitorProvider component) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "removeMonitorProvider", |
| | | String.valueOf(component)); |
| | | |
| | | synchronized (monitorProviders) |
| | | { |
| | |
| | | */ |
| | | private ConfigAttribute getConfigAttribute(String name) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getConfigAttribute", |
| | | String.valueOf(name)); |
| | | |
| | | for (ConfigurableComponent component : configurableComponents) |
| | | { |
| | |
| | | */ |
| | | private Attribute getJmxAttribute(String name) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getJmxAttribute", String.valueOf(name)); |
| | | |
| | | String attributeName ; |
| | | String pendingString = ";" + OPTION_PENDING_VALUES ; |
| | |
| | | public Attribute getAttribute(String attributeName) |
| | | throws AttributeNotFoundException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getAttribute"); |
| | | |
| | | // |
| | | // Get the jmx Client connection |
| | |
| | | } |
| | | catch (LDAPException e) |
| | | { |
| | | assert debugException(CLASS_NAME, "getAttribute", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_JMX_CANNOT_GET_ATTRIBUTE; |
| | | String message = getMessage(msgID, String.valueOf(attributeName), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "setAttribute", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_JMX_ATTR_NO_ATTR; |
| | | String message = getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | javax.management.Attribute attribute, ConfigEntry configEntry) |
| | | throws AttributeNotFoundException, InvalidAttributeValueException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getLdapAttributeFromJmx", String |
| | | .valueOf(attribute)); |
| | | |
| | | String name = attribute.getName() ; |
| | | // |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "setAttribute", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_JMX_ATTR_NO_ATTR; |
| | | String message = getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "setAttribute", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | logError( |
| | | ErrorLogCategory.CONFIGURATION, |
| | | ErrorLogSeverity.MILD_ERROR, |
| | |
| | | public void setAttribute(javax.management.Attribute attribute) |
| | | throws AttributeNotFoundException, InvalidAttributeValueException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setAttribute", String.valueOf(attribute)); |
| | | |
| | | ConfigEntry configEntry; |
| | | ConfigEntry newConfigEntry ; |
| | |
| | | newConfigEntry = configEntry.duplicate(); |
| | | } catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "setAttribute", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | int msgID = MSGID_CONFIG_JMX_CANNOT_GET_CONFIG_ENTRY; |
| | | String message = getMessage(msgID, String.valueOf(configEntryDN), |
| | |
| | | */ |
| | | public AttributeList getAttributes(String[] attributes) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getAttributes", String.valueOf(attributes)); |
| | | |
| | | // |
| | | // Get the jmx Client connection |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "getAttributes", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | |
| | | // It's possible that this is a monitor attribute rather than a |
| | |
| | | */ |
| | | public AttributeList setAttributes(AttributeList attributes) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "setAttributes", String.valueOf(attributes)); |
| | | |
| | | AttributeList setAttrs = new AttributeList(); |
| | | |
| | |
| | | newConfigEntry = configEntry.duplicate(); |
| | | } catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "setAttribute", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | logError( |
| | | ErrorLogCategory.CONFIGURATION, |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException( |
| | | CLASS_NAME, "setAttribute", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | logError(ErrorLogCategory.CONFIGURATION, ErrorLogSeverity.MILD_ERROR, |
| | | MSGID_CONFIG_JMX_ATTR_NO_ATTR, configEntryDN.toString(), |
| | |
| | | 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)); |
| | | |
| | | for (InvokableComponent component : invokableComponents) |
| | | { |
| | |
| | | } |
| | | catch (MBeanException me) |
| | | { |
| | | assert debugException(CLASS_NAME, "invoke", me); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, me); |
| | | } |
| | | |
| | | throw me; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "invoke", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | throw new MBeanException(e); |
| | | } |
| | |
| | | */ |
| | | public MBeanInfo getMBeanInfo() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getMBeanInfo"); |
| | | JmxClientConnection jmxClientConnection = getClientConnection(); |
| | | if (jmxClientConnection == null) |
| | | { |