git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272591 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -145,10 +145,10 @@ | |||
| </target> | |||
| <target name="antlibs" depends="common"> | |||
| <antcall target="build-lib" inheritall="false"> | |||
| <antcall target="build-lib"> | |||
| <param name="libset" value="system"/> | |||
| </antcall> | |||
| <ant antfile="build/script.xml" inheritAll="false"/> | |||
| <ant antfile="build/script.xml"/> | |||
| </target> | |||
| <target name="build-lib"> | |||
| @@ -37,6 +37,8 @@ | |||
| <patternset id="converted"> | |||
| <exclude name="org/apache/tools/ant/taskdefs/Ant.java"/> | |||
| <exclude name="org/apache/tools/ant/taskdefs/CallTarget.java"/> | |||
| <exclude name="org/apache/tools/ant/taskdefs/input/InputRequest.java"/> | |||
| <exclude name="org/apache/tools/ant/types/DataType.java"/> | |||
| </patternset> | |||
| <fileset id="ant1src_tocopy" dir="${ant1java.dir}"> | |||
| @@ -63,7 +65,6 @@ | |||
| <include name="org/apache/tools/ant/BuildListener.java"/> | |||
| <include name="org/apache/tools/ant/BuildLogger.java"/> | |||
| <!-- <patternset refid="deprecated"/> --> | |||
| <exclude name="org/apache/tools/ant/types/DataType.java"/> | |||
| <patternset refid="toohard"/> | |||
| <patternset refid="converted"/> | |||
| </fileset> | |||
| @@ -0,0 +1,88 @@ | |||
| /* | |||
| * The Apache Software License, Version 1.1 | |||
| * | |||
| * Copyright (c) 2002 The Apache Software Foundation. All rights | |||
| * reserved. | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without | |||
| * modification, are permitted provided that the following conditions | |||
| * are met: | |||
| * | |||
| * 1. Redistributions of source code must retain the above copyright | |||
| * notice, this list of conditions and the following disclaimer. | |||
| * | |||
| * 2. Redistributions in binary form must reproduce the above copyright | |||
| * notice, this list of conditions and the following disclaimer in | |||
| * the documentation and/or other materials provided with the | |||
| * distribution. | |||
| * | |||
| * 3. The end-user documentation included with the redistribution, if | |||
| * any, must include the following acknowlegement: | |||
| * "This product includes software developed by the | |||
| * Apache Software Foundation (http://www.apache.org/)." | |||
| * Alternately, this acknowlegement may appear in the software itself, | |||
| * if and wherever such third-party acknowlegements normally appear. | |||
| * | |||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||
| * Foundation" must not be used to endorse or promote products derived | |||
| * from this software without prior written permission. For written | |||
| * permission, please contact apache@apache.org. | |||
| * | |||
| * 5. Products derived from this software may not be called "Apache" | |||
| * nor may "Apache" appear in their names without prior written | |||
| * permission of the Apache Group. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
| * SUCH DAMAGE. | |||
| * ==================================================================== | |||
| * | |||
| * This software consists of voluntary contributions made by many | |||
| * individuals on behalf of the Apache Software Foundation. For more | |||
| * information on the Apache Software Foundation, please see | |||
| * <http://www.apache.org/>. | |||
| */ | |||
| package org.apache.ant.antcore.execution; | |||
| import org.apache.ant.common.service.InputService; | |||
| import org.apache.ant.common.util.ExecutionException; | |||
| import org.apache.ant.common.input.InputRequest; | |||
| /** | |||
| * The core's implementation of the Input Service. | |||
| * | |||
| * @author Conor MacNeill | |||
| * @created 30 April 2002 | |||
| */ | |||
| public class CoreInputService implements InputService { | |||
| /** The Frame this service instance is working for */ | |||
| private Frame frame; | |||
| /** | |||
| * Constructor | |||
| * | |||
| * @param frame the frame containing this context | |||
| */ | |||
| protected CoreInputService(Frame frame) { | |||
| this.frame = frame; | |||
| } | |||
| /** | |||
| * Handle an input request | |||
| * | |||
| * @param request an input request | |||
| * @exception ExecutionException if the request cannot be handled | |||
| */ | |||
| public void handleInput(InputRequest request) throws ExecutionException { | |||
| // XXX | |||
| } | |||
| } | |||
| @@ -0,0 +1,95 @@ | |||
| /* | |||
| * The Apache Software License, Version 1.1 | |||
| * | |||
| * Copyright (c) 2002 The Apache Software Foundation. All rights | |||
| * reserved. | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without | |||
| * modification, are permitted provided that the following conditions | |||
| * are met: | |||
| * | |||
| * 1. Redistributions of source code must retain the above copyright | |||
| * notice, this list of conditions and the following disclaimer. | |||
| * | |||
| * 2. Redistributions in binary form must reproduce the above copyright | |||
| * notice, this list of conditions and the following disclaimer in | |||
| * the documentation and/or other materials provided with the | |||
| * distribution. | |||
| * | |||
| * 3. The end-user documentation included with the redistribution, if | |||
| * any, must include the following acknowlegement: | |||
| * "This product includes software developed by the | |||
| * Apache Software Foundation (http://www.apache.org/)." | |||
| * Alternately, this acknowlegement may appear in the software itself, | |||
| * if and wherever such third-party acknowlegements normally appear. | |||
| * | |||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||
| * Foundation" must not be used to endorse or promote products derived | |||
| * from this software without prior written permission. For written | |||
| * permission, please contact apache@apache.org. | |||
| * | |||
| * 5. Products derived from this software may not be called "Apache" | |||
| * nor may "Apache" appear in their names without prior written | |||
| * permission of the Apache Group. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
| * SUCH DAMAGE. | |||
| * ==================================================================== | |||
| * | |||
| * This software consists of voluntary contributions made by many | |||
| * individuals on behalf of the Apache Software Foundation. For more | |||
| * information on the Apache Software Foundation, please see | |||
| * <http://www.apache.org/>. | |||
| */ | |||
| package org.apache.tools.ant; | |||
| import org.apache.ant.common.service.InputService; | |||
| import org.apache.ant.common.util.ExecutionException; | |||
| import org.apache.tools.ant.input.InputHandler; | |||
| import org.apache.tools.ant.input.InputRequest; | |||
| /** | |||
| * Uses the core's input service to handle input | |||
| * | |||
| * @author Conor MacNeill | |||
| * @created 30 April 2002 | |||
| */ | |||
| public class Ant1InputHandler implements InputHandler { | |||
| /** Core's input service instance */ | |||
| private InputService inputService; | |||
| /** | |||
| * Constructor for the Ant1InputHandler | |||
| * | |||
| * @param inputService the core's input service instance to which input | |||
| * requests will be delgated. | |||
| */ | |||
| public Ant1InputHandler(InputService inputService) { | |||
| this.inputService = inputService; | |||
| } | |||
| /** | |||
| * Pass input request into the core service | |||
| * | |||
| * @param request the input request | |||
| * @exception BuildException if there is a problem handling the request. | |||
| */ | |||
| public void handleInput(InputRequest request) throws BuildException { | |||
| try { | |||
| inputService.handleInput(request); | |||
| } catch (ExecutionException e) { | |||
| throw new BuildException(e); | |||
| } | |||
| } | |||
| } | |||
| @@ -69,8 +69,10 @@ import org.apache.ant.common.service.ComponentService; | |||
| import org.apache.ant.common.service.DataService; | |||
| import org.apache.ant.common.service.ExecService; | |||
| import org.apache.ant.common.service.FileService; | |||
| import org.apache.ant.common.service.InputService; | |||
| import org.apache.ant.common.util.ExecutionException; | |||
| import org.apache.ant.common.util.PropertyUtils; | |||
| import org.apache.tools.ant.input.InputHandler; | |||
| import org.apache.tools.ant.types.FilterSet; | |||
| import org.apache.tools.ant.types.FilterSetCollection; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| @@ -118,9 +120,12 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| /** The java version detected that Ant is running on */ | |||
| private static String javaVersion; | |||
| /** Called to handle any input requests. */ | |||
| private InputHandler inputHandler = null; | |||
| /** | |||
| * the factory which created this project instance. This is used to | |||
| * define new types and tasks | |||
| * the factory which created this project instance. This is used to define | |||
| * new types and tasks | |||
| */ | |||
| private AntLibFactory factory; | |||
| @@ -146,7 +151,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| /** Th ecore's execution service */ | |||
| private ExecService execService; | |||
| /** The core's Component Service instance */ | |||
| private ComponentService componentService; | |||
| @@ -202,36 +207,10 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| * @deprecated | |||
| */ | |||
| public Project() { | |||
| throw new BuildException("Projects can not be constructed to " | |||
| + "invoke Ant"); | |||
| } | |||
| /** | |||
| * The old initialisation method for Projects. Not used now | |||
| * | |||
| * @deprecated | |||
| * @exception BuildException if the default task list cannot be loaded | |||
| */ | |||
| public void init() throws BuildException { | |||
| throw new BuildException("Projects can not be initialized in this " | |||
| + "manner any longer."); | |||
| throw new BuildException("Projects can not be constructed to " | |||
| + "invoke Ant"); | |||
| } | |||
| /** | |||
| * Old method used to execute targets | |||
| * | |||
| * @param targetNames A vector of target name strings to execute. | |||
| * Must not be <code>null</code>. | |||
| * | |||
| * @exception BuildException always | |||
| * @deprecated | |||
| */ | |||
| public void executeTargets(Vector targetNames) throws BuildException { | |||
| throw new BuildException("Targets within the project cannot be " | |||
| + "executed with this method."); | |||
| } | |||
| /** | |||
| * static query of the java version | |||
| * | |||
| @@ -242,8 +221,8 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| } | |||
| /** | |||
| * returns the boolean equivalent of a string, which is considered true | |||
| * if either "on", "true", or "yes" is found, ignoring case. | |||
| * returns the boolean equivalent of a string, which is considered true if | |||
| * either "on", "true", or "yes" is found, ignoring case. | |||
| * | |||
| * @param s the string value to be interpreted at a boolean | |||
| * @return the value of s as a boolean | |||
| @@ -257,8 +236,8 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| * | |||
| * This method uses the PathTokenizer class to separate the input path | |||
| * into its components. This handles DOS style paths in a relatively | |||
| * sensible way. The file separators are then converted to their | |||
| * platform specific versions. | |||
| * sensible way. The file separators are then converted to their platform | |||
| * specific versions. | |||
| * | |||
| * @param toProcess the path to be converted | |||
| * @return the native version of to_process or an empty string if | |||
| @@ -284,6 +263,31 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| return path.toString(); | |||
| } | |||
| /** | |||
| * The old initialisation method for Projects. Not used now | |||
| * | |||
| * @exception BuildException if the default task list cannot be loaded | |||
| * @deprecated | |||
| */ | |||
| public void init() throws BuildException { | |||
| throw new BuildException("Projects can not be initialized in this " | |||
| + "manner any longer."); | |||
| } | |||
| /** | |||
| * Old method used to execute targets | |||
| * | |||
| * @param targetNames A vector of target name strings to execute. Must not | |||
| * be <code>null</code>. | |||
| * @exception BuildException always | |||
| * @deprecated | |||
| */ | |||
| public void executeTargets(Vector targetNames) throws BuildException { | |||
| throw new BuildException("Targets within the project cannot be " | |||
| + "executed with this method."); | |||
| } | |||
| /** | |||
| * set the project description | |||
| * | |||
| @@ -355,22 +359,22 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| } | |||
| /** | |||
| * Returns the current datatype definition hashtable. The returned | |||
| * Returns the current datatype definition hashtable. The returned | |||
| * hashtable is "live" and so should not be modified. | |||
| * | |||
| * @return a map of from datatype name to implementing class | |||
| * (String to Class). | |||
| * | |||
| * @return a map of from datatype name to implementing class (String to | |||
| * Class). | |||
| */ | |||
| public Hashtable getDataTypeDefinitions() { | |||
| return dataClassDefinitions; | |||
| } | |||
| /** | |||
| * Returns the current task definition hashtable. The returned hashtable is | |||
| * "live" and so should not be modified. | |||
| * | |||
| * @return a map of from task name to implementing class | |||
| * (String to Class). | |||
| * Returns the current task definition hashtable. The returned hashtable | |||
| * is "live" and so should not be modified. | |||
| * | |||
| * @return a map of from task name to implementing class (String to | |||
| * Class). | |||
| */ | |||
| public Hashtable getTaskDefinitions() { | |||
| return taskClassDefinitions; | |||
| @@ -410,8 +414,8 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| * @deprecated | |||
| */ | |||
| public String getDefaultTarget() { | |||
| throw new BuildException("The default project target is no longer " | |||
| + "available through this method."); | |||
| throw new BuildException("The default project target is no longer " | |||
| + "available through this method."); | |||
| } | |||
| /** | |||
| @@ -534,8 +538,8 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| } | |||
| /** | |||
| * Register a task as the current task for a thread. | |||
| * If the task is null, the thread's entry is removed. | |||
| * Register a task as the current task for a thread. If the task is null, | |||
| * the thread's entry is removed. | |||
| * | |||
| * @param thread the thread on which the task is registered. | |||
| * @param task the task to be registered. | |||
| @@ -548,19 +552,19 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| // threadTasks.remove(thread); | |||
| // } | |||
| } | |||
| /** | |||
| * Get the current task assopciated with a thread, if any | |||
| * | |||
| * @param thread the thread for which the task is required. | |||
| * @return the task which is currently registered for the given thread or | |||
| * null if no task is registered. | |||
| * null if no task is registered. | |||
| */ | |||
| public Task getThreadTask(Thread thread) { | |||
| return null; | |||
| // return (Task)threadTasks.get(thread); | |||
| } | |||
| /** | |||
| * build started event | |||
| * | |||
| @@ -649,8 +653,8 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| } | |||
| /** | |||
| * Add a reference to an object. NOte that in Ant2 objects and | |||
| * properties occupy the same namespace. | |||
| * Add a reference to an object. NOte that in Ant2 objects and properties | |||
| * occupy the same namespace. | |||
| * | |||
| * @param name the reference name | |||
| * @param value the object to be associated with the given name. | |||
| @@ -715,9 +719,9 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| /** | |||
| * Convienence method to copy a file from a source to a destination | |||
| * specifying if token filtering must be used, if source files may | |||
| * overwrite newer destination files and the last modified time of | |||
| * <code>destFile</code> file should be made equal to the last modified | |||
| * time of <code>sourceFile</code>. | |||
| * overwrite newer destination files and the last modified time | |||
| * of <code>destFile</code> file should be made equal to the last | |||
| * modified time of <code>sourceFile</code>. | |||
| * | |||
| * @param sourceFile the source file to be copied | |||
| * @param destFile the destination to which the file is copied | |||
| @@ -786,9 +790,9 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| /** | |||
| * Convienence method to copy a file from a source to a destination | |||
| * specifying if token filtering must be used, if source files may | |||
| * overwrite newer destination files and the last modified time of | |||
| * <code>destFile</code> file should be made equal to the last modified | |||
| * time of <code>sourceFile</code>. | |||
| * overwrite newer destination files and the last modified time of | |||
| * <code>destFile</code> file should be made equal to the last | |||
| * modified time of <code>sourceFile</code>. | |||
| * | |||
| * @param sourceFile the source file to be copied | |||
| * @param destFile the destination to which the file is copied | |||
| @@ -820,6 +824,10 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| componentService = (ComponentService) | |||
| context.getCoreService(ComponentService.class); | |||
| InputService inputService | |||
| = (InputService) context.getCoreService(InputService.class); | |||
| setInputHandler(new Ant1InputHandler(inputService)); | |||
| String defs = "/org/apache/tools/ant/taskdefs/defaults.properties"; | |||
| try { | |||
| @@ -892,8 +900,8 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| } | |||
| /** | |||
| * Output a message to the log with the given log level and an event | |||
| * scope of project | |||
| * Output a message to the log with the given log level and an event scope | |||
| * of project | |||
| * | |||
| * @param msg text to log | |||
| * @param msgLevel level to log at | |||
| @@ -903,8 +911,26 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| } | |||
| /** | |||
| * Output a message to the log with the given log level and an event | |||
| * scope of a task | |||
| * Retrieves the current input handler. | |||
| * | |||
| * @return the Project's current input handler. | |||
| */ | |||
| public InputHandler getInputHandler() { | |||
| return inputHandler; | |||
| } | |||
| /** | |||
| * Sets the input handler | |||
| * | |||
| * @param handler the new input handler to use. | |||
| */ | |||
| public void setInputHandler(InputHandler handler) { | |||
| inputHandler = handler; | |||
| } | |||
| /** | |||
| * Output a message to the log with the given log level and an event scope | |||
| * of a task | |||
| * | |||
| * @param task task to use in the log | |||
| * @param msg text to log | |||
| @@ -982,7 +1008,6 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| * | |||
| * @param taskType the name of the task to be created. | |||
| * @return the created task instance | |||
| * | |||
| * @exception BuildException if there is a build problem | |||
| */ | |||
| public Task createTask(String taskType) throws BuildException { | |||
| @@ -1016,8 +1041,8 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| * | |||
| * @param typeName The name of the data type to create an instance of. | |||
| * Must not be <code>null</code>. | |||
| * @return an instance of the specified data type, or <code>null</code> | |||
| * if the data type name is not recognised. | |||
| * @return an instance of the specified data type, or <code>null</code> if | |||
| * the data type name is not recognised. | |||
| * @exception BuildException if the data type name is recognised but | |||
| * instance creation fails. | |||
| */ | |||
| @@ -1176,7 +1201,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||
| listener.messageLogged(event); | |||
| } | |||
| } | |||
| /** | |||
| * Get the name of the project. | |||
| * | |||
| @@ -0,0 +1,71 @@ | |||
| /* | |||
| * The Apache Software License, Version 1.1 | |||
| * | |||
| * Copyright (c) 2002 The Apache Software Foundation. All rights | |||
| * reserved. | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without | |||
| * modification, are permitted provided that the following conditions | |||
| * are met: | |||
| * | |||
| * 1. Redistributions of source code must retain the above copyright | |||
| * notice, this list of conditions and the following disclaimer. | |||
| * | |||
| * 2. Redistributions in binary form must reproduce the above copyright | |||
| * notice, this list of conditions and the following disclaimer in | |||
| * the documentation and/or other materials provided with the | |||
| * distribution. | |||
| * | |||
| * 3. The end-user documentation included with the redistribution, if | |||
| * any, must include the following acknowlegement: | |||
| * "This product includes software developed by the | |||
| * Apache Software Foundation (http://www.apache.org/)." | |||
| * Alternately, this acknowlegement may appear in the software itself, | |||
| * if and wherever such third-party acknowlegements normally appear. | |||
| * | |||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||
| * Foundation" must not be used to endorse or promote products derived | |||
| * from this software without prior written permission. For written | |||
| * permission, please contact apache@apache.org. | |||
| * | |||
| * 5. Products derived from this software may not be called "Apache" | |||
| * nor may "Apache" appear in their names without prior written | |||
| * permission of the Apache Group. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
| * SUCH DAMAGE. | |||
| * ==================================================================== | |||
| * | |||
| * This software consists of voluntary contributions made by many | |||
| * individuals on behalf of the Apache Software Foundation. For more | |||
| * information on the Apache Software Foundation, please see | |||
| * <http://www.apache.org/>. | |||
| */ | |||
| package org.apache.tools.ant.input; | |||
| /** | |||
| * Encapsulates an input request. | |||
| * | |||
| * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||
| * @version $Revision$ | |||
| * @since Ant 1.5 | |||
| */ | |||
| public class InputRequest extends org.apache.ant.common.input.InputRequest { | |||
| /** | |||
| * @param prompt The prompt to show to the user. Must not be null. | |||
| */ | |||
| public InputRequest(String prompt) { | |||
| super(prompt); | |||
| } | |||
| } | |||
| @@ -87,6 +87,9 @@ public class Builder { | |||
| /** the util root */ | |||
| private static final File UTIL_ROOT | |||
| = new File(PACKAGE_ROOT, "util"); | |||
| /** the input root */ | |||
| private static final File INPUT_ROOT | |||
| = new File(PACKAGE_ROOT, "input"); | |||
| /** the root forthe depend task's support classes */ | |||
| @@ -142,6 +145,7 @@ public class Builder { | |||
| addJavaFiles(files, new File(UTIL_ROOT, "depend")); | |||
| addJavaFiles(files, ZIP_ROOT); | |||
| addJavaFiles(files, new File(UTIL_ROOT, "facade")); | |||
| addJavaFiles(files, INPUT_ROOT); | |||
| files.add(new File(PACKAGE_ROOT, "BuildException.java")); | |||
| files.add(new File(PACKAGE_ROOT, "Location.java")); | |||
| @@ -171,6 +175,8 @@ public class Builder { | |||
| files.remove(new File(TASKDEFS_ROOT, "AntStructure.java")); | |||
| files.remove(new File(TASKDEFS_ROOT, "Recorder.java")); | |||
| files.remove(new File(TASKDEFS_ROOT, "RecorderEntry.java")); | |||
| files.remove(new File(TASKDEFS_ROOT, "SendEmail.java")); | |||
| files.remove(new File(INPUT_ROOT, "InputRequest.java")); | |||
| // not needed for bootstrap | |||
| files.remove(new File(TASKDEFS_ROOT, "Java.java")); | |||
| @@ -0,0 +1,117 @@ | |||
| /* | |||
| * The Apache Software License, Version 1.1 | |||
| * | |||
| * Copyright (c) 2002 The Apache Software Foundation. All rights | |||
| * reserved. | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without | |||
| * modification, are permitted provided that the following conditions | |||
| * are met: | |||
| * | |||
| * 1. Redistributions of source code must retain the above copyright | |||
| * notice, this list of conditions and the following disclaimer. | |||
| * | |||
| * 2. Redistributions in binary form must reproduce the above copyright | |||
| * notice, this list of conditions and the following disclaimer in | |||
| * the documentation and/or other materials provided with the | |||
| * distribution. | |||
| * | |||
| * 3. The end-user documentation included with the redistribution, if | |||
| * any, must include the following acknowlegement: | |||
| * "This product includes software developed by the | |||
| * Apache Software Foundation (http://www.apache.org/)." | |||
| * Alternately, this acknowlegement may appear in the software itself, | |||
| * if and wherever such third-party acknowlegements normally appear. | |||
| * | |||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||
| * Foundation" must not be used to endorse or promote products derived | |||
| * from this software without prior written permission. For written | |||
| * permission, please contact apache@apache.org. | |||
| * | |||
| * 5. Products derived from this software may not be called "Apache" | |||
| * nor may "Apache" appear in their names without prior written | |||
| * permission of the Apache Group. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
| * SUCH DAMAGE. | |||
| * ==================================================================== | |||
| * | |||
| * This software consists of voluntary contributions made by many | |||
| * individuals on behalf of the Apache Software Foundation. For more | |||
| * information on the Apache Software Foundation, please see | |||
| * <http://www.apache.org/>. | |||
| */ | |||
| package org.apache.ant.common.input; | |||
| /** | |||
| * Encapsulates an input request. | |||
| * | |||
| * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||
| * @version $Revision$ | |||
| * @since Ant 1.5 | |||
| */ | |||
| public class InputRequest { | |||
| /** Prompt to show the user */ | |||
| private String prompt; | |||
| /** Input collected from user */ | |||
| private String input; | |||
| /** | |||
| * @param prompt The prompt to show to the user. Must not be null. | |||
| */ | |||
| public InputRequest(String prompt) { | |||
| if (prompt == null) { | |||
| throw new IllegalArgumentException("prompt must not be null"); | |||
| } | |||
| this.prompt = prompt; | |||
| } | |||
| /** | |||
| * Retrieves the prompt text. | |||
| * | |||
| * @return the prompt text. | |||
| */ | |||
| public String getPrompt() { | |||
| return prompt; | |||
| } | |||
| /** | |||
| * Sets the user provided input. | |||
| * | |||
| * @param input the user provided input. | |||
| */ | |||
| public void setInput(String input) { | |||
| this.input = input; | |||
| } | |||
| /** | |||
| * Is the user input valid? | |||
| * | |||
| * @return true if the input is valid. | |||
| */ | |||
| public boolean isInputValid() { | |||
| return true; | |||
| } | |||
| /** | |||
| * Retrieves the user input. | |||
| * | |||
| * @return the user's input. | |||
| */ | |||
| public String getInput() { | |||
| return input; | |||
| } | |||
| } | |||
| @@ -0,0 +1,74 @@ | |||
| /* | |||
| * The Apache Software License, Version 1.1 | |||
| * | |||
| * Copyright (c) 2002 The Apache Software Foundation. All rights | |||
| * reserved. | |||
| * | |||
| * Redistribution and use in source and binary forms, with or without | |||
| * modification, are permitted provided that the following conditions | |||
| * are met: | |||
| * | |||
| * 1. Redistributions of source code must retain the above copyright | |||
| * notice, this list of conditions and the following disclaimer. | |||
| * | |||
| * 2. Redistributions in binary form must reproduce the above copyright | |||
| * notice, this list of conditions and the following disclaimer in | |||
| * the documentation and/or other materials provided with the | |||
| * distribution. | |||
| * | |||
| * 3. The end-user documentation included with the redistribution, if | |||
| * any, must include the following acknowlegement: | |||
| * "This product includes software developed by the | |||
| * Apache Software Foundation (http://www.apache.org/)." | |||
| * Alternately, this acknowlegement may appear in the software itself, | |||
| * if and wherever such third-party acknowlegements normally appear. | |||
| * | |||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||
| * Foundation" must not be used to endorse or promote products derived | |||
| * from this software without prior written permission. For written | |||
| * permission, please contact apache@apache.org. | |||
| * | |||
| * 5. Products derived from this software may not be called "Apache" | |||
| * nor may "Apache" appear in their names without prior written | |||
| * permission of the Apache Group. | |||
| * | |||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||
| * SUCH DAMAGE. | |||
| * ==================================================================== | |||
| * | |||
| * This software consists of voluntary contributions made by many | |||
| * individuals on behalf of the Apache Software Foundation. For more | |||
| * information on the Apache Software Foundation, please see | |||
| * <http://www.apache.org/>. | |||
| */ | |||
| package org.apache.ant.common.service; | |||
| import org.apache.ant.common.input.InputRequest; | |||
| import org.apache.ant.common.util.ExecutionException; | |||
| /** | |||
| * Service interface for input management | |||
| * | |||
| * @author Conor MacNeill | |||
| * @created 30 April 2002 | |||
| */ | |||
| public interface InputService { | |||
| /** | |||
| * Handle an input request | |||
| * | |||
| * @param request an input request | |||
| * @exception ExecutionException if the request cannot be handled | |||
| */ | |||
| void handleInput(InputRequest request) throws ExecutionException; | |||
| } | |||