org.tinyjee.maven.dim.extensions
Class DirectoryLoader

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<String,Object>
          extended by org.tinyjee.maven.dim.extensions.DirectoryLoader
All Implemented Interfaces:
Serializable, Cloneable, Map<String,Object>

public class DirectoryLoader
extends HashMap<String,Object>

DirectoryLoader is a 'source-class' compatible helper class that can scan and load files from the given source directories.

Usage:

%{include|source=template.vm|source-class=org.tinyjee.maven.dim.extensions.DirectoryLoader}
or when using the alias:
%{include|source=template.vm|source-directories=src/main,src/test}

Author:
Juergen_Kellerer, 2011-10-09
See Also:
Serialized Form

Nested Class Summary
static class DirectoryLoader.AliasHandler
          Implements the "PARAM_ALIAS" alias functionality.
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Field Summary
protected static Map<String,Class<? extends Map<String,Object>>> EXTENSION_TO_LOADER_MAPPING
           
protected static Map<Class,String> FILE_INPUT_PARAM_MAP
           
static String PARAM_ALIAS
          Defines a shortcut for the request properties 'source-class' and 'directories'.
static String PARAM_DIRECTORIES
          Sets a comma separated list of URL or local path pointing to directories to load recursively.
static String PARAM_OUT_FILES
          Is set with a selectable list of FileReference instances of all files that were found in the given directories.
static String PARAM_OUT_JAVA_CLASSES
          Is set with a selectable list of all java classes found in the given directories.
static String PARAM_OUT_PROPERTY_FILES
          Is set with a selectable list of FileReference instances of all XML files that were found in the given directories.
static String PARAM_OUT_XML_FILES
          Is set with a selectable list of FileReference instances of all XML files that were found in the given directories.
 
Constructor Summary
DirectoryLoader(File baseDir, Map<String,Object> requestParams)
           
 
Method Summary
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

EXTENSION_TO_LOADER_MAPPING

protected static final Map<String,Class<? extends Map<String,Object>>> EXTENSION_TO_LOADER_MAPPING

FILE_INPUT_PARAM_MAP

protected static final Map<Class,String> FILE_INPUT_PARAM_MAP

PARAM_ALIAS

public static final String PARAM_ALIAS
Defines a shortcut for the request properties 'source-class' and 'directories'.

If this parameter is present inside the request parameters list, the system will effectively behave as if 'source-class' and 'directories' where set separately.

See Also:
Constant Field Values

PARAM_DIRECTORIES

public static final String PARAM_DIRECTORIES
Sets a comma separated list of URL or local path pointing to directories to load recursively.

The specified directories are resolved in exactly the same way as when using the parameter "source" (see Macro reference).

See Also:
Constant Field Values

PARAM_OUT_FILES

public static final String PARAM_OUT_FILES
Is set with a selectable list of FileReference instances of all files that were found in the given directories. The returned list derives from SelectableArrayList.

See Also:
Constant Field Values

PARAM_OUT_XML_FILES

public static final String PARAM_OUT_XML_FILES
Is set with a selectable list of FileReference instances of all XML files that were found in the given directories. Note: This is a shortcut to $files.selectMatching("(?i).*(\.xml|\.xsl|\.xdoc|\.xhtml|\.json)$").

See Also:
Constant Field Values

PARAM_OUT_PROPERTY_FILES

public static final String PARAM_OUT_PROPERTY_FILES
Is set with a selectable list of FileReference instances of all XML files that were found in the given directories. Note: This is a shortcut to $files.selectMatching("(?i).*(\.properties)$").

See Also:
Constant Field Values

PARAM_OUT_JAVA_CLASSES

public static final String PARAM_OUT_JAVA_CLASSES
Is set with a selectable list of all java classes found in the given directories.

The returned list derives from SelectableMappedJavaEntitiesList and every list row is a map created by JavaSourceLoader.

See Also:
Constant Field Values
Constructor Detail

DirectoryLoader

public DirectoryLoader(File baseDir,
                       Map<String,Object> requestParams)