|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object magoffin.matt.ma2.support.AbstractPlugin
public abstract class AbstractPlugin
Abstract base Plugin
implementation that provides a standardized Spring
initialization method.
The initialize(ApplicationContext)
method works in the following way:
getConfigName()
method to determine the base config
name to look for.ClassPathXmlApplicationContext
from the resource
found in either step #1 or #2, above.AbstractApplicationContext.setParent(ApplicationContext)
,
passing in the ApplicationContext
passed to this method.AbstractApplicationContext.refresh()
to initialize the
context. This context should define a bean named the full class
name of this plugin implementation. This bean should be a fully-configured
instance of this plugin.ClassPathXmlApplicationContext
and uses BeanUtils.copyProperties(Object, Object)
to copy the properties
of that instance onto this instance.init(ApplicationContext)
method, for the implementation
to perform any custom initialization.In this way, plugins can easily configure themselves by providing a Spring configuration of themselves.
Field Summary | |
---|---|
protected org.apache.log4j.Logger |
log
A class-level logger. |
Constructor Summary | |
---|---|
AbstractPlugin()
|
Method Summary | |
---|---|
protected java.lang.String |
getConfigName()
Get the base name for this plugin's Spring configuration. |
protected void |
init(org.springframework.context.ApplicationContext application)
Initialization hook for subclasses. |
void |
initialize(org.springframework.context.ApplicationContext application)
Initialize the plugin. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface magoffin.matt.ma2.plugin.Plugin |
---|
getMessageResourceNames, getPluginType |
Field Detail |
---|
protected final org.apache.log4j.Logger log
Constructor Detail |
---|
public AbstractPlugin()
Method Detail |
---|
public final void initialize(org.springframework.context.ApplicationContext application)
Plugin
initialize
in interface Plugin
application
- the Spring application contextprotected java.lang.String getConfigName()
This method must return the base name of the Spring configuration file.
The base name will have Context.xml
appended to it, and possibly
a path prefix.
This default method returns the name of this class, without any packages.
protected void init(org.springframework.context.ApplicationContext application)
This method will be called at the end of the initialize(org.springframework.context.ApplicationContext)
method.
application
- the ApplicationContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |