conor 2003/07/06 02:03:18
Modified: . docs.xml
src/main/org/apache/tools/ant ExitException.java
MagicNames.java
src/main/org/apache/tools/ant/filters TokenFilter.java
src/main/org/apache/tools/ant/taskdefs Classloader.java
GZip.java LogStreamHandler.java Redirector.java
Rename.java Taskdef.java XSLTLiaison.java
src/main/org/apache/tools/ant/taskdefs/condition
FilesMatch.java Not.java
src/main/org/apache/tools/ant/taskdefs/cvslib
RedirectingOutputStream.java
RedirectingStreamHandler.java
src/main/org/apache/tools/ant/taskdefs/optional/ccm
CCMCheckin.java
src/main/org/apache/tools/ant/taskdefs/optional/ejb
JonasDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/j2ee
JonasHotDeploymentTool.java
src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
Log:
Fix a few checkstyle errors
Revision Changes Path
1.5 +6 -6 ant/docs.xml
Index: docs.xml
===================================================================
RCS file: /home/cvs/ant/docs.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
1.8 +1 -1 ant/src/main/org/apache/tools/ant/ExitException.java
Index: ExitException.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/ExitException.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -u -r1.7 -r1.8
1.2 +6 -2 ant/src/main/org/apache/tools/ant/MagicNames.java
Index: MagicNames.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/MagicNames.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- MagicNames.java 9 Jun 2003 13:38:06 -0000 1.1
+++ MagicNames.java 6 Jul 2003 09:03:17 -0000 1.2
@@ -64,5 +64,9 @@
public class MagicNames {
/** The name of the script repository used by the script repo task */
public static final String SCRIPT_REPOSITORY =
"org.apache.ant.scriptrepo";
+
+ /** The name of the reference to the System Class Loader */
+ public static final String SYSTEM_LOADER_REF = "ant.coreLoader";
+
}
1.9 +1 -1
ant/src/main/org/apache/tools/ant/filters/TokenFilter.java
Index: TokenFilter.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/filters/TokenFilter.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -u -r1.8 -r1.9
--- TokenFilter.java 4 Jul 2003 16:16:50 -0000 1.8
+++ TokenFilter.java 6 Jul 2003 09:03:17 -0000 1.9
@@ -594,7 +594,7 @@
* Abstract class that converts derived filter classes into
* ChainableReaderFilter's
*/
- public static abstract class ChainableReaderFilter extends
ProjectComponent
+ public abstract static class ChainableReaderFilter extends
ProjectComponent
implements ChainableReader, Filter {
private boolean byLine = true;
1.7 +70 -62
ant/src/main/org/apache/tools/ant/taskdefs/Classloader.java
Index: Classloader.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Classloader.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -u -r1.6 -r1.7
--- Classloader.java 22 Apr 2003 07:35:15 -0000 1.6
+++ Classloader.java 6 Jul 2003 09:03:17 -0000 1.7
@@ -54,11 +54,15 @@
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.*;
-import org.apache.tools.ant.types.*;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.MagicNames;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.types.Reference;
+import org.apache.tools.ant.types.Path;
-import java.io.*;
-import java.util.*;
+import java.io.File;
/**
* EXPERIMENTAL
@@ -93,7 +97,8 @@
* @author Costin Manolache
*/
public class Classloader extends Task {
- public static final String SYSTEM_LOADER_REF="ant.coreLoader";
+ /** @see MagicNames#SYSTEM_LOADER_REF */
+ public static final String SYSTEM_LOADER_REF =
MagicNames.SYSTEM_LOADER_REF;
private String name=null;
private Path classpath;
@@ -101,23 +106,27 @@
private boolean parentFirst=true;
private String parentName=null;
+ /**
+ * Default constructor
+ */
public Classloader() {
}
/** Name of the loader. If none, the default loader will be modified
*
- * @param name
+ * @param name the name of this loader
*/
public void setName(String name) {
this.name=name;
}
- /** Reset the classloader, if it already exists. A new loader will
+ /**
+ * Reset the classloader, if it already exists. A new loader will
* be created and all the references to the old one will be removed.
* ( it is not possible to remove paths from a loader ). The new
* path will be used.
*
- * @param b
+ * @param b true if the loader is to be reset.
*/
public void setReset(boolean b) {
this.reset=b;
@@ -171,11 +180,10 @@
public void execute() {
try {
// Gump friendly - don't mess with the core loader if only
classpath
- if( "only".equals( project.getProperty("build.sysclasspath")) &&
- (name==null || SYSTEM_LOADER_REF.equals( name ))) {
- log( "Changing the system loader is disabled " +
- "by build.sysclasspath=only",
- Project.MSG_WARN);
+ if ("only".equals(project.getProperty("build.sysclasspath"))
+ && (name == null || SYSTEM_LOADER_REF.equals(name))) {
+ log("Changing the system loader is disabled "
+ + "by build.sysclasspath=only", Project.MSG_WARN);
return;
}
@@ -215,8 +223,8 @@
// The core loader must be reverse
//reverse=true;
}
- project.log("Setting parent loader " + name + " " +
- parent + " " + parentFirst, Project.MSG_DEBUG);
+ project.log("Setting parent loader " + name + " "
+ + parent + " " + parentFirst, Project.MSG_DEBUG);
// The param is "parentFirst"
acl=new AntClassLoader( (ClassLoader)parent,
@@ -232,7 +240,7 @@
}
}
if( classpath != null ) {
- String list[]=classpath.list();
+ String[] list = classpath.list();
for( int i=0; i<list.length; i++ ) {
File f= new File( list[i] );
if( f.exists() ) {
1.25 +3 -0 ant/src/main/org/apache/tools/ant/taskdefs/GZip.java
Index: GZip.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/GZip.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -w -u -r1.24 -r1.25
--- GZip.java 10 Feb 2003 14:13:34 -0000 1.24
+++ GZip.java 6 Jul 2003 09:03:17 -0000 1.25
@@ -73,6 +73,9 @@
*/
public class GZip extends Pack {
+ /**
+ * perform the GZip compression operation.
+ */
protected void pack() {
GZIPOutputStream zOut = null;
try {
1.8 +4 -1
ant/src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java
Index: LogStreamHandler.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -u -r1.7 -r1.8
--- LogStreamHandler.java 10 Feb 2003 14:13:35 -0000 1.7
+++ LogStreamHandler.java 6 Jul 2003 09:03:17 -0000 1.8
@@ -67,7 +67,7 @@
public class LogStreamHandler extends PumpStreamHandler {
/**
- * Creates a new instance of this class.
+ * Creates log stream handler
*
* @param task the task for whom to log
* @param outlevel the loglevel used to log standard output
@@ -78,6 +78,9 @@
new LogOutputStream(task, errlevel));
}
+ /**
+ * Stop the log stream handler.
+ */
public void stop() {
super.stop();
try {
1.6 +66 -66
ant/src/main/org/apache/tools/ant/taskdefs/Redirector.java
Index: Redirector.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Redirector.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -u -r1.5 -r1.6
1.15 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/Rename.java
Index: Rename.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Rename.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -w -u -r1.14 -r1.15
--- Rename.java 25 Jun 2003 11:52:46 -0000 1.14
+++ Rename.java 6 Jul 2003 09:03:17 -0000 1.15
@@ -124,8 +124,8 @@
try {
FileUtils.newFileUtils().rename(src, dest);
} catch (IOException e) {
- throw new BuildException("Unable to rename " + src + " to " +
- dest, e, getLocation());
+ throw new BuildException("Unable to rename " + src + " to "
+ + dest, e, getLocation());
}
}
}
1.29 +4 -0 ant/src/main/org/apache/tools/ant/taskdefs/Taskdef.java
Index: Taskdef.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Taskdef.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -w -u -r1.28 -r1.29
--- Taskdef.java 4 Jul 2003 14:04:54 -0000 1.28
+++ Taskdef.java 6 Jul 2003 09:03:17 -0000 1.29
@@ -75,6 +75,10 @@
*/
public class Taskdef extends Typedef {
+ /**
+ * Default constuctor.
+ *
+ */
public Taskdef() {
setAdapterClass(TaskAdapter.class);
setAdaptToClass(Task.class);
1.15 +1 -0
ant/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison.java
Index: XSLTLiaison.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -w -u -r1.14 -r1.15
--- XSLTLiaison.java 10 Feb 2003 14:13:36 -0000 1.14
+++ XSLTLiaison.java 6 Jul 2003 09:03:17 -0000 1.15
@@ -79,6 +79,7 @@
/**
* set the stylesheet to use for the transformation.
* @param stylesheet the stylesheet to be used for transformation.
+ * @throws Exception thrown if any problems happens.
* @since Ant 1.4
*/
void setStylesheet(File stylesheet) throws Exception;
1.11 +2 -2
ant/src/main/org/apache/tools/ant/taskdefs/condition/FilesMatch.java
Index: FilesMatch.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/FilesMatch.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -u -r1.10 -r1.11
1.6 +9 -2
ant/src/main/org/apache/tools/ant/taskdefs/condition/Not.java
Index: Not.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/Not.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -u -r1.5 -r1.6
--- Not.java 7 Mar 2003 11:23:05 -0000 1.5
+++ Not.java 6 Jul 2003 09:03:17 -0000 1.6
@@ -68,9 +68,16 @@
*/
public class Not extends ConditionBase implements Condition {
+ /**
+ * Evaluate condition
+ *
+ * @return true if the condition is true.
+ * @throws BuildException if the condition is not configured correctly.
+ */
public boolean eval() throws BuildException {
if (countConditions() > 1) {
- throw new BuildException("You must not nest more than one
condition into <not>");
+ throw new BuildException("You must not nest more than one "
+ + "condition into <not>");
}
if (countConditions() < 1) {
throw new BuildException("You must nest a condition into <not>");
1.6 +4 -4
ant/src/main/org/apache/tools/ant/taskdefs/cvslib/RedirectingOutputStream.java
Index: RedirectingOutputStream.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/RedirectingOutputStream.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -u -r1.5 -r1.6
--- RedirectingOutputStream.java 10 Feb 2003 14:13:43 -0000 1.5
+++ RedirectingOutputStream.java 6 Jul 2003 09:03:17 -0000 1.6
@@ -63,7 +63,7 @@
*/
class RedirectingOutputStream
extends LogOutputStream {
- private final ChangeLogParser m_parser;
+ private final ChangeLogParser parser;
/**
@@ -73,7 +73,7 @@
*/
public RedirectingOutputStream(final ChangeLogParser parser) {
super(null, 0);
- m_parser = parser;
+ this.parser = parser;
}
@@ -83,7 +83,7 @@
* @param line the line to log.
*/
protected void processLine(final String line) {
- m_parser.stdout(line);
+ parser.stdout(line);
}
}
1.13 +2 -2
ant/src/main/org/apache/tools/ant/taskdefs/cvslib/RedirectingStreamHandler.java
Index: RedirectingStreamHandler.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/RedirectingStreamHandler.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -w -u -r1.12 -r1.13
1.5 +3 -0
ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java
Index: CCMCheckin.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- CCMCheckin.java 10 Feb 2003 14:13:46 -0000 1.4
+++ CCMCheckin.java 6 Jul 2003 09:03:18 -0000 1.5
@@ -63,6 +63,9 @@
*/
public class CCMCheckin extends CCMCheck {
+ /**
+ * Default constructor - setup checkin command
+ */
public CCMCheckin() {
super();
setCcmAction(COMMAND_CHECKIN);
1.11 +132 -113
ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java
Index: JonasDeploymentTool.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -u -r1.10 -r1.11
--- JonasDeploymentTool.java 10 Feb 2003 14:13:50 -0000 1.10
+++ JonasDeploymentTool.java 6 Jul 2003 09:03:18 -0000 1.11
@@ -77,12 +77,16 @@
public class JonasDeploymentTool extends GenericDeploymentTool {
/** Public Id of the standard deployment descriptor DTD. */
- protected static final String EJB_JAR_1_1_PUBLIC_ID = "-//Sun
Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN";
- protected static final String EJB_JAR_2_0_PUBLIC_ID = "-//Sun
Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN";
+ protected static final String EJB_JAR_1_1_PUBLIC_ID
+ = "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN";
+ protected static final String EJB_JAR_2_0_PUBLIC_ID
+ = "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN";
/** Public Id of the JOnAS-specific deployment descriptor DTD. */
- protected static final String JONAS_EJB_JAR_2_4_PUBLIC_ID =
"-//ObjectWeb//DTD JOnAS 2.4//EN";
- protected static final String JONAS_EJB_JAR_2_5_PUBLIC_ID =
"-//ObjectWeb//DTD JOnAS 2.5//EN";
+ protected static final String JONAS_EJB_JAR_2_4_PUBLIC_ID
+ = "-//ObjectWeb//DTD JOnAS 2.4//EN";
+ protected static final String JONAS_EJB_JAR_2_5_PUBLIC_ID
+ = "-//ObjectWeb//DTD JOnAS 2.5//EN";
/** RMI ORB. */
protected static final String RMI_ORB = "RMI";
@@ -104,8 +108,10 @@
* Name of the JOnAS-specific deployment descriptor DTD (these files are
* stored in the ${JONAS_ROOT}/xml directory).
*/
- protected static final String JONAS_EJB_JAR_2_4_DTD =
"jonas-ejb-jar_2_4.dtd";
- protected static final String JONAS_EJB_JAR_2_5_DTD =
"jonas-ejb-jar_2_5.dtd";
+ protected static final String JONAS_EJB_JAR_2_4_DTD
+ = "jonas-ejb-jar_2_4.dtd";
+ protected static final String JONAS_EJB_JAR_2_5_DTD
+ = "jonas-ejb-jar_2_5.dtd";
/** Default JOnAS deployment descriptor name. */
protected static final String JONAS_DD = "jonas-ejb-jar.xml";
@@ -215,7 +221,10 @@
*/
private String orb;
- /** <code>true</code> if GenIC must not be run on the EJB JAR. The
default is <code>false</code>. */
+ /**
+ * <code>true</code> if GenIC must not be run on the EJB JAR.
+ * The default is <code>false</code>.
+ */
private boolean nogenic = false;
/* -------------------- */
@@ -441,8 +450,9 @@
fileName = descriptorName;
}
- if ( fileName.startsWith(EJB_DD) )
+ if (fileName.startsWith(EJB_DD)) {
return path + JONAS_DD;
+ }
int endOfBaseName =
descriptorName.indexOf(getConfig().baseNameTerminator, startOfFileName);
@@ -539,9 +549,12 @@
* @param ejbFiles the hashtable.
*/
private void addGenICGeneratedFiles(File genericJarFile, Hashtable
ejbFiles) {
+ // GenIC task
+ Java genicTask = null;
- Java genicTask = null; // GenIC task
- String genicClass = null; // GenIC class (3 GenIC classes for
various versions of JOnAS are supported)
+ // GenIC class (3 GenIC classes for various versions of JOnAS
+ // are supported)
+ String genicClass = null;
if ( nogenic ) {
return;
@@ -595,7 +608,8 @@
// try to create the classpath for the correct ORB
if ( orb != null ) {
- String orbJar = jonasroot + File.separator + "lib" +
File.separator + orb + "_jonas.jar";
+ String orbJar = jonasroot + File.separator + "lib"
+ + File.separator + orb + "_jonas.jar";
classpath.append(new Path(classpath.getProject(), orbJar));
}
@@ -668,8 +682,8 @@
genicTask.createArg().setValue(genericJarFile.getPath());
// calling GenIC task
- log("Calling " + genicClass + " for " + getConfig().descriptorDir +
File.separator + descriptorName
- + ".", Project.MSG_VERBOSE);
+ log("Calling " + genicClass + " for " + getConfig().descriptorDir
+ + File.separator + descriptorName + ".", Project.MSG_VERBOSE);
if ( genicTask.executeJava() != 0 ) {
@@ -698,41 +712,44 @@
*/
String getGenicClassName(Path classpath) {
- log("Looking for GenIC class in classpath: " + classpath.toString(),
Project.MSG_VERBOSE);
+ log("Looking for GenIC class in classpath: "
+ + classpath.toString(), Project.MSG_VERBOSE);
AntClassLoader cl =
classpath.getProject().createClassLoader(classpath);
try {
cl.loadClass(JonasDeploymentTool.GENIC_CLASS);
- log("Found GenIC class '" + JonasDeploymentTool.GENIC_CLASS + "'
in classpath.", Project.MSG_VERBOSE);
+ log("Found GenIC class '" + JonasDeploymentTool.GENIC_CLASS
+ + "' in classpath.", Project.MSG_VERBOSE);
return JonasDeploymentTool.GENIC_CLASS;
} catch (ClassNotFoundException cnf1) {
- log("GenIC class '" + JonasDeploymentTool.GENIC_CLASS + "' not
found in classpath.",
+ log("GenIC class '" + JonasDeploymentTool.GENIC_CLASS
+ + "' not found in classpath.",
Project.MSG_VERBOSE);
}
try {
cl.loadClass(JonasDeploymentTool.OLD_GENIC_CLASS_1);
- log("Found GenIC class '" +
JonasDeploymentTool.OLD_GENIC_CLASS_1 +
- "' in classpath.", Project.MSG_VERBOSE);
+ log("Found GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_1
+ + "' in classpath.", Project.MSG_VERBOSE);
return JonasDeploymentTool.OLD_GENIC_CLASS_1;
} catch (ClassNotFoundException cnf2) {
- log("GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_1 +
- "' not found in classpath.",
+ log("GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_1
+ + "' not found in classpath.",
Project.MSG_VERBOSE);
}
try {
cl.loadClass(JonasDeploymentTool.OLD_GENIC_CLASS_2);
- log("Found GenIC class '" +
JonasDeploymentTool.OLD_GENIC_CLASS_2 +
- "' in classpath.", Project.MSG_VERBOSE);
+ log("Found GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_2
+ + "' in classpath.", Project.MSG_VERBOSE);
return JonasDeploymentTool.OLD_GENIC_CLASS_2;
} catch (ClassNotFoundException cnf3) {
- log("GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_2 +
- "' not found in classpath.",
+ log("GenIC class '" + JonasDeploymentTool.OLD_GENIC_CLASS_2
+ + "' not found in classpath.",
Project.MSG_VERBOSE);
}
return null;
@@ -745,14 +762,16 @@
if ( jonasroot == null ) {
throw new BuildException("The jonasroot attribut is not set.");
} else if ( !jonasroot.isDirectory() ) {
- throw new BuildException("The jonasroot attribut '" + jonasroot +
- "' is not a valid directory.");
+ throw new BuildException("The jonasroot attribut '" + jonasroot
+ + "' is not a valid directory.");
}
// orb
- if ( orb != null && !orb.equals(RMI_ORB) && !orb.equals(JEREMIE_ORB)
&& !orb.equals(DAVID_ORB) ) {
- throw new BuildException("The orb attribut '" + orb + "' is not
valid (must be either " +
- RMI_ORB + ", " + JEREMIE_ORB + " or " + DAVID_ORB +
").");
+ if (orb != null && !orb.equals(RMI_ORB) && !orb.equals(JEREMIE_ORB)
+ && !orb.equals(DAVID_ORB)) {
+ throw new BuildException("The orb attribut '" + orb
+ + "' is not valid (must be either "
+ + RMI_ORB + ", " + JEREMIE_ORB + " or " + DAVID_ORB + ").");
}
// additionalargs
@@ -793,7 +812,7 @@
*/
private void deleteAllFiles(File aFile) {
if ( aFile.isDirectory() ) {
- File someFiles[] = aFile.listFiles();
+ File[] someFiles = aFile.listFiles();
for (int i = 0; i < someFiles.length; i++) {
deleteAllFiles(someFiles[i]);
@@ -818,7 +837,7 @@
String newRootDir;
if ( file.isDirectory() ) {
- File files[] = file.listFiles();
+ File[] files = file.listFiles();
for (int i = 0; i < files.length; i++) {
if ( rootDir.length() > 0 ) {
newRootDir = rootDir + File.separator +
files[i].getName();
1.11 +27 -18
ant/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/JonasHotDeploymentTool.java
Index: JonasHotDeploymentTool.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/JonasHotDeploymentTool.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -u -r1.10 -r1.11
--- JonasHotDeploymentTool.java 10 Feb 2003 14:14:09 -0000 1.10
+++ JonasHotDeploymentTool.java 6 Jul 2003 09:03:18 -0000 1.11
@@ -217,21 +217,30 @@
if (jonasroot == null || jonasroot.isDirectory()) {
java.createJvmarg().setValue("-Dinstall.root=" + jonasroot);
- java.createJvmarg().setValue("-Djava.security.policy=" +
jonasroot + "/config/java.policy");
+ java.createJvmarg().setValue("-Djava.security.policy=" +
jonasroot
+ + "/config/java.policy");
if ("DAVID".equals(orb)) {
-
java.createJvmarg().setValue("-Dorg.omg.CORBA.ORBClass=org.objectweb.david.libs.binding.orbs.iiop.IIOPORB");
-
java.createJvmarg().setValue("-Dorg.omg.CORBA.ORBSingletonClass=org.objectweb.david.libs.binding.orbs.ORBSingletonClass");
-
java.createJvmarg().setValue("-Djavax.rmi.CORBA.StubClass=org.objectweb.david.libs.stub_factories.rmi.StubDelegate");
-
java.createJvmarg().setValue("-Djavax.rmi.CORBA.PortableRemoteObjectClass=org.objectweb.david.libs.binding.rmi.ORBPortableRemoteObjectDelegate");
-
java.createJvmarg().setValue("-Djavax.rmi.CORBA.UtilClass=org.objectweb.david.libs.helpers.RMIUtilDelegate");
+ java.createJvmarg().setValue("-Dorg.omg.CORBA.ORBClass"
+ + "=org.objectweb.david.libs.binding.orbs.iiop.IIOPORB");
+
java.createJvmarg().setValue("-Dorg.omg.CORBA.ORBSingletonClass="
+ +
"org.objectweb.david.libs.binding.orbs.ORBSingletonClass");
+ java.createJvmarg().setValue("-Djavax.rmi.CORBA.StubClass="
+ +
"org.objectweb.david.libs.stub_factories.rmi.StubDelegate");
+
java.createJvmarg().setValue("-Djavax.rmi.CORBA.PortableRemoteObjectClass="
+ +
"org.objectweb.david.libs.binding.rmi.ORBPortableRemoteObjectDelegate");
+ java.createJvmarg().setValue("-Djavax.rmi.CORBA.UtilClass="
+ + "org.objectweb.david.libs.helpers.RMIUtilDelegate");
java.createJvmarg().setValue("-Ddavid.CosNaming.default_method=0");
-
java.createJvmarg().setValue("-Ddavid.rmi.ValueHandlerClass=com.sun.corba.se.internal.io.ValueHandlerImpl");
+ java.createJvmarg().setValue("-Ddavid.rmi.ValueHandlerClass="
+ + "com.sun.corba.se.internal.io.ValueHandlerImpl");
if (davidHost != null) {
-
java.createJvmarg().setValue("-Ddavid.CosNaming.default_host=" + davidHost);
+
java.createJvmarg().setValue("-Ddavid.CosNaming.default_host="
+ + davidHost);
}
if (davidPort != 0) {
-
java.createJvmarg().setValue("-Ddavid.CosNaming.default_port=" + davidPort);
+
java.createJvmarg().setValue("-Ddavid.CosNaming.default_port="
+ + davidPort);
}
}
}
@@ -240,9 +249,9 @@
java.createArg().setLine("-n " + getServer());
}
- if (action.equals(ACTION_DEPLOY) ||
- action.equals(ACTION_UPDATE) ||
- action.equals("redeploy")) {
+ if (action.equals(ACTION_DEPLOY)
+ || action.equals(ACTION_UPDATE)
+ || action.equals("redeploy")) {
java.createArg().setLine("-a " + getTask().getSource());
} else if (action.equals(ACTION_DELETE) ||
action.equals(ACTION_UNDEPLOY)) {
java.createArg().setLine("-r " + getTask().getSource());
1.36 +162 -86
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
Index: FTP.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -w -u -r1.35 -r1.36
--- FTP.java 7 Mar 2003 14:51:59 -0000 1.35
+++ FTP.java 6 Jul 2003 09:03:18 -0000 1.36
@@ -115,6 +115,9 @@
protected static final int CHMOD = 5;
protected static final int RM_DIR = 6;
+ /** Default port for FTP */
+ public static final int DEFAULT_FTP_PORT = 21;
+
private String remotedir;
private String server;
private String userid;
@@ -129,7 +132,7 @@
private Vector dirCache = new Vector();
private int transferred = 0;
private String remoteFileSep = "/";
- private int port = 21;
+ private int port = DEFAULT_FTP_PORT;
private boolean skipFailedTransfers = false;
private int skipped = 0;
private boolean ignoreNoncriticalErrors = false;
@@ -282,31 +285,49 @@
* Sets the remote directory where files will be placed. This may be a
* relative or absolute path, and must be in the path syntax expected by
* the remote server. No correction of path syntax will be performed.
+ *
+ * @param dir the remote directory name.
*/
public void setRemotedir(String dir) {
this.remotedir = dir;
}
- /** Sets the FTP server to send files to. */
+ /**
+ * Sets the FTP server to send files to.
+ *
+ * @param server the remote server name.
+ */
public void setServer(String server) {
this.server = server;
}
- /** Sets the FTP port used by the remote server. */
+ /**
+ * Sets the FTP port used by the remote server.
+ *
+ * @param port the port on which the remote server is listening.
+ */
public void setPort(int port) {
this.port = port;
}
- /** Sets the login user id to use on the specified server. */
+ /**
+ * Sets the login user id to use on the specified server.
+ *
+ * @param userid remote system userid.
+ */
public void setUserid(String userid) {
this.userid = userid;
}
- /** Sets the login password for the given user id. */
+ /**
+ * Sets the login password for the given user id.
+ *
+ * @param password the password on the remote system.
+ */
public void setPassword(String password) {
this.password = password;
}
@@ -314,6 +335,8 @@
/**
* If true, uses binary mode, otherwise text mode (default is binary).
+ *
+ * @param binary if true use binary mode in transfers.
*/
public void setBinary(boolean binary) {
this.binary = binary;
@@ -324,6 +347,8 @@
* Specifies whether to use passive mode. Set to true if you are behind a
* firewall and cannot connect without it. Passive mode is disabled by
* default.
+ *
+ * @param passive true is passive mode should be used.
*/
public void setPassive(boolean passive) {
this.passive = passive;
@@ -333,6 +358,8 @@
/**
* Set to true to receive notification about each file as it is
* transferred.
+ *
+ * @param verbose true if verbose notifications are required.
*/
public void setVerbose(boolean verbose) {
this.verbose = verbose;
@@ -340,8 +367,10 @@
/**
- * A synonym for <tt>depends</tt>. Set to true to transmit only new or
changed
- * files.
+ * A synonym for <tt>depends</tt>. Set to true to transmit only new
+ * or changed files.
+ *
+ * @param newer if true only transfer newer files.
*/
public void setNewer(boolean newer) {
this.newerOnly = newer;
@@ -350,6 +379,8 @@
/**
* Set to true to preserve modification times for "gotten" files.
+ *
+ * @param preserveLastModified if true preserver modification times.
*/
public void setPreserveLastModified(boolean preserveLastModified) {
this.preserveLastModified = preserveLastModified;
@@ -359,6 +390,8 @@
/**
* Set to true to transmit only files that are new or changed from their
* remote counterparts. The default is to transmit all files.
+ *
+ * @param depends if true only transfer newer files.
*/
public void setDepends(boolean depends) {
this.newerOnly = depends;
@@ -370,6 +403,8 @@
* Unix standard forward slash, but can be manually overridden using this
* call if the remote server requires some other separator. Only the
first
* character of the string is used.
+ *
+ * @param separator the file separator on the remote system.
*/
public void setSeparator(String separator) {
remoteFileSep = separator;
@@ -377,16 +412,22 @@
/**
- * Sets the file permission mode (Unix only) for files sent to the
server.
+ * Sets the file permission mode (Unix only) for files sent to the
+ * server.
+ *
+ * @param theMode unix style file mode for the files sent to the remote
+ * system.
*/
-
public void setChmod(String theMode) {
this.chmod = theMode;
}
- /** Sets the default mask for file creation on a unix server. */
-
+ /**
+ * Sets the default mask for file creation on a unix server.
+ *
+ * @param theUmask unix style umask for files created on the remote
server.
+ */
public void setUmask(String theUmask) {
this.umask = theUmask;
}
@@ -394,6 +435,9 @@
/**
* A set of files to upload or download
+ *
+ * @param set the set of files to be added to the list of files to be
+ * transferred.
*/
public void addFileset(FileSet set) {
filesets.addElement(set);
@@ -409,6 +453,10 @@
* work and also to encapsulate operations on the type in its own
* class.
* @ant.attribute ignore="true"
+ *
+ * @param action the FTP action to be performed.
+ *
+ * @throws BuildException if the action is not a valid action.
*/
public void setAction(String action) throws BuildException {
log("DEPRECATED - The setAction(String) method has been deprecated."
@@ -424,6 +472,10 @@
/**
* Sets the FTP action to be taken. Currently accepts "put", "get",
"del",
* "mkdir", "chmod" and "list".
+ *
+ * @param action the FTP action to be performed.
+ *
+ * @throws BuildException if the action is not a valid action.
*/
public void setAction(Action action) throws BuildException {
this.action = action.getAction();
@@ -433,8 +485,10 @@
/**
* The output file for the "list" action. This attribute is ignored for
* any other actions.
+ *
+ * @param listing file in which to store the listing.
*/
- public void setListing(File listing) throws BuildException {
+ public void setListing(File listing) {
this.listing = listing;
}
@@ -443,6 +497,8 @@
* If true, enables unsuccessful file put, delete and get
* operations to be skipped with a warning and the remainder
* of the files still transferred.
+ *
+ * @param skipFailedTransfers true if failures in transfers are ignored.
*/
public void setSkipFailedTransfers(boolean skipFailedTransfers) {
this.skipFailedTransfers = skipFailedTransfers;
@@ -452,13 +508,20 @@
/**
* set the flag to skip errors on directory creation.
* (and maybe later other server specific errors)
+ *
+ * @param ignoreNoncriticalErrors true if non-critical errors should not
+ * cause a failure.
*/
public void setIgnoreNoncriticalErrors(boolean ignoreNoncriticalErrors) {
this.ignoreNoncriticalErrors = ignoreNoncriticalErrors;
}
- /** Checks to see that all required parameters are set. */
+ /**
+ * Checks to see that all required parameters are set.
+ *
+ * @throws BuildException if the configuration is not valid.
+ */
protected void checkConfiguration() throws BuildException {
if (server == null) {
throw new BuildException("server attribute must be set!");
@@ -490,6 +553,14 @@
/**
* For each file in the fileset, do the appropriate action: send, get,
* delete, or list.
+ *
+ * @param ftp the FTPClient instance used to perform FTP actions
+ * @param fs the fileset on which the actions are performed.
+ *
+ * @return the number of files to be transferred.
+ *
+ * @throws IOException if there is a problem reading a file
+ * @throws BuildException if there is a problem in the configuration.
*/
protected int transferFiles(FTPClient ftp, FileSet fs)
throws IOException, BuildException {
@@ -537,48 +608,28 @@
for (int i = 0; i < dsfiles.length; i++) {
switch (action) {
case SEND_FILES:
- {
sendFile(ftp, dir, dsfiles[i]);
break;
- }
-
case GET_FILES:
- {
getFile(ftp, dir, dsfiles[i]);
break;
- }
-
case DEL_FILES:
- {
delFile(ftp, dsfiles[i]);
break;
- }
-
case LIST_FILES:
- {
listFile(ftp, bw, dsfiles[i]);
break;
- }
-
case CHMOD:
- {
doSiteCommand(ftp, "chmod " + chmod + " " +
dsfiles[i]);
transferred++;
break;
- }
-
case RM_DIR:
- {
rmDir(ftp, dsfiles[i]);
break;
- }
-
default:
- {
throw new BuildException("unknown ftp action " +
action);
}
}
- }
} finally {
if (bw != null) {
bw.close();
@@ -592,6 +643,11 @@
/**
* Sends all files specified by the configured filesets to the remote
* server.
+ *
+ * @param ftp the FTPClient instance used to perform FTP actions
+ *
+ * @throws IOException if there is a problem reading a file
+ * @throws BuildException if there is a problem in the configuration.
*/
protected void transferFiles(FTPClient ftp)
throws IOException, BuildException {
@@ -611,12 +667,11 @@
}
}
- log(transferred + " " + ACTION_TARGET_STRS[action] + " " +
- COMPLETED_ACTION_STRS[action]);
- if (skipped != 0) {
- log(skipped + " " + ACTION_TARGET_STRS[action] +
- " were not successfully "
+ log(transferred + " " + ACTION_TARGET_STRS[action] + " "
+ COMPLETED_ACTION_STRS[action]);
+ if (skipped != 0) {
+ log(skipped + " " + ACTION_TARGET_STRS[action]
+ + " were not successfully " + COMPLETED_ACTION_STRS[action]);
}
}
@@ -627,6 +682,10 @@
* Unix-style paths with forward-slash separators. This can be overridden
* with the <code>separator</code> task parameter. No attempt is made to
* determine what syntax is appropriate for the remote host.
+ *
+ * @param file the remote file name to be resolved
+ *
+ * @return the filename as it will appear on the server.
*/
protected String resolveFile(String file) {
return file.replace(System.getProperty("file.separator").charAt(0),
@@ -638,6 +697,11 @@
* Creates all parent directories specified in a complete relative
* pathname. Attempts to create existing directories will not cause
* errors.
+ *
+ * @param ftp the FTP client instance to use to execute FTP actions on
+ * the remote server.
+ * @param filename the name of the file whose parents should be created.
+ *
*/
protected void createParents(FTPClient ftp, String filename)
throws IOException, BuildException {
@@ -717,8 +781,8 @@
+ "assuming out of date.", Project.MSG_VERBOSE);
return false;
} else {
- throw new BuildException("could not date test remote file: "
+
- ftp.getReplyString());
+ throw new BuildException("could not date test remote file: "
+ + ftp.getReplyString());
}
}
@@ -734,24 +798,24 @@
/** Sends a site command to the ftp server */
- protected void doSiteCommand(FTPClient ftp, String TheCMD)
+ protected void doSiteCommand(FTPClient ftp, String theCMD)
throws IOException, BuildException {
boolean rc;
- String MyReply[] = null;
+ String myReply[] = null;
- log("Doing Site Command: " + TheCMD, Project.MSG_VERBOSE);
+ log("Doing Site Command: " + theCMD, Project.MSG_VERBOSE);
- rc = ftp.sendSiteCommand(TheCMD);
+ rc = ftp.sendSiteCommand(theCMD);
if (rc == false) {
- log("Failed to issue Site Command: " + TheCMD, Project.MSG_WARN);
+ log("Failed to issue Site Command: " + theCMD, Project.MSG_WARN);
} else {
- MyReply = ftp.getReplyStrings();
+ myReply = ftp.getReplyStrings();
- for (int x = 0; x < MyReply.length; x++) {
- if (MyReply[x].indexOf("200") == -1) {
- log(MyReply[x], Project.MSG_WARN);
+ for (int x = 0; x < myReply.length; x++) {
+ if (myReply[x].indexOf("200") == -1) {
+ log(myReply[x], Project.MSG_WARN);
}
}
}
@@ -794,7 +858,7 @@
if (!success) {
String s = "could not put file: " + ftp.getReplyString();
- if (skipFailedTransfers == true) {
+ if (skipFailedTransfers) {
log(s, Project.MSG_WARN);
skipped++;
} else {
@@ -802,7 +866,8 @@
}
} else {
- if (chmod != null) {// see if we should issue a chmod command
+ // see if we should issue a chmod command
+ if (chmod != null) {
doSiteCommand(ftp, "chmod " + chmod + " " + filename);
}
log("File " + file.getAbsolutePath() + " copied to " +
server,
@@ -831,7 +896,7 @@
if (!ftp.deleteFile(resolveFile(filename))) {
String s = "could not delete file: " + ftp.getReplyString();
- if (skipFailedTransfers == true) {
+ if (skipFailedTransfers) {
log(s, Project.MSG_WARN);
skipped++;
} else {
@@ -854,7 +919,7 @@
if (!ftp.removeDirectory(resolveFile(dirname))) {
String s = "could not remove directory: " + ftp.getReplyString();
- if (skipFailedTransfers == true) {
+ if (skipFailedTransfers) {
log(s, Project.MSG_WARN);
skipped++;
} else {
@@ -904,7 +969,7 @@
if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
String s = "could not get file: " + ftp.getReplyString();
- if (skipFailedTransfers == true) {
+ if (skipFailedTransfers) {
log(s, Project.MSG_WARN);
skipped++;
} else {
@@ -989,8 +1054,10 @@
// to indicate that an attempt to create a directory has
// failed because the directory already exists.
int rc = ftp.getReplyCode();
- if (!(ignoreNoncriticalErrors && (rc == 550 || rc == 553
|| rc==521))) {
- throw new BuildException("could not create
directory: " + ftp.getReplyString());
+ if (!(ignoreNoncriticalErrors
+ && (rc == 550 || rc == 553 || rc == 521))) {
+ throw new BuildException("could not create
directory: "
+ + ftp.getReplyString());
}
if (verbose) {
log("Directory already exists");
@@ -1019,14 +1086,18 @@
int rc=ftp.getReplyCode();
if (!(ignoreNoncriticalErrors
&& (rc == 550 || rc == 553 || rc == 521))) {
- throw new BuildException("could not create directory: " +
- ftp.getReplyString());
+ throw new BuildException("could not create directory: "
+ + ftp.getReplyString());
}
}
- /** Runs the task. */
- public void execute()
- throws BuildException {
+ /**
+ * Runs the task.
+ *
+ * @throws BuildException if the task fails or is not configured
+ * correctly.
+ */
+ public void execute() throws BuildException {
checkConfiguration();
FTPClient ftp = null;
@@ -1054,8 +1125,8 @@
if (binary) {
ftp.setFileType(org.apache.commons.net.ftp.FTP.IMAGE_FILE_TYPE);
if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
- throw new BuildException("could not set transfer type: "
+
- ftp.getReplyString());
+ throw new BuildException("could not set transfer type: "
+ + ftp.getReplyString());
}
}
@@ -1064,8 +1135,7 @@
ftp.enterLocalPassiveMode();
if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
throw new BuildException("could not enter into passive "
- + "mode: " +
- ftp.getReplyString());
+ + "mode: " + ftp.getReplyString());
}
}
@@ -1087,8 +1157,7 @@
ftp.changeWorkingDirectory(remotedir);
if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
throw new BuildException("could not change remote "
- + "directory: " +
- ftp.getReplyString());
+ + "directory: " + ftp.getReplyString());
}
}
log(ACTION_STRS[action] + " " + ACTION_TARGET_STRS[action]);
@@ -1118,28 +1187,35 @@
*/
public static class Action extends EnumeratedAttribute {
- private static final String[] validActions = {
+ private static final String[] VALID_ACTIONS = {
"send", "put", "recv", "get", "del", "delete", "list", "mkdir",
"chmod", "rmdir"
};
+ /**
+ * Get the valid values
+ *
+ * @return an array of the valid FTP actions.
+ */
public String[] getValues() {
- return validActions;
+ return VALID_ACTIONS;
}
+ /**
+ * Get the symbolic equivalent of the action value.
+ *
+ * @return the SYMBOL representing the given action.
+ */
public int getAction() {
String actionL = getValue().toLowerCase(Locale.US);
- if (actionL.equals("send") ||
- actionL.equals("put")) {
+ if (actionL.equals("send") || actionL.equals("put")) {
return SEND_FILES;
- } else if (actionL.equals("recv") ||
- actionL.equals("get")) {
+ } else if (actionL.equals("recv") || actionL.equals("get")) {
return GET_FILES;
- } else if (actionL.equals("del") ||
- actionL.equals("delete")) {
+ } else if (actionL.equals("del") || actionL.equals("delete")) {
return DEL_FILES;
} else if (actionL.equals("list")) {
return LIST_FILES;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]