geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject cvs commit: incubator-geronimo/modules/tools/src/java/org/apache/geronimo/tools/xdoclet GeronimoDocletTask.java GeronimoMBeanTagsHandler.java GeronimoMBeanInfoSubTask.java
Date Wed, 10 Dec 2003 10:49:44 GMT
gdamour     2003/12/10 02:49:44

  Added:       modules/tools/src/resources/org/apache/geronimo/tools/xdoclet/resources
                        geronimo-mbeaninfo.xdt
               modules/tools/src/conf xdoclet-xml.xdt
               modules/tools maven.xml project.xml
               modules/tools/src/java/org/apache/geronimo/tools/xdoclet
                        GeronimoDocletTask.java
                        GeronimoMBeanTagsHandler.java
                        GeronimoMBeanInfoSubTask.java
  Log:
  Initial check-in of a toolbox/utility module required to build or operate
  Geronimo.
  
  This first check-in defines the XDoclet task "geronimo" and the sub-task
  "mbeaninfo" to create an XML descriptor for the dynamic MBean
  GeronimoMBean.
  
  Revision  Changes    Path
  1.1                  incubator-geronimo/modules/tools/src/resources/org/apache/geronimo/tools/xdoclet/resources/geronimo-mbeaninfo.xdt
  
  Index: geronimo-mbeaninfo.xdt
  ===================================================================
  <!--
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" 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",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  //
  // Generated by XDoclet; Do not edit.
  //
  -->
  
  <mbean
     name="<XDtClass:className/>"
     description="<XDtClass:firstSentenceDescription/>"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="TBD">
  
     <!--
     *** Targets ***********************
     -->
     <target
        class="<XDtClass:fullClassName/>"
        />
  
     <!--
     *** Endpoints *********************
     -->
     <XDtMethod:forAllMethods>
     <XDtMethod:ifHasMethodTag tagName="geronimo.endpoint">
     <XDtParameter:forAllMethodParams>
     <endpoint
        name="<XDtMethod:methodNameWithoutPrefix/>"
        type="<XDtParameter:methodParamType/>"
        description="<XDtMethod:firstSentenceDescriptionOfCurrentMethod/>"
        setterName="<XDtMethod:methodName/>"
        <XDtMethod:ifHasMethodTag tagName="geronimo.endpoint" paramName="required">
        required="<XDtMethod:methodTagValue tagName="geronimo.endpoint" paramName="required"/>"
        </XDtMethod:ifHasMethodTag>
        >
     <XDtMethod:forAllMethodTags tagName="geronimo.peer">
        <peer pattern="<XDtMethod:methodTagValue tagName="geronimo.peer" paramName="pattern"/>"/>
     </XDtMethod:forAllMethodTags>
     </endpoint>
     </XDtParameter:forAllMethodParams>
     </XDtMethod:ifHasMethodTag>
     </XDtMethod:forAllMethods>
  
     <!--
     *** Attributes ********************
     -->
     <XDtMethod:forAllMethods>
     <XDtMethod:ifHasMethodTag tagName="geronimo.attribute">
     <attribute
        name="<XDtMethod:methodNameWithoutPrefix/>"
        description="<XDtMethod:firstSentenceDescriptionOfCurrentMethod/>"
        <XDtGeronimo:ifIsReadable>
        readable="true"
        getterName="<XDtGeronimo:getterName/>"
        </XDtGeronimo:ifIsReadable>
        <XDtGeronimo:ifIsNotReadable>
        readable="false"
        </XDtGeronimo:ifIsNotReadable>
        <XDtGeronimo:ifIsWritable>
        writable="true"
        setterName="<XDtGeronimo:setterName/>"
        </XDtGeronimo:ifIsWritable>
        <XDtGeronimo:ifIsNotWritable>
        writable="false"
        </XDtGeronimo:ifIsNotWritable>
        <XDtMethod:ifHasMethodTag tagName="geronimo.attribute" paramName="cache">
        cache="<XDtMethod:methodTagValue tagName="geronimo.attribute" paramName="cache"/>"
        </XDtMethod:ifHasMethodTag>
        />
     </XDtMethod:ifHasMethodTag>
     </XDtMethod:forAllMethods>
     
     <!--
     *** Operations ********************
     -->
     <XDtMethod:forAllMethods>
     <XDtMethod:ifHasMethodTag tagName="geronimo.operation">
     <operation
        name="<XDtMethod:methodName/>"
        description="<XDtMethod:firstSentenceDescriptionOfCurrentMethod/>"
        methodName="<XDtMethod:methodName/>"
        <XDtMethod:ifHasMethodTag tagName="geronimo.operation" paramName="impact">
        impact="<XDtMethod:methodTagValue tagName="geronimo.operation" paramName="impact"/>"
        </XDtMethod:ifHasMethodTag>
        <XDtMethod:ifHasMethodTag tagName="geronimo.operation" paramName="cache">
        cache="<XDtMethod:methodTagValue tagName="geronimo.operation" paramName="cache"/>"
        </XDtMethod:ifHasMethodTag>
        >
     <XDtParameter:forAllMethodParams>
        <parameter
           name="<XDtParameter:methodParamName/>"
           type="<XDtParameter:methodParamType/>"
           description="<XDtParameter:methodParamDescription/>"/>
     </XDtParameter:forAllMethodParams>
     </operation>
     </XDtMethod:ifHasMethodTag>
     </XDtMethod:forAllMethods>
     
  </mbean>
  
  
  
  1.1                  incubator-geronimo/modules/tools/src/conf/xdoclet-xml.xdt
  
  Index: xdoclet-xml.xdt
  ===================================================================
  <!--
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" 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",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  //
  // Generated by XDoclet; Do not edit.
  //
  -->
  
  
  <!--
  <!DOCTYPE xdoclet-module PUBLIC "-//XDoclet Team//DTD XDoclet Module 1.0//EN" "http://xdoclet.sourceforge.net/dtd/xdoclet-module_1_0.dtd">
  -->
  
  <XDtComment:comment>
  This template builds the deployment descriptor for XDoclet modules
  </XDtComment:comment>
  
  <xdoclet-module>
      <!--
      <XDtClass:forAllClasses>
      <XDtClass:fullClassName/>
      </XDtClass:forAllClasses>
      -->
  
     <XDtClass:forAllClasses type="xdoclet.template.TemplateTagHandler" abstract="false">
      <taghandler
          namespace="<XDtClass:classTagValue tagName="xdoclet.taghandler" paramName="namespace"
mandatory="true"/>"
          class="<XDtClass:fullClassName/>"
      />
     </XDtClass:forAllClasses>
  
     <XDtClass:forAllClasses type="xdoclet.SubTask" abstract="false">
      <subtask
          name="<XDtClass:classTagValue tagName="ant.element" paramName="name"  mandatory="true"/>"
          implementation-class="<XDtClass:fullClassName/>"
          parent-task-class="<XDtClass:classTagValue tagName="ant.element" paramName="parent"
mandatory="true"/>"
      />
     </XDtClass:forAllClasses>
  </xdoclet-module>
  
  
  
  1.1                  incubator-geronimo/modules/tools/maven.xml
  
  Index: maven.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- $Revision: 1.1 $ $Date: 2003/12/10 10:49:44 $ -->
  
  <project default="default"
    xmlns:j="jelly:core"
    xmlns:ant="jelly:ant">
  
    <preGoal name="java:compile">
      <!-- Define the standard XDoclet task -->
      <taskdef name="xdoclet" classname="xdoclet.DocletTask">
        <classpath>
          <path refid="maven.dependency.classpath"/>
        </classpath>
      </taskdef>
  
      <!-- Generate the xdoclet.xml file -->
      <mkdir dir="${basedir}/src/resources/META-INF"/>
      <xdoclet destdir="${basedir}/src/resources/META-INF">
        <fileset dir="${basedir}/src/java">
          <include name="**/*Handler.java" />
          <include name="**/*SubTask.java" />
        </fileset>
        <template
          templateFile="${basedir}/src/conf/xdoclet-xml.xdt"
          destinationFile="xdoclet.xml"
        />
      </xdoclet>
    </preGoal>
  
  </project>
  
  
  
  1.1                  incubator-geronimo/modules/tools/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <!-- $Revision: 1.1 $ $Date: 2003/12/10 10:49:44 $ -->
  
  <project>
    <pomVersion>3</pomVersion>
    <extend>${basedir}/../../etc/project.xml</extend>
    
    <name>Geronimo :: Tools</name>
    <id>geronimo-tools</id>
    <shortDescription>Tools used to build; operate Geronimo.</shortDescription>
    <description>
    Toolbox gathering compile time (e.g. XDoclet custom tasks) and runtime
    artifacts used to help the build or operation of Geronimo.
    </description>
    <siteDirectory>/www/incubator.apache.org/projects/geronimo/tools</siteDirectory>
    <distributionDirectory>/www/incubator.apache.org/projects/geronimo/builds/tools</distributionDirectory>
    
    <package>org.apache.geronimo.tools</package>
    <currentVersion>DEV</currentVersion>
    
    <!-- ============ -->
    <!-- Dependencies -->
    <!-- ============ -->
    <dependencies>
  
      <!-- Plugin Dependencies -->
      <dependency>
        <id>ant</id>
        <version>1.5.2</version>
        <properties>
          <runtime>false</runtime>
        </properties>
      </dependency>
  
      <dependency>
        <id>xdoclet</id>
        <version>1.2b2</version>
        <properties>
          <runtime>false</runtime>
        </properties>
      </dependency>
  
      <dependency>
        <id>xdoclet+xdoclet-module</id>
        <version>1.2b2</version>
        <properties>
          <runtime>false</runtime>
        </properties>
      </dependency>
  
      <dependency>
        <id>xdoclet+jmx-module</id>
        <version>1.2b2</version>
        <properties>
          <runtime>false</runtime>
        </properties>
      </dependency>
  
      <dependency>
        <id>xdoclet+xjavadoc</id>
        <version>1.2b2</version>
        <properties>
          <runtime>false</runtime>
        </properties>
      </dependency>
  
      <dependency>
        <id>commons-logging</id>
        <version>1.0.3</version>
        <url>http://jakarta.apache.org/commons/logging/</url>
        <properties>
          <runtime>false</runtime>
        </properties>
      </dependency>
  
      <dependency>
        <id>commons-collections</id>
        <version>2.1</version>
        <properties>
          <runtime>false</runtime>
        </properties>
      </dependency>
    </dependencies>
   
  </project>
  
  
  
  
  1.1                  incubator-geronimo/modules/tools/src/java/org/apache/geronimo/tools/xdoclet/GeronimoDocletTask.java
  
  Index: GeronimoDocletTask.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" 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",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  package org.apache.geronimo.tools.xdoclet;
  
  import xdoclet.DocletTask;
  
  /**
   * Geronimo task.
   *
   * @ant.element
   *      name="geronimodoclet"
   *      display-name="Geronimo Task"
   * 
   * @version $Revision: 1.1 $ $Date: 2003/12/10 10:49:44 $
   */
  public class GeronimoDocletTask extends DocletTask {}
  
  
  
  1.1                  incubator-geronimo/modules/tools/src/java/org/apache/geronimo/tools/xdoclet/GeronimoMBeanTagsHandler.java
  
  Index: GeronimoMBeanTagsHandler.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" 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",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  package org.apache.geronimo.tools.xdoclet;
  
  import java.util.Collection;
  import java.util.Iterator;
  import java.util.Properties;
  
  import xdoclet.XDocletException;
  import xdoclet.XDocletTagSupport;
  import xjavadoc.XMethod;
  
  /**
   * @xdoclet.taghandler namespace="Geronimo"
   * 
   * @version $Revision: 1.1 $ $Date: 2003/12/10 10:49:44 $
   */
  public class GeronimoMBeanTagsHandler
      extends XDocletTagSupport
  {
  
      /**
       * Gets the getter method associated to the current method. 
       * 
       * @param attributes
       * 
       * @return Getter.
       * 
       * @throws XDocletException Indicates that the method is never a getter nor
       * a setter.
       */
      public String getterName(Properties attributes) throws XDocletException {
          return getterName(getCurrentMethod());
      }
      
      /**
       * Gets the setter method associated to the current method. 
       * 
       * @param attributes
       * 
       * @return Setter.
       * 
       * @throws XDocletException Indicates that the method is never a getter nor
       * a setter.
       */
      public String setterName(Properties attributes) throws XDocletException {
          return setterName(getCurrentMethod());
      }
  
      /**
       * Gets the getter method associated to the specified method. 
       * 
       * @param aMethod Method whose getter is to be returned.
       * 
       * @return Getter.
       * 
       * @throws XDocletException Indicates that the method is never a getter nor
       * a setter.
       */
      private static String getterName(XMethod aMethod) throws XDocletException {
          String methodName = aMethod.getName(); 
          if ( methodName.startsWith("get") || methodName.startsWith("is") ) {
              return methodName;
          } else if ( methodName.startsWith("set") ) {
              String getterMethod1 = "get" + methodName.substring(3);
              String getterMethod2 = "is" + methodName.substring(3);
              Collection methods = aMethod.getContainingClass().getMethods();
              for (Iterator iter = methods.iterator(); iter.hasNext();) {
                  XMethod method = (XMethod) iter.next();
                  if ( method.getName().equals(getterMethod1) ||
                      method.getName().equals(getterMethod2)) {
                      return method.getName();
                  }
              }
              return null;
          } else {
              throw new XDocletException("Method " + aMethod +
                  " is never a getter nor a setter.");
          }
      }
  
      /**
       * Gets the setter method associated to the specified method. 
       * 
       * @param aMethod Method whose setter is to be returned.
       * 
       * @return Setter.
       * 
       * @throws XDocletException Indicates that the method is never a getter nor
       * a setter.
       */
      public static String setterName(XMethod aMethod) throws XDocletException {
          String methodName = aMethod.getName(); 
          if ( methodName.startsWith("set") ) {
              return methodName;
          } else if ( methodName.startsWith("get") || methodName.startsWith("is") ) {
              String setterMethod;
              if ( methodName.startsWith("get") ) {
                  setterMethod = "set" + methodName.substring(3);
              } else {
                  setterMethod = "set" + methodName.substring(2);
              }
              Collection methods = aMethod.getContainingClass().getMethods();
              for (Iterator iter = methods.iterator(); iter.hasNext();) {
                  XMethod method = (XMethod) iter.next();
                  if ( method.getName().equals(setterMethod) ) {
                      return method.getName();
                  }
              }
              return null;
          } else {
              throw new XDocletException("Method " + aMethod +
                  " is never a getter nor a setter.");
          }
      }
  
      /**
       * Indicates if the current method abstract a readable attribute.
       * 
       * @param template
       * @param attributes
       * 
       * @throws XDocletException Indicates that the method is never a getter nor
       * a setter. 
       */
      public void ifIsNotReadable(String template, Properties attributes)
          throws XDocletException {
          XMethod xMethod = getCurrentMethod();
              
          if ( null == getterName(xMethod) ) {
              generate(template);
          }
      }
      
      /**
       * Equivalent to !ifIsNotReadable.
       */
      public void ifIsReadable(String template, Properties attributes)
          throws XDocletException {
          XMethod xMethod = getCurrentMethod();
              
          if ( null != getterName(xMethod) ) {
              generate(template);
          }
      }
  
      /**
       * Indicates if the current method abstract a writable attribute.
       * 
       * @param template
       * @param attributes
       * 
       * @throws XDocletException Indicates that the method is never a getter nor
       * a setter. 
       */
      public void ifIsNotWritable(String template, Properties attributes)
          throws XDocletException {
          XMethod xMethod = getCurrentMethod();
  
          if ( null == setterName(xMethod) ) {
              generate(template);
          }
      }
      
      /**
       * Equivalent to !ifIsNotWritable.
       */
      public void ifIsWritable(String template, Properties attributes)
          throws XDocletException {
          XMethod xMethod = getCurrentMethod();
  
          if ( null != setterName(xMethod) ) {
              generate(template);
          }
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/tools/src/java/org/apache/geronimo/tools/xdoclet/GeronimoMBeanInfoSubTask.java
  
  Index: GeronimoMBeanInfoSubTask.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" 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",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  package org.apache.geronimo.tools.xdoclet;
  
  import xdoclet.TemplateSubTask;
  
  /**
   * Sub-task in charge of the generation of GeronimoMBeanInfo XML configuration
   * file. 
   * 
   * @ant.element
   *      display-name="GeronimoMBeanInfo"
   *      name="mbeaninfo"
   *      parent="org.apache.geronimo.tools.xdoclet.GeronimoDocletTask"
   * 
   * @version $Revision: 1.1 $ $Date: 2003/12/10 10:49:44 $
   */
  public class GeronimoMBeanInfoSubTask extends TemplateSubTask {
  
      /**
       * Default template.
       */
      private static String DEFAULT_TEMPLATE_FILE =
          "resources/geronimo-mbeaninfo.xdt";
  
      /**
       * Default destination file.
       */
      private static String GENERATED_FILE_NAME = "{0}MBeanInfo.xml";
  
      public GeronimoMBeanInfoSubTask() {
          setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE));
          setDestinationFile(GENERATED_FILE_NAME);
          setHavingClassTag("geronimo:mbean");
      }
  
  }
  
  
  

Mime
View raw message