Package net.sf.basedb.util.extensions
Class ExtensionPointContext<A extends Action>
java.lang.Object
net.sf.basedb.util.extensions.InvokationContext<A>
net.sf.basedb.util.extensions.ExtensionPointContext<A>
class ExtensionPointContext<A extends Action> extends InvokationContext<A>
Invokation context for an extension point.
- Version:
- 2.7
- Author:
- nicklas
- Last modified
- $Date: 2012-03-28 12:38:04 +0200 (on, 28 mar 2012) $
-
Field Summary
Fields Modifier and Type Field Description private ClientContext
clientContext
private ErrorHandler<? super A>
errorHandler
private ErrorHandlerFactory<? super A>
errorHandlerFactory
private Registry.RegisteredExtensionPoint<A>
extensionPoint
private boolean
hasCreatedRenderer
private Registry
registry
private Renderer<? super A>
renderer
-
Constructor Summary
Constructors Constructor Description ExtensionPointContext(Registry registry, ClientContext clientContext, Registry.RegisteredExtensionPoint<A> extensionPoint, ErrorHandlerFactory<? super A> errorHandlerFactory)
-
Method Summary
Modifier and Type Method Description protected void
clearError()
Clear the registered error for the current extension or extension point.protected A[]
getActions()
Always null, since this is an extension point context.Object
getAttribute(String name)
Always null, since this is an extension point context.ClassLoader
getClassLoader()
The class loader is the class loader that loaded the action class of the extension point.ClientContext
getClientContext()
Get the client context that was passed to theRegistry.useExtensions(ClientContext, ExtensionsFilter, String...)
method.protected ErrorHandler<? super A>
getErrorHandler()
Get the error handler used in this context.Extension<A>
getExtension()
Always null, since this is an extension point context.ExtensionPoint<? super A>
getExtensionPoint()
Get information about the extension point.protected Registry
getRegistry()
Get the registry where this invokation originated from.protected Renderer<? super A>
getRenderer()
If the extension point defines a renderer factory, creates a new renderer unless one already exists.private void
handleError(String message, Throwable t)
protected void
prepareRendererFactory()
Prepare the renderer factory if the extension or extension point has one.protected void
setError(A action, Throwable t)
Register an error for the current extension or extension point.
-
Field Details
-
clientContext
-
registry
-
extensionPoint
-
errorHandlerFactory
-
renderer
-
hasCreatedRenderer
private boolean hasCreatedRenderer -
errorHandler
-
-
Constructor Details
-
ExtensionPointContext
ExtensionPointContext(Registry registry, ClientContext clientContext, Registry.RegisteredExtensionPoint<A> extensionPoint, ErrorHandlerFactory<? super A> errorHandlerFactory)
-
-
Method Details
-
getClientContext
Description copied from class:InvokationContext
Get the client context that was passed to theRegistry.useExtensions(ClientContext, ExtensionsFilter, String...)
method.- Specified by:
getClientContext
in classInvokationContext<A extends Action>
- Returns:
- The client context, or null if the client didn't pass any context object
-
getExtensionPoint
Description copied from class:InvokationContext
Get information about the extension point.- Specified by:
getExtensionPoint
in classInvokationContext<A extends Action>
- Returns:
- An extension point object
-
getExtension
Always null, since this is an extension point context.- Specified by:
getExtension
in classInvokationContext<A extends Action>
- Returns:
- An extension object, or null if there is no current extension
-
getClassLoader
The class loader is the class loader that loaded the action class of the extension point.- Specified by:
getClassLoader
in classInvokationContext<A extends Action>
-
getAttribute
Always null, since this is an extension point context.- Specified by:
getAttribute
in classInvokationContext<A extends Action>
- Parameters:
name
- The name of the attribute- Returns:
- The attribute value, or null if no attribute has been registered
- See Also:
Registry.getAttribute(String, String)
-
getRegistry
Description copied from class:InvokationContext
Get the registry where this invokation originated from.- Specified by:
getRegistry
in classInvokationContext<A extends Action>
-
prepareRendererFactory
protected void prepareRendererFactory()Description copied from class:InvokationContext
Prepare the renderer factory if the extension or extension point has one.- Specified by:
prepareRendererFactory
in classInvokationContext<A extends Action>
-
getRenderer
If the extension point defines a renderer factory, creates a new renderer unless one already exists.- Specified by:
getRenderer
in classInvokationContext<A extends Action>
- Returns:
- A renderer, or null if no factory has been defined
-
getActions
Always null, since this is an extension point context.- Specified by:
getActions
in classInvokationContext<A extends Action>
-
setError
Description copied from class:InvokationContext
Register an error for the current extension or extension point. Registered errors can be retrieved byRegistry.getLastExtensionError(String)
andRegistry.getLastExtensionPointError(String)
- Specified by:
setError
in classInvokationContext<A extends Action>
- Parameters:
action
- The action that caused the errort
- The error
-
clearError
protected void clearError()Description copied from class:InvokationContext
Clear the registered error for the current extension or extension point.- Specified by:
clearError
in classInvokationContext<A extends Action>
-
getErrorHandler
Description copied from class:InvokationContext
Get the error handler used in this context. Should never be null, since if not the extension point provides one, the system should.- Specified by:
getErrorHandler
in classInvokationContext<A extends Action>
-
handleError
-