Partial fix for issue 2661 - public APIs must not reference private classes.
In org.opends.server.admin.Configuration replace
ManagedObjectDefinition<...,...> definition()
With:
Class<? extends Configuration> configurationClass()
And remove method:
ServerManagedObject<...> managedObject()
This decouples generated server-side management APIs from the rest of the framework with the exception of configuration listeners.
6 files added
45 files modified
| | |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! |
| | | ! Portions Copyright 2007 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | ! --> |
| | | <xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin" |
| | | xmlns:admpp="http://www.opends.org/admin-preprocessor" |
| | |
| | | <xsl:call-template name="generate-server-relation-methods" /> |
| | | </xsl:for-each> |
| | | <!-- |
| | | Configuration definition getter. |
| | | Configuration class getter. |
| | | --> |
| | | <xsl:text>
</xsl:text> |
| | | <xsl:text>
</xsl:text> |
| | |
| | | select="concat(' /**
', |
| | | ' * {@inheritDoc}
', |
| | | ' */
', |
| | | ' public ManagedObjectDefinition<? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg> definition() {
', |
| | | ' return INSTANCE;
', |
| | | ' }
')" /> |
| | | <!-- |
| | | Server managed object getter. |
| | | --> |
| | | <xsl:text>
</xsl:text> |
| | | <xsl:text>
</xsl:text> |
| | | <xsl:text>
</xsl:text> |
| | | <xsl:value-of |
| | | select="concat(' /**
', |
| | | ' * {@inheritDoc}
', |
| | | ' */
', |
| | | ' public ServerManagedObject<? extends ', $this-java-class,'Cfg> managedObject() {
', |
| | | ' return impl;
', |
| | | ' public Class<? extends ', $this-java-class,'Cfg> configurationClass() {
', |
| | | ' return ', $this-java-class, 'Cfg.class;
', |
| | | ' }
')" /> |
| | | <!-- |
| | | Configuration entry DN getter. |
| | |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! |
| | | ! Portions Copyright 2007 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | ! --> |
| | | <xsl:stylesheet version="1.0" xmlns:adm="http://www.opends.org/admin" |
| | | xmlns:admpp="http://www.opends.org/admin-preprocessor" |
| | |
| | | <xsl:text>{
</xsl:text> |
| | | </xsl:template> |
| | | <!-- |
| | | Template for generating the configuration definition getter. |
| | | Template for generating the configuration class getter. |
| | | --> |
| | | <xsl:template name="generate-configuration-definition-getter"> |
| | | <xsl:value-of |
| | | select="concat(' /**
', |
| | | ' * Get the configuration definition associated with this ', $this-ufn, '.
', |
| | | ' * Gets the configuration class associated with this ', $this-ufn, '.
', |
| | | ' *
', |
| | | ' * @return Returns the configuration definition associated with this ', $this-ufn, '.
', |
| | | ' * @return Returns the configuration class associated with this ', $this-ufn, '.
', |
| | | ' */
')" /> |
| | | <xsl:value-of |
| | | select="concat(' ManagedObjectDefinition<? extends ', $this-java-class,'CfgClient, ? extends ', $this-java-class,'Cfg> definition();
')" /> |
| | | select="concat(' Class<? extends ', $this-java-class,'Cfg> configurationClass();
')" /> |
| | | </xsl:template> |
| | | <!-- |
| | | Template for generating the change listener declaration. |
| | |
| | | <xsl:text>
</xsl:text> |
| | | <xsl:call-template name="generate-import-statements"> |
| | | <xsl:with-param name="imports"> |
| | | <xsl:element name="import"> |
| | | <xsl:value-of |
| | | select="concat($this-package, '.client.', $this-java-class, 'CfgClient')" /> |
| | | </xsl:element> |
| | | <xsl:for-each select="$this-local-properties"> |
| | | <xsl:call-template name="get-property-java-imports" > |
| | | <xsl:with-param name="interface" select="'server'" /> |
| | |
| | | org.opends.server.admin.server.ConfigurationDeleteListener |
| | | </import> |
| | | </xsl:if> |
| | | <import>org.opends.server.admin.ManagedObjectDefinition</import> |
| | | </xsl:with-param> |
| | | </xsl:call-template> |
| | | <xsl:text>
</xsl:text> |
| | |
| | | import org.opends.server.admin.client.ManagementContext; |
| | | import org.opends.server.admin.condition.Condition; |
| | | import org.opends.server.admin.condition.Conditions; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | | import org.opends.server.admin.server.ServerConstraintHandler; |
| | | import org.opends.server.admin.server.ServerManagedObject; |
| | | import org.opends.server.admin.server.ServerManagedObjectChangeListener; |
| | | import org.opends.server.admin.server.ServerManagementContext; |
| | | import org.opends.server.admin.std.meta.RootCfgDefn; |
| | | import org.opends.server.config.ConfigException; |
| | |
| | | * disabled. |
| | | */ |
| | | private class ReferentialIntegrityChangeListener implements |
| | | ConfigurationChangeListener<S> { |
| | | ServerManagedObjectChangeListener<S> { |
| | | |
| | | // The error message which should be returned if an attempt is |
| | | // made to disable the referenced component. |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange(S configuration) { |
| | | ServerManagedObject<?> mo = configuration.managedObject(); |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ServerManagedObject<? extends S> mo) { |
| | | try { |
| | | if (targetIsEnabledCondition.evaluate(mo)) { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | |
| | | // This should not happen - the previous call-back should have |
| | | // trapped this. |
| | | throw new IllegalStateException("Attempting to disable a referenced " |
| | | + configuration.definition().getUserFriendlyName()); |
| | | + relationDefinition.getChildDefinition().getUserFriendlyName()); |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isConfigurationChangeAcceptable(S configuration, |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ServerManagedObject<? extends S> mo, |
| | | List<Message> unacceptableReasons) { |
| | | // Always prevent the referenced component from being |
| | | // disabled. |
| | | ServerManagedObject<?> mo = configuration.managedObject(); |
| | | try { |
| | | if (!targetIsEnabledCondition.evaluate(mo)) { |
| | | unacceptableReasons.add(message); |
| | |
| | | |
| | | Message message = ERR_REFINT_UNABLE_TO_EVALUATE_TARGET_CONDITION.get(mo |
| | | .getManagedObjectDefinition().getUserFriendlyName(), String |
| | | .valueOf(configuration.dn()), StaticUtils.getExceptionMessage(e)); |
| | | .valueOf(mo.getDN()), StaticUtils.getExceptionMessage(e)); |
| | | ErrorLogger.logError(message); |
| | | unacceptableReasons.add(message); |
| | | return false; |
| | |
| | | // isConfigurationDeleteAcceptable() call-back should have |
| | | // trapped this. |
| | | throw new IllegalStateException("Attempting to delete a referenced " |
| | | + configuration.definition().getUserFriendlyName()); |
| | | + relationDefinition.getChildDefinition().getUserFriendlyName()); |
| | | } else { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, false); |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | |
| | | |
| | | import org.opends.server.admin.server.ServerManagedObject; |
| | | import org.opends.server.types.DN; |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Gets the configuration definition associated with this |
| | | * configuration. |
| | | * Gets the configuration class associated with this configuration. |
| | | * |
| | | * @return Returns the configuration definition associated with this |
| | | * @return Returns the configuration class associated with this |
| | | * configuration. |
| | | */ |
| | | ManagedObjectDefinition<? extends ConfigurationClient, |
| | | ? extends Configuration> definition(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the underlying server-side managed object associated with |
| | | * this configuration. |
| | | * |
| | | * @return Returns the underlying server-side managed object |
| | | * associated with this configuration. |
| | | */ |
| | | ServerManagedObject<? extends Configuration> managedObject(); |
| | | Class<? extends Configuration> configurationClass(); |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | |
| | | |
| | | /** |
| | | * An adaptor class which converts {@link ConfigAddListener} callbacks |
| | | * to strongly typed {@link ConfigurationAddListener} callbacks. |
| | | * to {@link ServerManagedObjectAddListener} callbacks. |
| | | * |
| | | * @param <S> |
| | | * The type of server configuration handled by the add |
| | |
| | | */ |
| | | private static final DebugTracer TRACER = getTracer(); |
| | | |
| | | // Cached configuration object between accept/apply callbacks. |
| | | private S cachedConfiguration; |
| | | |
| | | // Cached managed object between accept/apply callbacks. |
| | | private ServerManagedObject<? extends S> cachedManagedObject; |
| | | |
| | |
| | | private final InstantiableRelationDefinition<?, S> instantiableRelation; |
| | | |
| | | // The underlying add listener. |
| | | private final ConfigurationAddListener<S> listener; |
| | | private final ServerManagedObjectAddListener<S> listener; |
| | | |
| | | // The optional relation. |
| | | private final OptionalRelationDefinition<?, S> optionalRelation; |
| | |
| | | */ |
| | | public ConfigAddListenerAdaptor(ManagedObjectPath<?, ?> path, |
| | | InstantiableRelationDefinition<?, S> relation, |
| | | ConfigurationAddListener<S> listener) { |
| | | ServerManagedObjectAddListener<S> listener) { |
| | | this.path = path; |
| | | this.instantiableRelation = relation; |
| | | this.optionalRelation = null; |
| | | this.listener = listener; |
| | | this.cachedConfiguration = null; |
| | | this.cachedManagedObject = null; |
| | | } |
| | | |
| | |
| | | */ |
| | | public ConfigAddListenerAdaptor(ManagedObjectPath<?, ?> path, |
| | | OptionalRelationDefinition<?, S> relation, |
| | | ConfigurationAddListener<S> listener) { |
| | | ServerManagedObjectAddListener<S> listener) { |
| | | this.path = path; |
| | | this.optionalRelation = relation; |
| | | this.instantiableRelation = null; |
| | | this.listener = listener; |
| | | this.cachedConfiguration = null; |
| | | this.cachedManagedObject = null; |
| | | } |
| | | |
| | |
| | | // Cached objects are guaranteed to be from previous acceptable |
| | | // callback. |
| | | ConfigChangeResult result = listener |
| | | .applyConfigurationAdd(cachedConfiguration); |
| | | .applyConfigurationAdd(cachedManagedObject); |
| | | |
| | | // Now apply post constraint call-backs. |
| | | if (result.getResultCode() == ResultCode.SUCCESS) { |
| | |
| | | return false; |
| | | } |
| | | |
| | | cachedConfiguration = cachedManagedObject.getConfiguration(); |
| | | |
| | | // Give up immediately if a constraint violation occurs. |
| | | try { |
| | | cachedManagedObject.ensureIsUsable(); |
| | |
| | | |
| | | // Let the add listener decide. |
| | | List<Message> reasons = new LinkedList<Message>(); |
| | | if (listener.isConfigurationAddAcceptable(cachedConfiguration, reasons)) { |
| | | if (listener.isConfigurationAddAcceptable(cachedManagedObject, reasons)) { |
| | | return true; |
| | | } else { |
| | | generateUnacceptableReason(reasons, unacceptableReason); |
| | |
| | | |
| | | |
| | | /** |
| | | * Get the configuration add listener associated with this adaptor. |
| | | * Get the server managed object add listener associated with this |
| | | * adaptor. |
| | | * |
| | | * @return Returns the configuration add listener associated with |
| | | * this adaptor. |
| | | * @return Returns the server managed object add listener associated |
| | | * with this adaptor. |
| | | */ |
| | | ConfigurationAddListener<S> getConfigurationAddListener() { |
| | | ServerManagedObjectAddListener<S> getServerManagedObjectAddListener() { |
| | | return listener; |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * An adaptor class which converts {@link ConfigChangeListener} |
| | | * call-backs to strongly typed {@link ConfigurationChangeListener} |
| | | * call-backs to {@link ServerManagedObjectChangeListener} |
| | | * call-backs. |
| | | * |
| | | * @param <S> |
| | |
| | | private final DN dn; |
| | | |
| | | // The underlying change listener. |
| | | private final ConfigurationChangeListener<? super S> listener; |
| | | private final ServerManagedObjectChangeListener<? super S> listener; |
| | | |
| | | // The managed object path. |
| | | private final ManagedObjectPath<?, S> path; |
| | |
| | | * The underlying change listener. |
| | | */ |
| | | public ConfigChangeListenerAdaptor(ManagedObjectPath<?, S> path, |
| | | ConfigurationChangeListener<? super S> listener) { |
| | | ServerManagedObjectChangeListener<? super S> listener) { |
| | | this.path = path; |
| | | this.dn = DNBuilder.create(path); |
| | | this.listener = listener; |
| | |
| | | cachedManagedObject.setConfigEntry(configEntry); |
| | | |
| | | ConfigChangeResult result = listener |
| | | .applyConfigurationChange(cachedManagedObject.getConfiguration()); |
| | | .applyConfigurationChange(cachedManagedObject); |
| | | |
| | | // Now apply post constraint call-backs. |
| | | if (result.getResultCode() == ResultCode.SUCCESS) { |
| | |
| | | |
| | | // Let the change listener decide. |
| | | List<Message> reasons = new LinkedList<Message>(); |
| | | if (listener.isConfigurationChangeAcceptable(cachedManagedObject |
| | | .getConfiguration(), reasons)) { |
| | | if (listener.isConfigurationChangeAcceptable(cachedManagedObject,reasons)) { |
| | | return true; |
| | | } else { |
| | | generateUnacceptableReason(reasons, unacceptableReason); |
| | |
| | | |
| | | |
| | | /** |
| | | * Get the configuration change listener associated with this |
| | | * adaptor. |
| | | * |
| | | * @return Returns the configuration change listener associated with |
| | | * Get the server managed object change listener associated with |
| | | * this adaptor. |
| | | * |
| | | * @return Returns the server managed object change listener |
| | | * associated with this adaptor. |
| | | */ |
| | | ConfigurationChangeListener<? super S> getConfigurationChangeListener() { |
| | | ServerManagedObjectChangeListener<? super S> |
| | | getServerManagedObjectChangeListener() { |
| | | return listener; |
| | | } |
| | | |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | |
| | | |
| | | /** |
| | | * An adaptor class which converts {@link ConfigDeleteListener} |
| | | * callbacks to strongly typed {@link ConfigurationDeleteListener} |
| | | * callbacks. |
| | | * callbacks to {@link ServerManagedObjectDeleteListener} callbacks. |
| | | * |
| | | * @param <S> |
| | | * The type of server configuration handled by the delete |
| | |
| | | */ |
| | | private static final DebugTracer TRACER = getTracer(); |
| | | |
| | | // Cached configuration object between accept/apply callbacks. |
| | | private S cachedConfiguration; |
| | | |
| | | // Cached managed object between accept/apply callbacks. |
| | | private ServerManagedObject<? extends S> cachedManagedObject; |
| | | |
| | |
| | | private final InstantiableRelationDefinition<?, S> instantiableRelation; |
| | | |
| | | // The underlying delete listener. |
| | | private final ConfigurationDeleteListener<S> listener; |
| | | private final ServerManagedObjectDeleteListener<S> listener; |
| | | |
| | | // The optional relation. |
| | | private final OptionalRelationDefinition<?, S> optionalRelation; |
| | |
| | | */ |
| | | public ConfigDeleteListenerAdaptor(ManagedObjectPath<?, ?> path, |
| | | InstantiableRelationDefinition<?, S> relation, |
| | | ConfigurationDeleteListener<S> listener) { |
| | | ServerManagedObjectDeleteListener<S> listener) { |
| | | this.path = path; |
| | | this.optionalRelation = null; |
| | | this.instantiableRelation = relation; |
| | | this.listener = listener; |
| | | this.cachedConfiguration = null; |
| | | this.cachedManagedObject = null; |
| | | } |
| | | |
| | |
| | | */ |
| | | public ConfigDeleteListenerAdaptor(ManagedObjectPath<?, ?> path, |
| | | OptionalRelationDefinition<?, S> relation, |
| | | ConfigurationDeleteListener<S> listener) { |
| | | ServerManagedObjectDeleteListener<S> listener) { |
| | | this.path = path; |
| | | this.optionalRelation = relation; |
| | | this.instantiableRelation = null; |
| | | this.listener = listener; |
| | | this.cachedConfiguration = null; |
| | | this.cachedManagedObject = null; |
| | | } |
| | | |
| | |
| | | // Cached objects are guaranteed to be from previous acceptable |
| | | // callback. |
| | | ConfigChangeResult result = listener |
| | | .applyConfigurationDelete(cachedConfiguration); |
| | | .applyConfigurationDelete(cachedManagedObject); |
| | | |
| | | // Now apply post constraint call-backs. |
| | | if (result.getResultCode() == ResultCode.SUCCESS) { |
| | |
| | | return false; |
| | | } |
| | | |
| | | cachedConfiguration = cachedManagedObject.getConfiguration(); |
| | | List<Message> reasons = new LinkedList<Message>(); |
| | | |
| | | // Enforce any constraints. |
| | |
| | | } |
| | | |
| | | // Let the delete listener decide. |
| | | if (listener.isConfigurationDeleteAcceptable(cachedConfiguration, |
| | | if (listener.isConfigurationDeleteAcceptable(cachedManagedObject, |
| | | reasons)) { |
| | | return true; |
| | | } else { |
| | |
| | | |
| | | |
| | | /** |
| | | * Get the configuration delete listener associated with this |
| | | * adaptor. |
| | | * |
| | | * @return Returns the configuration delete listener associated with |
| | | * Get the server managed object delete listener associated with |
| | | * this adaptor. |
| | | * |
| | | * @return Returns the server managed object delete listener |
| | | * associated with this adaptor. |
| | | */ |
| | | ConfigurationDeleteListener<S> getConfigurationDeleteListener() { |
| | | ServerManagedObjectDeleteListener<S> getServerManagedObjectDeleteListener() { |
| | | return listener; |
| | | } |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | |
| | | |
| | |
| | | * The type of configuration that this listener should be |
| | | * notified about. |
| | | */ |
| | | public interface ConfigurationAddListener<T> { |
| | | public interface ConfigurationAddListener<T extends Configuration> { |
| | | |
| | | /** |
| | | * Indicates whether the proposed addition of a new configuration is |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | |
| | | |
| | |
| | | * The type of configuration that this listener should be |
| | | * notified about. |
| | | */ |
| | | public interface ConfigurationChangeListener<T> { |
| | | public interface ConfigurationChangeListener<T extends Configuration> { |
| | | |
| | | /** |
| | | * Indicates whether the proposed change to the configuration is |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | |
| | | |
| | |
| | | * The type of configuration that this listener should be |
| | | * notified about. |
| | | */ |
| | | public interface ConfigurationDeleteListener<T> { |
| | | public interface ConfigurationDeleteListener<T extends Configuration> { |
| | | |
| | | /** |
| | | * Indicates whether the proposed deletion of an existing |
| | |
| | | |
| | | |
| | | /** |
| | | * Deregisters an existing server managed object add listener. |
| | | * |
| | | * @param <M> |
| | | * The type of the child server configuration object. |
| | | * @param d |
| | | * The instantiable relation definition. |
| | | * @param listener |
| | | * The server managed object add listener. |
| | | * @throws IllegalArgumentException |
| | | * If the instantiable relation definition is not |
| | | * associated with this managed object's definition. |
| | | */ |
| | | public <M extends Configuration> void deregisterAddListener( |
| | | InstantiableRelationDefinition<?, M> d, |
| | | ServerManagedObjectAddListener<M> listener) |
| | | throws IllegalArgumentException { |
| | | validateRelationDefinition(d); |
| | | |
| | | DN baseDN = DNBuilder.create(path, d); |
| | | deregisterAddListener(baseDN, listener); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Deregisters an existing configuration add listener. |
| | | * |
| | | * @param <M> |
| | |
| | | |
| | | |
| | | /** |
| | | * Deregisters an existing server managed object add listener. |
| | | * |
| | | * @param <M> |
| | | * The type of the child server configuration object. |
| | | * @param d |
| | | * The optional relation definition. |
| | | * @param listener |
| | | * The server managed object add listener. |
| | | * @throws IllegalArgumentException |
| | | * If the optional relation definition is not associated |
| | | * with this managed object's definition. |
| | | */ |
| | | public <M extends Configuration> void deregisterAddListener( |
| | | OptionalRelationDefinition<?, M> d, |
| | | ServerManagedObjectAddListener<M> listener) |
| | | throws IllegalArgumentException { |
| | | validateRelationDefinition(d); |
| | | |
| | | DN baseDN = DNBuilder.create(path, d).getParent(); |
| | | deregisterAddListener(baseDN, listener); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Deregisters an existing configuration change listener. |
| | | * |
| | | * @param listener |
| | |
| | | if (l instanceof ConfigChangeListenerAdaptor) { |
| | | ConfigChangeListenerAdaptor<?> adaptor = |
| | | (ConfigChangeListenerAdaptor<?>) l; |
| | | if (adaptor.getConfigurationChangeListener() == listener) { |
| | | ServerManagedObjectChangeListener<?> l2 = adaptor |
| | | .getServerManagedObjectChangeListener(); |
| | | if (l2 instanceof ServerManagedObjectChangeListenerAdaptor<?>) { |
| | | ServerManagedObjectChangeListenerAdaptor<?> adaptor2 = |
| | | (ServerManagedObjectChangeListenerAdaptor<?>) l2; |
| | | if (adaptor2.getConfigurationChangeListener() == listener) { |
| | | adaptor.finalizeChangeListener(); |
| | | configEntry.deregisterChangeListener(adaptor); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Deregisters an existing server managed object change listener. |
| | | * |
| | | * @param listener |
| | | * The server managed object change listener. |
| | | */ |
| | | public void deregisterChangeListener( |
| | | ServerManagedObjectChangeListener<? super S> listener) { |
| | | for (ConfigChangeListener l : configEntry.getChangeListeners()) { |
| | | if (l instanceof ConfigChangeListenerAdaptor) { |
| | | ConfigChangeListenerAdaptor<?> adaptor = |
| | | (ConfigChangeListenerAdaptor<?>) l; |
| | | if (adaptor.getServerManagedObjectChangeListener() == listener) { |
| | | adaptor.finalizeChangeListener(); |
| | | configEntry.deregisterChangeListener(adaptor); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * Deregisters an existing server managed object delete listener. |
| | | * |
| | | * @param <M> |
| | | * The type of the child server configuration object. |
| | | * @param d |
| | | * The instantiable relation definition. |
| | | * @param listener |
| | | * The server managed object delete listener. |
| | | * @throws IllegalArgumentException |
| | | * If the instantiable relation definition is not |
| | | * associated with this managed object's definition. |
| | | */ |
| | | public <M extends Configuration> void deregisterDeleteListener( |
| | | InstantiableRelationDefinition<?, M> d, |
| | | ServerManagedObjectDeleteListener<M> listener) |
| | | throws IllegalArgumentException { |
| | | validateRelationDefinition(d); |
| | | |
| | | DN baseDN = DNBuilder.create(path, d); |
| | | deregisterDeleteListener(baseDN, listener); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Deregisters an existing configuration delete listener. |
| | | * |
| | | * @param <M> |
| | |
| | | |
| | | |
| | | /** |
| | | * Deregisters an existing server managed object delete listener. |
| | | * |
| | | * @param <M> |
| | | * The type of the child server configuration object. |
| | | * @param d |
| | | * The optional relation definition. |
| | | * @param listener |
| | | * The server managed object delete listener. |
| | | * @throws IllegalArgumentException |
| | | * If the optional relation definition is not associated |
| | | * with this managed object's definition. |
| | | */ |
| | | public <M extends Configuration> void deregisterDeleteListener( |
| | | OptionalRelationDefinition<?, M> d, |
| | | ServerManagedObjectDeleteListener<M> listener) |
| | | throws IllegalArgumentException { |
| | | validateRelationDefinition(d); |
| | | |
| | | DN baseDN = DNBuilder.create(path, d).getParent(); |
| | | deregisterDeleteListener(baseDN, listener); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieve an instantiable child managed object. |
| | | * |
| | | * @param <M> |
| | |
| | | InstantiableRelationDefinition<?, M> d, |
| | | ConfigurationAddListener<M> listener) throws IllegalArgumentException, |
| | | ConfigException { |
| | | registerAddListener(d, new ServerManagedObjectAddListenerAdaptor<M>( |
| | | listener)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Register to be notified when new child server managed object are |
| | | * added beneath an instantiable relation. |
| | | * |
| | | * @param <M> |
| | | * The type of the child server configuration object. |
| | | * @param d |
| | | * The instantiable relation definition. |
| | | * @param listener |
| | | * The server managed object add listener. |
| | | * @throws IllegalArgumentException |
| | | * If the instantiable relation definition is not |
| | | * associated with this managed object's definition. |
| | | * @throws ConfigException |
| | | * If the configuration entry associated with the |
| | | * instantiable relation could not be retrieved. |
| | | */ |
| | | public <M extends Configuration> void registerAddListener( |
| | | InstantiableRelationDefinition<?, M> d, |
| | | ServerManagedObjectAddListener<M> listener) |
| | | throws IllegalArgumentException, ConfigException { |
| | | validateRelationDefinition(d); |
| | | DN baseDN = DNBuilder.create(path, d); |
| | | ConfigAddListener adaptor = new ConfigAddListenerAdaptor<M>(path, d, |
| | |
| | | public <M extends Configuration> void registerAddListener( |
| | | OptionalRelationDefinition<?, M> d, ConfigurationAddListener<M> listener) |
| | | throws IllegalArgumentException, ConfigException { |
| | | registerAddListener(d, new ServerManagedObjectAddListenerAdaptor<M>( |
| | | listener)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Register to be notified when a new child server managed object is |
| | | * added beneath an optional relation. |
| | | * |
| | | * @param <M> |
| | | * The type of the child server configuration object. |
| | | * @param d |
| | | * The optional relation definition. |
| | | * @param listener |
| | | * The server managed object add listener. |
| | | * @throws IllegalArgumentException |
| | | * If the optional relation definition is not associated |
| | | * with this managed object's definition. |
| | | * @throws ConfigException |
| | | * If the configuration entry associated with the optional |
| | | * relation could not be retrieved. |
| | | */ |
| | | public <M extends Configuration> void registerAddListener( |
| | | OptionalRelationDefinition<?, M> d, |
| | | ServerManagedObjectAddListener<M> listener) |
| | | throws IllegalArgumentException, ConfigException { |
| | | validateRelationDefinition(d); |
| | | DN baseDN = DNBuilder.create(path, d).getParent(); |
| | | ConfigAddListener adaptor = new ConfigAddListenerAdaptor<M>(path, d, |
| | |
| | | */ |
| | | public void registerChangeListener( |
| | | ConfigurationChangeListener<? super S> listener) { |
| | | registerChangeListener(new ServerManagedObjectChangeListenerAdaptor<S>( |
| | | listener)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Register to be notified when this server managed object is |
| | | * changed. |
| | | * |
| | | * @param listener |
| | | * The server managed object change listener. |
| | | */ |
| | | public void registerChangeListener( |
| | | ServerManagedObjectChangeListener<? super S> listener) { |
| | | ConfigChangeListener adaptor = new ConfigChangeListenerAdaptor<S>(path, |
| | | listener); |
| | | configEntry.registerChangeListener(adaptor); |
| | |
| | | InstantiableRelationDefinition<?, M> d, |
| | | ConfigurationDeleteListener<M> listener) throws IllegalArgumentException, |
| | | ConfigException { |
| | | registerDeleteListener(d, new ServerManagedObjectDeleteListenerAdaptor<M>( |
| | | listener)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Register to be notified when existing child server managed |
| | | * objects are deleted beneath an instantiable relation. |
| | | * |
| | | * @param <M> |
| | | * The type of the child server configuration object. |
| | | * @param d |
| | | * The instantiable relation definition. |
| | | * @param listener |
| | | * The server managed objects delete listener. |
| | | * @throws IllegalArgumentException |
| | | * If the instantiable relation definition is not |
| | | * associated with this managed object's definition. |
| | | * @throws ConfigException |
| | | * If the configuration entry associated with the |
| | | * instantiable relation could not be retrieved. |
| | | */ |
| | | public <M extends Configuration> void registerDeleteListener( |
| | | InstantiableRelationDefinition<?, M> d, |
| | | ServerManagedObjectDeleteListener<M> listener) |
| | | throws IllegalArgumentException, ConfigException { |
| | | validateRelationDefinition(d); |
| | | DN baseDN = DNBuilder.create(path, d); |
| | | ConfigDeleteListener adaptor = new ConfigDeleteListenerAdaptor<M>(path, d, |
| | |
| | | OptionalRelationDefinition<?, M> d, |
| | | ConfigurationDeleteListener<M> listener) throws IllegalArgumentException, |
| | | ConfigException { |
| | | registerDeleteListener(d, new ServerManagedObjectDeleteListenerAdaptor<M>( |
| | | listener)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Register to be notified when an existing child server managed |
| | | * object is deleted beneath an optional relation. |
| | | * |
| | | * @param <M> |
| | | * The type of the child server configuration object. |
| | | * @param d |
| | | * The optional relation definition. |
| | | * @param listener |
| | | * The server managed object delete listener. |
| | | * @throws IllegalArgumentException |
| | | * If the optional relation definition is not associated |
| | | * with this managed object's definition. |
| | | * @throws ConfigException |
| | | * If the configuration entry associated with the optional |
| | | * relation could not be retrieved. |
| | | */ |
| | | public <M extends Configuration> void registerDeleteListener( |
| | | OptionalRelationDefinition<?, M> d, |
| | | ServerManagedObjectDeleteListener<M> listener) |
| | | throws IllegalArgumentException, ConfigException { |
| | | validateRelationDefinition(d); |
| | | DN baseDN = DNBuilder.create(path, d).getParent(); |
| | | ConfigDeleteListener adaptor = new ConfigDeleteListenerAdaptor<M>(path, d, |
| | |
| | | if (l instanceof ConfigAddListenerAdaptor) { |
| | | ConfigAddListenerAdaptor<?> adaptor = |
| | | (ConfigAddListenerAdaptor<?>) l; |
| | | if (adaptor.getConfigurationAddListener() == listener) { |
| | | ServerManagedObjectAddListener<?> l2 = adaptor |
| | | .getServerManagedObjectAddListener(); |
| | | if (l2 instanceof ServerManagedObjectAddListenerAdaptor<?>) { |
| | | ServerManagedObjectAddListenerAdaptor<?> adaptor2 = |
| | | (ServerManagedObjectAddListenerAdaptor<?>) l2; |
| | | if (adaptor2.getConfigurationAddListener() == listener) { |
| | | configEntry.deregisterAddListener(adaptor); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } catch (ConfigException e) { |
| | | // Ignore the exception since this implies deregistration. |
| | | if (debugEnabled()) { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // Deregister an add listener. |
| | | private <M extends Configuration> void deregisterAddListener(DN baseDN, |
| | | ServerManagedObjectAddListener<M> listener) { |
| | | try { |
| | | ConfigEntry configEntry = getListenerConfigEntry(baseDN); |
| | | if (configEntry != null) { |
| | | for (ConfigAddListener l : configEntry.getAddListeners()) { |
| | | if (l instanceof ConfigAddListenerAdaptor) { |
| | | ConfigAddListenerAdaptor<?> adaptor = |
| | | (ConfigAddListenerAdaptor<?>) l; |
| | | if (adaptor.getServerManagedObjectAddListener() == listener) { |
| | | configEntry.deregisterAddListener(adaptor); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | // Deregister a delete listener. |
| | | private <M> void deregisterDeleteListener(DN baseDN, |
| | | private <M extends Configuration> void deregisterDeleteListener(DN baseDN, |
| | | ConfigurationDeleteListener<M> listener) { |
| | | try { |
| | | ConfigEntry configEntry = getListenerConfigEntry(baseDN); |
| | |
| | | if (l instanceof ConfigDeleteListenerAdaptor) { |
| | | ConfigDeleteListenerAdaptor<?> adaptor = |
| | | (ConfigDeleteListenerAdaptor<?>) l; |
| | | if (adaptor.getConfigurationDeleteListener() == listener) { |
| | | ServerManagedObjectDeleteListener<?> l2 = adaptor |
| | | .getServerManagedObjectDeleteListener(); |
| | | if (l2 instanceof ServerManagedObjectDeleteListenerAdaptor<?>) { |
| | | ServerManagedObjectDeleteListenerAdaptor<?> adaptor2 = |
| | | (ServerManagedObjectDeleteListenerAdaptor<?>) l2; |
| | | if (adaptor2.getConfigurationDeleteListener() == listener) { |
| | | configEntry.deregisterDeleteListener(adaptor); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } catch (ConfigException e) { |
| | | // Ignore the exception since this implies deregistration. |
| | | if (debugEnabled()) { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // Deregister a delete listener. |
| | | private <M extends Configuration> void deregisterDeleteListener(DN baseDN, |
| | | ServerManagedObjectDeleteListener<M> listener) { |
| | | try { |
| | | ConfigEntry configEntry = getListenerConfigEntry(baseDN); |
| | | if (configEntry != null) { |
| | | for (ConfigDeleteListener l : configEntry.getDeleteListeners()) { |
| | | if (l instanceof ConfigDeleteListenerAdaptor) { |
| | | ConfigDeleteListenerAdaptor<?> adaptor = |
| | | (ConfigDeleteListenerAdaptor<?>) l; |
| | | if (adaptor.getServerManagedObjectDeleteListener() == listener) { |
| | | configEntry.deregisterDeleteListener(adaptor); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | | |
| | | |
| | | import org.opends.messages.Message; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This interface defines the methods that a Directory Server |
| | | * configurable component should implement if it wishes to be able to |
| | | * receive notifications when a new server managed object is added. |
| | | * |
| | | * @param <T> |
| | | * The type of server managed object that this listener |
| | | * should be notified about. |
| | | */ |
| | | public interface ServerManagedObjectAddListener<T extends Configuration> { |
| | | |
| | | /** |
| | | * Indicates whether the proposed addition of a new server managed |
| | | * object is acceptable to this add listener. |
| | | * |
| | | * @param mo |
| | | * The server managed object that will be added. |
| | | * @param unacceptableReasons |
| | | * A list that can be used to hold messages about why the |
| | | * provided server managed object is not acceptable. |
| | | * @return Returns <code>true</code> if the proposed addition is |
| | | * acceptable, or <code>false</code> if it is not. |
| | | */ |
| | | public boolean isConfigurationAddAcceptable( |
| | | ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Adds a new server managed object to this add listener. |
| | | * |
| | | * @param mo |
| | | * The server managed object that will be added. |
| | | * @return Returns information about the result of adding the server |
| | | * managed object. |
| | | */ |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | ServerManagedObject<? extends T> mo); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | |
| | | |
| | | |
| | | /** |
| | | * An adaptor class which converts |
| | | * {@link ServerManagedObjectAddListener} callbacks to |
| | | * {@link ConfigurationAddListener} callbacks. |
| | | * |
| | | * @param <T> |
| | | * The type of server managed object that this listener |
| | | * should be notified about. |
| | | */ |
| | | final class ServerManagedObjectAddListenerAdaptor<T extends Configuration> |
| | | implements ServerManagedObjectAddListener<T> { |
| | | |
| | | // The underlying add listener. |
| | | private final ConfigurationAddListener<T> listener; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new server managed object add listener adaptor. |
| | | * |
| | | * @param listener |
| | | * The underlying add listener. |
| | | */ |
| | | public ServerManagedObjectAddListenerAdaptor( |
| | | ConfigurationAddListener<T> listener) { |
| | | this.listener = listener; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | ServerManagedObject<? extends T> mo) { |
| | | return listener.applyConfigurationAdd(mo.getConfiguration()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the configuration add listener associated with this adaptor. |
| | | * |
| | | * @return Returns the configuration add listener associated with |
| | | * this adaptor. |
| | | */ |
| | | public ConfigurationAddListener<T> getConfigurationAddListener() { |
| | | return listener; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isConfigurationAddAcceptable( |
| | | ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons) { |
| | | return listener.isConfigurationAddAcceptable(mo.getConfiguration(), |
| | | unacceptableReasons); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | | |
| | | |
| | | import org.opends.messages.Message; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This interface defines the methods that a Directory Server |
| | | * configurable component should implement if it wishes to be able to |
| | | * receive notifications when a its associated server managed object |
| | | * is changed. |
| | | * |
| | | * @param <T> |
| | | * The type of server managed object that this listener |
| | | * should be notified about. |
| | | */ |
| | | public interface ServerManagedObjectChangeListener<T extends Configuration> { |
| | | |
| | | /** |
| | | * Indicates whether the proposed change to the server managed |
| | | * object is acceptable to this change listener. |
| | | * |
| | | * @param mo |
| | | * The new server managed object containing the changes. |
| | | * @param unacceptableReasons |
| | | * A list that can be used to hold messages about why the |
| | | * provided server managed object is not acceptable. |
| | | * @return Returns <code>true</code> if the proposed change is |
| | | * acceptable, or <code>false</code> if it is not. |
| | | */ |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Applies the server managed object changes to this change |
| | | * listener. |
| | | * |
| | | * @param mo |
| | | * The new server managed object containing the changes. |
| | | * @return Returns information about the result of changing the |
| | | * server managed object. |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ServerManagedObject<? extends T> mo); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | |
| | | |
| | | |
| | | /** |
| | | * An adaptor class which converts |
| | | * {@link ServerManagedObjectChangeListener} callbacks to |
| | | * {@link ConfigurationChangeListener} callbacks. |
| | | * |
| | | * @param <T> |
| | | * The type of server managed object that this listener |
| | | * should be notified about. |
| | | */ |
| | | final class ServerManagedObjectChangeListenerAdaptor<T extends Configuration> |
| | | implements ServerManagedObjectChangeListener<T> { |
| | | |
| | | // The underlying change listener. |
| | | private final ConfigurationChangeListener<? super T> listener; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new server managed object change listener adaptor. |
| | | * |
| | | * @param listener |
| | | * The underlying change listener. |
| | | */ |
| | | public ServerManagedObjectChangeListenerAdaptor( |
| | | ConfigurationChangeListener<? super T> listener) { |
| | | this.listener = listener; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ServerManagedObject<? extends T> mo) { |
| | | return listener.applyConfigurationChange(mo.getConfiguration()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the configuration change listener associated with this |
| | | * adaptor. |
| | | * |
| | | * @return Returns the configuration change listener associated with |
| | | * this adaptor. |
| | | */ |
| | | public ConfigurationChangeListener<? super T> |
| | | getConfigurationChangeListener() { |
| | | return listener; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons) { |
| | | return listener.isConfigurationChangeAcceptable(mo.getConfiguration(), |
| | | unacceptableReasons); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | | |
| | | |
| | | import org.opends.messages.Message; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This interface defines the methods that a Directory Server |
| | | * configurable component should implement if it wishes to be able to |
| | | * receive notifications when an existing server managed object is |
| | | * deleted. |
| | | * |
| | | * @param <T> |
| | | * The type of server managed object that this listener |
| | | * should be notified about. |
| | | */ |
| | | public interface ServerManagedObjectDeleteListener<T extends Configuration> { |
| | | |
| | | /** |
| | | * Indicates whether the proposed deletion of an existing server |
| | | * managed object is acceptable to this delete listener. |
| | | * |
| | | * @param mo |
| | | * The server managed object that will be deleted. |
| | | * @param unacceptableReasons |
| | | * A list that can be used to hold messages about why the |
| | | * provided server managed object is not acceptable. |
| | | * @return Returns <code>true</code> if the proposed deletion is |
| | | * acceptable, or <code>false</code> if it is not. |
| | | */ |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Deletes an existing server managed object from this delete |
| | | * listener. |
| | | * |
| | | * @param mo |
| | | * The existing server managed object that will be deleted. |
| | | * @return Returns information about the result of deleting the |
| | | * server managed object. |
| | | */ |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | ServerManagedObject<? extends T> mo); |
| | | } |
| New file |
| | |
| | | /* |
| | | * CDDL HEADER START |
| | | * |
| | | * The contents of this file are subject to the terms of the |
| | | * Common Development and Distribution License, Version 1.0 only |
| | | * (the "License"). You may not use this file except in compliance |
| | | * with the License. |
| | | * |
| | | * You can obtain a copy of the license at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE |
| | | * or https://OpenDS.dev.java.net/OpenDS.LICENSE. |
| | | * See the License for the specific language governing permissions |
| | | * and limitations under the License. |
| | | * |
| | | * When distributing Covered Code, include this CDDL HEADER in each |
| | | * file and include the License file at |
| | | * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, |
| | | * add the following below this CDDL HEADER, with the fields enclosed |
| | | * by brackets "[]" replaced with your own identifying information: |
| | | * Portions Copyright [yyyy] [name of copyright owner] |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | |
| | | |
| | | |
| | | /** |
| | | * An adaptor class which converts |
| | | * {@link ServerManagedObjectDeleteListener} callbacks to |
| | | * {@link ConfigurationDeleteListener} callbacks. |
| | | * |
| | | * @param <T> |
| | | * The type of server managed object that this listener |
| | | * should be notified about. |
| | | */ |
| | | final class ServerManagedObjectDeleteListenerAdaptor<T extends Configuration> |
| | | implements ServerManagedObjectDeleteListener<T> { |
| | | |
| | | // The underlying delete listener. |
| | | private final ConfigurationDeleteListener<T> listener; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new server managed object delete listener adaptor. |
| | | * |
| | | * @param listener |
| | | * The underlying delete listener. |
| | | */ |
| | | public ServerManagedObjectDeleteListenerAdaptor( |
| | | ConfigurationDeleteListener<T> listener) { |
| | | this.listener = listener; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ConfigChangeResult applyConfigurationDelete( |
| | | ServerManagedObject<? extends T> mo) { |
| | | return listener.applyConfigurationDelete(mo.getConfiguration()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the configuration delete listener associated with this |
| | | * adaptor. |
| | | * |
| | | * @return Returns the configuration delete listener associated with |
| | | * this adaptor. |
| | | */ |
| | | public ConfigurationDeleteListener<T> getConfigurationDeleteListener() { |
| | | return listener; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons) { |
| | | return listener.isConfigurationDeleteAcceptable(mo.getConfiguration(), |
| | | unacceptableReasons); |
| | | } |
| | | |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | if (configuration != null) |
| | | { |
| | | Method method = |
| | | provider.getClass().getMethod("initializeAccessControlHandler", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = provider.getClass().getMethod( |
| | | "initializeAccessControlHandler", |
| | | configuration.configurationClass()); |
| | | if(initialize) { |
| | | method.invoke(provider, configuration); |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | Method method = notificationHandler.getClass().getMethod( |
| | | "initializeStatusNotificationHandler", |
| | | configuration.definition().getServerConfigurationClass() |
| | | ); |
| | | configuration.configurationClass()); |
| | | method.invoke(notificationHandler, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | Method method = |
| | | handler.getClass().getMethod("initializeAlertHandler", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = handler.getClass().getMethod("initializeAlertHandler", |
| | | configuration.configurationClass()); |
| | | method.invoke(handler, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | Method method = |
| | | syntax.getClass().getMethod("initializeSyntax", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = syntax.getClass().getMethod("initializeSyntax", |
| | | configuration.configurationClass()); |
| | | method.invoke(syntax, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | Method method = |
| | | mapper.getClass().getMethod("initializeCertificateMapper", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | configuration.configurationClass()); |
| | | method.invoke(mapper, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | // Determine the initialization method to use: it must take a |
| | | // single parameter which is the exact type of the configuration |
| | | // object. |
| | | Method method = theClass.getMethod( |
| | | "initializeConnectionHandler", config.definition() |
| | | .getServerConfigurationClass()); |
| | | Method method = theClass.getMethod("initializeConnectionHandler", config |
| | | .configurationClass()); |
| | | |
| | | method.invoke(connectionHandler, config); |
| | | } catch (Exception e) { |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | Method method = cache.getClass().getMethod( |
| | | "initializeEntryCache", |
| | | configuration.definition().getServerConfigurationClass() |
| | | ); |
| | | Method method = cache.getClass().getMethod("initializeEntryCache", |
| | | configuration.configurationClass()); |
| | | method.invoke(cache, configuration); |
| | | } |
| | | // This will check if configuration is acceptable on disabled |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | // Determine the initialization method to use: it must take a |
| | | // single parameter which is the exact type of the configuration |
| | | // object. |
| | | Method method = theClass.getMethod( |
| | | "initializeExtendedOperationHandler", |
| | | config.definition().getServerConfigurationClass()); |
| | | Method method = theClass.getMethod("initializeExtendedOperationHandler", |
| | | config.configurationClass()); |
| | | |
| | | method.invoke(extendedOperationHandler, config); |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | Method method = |
| | | group.getClass().getMethod("initializeGroupImplementation", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = group.getClass() |
| | | .getMethod("initializeGroupImplementation", |
| | | configuration.configurationClass()); |
| | | method.invoke(group, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | Method method = |
| | | mapper.getClass().getMethod("initializeIdentityMapper", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = mapper.getClass().getMethod("initializeIdentityMapper", |
| | | configuration.configurationClass()); |
| | | method.invoke(mapper, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | Method method = |
| | | provider.getClass().getMethod("initializeKeyManagerProvider", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = provider.getClass().getMethod( |
| | | "initializeKeyManagerProvider", configuration.configurationClass()); |
| | | method.invoke(provider, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | // Determine the initialization method to use: it must take a |
| | | // single parameter which is the exact type of the configuration |
| | | // object. |
| | | theClass.getMethod("initializeLogRetentionPolicy", config.definition() |
| | | .getServerConfigurationClass()); |
| | | theClass.getMethod("initializeLogRetentionPolicy", config |
| | | .configurationClass()); |
| | | } catch (Exception e) { |
| | | Message message = ERR_CONFIG_RETENTION_POLICY_INVALID_CLASS.get(className, |
| | | config.dn().toString(), |
| | |
| | | // Determine the initialization method to use: it must take a |
| | | // single parameter which is the exact type of the configuration |
| | | // object. |
| | | Method method = theClass.getMethod("initializeLogRetentionPolicy", |
| | | config.definition().getServerConfigurationClass()); |
| | | Method method = theClass.getMethod("initializeLogRetentionPolicy", config |
| | | .configurationClass()); |
| | | method.invoke(RetentionPolicy, config); |
| | | } |
| | | catch (InvocationTargetException ite) |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | // Determine the initialization method to use: it must take a |
| | | // single parameter which is the exact type of the configuration |
| | | // object. |
| | | theClass.getMethod("initializeLogRotationPolicy", config.definition() |
| | | .getServerConfigurationClass()); |
| | | theClass.getMethod("initializeLogRotationPolicy", config |
| | | .configurationClass()); |
| | | } catch (Exception e) { |
| | | Message message = ERR_CONFIG_ROTATION_POLICY_INVALID_CLASS.get(className, |
| | | config.dn().toString(), |
| | |
| | | // Determine the initialization method to use: it must take a |
| | | // single parameter which is the exact type of the configuration |
| | | // object. |
| | | Method method = theClass.getMethod("initializeLogRotationPolicy", |
| | | config.definition().getServerConfigurationClass()); |
| | | Method method = theClass.getMethod("initializeLogRotationPolicy", config |
| | | .configurationClass()); |
| | | method.invoke(rotationPolicy, config); |
| | | } |
| | | catch (InvocationTargetException ite) |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | Method method = |
| | | matchingRule.getClass().getMethod("initializeMatchingRule", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = matchingRule.getClass().getMethod( |
| | | "initializeMatchingRule", configuration.configurationClass()); |
| | | method.invoke(matchingRule, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | if (configuration != null) |
| | | { |
| | | Method method = |
| | | monitor.getClass().getMethod("initializeMonitorProvider", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = monitor.getClass().getMethod( |
| | | "initializeMonitorProvider", configuration.configurationClass()); |
| | | method.invoke(monitor, configuration); |
| | | } |
| | | |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | Method method = |
| | | generator.getClass().getMethod("initializePasswordGenerator", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = generator.getClass().getMethod( |
| | | "initializePasswordGenerator", configuration.configurationClass()); |
| | | method.invoke(generator, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | Method method = passwordStorageScheme.getClass().getMethod( |
| | | "initializePasswordStorageScheme", |
| | | configuration.definition().getServerConfigurationClass() |
| | | ); |
| | | configuration.configurationClass()); |
| | | method.invoke(passwordStorageScheme, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | Method method = |
| | | validator.getClass().getMethod("initializePasswordValidator", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = validator.getClass().getMethod( |
| | | "initializePasswordValidator", configuration.configurationClass()); |
| | | method.invoke(validator, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | method.invoke(plugin, configuration, pluginTypes); |
| | | |
| | | method = plugin.getClass().getMethod("initializePlugin", Set.class, |
| | | configuration.definition().getServerConfigurationClass()); |
| | | configuration.configurationClass()); |
| | | method.invoke(plugin, pluginTypes, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | Method method = |
| | | handler.getClass().getMethod("initializeSASLMechanismHandler", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = handler.getClass().getMethod( |
| | | "initializeSASLMechanismHandler", |
| | | configuration.configurationClass()); |
| | | method.invoke(handler, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | Method method = |
| | | provider.getClass().getMethod("initializeTrustManagerProvider", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = provider.getClass().getMethod( |
| | | "initializeTrustManagerProvider", |
| | | configuration.configurationClass()); |
| | | method.invoke(provider, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | |
| | | if (initialize) |
| | | { |
| | | Method method = |
| | | provider.getClass().getMethod("initializeVirtualAttributeProvider", |
| | | configuration.definition().getServerConfigurationClass()); |
| | | Method method = provider.getClass().getMethod( |
| | | "initializeVirtualAttributeProvider", |
| | | configuration.configurationClass()); |
| | | method.invoke(provider, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | WorkQueue workQueue = workQueueClass.newInstance(); |
| | | |
| | | Method method = workQueue.getClass().getMethod("initializeWorkQueue", |
| | | workQueueConfig.definition().getServerConfigurationClass()); |
| | | workQueueConfig.configurationClass()); |
| | | method.invoke(workQueue, workQueueConfig); |
| | | |
| | | return workQueue; |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | import org.opends.messages.Message; |
| | |
| | | // Determine the initialization method to use: it must take a |
| | | // single parameter which is the exact type of the configuration |
| | | // object. |
| | | Method method = theClass.getMethod("initializeAccessLogPublisher", |
| | | config.definition().getServerConfigurationClass()); |
| | | Method method = theClass.getMethod("initializeAccessLogPublisher", config |
| | | .configurationClass()); |
| | | method.invoke(AccessLogPublisher, config); |
| | | } |
| | | catch (InvocationTargetException ite) |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | import org.opends.messages.Message; |
| | |
| | | // Determine the initialization method to use: it must take a |
| | | // single parameter which is the exact type of the configuration |
| | | // object. |
| | | Method method = theClass.getMethod("initializeErrorLogPublisher", |
| | | config.definition().getServerConfigurationClass()); |
| | | Method method = theClass.getMethod("initializeErrorLogPublisher", config |
| | | .configurationClass()); |
| | | method.invoke(errorLogPublisher, config); |
| | | } |
| | | catch (InvocationTargetException ite) |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.server.loggers.debug; |
| | |
| | | // Determine the initialization method to use: it must take a |
| | | // single parameter which is the exact type of the configuration |
| | | // object. |
| | | Method method = theClass.getMethod("initializeDebugLogPublisher", |
| | | config.definition().getServerConfigurationClass()); |
| | | Method method = theClass.getMethod("initializeDebugLogPublisher", config |
| | | .configurationClass()); |
| | | method.invoke(debugLogPublisher, config); |
| | | } |
| | | catch (InvocationTargetException ite) |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.workflowelement; |
| | | |
| | |
| | | if (initialize) |
| | | { |
| | | Method method = workflowElement.getClass().getMethod( |
| | | "initializeWorkflowElement", |
| | | configuration.definition().getServerConfigurationClass() |
| | | ); |
| | | "initializeWorkflowElement", configuration.configurationClass()); |
| | | method.invoke(workflowElement, configuration); |
| | | } |
| | | else |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin; |
| | | |
| | |
| | | |
| | | import java.util.SortedSet; |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.admin.ManagedObjectDefinition; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.TestChildCfgClient; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.DN; |
| | | |
| | |
| | | public interface TestChildCfg extends Configuration { |
| | | |
| | | /** |
| | | * Get the configuration definition associated with this Test Child. |
| | | * Get the configuration class associated with this Test Child. |
| | | * |
| | | * @return Returns the configuration definition associated with this Test Child. |
| | | * @return Returns the configuration class associated with this Test Child. |
| | | */ |
| | | ManagedObjectDefinition<? extends TestChildCfgClient, ? extends TestChildCfg> definition(); |
| | | Class<? extends TestChildCfg> configurationClass(); |
| | | |
| | | |
| | | |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin; |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ManagedObjectDefinition<? extends TestChildCfgClient, ? extends TestChildCfg> definition() { |
| | | return INSTANCE; |
| | | public Class<? extends TestChildCfg> configurationClass() { |
| | | return TestChildCfg.class; |
| | | } |
| | | |
| | | |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin; |
| | | |
| | |
| | | |
| | | import java.util.SortedSet; |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.admin.ManagedObjectDefinition; |
| | | import org.opends.server.admin.server.ConfigurationAddListener; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ConfigurationDeleteListener; |
| | |
| | | public interface TestParentCfg extends Configuration { |
| | | |
| | | /** |
| | | * Get the configuration definition associated with this Test Parent. |
| | | * Get the configuration class associated with this Test Parent. |
| | | * |
| | | * @return Returns the configuration definition associated with this Test Parent. |
| | | * @return Returns the configuration class associated with this Test Parent. |
| | | */ |
| | | ManagedObjectDefinition<? extends TestParentCfgClient, ? extends TestParentCfg> definition(); |
| | | Class<? extends TestParentCfg> configurationClass(); |
| | | |
| | | |
| | | |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin; |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ManagedObjectDefinition<? extends TestParentCfgClient, ? extends TestParentCfg> definition() { |
| | | return INSTANCE; |
| | | public Class<? extends TestParentCfg> configurationClass() { |
| | | return TestParentCfg.class; |
| | | } |
| | | |
| | | |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | |
| | | ConfigAddListener tmp = dl.getDelayedAddListener(); |
| | | if (tmp instanceof ConfigAddListenerAdaptor) { |
| | | ConfigAddListenerAdaptor<?> al = (ConfigAddListenerAdaptor<?>) tmp; |
| | | if (al.getConfigurationAddListener() == listener) { |
| | | if (extractListener(al) == listener) { |
| | | isFound = true; |
| | | } |
| | | } |
| | |
| | | ConfigAddListener tmp = dl.getDelayedAddListener(); |
| | | if (tmp instanceof ConfigAddListenerAdaptor) { |
| | | ConfigAddListenerAdaptor<?> al = (ConfigAddListenerAdaptor<?>) tmp; |
| | | if (al.getConfigurationAddListener() == listener) { |
| | | if (extractListener(al) == listener) { |
| | | fail("Delayed listener still exists in entry " + parentDN |
| | | + " when it should have been removed"); |
| | | |
| | |
| | | for (ConfigAddListener l : configEntry.getAddListeners()) { |
| | | if (l instanceof ConfigAddListenerAdaptor) { |
| | | ConfigAddListenerAdaptor<?> al = (ConfigAddListenerAdaptor<?>) l; |
| | | if (al.getConfigurationAddListener() == listener) { |
| | | if (extractListener(al) == listener) { |
| | | isFound = true; |
| | | |
| | | // Clean up. |
| | |
| | | for (ConfigAddListener l : configEntry.getAddListeners()) { |
| | | if (l instanceof ConfigAddListenerAdaptor) { |
| | | ConfigAddListenerAdaptor<?> al = (ConfigAddListenerAdaptor<?>) l; |
| | | if (al.getConfigurationAddListener() == listener) { |
| | | if (extractListener(al) == listener) { |
| | | isFound = true; |
| | | |
| | | // Clean up. |
| | |
| | | for (ConfigAddListener l : configEntry.getAddListeners()) { |
| | | if (l instanceof ConfigAddListenerAdaptor) { |
| | | ConfigAddListenerAdaptor<?> al = (ConfigAddListenerAdaptor<?>) l; |
| | | if (al.getConfigurationAddListener() == listener) { |
| | | if (extractListener(al) == listener) { |
| | | isFound = true; |
| | | |
| | | // Clean up. |
| | |
| | | ConfigDeleteListener tmp = dl.getDelayedDeleteListener(); |
| | | if (tmp instanceof ConfigDeleteListenerAdaptor) { |
| | | ConfigDeleteListenerAdaptor<?> al = (ConfigDeleteListenerAdaptor<?>) tmp; |
| | | if (al.getConfigurationDeleteListener() == listener) { |
| | | if (extractListener(al) == listener) { |
| | | isFound = true; |
| | | } |
| | | } |
| | |
| | | ConfigDeleteListener tmp = dl.getDelayedDeleteListener(); |
| | | if (tmp instanceof ConfigDeleteListenerAdaptor) { |
| | | ConfigDeleteListenerAdaptor<?> al = (ConfigDeleteListenerAdaptor<?>) tmp; |
| | | if (al.getConfigurationDeleteListener() == listener) { |
| | | if (extractListener(al) == listener) { |
| | | fail("Delayed listener still exists in entry " + parentDN |
| | | + " when it should have been removed"); |
| | | |
| | |
| | | for (ConfigDeleteListener l : configEntry.getDeleteListeners()) { |
| | | if (l instanceof ConfigDeleteListenerAdaptor) { |
| | | ConfigDeleteListenerAdaptor<?> al = (ConfigDeleteListenerAdaptor<?>) l; |
| | | if (al.getConfigurationDeleteListener() == listener) { |
| | | if (extractListener(al) == listener) { |
| | | isFound = true; |
| | | |
| | | // Clean up. |
| | |
| | | for (ConfigDeleteListener l : configEntry.getDeleteListeners()) { |
| | | if (l instanceof ConfigDeleteListenerAdaptor) { |
| | | ConfigDeleteListenerAdaptor<?> al = (ConfigDeleteListenerAdaptor<?>) l; |
| | | if (al.getConfigurationDeleteListener() == listener) { |
| | | if (extractListener(al) == listener) { |
| | | isFound = true; |
| | | |
| | | // Clean up. |
| | |
| | | for (ConfigDeleteListener l : configEntry.getDeleteListeners()) { |
| | | if (l instanceof ConfigDeleteListenerAdaptor) { |
| | | ConfigDeleteListenerAdaptor<?> al = (ConfigDeleteListenerAdaptor<?>) l; |
| | | if (al.getConfigurationDeleteListener() == listener) { |
| | | if (extractListener(al) == listener) { |
| | | isFound = true; |
| | | |
| | | // Clean up. |
| | |
| | | fail("Unable to locate listener adaptor in entry " + relationDN); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // Attempt to extract an add listener from the provided adaptor. |
| | | private ConfigurationAddListener<?> extractListener( |
| | | ConfigAddListenerAdaptor<?> al) { |
| | | ServerManagedObjectAddListener<?> al2 = al |
| | | .getServerManagedObjectAddListener(); |
| | | if (al2 instanceof ServerManagedObjectAddListenerAdaptor) { |
| | | ServerManagedObjectAddListenerAdaptor<?> al3 = |
| | | (ServerManagedObjectAddListenerAdaptor<?>) al2; |
| | | return al3.getConfigurationAddListener(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | // Attempt to extract a delete listener from the provided adaptor. |
| | | private ConfigurationDeleteListener<?> extractListener( |
| | | ConfigDeleteListenerAdaptor<?> al) { |
| | | ServerManagedObjectDeleteListener<?> al2 = al |
| | | .getServerManagedObjectDeleteListener(); |
| | | if (al2 instanceof ServerManagedObjectDeleteListenerAdaptor) { |
| | | ServerManagedObjectDeleteListenerAdaptor<?> al3 = |
| | | (ServerManagedObjectDeleteListenerAdaptor<?>) al2; |
| | | return al3.getConfigurationDeleteListener(); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import java.util.SortedSet; |
| | | |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.admin.ManagedObjectDefinition; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ServerManagedObject; |
| | | import org.opends.server.admin.std.client.ReplicationDomainCfgClient; |
| | | import org.opends.server.admin.std.meta.ReplicationDomainCfgDefn.IsolationPolicy; |
| | | import org.opends.server.admin.std.server.ReplicationDomainCfg; |
| | | import org.opends.server.types.DN; |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ManagedObjectDefinition<? extends ReplicationDomainCfgClient, |
| | | ? extends ReplicationDomainCfg> definition() |
| | | public Class<? extends ReplicationDomainCfg> configurationClass() |
| | | { |
| | | return null; |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | | import java.util.SortedSet; |
| | | |
| | | import org.opends.server.admin.Configuration; |
| | | import org.opends.server.admin.ManagedObjectDefinition; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.server.ServerManagedObject; |
| | | import org.opends.server.admin.std.client.ReplicationServerCfgClient; |
| | | import org.opends.server.admin.std.server.ReplicationServerCfg; |
| | | import org.opends.server.types.DN; |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ManagedObjectDefinition<? extends ReplicationServerCfgClient, |
| | | ? extends ReplicationServerCfg> definition() |
| | | public Class<? extends ReplicationServerCfg> configurationClass() |
| | | { |
| | | return null; |
| | | } |