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 f)
           adds a file to the classpath if it does exist
void addFile(String s)
           adds a file to the classpath if it does exist
String assignProperties(String str)
           exapands the properties inside the given string to it's values
void configure(InputStream is)
           configures this loader with a stream
void findMatchingFiles(def files, Pattern pattern, boolean recursive)
          
def getClassPathUrls()
           gets a classpath as URL[] from this configuration.
String getMainClass()
           returns the main class or null is no is defined
String getParentPath(String filter)
           seperates the given path at the last '/'
String getSlashyPath(String path)
          
void loadFilteredPath(String filter)
           load a possible filtered path.
boolean parentPathDoesExist(String path)
           return true if the parent of the path inside the given string does exist
void setMainClass(String clazz)
           sets the main class.
void setRequireMain(boolean requireMain)
           if set to false no 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
see:
File#pathSeparator


addFile

public void addFile(File f)
adds a file to the classpath if it does exist


addFile

public void addFile(String s)
adds a file to the classpath if it does exist


assignProperties

String assignProperties(String str)
exapands the properties inside the given string to it's values


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()
gets a classpath as URL[] from this configuration. This can be used to construct a
see:
URLClassLoader


getMainClass

public String getMainClass()
returns the main class or null is no is defined


getParentPath

String getParentPath(String filter)
seperates the given path at the last '/'


getSlashyPath

String getSlashyPath(String path)


loadFilteredPath

void loadFilteredPath(String filter)
load a possible filtered path. Filters are defined by using the * wildcard like in any shell


parentPathDoesExist

boolean parentPathDoesExist(String path)
return true if the parent of the path inside the given string does exist


setMainClass

public void setMainClass(String clazz)
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


setRequireMain

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