diff --git a/proposal/sandbox/embed/AntBean.java b/proposal/sandbox/embed/AntBean.java
deleted file mode 100644
index b2170c0cb..000000000
--- a/proposal/sandbox/embed/AntBean.java
+++ /dev/null
@@ -1,610 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000-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
- *
Takes the "find" property as a suffix to append to each - * parent directory in seach of a build file. Once the - * root of the file-system has been reached an exception - * is thrown. - */ - public File getBuildFile() - throws BuildException - { - // if buildFile was not specified on the command line, - if (buildFile == null) { - // but -find then search for it - if (searchForThis != null) { - buildFile = findBuildFile(System.getProperty("user.dir"), - searchForThis); - } else { - buildFile = new File(DEFAULT_BUILD_FILENAME); - } - } - getProject().setUserProperty("ant.file" , buildFile.getAbsolutePath() ); - return buildFile; - } - - /** Return an (initialized) project constructed using the current - * settings. - * This will not load the build.xml file - you can 'load' the - * project object with tasks manually or execute 'standalone' - * tasks in the context of the project. - */ - public Project getProject() { - if( newProject!=null ) - return newProject; - loadProperties(); - - helper=ProjectHelper.getProjectHelper(); - newProject = helper.createProject(coreLoader); - newProject.setCoreLoader(coreLoader); - - addBuildListeners(newProject); - - newProject.fireBuildStarted(); - - newProject.init(); - newProject.setUserProperty("ant.version", getAntVersion()); - - // set user-define properties - Enumeration e = definedProps.keys(); - while (e.hasMoreElements()) { - String arg = (String)e.nextElement(); - String value = (String)definedProps.get(arg); - newProject.setUserProperty(arg, value); - } - - return newProject; - } - - private static String antVersion = null; - - /** @experimental - * Ant version should be combined with the ProjectHelper version and type, - * since it'll determine the set of features supported by ant ( at the xml - * level ). - */ - public static synchronized String getAntVersion() throws BuildException { - if (antVersion == null) { - try { - Properties props = new Properties(); - InputStream in = - Main.class.getResourceAsStream("/org/apache/tools/ant/version.txt"); - props.load(in); - in.close(); - - String lSep = System.getProperty("line.separator"); - StringBuffer msg = new StringBuffer(); - msg.append("Apache Ant version "); - msg.append(props.getProperty("VERSION")); - msg.append(" compiled on "); - msg.append(props.getProperty("DATE")); - antVersion = msg.toString(); - } catch (IOException ioe) { - throw new BuildException("Could not load the version information:" - + ioe.getMessage()); - } catch (NullPointerException npe) { - throw new BuildException("Could not load the version information."); - } - } - return antVersion; - } - - - - // -------------------- Bean methods -------------------- - Throwable error = null; - - - /** Clean up allocated resources and finish the processing of the - * current Project. - */ - public void done() { - newProject.fireBuildFinished(error); - } - - - /** - * Process an XML file and execute the targets. - * - * This method can be called multiple times, eventually after setting different - * build file and different targets - all executions will happen in the - * same execution context ( project ). - */ - public void processBuildXml() throws BuildException { - checkBuildFile(); - File buildFile=getBuildFile(); - Project newProject=getProject(); - - // first use the ProjectHelper to create the project object - // from the given build file. - String noParserMessage = - "No JAXP compliant XML parser found. Please visit http://xml.apache.org for a suitable parser"; - try { - Class.forName("javax.xml.parsers.SAXParserFactory"); - helper.parse(newProject, buildFile); - } catch (NoClassDefFoundError ncdfe) { - throw new BuildException(noParserMessage, ncdfe); - } catch (ClassNotFoundException cnfe) { - throw new BuildException(noParserMessage, cnfe); - } catch (NullPointerException npe) { - throw new BuildException(noParserMessage, npe); - } - - // make sure that we have a target to execute - if (targets.size() == 0) { - targets.addElement(newProject.getDefaultTarget()); - } - - newProject.executeTargets(targets); - } - - public void execute() throws BuildException { - - try { - if( redirectOutput ) { - pushSystemOut(); - } - - processBuildXml(); - } catch(RuntimeException exc) { - error = exc; - throw exc; - } catch(Error err) { - error = err; - throw err; - } finally { - done(); - if( redirectOutput ) - popSystemOut(); - } - } - - // -------------------- Private methods -------------------- - - private void checkBuildFile() throws BuildException { - File buildFile=getBuildFile(); - - // make sure buildfile exists - if (!buildFile.exists()) { - System.out.println("Buildfile: " + buildFile + " does not exist!"); - throw new BuildException("Build failed"); - } - - // make sure it's not a directory (this falls into the ultra - // paranoid lets check everything catagory - if (buildFile.isDirectory()) { - System.out.println("What? Buildfile: " + buildFile + " is a dir!"); - throw new BuildException("Build failed"); - } - - // track when we started - if (msgOutputLevel >= Project.MSG_INFO) { - System.out.println("Buildfile: " + buildFile); - } - } - - private PrintStream oldErr=null; - private PrintStream oldOut=null; - private SecurityManager oldsm = null; - - private void pushSystemOut() { - oldErr = System.err; - oldOut = System.out; - - // use a system manager that prevents from System.exit() - // only in JDK > 1.1 - if ( !Project.JAVA_1_0.equals(Project.getJavaVersion()) && - !Project.JAVA_1_1.equals(Project.getJavaVersion()) ){ - oldsm = System.getSecurityManager(); - - //SecurityManager can not be installed here for backwards - //compatability reasons (PD). Needs to be loaded prior to - //ant class if we are going to implement it. - //System.setSecurityManager(new NoExitSecurityManager()); - } - System.setOut(new PrintStream(new DemuxOutputStream(getProject(), false))); - System.setErr(new PrintStream(new DemuxOutputStream(getProject(), true))); - } - - private void popSystemOut() { - // put back the original security manager - //The following will never eval to true. (PD) - if (oldsm != null){ - System.setSecurityManager(oldsm); - } - - if( oldOut!=null && oldErr!=null ) { - System.setOut(oldOut); - System.setErr(oldErr); - } - } - - protected void addBuildListeners(Project newProject) { - - // Add the default listener - newProject.addBuildListener(createLogger()); - - for (int i = 0; i < listeners.size(); i++) { - String className = (String) listeners.elementAt(i); - try { - BuildListener listener = - (BuildListener) Class.forName(className).newInstance(); - newProject.addBuildListener(listener); - } - catch(Throwable exc) { - throw new BuildException("Unable to instantiate listener " + className, exc); - } - } - } - - /** - * Creates the default build logger for sending build events to the ant log. - */ - protected BuildLogger createLogger() { - BuildLogger logger = null; - if (loggerClassname != null) { - try { - logger = (BuildLogger)(Class.forName(loggerClassname).newInstance()); - } catch (ClassCastException e) { - System.err.println("The specified logger class " + loggerClassname + - " does not implement the BuildLogger interface"); - throw new RuntimeException(); - } catch (Exception e) { - System.err.println("Unable to instantiate specified logger class " + - loggerClassname + " : " + e.getClass().getName()); - throw new RuntimeException(); - } - } - else { - logger = new DefaultLogger(); - } - - logger.setMessageOutputLevel(msgOutputLevel); - logger.setOutputPrintStream(out); - logger.setErrorPrintStream(err); - logger.setEmacsMode(emacsMode); - - return logger; - } - - /** Load all propertyFiles - */ - private void loadProperties() - { - // Load the property files specified by -propertyfile - for (int propertyFileIndex=0; - propertyFileIndex < propertyFiles.size(); - propertyFileIndex++) { - String filename = (String) propertyFiles.elementAt(propertyFileIndex); - Properties props = new Properties(); - FileInputStream fis = null; - try { - fis = new FileInputStream(filename); - props.load(fis); - } - catch (IOException e) { - System.out.println("Could not load property file " - + filename + ": " + e.getMessage()); - } finally { - if (fis != null){ - try { - fis.close(); - } catch (IOException e){ - } - } - } - - // ensure that -D properties take precedence - Enumeration propertyNames = props.propertyNames(); - while (propertyNames.hasMoreElements()) { - String name = (String) propertyNames.nextElement(); - if (definedProps.getProperty(name) == null) { - definedProps.put(name, props.getProperty(name)); - } - } - } - } - - // -------------------- XXX Move to FileUtil -------------------- - - /** - * Helper to get the parent file for a given file. - * - *
Added to simulate File.getParentFile() from JDK 1.2. - * - * @param file File - * @return Parent file or null if none - */ - private File getParentFile(File file) { - String filename = file.getAbsolutePath(); - file = new File(filename); - filename = file.getParent(); - - if (filename != null && msgOutputLevel >= Project.MSG_VERBOSE) { - System.out.println("Searching in "+filename); - } - - return (filename == null) ? null : new File(filename); - } - - /** - * Search parent directories for the build file. - * - *
Takes the given target as a suffix to append to each
- * parent directory in seach of a build file. Once the
- * root of the file-system has been reached an exception
- * is thrown.
- *
- * @param suffix Suffix filename to look for in parents.
- * @return A handle to the build file
- *
- * @exception BuildException Failed to locate a build file
- */
- private File findBuildFile(String start, String suffix) throws BuildException {
- if (msgOutputLevel >= Project.MSG_INFO) {
- System.out.println("Searching for " + suffix + " ...");
- }
-
- File parent = new File(new File(start).getAbsolutePath());
- File file = new File(parent, suffix);
-
- // check if the target file exists in the current directory
- while (!file.exists()) {
- // change to parent directory
- parent = getParentFile(parent);
-
- // if parent is null, then we are at the root of the fs,
- // complain that we can't find the build file.
- if (parent == null) {
- throw new BuildException("Could not locate a build file!");
- }
-
- // refresh our file handle
- file = new File(parent, suffix);
- }
-
- return file;
- }
-
-}
diff --git a/proposal/sandbox/embed/Main.java b/proposal/sandbox/embed/Main.java
deleted file mode 100644
index cc62e0997..000000000
--- a/proposal/sandbox/embed/Main.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000-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
- *
- * If you integrating Ant into some other tool, this is not the class
- * to use as an entry point. Please see the source code of this
- * class to see how it manipulates the Ant project classes.
- *
- * @author duncan@x180.com
- */
-public class Main {
-
- private AntBean ant=new AntBean();
-
- /**
- * Indicates if this ant should be run.
- */
- private boolean readyToRun = false;
-
- /**
- * Indicates we should only parse and display the project help information
- */
- private boolean projectHelp = false;
-
- /**
- * Prints the message of the Throwable if it's not null.
- */
- private static void printMessage(Throwable t) {
- String message = t.getMessage();
- if (message != null) {
- System.err.println(message);
- }
- }
-
- /**
- * Entry point method.
- */
- public static void start(String[] args, Properties additionalUserProperties,
- ClassLoader coreLoader) {
- Main m = null;
-
- try {
- m = new Main(args);
- } catch(Throwable exc) {
- printMessage(exc);
- System.exit(1);
- }
- AntBean ant=m.ant;
- ant.setCoreLoader( coreLoader );
-
- if (additionalUserProperties != null) {
- for (Enumeration e = additionalUserProperties.keys(); e.hasMoreElements(); ) {
- String key = (String) e.nextElement();
- String property = additionalUserProperties.getProperty(key);
- ant.setUserProperty(key, property);
- }
- }
-
- try {
- Project project=ant.getProject();
-
- ant.execute();
-
- System.exit(0);
- } catch (BuildException be) {
- // ?? What is that, and how should it be implemented
- // XXX if (m.err != System.err) {
- printMessage(be);
- //}
- System.exit(1);
- } catch(Throwable exc) {
- exc.printStackTrace();
- printMessage(exc);
- System.exit(1);
- }
- }
-
-
-
- /**
- * Command line entry point. This method kicks off the building
- * of a project object and executes a build using either a given
- * target or the default target.
- *
- * @param args Command line args.
- */
- public static void main(String[] args) {
- start(args, null, null);
- }
-
- protected Main(String[] args) throws BuildException {
-
- String searchForThis = null;
-
- // cycle through given args
-
- for (int i = 0; i < args.length; i++) {
- String arg = args[i];
-
- if (arg.equals("-help")) {
- printUsage();
- return;
- } else if (arg.equals("-version")) {
- printVersion();
- return;
- } else if (arg.equals("-quiet") || arg.equals("-q")) {
- ant.setOutputLevel( Project.MSG_WARN );
- } else if (arg.equals("-verbose") || arg.equals("-v")) {
- printVersion();
- ant.setOutputLevel( Project.MSG_VERBOSE );
- } else if (arg.equals("-debug")) {
- printVersion();
- ant.setOutputLevel( Project.MSG_DEBUG );
- } else if (arg.equals("-logfile") || arg.equals("-l")) {
- try {
- ant.setLogfile( args[i+1] );
- i++;
- } catch (ArrayIndexOutOfBoundsException aioobe) {
- String msg = "You must specify a log file when " +
- "using the -log argument";
- System.out.println(msg);
- return;
- }
- } else if (arg.equals("-buildfile") || arg.equals("-file") || arg.equals("-f")) {
- try {
- ant.setBuildfile( args[i+1] );
- i++;
- } catch (ArrayIndexOutOfBoundsException aioobe) {
- String msg = "You must specify a buildfile when " +
- "using the -buildfile argument";
- System.out.println(msg);
- return;
- }
- } else if (arg.equals("-listener")) {
- try {
- ant.addListener(args[i+1]);
- i++;
- } catch (ArrayIndexOutOfBoundsException aioobe) {
- String msg = "You must specify a classname when " +
- "using the -listener argument";
- System.out.println(msg);
- return;
- }
- } else if (arg.startsWith("-D")) {
-
- /* Interestingly enough, we get to here when a user
- * uses -Dname=value. However, in some cases, the JDK
- * goes ahead * and parses this out to args
- * {"-Dname", "value"}
- * so instead of parsing on "=", we just make the "-D"
- * characters go away and skip one argument forward.
- *
- * I don't know how to predict when the JDK is going
- * to help or not, so we simply look for the equals sign.
- */
-
- String name = arg.substring(2, arg.length());
- String value = null;
- int posEq = name.indexOf("=");
- if (posEq > 0) {
- value = name.substring(posEq+1);
- name = name.substring(0, posEq);
- } else if (i < args.length-1) {
- value = args[++i];
- }
-
- ant.setUserProperty(name, value);
-
- } else if (arg.equals("-logger")) {
- try {
- ant.setLogger( args[++i] );
- } catch (ArrayIndexOutOfBoundsException aioobe) {
- System.out.println("You must specify a classname when " +
- "using the -logger argument");
- return;
- }
- } else if (arg.equals("-emacs")) {
- ant.setEmacs( true );
- } else if (arg.equals("-projecthelp")) {
- // set the flag to display the targets and quit
- projectHelp = true;
- } else if (arg.equals("-find")) {
- // eat up next arg if present, default to build.xml
- if (i < args.length-1) {
- ant.setFind( args[++i] );
- } else {
- ant.setFind( null );
- }
- } else if (arg.startsWith("-propertyfile")) {
- try {
- ant.addPropertyfile( args[i+1] );
- i++;
- } catch (ArrayIndexOutOfBoundsException aioobe) {
- String msg = "You must specify a property filename when " +
- "using the -propertyfile argument";
- System.out.println(msg);
- return;
- }
- } else if (arg.startsWith("-")) {
- // we don't have any more args to recognize!
- String msg = "Unknown argument: " + arg;
- System.out.println(msg);
- printUsage();
- return;
- } else {
- // if it's no other arg, it may be the target
- ant.addTarget(arg);
- }
- }
-
- readyToRun = true;
- }
-
-
- protected void addBuildListeners(Project project) {
- ant.addBuildListeners( project );
- }
-
- /**
- * Prints the usage of how to use this class to System.out
- */
- private static void printUsage() {
- String lSep = System.getProperty("line.separator");
- StringBuffer msg = new StringBuffer();
- msg.append("ant [options] [target [target2 [target3] ...]]" + lSep);
- msg.append("Options: " + lSep);
- msg.append(" -help print this message" + lSep);
- msg.append(" -projecthelp print project help information" + lSep);
- msg.append(" -version print the version information and exit" + lSep);
- msg.append(" -quiet be extra quiet" + lSep);
- msg.append(" -verbose be extra verbose" + lSep);
- msg.append(" -debug print debugging information" + lSep);
- msg.append(" -emacs produce logging information without adornments" + lSep);
- msg.append(" -logfile