avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/tools/xdoclet AvalonTagHandler.java componentinfo.xdt
Date Sun, 25 Aug 2002 12:53:32 GMT
donaldp     2002/08/25 05:53:32

  Modified:    containerkit/src/java/org/apache/excalibur/containerkit/demo/components
                        Component1.java
               containerkit/src/java/org/apache/excalibur/containerkit/tools/xdoclet
                        AvalonTagHandler.java componentinfo.xdt
  Log:
  Isimplified the template for service generation and component generation.
  
  Revision  Changes    Path
  1.3       +1 -0      jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/demo/components/Component1.java
  
  Index: Component1.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/demo/components/Component1.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Component1.java	25 Aug 2002 12:10:02 -0000	1.2
  +++ Component1.java	25 Aug 2002 12:53:31 -0000	1.3
  @@ -22,6 +22,7 @@
   /**
    * @avalon.component lifestyle="alternative" version="1.4"
    * @avalon.service interface="Service1" shareable="true"
  + * @avalon.service interface="Service1" shareable="true" version="2.0"
    */
   public class Component1
       implements Service1, Contextualizable, Serviceable, Configurable, Initializable
  
  
  
  1.4       +39 -5     jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/tools/xdoclet/AvalonTagHandler.java
  
  Index: AvalonTagHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/tools/xdoclet/AvalonTagHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AvalonTagHandler.java	25 Aug 2002 12:10:02 -0000	1.3
  +++ AvalonTagHandler.java	25 Aug 2002 12:53:31 -0000	1.4
  @@ -32,6 +32,21 @@
   {
       private static String c_attribute;
   
  +    public void forAllServices( final String template )
  +        throws XDocletException
  +    {
  +        final XDoc doc = getCurrentClass().getDoc();
  +        final Collection tags =
  +            doc.getTags( "avalon.service" );
  +        final Iterator iterator = tags.iterator();
  +        while( iterator.hasNext() )
  +        {
  +            final XTag tag = (XTag)iterator.next();
  +            setCurrentClassTag( tag );
  +            generate( template );
  +        }
  +    }
  +
       public void forAllDeps( final String template )
           throws XDocletException
       {
  @@ -55,15 +70,23 @@
           }
       }
   
  +    public void forAllClassAttributes( final String template,
  +                                        final Properties attributes )
  +        throws XDocletException
  +    {
  +        final XTag tag = getCurrentClassTag();
  +        forAllAttributes( tag, template, attributes );
  +    }
  +
       public void forAllMethodAttributes( final String template,
                                           final Properties attributes )
           throws XDocletException
       {
           final XTag tag = getCurrentMethodTag();
  -        forAllMethodAttributes( tag, template, attributes );
  +        forAllAttributes( tag, template, attributes );
       }
   
  -    private void forAllMethodAttributes( final XTag tag,
  +    private void forAllAttributes( final XTag tag,
                                            final String template,
                                            final Properties attributes )
           throws XDocletException
  @@ -102,12 +125,23 @@
           return split( skipList, ", " );
       }
   
  -    public String getAttributeValueAsType( final Properties attributes )
  +    public String getClassAttributeValueAsType( final Properties attributes )
  +    {
  +        final XTag tag = getCurrentClassTag();
  +        return getAttributeValueAsType( tag, attributes );
  +    }
  +
  +    public String getMethodAttributeValueAsType( final Properties attributes )
  +    {
  +        final XTag tag = getCurrentMethodTag();
  +        return getAttributeValueAsType( tag, attributes );
  +    }
  +
  +    private String getAttributeValueAsType( final XTag tag, final Properties attributes
)
       {
           final Log log =
               LogUtil.getLog( AvalonTagHandler.class, "getAttributeValueAsType" );
           final String name = attributes.getProperty( "name", "" );
  -        final XTag tag = getCurrentMethodTag();
           final String value = tag.getAttributeValue( name );
           if( null == value )
           {
  
  
  
  1.3       +10 -19    jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/tools/xdoclet/componentinfo.xdt
  
  Index: componentinfo.xdt
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/tools/xdoclet/componentinfo.xdt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- componentinfo.xdt	25 Aug 2002 12:10:02 -0000	1.2
  +++ componentinfo.xdt	25 Aug 2002 12:53:31 -0000	1.3
  @@ -6,19 +6,16 @@
   
   <!-- Autogenerated by XDoclet. Do not Edit! -->
   <component-info>
  +
     <!-- section to describe Component -->
     <component>
       <XDtClass:ifHasClassTag tagName="avalon.component" paramName="name"><name><XDtClass:classTagValue
tagName="avalon.component" paramName="name"/></name></XDtClass:ifHasClassTag>
       <version><XDtClass:classTagValue tagName="avalon.component" paramName="version"
default="1.0"/></version>
  -    <XDtAvalon:setCurrentClassTag name="avalon.component"/>
       <attributes>
  -      <XDtAvalon:forAllAttributes isMethod="false">
  -        <XDtAvalon:ifAttributeNameNotEquals value="name">
  -          <XDtAvalon:ifAttributeNameNotEquals value="version">
  +      <XDtAvalon:setCurrentClassTag name="avalon.component"/>
  +      <XDtAvalon:forAllClassAttributes skip="interface,version,role">
         <attribute key="<XDtAvalon:attributeName/>" value="<XDtAvalon:attributeValue/>"/>
  -          </XDtAvalon:ifAttributeNameNotEquals>
  -        </XDtAvalon:ifAttributeNameNotEquals>
  -      </XDtAvalon:forAllAttributes>
  +      </XDtAvalon:forAllClassAttributes>
       </attributes>
     </component>
   
  @@ -48,22 +45,16 @@
   
     <!-- services that are offered by this Component -->
     <services>
  -    <XDtClass:forAllClassTags tagName="avalon.service">
  +    <XDtAvalon:forAllServices>
       <service>
  -      <XDtAvalon:setCurrentAttribute name="interface"/>
  -      <service-ref type="<XDtAvalon:attributeValueAsType/>"<XDtClass:ifHasClassTag
tagName="avalon.service" paramName="version"> version="<XDtClass:classTagValue tagName="avalon.service"
paramName="version"/>"</XDtClass:ifHasClassTag>/>
  -      <XDtAvalon:unsetCurrentAttribute/>
  +      <service-ref type="<XDtAvalon:getClassAttributeValueAsType name="interface"/>"<XDtClass:ifHasClassTag
tagName="avalon.service" paramName="version"> version="<XDtClass:classTagValue tagName="avalon.service"
paramName="version"/>"</XDtClass:ifHasClassTag>/>
         <attributes>
  -      <XDtAvalon:forAllAttributes isMethod="false">
  -        <XDtAvalon:ifAttributeNameNotEquals value="interface">
  -          <XDtAvalon:ifAttributeNameNotEquals value="version">
  +      <XDtAvalon:forAllClassAttributes skip="interface,version,role">
           <attribute key="<XDtAvalon:attributeName/>" value="<XDtAvalon:attributeValue/>"/>
  -          </XDtAvalon:ifAttributeNameNotEquals>
  -        </XDtAvalon:ifAttributeNameNotEquals>
  -      </XDtAvalon:forAllAttributes>
  +      </XDtAvalon:forAllClassAttributes>
         </attributes>
       </service>
  -    </XDtClass:forAllClassTags>
  +    </XDtAvalon:forAllServices>
     </services>
   
     <!-- services that are required by this Component -->
  @@ -71,7 +62,7 @@
     <XDtAvalon:forAllDeps>
       <dependency<XDtMethod:ifHasMethodTag tagName="avalon.dependency" paramName="optional">
optional="<XDtMethod:methodTagValue tagName="avalon.dependency" paramName="optional"/>"</XDtMethod:ifHasMethodTag>>
         <XDtMethod:ifHasMethodTag tagName="avalon.dependency" paramName="role"><role><XDtMethod:methodTagValue
tagName="avalon.dependency" paramName="role"/></role></XDtMethod:ifHasMethodTag>
  -      <service-ref type="<XDtAvalon:getAttributeValueAsType name="interface"/>"<XDtMethod:ifHasMethodTag
tagName="avalon.dependency" paramName="version"> version="<XDtMethod:methodTagValue
tagName="avalon.dependency" paramName="version"/>"</XDtMethod:ifHasMethodTag>/>
  +      <service-ref type="<XDtAvalon:getMethodAttributeValueAsType name="interface"/>"<XDtMethod:ifHasMethodTag
tagName="avalon.dependency" paramName="version"> version="<XDtMethod:methodTagValue
tagName="avalon.dependency" paramName="version"/>"</XDtMethod:ifHasMethodTag>/>
         <attributes>
         <XDtAvalon:forAllMethodAttributes skip="interface,version,role,optional">
           <attribute key="<XDtAvalon:attributeName/>" value="<XDtAvalon:attributeValue/>"/>
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message