org.codehaus.groovy.tools
Class LoaderConfiguration

Field Summary
 String ALL_WILDCARD
           
 String LOAD_PREFIX
           
 String MAIN_PREFIX
           
 String MATCH_ALL
           
 String MATCH_FILE_NAME
           
 char WILDCARD
           
 List classPath
           
 String main
           
 boolean requireMain
           
 
Constructor Summary
LoaderConfiguration()
            creates a new loader configuration
 
Method Summary
void addClassPath(String path)
           Adds a classpath to this configuration.
void addFile(File file)
           Adds a file to the classpath if it exists.
void addFile(String filename)
           Adds a file to the classpath if it exists.
String assignProperties(String str)
          
void configure(InputStream is)
           configures this loader with a stream
void findMatchingFiles(def files, Pattern pattern, boolean recursive)
          
def getClassPathUrls()
           The classpath as URL[] from this configuration.
String getMainClass()
           Returns the name of the main class for this configuration.
String getParentPath(String filter)
          
String getSlashyPath(String path)
          
void loadFilteredPath(String filter)
          
boolean parentPathDoesExist(String path)
          
void setMainClass(String classname)
           Sets the main class.
void setRequireMain(boolean requireMain)
           Determines if a main class is required when calling.
 

Constructor Detail

LoaderConfiguration

public LoaderConfiguration()
creates a new loader configuration


Method Detail

addClassPath

public void addClassPath(String path)
Adds a classpath to this configuration. It expects a string with multiple paths, seperated by the system dependent path separator
param:
path the path as a path separator delimited string
see:
File#pathSeparator


addFile

public void addFile(File file)
Adds a file to the classpath if it exists.
param:
file the file to add


addFile

public void addFile(String filename)
Adds a file to the classpath if it exists.
param:
filename the name of the file to add


assignProperties

String assignProperties(String str)


configure

public void configure(InputStream is)
configures this loader with a stream
param:
is stream used to read the configuration
throws:
IOException if reading or parsing the contents of the stream fails


findMatchingFiles

void findMatchingFiles(def files, Pattern pattern, boolean recursive)


getClassPathUrls

public def getClassPathUrls()
The classpath as URL[] from this configuration. This can be used to construct a class loader.
return:
the classpath
see:
URLClassLoader


getMainClass

public String getMainClass()
Returns the name of the main class for this configuration.
return:
the name of the main class or null if not defined


getParentPath

String getParentPath(String filter)


getSlashyPath

String getSlashyPath(String path)


loadFilteredPath

void loadFilteredPath(String filter)


parentPathDoesExist

boolean parentPathDoesExist(String path)


setMainClass

public void setMainClass(String classname)
Sets the main class. If there is already a main class it is overwritten. Calling
see:
#configure(InputStream)
after calling this method does not require a main class definition inside the stream.
param:
classname the name to become the main class


setRequireMain

public void setRequireMain(boolean requireMain)
Determines if a main class is required when calling.
param:
requireMain set to false if no main class is required
see:
#configure(InputStream)