Fields Summary |
---|
private org.apache.tools.ant.taskdefs.Rmic | attributes |
private org.apache.tools.ant.util.FileNameMapper | mapper |
private static final Random | RAND |
public static final String | RMI_STUB_SUFFIXsuffix denoting a stub file |
public static final String | RMI_SKEL_SUFFIXsuffix denoting a skel file |
public static final String | RMI_TIE_SUFFIXsuffix denoting a tie file |
public static final String | STUB_COMPATarg for compat |
public static final String | STUB_1_1arg for 1.1 |
public static final String | STUB_1_2arg for 1.2 |
Methods Summary |
---|
public org.apache.tools.ant.types.Path | getClasspath()Gets the CLASSPATH this rmic process will use.
return getCompileClasspath();
|
protected org.apache.tools.ant.types.Path | getCompileClasspath()Builds the compilation classpath.
Path classpath = new Path(attributes.getProject());
// add dest dir to classpath so that previously compiled and
// untouched classes are on classpath
classpath.setLocation(attributes.getBase());
// Combine the build classpath with the system classpath, in an
// order determined by the value of build.sysclasspath
Path cp = attributes.getClasspath();
if (cp == null) {
cp = new Path(attributes.getProject());
}
if (attributes.getIncludeantruntime()) {
classpath.addExisting(cp.concatSystemClasspath("last"));
} else {
classpath.addExisting(cp.concatSystemClasspath("ignore"));
}
if (attributes.getIncludejavaruntime()) {
classpath.addJavaRuntime();
}
return classpath;
|
public org.apache.tools.ant.util.FileNameMapper | getMapper()This implementation returns a mapper that may return up to two
file names.
- for JRMP it will return *_getStubClassSuffix (and
*_getSkelClassSuffix if JDK 1.1 is used)
- for IDL it will return a random name, causing <rmic> to
always recompile.
- for IIOP it will return _*_getStubClassSuffix for
interfaces and _*_getStubClassSuffix for non-interfaces (and
determine the interface and create _*_Stub from that).
return mapper;
|
public org.apache.tools.ant.taskdefs.Rmic | getRmic()Get the Rmic attributes
return attributes;
|
protected java.lang.String | getSkelClassSuffix()Gets the skeleton class suffix
return RMI_SKEL_SUFFIX;
|
protected java.lang.String | getStubClassSuffix()Gets the stub class suffix
return RMI_STUB_SUFFIX;
|
protected java.lang.String | getTieClassSuffix()Gets the tie class suffix
return RMI_TIE_SUFFIX;
|
protected void | logAndAddFilesToCompile(org.apache.tools.ant.types.Commandline cmd)Logs the compilation parameters, adds the files to compile and logs the
"niceSourceList"
Vector compileList = attributes.getCompileList();
attributes.log("Compilation " + cmd.describeArguments(),
Project.MSG_VERBOSE);
StringBuffer niceSourceList = new StringBuffer("File");
int cListSize = compileList.size();
if (cListSize != 1) {
niceSourceList.append("s");
}
niceSourceList.append(" to be compiled:");
for (int i = 0; i < cListSize; i++) {
String arg = (String) compileList.elementAt(i);
cmd.createArgument().setValue(arg);
niceSourceList.append(" ");
niceSourceList.append(arg);
}
attributes.log(niceSourceList.toString(), Project.MSG_VERBOSE);
|
public void | setRmic(org.apache.tools.ant.taskdefs.Rmic attributes)Sets Rmic attributes
this.attributes = attributes;
mapper = new RmicFileNameMapper();
|
protected org.apache.tools.ant.types.Commandline | setupRmicCommand()Setup rmic argument for rmic.
return setupRmicCommand(null);
|
protected org.apache.tools.ant.types.Commandline | setupRmicCommand(java.lang.String[] options)Setup rmic argument for rmic.
Commandline cmd = new Commandline();
if (options != null) {
for (int i = 0; i < options.length; i++) {
cmd.createArgument().setValue(options[i]);
}
}
Path classpath = getCompileClasspath();
cmd.createArgument().setValue("-d");
cmd.createArgument().setFile(attributes.getBase());
if (attributes.getExtdirs() != null) {
cmd.createArgument().setValue("-extdirs");
cmd.createArgument().setPath(attributes.getExtdirs());
}
cmd.createArgument().setValue("-classpath");
cmd.createArgument().setPath(classpath);
//handle the many different stub options.
String stubVersion = attributes.getStubVersion();
//default is compatibility
String stubOption = null;
if (null != stubVersion) {
if ("1.1".equals(stubVersion)) {
stubOption = STUB_1_1;
} else if ("1.2".equals(stubVersion)) {
stubOption = STUB_1_2;
} else if ("compat".equals(stubVersion)) {
stubOption = STUB_COMPAT;
} else {
//anything else
attributes.log("Unknown stub option " + stubVersion);
//do nothing with the value? or go -v+stubVersion??
}
}
//for java1.5+, we generate compatible stubs, that is, unless
//the caller asked for IDL or IIOP support.
if (stubOption == null
&& !attributes.getIiop()
&& !attributes.getIdl()) {
stubOption = STUB_COMPAT;
}
if (stubOption != null) {
//set the non-null stubOption
cmd.createArgument().setValue(stubOption);
}
if (null != attributes.getSourceBase()) {
cmd.createArgument().setValue("-keepgenerated");
}
if (attributes.getIiop()) {
attributes.log("IIOP has been turned on.", Project.MSG_INFO);
cmd.createArgument().setValue("-iiop");
if (attributes.getIiopopts() != null) {
attributes.log("IIOP Options: " + attributes.getIiopopts(),
Project.MSG_INFO);
cmd.createArgument().setValue(attributes.getIiopopts());
}
}
if (attributes.getIdl()) {
cmd.createArgument().setValue("-idl");
attributes.log("IDL has been turned on.", Project.MSG_INFO);
if (attributes.getIdlopts() != null) {
cmd.createArgument().setValue(attributes.getIdlopts());
attributes.log("IDL Options: " + attributes.getIdlopts(),
Project.MSG_INFO);
}
}
if (attributes.getDebug()) {
cmd.createArgument().setValue("-g");
}
cmd.addArguments(attributes.getCurrentCompilerArgs());
logAndAddFilesToCompile(cmd);
return cmd;
|