umagesh     2004/06/06 10:31:50

  Added:       src/main/org/apache/tools/ant/dispatch DispatchTask.java
                        Dispatchable.java
  Log:
  Tasks extending from abstract DispatchTask may have multiple action methods 
that will get invoked depending upon the action attribute of the task.
  
  Revision  Changes    Path
  1.1                  
ant/src/main/org/apache/tools/ant/dispatch/DispatchTask.java
  
  Index: DispatchTask.java
  ===================================================================
  /*
   * Copyright  2004 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.
   *  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 org.apache.tools.ant.dispatch;
  
  import org.apache.tools.ant.Task;
  
  /**
   * Tasks extending this class may contain multiple actions.
   * The method that is invoked for executoin depends upon the
   * value of the action attribute of the task.
   * <br/>
   * Example:<br/>
   * &lt;mytask action=&quot;list&quot;/&gt; will invoke the method
   * with the signature public void list() in mytask's class.
   * If the action attribute is not defined in the task or is empty,
   * the execute() method will be called.
   */
  public abstract class DispatchTask implements Dispatchable {
      private String action;
  
      public String getActionParameterName() {
          return "action";
      }
  
      public void setAction(String action) {
          this.action = action;
      }
  
      public String getAction() {
          return action;
      }
  }
  
  
  1.1                  
ant/src/main/org/apache/tools/ant/dispatch/Dispatchable.java
  
  Index: Dispatchable.java
  ===================================================================
  /*
   * Copyright  2004 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.
   *  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 org.apache.tools.ant.dispatch;
  
  /**
   * Classes implementing this interface specify the
   * name of the parameter that contains the name
   * of the task's method to execute.
   */
  public interface Dispatchable {
      public String getActionParameterName();
  }
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to