You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2003/05/14 11:36:10 UTC

cvs commit: avalon-sandbox/merlin/meta-tools/src/java/org/apache/avalon/meta/info/builder/tags AbstractTag.java DependencyTag.java

mcconnell    2003/05/14 02:36:10

  Modified:    merlin   project.xml
               merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl
                        BlockURLConnection.java
                        DefaultApplianceRepository.java
               merlin/merlin-plugin plugin.jelly
               merlin/merlin-smp/xdocs/tools ant.xml
               merlin/meta/src/java/org/apache/avalon/meta/info/builder
                        TypeBuilder.java
               merlin/meta-tools/src/java/org/apache/avalon/meta/info/builder/tags
                        AbstractTag.java DependencyTag.java
  Log:
  Application of patch by Kristian Meier concerning meta-info generation (sources and documetation).
  
  Revision  Changes    Path
  1.12      +7 -0      avalon-sandbox/merlin/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/project.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- project.xml	1 May 2003 10:45:22 -0000	1.11
  +++ project.xml	14 May 2003 09:36:09 -0000	1.12
  @@ -137,6 +137,13 @@
           <role>Documentation and tutorial review, testing and patches.</role>
         </roles>
       </contributor>
  +    <contributor>
  +      <name>Kristian Meier</name>
  +      <email>kristian.meier@jentro.com</email>
  +      <roles>
  +        <role>Patches enhancing the meta-info generation sources and documentation.</role>
  +      </roles>
  +    </contributor>
     </contributors>
   
     <build>
  
  
  
  1.4       +2 -1      avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl/BlockURLConnection.java
  
  Index: BlockURLConnection.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl/BlockURLConnection.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BlockURLConnection.java	9 May 2003 05:38:07 -0000	1.3
  +++ BlockURLConnection.java	14 May 2003 09:36:09 -0000	1.4
  @@ -147,7 +147,8 @@
           try
           {
               return appliance.resolve( m_url, ref );
  -        } catch( Throwable e )
  +        } 
  +        catch( Throwable e )
           {
               final String error =
                       "URL content resolution error in: " + m_url;
  
  
  
  1.3       +30 -23    avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl/DefaultApplianceRepository.java
  
  Index: DefaultApplianceRepository.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl/DefaultApplianceRepository.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultApplianceRepository.java	9 May 2003 05:38:07 -0000	1.2
  +++ DefaultApplianceRepository.java	14 May 2003 09:36:09 -0000	1.3
  @@ -381,31 +381,13 @@
           }
       }
   
  -    private String getKey( Appliance appliance )
  -    {
  -        final String local = getURL().getPath();
  -        final String path = appliance.getURL().getPath();
  -        final String key = path.substring( local.length() );
  -        return getKey( key );
  -    }
  -
  -    private String getKey( String key )
  -    {
  -        int n = key.indexOf( "/" );
  -        if( n > -1 )
  -        {
  -            return key.substring( 0, n );
  -        }
  -        else
  -        {
  -            return key;
  -        }
  -    }
  -
  -
       /**
        * Return an appliance relative to the supplied path.
        * @param uri the appliance path
  +     * @return the appliance
  +     * @exception IllegalArgumentException if the supplied uri path
  +     *   does not correspond to this repository or a repository 
  +     *   resolvable from this repository
        */
       public Appliance resolveAppliance( String uri )
       {
  @@ -445,8 +427,33 @@
           }
       }
   
  +   /**
  +    * Return a string representation of the appliance repository.
  +    * @return the string representation
  +    */
       public String toString()
       {
           return "[repository:" + m_url.getPath() + "]";
  +    }
  +
  +    private String getKey( Appliance appliance )
  +    {
  +        final String local = getURL().getPath();
  +        final String path = appliance.getURL().getPath();
  +        final String key = path.substring( local.length() );
  +        return getKey( key );
  +    }
  +
  +    private String getKey( String key )
  +    {
  +        int n = key.indexOf( "/" );
  +        if( n > -1 )
  +        {
  +            return key.substring( 0, n );
  +        }
  +        else
  +        {
  +            return key;
  +        }
       }
   }
  
  
  
  1.6       +1 -1      avalon-sandbox/merlin/merlin-plugin/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-plugin/plugin.jelly,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- plugin.jelly	9 May 2003 05:42:38 -0000	1.5
  +++ plugin.jelly	14 May 2003 09:36:09 -0000	1.6
  @@ -45,7 +45,7 @@
       </meta>
     </goal>
   
  -  <goal name="merlin:deploy" prereqs="jar:jar"
  +  <goal name="merlin:deploy" 
       description="Deployment of a jar file containing a block.xml directive and execution of all components associated with a lauch on startup policy.">
   
       <echo>Merlin block deployment.</echo>
  
  
  
  1.3       +5 -3      avalon-sandbox/merlin/merlin-smp/xdocs/tools/ant.xml
  
  Index: ant.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/tools/ant.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ant.xml	30 Mar 2003 05:27:49 -0000	1.2
  +++ ant.xml	14 May 2003 09:36:09 -0000	1.3
  @@ -7,9 +7,8 @@
     </properties>
     <body>
       <section name="Introduction">
  -      <p>
  -The mata info generator task scans sources files for the present of an avalon.meta tags and based on the tag set specification, generates either XML or serialized meta-info descriptors.
  -      </p>
  +<p>
  +The meta info generator task scans sources files for the present of an avalon.meta tags and based on the tag set specification, generates either XML or serialized meta-info descriptors.      </p>
   
         <subsection name="Parameters">
   <table>
  @@ -23,6 +22,9 @@
     <tr>
       <td>format</td><td>false</td>
       <td>The output format. May be one of <strong>xml</strong> or <strong>serial</strong>.  The xml format is less compact but more portable.  The serial format is appropriate when usage is know to be in the context of the Avalon Meta API.  The serial format is a serialized representation of the corresponding Task or Service instance.</td>
  +  </tr>
  +  <tr>
  +    <td>A boolean flag to force regenerating of the meta-files. <strong>false</strong> (default) will generate the meta-file if the source is newer than the exisiting meta-file or if the meta-file does not exist. <strong>true</strong> will generate the meta-file even if the file already exists.</td>
     </tr>
   </table>
         </subsection>
  
  
  
  1.4       +3 -3      avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/info/builder/TypeBuilder.java
  
  Index: TypeBuilder.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/info/builder/TypeBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TypeBuilder.java	18 Apr 2003 22:17:28 -0000	1.3
  +++ TypeBuilder.java	14 May 2003 09:36:09 -0000	1.4
  @@ -160,14 +160,14 @@
           //
   
           String path =
  -            classname.replace( '.', '/' ) + ".xinfo";
  +            classname.replace( '.', '/' ) + ".xtype";
           InputStream inputStream =
               classLoader.getResourceAsStream( path );
   
           if( null == inputStream )
           {
               path =
  -              classname.replace( '.', '/' ) + ".xtype";
  +              classname.replace( '.', '/' ) + ".xinfo";
               inputStream =
                 classLoader.getResourceAsStream( path );
           }
  
  
  
  1.4       +59 -6     avalon-sandbox/merlin/meta-tools/src/java/org/apache/avalon/meta/info/builder/tags/AbstractTag.java
  
  Index: AbstractTag.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/meta-tools/src/java/org/apache/avalon/meta/info/builder/tags/AbstractTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractTag.java	16 Apr 2003 14:19:42 -0000	1.3
  +++ AbstractTag.java	14 May 2003 09:36:10 -0000	1.4
  @@ -207,13 +207,48 @@
        */
       protected String resolveType( final String type )
       {
  +        final String resolvedType;
           if( type.indexOf(":") > -1 )
           {
  -            return getJavaClass().getParentSource().resolveType( type.substring( 0, type.indexOf(":") ) );
  +            resolvedType = this.doResolveType( getJavaClass(), 
  +                            type.substring( 0, type.indexOf(":") ) );
  +        }    
  +        else
  +        {
  +            resolvedType = doResolveType( getJavaClass(), type );
  +        }
  +        if( resolvedType == null )
  +        {
  +            final String message = 
  +              "Unable to find type " + type
  +              + " in class " + getJavaClass().getFullyQualifiedName();
  +            throw new RuntimeException( message );   
  +        }
  +        else 
  +        {
  +            return resolvedType;
  +        }
  +    }
  +
  +    private String doResolveType( final JavaClass clazz, final String type )
  +    {
  +        final String resolvedType = clazz.getParentSource().resolveType( type );
  +        if( resolvedType != null )
  +        {
  +            return resolvedType;
  +        }
  +        else if( clazz.getSuperJavaClass() == null || 
  +          JavaClass.OBJECT.equals( clazz.getSuperClass() ) )
  +        {
  +            return null;
  +        }
  +        else 
  +        {
  +            return doResolveType( clazz.getSuperJavaClass(), type );
           }
  -        return getJavaClass().getParentSource().resolveType( type );
       }
   
  +
       /**
        * Retrieve a method with specified name and one parameter of specified
        * type. The method must also return void.
  @@ -225,7 +260,15 @@
       protected JavaMethod getLifecycleMethod( final String methodName,
                                                final String parameterType )
       {
  -        final JavaMethod[] methods = getJavaClass().getMethods();
  +        return findLifecycleMethod( getJavaClass(), methodName, parameterType );
  +    }
  +
  +    private JavaMethod findLifecycleMethod( 
  +            final JavaClass clazz,
  +            final String methodName,
  +            final String parameterType )
  +    {
  +        final JavaMethod[] methods = clazz.getMethods();
           for( int i = 0; i < methods.length; i++ )
           {
               final JavaMethod method = methods[ i ];
  @@ -237,7 +280,17 @@
                   return method;
               }
           }
  -        return null;
  -    }
   
  +        if( 
  +            clazz.getSuperJavaClass() == null 
  +            || JavaClass.OBJECT.equals( clazz.getSuperClass() ) )
  +        {
  +            return null;
  +        }
  +        else
  +        {
  +            return this.findLifecycleMethod( 
  +              clazz.getSuperJavaClass(), methodName, parameterType );
  +        }
  +    }
   }
  
  
  
  1.4       +6 -2      avalon-sandbox/merlin/meta-tools/src/java/org/apache/avalon/meta/info/builder/tags/DependencyTag.java
  
  Index: DependencyTag.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/meta-tools/src/java/org/apache/avalon/meta/info/builder/tags/DependencyTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DependencyTag.java	16 Apr 2003 14:19:42 -0000	1.3
  +++ DependencyTag.java	14 May 2003 09:36:10 -0000	1.4
  @@ -123,8 +123,12 @@
           {
               return new DependencyDescriptor[0];
           }
  +
           final ArrayList deps = new ArrayList();
  -        final DocletTag[] tags = getMethod().getTagsByName( getNS() + Tags.DELIMITER + KEY );
  +        final DocletTag[] tags = 
  +          getMethod().getTagsByName( getNS() 
  +          + Tags.DELIMITER + KEY );
  +
           for( int i = 0; i < tags.length; i++ )
           {
               deps.add( getDependency( tags[i] ) );
  
  
  

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