You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/10/26 13:39:39 UTC
svn commit: r829771 - in /commons/sandbox/runtime/trunk: ./
src/main/native/build/org/apache/commons/runtime/
Author: mturk
Date: Mon Oct 26 12:39:39 2009
New Revision: 829771
URL: http://svn.apache.org/viewvc?rev=829771&view=rev
Log:
Add few more ant tasks
Added:
commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalTask.java (with props)
commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/FormattedEchoTask.java (with props)
commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SilentExecTask.java (with props)
commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/VolatileProperty.java (with props)
Modified:
commons/sandbox/runtime/trunk/build.xml
commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SystemIdTask.java
Modified: commons/sandbox/runtime/trunk/build.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/build.xml?rev=829771&r1=829770&r2=829771&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/build.xml (original)
+++ commons/sandbox/runtime/trunk/build.xml Mon Oct 26 12:39:39 2009
@@ -21,32 +21,31 @@
<property name="implementation" value="${version.major}.${version.minor}"/>
<property name="version.number" value="${version.major}${version.minor}${version.patch}"/>
<property name="project" value="commons-runtime"/>
- <property name="build.dir" value="./dist"/>
+ <property name="build.top" value="${basedir}"/>
+ <property name="build.dir" value="${basedir}/dist"/>
<property name="build.src" value="${build.dir}/src"/>
<property name="build.dest" value="${build.dir}/bin"/>
- <property name="src.dir" value="./src"/>
+ <property name="src.java" value="${basedir}/src"/>
+ <property name="src.docs" value="${basedir}/xdocs"/>
+ <property name="src.native" value="${basedir}/src/main/native"/>
<property name="final.name" value="${project}-${version}${version.suffix}"/>
- <property name="dist.root" value="./dist"/>
- <property name="ant.home" value="."/>
<property name="build.package.path" value="org/apache/commons/runtime"/>
<property name="build.package.name" value="org.apache.commons.runtime"/>
- <property name="docs.src" value="./xdocs"/>
- <property name="docs.dest" value="${dist.root}/doc"/>
- <property name="docs.dest.print" value="${dist.root}/doc/printable"/>
+ <property name="docs.dest" value="${build.dir}/doc"/>
+ <property name="docs.dest.print" value="${docs.dest}/printable"/>
<property name="test.runner" value="junit.textui.TestRunner"/>
<property name="test.entry" value="${build.package.name}.TestAll"/>
<property name="test.child" value="${build.package.name}.TestChild"/>
<property name="test.dir" value="${build.dest}/test"/>
<property name="examples.dir" value="${build.dest}/examples"/>
<property name="example" value="Unknown"/>
- <property name="junit.home" value="./lib"/>
+ <property name="junit.home" value="${basedir}/lib"/>
<property name="junit.jar" value="${junit.home}/junit-4.5.jar"/>
- <property name="commons-logging.home" value="./lib"/>
+ <property name="commons-logging.home" value="${basedir}/lib"/>
<property name="commons-logging.jar" value="${commons-logging.home}/commons-logging-1.1.1.jar"/>
- <property name="runtime.natives.path" value="${basedir}/src/main/native"/>
<property name="runtime.libname" value="libacr"/>
- <property name="runtime.library.path" value="${runtime.natives.path}"/>
+ <property name="runtime.library.path" value="${src.native}"/>
<property name="compile.source" value="1.5"/>
<property name="compile.target" value="1.5"/>
@@ -86,11 +85,17 @@
<!-- prints the environment -->
<!-- =================================================================== -->
<target name="env" description="Print Java environment">
- <echo message="java.home = ${java.home}"/>
- <echo message="user.home = ${user.home}"/>
- <echo message="os.name = ${os.name}"/>
- <echo message="os.arch = ${os.arch}"/>
- <echo message="os.version = ${os.version}"/>
+ <echo message="java.home = ${java.home}"/>
+ <echo message="user.home = ${user.home}"/>
+ <echo message="os.name = ${os.name}"/>
+ <echo message="os.arch = ${os.arch}"/>
+ <echo message="os.version = ${os.version}"/>
+ <echo message="basedir = ${basedir}"/>
+ <echo message="build.top = ${build.top}"/>
+ <echo message="build.dir = ${build.dir}"/>
+ <echo message="build.src = ${build.src}"/>
+ <echo message="src.native = ${src.native}"/>
+
</target>
<target name="prepare" depends="env">
@@ -128,7 +133,7 @@
destdir="${docs.dest}/api"
author="true"
version="true"
- overview="${src.dir}/main/java/overview.html"
+ overview="${src.java}/main/java/overview.html"
packagenames="${build.package.name}.*"
windowtitle="${title} (Version ${version})"
doctitle="<h2>${title}</h2>"
@@ -155,7 +160,7 @@
<mkdir dir="${build.dest}/build"/>
<mkdir dir="${build.src}/build"/>
<copy todir="${build.src}/build" filtering="yes">
- <fileset dir="${runtime.natives.path}/build">
+ <fileset dir="${src.native}/build">
<include name="**/*.java"/>
<include name="**/*.xml"/>
<include name="**/*.properties"/>
@@ -174,11 +179,20 @@
classname="${build.package.name}.SystemIdTask">
<classpath refid="task.classpath"/>
</taskdef>
+ <taskdef name="conditional"
+ classname="${build.package.name}.ConditionTask">
+ <classpath refid="task.classpath"/>
+ </taskdef>
<taskdef name="uuid"
classname="${build.package.name}.UuidTask">
<classpath refid="task.classpath"/>
</taskdef>
+ <taskdef name="variable"
+ classname="${build.package.name}.VolatileProperty">
+ <classpath refid="task.classpath"/>
+ </taskdef>
<uuid property="build.uuid" />
+ <systemid prefix="systemid" />
</target>
<!-- =================================================================== -->
@@ -213,7 +227,7 @@
<filter token="JAVA5_CODE[[" value="${java5.code.start}"/>
<filter token="]]JAVA5_CODE" value="${java5.code.end}"/>
<copy todir="${build.src}/java" filtering="yes">
- <fileset dir="${src.dir}/main/java">
+ <fileset dir="${src.java}/main/java">
<include name="**/*.java"/>
<include name="**/*.xml"/>
<include name="**/*.properties"/>
@@ -260,7 +274,7 @@
<filter token="VERSION_PNAME" value="${final.name}"/>
<filter token="VERSION_BUILT" value="${TODAY} ${TSTAMP}"/>
<copy todir="${build.src}/examples" filtering="yes">
- <fileset dir="${src.dir}/examples">
+ <fileset dir="${src.java}/examples">
<include name="**/*.java"/>
<include name="**/*.xml"/>
<include name="**/*.properties"/>
@@ -289,7 +303,7 @@
<!-- ================================================================== -->
<target name="jar" depends="compile"
description="Generates the Jar file">
- <systemid prefix="system" />
+ <systemid prefix="systemid" />
<jar
destfile="${build.dir}/${final.name}.jar"
basedir="${build.dest}/java"
@@ -343,13 +357,23 @@
</target>
<!-- =================================================================== -->
+ <!-- Run Native configuration -->
+ <!-- =================================================================== -->
+ <target name="configure" depends="tasks">
+ <ant dir="${src.native}" antfile="configure.xml"
+ inheritAll="true" >
+
+ </ant>
+ </target>
+
+ <!-- =================================================================== -->
<!-- Compiles the test directory -->
<!-- =================================================================== -->
<target name="tests" depends="compile">
<mkdir dir="${build.dest}/test"/>
<mkdir dir="${build.src}/test"/>
<copy todir="${build.src}/test" filtering="yes">
- <fileset dir="${src.dir}/test">
+ <fileset dir="${src.java}/test">
<include name="**/*.java"/>
<include name="**/*.xml"/>
<include name="**/*.properties"/>
@@ -465,5 +489,4 @@
<jvmarg value="-d64"/>
</java>
</target>
-
</project>
Added: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalTask.java?rev=829771&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalTask.java (added)
+++ commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalTask.java Mon Oct 26 12:39:39 2009
@@ -0,0 +1,112 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.runtime;
+
+import java.util.Properties;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.PropertyHelper;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.ConditionTask;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ */
+public class ConditionalTask extends ConditionTask
+{
+
+ private String property;
+ private String value;
+ private String add;
+ private String target;
+ private String alternative;
+
+ public ConditionalTask()
+ {
+ super();
+ property = null;
+ value = null;
+ add = null;
+ target = null;
+ alternative = null;
+ }
+
+ public void setVariable(String property)
+ {
+ this.property = property;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ super.setValue(value);
+ }
+
+ public void setAdd(String value)
+ {
+ add = value;
+ }
+
+ public void setTarget(String target)
+ {
+ this.target = target;
+ }
+
+ public void setElse(String target)
+ {
+ alternative = target;
+ super.setElse(target);
+ }
+
+ public void addSystemid(SystemIdTask id)
+ {
+ add(id);
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ int cnt = 0;
+ if (target != null)
+ cnt++;
+ if (property != null)
+ cnt++;
+ if (cnt == 0) {
+ super.execute();
+ return;
+ }
+ if (cnt > 1) {
+ throw new BuildException("Single attribute is required");
+ }
+ Condition c = (Condition)getConditions().nextElement();
+ if (c.eval()) {
+ if (target != null)
+ getProject().executeTarget(target);
+ else {
+ VolatileProperty.set(getProject(), property, value, add);
+ }
+ }
+ else if (alternative != null) {
+ if (target != null)
+ getProject().executeTarget(alternative);
+ else {
+ VolatileProperty.set(getProject(), property, alternative, add);
+ }
+ }
+ }
+
+}
Propchange: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/FormattedEchoTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/FormattedEchoTask.java?rev=829771&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/FormattedEchoTask.java (added)
+++ commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/FormattedEchoTask.java Mon Oct 26 12:39:39 2009
@@ -0,0 +1,62 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.runtime;
+
+import java.util.Properties;
+import java.util.Formatter;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.PropertyHelper;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Echo;
+
+/**
+ */
+public class FormattedEchoTask extends Echo
+{
+
+ private String format;
+
+ public FormattedEchoTask()
+ {
+ super();
+ format = null;
+ }
+
+ public void setFormat(String format)
+ {
+ this.format = format;
+ }
+
+
+ public void execute()
+ throws BuildException
+ {
+ if (format != null) {
+ if (message != null) {
+ StringBuilder sb = new StringBuilder();
+ Formatter fmt = new Formatter(sb);
+ String [] ma = message.split(" : ");
+ fmt.format(format, (Object [])ma);
+ message = sb.toString();
+ }
+ else
+ message = format;
+ }
+ super.execute();
+ }
+
+}
Propchange: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/FormattedEchoTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SilentExecTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SilentExecTask.java?rev=829771&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SilentExecTask.java (added)
+++ commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SilentExecTask.java Mon Oct 26 12:39:39 2009
@@ -0,0 +1,84 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.runtime;
+
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Vector;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.ConditionTask;
+import org.apache.tools.ant.taskdefs.ExecTask;
+import org.apache.tools.ant.taskdefs.condition.And;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+import org.apache.tools.ant.taskdefs.condition.Not;
+import org.apache.tools.ant.taskdefs.condition.Or;
+
+/**
+ */
+public class SilentExecTask extends ExecTask
+{
+
+ /** Optional Vector holding the nested tasks */
+ private Vector<Condition> conditions = new Vector<Condition>();
+ private Condition cond;
+ public SilentExecTask()
+ {
+ super();
+ }
+
+ public void addAnd(And cond)
+ {
+ conditions.add(cond);
+ }
+
+ public void addNot(Not cond)
+ {
+ conditions.add(cond);
+ }
+
+ public void addOr(Or cond)
+ {
+ conditions.add(cond);
+ }
+
+ public void addSystemId(SystemIdTask cond)
+ {
+ conditions.add(cond);
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ setFailonerror(true);
+ setFailIfExecutionFails(true);
+ boolean perform = true;
+
+ for (Iterator<Condition> i = conditions.iterator(); i.hasNext();) {
+ Condition c = i.next();
+ if (!c.eval())
+ perform = false;
+ }
+ if (!perform) {
+ return;
+ }
+ try {
+ super.execute();
+ } catch(BuildException ex) {
+ // Ignore so that failure doesn't get logged
+ }
+ }
+}
Propchange: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SilentExecTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SystemIdTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SystemIdTask.java?rev=829771&r1=829770&r2=829771&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SystemIdTask.java (original)
+++ commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SystemIdTask.java Mon Oct 26 12:39:39 2009
@@ -19,6 +19,8 @@
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
/**
* Apache Ant task for setting the {@code SystemId} properties.
@@ -27,9 +29,12 @@
* names later used for extracting the native libraries.
* </p>
*/
-public class SystemIdTask extends Task
+public class SystemIdTask extends Task implements Condition
{
private String prefix;
+ private String equals;
+ private String arch;
+ private String cpu;
private static Properties props;
static {
@@ -166,6 +171,21 @@
this.prefix = prefix;
}
+ public void setEquals(String equals)
+ {
+ this.equals = equals;
+ }
+
+ public void setArch(String arch)
+ {
+ this.arch = arch;
+ }
+
+ public void setCpu(String cpu)
+ {
+ this.cpu = cpu;
+ }
+
public void execute()
throws BuildException
{
@@ -175,6 +195,37 @@
getProject().setNewProperty(prefix + ".cpu", getProcessor());
getProject().setNewProperty(prefix + ".os", getSysname());
getProject().setNewProperty(prefix + ".data.model", getDataModel());
+ getProject().setNewProperty(prefix + ".OS", getSysname().toUpperCase());
+ getProject().setNewProperty(prefix + ".CPU", getProcessor().toUpperCase());
}
+ public boolean eval()
+ throws BuildException
+ {
+ int cnt = 0;
+ if (equals != null)
+ cnt++;
+ if (arch != null)
+ cnt++;
+ if (cpu != null)
+ cnt++;
+
+ if (cnt == 0)
+ throw new BuildException("Missing condition attribute");
+ else if (cnt > 1)
+ throw new BuildException("Multiple condition attributes not allowed");
+
+ boolean matches = false;
+ if (equals != null) {
+ if (arch != null || cpu != null)
+ throw new BuildException("Single condition is allowed only");
+ matches = equals.equalsIgnoreCase(getSysname());
+ }
+ if (arch != null)
+ matches = arch.equalsIgnoreCase(getDataModel());
+ if (cpu != null)
+ matches = cpu.equalsIgnoreCase(getProcessor());
+
+ return matches;
+ }
}
Added: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/VolatileProperty.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/VolatileProperty.java?rev=829771&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/VolatileProperty.java (added)
+++ commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/VolatileProperty.java Mon Oct 26 12:39:39 2009
@@ -0,0 +1,166 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.runtime;
+
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+import java.util.Properties;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.PropertyHelper;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Property;
+
+/**
+ */
+public class VolatileProperty extends Property
+{
+
+ private String add;
+ private boolean del;
+ public VolatileProperty()
+ {
+ super();
+ add = null;
+ del = false;
+ }
+
+ public void setAdd(String value)
+ {
+ add = value;
+ }
+
+ public void setUnset(boolean value)
+ {
+ del = value;
+ }
+
+ /**
+ * Object rape: fondle the private parts of an object without it's
+ * permission.
+ *
+ * @param clazz The class to rape.
+ * @param fieldName The field to fondle
+ * @return The field value
+ * @exception NoSuchFieldException Darn, nothing to fondle.
+ */
+ private Field getField(Class clazz, String filedName)
+ throws NoSuchFieldException
+ {
+ if (clazz == null) {
+ throw new NoSuchFieldException("Invalid field : " + filedName);
+ }
+ try {
+ return clazz.getDeclaredField(filedName);
+ } catch (NoSuchFieldException e) {
+ return getField(clazz.getSuperclass(), filedName);
+ }
+ }
+
+
+ /**
+ * Object rape: fondle the private parts of an object without it's
+ * permission.
+ *
+ * @param instance the object instance
+ * @param fieldName the name of the field
+ * @return an object representing the value of the
+ * field
+ */
+ private Object getFieldValue(Object instance, String fieldName)
+ throws BuildException
+ {
+ try {
+ Field field = getField(instance.getClass(), fieldName);
+ field.setAccessible(true);
+ return field.get(instance);
+ } catch(IllegalAccessException e) {
+ throw new BuildException(e.getMessage());
+ } catch(NoSuchFieldException e) {
+ throw new BuildException(e.getMessage());
+ }
+ }
+
+ public static void set(Project project, String name, String value, String add)
+ throws BuildException
+ {
+ VolatileProperty prop = new VolatileProperty();
+ prop.setProject(project);
+ prop.setName(name);
+ prop.setValue(value);
+ prop.setAdd(add);
+ prop.execute();
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ PropertyHelper ph = PropertyHelper.getPropertyHelper(getProject());
+ int cnt = 0;
+ if (add != null)
+ cnt++;
+ if (getValue() != null)
+ cnt++;
+ if (cnt > 1) {
+ throw new BuildException("Single attribute required");
+ }
+ if (del) {
+ Hashtable properties = (Hashtable)getFieldValue(ph, "properties");
+ if (properties.containsKey(getName())) {
+ properties.remove(getName());
+ }
+ return;
+ }
+ else if (getValue() != null) {
+ Hashtable properties = (Hashtable)getFieldValue(ph, "properties");
+ if (properties.containsKey(getName())) {
+ properties.put(getName(), getValue());
+ return;
+ }
+ }
+ else if (add != null) {
+ Hashtable properties = (Hashtable)getFieldValue(ph, "properties");
+ if (properties.containsKey(getName())) {
+ String org = (String)properties.get(getName());
+ if (!org.equals(add)) {
+ String [] aa = add.split(" ");
+ String [] oa = org.split(" ");
+ for (int i = 0; i < oa.length; i++) {
+ for (int x = 0; x < aa.length; x++) {
+ if (aa[x] != null && oa[i].equals(aa[x])) {
+ // Don't add if already there
+ aa[x] = null;
+ }
+ }
+ }
+ StringBuilder val = new StringBuilder(org);
+ for (int i = 0; i < aa.length; i++) {
+ if (aa[i] != null) {
+ val.append(' ');
+ val.append(aa[i]);
+ }
+ }
+ properties.put(getName(), val.toString());
+ }
+ return;
+ }
+ else
+ setValue(add);
+ }
+ super.execute();
+ }
+
+}
Propchange: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/VolatileProperty.java
------------------------------------------------------------------------------
svn:eol-style = native