summaryrefslogtreecommitdiff
path: root/src/main/org/apache/tools/ant/taskdefs/optional/extension
diff options
context:
space:
mode:
authorPeter Reilly <peterreilly@apache.org>2004-12-10 10:58:19 +0000
committerPeter Reilly <peterreilly@apache.org>2004-12-10 10:58:19 +0000
commit64f7d86fe1e4c58eb2bd35977e2fd3b05e9647ba (patch)
treebeaebe4830d299d62596c771e670fc1528e56faf /src/main/org/apache/tools/ant/taskdefs/optional/extension
parent0833007731e08c468319eebcda0ef776a7fefdc1 (diff)
downloadant-64f7d86fe1e4c58eb2bd35977e2fd3b05e9647ba.tar.gz
checkstyle changes
Obtained from: Kevin Jackson git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277156 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/main/org/apache/tools/ant/taskdefs/optional/extension')
-rw-r--r--src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java64
-rw-r--r--src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/LocationResolver.java32
-rw-r--r--src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java70
3 files changed, 115 insertions, 51 deletions
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java
index 5ae007af0..ee39b5ee9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java
@@ -29,63 +29,87 @@ import org.apache.tools.ant.taskdefs.optional.extension.ExtensionResolver;
*
* @version $Revision$ $Date$
*/
-public class AntResolver
- implements ExtensionResolver {
- private File m_antfile;
- private File m_destfile;
- private String m_target;
+public class AntResolver implements ExtensionResolver {
+ private File antfile;
+ private File destfile;
+ private String target;
- public void setAntfile(File antfile) {
- m_antfile = antfile;
+ /**
+ * Sets the ant file
+ * @param antfile the ant file to set
+ */
+ public void setAntfile(final File antfile) {
+ this.antfile = antfile;
}
- public void setDestfile(File destfile) {
- m_destfile = destfile;
+ /**
+ * Sets the destination file
+ * @param destfile the destination file
+ */
+ public void setDestfile(final File destfile) {
+ this.destfile = destfile;
}
+ /**
+ * Sets the target
+ * @param target the target
+ */
public void setTarget(final String target) {
- m_target = target;
+ this.target = target;
}
+ /**
+ * Returns the resolved file
+ * @param extension the extension
+ * @param project the project
+ * @return the file resolved
+ * @throws BuildException if the file cannot be resolved
+ */
public File resolve(final Extension extension,
- final Project project)
- throws BuildException {
+ final Project project) throws BuildException {
validate();
final Ant ant = (Ant) project.createTask("ant");
ant.setInheritAll(false);
- ant.setAntfile(m_antfile.getName());
+ ant.setAntfile(antfile.getName());
try {
final File dir =
- m_antfile.getParentFile().getCanonicalFile();
+ antfile.getParentFile().getCanonicalFile();
ant.setDir(dir);
} catch (final IOException ioe) {
throw new BuildException(ioe.getMessage(), ioe);
}
- if (null != m_target) {
- ant.setTarget(m_target);
+ if (null != target) {
+ ant.setTarget(target);
}
ant.execute();
- return m_destfile;
+ return destfile;
}
+ /*
+ * Validates URL
+ */
private void validate() {
- if (null == m_antfile) {
+ if (null == antfile) {
final String message = "Must specify Buildfile";
throw new BuildException(message);
}
- if (null == m_destfile) {
+ if (null == destfile) {
final String message = "Must specify destination file";
throw new BuildException(message);
}
}
+ /**
+ * Returns a string representation
+ * @return the string representation
+ */
public String toString() {
- return "Ant[" + m_antfile + "==>" + m_destfile + "]";
+ return "Ant[" + antfile + "==>" + destfile + "]";
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/LocationResolver.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/LocationResolver.java
index fd4b4de71..33eda438e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/LocationResolver.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/LocationResolver.java
@@ -27,26 +27,38 @@ import org.apache.tools.ant.taskdefs.optional.extension.ExtensionResolver;
*
* @version $Revision$ $Date$
*/
-public class LocationResolver
- implements ExtensionResolver {
- private String m_location;
+public class LocationResolver implements ExtensionResolver {
+ private String location;
+ /**
+ * Sets the location for this resolver
+ * @param location the location
+ */
public void setLocation(final String location) {
- m_location = location;
+ this.location = location;
}
+ /**
+ * Returns the resolved file
+ * @param extension the extension
+ * @param project the project
+ * @return the file resolved
+ * @throws BuildException if no location is set
+ */
public File resolve(final Extension extension,
- final Project project)
- throws BuildException {
- if (null == m_location) {
+ final Project project) throws BuildException {
+ if (null == location) {
final String message = "No location specified for resolver";
throw new BuildException(message);
}
- return project.resolveFile(m_location);
+ return project.resolveFile(location);
}
-
+ /**
+ * Returns a string representation of the Location
+ * @return the string representation
+ */
public String toString() {
- return "Location[" + m_location + "]";
+ return "Location[" + location + "]";
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java
index bf096fc29..fa22d336e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java
@@ -29,45 +29,66 @@ import org.apache.tools.ant.taskdefs.optional.extension.ExtensionResolver;
*
* @version $Revision$ $Date$
*/
-public class URLResolver
- implements ExtensionResolver {
- private File m_destfile;
- private File m_destdir;
- private URL m_url;
+public class URLResolver implements ExtensionResolver {
+ private File destfile;
+ private File destdir;
+ private URL url;
+ /**
+ * Sets the URL
+ * @param url the url
+ */
public void setUrl(final URL url) {
- m_url = url;
+ this.url = url;
}
+ /**
+ * Sets the destination file
+ * @param destfile the destination file
+ */
public void setDestfile(final File destfile) {
- m_destfile = destfile;
+ this.destfile = destfile;
}
+ /**
+ * Sets the destination directory
+ * @param destdir the destination directory
+ */
public void setDestdir(final File destdir) {
- m_destdir = destdir;
+ this.destdir = destdir;
}
+ /**
+ * Returns the file resolved from URL and directory
+ * @param extension the extention
+ * @param project the project
+ * @return file the file resolved
+ * @throws BuildException if the URL is invalid
+ */
public File resolve(final Extension extension,
- final Project project)
- throws BuildException {
+ final Project project) throws BuildException {
validate();
final File file = getDest();
final Get get = (Get) project.createTask("get");
get.setDest(file);
- get.setSrc(m_url);
+ get.setSrc(url);
get.execute();
return file;
}
+ /*
+ * Gets the destination file
+ */
private File getDest() {
- if (null != m_destfile) {
- return m_destfile;
+ File result;
+ if (null != destfile) {
+ result = destfile;
} else {
- final String file = m_url.getFile();
- String filename = null;
+ final String file = url.getFile();
+ String filename;
if (null == file || file.length() <= 1) {
filename = "default.file";
} else {
@@ -77,27 +98,34 @@ public class URLResolver
}
filename = file.substring(index);
}
-
- return new File(m_destdir, filename);
+ result = new File(destdir, filename);
}
+ return result;
}
+ /*
+ * Validates URL
+ */
private void validate() {
- if (null == m_url) {
+ if (null == url) {
final String message = "Must specify URL";
throw new BuildException(message);
}
- if (null == m_destdir && null == m_destfile) {
+ if (null == destdir && null == destfile) {
final String message = "Must specify destination file or directory";
throw new BuildException(message);
- } else if (null != m_destdir && null != m_destfile) {
+ } else if (null != destdir && null != destfile) {
final String message = "Must not specify both destination file or directory";
throw new BuildException(message);
}
}
+ /**
+ * Returns a string representation of the URL
+ * @return the string representation
+ */
public String toString() {
- return "URL[" + m_url + "]";
+ return "URL[" + url + "]";
}
}