git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270321 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -23,6 +23,7 @@ import org.apache.tools.ant.types.CommandlineJava; | |||||
| import org.apache.tools.ant.types.EnvironmentData; | import org.apache.tools.ant.types.EnvironmentData; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
| import org.apache.tools.ant.types.EnvironmentVariable; | |||||
| /** | /** | ||||
| * This task acts as a loader for java applications but allows to use the same | * This task acts as a loader for java applications but allows to use the same | ||||
| @@ -166,7 +167,7 @@ public class Java extends Task | |||||
| * | * | ||||
| * @param sysp The feature to be added to the Sysproperty attribute | * @param sysp The feature to be added to the Sysproperty attribute | ||||
| */ | */ | ||||
| public void addSysproperty( EnvironmentData.Variable sysp ) | |||||
| public void addSysproperty( EnvironmentVariable sysp ) | |||||
| { | { | ||||
| cmdl.addSysproperty( sysp ); | cmdl.addSysproperty( sysp ); | ||||
| } | } | ||||
| @@ -21,6 +21,7 @@ import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.EnvironmentData; | import org.apache.tools.ant.types.EnvironmentData; | ||||
| import org.apache.tools.ant.types.EnvironmentVariable; | |||||
| /** | /** | ||||
| * Executes a given command if the os platform is appropriate. | * Executes a given command if the os platform is appropriate. | ||||
| @@ -175,7 +176,7 @@ public class ExecTask extends Task | |||||
| * | * | ||||
| * @param var The feature to be added to the Env attribute | * @param var The feature to be added to the Env attribute | ||||
| */ | */ | ||||
| public void addEnv( EnvironmentData.Variable var ) | |||||
| public void addEnv( EnvironmentVariable var ) | |||||
| { | { | ||||
| env.addVariable( var ); | env.addVariable( var ); | ||||
| } | } | ||||
| @@ -24,6 +24,7 @@ import org.apache.tools.ant.types.Commandline; | |||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| import org.apache.tools.ant.types.EnvironmentData; | import org.apache.tools.ant.types.EnvironmentData; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.EnvironmentVariable; | |||||
| /** | /** | ||||
| * Websphere deployment tool that augments the ejbjar task. | * Websphere deployment tool that augments the ejbjar task. | ||||
| @@ -966,7 +967,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| // Set the EnvironmentData variable | // Set the EnvironmentData variable | ||||
| EnvironmentData.Variable var = new EnvironmentData.Variable(); | |||||
| EnvironmentVariable var = new EnvironmentVariable(); | |||||
| var.setKey( "websphere.lib.dir" ); | var.setKey( "websphere.lib.dir" ); | ||||
| var.setValue( getTask().getProject().getProperty( "websphere.home" ) + "/lib" ); | var.setValue( getTask().getProject().getProperty( "websphere.home" ) + "/lib" ); | ||||
| javaTask.addSysproperty( var ); | javaTask.addSysproperty( var ); | ||||
| @@ -30,6 +30,7 @@ import org.apache.tools.ant.types.CommandlineJava; | |||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| import org.apache.tools.ant.types.EnvironmentData; | import org.apache.tools.ant.types.EnvironmentData; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.EnvironmentVariable; | |||||
| /** | /** | ||||
| * Ant task to run JUnit tests. <p> | * Ant task to run JUnit tests. <p> | ||||
| @@ -319,7 +320,7 @@ public class JUnitTask extends Task | |||||
| * | * | ||||
| * @param sysp The feature to be added to the Sysproperty attribute | * @param sysp The feature to be added to the Sysproperty attribute | ||||
| */ | */ | ||||
| public void addSysproperty( EnvironmentData.Variable sysp ) | |||||
| public void addSysproperty( EnvironmentVariable sysp ) | |||||
| { | { | ||||
| commandline.addSysproperty( sysp ); | commandline.addSysproperty( sysp ); | ||||
| } | } | ||||
| @@ -189,7 +189,7 @@ public class CommandlineJava implements Cloneable | |||||
| return vmVersion; | return vmVersion; | ||||
| } | } | ||||
| public void addSysproperty( EnvironmentData.Variable sysp ) | |||||
| public void addSysproperty( EnvironmentVariable sysp ) | |||||
| { | { | ||||
| sysProperties.addVariable( sysp ); | sysProperties.addVariable( sysp ); | ||||
| } | } | ||||
| @@ -341,7 +341,7 @@ public class CommandlineJava implements Cloneable | |||||
| for( Iterator e = m_variables.iterator(); e.hasNext(); ) | for( Iterator e = m_variables.iterator(); e.hasNext(); ) | ||||
| { | { | ||||
| EnvironmentData.Variable v = (EnvironmentData.Variable)e.next(); | |||||
| EnvironmentVariable v = (EnvironmentVariable)e.next(); | |||||
| p.put( v.getKey(), v.getValue() ); | p.put( v.getKey(), v.getValue() ); | ||||
| } | } | ||||
| System.setProperties( p ); | System.setProperties( p ); | ||||
| @@ -28,50 +28,15 @@ public class EnvironmentData | |||||
| final int size = m_variables.size(); | final int size = m_variables.size(); | ||||
| for( int i = 0; i < size; i++ ) | for( int i = 0; i < size; i++ ) | ||||
| { | { | ||||
| final Variable variable = (Variable)m_variables.get( i ); | |||||
| final EnvironmentVariable variable = (EnvironmentVariable)m_variables.get( i ); | |||||
| environment.setProperty( variable.getKey(), variable.getValue() ); | environment.setProperty( variable.getKey(), variable.getValue() ); | ||||
| } | } | ||||
| return environment; | return environment; | ||||
| } | } | ||||
| public void addVariable( Variable var ) | |||||
| public void addVariable( EnvironmentVariable var ) | |||||
| { | { | ||||
| m_variables.add( var ); | m_variables.add( var ); | ||||
| } | } | ||||
| public static class Variable | |||||
| { | |||||
| private String m_key; | |||||
| private String m_value; | |||||
| public void setFile( final File file ) | |||||
| { | |||||
| m_value = file.getAbsolutePath(); | |||||
| } | |||||
| public void setKey( final String key ) | |||||
| { | |||||
| m_key = key; | |||||
| } | |||||
| public void setPath( final Path path ) | |||||
| { | |||||
| m_value = path.toString(); | |||||
| } | |||||
| public void setValue( final String value ) | |||||
| { | |||||
| m_value = value; | |||||
| } | |||||
| public String getKey() | |||||
| { | |||||
| return m_key; | |||||
| } | |||||
| public String getValue() | |||||
| { | |||||
| return m_value; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,46 @@ | |||||
| /* | |||||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
| * | |||||
| * This software is published under the terms of the Apache Software License | |||||
| * version 1.1, a copy of which has been included with this distribution in | |||||
| * the LICENSE.txt file. | |||||
| */ | |||||
| package org.apache.tools.ant.types; | |||||
| import java.io.File; | |||||
| public class EnvironmentVariable | |||||
| { | |||||
| private String m_key; | |||||
| private String m_value; | |||||
| public void setFile( final File file ) | |||||
| { | |||||
| m_value = file.getAbsolutePath(); | |||||
| } | |||||
| public void setKey( final String key ) | |||||
| { | |||||
| m_key = key; | |||||
| } | |||||
| public void setPath( final Path path ) | |||||
| { | |||||
| m_value = path.toString(); | |||||
| } | |||||
| public void setValue( final String value ) | |||||
| { | |||||
| m_value = value; | |||||
| } | |||||
| public String getKey() | |||||
| { | |||||
| return m_key; | |||||
| } | |||||
| public String getValue() | |||||
| { | |||||
| return m_value; | |||||
| } | |||||
| } | |||||
| @@ -23,6 +23,7 @@ import org.apache.tools.ant.types.CommandlineJava; | |||||
| import org.apache.tools.ant.types.EnvironmentData; | import org.apache.tools.ant.types.EnvironmentData; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
| import org.apache.tools.ant.types.EnvironmentVariable; | |||||
| /** | /** | ||||
| * This task acts as a loader for java applications but allows to use the same | * This task acts as a loader for java applications but allows to use the same | ||||
| @@ -166,7 +167,7 @@ public class Java extends Task | |||||
| * | * | ||||
| * @param sysp The feature to be added to the Sysproperty attribute | * @param sysp The feature to be added to the Sysproperty attribute | ||||
| */ | */ | ||||
| public void addSysproperty( EnvironmentData.Variable sysp ) | |||||
| public void addSysproperty( EnvironmentVariable sysp ) | |||||
| { | { | ||||
| cmdl.addSysproperty( sysp ); | cmdl.addSysproperty( sysp ); | ||||
| } | } | ||||
| @@ -21,6 +21,7 @@ import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.EnvironmentData; | import org.apache.tools.ant.types.EnvironmentData; | ||||
| import org.apache.tools.ant.types.EnvironmentVariable; | |||||
| /** | /** | ||||
| * Executes a given command if the os platform is appropriate. | * Executes a given command if the os platform is appropriate. | ||||
| @@ -175,7 +176,7 @@ public class ExecTask extends Task | |||||
| * | * | ||||
| * @param var The feature to be added to the Env attribute | * @param var The feature to be added to the Env attribute | ||||
| */ | */ | ||||
| public void addEnv( EnvironmentData.Variable var ) | |||||
| public void addEnv( EnvironmentVariable var ) | |||||
| { | { | ||||
| env.addVariable( var ); | env.addVariable( var ); | ||||
| } | } | ||||
| @@ -24,6 +24,7 @@ import org.apache.tools.ant.types.Commandline; | |||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| import org.apache.tools.ant.types.EnvironmentData; | import org.apache.tools.ant.types.EnvironmentData; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.EnvironmentVariable; | |||||
| /** | /** | ||||
| * Websphere deployment tool that augments the ejbjar task. | * Websphere deployment tool that augments the ejbjar task. | ||||
| @@ -966,7 +967,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
| // Set the EnvironmentData variable | // Set the EnvironmentData variable | ||||
| EnvironmentData.Variable var = new EnvironmentData.Variable(); | |||||
| EnvironmentVariable var = new EnvironmentVariable(); | |||||
| var.setKey( "websphere.lib.dir" ); | var.setKey( "websphere.lib.dir" ); | ||||
| var.setValue( getTask().getProject().getProperty( "websphere.home" ) + "/lib" ); | var.setValue( getTask().getProject().getProperty( "websphere.home" ) + "/lib" ); | ||||
| javaTask.addSysproperty( var ); | javaTask.addSysproperty( var ); | ||||
| @@ -30,6 +30,7 @@ import org.apache.tools.ant.types.CommandlineJava; | |||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| import org.apache.tools.ant.types.EnvironmentData; | import org.apache.tools.ant.types.EnvironmentData; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.EnvironmentVariable; | |||||
| /** | /** | ||||
| * Ant task to run JUnit tests. <p> | * Ant task to run JUnit tests. <p> | ||||
| @@ -319,7 +320,7 @@ public class JUnitTask extends Task | |||||
| * | * | ||||
| * @param sysp The feature to be added to the Sysproperty attribute | * @param sysp The feature to be added to the Sysproperty attribute | ||||
| */ | */ | ||||
| public void addSysproperty( EnvironmentData.Variable sysp ) | |||||
| public void addSysproperty( EnvironmentVariable sysp ) | |||||
| { | { | ||||
| commandline.addSysproperty( sysp ); | commandline.addSysproperty( sysp ); | ||||
| } | } | ||||
| @@ -189,7 +189,7 @@ public class CommandlineJava implements Cloneable | |||||
| return vmVersion; | return vmVersion; | ||||
| } | } | ||||
| public void addSysproperty( EnvironmentData.Variable sysp ) | |||||
| public void addSysproperty( EnvironmentVariable sysp ) | |||||
| { | { | ||||
| sysProperties.addVariable( sysp ); | sysProperties.addVariable( sysp ); | ||||
| } | } | ||||
| @@ -341,7 +341,7 @@ public class CommandlineJava implements Cloneable | |||||
| for( Iterator e = m_variables.iterator(); e.hasNext(); ) | for( Iterator e = m_variables.iterator(); e.hasNext(); ) | ||||
| { | { | ||||
| EnvironmentData.Variable v = (EnvironmentData.Variable)e.next(); | |||||
| EnvironmentVariable v = (EnvironmentVariable)e.next(); | |||||
| p.put( v.getKey(), v.getValue() ); | p.put( v.getKey(), v.getValue() ); | ||||
| } | } | ||||
| System.setProperties( p ); | System.setProperties( p ); | ||||
| @@ -28,50 +28,15 @@ public class EnvironmentData | |||||
| final int size = m_variables.size(); | final int size = m_variables.size(); | ||||
| for( int i = 0; i < size; i++ ) | for( int i = 0; i < size; i++ ) | ||||
| { | { | ||||
| final Variable variable = (Variable)m_variables.get( i ); | |||||
| final EnvironmentVariable variable = (EnvironmentVariable)m_variables.get( i ); | |||||
| environment.setProperty( variable.getKey(), variable.getValue() ); | environment.setProperty( variable.getKey(), variable.getValue() ); | ||||
| } | } | ||||
| return environment; | return environment; | ||||
| } | } | ||||
| public void addVariable( Variable var ) | |||||
| public void addVariable( EnvironmentVariable var ) | |||||
| { | { | ||||
| m_variables.add( var ); | m_variables.add( var ); | ||||
| } | } | ||||
| public static class Variable | |||||
| { | |||||
| private String m_key; | |||||
| private String m_value; | |||||
| public void setFile( final File file ) | |||||
| { | |||||
| m_value = file.getAbsolutePath(); | |||||
| } | |||||
| public void setKey( final String key ) | |||||
| { | |||||
| m_key = key; | |||||
| } | |||||
| public void setPath( final Path path ) | |||||
| { | |||||
| m_value = path.toString(); | |||||
| } | |||||
| public void setValue( final String value ) | |||||
| { | |||||
| m_value = value; | |||||
| } | |||||
| public String getKey() | |||||
| { | |||||
| return m_key; | |||||
| } | |||||
| public String getValue() | |||||
| { | |||||
| return m_value; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,46 @@ | |||||
| /* | |||||
| * Copyright (C) The Apache Software Foundation. All rights reserved. | |||||
| * | |||||
| * This software is published under the terms of the Apache Software License | |||||
| * version 1.1, a copy of which has been included with this distribution in | |||||
| * the LICENSE.txt file. | |||||
| */ | |||||
| package org.apache.tools.ant.types; | |||||
| import java.io.File; | |||||
| public class EnvironmentVariable | |||||
| { | |||||
| private String m_key; | |||||
| private String m_value; | |||||
| public void setFile( final File file ) | |||||
| { | |||||
| m_value = file.getAbsolutePath(); | |||||
| } | |||||
| public void setKey( final String key ) | |||||
| { | |||||
| m_key = key; | |||||
| } | |||||
| public void setPath( final Path path ) | |||||
| { | |||||
| m_value = path.toString(); | |||||
| } | |||||
| public void setValue( final String value ) | |||||
| { | |||||
| m_value = value; | |||||
| } | |||||
| public String getKey() | |||||
| { | |||||
| return m_key; | |||||
| } | |||||
| public String getValue() | |||||
| { | |||||
| return m_value; | |||||
| } | |||||
| } | |||||