|
|||||||||
| 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(java.util.List<java.lang.String> sourceFiles)
Construct an enunciate mechanism on the specified source files. |
|
Enunciate(java.lang.String[] sourceFiles)
Construct an enunciate mechanism on the specified source files. |
|
Enunciate(java.lang.String[] sourceFiles,
EnunciateConfiguration config)
Construct an enunciate mechanism on the specified source files with the specified config. |
| Method Summary | |
|---|---|
void |
addAdditionalSourceRoot(java.io.File root)
Add an additional source root for Enunciate to process. |
boolean |
addArtifact(Artifact artifact)
Adds the specified artifact. |
void |
addClasspathHandler(ClasspathHandler handler)
Add a classpath handler. |
void |
addExport(java.lang.String artifactId,
java.io.File destination)
Adds an export. |
void |
addWebAppFragment(WebAppFragment fragment)
Add a webapp fragment for Enunciate to process. |
protected void |
buildFileList(java.util.List<java.io.File> list,
java.io.File... dirs)
Adds all files in specified directories to a list. |
void |
compileSources(java.io.File compileDir)
Compile all sources and any additional (generated) sources to the specified directory. |
void |
copyDir(java.io.File from,
java.io.File to,
java.io.File... excludes)
Copy an entire directory from one place to another. |
void |
copyFile(java.io.File from,
java.io.File to)
Copy a file from one location to another. |
void |
copyFile(java.io.File src,
java.io.File fromDir,
java.io.File toDir)
Copy a file from one directory to another, preserving directory structure. |
void |
copyResource(java.lang.String resource,
java.io.File to)
Copies a resource on the classpath to a file. |
void |
copyResource(java.net.URL url,
java.io.File to)
Copies a resource to a file. |
java.io.File |
createTempDir()
Creates a temporary directory. |
java.io.File |
createTempFile(java.lang.String baseName,
java.lang.String suffix)
Creates a temporary file. |
void |
debug(java.lang.String message,
java.lang.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 |
error(java.lang.String message,
java.lang.Object... formatArgs)
Handle an error-level message. |
void |
execute()
Execute the mechanism. |
void |
extractBase(java.io.InputStream baseIn,
java.io.File toDir)
Extracts the (zipped up) base to the specified directory. |
Artifact |
findArtifact(java.lang.String artifactId)
Finds the artifact of the given id. |
java.util.Set<java.io.File> |
getAdditionalSourceRoots()
The additional source roots. |
java.util.Set<Artifact> |
getArtifacts()
The artifacts exportable by enunciate. |
java.lang.String |
getBuildClasspath()
The build classpath. |
java.io.File |
getBuildDir()
The directory to use to build the war. |
java.io.File |
getCompileDir()
The destination directory for the compiled classes. |
EnunciateConfiguration |
getConfig()
|
java.io.File |
getConfigFile()
The enunciate config file. |
java.lang.String |
getEncoding()
|
java.lang.String |
getEnunciateBuildClasspath()
The enunciate classpath to use when building the application. |
java.lang.String |
getEnunciateRuntimeClasspath()
The enunciate classpath to use when running the application (after being built). |
java.util.Collection<java.lang.String> |
getFiles(java.io.File basedir,
java.io.FileFilter filter)
Finds all files in the specified base directory using the specified filter. |
java.io.File |
getGenerateDir()
The preprocessor directory (-s). |
java.util.Collection<java.lang.String> |
getJavaFiles(java.io.File basedir)
Finds all java files in the specified base directory. |
protected java.io.File |
getOldest(java.util.List<java.io.File> files)
Get the earliest modified file. |
java.io.File |
getPackageDir()
The package directory. |
java.lang.Object |
getProperty(java.lang.String property)
Get a property value. |
java.lang.String |
getRuntimeClasspath()
The runtime classpath. |
java.io.File |
getScratchDir()
A scratch directory for Enunciate to use. |
java.lang.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. |
java.lang.String |
getVersion()
The version of the Enunciate mechanism. |
java.util.Set<WebAppFragment> |
getWebAppFragments()
The webapp fragments. |
protected java.io.File |
getYoungest(java.util.List<java.io.File> files)
Get the latest modified file. |
void |
info(java.lang.String message,
java.lang.Object... formatArgs)
Handle an info-level message. |
protected void |
initModules(java.util.Collection<DeploymentModule> deploymentModules)
Initialize each module. |
protected void |
invokeApt(java.lang.String[] sourceFiles,
java.lang.String... additionalApiClasses)
Invokes APT on the specified source files. |
void |
invokeJavac(java.io.File compileDir,
java.lang.String[] sourceFiles)
Invokes javac on the specified source files. |
void |
invokeJavac(java.lang.String classpath,
java.io.File compileDir,
java.lang.String[] sourceFiles)
Invokes javac on the specified source files. |
void |
invokeJavac(java.lang.String classpath,
java.lang.String version,
java.io.File compileDir,
java.util.List<java.lang.String> additionalArgs,
java.lang.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(java.lang.String moduleName)
Whether the specified module is enabled. |
boolean |
isUpToDate(java.io.File sourceFile,
java.io.File destFile)
Determines whether a destination file is newer than a source file. |
protected boolean |
isUpToDate(java.util.List<java.io.File> sourceFiles,
java.io.File destFile)
Whether a given destination file is newer than all the specified source files. |
boolean |
isUpToDateWithSources(java.io.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 java.lang.String |
lookupSourceEntry(java.io.File pathEntry)
Lookup the source entry for the specified classpath entry. |
static void |
main(java.lang.String[] args)
|
java.io.File |
resolvePath(java.lang.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 void |
scanClasspath(java.util.Collection<ClasspathHandler> classpathHandlers)
Scans the Enunciate classpath, handling each entry according to each ClasspathHandler. |
void |
setBuildClasspath(java.lang.String buildClasspath)
The build classpath. |
void |
setBuildDir(java.io.File buildDir)
The directory to use to build the war. |
void |
setCompileDebugInfo(boolean compileDebugInfo)
Whether to compile with debug info. |
void |
setCompileDir(java.io.File compileDir)
The destination directory for the compiled classes. |
void |
setConfig(EnunciateConfiguration config)
Set the configuration for the mechanism. |
void |
setConfigFile(java.io.File configFile)
The enunciate config file. |
void |
setDebug(boolean debug)
Whether to print debugging information. |
void |
setEncoding(java.lang.String encoding)
|
void |
setGenerateDir(java.io.File generateDir)
The preprocessor directory (-s). |
void |
setJavacCheck(boolean javacCheck)
Whether to do a javac check before invoking the Enunciate mechanism. |
void |
setPackageDir(java.io.File packageDir)
The package directory. |
void |
setProperty(java.lang.String property,
java.lang.Object value)
Set a property value. |
void |
setRuntimeClasspath(java.lang.String runtimeClasspath)
The runtime classpath. |
void |
setScratchDir(java.io.File scratchDir)
A scratch directory for Enunciate to use. |
protected void |
setSourceFiles(java.lang.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(java.lang.String message,
java.lang.Object... formatArgs)
Handle a warn-level message. |
void |
zip(java.io.File toFile,
java.io.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(java.lang.String[] sourceFiles)
sourceFiles - The source files.
public Enunciate(java.lang.String[] sourceFiles,
EnunciateConfiguration config)
sourceFiles - The source files.config - The configpublic Enunciate(java.util.List<java.lang.String> sourceFiles)
sourceFiles - The source files.| Method Detail |
|---|
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exceptionprotected void setSourceFiles(java.lang.String[] sourceFiles)
sourceFiles - The source files to enunciate.
public Enunciate.Stepper getStepper()
throws EnunciateException,
java.io.IOException
java.util.ConcurrentModificationException - If a stepper has already been retrieved.
EnunciateException - If there was an error initializing the Enunciate mechanism.
java.io.IOException - If there was an error initializing the Enunciate mechanism.
public void execute()
throws EnunciateException,
java.io.IOException
EnunciateException
java.io.IOException
protected void doClose()
throws EnunciateException,
java.io.IOException
EnunciateException
java.io.IOException
protected void doPackage()
throws java.io.IOException,
EnunciateException
java.io.IOException
EnunciateException
protected void doBuild()
throws java.io.IOException,
EnunciateException
java.io.IOException
EnunciateException
protected void doCompile()
throws java.io.IOException,
EnunciateException
java.io.IOException
EnunciateException
protected void doGenerate()
throws java.io.IOException,
EnunciateException
java.io.IOException
EnunciateException
protected void scanClasspath(java.util.Collection<ClasspathHandler> classpathHandlers)
throws java.io.IOException
ClasspathHandler.
java.io.IOExceptionprotected java.lang.String lookupSourceEntry(java.io.File pathEntry)
pathEntry - The path entry for which to lookup the source entry.
protected void doInit()
throws EnunciateException,
java.io.IOException
EnunciateException
java.io.IOException
protected void initModules(java.util.Collection<DeploymentModule> deploymentModules)
throws EnunciateException,
java.io.IOException
deploymentModules - The deployment modules.
EnunciateException
java.io.IOException
public void info(java.lang.String message,
java.lang.Object... formatArgs)
message - The info message.formatArgs - The format args of the message.
public void debug(java.lang.String message,
java.lang.Object... formatArgs)
message - The debug message.formatArgs - The format args of the message.
public void warn(java.lang.String message,
java.lang.Object... formatArgs)
message - The warn message.formatArgs - The format args of the message.
public void error(java.lang.String message,
java.lang.Object... formatArgs)
message - The error message.formatArgs - The format args of the message.
public java.io.File createTempDir()
throws java.io.IOException
java.io.IOException
public java.io.File createTempFile(java.lang.String baseName,
java.lang.String suffix)
throws java.io.IOException
File.createTempFile(String, String) but in the Enunciate scratch directory.
baseName - The base name of the file.suffix - The suffix.
java.io.IOExceptionpublic java.lang.String[] getSourceFiles()
protected EnunciateConfiguration loadConfig()
throws java.io.IOException
java.io.IOExceptionpublic java.util.Collection<java.lang.String> getJavaFiles(java.io.File basedir)
basedir - The base directory.
public java.util.Collection<java.lang.String> getFiles(java.io.File basedir,
java.io.FileFilter filter)
basedir - The base directory.filter - The filter to use.
public java.lang.String getEnunciateRuntimeClasspath()
public java.lang.String getEnunciateBuildClasspath()
protected void invokeApt(java.lang.String[] sourceFiles,
java.lang.String... additionalApiClasses)
throws java.io.IOException,
EnunciateException
sourceFiles - The source files.additionalApiClasses - The FQNs of additional classes (should be found on the Enunciate classpath) that comprise the API.
java.io.IOException
EnunciateException
public void compileSources(java.io.File compileDir)
throws EnunciateException
compileDir - The compile directory.
EnunciateException - If the compile fails.
public void invokeJavac(java.io.File compileDir,
java.lang.String[] sourceFiles)
throws EnunciateException
runtime classpath.
compileDir - The compile directory.sourceFiles - The source files.
EnunciateException - if the compile fails.
public void invokeJavac(java.lang.String classpath,
java.io.File compileDir,
java.lang.String[] sourceFiles)
throws EnunciateException
classpath - The classpath.compileDir - The compile directory.sourceFiles - The source files.
EnunciateException - if the compile fails.
public void invokeJavac(java.lang.String classpath,
java.lang.String version,
java.io.File compileDir,
java.util.List<java.lang.String> additionalArgs,
java.lang.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(java.io.File from,
java.io.File to,
java.io.File... excludes)
throws java.io.IOException
from - The source directory.to - The destination directory.excludes - The files to exclude from the copy
java.io.IOException
public void extractBase(java.io.InputStream baseIn,
java.io.File toDir)
throws java.io.IOException
baseIn - The stream to the base.toDir - The directory to extract to.
java.io.IOException
public void copyFile(java.io.File src,
java.io.File fromDir,
java.io.File toDir)
throws java.io.IOException
src - The source file.fromDir - The from directory.toDir - The to directory.
java.io.IOException
public void copyFile(java.io.File from,
java.io.File to)
throws java.io.IOException
from - The source file.to - The destination file.
java.io.IOException
public void copyResource(java.lang.String resource,
java.io.File to)
throws java.io.IOException
resource - The resource to copy.to - The file to copy to.
java.io.IOException
public void copyResource(java.net.URL url,
java.io.File to)
throws java.io.IOException
url - The url of the resource.to - The file to copy to.
java.io.IOException
public void zip(java.io.File toFile,
java.io.File... dirs)
throws java.io.IOException
toFile - The file to zip to.dirs - The directories to zip up.
java.io.IOExceptionpublic java.io.File resolvePath(java.lang.String filePath)
filePath - The file path to resolve.
public boolean isUpToDate(java.io.File sourceFile,
java.io.File destFile)
sourceFile - The source file.destFile - The destination file.
public boolean isUpToDateWithSources(java.io.File destDir)
destDir - The directory.
protected boolean isUpToDate(java.util.List<java.io.File> sourceFiles,
java.io.File destFile)
sourceFiles - The specified source files.destFile - The destination file.
protected java.io.File getYoungest(java.util.List<java.io.File> files)
files - The files.
protected java.io.File getOldest(java.util.List<java.io.File> files)
files - The files.
protected void buildFileList(java.util.List<java.io.File> list,
java.io.File... dirs)
list - The list.dirs - The directories.public boolean isVerbose()
public java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
encoding - the encoding for the javac compilerpublic void setVerbose(boolean verbose)
verbose - Whether to be verbose.public boolean isDebug()
public void setDebug(boolean debug)
debug - Whether to print debugging information.public java.lang.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 java.io.File getConfigFile()
public void setConfigFile(java.io.File configFile)
configFile - The enunciate config file.public java.io.File getCompileDir()
public void setCompileDir(java.io.File compileDir)
compileDir - The destination directory for the compiled classes.public java.io.File getBuildDir()
public void setBuildDir(java.io.File buildDir)
buildDir - The directory to use to build the war.public java.io.File getPackageDir()
public void setPackageDir(java.io.File packageDir)
packageDir - The package directory.public java.io.File getScratchDir()
public void setScratchDir(java.io.File scratchDir)
scratchDir - A scratch directory for Enunciate to use.public java.io.File getGenerateDir()
public void setGenerateDir(java.io.File generateDir)
generateDir - The preprocessor directory (-s).public java.lang.String getRuntimeClasspath()
public void setRuntimeClasspath(java.lang.String runtimeClasspath)
runtimeClasspath - The runtime classpath.public java.lang.String getBuildClasspath()
public void setBuildClasspath(java.lang.String buildClasspath)
buildClasspath - The build classpath.public Enunciate.Target getTarget()
public void setTarget(Enunciate.Target target)
target - The target.
public void setProperty(java.lang.String property,
java.lang.Object value)
property - The property.value - The value.public java.util.Set<Artifact> getArtifacts()
public Artifact findArtifact(java.lang.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 void addClasspathHandler(ClasspathHandler handler)
handler - The classpath handler.public java.util.Set<WebAppFragment> getWebAppFragments()
public void addAdditionalSourceRoot(java.io.File root)
root - The source root directory.public java.util.Set<java.io.File> getAdditionalSourceRoots()
public void addExport(java.lang.String artifactId,
java.io.File destination)
artifactId - The id of the artifact to export.destination - The file or directory to export the artifact to.public java.lang.Object getProperty(java.lang.String property)
property - The property whose value to retrieve.
public EnunciateConfiguration getConfig()
public boolean isModuleEnabled(java.lang.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 | ||||||||