Enforce naming guidelines git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270638 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -54,22 +54,21 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.ccm; | package org.apache.tools.ant.taskdefs.optional.ccm; | ||||
| import java.io.File; | |||||
| import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import java.io.File; | |||||
| /** | /** | ||||
| * Class common to all check commands (checkout, checkin,checkin default task); | * Class common to all check commands (checkout, checkin,checkin default task); | ||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | * @author Benoit Moussaud benoit.moussaud@criltelecom.com | ||||
| */ | */ | ||||
| public class CCMCheck extends Continuus { | public class CCMCheck extends Continuus { | ||||
| private File _file = null; | |||||
| private String _comment = null; | |||||
| private String _task = null; | |||||
| private File file = null; | |||||
| private String comment = null; | |||||
| private String task = null; | |||||
| public CCMCheck() { | public CCMCheck() { | ||||
| super(); | super(); | ||||
| @@ -80,51 +79,51 @@ public class CCMCheck extends Continuus { | |||||
| * @return value of file. | * @return value of file. | ||||
| */ | */ | ||||
| public File getFile() { | public File getFile() { | ||||
| return _file; | |||||
| return file; | |||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of file. | * Set the value of file. | ||||
| * @param v Value to assign to file. | * @param v Value to assign to file. | ||||
| */ | */ | ||||
| public void setFile(File v) { | |||||
| this._file = v; | |||||
| public void setFile(File v) { | |||||
| this.file = v; | |||||
| } | } | ||||
| /** | /** | ||||
| * Get the value of comment. | * Get the value of comment. | ||||
| * @return value of comment. | * @return value of comment. | ||||
| */ | */ | ||||
| public String getComment() { | public String getComment() { | ||||
| return _comment; | |||||
| return comment; | |||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of comment. | * Set the value of comment. | ||||
| * @param v Value to assign to comment. | * @param v Value to assign to comment. | ||||
| */ | */ | ||||
| public void setComment(String v) { | |||||
| this._comment = v; | |||||
| public void setComment(String v) { | |||||
| this.comment = v; | |||||
| } | } | ||||
| /** | /** | ||||
| * Get the value of task. | * Get the value of task. | ||||
| * @return value of task. | * @return value of task. | ||||
| */ | */ | ||||
| public String getTask() { | public String getTask() { | ||||
| return _task; | |||||
| return task; | |||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of task. | * Set the value of task. | ||||
| * @param v Value to assign to task. | * @param v Value to assign to task. | ||||
| */ | */ | ||||
| public void setTask(String v) { | |||||
| this._task = v; | |||||
| public void setTask(String v) { | |||||
| this.task = v; | |||||
| } | } | ||||
| /** | /** | ||||
| * Executes the task. | * Executes the task. | ||||
| * <p> | * <p> | ||||
| @@ -142,11 +141,11 @@ public class CCMCheck extends Continuus { | |||||
| // as specified in the CLEARTOOL.EXE help | // as specified in the CLEARTOOL.EXE help | ||||
| commandLine.setExecutable(getCcmCommand()); | commandLine.setExecutable(getCcmCommand()); | ||||
| commandLine.createArgument().setValue(getCcmAction()); | commandLine.createArgument().setValue(getCcmAction()); | ||||
| checkOptions(commandLine); | checkOptions(commandLine); | ||||
| result = run(commandLine); | result = run(commandLine); | ||||
| if ( result != 0 ) { | |||||
| if (result != 0) { | |||||
| String msg = "Failed executing: " + commandLine.toString(); | String msg = "Failed executing: " + commandLine.toString(); | ||||
| throw new BuildException(msg, location); | throw new BuildException(msg, location); | ||||
| } | } | ||||
| @@ -156,30 +155,30 @@ public class CCMCheck extends Continuus { | |||||
| /** | /** | ||||
| * Check the command line options. | * Check the command line options. | ||||
| */ | */ | ||||
| private void checkOptions(Commandline cmd) { | |||||
| private void checkOptions(Commandline cmd) { | |||||
| if (getComment() != null) { | if (getComment() != null) { | ||||
| cmd.createArgument().setValue(FLAG_COMMENT); | cmd.createArgument().setValue(FLAG_COMMENT); | ||||
| cmd.createArgument().setValue(getComment()); | cmd.createArgument().setValue(getComment()); | ||||
| } | } | ||||
| if ( getTask() != null) { | |||||
| if (getTask() != null) { | |||||
| cmd.createArgument().setValue(FLAG_TASK); | cmd.createArgument().setValue(FLAG_TASK); | ||||
| cmd.createArgument().setValue(getTask()); | |||||
| } // end of if () | |||||
| if ( getFile() != null ) { | |||||
| cmd.createArgument().setValue(_file.getAbsolutePath()); | |||||
| } // end of if () | |||||
| cmd.createArgument().setValue(getTask()); | |||||
| } // end of if () | |||||
| if (getFile() != null) { | |||||
| cmd.createArgument().setValue(file.getAbsolutePath()); | |||||
| } // end of if () | |||||
| } | } | ||||
| /** | /** | ||||
| * -comment flag -- comment to attach to the file | * -comment flag -- comment to attach to the file | ||||
| */ | */ | ||||
| public final static String FLAG_COMMENT = "/comment"; | public final static String FLAG_COMMENT = "/comment"; | ||||
| /** | /** | ||||
| * -task flag -- associate checckout task with task | * -task flag -- associate checckout task with task | ||||
| */ | */ | ||||
| public final static String FLAG_TASK = "/task"; | |||||
| public final static String FLAG_TASK = "/task"; | |||||
| } | } | ||||
| @@ -61,11 +61,11 @@ import java.util.Date; | |||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | * @author Benoit Moussaud benoit.moussaud@criltelecom.com | ||||
| */ | */ | ||||
| public class CCMCheckin extends CCMCheck { | public class CCMCheckin extends CCMCheck { | ||||
| public CCMCheckin() { | public CCMCheckin() { | ||||
| super(); | super(); | ||||
| setCcmAction(COMMAND_CHECKIN); | setCcmAction(COMMAND_CHECKIN); | ||||
| setComment("Checkin "+ new Date()); | |||||
| setComment("Checkin " + new Date()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -59,13 +59,13 @@ package org.apache.tools.ant.taskdefs.optional.ccm; | |||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | * @author Benoit Moussaud benoit.moussaud@criltelecom.com | ||||
| */ | */ | ||||
| public class CCMCheckinDefault extends CCMCheck { | public class CCMCheckinDefault extends CCMCheck { | ||||
| public CCMCheckinDefault(){ | |||||
| public CCMCheckinDefault() { | |||||
| super(); | super(); | ||||
| setCcmAction(COMMAND_CHECKIN); | setCcmAction(COMMAND_CHECKIN); | ||||
| setTask(DEFAULT_TASK); | setTask(DEFAULT_TASK); | ||||
| } | } | ||||
| public final static String DEFAULT_TASK = "default"; | |||||
| public final static String DEFAULT_TASK = "default"; | |||||
| } | } | ||||
| @@ -59,8 +59,8 @@ package org.apache.tools.ant.taskdefs.optional.ccm; | |||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | * @author Benoit Moussaud benoit.moussaud@criltelecom.com | ||||
| */ | */ | ||||
| public class CCMCheckout extends CCMCheck { | public class CCMCheckout extends CCMCheck { | ||||
| public CCMCheckout(){ | |||||
| public CCMCheckout() { | |||||
| super(); | super(); | ||||
| setCcmAction(COMMAND_CHECKOUT); | setCcmAction(COMMAND_CHECKOUT); | ||||
| } | } | ||||
| @@ -56,7 +56,6 @@ package org.apache.tools.ant.taskdefs.optional.ccm; | |||||
| import java.io.BufferedReader; | import java.io.BufferedReader; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.io.InputStreamReader; | import java.io.InputStreamReader; | ||||
| @@ -72,21 +71,21 @@ import org.apache.tools.ant.types.Commandline; | |||||
| * Task allows to create new ccm task and set it as the default | * Task allows to create new ccm task and set it as the default | ||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | * @author Benoit Moussaud benoit.moussaud@criltelecom.com | ||||
| */ | */ | ||||
| public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| private String comment = null; | |||||
| private String platform = null; | |||||
| private String resolver = null; | |||||
| private String release = null; | |||||
| private String comment = null; | |||||
| private String platform = null; | |||||
| private String resolver = null; | |||||
| private String release = null; | |||||
| private String subSystem = null; | private String subSystem = null; | ||||
| private String task = null; | |||||
| private String task = null; | |||||
| public CCMCreateTask() { | public CCMCreateTask() { | ||||
| super(); | super(); | ||||
| setCcmAction(COMMAND_CREATE_TASK); | setCcmAction(COMMAND_CREATE_TASK); | ||||
| } | } | ||||
| /** | /** | ||||
| * Executes the task. | * Executes the task. | ||||
| * <p> | * <p> | ||||
| @@ -99,15 +98,15 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| Project aProj = getProject(); | Project aProj = getProject(); | ||||
| int result = 0; | int result = 0; | ||||
| // build the command line from what we got the format | |||||
| // build the command line from what we got the format | |||||
| // as specified in the CCM.EXE help | // as specified in the CCM.EXE help | ||||
| commandLine.setExecutable(getCcmCommand()); | commandLine.setExecutable(getCcmCommand()); | ||||
| commandLine.createArgument().setValue(getCcmAction()); | commandLine.createArgument().setValue(getCcmAction()); | ||||
| checkOptions(commandLine); | checkOptions(commandLine); | ||||
| result = run(commandLine,this); | |||||
| if ( result != 0 ) { | |||||
| result = run(commandLine, this); | |||||
| if (result != 0) { | |||||
| String msg = "Failed executing: " + commandLine.toString(); | String msg = "Failed executing: " + commandLine.toString(); | ||||
| throw new BuildException(msg, location); | throw new BuildException(msg, location); | ||||
| } | } | ||||
| @@ -118,10 +117,10 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| commandLine2.createArgument().setValue(COMMAND_DEFAULT_TASK); | commandLine2.createArgument().setValue(COMMAND_DEFAULT_TASK); | ||||
| commandLine2.createArgument().setValue(getTask()); | commandLine2.createArgument().setValue(getTask()); | ||||
| log(commandLine.toString(),Project.MSG_DEBUG); | |||||
| log(commandLine.toString(), Project.MSG_DEBUG); | |||||
| result = run(commandLine2); | result = run(commandLine2); | ||||
| if ( result != 0 ) { | |||||
| if (result != 0) { | |||||
| String msg = "Failed executing: " + commandLine2.toString(); | String msg = "Failed executing: " + commandLine2.toString(); | ||||
| throw new BuildException(msg, location); | throw new BuildException(msg, location); | ||||
| } | } | ||||
| @@ -132,34 +131,34 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| /** | /** | ||||
| * Check the command line options. | * Check the command line options. | ||||
| */ | */ | ||||
| private void checkOptions(Commandline cmd) { | |||||
| private void checkOptions(Commandline cmd) { | |||||
| if (getComment() != null) { | if (getComment() != null) { | ||||
| cmd.createArgument().setValue(FLAG_COMMENT); | cmd.createArgument().setValue(FLAG_COMMENT); | ||||
| cmd.createArgument().setValue("\""+getComment()+"\""); | |||||
| cmd.createArgument().setValue("\"" + getComment() + "\""); | |||||
| } | } | ||||
| if ( getPlatform() != null) { | |||||
| if (getPlatform() != null) { | |||||
| cmd.createArgument().setValue(FLAG_PLATFORM); | cmd.createArgument().setValue(FLAG_PLATFORM); | ||||
| cmd.createArgument().setValue(getPlatform()); | |||||
| } // end of if () | |||||
| cmd.createArgument().setValue(getPlatform()); | |||||
| } // end of if () | |||||
| if ( getResolver() != null) { | |||||
| if (getResolver() != null) { | |||||
| cmd.createArgument().setValue(FLAG_RESOLVER); | cmd.createArgument().setValue(FLAG_RESOLVER); | ||||
| cmd.createArgument().setValue(getResolver()); | |||||
| cmd.createArgument().setValue(getResolver()); | |||||
| } // end of if () | } // end of if () | ||||
| if ( getSubSystem() != null) { | |||||
| if (getSubSystem() != null) { | |||||
| cmd.createArgument().setValue(FLAG_SUBSYSTEM); | cmd.createArgument().setValue(FLAG_SUBSYSTEM); | ||||
| cmd.createArgument().setValue("\""+getSubSystem()+"\""); | |||||
| } // end of if () | |||||
| if ( getRelease() != null ) { | |||||
| cmd.createArgument().setValue("\"" + getSubSystem() + "\""); | |||||
| } // end of if () | |||||
| if (getRelease() != null) { | |||||
| cmd.createArgument().setValue(FLAG_RELEASE); | cmd.createArgument().setValue(FLAG_RELEASE); | ||||
| cmd.createArgument().setValue(getRelease()); | |||||
| } // end of if () | |||||
| cmd.createArgument().setValue(getRelease()); | |||||
| } // end of if () | |||||
| } | } | ||||
| /** | /** | ||||
| * Get the value of comment. | * Get the value of comment. | ||||
| * @return value of comment. | * @return value of comment. | ||||
| @@ -167,16 +166,16 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| public String getComment() { | public String getComment() { | ||||
| return comment; | return comment; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of comment. | * Set the value of comment. | ||||
| * @param v Value to assign to comment. | * @param v Value to assign to comment. | ||||
| */ | */ | ||||
| public void setComment(String v) { | |||||
| public void setComment(String v) { | |||||
| this.comment = v; | this.comment = v; | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the value of platform. | * Get the value of platform. | ||||
| * @return value of platform. | * @return value of platform. | ||||
| @@ -184,16 +183,16 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| public String getPlatform() { | public String getPlatform() { | ||||
| return platform; | return platform; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of platform. | * Set the value of platform. | ||||
| * @param v Value to assign to platform. | * @param v Value to assign to platform. | ||||
| */ | */ | ||||
| public void setPlatform(String v) { | |||||
| public void setPlatform(String v) { | |||||
| this.platform = v; | this.platform = v; | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the value of resolver. | * Get the value of resolver. | ||||
| * @return value of resolver. | * @return value of resolver. | ||||
| @@ -201,16 +200,16 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| public String getResolver() { | public String getResolver() { | ||||
| return resolver; | return resolver; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of resolver. | * Set the value of resolver. | ||||
| * @param v Value to assign to resolver. | * @param v Value to assign to resolver. | ||||
| */ | */ | ||||
| public void setResolver(String v) { | |||||
| public void setResolver(String v) { | |||||
| this.resolver = v; | this.resolver = v; | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the value of release. | * Get the value of release. | ||||
| * @return value of release. | * @return value of release. | ||||
| @@ -218,15 +217,15 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| public String getRelease() { | public String getRelease() { | ||||
| return release; | return release; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of release. | * Set the value of release. | ||||
| * @param v Value to assign to release. | * @param v Value to assign to release. | ||||
| */ | */ | ||||
| public void setRelease(String v) { | |||||
| public void setRelease(String v) { | |||||
| this.release = v; | this.release = v; | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the value of subSystem. | * Get the value of subSystem. | ||||
| * @return value of subSystem. | * @return value of subSystem. | ||||
| @@ -234,76 +233,76 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| public String getSubSystem() { | public String getSubSystem() { | ||||
| return subSystem; | return subSystem; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of subSystem. | * Set the value of subSystem. | ||||
| * @param v Value to assign to subSystem. | * @param v Value to assign to subSystem. | ||||
| */ | */ | ||||
| public void setSubSystem(String v) { | |||||
| public void setSubSystem(String v) { | |||||
| this.subSystem = v; | this.subSystem = v; | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the value of task. | * Get the value of task. | ||||
| * @return value of task. | * @return value of task. | ||||
| */ | */ | ||||
| public String getTask() { | |||||
| public String getTask() { | |||||
| return task; | return task; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of task. | * Set the value of task. | ||||
| * @param v Value to assign to task. | * @param v Value to assign to task. | ||||
| */ | */ | ||||
| public void setTask(String v) { | |||||
| public void setTask(String v) { | |||||
| this.task = v; | this.task = v; | ||||
| } | } | ||||
| /** | /** | ||||
| * /comment -- comments associated to the task | * /comment -- comments associated to the task | ||||
| */ | */ | ||||
| public final static String FLAG_COMMENT = "/synopsis"; | public final static String FLAG_COMMENT = "/synopsis"; | ||||
| /** | /** | ||||
| * /platform flag -- target platform | * /platform flag -- target platform | ||||
| */ | */ | ||||
| public final static String FLAG_PLATFORM = "/plat"; | |||||
| public final static String FLAG_PLATFORM = "/plat"; | |||||
| /** | /** | ||||
| * /resolver flag | * /resolver flag | ||||
| */ | */ | ||||
| public final static String FLAG_RESOLVER = "/resolver"; | |||||
| public final static String FLAG_RESOLVER = "/resolver"; | |||||
| /** | /** | ||||
| * /release flag | * /release flag | ||||
| */ | */ | ||||
| public final static String FLAG_RELEASE = "/release"; | |||||
| public final static String FLAG_RELEASE = "/release"; | |||||
| /** | /** | ||||
| * /release flag | * /release flag | ||||
| */ | */ | ||||
| public final static String FLAG_SUBSYSTEM = "/subsystem"; | |||||
| public final static String FLAG_SUBSYSTEM = "/subsystem"; | |||||
| /** | /** | ||||
| * -task flag -- associate checckout task with task | * -task flag -- associate checckout task with task | ||||
| */ | */ | ||||
| public final static String FLAG_TASK = "/task"; | |||||
| public final static String FLAG_TASK = "/task"; | |||||
| // implementation of org.apache.tools.ant.taskdefs.ExecuteStreamHandler interface | // implementation of org.apache.tools.ant.taskdefs.ExecuteStreamHandler interface | ||||
| /** | /** | ||||
| * | * | ||||
| * @exception java.io.IOException | * @exception java.io.IOException | ||||
| */ | */ | ||||
| public void start() throws IOException { | |||||
| public void start() throws IOException { | |||||
| } | } | ||||
| /** | /** | ||||
| * | * | ||||
| */ | */ | ||||
| public void stop(){ | |||||
| public void stop() { | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -311,7 +310,7 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| * @param param1 | * @param param1 | ||||
| * @exception java.io.IOException | * @exception java.io.IOException | ||||
| */ | */ | ||||
| public void setProcessInputStream(OutputStream param1) throws IOException { | |||||
| public void setProcessInputStream(OutputStream param1) throws IOException { | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -319,48 +318,42 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { | |||||
| * @param param1 | * @param param1 | ||||
| * @exception java.io.IOException | * @exception java.io.IOException | ||||
| */ | */ | ||||
| public void setProcessErrorStream(InputStream is) throws IOException { | |||||
| public void setProcessErrorStream(InputStream is) throws IOException { | |||||
| BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | ||||
| String s = reader.readLine(); | String s = reader.readLine(); | ||||
| if ( s != null) | |||||
| { | |||||
| log("err "+s,Project.MSG_DEBUG); | |||||
| } // end of if () | |||||
| if (s != null) { | |||||
| log("err " + s, Project.MSG_DEBUG); | |||||
| } // end of if () | |||||
| } | } | ||||
| /** | /** | ||||
| * read the output stream to retrieve the new task number. | * read the output stream to retrieve the new task number. | ||||
| * @param is InputStream | * @param is InputStream | ||||
| * @exception java.io.IOException | |||||
| * @exception java.io.IOException | |||||
| */ | */ | ||||
| public void setProcessOutputStream(InputStream is) throws IOException { | |||||
| public void setProcessOutputStream(InputStream is) throws IOException { | |||||
| String buffer = ""; | String buffer = ""; | ||||
| try | |||||
| { | |||||
| try { | |||||
| BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | ||||
| buffer = reader.readLine(); | buffer = reader.readLine(); | ||||
| if ( buffer != null) | |||||
| { | |||||
| log("buffer:" +buffer,Project.MSG_DEBUG); | |||||
| String taskstring = buffer.substring(buffer.indexOf(' ')).trim(); | |||||
| taskstring = taskstring.substring(0,taskstring.lastIndexOf(' ')).trim(); | |||||
| if (buffer != null) { | |||||
| log("buffer:" + buffer, Project.MSG_DEBUG); | |||||
| String taskstring = buffer.substring(buffer.indexOf(' ')).trim(); | |||||
| taskstring = taskstring.substring(0, taskstring.lastIndexOf(' ')).trim(); | |||||
| setTask(taskstring); | setTask(taskstring); | ||||
| log("task is "+getTask(),Project.MSG_DEBUG); | |||||
| } // end of if () | |||||
| } | |||||
| catch ( NullPointerException npe) | |||||
| { | |||||
| log("error procession stream , null pointer exception",Project.MSG_ERR); | |||||
| log("task is " + getTask(), Project.MSG_DEBUG); | |||||
| } // end of if () | |||||
| } catch (NullPointerException npe) { | |||||
| log("error procession stream , null pointer exception", Project.MSG_ERR); | |||||
| npe.printStackTrace(); | npe.printStackTrace(); | ||||
| throw new BuildException(npe.getClass().getName()); | throw new BuildException(npe.getClass().getName()); | ||||
| } // end of catch | |||||
| catch (Exception e) | |||||
| { | |||||
| log("error procession stream "+e.getMessage(),Project.MSG_ERR); | |||||
| } // end of catch | |||||
| catch (Exception e) { | |||||
| log("error procession stream " + e.getMessage(), Project.MSG_ERR); | |||||
| throw new BuildException(e.getMessage()); | throw new BuildException(e.getMessage()); | ||||
| } // end of try-catch | } // end of try-catch | ||||
| } | } | ||||
| } | } | ||||
| @@ -55,24 +55,18 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.ccm; | package org.apache.tools.ant.taskdefs.optional.ccm; | ||||
| import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| * Task allows to reconfigure a project, recurcively or not | |||||
| * Task allows to reconfigure a project, recurcively or not | |||||
| * @author Benoit Moussaud benoit.moussaud@criltelecom.com | * @author Benoit Moussaud benoit.moussaud@criltelecom.com | ||||
| */ | */ | ||||
| public class CCMReconfigure extends Continuus { | public class CCMReconfigure extends Continuus { | ||||
| private String project = null; | |||||
| private String project = null; | |||||
| private boolean recurse = false; | private boolean recurse = false; | ||||
| private boolean verbose = false; | private boolean verbose = false; | ||||
| @@ -81,7 +75,7 @@ public class CCMReconfigure extends Continuus { | |||||
| setCcmAction(COMMAND_RECONFIGURE); | setCcmAction(COMMAND_RECONFIGURE); | ||||
| } | } | ||||
| /** | /** | ||||
| * Executes the task. | * Executes the task. | ||||
| * <p> | * <p> | ||||
| @@ -94,15 +88,15 @@ public class CCMReconfigure extends Continuus { | |||||
| Project aProj = getProject(); | Project aProj = getProject(); | ||||
| int result = 0; | int result = 0; | ||||
| // build the command line from what we got the format | |||||
| // build the command line from what we got the format | |||||
| // as specified in the CCM.EXE help | // as specified in the CCM.EXE help | ||||
| commandLine.setExecutable(getCcmCommand()); | commandLine.setExecutable(getCcmCommand()); | ||||
| commandLine.createArgument().setValue(getCcmAction()); | commandLine.createArgument().setValue(getCcmAction()); | ||||
| checkOptions(commandLine); | checkOptions(commandLine); | ||||
| result = run(commandLine); | result = run(commandLine); | ||||
| if ( result != 0 ) { | |||||
| if (result != 0) { | |||||
| String msg = "Failed executing: " + commandLine.toString(); | String msg = "Failed executing: " + commandLine.toString(); | ||||
| throw new BuildException(msg, location); | throw new BuildException(msg, location); | ||||
| } | } | ||||
| @@ -112,92 +106,89 @@ public class CCMReconfigure extends Continuus { | |||||
| /** | /** | ||||
| * Check the command line options. | * Check the command line options. | ||||
| */ | */ | ||||
| private void checkOptions(Commandline cmd) { | |||||
| private void checkOptions(Commandline cmd) { | |||||
| if ( isRecurse() == true) { | |||||
| if (isRecurse() == true) { | |||||
| cmd.createArgument().setValue(FLAG_RECURSE); | cmd.createArgument().setValue(FLAG_RECURSE); | ||||
| } // end of if () | |||||
| } // end of if () | |||||
| if ( isVerbose() == true) { | |||||
| if (isVerbose() == true) { | |||||
| cmd.createArgument().setValue(FLAG_VERBOSE); | cmd.createArgument().setValue(FLAG_VERBOSE); | ||||
| } // end of if () | |||||
| } // end of if () | |||||
| if (getCcmProject() != null) { | if (getCcmProject() != null) { | ||||
| cmd.createArgument().setValue(FLAG_PROJECT); | cmd.createArgument().setValue(FLAG_PROJECT); | ||||
| cmd.createArgument().setValue(getCcmProject()); | cmd.createArgument().setValue(getCcmProject()); | ||||
| } | } | ||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * Get the value of project. | * Get the value of project. | ||||
| * @return value of project. | * @return value of project. | ||||
| */ | */ | ||||
| public String getCcmProject() { | |||||
| public String getCcmProject() { | |||||
| return project; | return project; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of project. | * Set the value of project. | ||||
| * @param v Value to assign to project. | * @param v Value to assign to project. | ||||
| */ | */ | ||||
| public void setCcmProject(String v) { | |||||
| public void setCcmProject(String v) { | |||||
| this.project = v; | this.project = v; | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the value of recurse. | * Get the value of recurse. | ||||
| * @return value of recurse. | * @return value of recurse. | ||||
| */ | */ | ||||
| public boolean isRecurse() { | |||||
| public boolean isRecurse() { | |||||
| return recurse; | return recurse; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of recurse. | * Set the value of recurse. | ||||
| * @param v Value to assign to recurse. | * @param v Value to assign to recurse. | ||||
| */ | */ | ||||
| public void setRecurse(boolean v) { | |||||
| public void setRecurse(boolean v) { | |||||
| this.recurse = v; | this.recurse = v; | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the value of verbose. | * Get the value of verbose. | ||||
| * @return value of verbose. | * @return value of verbose. | ||||
| */ | */ | ||||
| public boolean isVerbose() | |||||
| { | |||||
| public boolean isVerbose() { | |||||
| return verbose; | return verbose; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of verbose. | * Set the value of verbose. | ||||
| * @param v Value to assign to verbose. | * @param v Value to assign to verbose. | ||||
| */ | */ | ||||
| public void setVerbose(boolean v) | |||||
| { | |||||
| public void setVerbose(boolean v) { | |||||
| this.verbose = v; | this.verbose = v; | ||||
| } | } | ||||
| /** | /** | ||||
| * /recurse -- | |||||
| * /recurse -- | |||||
| */ | */ | ||||
| public final static String FLAG_RECURSE = "/recurse"; | public final static String FLAG_RECURSE = "/recurse"; | ||||
| /** | /** | ||||
| * /recurse -- | |||||
| * /recurse -- | |||||
| */ | */ | ||||
| public final static String FLAG_VERBOSE = "/verbose"; | public final static String FLAG_VERBOSE = "/verbose"; | ||||
| /** | /** | ||||
| * /project flag -- target project | * /project flag -- target project | ||||
| */ | */ | ||||
| public final static String FLAG_PROJECT = "/project"; | |||||
| public final static String FLAG_PROJECT = "/project"; | |||||
| } | } | ||||
| @@ -54,22 +54,21 @@ | |||||
| package org.apache.tools.ant.taskdefs.optional.ccm; | package org.apache.tools.ant.taskdefs.optional.ccm; | ||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.taskdefs.Execute; | import org.apache.tools.ant.taskdefs.Execute; | ||||
| import org.apache.tools.ant.taskdefs.LogStreamHandler; | |||||
| import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; | import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; | ||||
| import org.apache.tools.ant.taskdefs.LogStreamHandler; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| * A base class for creating tasks for executing commands on Continuus 5.1 | * A base class for creating tasks for executing commands on Continuus 5.1 | ||||
| * <p> | * <p> | ||||
| * The class extends the task as it operates by executing the ccm.exe program | * The class extends the task as it operates by executing the ccm.exe program | ||||
| * supplied with Continuus/Synergy. By default the task expects the ccm executable to be | * supplied with Continuus/Synergy. By default the task expects the ccm executable to be | ||||
| * in the path, | |||||
| * in the path, | |||||
| * you can override this be specifying the ccmdir attribute. | * you can override this be specifying the ccmdir attribute. | ||||
| * </p> | * </p> | ||||
| * | * | ||||
| @@ -77,32 +76,32 @@ import org.apache.tools.ant.types.Commandline; | |||||
| */ | */ | ||||
| public abstract class Continuus extends Task { | public abstract class Continuus extends Task { | ||||
| private String _ccmDir = ""; | |||||
| private String _ccmAction = ""; | |||||
| private String ccmDir = ""; | |||||
| private String ccmAction = ""; | |||||
| /** | /** | ||||
| * Get the value of ccmAction. | * Get the value of ccmAction. | ||||
| * @return value of ccmAction. | * @return value of ccmAction. | ||||
| */ | */ | ||||
| public String getCcmAction() { | public String getCcmAction() { | ||||
| return _ccmAction; | |||||
| return ccmAction; | |||||
| } | } | ||||
| /** | /** | ||||
| * Set the value of ccmAction. | * Set the value of ccmAction. | ||||
| * @param v Value to assign to ccmAction. | * @param v Value to assign to ccmAction. | ||||
| */ | */ | ||||
| public void setCcmAction(String v) { | |||||
| this._ccmAction = v; | |||||
| public void setCcmAction(String v) { | |||||
| this.ccmAction = v; | |||||
| } | } | ||||
| /** | /** | ||||
| * Set the directory where the ccm executable is located | * Set the directory where the ccm executable is located | ||||
| * @param dir the directory containing the ccm executable | * @param dir the directory containing the ccm executable | ||||
| */ | */ | ||||
| public final void setCcmDir(String dir) { | public final void setCcmDir(String dir) { | ||||
| _ccmDir = project.translatePath(dir); | |||||
| ccmDir = project.translatePath(dir); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -110,8 +109,8 @@ public abstract class Continuus extends Task { | |||||
| * @return String containing path to the executable | * @return String containing path to the executable | ||||
| */ | */ | ||||
| protected final String getCcmCommand() { | protected final String getCcmCommand() { | ||||
| String toReturn = _ccmDir; | |||||
| if ( !toReturn.equals("") && !toReturn.endsWith("/") ) { | |||||
| String toReturn = ccmDir; | |||||
| if (!toReturn.equals("") && !toReturn.endsWith("/")) { | |||||
| toReturn += "/"; | toReturn += "/"; | ||||
| } | } | ||||
| @@ -122,20 +121,19 @@ public abstract class Continuus extends Task { | |||||
| protected int run(Commandline cmd, ExecuteStreamHandler handler) { | protected int run(Commandline cmd, ExecuteStreamHandler handler) { | ||||
| try { | |||||
| try { | |||||
| Execute exe = new Execute(handler); | Execute exe = new Execute(handler); | ||||
| exe.setAntRun(getProject()); | |||||
| exe.setAntRun(getProject()); | |||||
| exe.setWorkingDirectory(getProject().getBaseDir()); | exe.setWorkingDirectory(getProject().getBaseDir()); | ||||
| exe.setCommandline(cmd.getCommandline()); | exe.setCommandline(cmd.getCommandline()); | ||||
| return exe.execute(); | return exe.execute(); | ||||
| } | |||||
| catch (java.io.IOException e) { | |||||
| } catch (java.io.IOException e) { | |||||
| throw new BuildException(e, location); | throw new BuildException(e, location); | ||||
| } | } | ||||
| } | } | ||||
| protected int run(Commandline cmd) { | |||||
| return run(cmd,new LogStreamHandler(this, Project.MSG_VERBOSE, Project.MSG_WARN)); | |||||
| protected int run(Commandline cmd) { | |||||
| return run(cmd, new LogStreamHandler(this, Project.MSG_VERBOSE, Project.MSG_WARN)); | |||||
| } | } | ||||
| /** | /** | ||||