Remove Ant extensions
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 4 Jul 2006 11:57:34 +0000 (11:57 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 4 Jul 2006 11:57:34 +0000 (11:57 +0000)
Use ant extensions library

git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@1950 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

.classpath
build.xml
src/edu/internet2/middleware/shibboleth/utils/ant/URLConvert.java [deleted file]
src/edu/internet2/middleware/shibboleth/utils/ant/XInput.java [deleted file]
src/edu/internet2/middleware/shibboleth/utils/ant/XInputHandler.java [deleted file]
src/edu/internet2/middleware/shibboleth/utils/ant/XInputOption.java [deleted file]
src/edu/internet2/middleware/shibboleth/utils/ant/XInputRequest.java [deleted file]
src/edu/internet2/middleware/shibboleth/utils/ant/XMenuInputHandler.java [deleted file]
src/edu/internet2/middleware/shibboleth/utils/ant/XMultipleChoiceInputRequest.java [deleted file]

index 38d78de..3096dbd 100644 (file)
@@ -33,5 +33,6 @@
        <classpathentry kind="lib" path="webApplication/WEB-INF/lib/commons-codec-1.3.jar"/>
        <classpathentry kind="lib" path="lib/commons-io-1.1.jar"/>
        <classpathentry kind="lib" path="webApplication/WEB-INF/lib/bsh-2.0b1.jar"/>
+       <classpathentry kind="lib" path="lib/antext-04Jul2006.jar"/>
        <classpathentry kind="output" path="webApplication/WEB-INF/classes"/>
 </classpath>
index 25c1f99..8919086 100755 (executable)
--- a/build.xml
+++ b/build.xml
        <property name="year" value="2002-2005"/>
        <property name="copyright" value="Copyright &#169; ${year} UCAID. All Rights Reserved."/>
 
-
        <!-- antcontrib tasks -->
        <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${buildlibs}/ant-contrib.jar"/>
 
        <!-- Import the tasks for building custom extensions -->
        <import file="${custom}/extension-build.xml"/>
 
+       
        <!-- Construct the CLASSPATH -->
        <path id="build.path">
                <pathelement location="${build}" />
-               <fileset dir="${endorsed}">
-                       <include name="**/*.jar" />
-               </fileset>
-               <fileset dir="${libdir}">
-                       <include name="**/*.jar" />
-               </fileset>
-               <fileset dir="${buildlibs}">
-                       <include name="**/*.jar" />
-               </fileset>
+               <fileset dir="${endorsed}" includes="**/*.jar" />
+               <fileset dir="${libdir}" includes="**/*.jar" />
+               <fileset dir="${buildlibs}" includes="**/*.jar" />
+       </path>
+       
+
+       <!-- Add to the classpath for unit tests -->
+       <path id="test.path">
+               <path refid="build.path"/>
+               <pathelement location="${tests}"/>
        </path>
 
 
@@ -66,7 +67,7 @@
 
 
        <!-- This target should be run before checking code into the repository -->
-       <target name="pre-checkin" depends="compile, test-all, clean-all" />
+       <target name="pre-checkin" depends="compile, test, clean-all" />
 
 
        <!-- Compile classes and move them to ${build} -->
                <jar jarfile="${distlibs}/shib-util.jar" basedir="${build}" />
        </target>
 
-       <!-- Cleanup after the build, test, and distribution processes -->
-       <target name="clean" depends="clean-all" />
-
-    <target name="clean-all" depends="clean-build, clean-dist, clean-test, clean-javadocs, clean-util"/>
-       
-    <target name="clean-build">
-               <delete dir="${build}" />
-               <delete dir="${custom.libs}"/>
-               <delete dir="${custom.webapges}"/>
-           <antcall target="ext-invoke">
-               <param name="exts.dir" value="${custom}"/>
-            <param name="ext.build.function" value="ext-clean-build"/>   
-           </antcall>
-       </target>
-       
-    <target name="clean-test">
-               <delete>
-                       <fileset dir="${root}">
-                               <include name="**/TEST*.txt" />
-                       </fileset>
-               </delete>
-       </target>
-       
-    <target name="clean-dist">
-               <delete dir="${dist}" />
-        <antcall target="ext-invoke">
-            <param name="exts.dir" value="${custom}"/>
-            <param name="ext.build.function" value="ext-clean-dist"/>   
-        </antcall>   
-       </target>
-       
-    <target name="clean-javadocs">
-               <delete dir="${javadocs}" />
-        <antcall target="ext-invoke">
-            <param name="exts.dir" value="${custom}"/>
-            <param name="ext.build.function" value="ext-clean-javadocs"/>   
-        </antcall>
-       </target>
        
-    <target name="clean-util">
-               <delete>
-                       <fileset dir="${buildlibs}">
-                               <include name="shib-util.jar" />
-                       </fileset>
-               </delete>
-       </target>
-
-       <!-- Add to the classpath for unit tests -->
-       <path id="test.path">
-               <path refid="build.path"/>
-               <pathelement location="${tests}"/>
-       </path>
-
        <!-- Compile classes needed for unit testing -->
        <target name="compile-tests" depends="compile">
                <javac srcdir="${tests}" destdir="${build}" includes="**/*.java" debug="on" source="1.4">
                </javac>
        </target>
 
-       <!-- Run automated tests on compiled code -->
-       <target name="test-all" depends="test-IdP" />
-
-       <target name="test-IdP" depends="compile-tests">
+       <target name="test" depends="compile-tests">
                <junit printsummary="no" fork="yes" haltonfailure="yes" haltonerror="yes" dir="${root}">
                        <jvmarg value="-Djava.endorsed.dirs=${endorsed}" />
                        <classpath>
 
        <!-- Install Shibboleth -->
        <target name="install.init">
-               <taskdef name="xinput" classname="edu.internet2.middleware.shibboleth.utils.ant.XInput" classpath="${build}" />
-               <typedef name="xoption" classname="edu.internet2.middleware.shibboleth.utils.ant.XInputOption" classpath="${build}" />
+               <taskdef name="xinput" classname="edu.internet2.middleware.ant.XInput" classpath="${build}" />
+               <typedef name="xoption" classname="edu.internet2.middleware.ant.XInputOption" classpath="${build}" />
        </target>
 
        <target name="install.url">
-               <taskdef name="urlconvert" classname="edu.internet2.middleware.shibboleth.utils.ant.URLConvert" classpath="${build}"/>
+               <taskdef name="urlconvert" classname="edu.internet2.middleware.ant.URLConvert" classpath="${build}"/>
        </target>
 
        <target name="install" depends="init, install.init" description="Install Shibboleth">
                </propertyfile>
        </target>
        
+
+       <!-- Cleanup after the build, test, and distribution processes -->
+       <target name="clean" depends="clean-all" />
+
+    <target name="clean-all" depends="clean-build, clean-dist, clean-test, clean-javadocs, clean-util"/>
+       
+    <target name="clean-build">
+               <delete dir="${build}" />
+               <delete dir="${custom.libs}"/>
+               <delete dir="${custom.webapges}"/>
+           <antcall target="ext-invoke">
+               <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-clean-build"/>   
+           </antcall>
+       </target>
+       
+    <target name="clean-test">
+               <delete>
+                       <fileset dir="${root}">
+                               <include name="**/TEST*.txt" />
+                       </fileset>
+               </delete>
+       </target>
+       
+    <target name="clean-dist">
+               <delete dir="${dist}" />
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-clean-dist"/>   
+        </antcall>   
+       </target>
+       
+    <target name="clean-javadocs">
+               <delete dir="${javadocs}" />
+        <antcall target="ext-invoke">
+            <param name="exts.dir" value="${custom}"/>
+            <param name="ext.build.function" value="ext-clean-javadocs"/>   
+        </antcall>
+       </target>
+       
+    <target name="clean-util">
+               <delete>
+                       <fileset dir="${buildlibs}">
+                               <include name="shib-util.jar" />
+                       </fileset>
+               </delete>
+       </target>
+       
        <!-- For IDE development, run this target first to delete all
        directories generated by the install process before
        recreating and reinstalling everything. -->
                <delete dir="${idp.home}" />
                <delete dir="${tomcat.home}/webapps/${idp.webapp.name}" />
        </target>
+       
 </project>
diff --git a/src/edu/internet2/middleware/shibboleth/utils/ant/URLConvert.java b/src/edu/internet2/middleware/shibboleth/utils/ant/URLConvert.java
deleted file mode 100644 (file)
index c8fb947..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
- *
- * Licensed 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 edu.internet2.middleware.shibboleth.utils.ant;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-
-/**
- * @author Walter Hoehn
- */
-public class URLConvert extends Task {
-
-       private String addProperty;
-       private String path;
-
-       public void execute() throws BuildException {
-
-               if (addProperty != null && getProject().getProperty(addProperty) != null) {
-                       log("Skipping " + getTaskName() + " as property " + addProperty + " has already been set.");
-                       return;
-               }
-
-               if (path == null) {
-                       log("Skipping " + getTaskName() + " because path was not specified.");
-                       return;
-               }
-
-               File file = new File(path);
-               try {
-                       URL url = file.getAbsoluteFile().toURI().toURL();
-
-                       if (addProperty != null && url != null) {
-                               getProject().setNewProperty(addProperty, url.toString());
-                       }
-               } catch (MalformedURLException e) {
-                       log("Skipping " + getTaskName() + " because path (" + path + ") could not be converted to a URL.");
-                       return;
-               }
-
-       }
-
-       public void setAddProperty(String addproperty) {
-
-               this.addProperty = addproperty;
-       }
-
-       public void setPath(String path) {
-
-               this.path = path;
-       }
-
-}
diff --git a/src/edu/internet2/middleware/shibboleth/utils/ant/XInput.java b/src/edu/internet2/middleware/shibboleth/utils/ant/XInput.java
deleted file mode 100644 (file)
index b08add5..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
- *
- * Licensed 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 edu.internet2.middleware.shibboleth.utils.ant;
-
-import java.util.Vector;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.input.InputRequest;
-import org.apache.tools.ant.taskdefs.condition.Condition;
-
-/**
- * Extended version of <code>org.apache.tools.ant.taskdefs.Input</code>
- * 
- * @author Will Norris (wnorris@memphis.edu)
- */
-public class XInput extends Task implements Condition {
-
-       private Boolean caseSensitive = new Boolean(true);
-       private String validArgs = null;
-       private String message = "";
-       private String addproperty = null;
-       private String defaultValue = null;
-       private String type = "standard";
-       private Vector options = new Vector();
-       private String value = null;
-
-       public void setCaseSensitive(Boolean b) {
-
-               this.caseSensitive = b;
-       }
-
-       public Boolean getCaseSensitive() {
-
-               return this.caseSensitive;
-       }
-
-       /**
-        * Defines valid input parameters as comma separated strings. If set, input task will reject any input not defined
-        * as accepted and requires the user to reenter it. Validargs are case sensitive. If you want 'a' and 'A' to be
-        * accepted you need to define both values as accepted arguments.
-        * 
-        * @param validargs
-        *            A comma separated String defining valid input args.
-        */
-       public void setValidargs(String validArgs) {
-
-               this.validArgs = validArgs;
-       }
-
-       /**
-        * Defines the name of a property to be created from input. Behaviour is according to property task which means that
-        * existing properties cannot be overridden.
-        * 
-        * @param addproperty
-        *            Name for the property to be created from input
-        */
-       public void setAddproperty(String addproperty) {
-
-               this.addproperty = addproperty;
-       }
-
-       /**
-        * Sets the Message which gets displayed to the user during the build run.
-        * 
-        * @param message
-        *            The message to be displayed.
-        */
-       public void setMessage(String message) {
-
-               this.message = message;
-       }
-
-       /**
-        * Defines the default value of the property to be created from input. Property value will be set to default if not
-        * input is received.
-        * 
-        * @param defaultvalue
-        *            Default value for the property if no input is received
-        */
-       public void setDefaultvalue(String defaultValue) {
-
-               this.defaultValue = defaultValue;
-       }
-
-       public void setType(String type) {
-
-               this.type = type;
-       }
-
-       public void addConfiguredXoption(XInputOption option) {
-
-               if (option.getCaseSensitive() == null) {
-                       option.setCaseSensitive(getCaseSensitive());
-               }
-               if (defaultValue != null && option.acceptsInput(defaultValue)) {
-                       option.setIsDefault(true);
-               }
-
-               options.add(option);
-       }
-
-       /**
-        * Set a multiline message.
-        * 
-        * @param msg
-        *            The message to be displayed.
-        */
-       public void addText(String msg) {
-
-               message += getProject().replaceProperties(msg);
-       }
-
-       /**
-        * No arg constructor.
-        */
-       public XInput() {
-
-       }
-
-       /**
-        * Actual method executed by ant.
-        * 
-        * @throws BuildException
-        */
-       public void execute() throws BuildException {
-
-               if (addproperty != null && getProject().getProperty(addproperty) != null) {
-                       log("skipping " + getTaskName() + " as property " + addproperty + " has already been set.");
-                       return;
-               }
-
-               InputRequest request = null;
-
-               if (type.equals("menu")) {
-                       getProject().setInputHandler(new XMenuInputHandler());
-                       request = new XMultipleChoiceInputRequest(message.trim(), options);
-               } else if (type.equals("confirm")) {
-                       setCaseSensitive(new Boolean(false));
-                       addConfiguredXoption(new XInputOption("y", "y,yes,t,true", "y"));
-                       addConfiguredXoption(new XInputOption("n", "n,no,f,false", "n"));
-
-                       getProject().setInputHandler(new XInputHandler());
-                       request = new XMultipleChoiceInputRequest(message.trim(), options);
-               } else {
-                       getProject().setInputHandler(new XInputHandler());
-                       request = new XMultipleChoiceInputRequest(message.trim(), options);
-               }
-
-               getProject().getInputHandler().handleInput(request);
-
-               value = request.getInput();
-               if ((value == null || value.trim().length() == 0) && defaultValue != null) {
-                       value = defaultValue;
-               }
-               if (addproperty != null && value != null) {
-                       getProject().setNewProperty(addproperty, value);
-               }
-       }
-
-       public boolean eval() {
-
-               if (!type.equals("confirm")) { throw new BuildException(); }
-
-               execute();
-               return value.equals("y");
-       }
-
-}
diff --git a/src/edu/internet2/middleware/shibboleth/utils/ant/XInputHandler.java b/src/edu/internet2/middleware/shibboleth/utils/ant/XInputHandler.java
deleted file mode 100644 (file)
index 57bb06a..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
- *
- * Licensed 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 edu.internet2.middleware.shibboleth.utils.ant;
-
-import java.util.Iterator;
-
-import org.apache.tools.ant.input.DefaultInputHandler;
-import org.apache.tools.ant.input.InputRequest;
-
-/**
- * Extended version of <code>org.apache.tools.ant.input.DefaultInputHandler</code>.
- * 
- * @author Will Norris (wnorris@memphis.edu)
- */
-public class XInputHandler extends DefaultInputHandler {
-
-       public XInputHandler() {
-
-               super();
-
-       }
-
-       protected String getPrompt(InputRequest request) {
-
-               String prompt = request.getPrompt();
-               if (request instanceof XMultipleChoiceInputRequest) {
-                       StringBuffer sb = new StringBuffer("\n" + prompt);
-                       sb.append(" [");
-                       Iterator i = ((XMultipleChoiceInputRequest) request).getOptions().iterator();
-                       boolean first = true;
-                       while (i.hasNext()) {
-                               if (!first) {
-                                       sb.append(",");
-                               }
-                               XInputOption o = (XInputOption) i.next();
-                               sb.append(o.isDefault() ? o.displayName().toUpperCase() : o.displayName());
-                               first = false;
-                       }
-                       sb.append("]");
-                       prompt = sb.toString();
-               }
-               return prompt;
-       }
-
-}
diff --git a/src/edu/internet2/middleware/shibboleth/utils/ant/XInputOption.java b/src/edu/internet2/middleware/shibboleth/utils/ant/XInputOption.java
deleted file mode 100644 (file)
index cb9bd89..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
- *
- * Licensed 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 edu.internet2.middleware.shibboleth.utils.ant;
-
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.apache.tools.ant.ProjectComponent;
-import org.apache.tools.ant.util.StringUtils;
-
-/**
- * @author Will Norris (wnorris@memphis.edu)
- */
-public class XInputOption extends ProjectComponent {
-
-       private Boolean caseSensitive = null;
-       private String value = "";
-       private Vector validArgs = null;
-       private String displayName = null;
-       private boolean isDefault = false;
-
-       public XInputOption() {
-
-               super();
-       }
-
-       public XInputOption(String value, String validargs, String displayName) {
-
-               setValue(value);
-               setValidArgs(validargs);
-               addText(displayName);
-       }
-
-       public void setCasesensitive(boolean b) {
-
-               setCaseSensitive(new Boolean(b));
-       }
-
-       public void setCaseSensitive(Boolean b) {
-
-               this.caseSensitive = b;
-       }
-
-       public Boolean getCaseSensitive() {
-
-               return this.caseSensitive;
-       }
-
-       public void setValue(String value) {
-
-               this.value = value;
-       }
-
-       public String getValue() {
-
-               if (value == null || value.equals("")) { return displayName(); }
-
-               return this.value;
-       }
-
-       public void setValidArgs(String validargs) {
-
-               this.validArgs = StringUtils.split(validargs, ',');
-       }
-
-       public Vector getValidArgs() {
-
-               if (validArgs != null) {
-                       return this.validArgs;
-               } else {
-                       Vector v = new Vector();
-                       v.add(getValue());
-                       return v;
-               }
-       }
-
-       public void addText(String text) {
-
-               this.displayName = text;
-       }
-
-       public String displayName() {
-
-               return displayName;
-       }
-
-       public void setIsDefault(boolean b) {
-
-               this.isDefault = b;
-       }
-
-       public boolean isDefault() {
-
-               return this.isDefault;
-       }
-
-       public boolean acceptsInput(String input) {
-
-               if (input.equals("") && isDefault()) { return true; }
-
-               Iterator i = getValidArgs().iterator();
-               while (i.hasNext()) {
-                       String arg = (String) i.next();
-                       if (getCaseSensitive().booleanValue()) {
-                               if (arg.equals(input)) { return true; }
-                       } else {
-                               if (arg.equalsIgnoreCase(input)) { return true; }
-                       }
-               }
-               return false;
-       }
-}
diff --git a/src/edu/internet2/middleware/shibboleth/utils/ant/XInputRequest.java b/src/edu/internet2/middleware/shibboleth/utils/ant/XInputRequest.java
deleted file mode 100644 (file)
index ea36197..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
- *
- * Licensed 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 edu.internet2.middleware.shibboleth.utils.ant;
-
-import org.apache.tools.ant.input.InputRequest;
-
-/**
- * Extended version of <code>org.apache.tools.ant.input.InputRequest</code>
- * 
- * @author Will Norris (wnorris@memphis.edu)
- */
-public class XInputRequest extends InputRequest {
-
-       private String prompt;
-       private String input;
-
-       /**
-        * @param prompt
-        *            The prompt to show to the user. Must not be null.
-        */
-       public XInputRequest(String prompt) {
-
-               super(prompt);
-               if (prompt == null) { throw new IllegalArgumentException("prompt must not be null"); }
-
-               this.prompt = prompt;
-       }
-
-       /**
-        * Retrieves the prompt text.
-        */
-       public String getPrompt() {
-
-               return prompt;
-       }
-
-       /**
-        * Sets the user provided input.
-        */
-       public void setInput(String input) {
-
-               this.input = input;
-       }
-
-       /**
-        * Is the user input valid?
-        */
-       public boolean isInputValid() {
-
-               return true;
-       }
-
-       /**
-        * Retrieves the user input.
-        */
-       public String getInput() {
-
-               return input;
-       }
-
-}
diff --git a/src/edu/internet2/middleware/shibboleth/utils/ant/XMenuInputHandler.java b/src/edu/internet2/middleware/shibboleth/utils/ant/XMenuInputHandler.java
deleted file mode 100644 (file)
index 369a713..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
- *
- * Licensed 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 edu.internet2.middleware.shibboleth.utils.ant;
-
-import java.util.Iterator;
-
-import org.apache.tools.ant.input.DefaultInputHandler;
-import org.apache.tools.ant.input.InputRequest;
-
-/**
- * Input handler to display of a multiple choice menu
- * 
- * @author Will Norris (wnorris@memphis.edu)
- */
-public class XMenuInputHandler extends DefaultInputHandler {
-
-       /**
-        * 
-        */
-       public XMenuInputHandler() {
-
-               super();
-       }
-
-       protected String getPrompt(InputRequest request) {
-
-               String prompt = request.getPrompt();
-               if (request instanceof XMultipleChoiceInputRequest) {
-                       StringBuffer sb = new StringBuffer("\n" + prompt);
-                       sb.append("\n\n");
-                       Iterator i = ((XMultipleChoiceInputRequest) request).getOptions().iterator();
-                       boolean first = true;
-                       int count = 0;
-                       while (i.hasNext()) {
-                               if (!first) {
-                                       sb.append("\n");
-                               }
-                               count++;
-                               XInputOption o = (XInputOption) i.next();
-                               sb.append("    " + count + ") " + o.displayName());
-                               if (o.isDefault()) {
-                                       sb.append(" (default)");
-                               }
-                               first = false;
-                       }
-                       prompt = sb.toString();
-               }
-               return prompt;
-       }
-
-}
diff --git a/src/edu/internet2/middleware/shibboleth/utils/ant/XMultipleChoiceInputRequest.java b/src/edu/internet2/middleware/shibboleth/utils/ant/XMultipleChoiceInputRequest.java
deleted file mode 100644 (file)
index d48f534..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
- *
- * Licensed 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 edu.internet2.middleware.shibboleth.utils.ant;
-
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.apache.tools.ant.input.InputRequest;
-
-/**
- * @author Will Norris (wnorris@memphis.edu)
- */
-public class XMultipleChoiceInputRequest extends InputRequest {
-
-       private Vector options = null;
-
-       public XMultipleChoiceInputRequest(String prompt, Vector options) {
-
-               super(prompt);
-               if (options == null) { throw new IllegalArgumentException("choices must not be null"); }
-               this.options = options;
-       }
-
-       public Vector getOptions() {
-
-               return options;
-       }
-
-       /**
-        * @return The possible values.
-        */
-       public Vector getChoices() {
-
-               Vector choices = new Vector();
-
-               Iterator i = options.iterator();
-               while (i.hasNext()) {
-                       XInputOption o = (XInputOption) i.next();
-                       choices.add(o.displayName());
-               }
-
-               return choices;
-       }
-
-       /**
-        * @return true if the input is one of the allowed values.
-        */
-       public boolean isInputValid() {
-
-               // first check if any XInputOptions will accept the input
-               Iterator i = options.iterator();
-               while (i.hasNext()) {
-                       XInputOption o = (XInputOption) i.next();
-                       if (o.acceptsInput(getInput())) {
-                               setInput(o.getValue());
-                               return true;
-                       }
-               }
-
-               // next check if they tried to input a menu item number
-               try {
-                       Integer input = new Integer(getInput());
-                       if (input.intValue() > 0 && input.intValue() <= options.size()) {
-                               XInputOption o = (XInputOption) options.get(input.intValue() - 1);
-                               setInput(o.getValue());
-                               return true;
-                       }
-               } catch (NumberFormatException nfe) {
-                       // input was not a number
-               }
-
-               return false;
-       }
-
-}