Class Rmic
- java.lang.Object
- 
- org.apache.tools.ant.ProjectComponent
- 
- org.apache.tools.ant.Task
- 
- org.apache.tools.ant.taskdefs.MatchingTask
- 
- org.apache.tools.ant.taskdefs.Rmic
 
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable,- SelectorContainer
 
 public class Rmic extends MatchingTask Runs the rmic compiler against classes. Rmic can be run on a single class (as specified with the classname attribute) or a number of classes at once (all classes below base that are neither _Stub nor _Skel classes). If you want to rmic a single class and this class is a class nested into another class, you have to specify the classname in the form Outer$$Innerinstead ofOuter.Inner.It is possible to refine the set of files that are being rmiced. This can be done with the includes, includesfile, excludes, excludesfile and defaultexcludes attributes. With the includes or includesfile attribute you specify the files you want to have included by using patterns. The exclude or excludesfile attribute is used to specify the files you want to have excluded. This is also done with patterns. And finally with the defaultexcludes attribute, you can specify whether you want to use default exclusions or not. See the section on directory based tasks, on how the inclusion/exclusion of files works, and how to write patterns. This task forms an implicit FileSet and supports all attributes of <fileset>(dirbecomesbase) as well as the nested<include>,<exclude>and<patternset>elements.It is possible to use different compilers. This can be selected with the "build.rmic" property or the compilerattribute. There are three choices:- sun (the standard compiler of the JDK)
- kaffe (the standard compiler of Kaffe)
- weblogic
 The miniRMI project contains a compiler implementation for this task as well, please consult miniRMI's documentation to learn how to use it. - Since:
- Ant 1.1
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classRmic.ImplementationSpecificArgumentAdds an "compiler" attribute to Commandline$Attribute used to filter command line attributes based on the current implementation.
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.StringERROR_BASE_NOT_SETbase attribute not set messagestatic java.lang.StringERROR_LOADING_CAUSED_EXCEPTIONloaded error messagestatic java.lang.StringERROR_NO_BASE_EXISTSbase not exists messagestatic java.lang.StringERROR_NOT_A_DIRbase not a directory messagestatic java.lang.StringERROR_NOT_DEFINEDnot defined messagestatic java.lang.StringERROR_NOT_FOUNDcould not be found messagestatic java.lang.StringERROR_RMIC_FAILEDrmic failed messagestatic java.lang.StringERROR_UNABLE_TO_VERIFY_CLASSunable to verify message- 
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTaskfileset
 - 
Fields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
 
- 
 - 
Constructor SummaryConstructors Constructor Description Rmic()Constructor for Rmic.
 - 
Method SummaryModifier and Type Method Description voidadd(RmicAdapter adapter)Set the compiler adapter explicitly.protected voidcleanup()Cleans up resources.PathcreateClasspath()Creates a nested classpath element.Rmic.ImplementationSpecificArgumentcreateCompilerArg()Adds an implementation specific command line argument.PathcreateCompilerClasspath()The classpath to use when loading the compiler implementation if it is not a built-in one.PathcreateExtdirs()Maybe creates a nested extdirs element.voidexecute()execute by creating an instance of an implementation class and getting to do the workjava.io.FilegetBase()Gets the base directory to output generated class.java.lang.StringgetClassname()Gets the class name to compile.PathgetClasspath()Gets the classpath.java.util.Vector<java.lang.String>getCompileList()java.lang.StringgetCompiler()get the name of the current compilerjava.lang.String[]getCurrentCompilerArgs()Get the additional implementation specific command line arguments.booleangetDebug()Gets the debug flag.java.io.FilegetDestdir()Gets the base directory to output the generated files.java.lang.StringgetExecutable()Explicitly specified name of the executable to use when forking - if any.PathgetExtdirs()Gets the extension directories that will be used during the compilation.java.util.Vector<java.lang.String>getFileList()Gets file list to compile.booleangetFiltering()Gets whether token filtering is setbooleangetIdl()Gets IDL flags.java.lang.StringgetIdlopts()Gets additional arguments for idl compile.booleangetIiop()Gets iiop flags.java.lang.StringgetIiopopts()Gets additional arguments for iiop.booleangetIncludeantruntime()Gets whether or not the ant classpath is to be included in the task's classpath.booleangetIncludejavaruntime()Gets whether or not the java runtime should be included in this task's classpath.java.lang.ClassLoadergetLoader()Classloader for the user-specified classpath.java.io.FilegetOutputDir()Gets the base directory to output the generated files, favoring destdir if set, otherwise defaulting to basedir.java.lang.Class<?>getRemoteInterface(java.lang.Class<?> testClass)Returns the topmost interface that extends Remote for a given class - if one exists.java.io.FilegetSourceBase()Gets the source dirs to find the source java files.java.lang.StringgetStubVersion()Gets the JDK version for the generated stub code.booleangetVerify()Get verify flag.booleanisValidRmiRemote(java.lang.String classname)Load named class and test whether it can be rmic'edprotected voidscanDir(java.io.File baseDir, java.lang.String[] files, FileNameMapper mapper)Scans the directory looking for class files to be compiled.voidsetBase(java.io.File base)Sets the location to store the compiled files; requiredvoidsetClassname(java.lang.String classname)Sets the class to runrmicagainst; optionalvoidsetClasspath(Path classpath)Set the classpath to be used for this compilation.voidsetClasspathRef(Reference pathRef)Adds to the classpath a reference to a <path> defined elsewhere.voidsetCompiler(java.lang.String compiler)Sets the compiler implementation to use; optional, defaults to the value of thebuild.rmicproperty, or failing that, default compiler for the current VMvoidsetDebug(boolean debug)Generate debug info (passes -g to rmic); optional, defaults to falsevoidsetDestdir(java.io.File destdir)Sets the base directory to output the generated files.voidsetExecutable(java.lang.String ex)Name of the executable to use when forking.voidsetExtdirs(Path extDirs)Sets the extension directories that will be used during the compilation; optional.voidsetFiltering(boolean filter)Sets token filtering [optional], default=falsevoidsetIdl(boolean idl)Indicates that IDL output should be generated.voidsetIdlopts(java.lang.String idlOpts)pass additional arguments for IDL compilevoidsetIiop(boolean iiop)Indicates that IIOP compatible stubs should be generated; optional, defaults to false if not set.voidsetIiopopts(java.lang.String iiopOpts)Set additional arguments for iiopvoidsetIncludeantruntime(boolean include)Sets whether or not to include ant's own classpath in this task's classpath.voidsetIncludejavaruntime(boolean include)task's classpath.voidsetListfiles(boolean list)If true, list the source files being handed off to the compiler.voidsetSourceBase(java.io.File sourceBase)optional directory to save generated source files to.voidsetStubVersion(java.lang.String stubVersion)Specify the JDK version for the generated stub code.voidsetVerify(boolean verify)Flag to enable verification so that the classes found by the directory match are checked to see if they implement java.rmi.Remote.- 
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTaskadd, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems
 - 
Methods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 - 
Methods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation
 
- 
 
- 
- 
- 
Field Detail- 
ERROR_RMIC_FAILEDpublic static final java.lang.String ERROR_RMIC_FAILED rmic failed message- See Also:
- Constant Field Values
 
 - 
ERROR_UNABLE_TO_VERIFY_CLASSpublic static final java.lang.String ERROR_UNABLE_TO_VERIFY_CLASS unable to verify message- See Also:
- Constant Field Values
 
 - 
ERROR_NOT_FOUNDpublic static final java.lang.String ERROR_NOT_FOUND could not be found message- See Also:
- Constant Field Values
 
 - 
ERROR_NOT_DEFINEDpublic static final java.lang.String ERROR_NOT_DEFINED not defined message- See Also:
- Constant Field Values
 
 - 
ERROR_LOADING_CAUSED_EXCEPTIONpublic static final java.lang.String ERROR_LOADING_CAUSED_EXCEPTION loaded error message- See Also:
- Constant Field Values
 
 - 
ERROR_NO_BASE_EXISTSpublic static final java.lang.String ERROR_NO_BASE_EXISTS base not exists message- See Also:
- Constant Field Values
 
 - 
ERROR_NOT_A_DIRpublic static final java.lang.String ERROR_NOT_A_DIR base not a directory message- See Also:
- Constant Field Values
 
 - 
ERROR_BASE_NOT_SETpublic static final java.lang.String ERROR_BASE_NOT_SET base attribute not set message- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
setBasepublic void setBase(java.io.File base) Sets the location to store the compiled files; required- Parameters:
- base- the location to store the compiled files
 
 - 
setDestdirpublic void setDestdir(java.io.File destdir) Sets the base directory to output the generated files.- Parameters:
- destdir- the base directory to output the generated files.
- Since:
- Ant 1.8.0
 
 - 
getDestdirpublic java.io.File getDestdir() Gets the base directory to output the generated files.- Returns:
- the base directory to output the generated files.
- Since:
- Ant 1.8.0
 
 - 
getOutputDirpublic java.io.File getOutputDir() Gets the base directory to output the generated files, favoring destdir if set, otherwise defaulting to basedir.- Returns:
- the actual directory to output to (either destdir or basedir)
- Since:
- Ant 1.8.0
 
 - 
getBasepublic java.io.File getBase() Gets the base directory to output generated class.- Returns:
- the location of the compiled files
 
 - 
setClassnamepublic void setClassname(java.lang.String classname) Sets the class to runrmicagainst; optional- Parameters:
- classname- the name of the class for rmic to create code for
 
 - 
getClassnamepublic java.lang.String getClassname() Gets the class name to compile.- Returns:
- the name of the class to compile
 
 - 
setSourceBasepublic void setSourceBase(java.io.File sourceBase) optional directory to save generated source files to.- Parameters:
- sourceBase- the directory to save source files to.
 
 - 
getSourceBasepublic java.io.File getSourceBase() Gets the source dirs to find the source java files.- Returns:
- sourceBase the directory containing the source files.
 
 - 
setStubVersionpublic void setStubVersion(java.lang.String stubVersion) Specify the JDK version for the generated stub code. Specify "1.1" to pass the "-v1.1" option to rmic.- Parameters:
- stubVersion- the JDK version
 
 - 
getStubVersionpublic java.lang.String getStubVersion() Gets the JDK version for the generated stub code.- Returns:
- stubVersion
 
 - 
setFilteringpublic void setFiltering(boolean filter) Sets token filtering [optional], default=false- Parameters:
- filter- turn on token filtering
 
 - 
getFilteringpublic boolean getFiltering() Gets whether token filtering is set- Returns:
- filtering
 
 - 
setDebugpublic void setDebug(boolean debug) Generate debug info (passes -g to rmic); optional, defaults to false- Parameters:
- debug- turn on debug info
 
 - 
getDebugpublic boolean getDebug() Gets the debug flag.- Returns:
- debug
 
 - 
setClasspathpublic void setClasspath(Path classpath) Set the classpath to be used for this compilation.- Parameters:
- classpath- the classpath used for this compilation
 
 - 
createClasspathpublic Path createClasspath() Creates a nested classpath element.- Returns:
- classpath
 
 - 
setClasspathRefpublic void setClasspathRef(Reference pathRef) Adds to the classpath a reference to a <path> defined elsewhere.- Parameters:
- pathRef- the reference to add to the classpath
 
 - 
getClasspathpublic Path getClasspath() Gets the classpath.- Returns:
- the classpath
 
 - 
setVerifypublic void setVerify(boolean verify) Flag to enable verification so that the classes found by the directory match are checked to see if they implement java.rmi.Remote. optional; This defaults to false if not set.- Parameters:
- verify- turn on verification for classes
 
 - 
getVerifypublic boolean getVerify() Get verify flag.- Returns:
- verify
 
 - 
setIioppublic void setIiop(boolean iiop) Indicates that IIOP compatible stubs should be generated; optional, defaults to false if not set.- Parameters:
- iiop- generate IIOP compatible stubs
 
 - 
getIioppublic boolean getIiop() Gets iiop flags.- Returns:
- iiop
 
 - 
setIiopoptspublic void setIiopopts(java.lang.String iiopOpts) Set additional arguments for iiop- Parameters:
- iiopOpts- additional arguments for iiop
 
 - 
getIiopoptspublic java.lang.String getIiopopts() Gets additional arguments for iiop.- Returns:
- iiopOpts
 
 - 
setIdlpublic void setIdl(boolean idl) Indicates that IDL output should be generated. This defaults to false if not set.- Parameters:
- idl- generate IDL output
 
 - 
getIdlpublic boolean getIdl() Gets IDL flags.- Returns:
- the idl flag
 
 - 
setIdloptspublic void setIdlopts(java.lang.String idlOpts) pass additional arguments for IDL compile- Parameters:
- idlOpts- additional IDL arguments
 
 - 
getIdloptspublic java.lang.String getIdlopts() Gets additional arguments for idl compile.- Returns:
- the idl options
 
 - 
getFileListpublic java.util.Vector<java.lang.String> getFileList() Gets file list to compile.- Returns:
- the list of files to compile.
 
 - 
setIncludeantruntimepublic void setIncludeantruntime(boolean include) Sets whether or not to include ant's own classpath in this task's classpath. Optional; default istrue.- Parameters:
- include- if true include ant's classpath
 
 - 
getIncludeantruntimepublic boolean getIncludeantruntime() Gets whether or not the ant classpath is to be included in the task's classpath.- Returns:
- true if ant's classpath is to be included
 
 - 
setIncludejavaruntimepublic void setIncludejavaruntime(boolean include) task's classpath. Enables or disables including the default run-time libraries from the executing VM; optional, defaults to false- Parameters:
- include- if true include default run-time libraries
 
 - 
getIncludejavaruntimepublic boolean getIncludejavaruntime() Gets whether or not the java runtime should be included in this task's classpath.- Returns:
- true if default run-time libraries are included
 
 - 
setExtdirspublic void setExtdirs(Path extDirs) Sets the extension directories that will be used during the compilation; optional.- Parameters:
- extDirs- the extension directories to be used
 
 - 
createExtdirspublic Path createExtdirs() Maybe creates a nested extdirs element.- Returns:
- path object to be configured with the extension directories
 
 - 
getExtdirspublic Path getExtdirs() Gets the extension directories that will be used during the compilation.- Returns:
- the extension directories to be used
 
 - 
getCompileListpublic java.util.Vector<java.lang.String> getCompileList() - Returns:
- the compile list.
 
 - 
setCompilerpublic void setCompiler(java.lang.String compiler) Sets the compiler implementation to use; optional, defaults to the value of thebuild.rmicproperty, or failing that, default compiler for the current VM- Parameters:
- compiler- the compiler implementation to use
- Since:
- Ant 1.5
 
 - 
getCompilerpublic java.lang.String getCompiler() get the name of the current compiler- Returns:
- the name of the compiler
- Since:
- Ant 1.5
 
 - 
createCompilerArgpublic Rmic.ImplementationSpecificArgument createCompilerArg() Adds an implementation specific command line argument.- Returns:
- an object to be configured with a command line argument
- Since:
- Ant 1.5
 
 - 
getCurrentCompilerArgspublic java.lang.String[] getCurrentCompilerArgs() Get the additional implementation specific command line arguments.- Returns:
- array of command line arguments, guaranteed to be non-null.
- Since:
- Ant 1.5
 
 - 
setExecutablepublic void setExecutable(java.lang.String ex) Name of the executable to use when forking.- Parameters:
- ex- String
- Since:
- Ant 1.8.0
 
 - 
getExecutablepublic java.lang.String getExecutable() Explicitly specified name of the executable to use when forking - if any.- Returns:
- String
- Since:
- Ant 1.8.0
 
 - 
createCompilerClasspathpublic Path createCompilerClasspath() The classpath to use when loading the compiler implementation if it is not a built-in one.- Returns:
- Path
- Since:
- Ant 1.8.0
 
 - 
setListfilespublic void setListfiles(boolean list) If true, list the source files being handed off to the compiler.- Parameters:
- list- if true list the source files
- Since:
- Ant 1.8.0
 
 - 
addpublic void add(RmicAdapter adapter) Set the compiler adapter explicitly.- Parameters:
- adapter- RmicAdapter
- Since:
- Ant 1.8.0
 
 - 
executepublic void execute() throws BuildExceptionexecute by creating an instance of an implementation class and getting to do the work- Overrides:
- executein class- Task
- Throws:
- BuildException- if there's a problem with baseDir or RMIC
 
 - 
cleanupprotected void cleanup() Cleans up resources.- Since:
- Ant 1.8.0
 
 - 
scanDirprotected void scanDir(java.io.File baseDir, java.lang.String[] files, FileNameMapper mapper)Scans the directory looking for class files to be compiled. The result is returned in the class variable compileList.- Parameters:
- baseDir- the base direction
- files- the list of files to scan
- mapper- the mapper of files to target files
 
 - 
isValidRmiRemotepublic boolean isValidRmiRemote(java.lang.String classname) Load named class and test whether it can be rmic'ed- Parameters:
- classname- the name of the class to be tested
- Returns:
- true if the class can be rmic'ed
 
 - 
getRemoteInterfacepublic java.lang.Class<?> getRemoteInterface(java.lang.Class<?> testClass) Returns the topmost interface that extends Remote for a given class - if one exists.- Parameters:
- testClass- the class to be tested
- Returns:
- the topmost interface that extends Remote, or null if there is none.
 
 - 
getLoaderpublic java.lang.ClassLoader getLoader() Classloader for the user-specified classpath.- Returns:
- the classloader
 
 
- 
 
-