Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Unified Directory
11g Release 2 (11.1.2.2.0)

E38583-02


oracle.oud.plugin
Class AbstractPlugin

java.lang.Object
  extended by oracle.oud.plugin.AbstractPlugin

All Implemented Interfaces:
ManagedPlugin, Plugin, RequestManager

public abstract class AbstractPlugin
extends java.lang.Object
implements ManagedPlugin

This class is a default implementation of a plugin that forwards all requests to the next plugin relative to this one.

Implementations of plugins should derive from this class to guarantee backward compatibility.

In case of plugins that are not leaf plugins, only the requests that need to be handled must be overridden .

In case of leaf plugins all request handlers must be overridden. Indeed this implementation would throw NullPointerException when attempting to retrieve the next plugin relative to this one from the configuration.


Constructor Summary
protected AbstractPlugin()
          Instantiates a new instance of this class.

 

Method Summary
 void finalizePlugin()
          This method is called when this plugin is stopped.
 PluginConfiguration getConfiguration()
          Returns the raw configuration of this plugin.
<T extends PluginConfiguration>
T
getConfiguration(java.lang.Class<T> configurationInterface)
          Returns an instance of the provided configuration interface that attempts to provide a parsed view of the raw configuration.
 java.lang.String getName()
          Returns the name of this plugin.
 PluginContext getPluginContext()
          Returns the context of this plugin once initialized.
 java.lang.String getVersion()
          Returns the version of the plugin Api expected by this plugin.
 void handleAdd(RequestContext requestContext, AddRequest request, ResultHandler resultHandler)
          Invoked when an add request is received from a client.
 void handleBind(RequestContext requestContext, int version, BindRequest request, ResultHandler resultHandler)
          Invoked when a bind request is received from a client.
 void handleCompare(RequestContext requestContext, CompareRequest request, ResultHandler resultHandler)
          Invoked when a compare request is received from a client.
 void handleConfigurationChange(PluginConfiguration configuration)
          This method is called each time the configuration of this plugin is changed.
 void handleDelete(RequestContext requestContext, DeleteRequest request, ResultHandler resultHandler)
          Invoked when a delete request is received from a client.
<R extends ExtendedResult>
void
handleExtended(RequestContext requestContext, ExtendedRequest<R> request, ResultHandler resultHandler)
          Invoked when an extended request is received from a client.
 void handleModify(RequestContext requestContext, ModifyRequest request, ResultHandler resultHandler)
          Invoked when a modify request is received from a client.
 void handleModifyDN(RequestContext requestContext, ModifyDNRequest request, ResultHandler resultHandler)
          Invoked when a modify DN request is received from a client.
 void handleSearch(RequestContext requestContext, SearchRequest request, SearchResultHandler resultHandler)
          Invoked when a search request is received from a client.
 void initializePlugin(PluginConfiguration configuration, PluginContext context)
          This method is called when this plugin is initialized.
 void setConfiguration(PluginConfiguration configuration)
          Sets the configuration of this plugin.
 void setContext(PluginContext context)
          Sets the context of this plugin.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

AbstractPlugin

protected AbstractPlugin()
Instantiates a new instance of this class.

Method Detail

initializePlugin

public void initializePlugin(PluginConfiguration configuration,
                             PluginContext context)
                      throws PluginException
This method is called when this plugin is initialized.

This method returns immediately by default and should be overridden if checks must be performed at startup.

The provided configuration is available through the getConfiguration() after this call has returned.

Specified by:
initializePlugin in interface ManagedPlugin
Parameters:
configuration - the configuration of this plugin.
context - the context of this plugin
Throws:
PluginException - when the plugin failed to initialize successfully.

finalizePlugin

public void finalizePlugin()
This method is called when this plugin is stopped.

This method returns immediately by default and should be overridden if cleanup is required at shutdown.

Specified by:
finalizePlugin in interface ManagedPlugin

handleConfigurationChange

public void handleConfigurationChange(PluginConfiguration configuration)
                               throws PluginException
This method is called each time the configuration of this plugin is changed.

The configuration available through the getConfiguration() is updated after this call has returned.

Specified by:
handleConfigurationChange in interface ManagedPlugin
Parameters:
configuration - the configuration of this plugin.
Throws:
PluginException - if the new configuration can not be applied.

getPluginContext

public final PluginContext getPluginContext()
Returns the context of this plugin once initialized. null is returned if this plugin is not yet initialized.
Returns:
the context of this plugin or null.

setContext

public final void setContext(PluginContext context)
Sets the context of this plugin.
Parameters:
context - the new context of this plugin.

getConfiguration

public final PluginConfiguration getConfiguration()
Returns the raw configuration of this plugin. null is returned if this plugin was not yet initialized.
Returns:
the raw configuration of this plugin or null.

setConfiguration

public final void setConfiguration(PluginConfiguration configuration)
Sets the configuration of this plugin.
Parameters:
configuration - the new configuration of this plugin.

getConfiguration

public <T extends PluginConfiguration> T getConfiguration(java.lang.Class<T> configurationInterface)
Returns an instance of the provided configuration interface that attempts to provide a parsed view of the raw configuration.

The relations to the raw configuration properties are determined by reflection on the provided Java interface.

The rules are the following - the provided interface must extend the PluginConfiguration and define getters in the forms '<type> getX()' or 'boolean isY()' - the returned values are constructed from type defined in the provided configuration interface by calling the valueOf(String) method (eg. String.valueOf(String)) - String getX() attempts to parse the value of the raw configuration property defined by x=value using the String.valueOf(String) method - if a property is multivalued then the returned type of the method defined in the provided configuration interface must be of type java.util.Collection and the type contained type contained in that collection must be defined using the annotation ConfigurationProperty (String is the default type).

Beware that parsing the raw configuration can throw undeclared exceptions.

Type Parameters:
T - the type of the configuration interface that attempts to provide the parsed configuration.
Parameters:
configurationInterface - the interface that defines the types and the names of the parsed configuration properties.
Returns:
an instance of the provided configuration interface that attempts to provide a parsed view of the raw configuration.

getName

public java.lang.String getName()
Description copied from interface: Plugin
Returns the name of this plugin. Note that names are unique across plugins and as a consequence can be used as plugin identifiers.
Specified by:
getName in interface Plugin
Returns:
the name of this plugin.

getVersion

public java.lang.String getVersion()
Description copied from interface: ManagedPlugin
Returns the version of the plugin Api expected by this plugin.

This method attempts to read the file named "plugin.properties" embedded in the jar file that contained this plugin class and located at the root. If that file exists, the value associated to the key plugin.<plugin-name>.version is returned if that key exists.

Otherwise, the value associated to the key plugin.version is returned.

If the properties file could not be read or if none of the keys described above is found then null is returned.

If null is returned, this means that this plugin does not expect a particular behavior of the plugin Api.

In case this plugin expects a particular behavior of the plugin Api, the version of the server at time this plugin was built must be returned.

The version of the server is returned by the command 'start-ds -V'.

The plugin Api was released in version "11.1.2.1.0".

Specified by:
getVersion in interface ManagedPlugin
Returns:
the version of the plugin Api expected by this plugin.

handleAdd

public void handleAdd(RequestContext requestContext,
                      AddRequest request,
                      ResultHandler resultHandler)
               throws java.lang.UnsupportedOperationException
Description copied from interface: RequestManager
Invoked when an add request is received from a client.
Specified by:
handleAdd in interface RequestManager
Parameters:
requestContext - The request context.
request - The add request.
resultHandler - The handler which should be used to send back the result to the client.
Throws:
java.lang.UnsupportedOperationException - If this request handler does not handle add requests.

handleBind

public void handleBind(RequestContext requestContext,
                       int version,
                       BindRequest request,
                       ResultHandler resultHandler)
                throws java.lang.UnsupportedOperationException
Description copied from interface: RequestManager
Invoked when a bind request is received from a client.
Specified by:
handleBind in interface RequestManager
Parameters:
requestContext - The request context.
version - The protocol version included with the bind request.
request - The bind request.
resultHandler - The handler which should be used to send back the result to the client.
Throws:
java.lang.UnsupportedOperationException - If this request handler does not handle bind requests.

handleCompare

public void handleCompare(RequestContext requestContext,
                          CompareRequest request,
                          ResultHandler resultHandler)
                   throws java.lang.UnsupportedOperationException
Description copied from interface: RequestManager
Invoked when a compare request is received from a client.
Specified by:
handleCompare in interface RequestManager
Parameters:
requestContext - The request context.
request - The compare request.
resultHandler - The handler which should be used to send back the result to the client.
Throws:
java.lang.UnsupportedOperationException - If this request handler does not handle compare requests.

handleDelete

public void handleDelete(RequestContext requestContext,
                         DeleteRequest request,
                         ResultHandler resultHandler)
                  throws java.lang.UnsupportedOperationException
Description copied from interface: RequestManager
Invoked when a delete request is received from a client.
Specified by:
handleDelete in interface RequestManager
Parameters:
requestContext - The request context.
request - The delete request.
resultHandler - The handler which should be used to send back the result to the client.
Throws:
java.lang.UnsupportedOperationException - If this request handler does not handle delete requests.

handleExtended

public <R extends ExtendedResult> void handleExtended(RequestContext requestContext,
                                                      ExtendedRequest<R> request,
                                                      ResultHandler resultHandler)
                    throws java.lang.UnsupportedOperationException
Description copied from interface: RequestManager
Invoked when an extended request is received from a client.
Specified by:
handleExtended in interface RequestManager
Type Parameters:
R - The type of result returned by the extended request.
Parameters:
requestContext - The request context.
request - The extended request.
resultHandler - The handler which should be used to send back the result to the client.
Throws:
java.lang.UnsupportedOperationException - If this request handler does not handle extended requests.

handleModify

public void handleModify(RequestContext requestContext,
                         ModifyRequest request,
                         ResultHandler resultHandler)
                  throws java.lang.UnsupportedOperationException
Description copied from interface: RequestManager
Invoked when a modify request is received from a client.
Specified by:
handleModify in interface RequestManager
Parameters:
requestContext - The request context.
request - The modify request.
resultHandler - The handler which should be used to send back the result to the client.
Throws:
java.lang.UnsupportedOperationException - If this request handler does not handle modify requests.

handleModifyDN

public void handleModifyDN(RequestContext requestContext,
                           ModifyDNRequest request,
                           ResultHandler resultHandler)
                    throws java.lang.UnsupportedOperationException
Description copied from interface: RequestManager
Invoked when a modify DN request is received from a client.
Specified by:
handleModifyDN in interface RequestManager
Parameters:
requestContext - The request context.
request - The modify DN request.
resultHandler - The handler which should be used to send back the result to the client.
Throws:
java.lang.UnsupportedOperationException - If this request handler does not handle modify DN requests.

handleSearch

public void handleSearch(RequestContext requestContext,
                         SearchRequest request,
                         SearchResultHandler resultHandler)
                  throws java.lang.UnsupportedOperationException
Description copied from interface: RequestManager
Invoked when a search request is received from a client.
Specified by:
handleSearch in interface RequestManager
Parameters:
requestContext - The request context.
request - The search request.
resultHandler - The handler which should be used to send back the search results to the client.
Throws:
java.lang.UnsupportedOperationException - If this request handler does not handle search requests.

Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Unified Directory
11g Release 2 (11.1.2.2.0)

E38583-02


Copyright © 2013, Oracle and/or its affiliates. All rights reserved.