Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 7239 invoked from network); 25 Jan 2005 14:43:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 Jan 2005 14:43:18 -0000 Received: (qmail 41246 invoked by uid 500); 25 Jan 2005 14:43:11 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 41179 invoked by uid 500); 25 Jan 2005 14:43:11 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 41140 invoked by uid 500); 25 Jan 2005 14:43:11 -0000 Received: (qmail 41088 invoked by uid 99); 25 Jan 2005 14:43:10 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 25 Jan 2005 06:43:10 -0800 Received: (qmail 7047 invoked by uid 1539); 25 Jan 2005 14:43:08 -0000 Date: 25 Jan 2005 14:43:08 -0000 Message-ID: <20050125144308.7046.qmail@minotaur.apache.org> From: peterreilly@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/main/org/apache/tools/ant/dispatch Dispatchable.java DispatchTask.java DispatchUtils.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N peterreilly 2005/01/25 06:43:08 Modified: src/main/org/apache/tools/ant/dispatch Dispatchable.java DispatchTask.java DispatchUtils.java Log: javadoc + linelength Revision Changes Path 1.2 +7 -3 ant/src/main/org/apache/tools/ant/dispatch/Dispatchable.java Index: Dispatchable.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/dispatch/Dispatchable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Dispatchable.java 6 Jun 2004 17:31:50 -0000 1.1 +++ Dispatchable.java 25 Jan 2005 14:43:08 -0000 1.2 @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Apache Software Foundation + * Copyright 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. @@ -22,5 +22,9 @@ * of the task's method to execute. */ public interface Dispatchable { - public String getActionParameterName(); -} \ No newline at end of file + /** + * Get the name of the parameter. + * @return the name of the parameter that contains the name of the method. + */ + String getActionParameterName(); +} 1.4 +13 -1 ant/src/main/org/apache/tools/ant/dispatch/DispatchTask.java Index: DispatchTask.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/dispatch/DispatchTask.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DispatchTask.java 17 Dec 2004 20:33:54 -0000 1.3 +++ DispatchTask.java 25 Jan 2005 14:43:08 -0000 1.4 @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Apache Software Foundation + * Copyright 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. @@ -32,14 +32,26 @@ public abstract class DispatchTask extends Task implements Dispatchable { private String action; + /** + * Get the action parameter name. + * @return the String "action" by default (can be overridden). + */ public String getActionParameterName() { return "action"; } + /** + * Set the action. + * @param action the method name. + */ public void setAction(String action) { this.action = action; } + /** + * Get the action. + * @return the action. + */ public String getAction() { return action; } 1.4 +20 -11 ant/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java Index: DispatchUtils.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DispatchUtils.java 22 Nov 2004 09:23:26 -0000 1.3 +++ DispatchUtils.java 25 Jan 2005 14:43:08 -0000 1.4 @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Apache Software Foundation + * Copyright 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. @@ -24,11 +24,13 @@ import java.lang.reflect.Method; /** - * Determines and Executes the action method for the task + * Determines and Executes the action method for the task. */ public class DispatchUtils { /** - * Determines and Executes the action method for the task + * Determines and Executes the action method for the task. + * @param task the task to execute. + * @throws BuildException on error. */ public static final void execute(Object task) throws BuildException { String methodName = "execute"; @@ -39,7 +41,9 @@ } else if (task instanceof UnknownElement) { UnknownElement ue = (UnknownElement) task; Object realThing = ue.getRealThing(); - if (realThing != null && realThing instanceof Dispatchable && realThing instanceof Task) { + if (realThing != null + && realThing instanceof Dispatchable + && realThing instanceof Task) { dispatchable = (Dispatchable) realThing; } } @@ -61,9 +65,11 @@ if (s != null && s.trim().length() > 0) { methodName = s.trim(); Method executeM = null; - executeM = dispatchable.getClass().getMethod(methodName, new Class[0]); + executeM = dispatchable.getClass().getMethod( + methodName, new Class[0]); if (executeM == null) { - throw new BuildException("No public " + methodName + "() in " + throw new BuildException( + "No public " + methodName + "() in " + dispatchable.getClass()); } executeM.invoke(dispatchable, (Object[]) null); @@ -71,16 +77,19 @@ ((UnknownElement) task).setRealThing(null); } } else { - throw new BuildException("Dispatchable Task attribute '" + name.trim() - + "' not set or value is empty."); + throw new BuildException( + "Dispatchable Task attribute '" + name.trim() + + "' not set or value is empty."); } } else { - throw new BuildException("Dispatchable Task attribute '" + name.trim() - + "' not set or value is empty."); + throw new BuildException( + "Dispatchable Task attribute '" + name.trim() + + "' not set or value is empty."); } } } else { - throw new BuildException("Action Parameter Name must not be empty for Dispatchable Task."); + throw new BuildException( + "Action Parameter Name must not be empty for Dispatchable Task."); } } catch (NoSuchMethodException nsme) { throw new BuildException("No public " + mName + "() in " + task.getClass()); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org