conor 02/04/29 08:29:12
Modified: proposal/mutant build.xml
proposal/mutant/build ant1compat.xml
proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant
Project.java
proposal/mutant/src/java/bootstrap/org/apache/ant/builder
Builder.java
Added: proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution
CoreInputService.java
proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant
Ant1InputHandler.java
proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/input
InputRequest.java
proposal/mutant/src/java/common/org/apache/ant/common/service
InputService.java
proposal/mutant/src/java/common/org/apache/ant/common/input
InputRequest.java
Log:
Input Service for mutant
Revision Changes Path
1.23 +2 -2 jakarta-ant/proposal/mutant/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/build.xml,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -w -u -r1.22 -r1.23
--- build.xml 16 Apr 2002 14:07:46 -0000 1.22
+++ build.xml 29 Apr 2002 15:29:11 -0000 1.23
@@ -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">
1.15 +2 -1 jakarta-ant/proposal/mutant/build/ant1compat.xml
Index: ant1compat.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/build/ant1compat.xml,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -w -u -r1.14 -r1.15
--- ant1compat.xml 12 Apr 2002 14:59:56 -0000 1.14
+++ ant1compat.xml 29 Apr 2002 15:29:11 -0000 1.15
@@ -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>
1.1
jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreInputService.java
Index: CoreInputService.java
===================================================================
/*
* 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 [EMAIL PROTECTED]
*
* 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
}
}
1.21 +92 -67
jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java
Index: Project.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Project.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -w -u -r1.20 -r1.21
--- Project.java 11 Apr 2002 09:31:06 -0000 1.20
+++ Project.java 29 Apr 2002 15:29:12 -0000 1.21
@@ -69,8 +69,10 @@
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 @@
/** 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;
@@ -207,32 +212,6 @@
}
/**
- * 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.");
- }
-
-
- /**
- * 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
*
* @return a string indicating the Java version
@@ -242,8 +221,8 @@
}
/**
- * 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 @@
*
* 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
@@ -285,6 +264,31 @@
}
/**
+ * 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
*
* @param description text
@@ -358,19 +362,19 @@
* 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.
+ * 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).
+ * @return a map of from task name to implementing class (String to
+ * Class).
*/
public Hashtable getTaskDefinitions() {
return taskClassDefinitions;
@@ -534,8 +538,8 @@
}
/**
- * 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.
@@ -649,8 +653,8 @@
}
/**
- * 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 @@
/**
* 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
@@ -787,8 +791,8 @@
* 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>.
+ * <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 @@
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 @@
}
/**
- * 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 @@
}
/**
- * 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 @@
*
* @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 @@
*
* @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.
*/
1.1
jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1InputHandler.java
Index: Ant1InputHandler.java
===================================================================
/*
* 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 [EMAIL PROTECTED]
*
* 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);
}
}
}
1.1
jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/input/InputRequest.java
Index: InputRequest.java
===================================================================
/*
* 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 [EMAIL PROTECTED]
*
* 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:[EMAIL PROTECTED]">Stefan Bodewig</a>
* @version $Revision: 1.1 $
* @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);
}
}
1.16 +6 -0
jakarta-ant/proposal/mutant/src/java/bootstrap/org/apache/ant/builder/Builder.java
Index: Builder.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/mutant/src/java/bootstrap/org/apache/ant/builder/Builder.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -w -u -r1.15 -r1.16
--- Builder.java 16 Apr 2002 14:07:46 -0000 1.15
+++ Builder.java 29 Apr 2002 15:29:12 -0000 1.16
@@ -87,6 +87,9 @@
/** 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 @@
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 @@
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"));
1.1
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/InputService.java
Index: InputService.java
===================================================================
/*
* 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 [EMAIL PROTECTED]
*
* 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;
}
1.1
jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/input/InputRequest.java
Index: InputRequest.java
===================================================================
/*
* 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 [EMAIL PROTECTED]
*
* 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:[EMAIL PROTECTED]">Stefan Bodewig</a>
* @version $Revision: 1.1 $
* @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;
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>