Package net.sf.basedb.util.extensions
Class InvokationContext<A extends Action>
java.lang.Object
net.sf.basedb.util.extensions.InvokationContext<A>
- Direct Known Subclasses:
ExtensionContext
,ExtensionPointContext
Keeps contextual information about a single invokation of
extensions. The
Registry.useExtensions(ClientContext, ExtensionsFilter, String...)
will create invokation contexts for each enabled extension that
extends any of the given extension points.
Instances of this class are passed to factory methods,
for example ActionFactory.getActions(InvokationContext)
to make it possible for the factories to know anything about
the context the extension was invoked in.
Do not confuse the invokation context with the a
ClientContext
object. The invokation context contains
the client context (see getClientContext()
but has also
a lot more information collected from other parts of the
extensions system.
- Version:
- 2.7
- Author:
- nicklas
- Last modified
- $Date: 2012-03-28 12:38:04 +0200 (on, 28 mar 2012) $
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
Clear the registered error for the current extension or extension point.protected abstract A[]
Get the actions, or null if there is no current extension.abstract Object
getAttribute
(String name) Get the value of an attribute that has been registered for the extension.abstract ClassLoader
Get the class loader that is used for the given extension or extension point.abstract ClientContext
Get the client context that was passed to theRegistry.useExtensions(ClientContext, ExtensionsFilter, String...)
method.protected abstract ErrorHandler<? super A>
Get the error handler used in this context.Get information about the extension.abstract ExtensionPoint<? super A>
Get information about the extension point.protected abstract Registry
Get the registry where this invokation originated from.Get the renderer, if any.protected abstract void
Prepare the renderer factory if the extension or extension point has one.protected abstract void
Register an error for the current extension or extension point.
-
Constructor Details
-
InvokationContext
protected InvokationContext()
-
-
Method Details
-
getClientContext
Get the client context that was passed to theRegistry.useExtensions(ClientContext, ExtensionsFilter, String...)
method.- Returns:
- The client context, or null if the client didn't pass any context object
-
getExtensionPoint
Get information about the extension point.- Returns:
- An extension point object
-
getExtension
Get information about the extension. This method may return null if there is no current extension, which happens when any of theRendererFactory
methods are called for a renderer factory attached to an extension point and for theErrorHandlerFactory
methods.- Returns:
- An extension object, or null if there is no current extension
-
getClassLoader
Get the class loader that is used for the given extension or extension point.- Since:
- 3.2
-
getAttribute
Get the value of an attribute that has been registered for the extension.- Parameters:
name
- The name of the attribute- Returns:
- The attribute value, or null if no attribute has been registered
- See Also:
-
getRegistry
Get the registry where this invokation originated from. -
prepareRendererFactory
protected abstract void prepareRendererFactory()Prepare the renderer factory if the extension or extension point has one. -
getRenderer
Get the renderer, if any. This method should always return the same rendere instance if called multiple times on the same object. -
getActions
Get the actions, or null if there is no current extension. -
setError
Register an error for the current extension or extension point. Registered errors can be retrieved byRegistry.getLastExtensionError(String)
andRegistry.getLastExtensionPointError(String)
- Parameters:
action
- The action that caused the errort
- The error- Since:
- 2.9
-
clearError
protected abstract void clearError()Clear the registered error for the current extension or extension point.- Since:
- 2.9
-
getErrorHandler
Get the error handler used in this context. Should never be null, since if not the extension point provides one, the system should.- Since:
- 2.17
-