|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.enunciate.main.Enunciate
public class Enunciate
Main enunciate entry point.
| Nested Class Summary | |
|---|---|
static interface |
Enunciate.FileVisitor
File visitor interface used to visit files. |
class |
Enunciate.Stepper
Mechansim for stepping through the Enunciate build process. |
static class |
Enunciate.Target
The targets for the project. |
| Constructor Summary | |
|---|---|
protected |
Enunciate()
Protected to ensure the source files are set. |
|
Enunciate(List<String> sourceFiles)
Construct an enunciate mechanism on the specified source files. |
|
Enunciate(String[] sourceFiles)
Construct an enunciate mechanism on the specified source files. |
|
Enunciate(String[] sourceFiles,
EnunciateConfiguration config)
Construct an enunciate mechanism on the specified source files with the specified config. |
| Method Summary | |
|---|---|
void |
addAdditionalSourceRoot(File root)
Add an additional source root for Enunciate to process. |
boolean |
addArtifact(Artifact artifact)
Adds the specified artifact. |
void |
addExport(String artifactId,
File destination)
Adds an export. |
void |
addWebAppFragment(WebAppFragment fragment)
Add a webapp fragment for Enunciate to process. |
protected void |
buildFileList(List<File> list,
File... dirs)
Adds all files in specified directories to a list. |
void |
compileSources(File compileDir)
Compile all sources and any additional (generated) sources to the specified directory. |
void |
copyDir(File from,
File to,
File... excludes)
Copy an entire directory from one place to another. |
void |
copyFile(File from,
File to)
Copy a file from one location to another. |
void |
copyFile(File src,
File fromDir,
File toDir)
Copy a file from one directory to another, preserving directory structure. |
protected boolean |
copyImportedClasses(Map<String,File> foundClasses2Sources,
Map<String,File> classes2sources)
Copy the relevant found classes that are imported to the specified map. |
void |
copyResource(String resource,
File to)
Copies a resource on the classpath to a file. |
void |
copyResource(URL url,
File to)
Copies a resource to a file. |
File |
createTempDir()
Creates a temporary directory. |
File |
createTempFile(String baseName,
String suffix)
Creates a temporary file. |
void |
debug(String message,
Object... formatArgs)
Handle a debug-level message. |
protected void |
doBuild()
Do the build logic. |
protected void |
doClose()
Logic for handling the closing of the Enunciate mechanism. |
protected void |
doCompile()
Do the compile logic. |
protected void |
doGenerate()
Do the generate logic. |
protected void |
doInit()
Do the initialization logic. |
protected void |
doPackage()
Do the package logic. |
void |
execute()
Execute the mechanism. |
void |
extractBase(InputStream baseIn,
File toDir)
Extracts the (zipped up) base to the specified directory. |
Artifact |
findArtifact(String artifactId)
Finds the artifact of the given id. |
Set<File> |
getAdditionalSourceRoots()
The additional source roots. |
Set<Artifact> |
getArtifacts()
The artifacts exportable by enunciate. |
String |
getBuildClasspath()
The build classpath. |
File |
getBuildDir()
The directory to use to build the war. |
File |
getCompileDir()
The destination directory for the compiled classes. |
EnunciateConfiguration |
getConfig()
|
File |
getConfigFile()
The enunciate config file. |
String |
getEnunciateBuildClasspath()
The enunciate classpath to use when building the application. |
String |
getEnunciateRuntimeClasspath()
The enunciate classpath to use when running the application (after being built). |
Collection<String> |
getFiles(File basedir,
FileFilter filter)
Finds all files in the specified base directory using the specified filter. |
File |
getGenerateDir()
The preprocessor directory (-s). |
Collection<String> |
getJavaFiles(File basedir)
Finds all java files in the specified base directory. |
protected File |
getOldest(List<File> files)
Get the earliest modified file. |
File |
getPackageDir()
The package directory. |
Object |
getProperty(String property)
Get a property value. |
String |
getRuntimeClasspath()
The runtime classpath. |
File |
getScratchDir()
A scratch directory for Enunciate to use. |
String[] |
getSourceFiles()
Get the source files for this enunciate mechanism. |
Enunciate.Stepper |
getStepper()
Get a stepper that can be used to step through the Enunciate mechanism, which will be initialized. |
Enunciate.Target |
getTarget()
The target. |
String |
getVersion()
The version of the Enunciate mechanism. |
Set<WebAppFragment> |
getWebAppFragments()
The webapp fragments. |
protected File |
getYoungest(List<File> files)
Get the latest modified file. |
void |
info(String message,
Object... formatArgs)
Handle an info-level message. |
protected void |
initModules(Collection<DeploymentModule> deploymentModules)
Initialize each module. |
protected void |
invokeApt(String[] sourceFiles,
String... additionalApiClasses)
Invokes APT on the specified source files. |
void |
invokeJavac(File compileDir,
String[] sourceFiles)
Invokes javac on the specified source files. |
void |
invokeJavac(String classpath,
File compileDir,
String[] sourceFiles)
Invokes javac on the specified source files. |
void |
invokeJavac(String classpath,
String version,
File compileDir,
List<String> additionalArgs,
String[] sourceFiles)
Invokes javac on the specified source files. |
boolean |
isCompileDebugInfo()
Whether to compile with debug info. |
boolean |
isDebug()
Whether to print debugging information. |
boolean |
isJavacCheck()
Whether to do a javac check before invoking the Enunciate mechanism. |
boolean |
isModuleEnabled(String moduleName)
Whether the specified module is enabled. |
boolean |
isUpToDate(File sourceFile,
File destFile)
Determines whether a destination file is newer than a source file. |
protected boolean |
isUpToDate(List<File> sourceFiles,
File destFile)
Whether a given destination file is newer than all the specified source files. |
boolean |
isUpToDateWithSources(File destDir)
Whether all files in the specified directory are newer than all the source files. |
boolean |
isVerbose()
Whether to be verbose. |
protected EnunciateConfiguration |
loadConfig()
Reads the enunciate configuration from the specified file, if any. |
protected String |
lookupSourceEntry(File pathEntry)
Lookup the source entry for the specified classpath entry. |
static void |
main(String[] args)
|
File |
resolvePath(String filePath)
Resolves a path relative to the Enunciate config file, if present, otherwise the file will be a relative file to the current user directory. |
protected Map<String,File> |
scanForClassesToImport()
Scans the Enunciate classpath for classes to be imported. |
void |
setBuildClasspath(String buildClasspath)
The build classpath. |
void |
setBuildDir(File buildDir)
The directory to use to build the war. |
void |
setCompileDebugInfo(boolean compileDebugInfo)
Whether to compile with debug info. |
void |
setCompileDir(File compileDir)
The destination directory for the compiled classes. |
void |
setConfig(EnunciateConfiguration config)
Set the configuration for the mechanism. |
void |
setConfigFile(File configFile)
The enunciate config file. |
void |
setDebug(boolean debug)
Whether to print debugging information. |
void |
setGenerateDir(File generateDir)
The preprocessor directory (-s). |
void |
setJavacCheck(boolean javacCheck)
Whether to do a javac check before invoking the Enunciate mechanism. |
void |
setPackageDir(File packageDir)
The package directory. |
void |
setProperty(String property,
Object value)
Set a property value. |
void |
setRuntimeClasspath(String runtimeClasspath)
The runtime classpath. |
void |
setScratchDir(File scratchDir)
A scratch directory for Enunciate to use. |
protected void |
setSourceFiles(String[] sourceFiles)
Protected to allow the source files to be set after construction. |
void |
setTarget(Enunciate.Target target)
The target. |
void |
setVerbose(boolean verbose)
Whether to be verbose. |
void |
warn(String message,
Object... formatArgs)
Handle a warn-level message. |
protected void |
writePackageSourceFile(InputStream bytecode,
File packageSourceFile)
Write the package-info.java source to the specified file. |
void |
zip(File toFile,
File... dirs)
zip up directories to a specified zip file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected Enunciate()
public Enunciate(String[] sourceFiles)
sourceFiles - The source files.
public Enunciate(String[] sourceFiles,
EnunciateConfiguration config)
sourceFiles - The source files.config - The configpublic Enunciate(List<String> sourceFiles)
sourceFiles - The source files.| Method Detail |
|---|
public static void main(String[] args)
throws Exception
Exceptionprotected void setSourceFiles(String[] sourceFiles)
sourceFiles - The source files to enunciate.
public Enunciate.Stepper getStepper()
throws EnunciateException,
IOException
ConcurrentModificationException - If a stepper has already been retrieved.
EnunciateException - If there was an error initializing the Enunciate mechanism.
IOException - If there was an error initializing the Enunciate mechanism.
public void execute()
throws EnunciateException,
IOException
EnunciateException
IOException
protected void doClose()
throws EnunciateException,
IOException
EnunciateException
IOException
protected void doPackage()
throws IOException,
EnunciateException
IOException
EnunciateException
protected void doBuild()
throws IOException,
EnunciateException
IOException
EnunciateException
protected void doCompile()
throws IOException,
EnunciateException
IOException
EnunciateException
protected void doGenerate()
throws IOException,
EnunciateException
IOException
EnunciateException
protected Map<String,File> scanForClassesToImport()
throws IOException
IOExceptionprotected String lookupSourceEntry(File pathEntry)
pathEntry - The path entry for which to lookup the source entry.
protected void writePackageSourceFile(InputStream bytecode,
File packageSourceFile)
throws IOException
bytecode - The bytecode for the package-info.classpackageSourceFile - The source file.
IOException
protected boolean copyImportedClasses(Map<String,File> foundClasses2Sources,
Map<String,File> classes2sources)
foundClasses2Sources - the found classes.classes2sources - the target map.
protected void doInit()
throws EnunciateException,
IOException
EnunciateException
IOException
protected void initModules(Collection<DeploymentModule> deploymentModules)
throws EnunciateException,
IOException
deploymentModules - The deployment modules.
EnunciateException
IOException
public void info(String message,
Object... formatArgs)
message - The info message.formatArgs - The format args of the message.
public void debug(String message,
Object... formatArgs)
message - The debug message.formatArgs - The format args of the message.
public void warn(String message,
Object... formatArgs)
message - The warn message.formatArgs - The format args of the message.
public File createTempDir()
throws IOException
IOException
public File createTempFile(String baseName,
String suffix)
throws IOException
File.createTempFile(String, String) but in the Enunciate scratch directory.
baseName - The base name of the file.suffix - The suffix.
IOExceptionpublic String[] getSourceFiles()
protected EnunciateConfiguration loadConfig()
throws IOException
IOExceptionpublic Collection<String> getJavaFiles(File basedir)
basedir - The base directory.
public Collection<String> getFiles(File basedir,
FileFilter filter)
basedir - The base directory.filter - The filter to use.
public String getEnunciateRuntimeClasspath()
public String getEnunciateBuildClasspath()
protected void invokeApt(String[] sourceFiles,
String... additionalApiClasses)
throws IOException,
EnunciateException
sourceFiles - The source files.additionalApiClasses - The FQNs of additional classes (should be found on the Enunciate classpath) that comprise the API.
IOException
EnunciateException
public void compileSources(File compileDir)
throws EnunciateException
compileDir - The compile directory.
EnunciateException - If the compile fails.
public void invokeJavac(File compileDir,
String[] sourceFiles)
throws EnunciateException
runtime classpath.
compileDir - The compile directory.sourceFiles - The source files.
EnunciateException - if the compile fails.
public void invokeJavac(String classpath,
File compileDir,
String[] sourceFiles)
throws EnunciateException
classpath - The classpath.compileDir - The compile directory.sourceFiles - The source files.
EnunciateException - if the compile fails.
public void invokeJavac(String classpath,
String version,
File compileDir,
List<String> additionalArgs,
String[] sourceFiles)
throws EnunciateException
classpath - The classpath.version - The Java version to compile to.compileDir - The compile directory.additionalArgs - Any additional arguments to the compiler.sourceFiles - The source files. @throws EnunciateException if the compile fails.
EnunciateException
public void copyDir(File from,
File to,
File... excludes)
throws IOException
from - The source directory.to - The destination directory.excludes - The files to exclude from the copy
IOException
public void extractBase(InputStream baseIn,
File toDir)
throws IOException
baseIn - The stream to the base.toDir - The directory to extract to.
IOException
public void copyFile(File src,
File fromDir,
File toDir)
throws IOException
src - The source file.fromDir - The from directory.toDir - The to directory.
IOException
public void copyFile(File from,
File to)
throws IOException
from - The source file.to - The destination file.
IOException
public void copyResource(String resource,
File to)
throws IOException
resource - The resource to copy.to - The file to copy to.
IOException
public void copyResource(URL url,
File to)
throws IOException
url - The url of the resource.to - The file to copy to.
IOException
public void zip(File toFile,
File... dirs)
throws IOException
toFile - The file to zip to.dirs - The directories to zip up.
IOExceptionpublic File resolvePath(String filePath)
filePath - The file path to resolve.
public boolean isUpToDate(File sourceFile,
File destFile)
sourceFile - The source file.destFile - The destination file.
public boolean isUpToDateWithSources(File destDir)
destDir - The directory.
protected boolean isUpToDate(List<File> sourceFiles,
File destFile)
sourceFiles - The specified source files.destFile - The destination file.
protected File getYoungest(List<File> files)
files - The files.
protected File getOldest(List<File> files)
files - The files.
protected void buildFileList(List<File> list,
File... dirs)
list - The list.dirs - The directories.public boolean isVerbose()
public void setVerbose(boolean verbose)
verbose - Whether to be verbose.public boolean isDebug()
public void setDebug(boolean debug)
debug - Whether to print debugging information.public String getVersion()
public boolean isJavacCheck()
public void setJavacCheck(boolean javacCheck)
javacCheck - Whether to do a javac check before invoking the Enunciate mechanism.public boolean isCompileDebugInfo()
public void setCompileDebugInfo(boolean compileDebugInfo)
compileDebugInfo - Whether to compile with debug info.public File getConfigFile()
public void setConfigFile(File configFile)
configFile - The enunciate config file.public File getCompileDir()
public void setCompileDir(File compileDir)
compileDir - The destination directory for the compiled classes.public File getBuildDir()
public void setBuildDir(File buildDir)
buildDir - The directory to use to build the war.public File getPackageDir()
public void setPackageDir(File packageDir)
packageDir - The package directory.public File getScratchDir()
public void setScratchDir(File scratchDir)
scratchDir - A scratch directory for Enunciate to use.public File getGenerateDir()
public void setGenerateDir(File generateDir)
generateDir - The preprocessor directory (-s).public String getRuntimeClasspath()
public void setRuntimeClasspath(String runtimeClasspath)
runtimeClasspath - The runtime classpath.public String getBuildClasspath()
public void setBuildClasspath(String buildClasspath)
buildClasspath - The build classpath.public Enunciate.Target getTarget()
public void setTarget(Enunciate.Target target)
target - The target.
public void setProperty(String property,
Object value)
property - The property.value - The value.public Set<Artifact> getArtifacts()
public Artifact findArtifact(String artifactId)
artifactId - The id of the artifact.
public boolean addArtifact(Artifact artifact)
artifact - The artifact to add.
public void addWebAppFragment(WebAppFragment fragment)
fragment - The fragment.public Set<WebAppFragment> getWebAppFragments()
public void addAdditionalSourceRoot(File root)
root - The source root directory.public Set<File> getAdditionalSourceRoots()
public void addExport(String artifactId,
File destination)
artifactId - The id of the artifact to export.destination - The file or directory to export the artifact to.public Object getProperty(String property)
property - The property whose value to retrieve.
public EnunciateConfiguration getConfig()
public boolean isModuleEnabled(String moduleName)
moduleName - The name of the module.
public void setConfig(EnunciateConfiguration config)
config - The configuration.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||