avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/meta/tools/src/test/org/apache/avalon/meta MetaTestCase.java
Date Fri, 11 Jul 2003 04:49:35 GMT
mcconnell    2003/07/10 21:49:34

  Modified:    meta     maven.xml
               meta/api/src/java/org/apache/avalon/meta/info
                        ContextDescriptor.java EntryDescriptor.java
               meta/impl/src/java/org/apache/avalon/meta/info/builder
                        XMLLegacyCreator.java XMLServiceCreator.java
               meta/impl/src/java/org/apache/avalon/meta/info/writer
                        XMLTypeWriter.java
               meta/tools/src/java/org/apache/avalon/meta/info/builder/tags
                        ContextTag.java
               meta/tools/src/test/org/apache/avalon/meta MetaTestCase.java
  Log:
  Completed the implementation details covering context alias entry declarations (as per framework
guidelines) and fixed a bug in the maven.xml that was resulting in the incorrect building
of the maven meta plugin.
  
  Revision  Changes    Path
  1.2       +3 -3      avalon-sandbox/meta/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/maven.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- maven.xml	10 Jul 2003 20:39:20 -0000	1.1
  +++ maven.xml	11 Jul 2003 04:49:33 -0000	1.2
  @@ -13,7 +13,7 @@
       <maven:reactor
         basedir="${basedir}"
         includes="*/project.xml"
  -      excludes="meta-plugin/*,docs/*"
  +      excludes="plugin/*,site/*"
         goals="jar:install-snapshot"
         banner="Building:"
         ignoreFailures="false" />
  @@ -24,7 +24,7 @@
       <maven:reactor
         basedir="${basedir}"
         includes="*/project.xml"
  -      excludes="merlin-platform/*"
  +      excludes="site/*"
         goals="clean:clean"
         banner="Cleaning subproject:"
         ignoreFailures="false"/>
  @@ -33,7 +33,7 @@
     <goal name="do-plugin">
       <maven:reactor
         basedir="${basedir}"
  -      includes="meta-plugin/project.xml"
  +      includes="plugin/project.xml"
         goals="plugin:install"
         banner="Installing plugin:"
         ignoreFailures="false"
  
  
  
  1.3       +3 -7      avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ContextDescriptor.java
  
  Index: ContextDescriptor.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/ContextDescriptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContextDescriptor.java	10 Jul 2003 21:01:08 -0000	1.2
  +++ ContextDescriptor.java	11 Jul 2003 04:49:33 -0000	1.3
  @@ -142,11 +142,7 @@
       }
   
       /**
  -     * Return the entry with specified key.  If the supplied key
  -     * corresponds to an alias entry, the key backing the lias will be
  -     * returned.  If the supplied key corresponds to a key, that key
  -     * entry will be returned.  If the key does not correspond with
  -     * wither an elias or key, null is returned.
  +     * Return the entry with specified key.
        *
        * @param key the context entry key to lookup
        * @return the entry with specified key.
  @@ -192,7 +188,7 @@
               EntryDescriptor local = getEntry( entry.getKey() );
               if ( local != null )
               {
  -                if ( !entry.getType().equals( local.getType() ) )
  +                if ( !entry.getClassname().equals( local.getClassname() ) )
                   {
                       final String error =
                               "Conflicting entry type for key: " + key;
  
  
  
  1.4       +65 -30    avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/EntryDescriptor.java
  
  Index: EntryDescriptor.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/api/src/java/org/apache/avalon/meta/info/EntryDescriptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EntryDescriptor.java	10 Jul 2003 21:01:09 -0000	1.3
  +++ EntryDescriptor.java	11 Jul 2003 04:49:33 -0000	1.4
  @@ -57,7 +57,7 @@
    * in components Context. It contains information about;
    * <ul>
    *   <li>key: the key that component uses to look up entry</li>
  - *   <li>type: the class/interface of the entry</li>
  + *   <li>classname: the class/interface of the entry</li>
    *   <li>isOptional: true if entry is optional rather than required</li>
    * </ul>
    *
  @@ -73,14 +73,9 @@
       private final String m_key;
   
       /**
  -     * An alias to a key.
  -     */
  -    private final String m_alias;
  -
  -    /**
        * The class/interface of the Entry.
        */
  -    private final String m_type;
  +    private final String m_classname;
   
       /**
        * True if entry is optional, false otherwise.
  @@ -88,57 +83,85 @@
       private final boolean m_optional;
   
       /**
  -     * Construct an Entry.
  +     * Immutable state of the entry.
  +     */
  +    private final boolean m_volatile;
  +
  +    /**
  +     * An alias to a key.
  +     */
  +    private final String m_alias;
  +
  +    /**
  +     * Construct an non-volotile required Entry.
        * @param key the context entry key
        * @param type the classname of the context entry
        * @exception NullPointerException if the key or type value are null
        */
       public EntryDescriptor( final String key,
  -                            final String type ) throws NullPointerException
  +                            final String classname ) throws NullPointerException
       {
  -        this( key, type, false );
  +        this( key, classname, false );
       }
   
       /**
  -     * Construct an Entry.
  +     * Construct an non-volotile Entry.
        * @param key the context entry key
  -     * @param type the classname of the context entry
  +     * @param classname the classname of the context entry
        * @param optional TRUE if this is an optional entry
        * @exception NullPointerException if the key or type value are null
        */
       public EntryDescriptor( final String key,
  -                            final String type,
  +                            final String classname,
                               final boolean optional ) throws NullPointerException
       {
  -        this( key, null, type, optional );
  +        this( key, classname, optional, false );
       }
   
       /**
        * Construct an Entry.
        * @param key the context entry key
  -     * @param type the classname of the context entry
  -     * @param alias an alternative key used by the component to reference the key
  +     * @param classname the classname of the context entry
        * @param optional TRUE if this is an optional entry
  +     * @param immutable TRUE if the entry is consider to be immutable
        * @exception NullPointerException if the key or type value are null
        */
       public EntryDescriptor( final String key,
  -                            final String alias,
  -                            final String type,
  -                            final boolean optional ) throws NullPointerException
  +                            final String classname,
  +                            final boolean optional, 
  +                            final boolean isVolatile ) throws NullPointerException
  +    {
  +        this( key, classname, optional, isVolatile, null );
  +    }
  +
  +    /**
  +     * Construct an Entry.
  +     * @param key the context entry key
  +     * @param classname the classname of the context entry
  +     * @param optional TRUE if this is an optional entry
  +     * @param isVolatile TRUE if the entry is is volatile
  +     * @param alias an alternative key used by the component to reference the key
  +     * @exception NullPointerException if the key or type value are null
  +     */
  +    public EntryDescriptor( final String key,
  +                            final String classname,
  +                            final boolean optional, 
  +                            final boolean isVolatile,
  +                            final String alias ) throws NullPointerException
       {
           if ( null == key )
           {
               throw new NullPointerException( "key" );
           }
  -
  -        if ( null == type )
  +        if ( null == classname )
           {
  -            throw new NullPointerException( "type" );
  +            throw new NullPointerException( "classnamei" );
           }
   
           m_key = key;
  -        m_type = type;
  +        m_classname = classname;
           m_optional = optional;
  +        m_volatile = isVolatile;
           m_alias = alias;
       }
   
  @@ -153,7 +176,7 @@
       }
   
       /**
  -     * Return the alias that Component uses to lookup entry.
  +     * Return the alias that Component uses to lookup the entry.
        *
        * @return the alias to the key.
        */
  @@ -167,9 +190,9 @@
        *
        * @return the key type of value that is stored in Context.
        */
  -    public String getType()
  +    public String getClassname()
       {
  -        return m_type;
  +        return m_classname;
       }
   
       /**
  @@ -192,6 +215,16 @@
           return !isOptional();
       }
   
  +    /**
  +     * Return true if entry is volotile.
  +     *
  +     * @return the volatile state of the entry
  +     */
  +    public boolean isVolatile()
  +    {
  +        return m_volatile;
  +    }
  +
       public boolean equals( Object other )
       {
           boolean isEqual = other instanceof EntryDescriptor;
  @@ -201,9 +234,9 @@
               EntryDescriptor entry = (EntryDescriptor) other;
   
               isEqual = isEqual && m_key.equals( entry.m_key );
  -            isEqual = isEqual && m_type.equals( entry.m_type );
  +            isEqual = isEqual && m_classname.equals( entry.m_classname );
               isEqual = isEqual && m_optional == entry.m_optional;
  -
  +            isEqual = isEqual && m_volatile == entry.m_volatile;
               if ( null == m_alias )
               {
                   isEqual = isEqual && null == entry.m_alias;
  @@ -221,9 +254,11 @@
       {
           int hash = m_key.hashCode();
           hash >>>= 13;
  +        hash ^= m_classname.hashCode();
  +        hash >>>= 13;
           hash ^= ( null != m_alias ) ? m_alias.hashCode() : 0;
           hash >>>= 13;
  -        hash ^= m_type.hashCode();
  +        hash >>>= ( m_volatile ) ? 1 : 3;
           hash >>>= ( m_optional ) ? 1 : 3;
   
           return hash;
  
  
  
  1.3       +7 -4      avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java
  
  Index: XMLLegacyCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLLegacyCreator.java	10 Jul 2003 21:19:08 -0000	1.2
  +++ XMLLegacyCreator.java	11 Jul 2003 04:49:33 -0000	1.3
  @@ -200,10 +200,13 @@
           ReferenceDescriptor reference = 
              createReference( "org.apache.avalon.framework.context.Context" );
           EntryDescriptor name = 
  -          new EntryDescriptor( "urn:avalon:name", "block.name", "java.lang.String", false
);
  +          new EntryDescriptor( "urn:avalon:name", "java.lang.String", false, false, "block.name"
);
  +        EntryDescriptor partition = 
  +          new EntryDescriptor( "urn:avalon:partition", "java.lang.String", false, false,
"app.name" );
           EntryDescriptor home = 
  -          new EntryDescriptor( "urn:avalon:home", "app.home", "java.io.File", false );
  -        return new ContextDescriptor( reference, new EntryDescriptor[]{ name, home }, null
);
  +          new EntryDescriptor( "urn:avalon:home", "java.io.File", false, false, "app.home"
);
  +        return new ContextDescriptor( 
  +          reference, new EntryDescriptor[]{ name, partition, home }, null );
       }
   
       /**
  
  
  
  1.2       +4 -4      avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLServiceCreator.java
  
  Index: XMLServiceCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/builder/XMLServiceCreator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XMLServiceCreator.java	10 Jul 2003 12:10:12 -0000	1.1
  +++ XMLServiceCreator.java	11 Jul 2003 04:49:33 -0000	1.2
  @@ -203,11 +203,11 @@
       {
           final String key = config.getAttribute( "key" );
           final String type = config.getAttribute( "type", "java.lang.String" );
  -        final String alias = config.getAttribute( "alias", null );
  +        final boolean isVolatile = config.getAttributeAsBoolean( "volatile", false );
           final boolean optional =
               config.getAttributeAsBoolean( "optional", false );
  -
  -        return new EntryDescriptor( key, alias, type, optional );
  +        final String alias = config.getAttribute( "alias", null );
  +        return new EntryDescriptor( key, type, optional, isVolatile, alias );
       }
   
   
  
  
  
  1.4       +10 -7     avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/writer/XMLTypeWriter.java
  
  Index: XMLTypeWriter.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/impl/src/java/org/apache/avalon/meta/info/writer/XMLTypeWriter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLTypeWriter.java	10 Jul 2003 21:22:27 -0000	1.3
  +++ XMLTypeWriter.java	11 Jul 2003 04:49:33 -0000	1.4
  @@ -69,7 +69,6 @@
    * Write {@link Type} objects to a stream as xml documents.
    *
    * @todo Address configuration schema support
  - * @todo Add context entry alias
    * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
    * @version $Revision$ $Date$
    */
  @@ -278,15 +277,19 @@
           writer.write( "\n    <entry key=\"" );
           writer.write( entry.getKey() );
           writer.write( "\" type=\"" );
  -        writer.write( entry.getType() );
  -
  -        //
  -        // ## need to add alias
  -        //
  +        writer.write( entry.getClassname() );
   
  +        if( entry.getAlias() != null )
  +        {
  +            writer.write( "\" alias=\"" + entry.getAlias() + "\"" );
  +        }
           if( entry.isOptional() )
           {
               writer.write( "\" optional=\"true" );
  +        }
  +        if( entry.isVolatile() )
  +        {
  +            writer.write( "\" volatile=\"true" );
           }
   
           writer.write( "\"/>" );
  
  
  
  1.2       +26 -17    avalon-sandbox/meta/tools/src/java/org/apache/avalon/meta/info/builder/tags/ContextTag.java
  
  Index: ContextTag.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/tools/src/java/org/apache/avalon/meta/info/builder/tags/ContextTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContextTag.java	10 Jul 2003 12:10:39 -0000	1.1
  +++ ContextTag.java	11 Jul 2003 04:49:33 -0000	1.2
  @@ -86,6 +86,11 @@
       public static final String KEY_PARAM = "key";
   
      /**
  +    * The javadoc context tag volatile flag.
  +    */
  +    public static final String VOLATILE_PARAM = "volatile";
  +
  +   /**
       * The javadoc context tag alias parameter.
       */
       public static final String ALIAS_PARAM = "alias";
  @@ -136,21 +141,22 @@
   
               final ArrayList list = new ArrayList();
               final Set marked = new HashSet( 10 );
  -	    for( int j = 0; j < methods.length; j++ )
  -	    {
  -		final DocletTag[] tags = 
  -              methods[j].getTagsByName( getNS() + Tags.DELIMITER + ENTRY );
  -		for( int i = 0; i < tags.length; i++ )
  -		{
  -		    final String key = getNamedParameter( tags[i], KEY_PARAM );
  -		    if( !marked.contains( key ) ){
  -			list.add( getEntry( tags[i] ) );
  -			marked.add( key );
  -		    }
  -		}
  -	    }
  -	    final EntryDescriptor[] entries =
  -		(EntryDescriptor[])list.toArray( new EntryDescriptor[ list.size() ] );
  +            for( int j = 0; j < methods.length; j++ )
  +            {
  +                final DocletTag[] tags = 
  +                  methods[j].getTagsByName( getNS() + Tags.DELIMITER + ENTRY );
  +                for( int i = 0; i < tags.length; i++ )
  +                {
  +                    final String key = getNamedParameter( tags[i], KEY_PARAM );
  +                    if( !marked.contains( key ) )
  +                    {
  +                        list.add( getEntry( tags[i] ) );
  +                        marked.add( key );
  +                    }
  +                }
  +            }
  +            final EntryDescriptor[] entries =
  +              (EntryDescriptor[])list.toArray( new EntryDescriptor[ list.size() ] );
               return new ContextDescriptor(
                 new ReferenceDescriptor( type ), entries, null );
           }
  @@ -159,9 +165,12 @@
       private EntryDescriptor getEntry( DocletTag tag )
       {
           final String key = getNamedParameter( tag, KEY_PARAM );
  +        final String alias = getNamedParameter( tag, ALIAS_PARAM, null );
           final String entryType = getNamedParameter( tag, TYPE_PARAM );
           final String optional = getNamedParameter( tag, OPTIONAL_PARAM, "false" );
           final boolean isOptional = "true".equals( optional );
  -        return new EntryDescriptor( key, entryType, isOptional );
  +        final String volatileValue = getNamedParameter( tag, VOLATILE_PARAM, "false" );
  +        final boolean isVolatile = "true".equals( volatileValue );
  +        return new EntryDescriptor( key, entryType, isOptional, isVolatile, alias );
       }
   }
  
  
  
  1.4       +1 -1      avalon-sandbox/meta/tools/src/test/org/apache/avalon/meta/MetaTestCase.java
  
  Index: MetaTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/meta/tools/src/test/org/apache/avalon/meta/MetaTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MetaTestCase.java	10 Jul 2003 21:22:27 -0000	1.3
  +++ MetaTestCase.java	11 Jul 2003 04:49:33 -0000	1.4
  @@ -215,7 +215,7 @@
           else
           {
               assertTrue( entry.getKey().equals( "home" ) );
  -            assertTrue( entry.getType().equals( "java.io.File" ) );
  +            assertTrue( entry.getClassname().equals( "java.io.File" ) );
           }
       }
   
  
  
  

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


Mime
View raw message