jodd.madvoc.config
Class AutomagicMadvocConfigurator

java.lang.Object
  extended by jodd.io.findfile.FindClass
      extended by jodd.madvoc.config.AutomagicMadvocConfigurator
All Implemented Interfaces:
MadvocConfigurator

public class AutomagicMadvocConfigurator
extends jodd.io.findfile.FindClass
implements MadvocConfigurator

Default Madvoc configurator uses auto-magic to configure WebApplication. It searches the class path for all classes which names ends with 'Action', 'Result' and 'Configurator' suffixes. Each such class will be loaded and introspected to determine if it represents valid Madvoc entity and then registered into the web application.

Action class is scanned for the MadvocAction. All public methods of the action class are candidates for the actions, unless if not annotated differently.

Interceptors may be defined both for all actions on class level or for the action itself.

Configuration classes are loaded during the search, but they are invoked after the classpath scanning ends.

The latest step is applying the default configurations, such as default interceptors to all registered actions.


Field Summary
protected  java.lang.String actionClassSuffix
           
protected  java.lang.String configClassSuffix
           
protected  long elapsed
           
protected  boolean registerNonExistingActionsOnly
           
protected  java.lang.String resultClassSuffix
           
protected  WebApplication webapp
           
 
Fields inherited from class jodd.io.findfile.FindClass
createInputStream, excludedJars, excludedPackages, includedJars, includedPackages
 
Constructor Summary
AutomagicMadvocConfigurator()
           
 
Method Summary
 boolean checkClass(java.lang.Class clazz)
           
 void configure(WebApplication webapp)
          Configures web application from system classpath
 void configure(WebApplication webapp, java.net.URL[] classpath)
          Configures web application from specified classpath.
protected  void onActionClass(java.lang.String className)
          Builds action configuration on founded action class.
protected  void onClassName(java.lang.String className, java.io.InputStream inputStream)
          Parses class name that matches madvoc-related names.
protected  void onConfigClass(java.lang.String className)
          Creates madvoc configuration from founded MadvocConfigurator instance.
protected  void onResultClass(java.lang.String className)
          Loads madvoc result from founded ActionResult instance.
 
Methods inherited from class jodd.io.findfile.FindClass
getExcludedJars, getExcludedPackages, getIncludedJars, getIncludedPackages, scanClassName, scanClassPath, scanJarFile, scanUrl, setExcludedJars, setExcludedPackages, setIncludedJars, setIncludedPackages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

webapp

protected WebApplication webapp

actionClassSuffix

protected java.lang.String actionClassSuffix

configClassSuffix

protected java.lang.String configClassSuffix

resultClassSuffix

protected java.lang.String resultClassSuffix

registerNonExistingActionsOnly

protected boolean registerNonExistingActionsOnly

elapsed

protected long elapsed
Constructor Detail

AutomagicMadvocConfigurator

public AutomagicMadvocConfigurator()
Method Detail

configure

public void configure(WebApplication webapp)
Configures web application from system classpath

Specified by:
configure in interface MadvocConfigurator
See Also:
configure(jodd.madvoc.WebApplication, java.net.URL[])

configure

public void configure(WebApplication webapp,
                      java.net.URL[] classpath)
Configures web application from specified classpath. The whole process is done in the following steps:
  1. scanning web application classpath
  2. invoking external configurations, if exist
  3. applying defaults

See Also:
configure(jodd.madvoc.WebApplication)

onClassName

protected void onClassName(java.lang.String className,
                           java.io.InputStream inputStream)
Parses class name that matches madvoc-related names.

Specified by:
onClassName in class jodd.io.findfile.FindClass

checkClass

public boolean checkClass(java.lang.Class clazz)

onActionClass

protected void onActionClass(java.lang.String className)
Builds action configuration on founded action class. Action classes are annotated with MadvocAction annotation.


onConfigClass

protected void onConfigClass(java.lang.String className)
Creates madvoc configuration from founded MadvocConfigurator instance. All founded configurations will be invoked at the end of auto-magic process.


onResultClass

protected void onResultClass(java.lang.String className)
Loads madvoc result from founded ActionResult instance.



Copyright ©2008 Jodd Team