commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From patri...@apache.org
Subject cvs commit: jakarta-commons-sandbox/daemon/src/java/org/apache/commons/launcher/types ConditionalArgument.java
Date Fri, 19 Jul 2002 10:05:56 GMT
patrickl    2002/07/19 03:05:56

  Modified:    daemon/src/java/org/apache/commons/launcher LaunchTask.java
               daemon/src/java/org/apache/commons/launcher/types
                        ConditionalArgument.java
  Log:
  Add "line" attribute to <arg> and <jvmarg> elements. This attribute is in the
standard Ant <arg> and <jvmarg> elements but was missing in the Launcher's implementations.
  
  Revision  Changes    Path
  1.13      +10 -4     jakarta-commons-sandbox/daemon/src/java/org/apache/commons/launcher/LaunchTask.java
  
  Index: LaunchTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/java/org/apache/commons/launcher/LaunchTask.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- LaunchTask.java	19 Jul 2002 08:05:11 -0000	1.12
  +++ LaunchTask.java	19 Jul 2002 10:05:55 -0000	1.13
  @@ -368,8 +368,11 @@
               for (int i = 0; i < taskJVMArgs.size(); i++) {
                   ConditionalArgument value = (ConditionalArgument)taskJVMArgs.get(i);
                   // Test "if" and "unless" conditions
  -                if (testIfCondition(value.getIf()) && testUnlessCondition(value.getUnless()))
  -                    jvmArgs.add(value.getValue());
  +                if (testIfCondition(value.getIf()) && testUnlessCondition(value.getUnless()))
{
  +                    String[] list = value.getParts();
  +                    for (int j = 0; j < list.length; j++)
  +                        jvmArgs.add(list[j]);
  +                }
               }
   
               // Copy all of the nested sysproperty elements into the sysProps
  @@ -389,8 +392,11 @@
               for (int i = 0; i < taskArgs.size(); i++) {
                   ConditionalArgument value = (ConditionalArgument)taskArgs.get(i);
                   // Test "if" and "unless" conditions
  -                if (testIfCondition(value.getIf()) && testUnlessCondition(value.getUnless()))
  -                    appArgs.add(value.getValue());
  +                if (testIfCondition(value.getIf()) && testUnlessCondition(value.getUnless()))
{
  +                    String[] list = value.getParts();
  +                    for (int j = 0; j < list.length; j++)
  +                        appArgs.add(list[j]);
  +                }
               }
   
               // Add the Launcher's command line arguments to the appArgs object
  
  
  
  1.4       +31 -15    jakarta-commons-sandbox/daemon/src/java/org/apache/commons/launcher/types/ConditionalArgument.java
  
  Index: ConditionalArgument.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/java/org/apache/commons/launcher/types/ConditionalArgument.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ConditionalArgument.java	16 Jul 2002 06:42:28 -0000	1.3
  +++ ConditionalArgument.java	19 Jul 2002 10:05:56 -0000	1.4
  @@ -58,8 +58,10 @@
   package org.apache.commons.launcher.types;
   
   import java.io.File;
  +import org.apache.tools.ant.Project;
   import org.apache.tools.ant.ProjectHelper;
   import org.apache.tools.ant.Task;
  +import org.apache.tools.ant.types.Commandline;
   import org.apache.tools.ant.types.DataType;
   import org.apache.tools.ant.types.Path;
   
  @@ -86,9 +88,9 @@
       private String unlessCondition = null;
   
       /**
  -     * Cached command line argument.
  +     * Cached command line arguments.
        */
  -    private String value = null;
  +    private String[] parts = null;
   
       //----------------------------------------------------------------- Methods
   
  @@ -104,24 +106,27 @@
       }
   
       /**
  -     * Get the "unless" condition flag.
  +     * Get a single command line argument.
        *
  -     * @return the "unless" condition flag
  +     * @return a single command line argument
        */
  -    public String getUnless() {
  - 
  -        return ProjectHelper.replaceProperties(project, unlessCondition, project.getProperties());
  +    public String[] getParts() {
  +
  +        String[] list = new String[parts.length];
  +        for (int i = 0; i < parts.length; i++)
  +            list[i] = ProjectHelper.replaceProperties(project, parts[i], project.getProperties());
  +        return list;
   
       }
   
       /**
  -     * Get a single command line argument.
  +     * Get the "unless" condition flag.
        *
  -     * @return a single command line argument
  +     * @return the "unless" condition flag
        */
  -    public String getValue() {
  -
  -        return ProjectHelper.replaceProperties(project, value, project.getProperties());
  +    public String getUnless() {
  + 
  +        return ProjectHelper.replaceProperties(project, unlessCondition, project.getProperties());
   
       }
   
  @@ -133,7 +138,7 @@
        */
       public void setFile(File file) {
   
  -        this.value = file.getAbsolutePath();
  +        this.parts = new String[]{ file.getAbsolutePath() };
   
       }
   
  @@ -156,6 +161,17 @@
       }
   
       /**
  +     * Set a line to split into several command line arguments.
  +     *
  +     * @param line line to split into several commandline arguments
  +     */
  +    public void setLine(String line) {
  +
  +        parts = Commandline.translateCommandline(line);
  +
  +    }
  +
  +    /**
        * Set a single command line argument and treat it like a path. The
        * correct path separator for the platform is used.
        *
  @@ -163,7 +179,7 @@
        */
       public void setPath(Path path) {
   
  -        this.value = path.toString();
  +        this.parts = new String[]{ path.toString() };
   
       }
   
  @@ -192,7 +208,7 @@
        */
       public void setValue(String value) {
   
  -        this.value = value;
  +        this.parts = new String[]{ value };
   
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message