com.google.code.rees.scope.struts2
Class StrutsActionProvider

java.lang.Object
  extended by com.google.code.rees.scope.struts2.StrutsActionProvider
All Implemented Interfaces:
ActionProvider, Serializable

public class StrutsActionProvider
extends Object
implements ActionProvider

Struts2 implementation of the ActionProvider.

Author:
rees.byars with code from the struts2 convention package
See Also:
Serialized Form

Constructor Summary
StrutsActionProvider()
           
 
Method Summary
static boolean contains(String[] strings, String value, boolean ignoreCase)
           
protected  Set<Class<?>> findActions()
           
 Set<Class<?>> getActionClasses()
          Returns the set of action classes
protected  com.opensymphony.xwork2.util.finder.Test<com.opensymphony.xwork2.util.finder.ClassFinder.ClassInfo> getActionClassTest()
          Construct a Test Object that determines if a specified class should be included in the package scan based on the full ClassFinder.ClassInfo of the class.
protected  ClassLoader getClassLoader()
           
protected  com.opensymphony.xwork2.util.finder.ClassLoaderInterface getClassLoaderInterface()
           
protected  com.opensymphony.xwork2.util.finder.Test<String> getClassPackageTest()
          Construct a Test object that determines if a specified class name should be included in the package scan based on the clazz's package name.
protected  boolean includeClassNameInActionScan(String className)
          Note that we can't include the test for actionSuffix here because a class is included if its name ends in actionSuffix OR it implements Action.
protected  void initReloadClassLoader()
           
protected  boolean isReloadEnabled()
           
 void setActionPackages(String actionPackages)
           
 void setActionSuffix(String actionSuffix)
           
 void setCheckImplementsAction(String checkImplementsAction)
           
 void setContainer(com.opensymphony.xwork2.inject.Container container)
           
 void setDevMode(String mode)
           
 void setDisablePackageLocatorsScanning(String disablePackageLocatorsScanning)
           
 void setExcludeParentClassLoader(String exclude)
          Exclude URLs found by the parent class loader.
 void setFileProtocols(String fileProtocols)
          File URLs whose protocol are in these list will be processed as jars containing classes
 void setIncludeJars(String includeJars)
           
 void setPackageLocators(String packageLocators)
           
 void setPackageLocatorsBase(String packageLocatorsBasePackage)
           
 void setReload(String reload)
          Reload configuration when classes change.
 void setRequireFollowsConvention(String requireFollowsConvention)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrutsActionProvider

public StrutsActionProvider()
Method Detail

getActionClasses

public Set<Class<?>> getActionClasses()
                               throws Exception
Description copied from interface: ActionProvider
Returns the set of action classes

Specified by:
getActionClasses in interface ActionProvider
Returns:
Throws:
Exception

setContainer

public void setContainer(com.opensymphony.xwork2.inject.Container container)

setDevMode

public void setDevMode(String mode)

setReload

public void setReload(String reload)
Reload configuration when classes change. Defaults to "false" and should not be used in production.


setExcludeParentClassLoader

public void setExcludeParentClassLoader(String exclude)
Exclude URLs found by the parent class loader. Defaults to "true", set to true for JBoss


setFileProtocols

public void setFileProtocols(String fileProtocols)
File URLs whose protocol are in these list will be processed as jars containing classes

Parameters:
fileProtocols - Comma separated list of file protocols that will be considered as jar files and scanned

setIncludeJars

public void setIncludeJars(String includeJars)
Parameters:
includeJars - Comma separated list of regular expressions of jars to be included.

setDisablePackageLocatorsScanning

public void setDisablePackageLocatorsScanning(String disablePackageLocatorsScanning)
Parameters:
disablePackageLocatorsScanning - If set to true, only the named packages will be scanned

setActionPackages

public void setActionPackages(String actionPackages)
Parameters:
actionPackages - (Optional) An optional list of action packages that this should create configuration for.

setCheckImplementsAction

public void setCheckImplementsAction(String checkImplementsAction)
Parameters:
checkImplementsAction - (Optional) Map classes that implement com.opensymphony.xwork2.Action as actions

setActionSuffix

public void setActionSuffix(String actionSuffix)
Parameters:
actionSuffix - (Optional) Classes that end with these value will be mapped as actions (defaults to "Action")

setPackageLocators

public void setPackageLocators(String packageLocators)
Parameters:
packageLocators - (Optional) A list of names used to find action packages.

setPackageLocatorsBase

public void setPackageLocatorsBase(String packageLocatorsBasePackage)
Parameters:
packageLocatorsBasePackage - (Optional) If set, only packages that start with this name will be scanned for actions.

setRequireFollowsConvention

public void setRequireFollowsConvention(String requireFollowsConvention)
Parameters:
requireFollowsConvention - If true, only classes that follow the convention for action classes will be scanned for the scope annotations.

includeClassNameInActionScan

protected boolean includeClassNameInActionScan(String className)
Note that we can't include the test for actionSuffix here because a class is included if its name ends in actionSuffix OR it implements Action. Since the whole goal is to avoid loading the class if we don't have to, the (actionSuffix || implements Action) test will have to remain until later. See getActionClassTest() for the test performed on the loaded ClassFinder.ClassInfo structure.

Parameters:
className - the name of the class to test
Returns:
true if the specified class should be included in the package-based action scan

getClassPackageTest

protected com.opensymphony.xwork2.util.finder.Test<String> getClassPackageTest()
Construct a Test object that determines if a specified class name should be included in the package scan based on the clazz's package name. Note that the goal is to avoid loading the class, so the test should only rely on information in the class name itself. The default implementation is to return the result of includeClassNameInActionScan(String).

Returns:
a Test object that returns true if the specified class name should be included in the package scan

getActionClassTest

protected com.opensymphony.xwork2.util.finder.Test<com.opensymphony.xwork2.util.finder.ClassFinder.ClassInfo> getActionClassTest()
Construct a Test Object that determines if a specified class should be included in the package scan based on the full ClassFinder.ClassInfo of the class. At this point, the class has been loaded, so it's ok to perform tests such as checking annotations or looking at interfaces or super-classes of the specified class.

Returns:
a Test object that returns true if the specified class should be included in the package scan

findActions

protected Set<Class<?>> findActions()

isReloadEnabled

protected boolean isReloadEnabled()

initReloadClassLoader

protected void initReloadClassLoader()

getClassLoaderInterface

protected com.opensymphony.xwork2.util.finder.ClassLoaderInterface getClassLoaderInterface()

getClassLoader

protected ClassLoader getClassLoader()

contains

public static boolean contains(String[] strings,
                               String value,
                               boolean ignoreCase)


Copyright © 2012-2013. All Rights Reserved.