git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277905 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -289,6 +289,7 @@ public class ExecTask extends Task { | |||
| /** | |||
| * Indicates whether to attempt to resolve the executable to a | |||
| * file. | |||
| * @return the resolveExecutable flag | |||
| * | |||
| * @since Ant 1.6 | |||
| */ | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2000,2002,2004 The Apache Software Foundation | |||
| * Copyright 2000,2002,2004-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -34,6 +34,7 @@ public interface ExecuteStreamHandler { | |||
| * | |||
| * @param os output stream to write to the standard input stream of the | |||
| * subprocess | |||
| * @throws IOException on error | |||
| */ | |||
| void setProcessInputStream(OutputStream os) throws IOException; | |||
| @@ -41,6 +42,7 @@ public interface ExecuteStreamHandler { | |||
| * Install a handler for the error stream of the subprocess. | |||
| * | |||
| * @param is input stream to read from the error stream from the subprocess | |||
| * @throws IOException on error | |||
| */ | |||
| void setProcessErrorStream(InputStream is) throws IOException; | |||
| @@ -48,11 +50,13 @@ public interface ExecuteStreamHandler { | |||
| * Install a handler for the output stream of the subprocess. | |||
| * | |||
| * @param is input stream to read from the error stream from the subprocess | |||
| * @throws IOException on error | |||
| */ | |||
| void setProcessOutputStream(InputStream is) throws IOException; | |||
| /** | |||
| * Start handling of the streams. | |||
| * @throws IOException on error | |||
| */ | |||
| void start() throws IOException; | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2000-2004 The Apache Software Foundation | |||
| * Copyright 2000-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -107,6 +107,7 @@ public class ExecuteWatchdog implements TimeoutObserver { | |||
| /** | |||
| * Called after watchdog has finished. | |||
| * @param w the watchdog | |||
| */ | |||
| public void timeoutOccured(Watchdog w) { | |||
| try { | |||
| @@ -63,7 +63,7 @@ public class Expand extends Task { | |||
| private String encoding = "UTF8"; | |||
| /** Error message when more that one mapper is defined */ | |||
| public static final String ERROR_MULTIPLE_MAPPERS = "Cannot define more than one mapper"; | |||
| private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | |||
| /** | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2000-2004 The Apache Software Foundation | |||
| * Copyright 2000-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -63,6 +63,10 @@ public class Filter extends Task { | |||
| this.filtersFile = filtersFile; | |||
| } | |||
| /** | |||
| * Execute the task. | |||
| * @throws BuildException on error | |||
| */ | |||
| public void execute() throws BuildException { | |||
| boolean isFiltersFromFile = | |||
| filtersFile != null && token == null && value == null; | |||
| @@ -84,6 +88,10 @@ public class Filter extends Task { | |||
| } | |||
| } | |||
| /** | |||
| * Read the filters. | |||
| * @throws BuildException on error | |||
| */ | |||
| protected void readFilters() throws BuildException { | |||
| log("Reading filters from " + filtersFile, Project.MSG_VERBOSE); | |||
| getProject().getGlobalFilterSet().readFiltersFromFile(filtersFile); | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2000-2002,2004 The Apache Software Foundation | |||
| * Copyright 2000-2002,2004-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -37,10 +37,17 @@ public class GUnzip extends Unpack { | |||
| private static final String DEFAULT_EXTENSION = ".gz"; | |||
| /** | |||
| * Get the default extension. | |||
| * @return the value ".gz" | |||
| */ | |||
| protected String getDefaultExtension() { | |||
| return DEFAULT_EXTENSION; | |||
| } | |||
| /** | |||
| * Implement the gunzipping. | |||
| */ | |||
| protected void extract() { | |||
| if (source.lastModified() > dest.lastModified()) { | |||
| log("Expanding " + source.getAbsolutePath() + " to " | |||
| @@ -32,30 +32,57 @@ import org.apache.tools.ant.util.JavaEnvUtils; | |||
| */ | |||
| public class GenerateKey extends Task { | |||
| /** | |||
| * A DistinguishedName parameter. | |||
| * This is a nested element in a dname nested element. | |||
| */ | |||
| public static class DnameParam { | |||
| private String name; | |||
| private String value; | |||
| /** | |||
| * Set the name attribute. | |||
| * @param name a <code>String</code> value | |||
| */ | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| /** | |||
| * Get the name attribute. | |||
| * @return the name. | |||
| */ | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| /** | |||
| * Set the value attribute. | |||
| * @param value a <code>String</code> value | |||
| */ | |||
| public void setValue(String value) { | |||
| this.value = value; | |||
| } | |||
| /** | |||
| * Get the value attribute. | |||
| * @return the value. | |||
| */ | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| } | |||
| /** | |||
| * A class corresponding to the dname nested element. | |||
| */ | |||
| public static class DistinguishedName { | |||
| private Vector params = new Vector(); | |||
| /** | |||
| * Create a param nested element. | |||
| * @return a DnameParam object to be configured. | |||
| */ | |||
| public Object createParam() { | |||
| DnameParam param = new DnameParam(); | |||
| params.addElement(param); | |||
| @@ -63,10 +90,21 @@ public class GenerateKey extends Task { | |||
| return param; | |||
| } | |||
| /** | |||
| * Get the nested parameters. | |||
| * @return an enumeration of the nested parameters. | |||
| */ | |||
| public Enumeration getParams() { | |||
| return params.elements(); | |||
| } | |||
| /** | |||
| * Generate a string rep of this distinguished name. | |||
| * The format is each of the parameters (name = value) | |||
| * separated by ','. | |||
| * This is used on the command line. | |||
| * @return a string rep of this name | |||
| */ | |||
| public String toString() { | |||
| final int size = params.size(); | |||
| final StringBuffer sb = new StringBuffer(); | |||
| @@ -87,6 +125,13 @@ public class GenerateKey extends Task { | |||
| return sb.toString(); | |||
| } | |||
| /** | |||
| * Encode a name or value. | |||
| * The encoded result is the same as the input string | |||
| * except that each ',' is replaced by a '\,'. | |||
| * @param string the value to be encoded | |||
| * @return the encoded value. | |||
| */ | |||
| public String encode(final String string) { | |||
| int end = string.indexOf(','); | |||
| @@ -264,6 +309,10 @@ public class GenerateKey extends Task { | |||
| this.verbose = verbose; | |||
| } | |||
| /** | |||
| * Execute the task. | |||
| * @throws BuildException on error | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (null == alias) { | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2002-2004 The Apache Software Foundation | |||
| * Copyright 2002-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -151,7 +151,7 @@ public abstract class JDBCTask extends Task { | |||
| * Caching loaders / driver. This is to avoid | |||
| * getting an OutOfMemoryError when calling this task | |||
| * multiple times in a row; default: true | |||
| * @param enable | |||
| * @param enable a <code>boolean</code> value | |||
| */ | |||
| public void setCaching(boolean enable) { | |||
| caching = enable; | |||
| @@ -159,6 +159,7 @@ public abstract class JDBCTask extends Task { | |||
| /** | |||
| * Add a path to the classpath for loading the driver. | |||
| * @return a path to be configured | |||
| */ | |||
| public Path createClasspath() { | |||
| if (this.classpath == null) { | |||
| @@ -170,6 +171,7 @@ public abstract class JDBCTask extends Task { | |||
| /** | |||
| * Set the classpath for loading the driver | |||
| * using the classpath reference. | |||
| * @param r a reference to a classpath | |||
| */ | |||
| public void setClasspathRef(Reference r) { | |||
| createClasspath().setRefid(r); | |||
| @@ -228,6 +230,8 @@ public abstract class JDBCTask extends Task { | |||
| /** | |||
| * Verify we are connected to the correct RDBMS | |||
| * @param conn the jdbc connection | |||
| * @return true if we are connected to the correct RDBMS | |||
| */ | |||
| protected boolean isValidRdbms(Connection conn) { | |||
| if (rdbms == null && version == null) { | |||
| @@ -268,10 +272,18 @@ public abstract class JDBCTask extends Task { | |||
| return true; | |||
| } | |||
| /** | |||
| * Get the cache of loaders and drivers. | |||
| * @return a hashtable | |||
| */ | |||
| protected static Hashtable getLoaderMap() { | |||
| return loaderMap; | |||
| } | |||
| /** | |||
| * Get the classloader used to create a driver. | |||
| * @return the classloader | |||
| */ | |||
| protected AntClassLoader getLoader() { | |||
| return loader; | |||
| } | |||
| @@ -380,6 +392,10 @@ public abstract class JDBCTask extends Task { | |||
| } | |||
| /** | |||
| * Set the caching attribute. (!) | |||
| * @param value a <code>boolean</code> value | |||
| */ | |||
| public void isCaching(boolean value) { | |||
| caching = value; | |||
| } | |||