avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pro...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel DefaultApplicationContext.java Resources.properties
Date Sat, 13 Jul 2002 19:39:12 GMT
proyal      2002/07/13 12:39:12

  Modified:    src/java/org/apache/avalon/phoenix/components/kernel
                        DefaultApplicationContext.java Resources.properties
  Log:
  * Throw an exception on validation failure now.
  * Cannot validate BlockListeners yet, temp. workaround.
  
  Revision  Changes    Path
  1.21      +42 -3     jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel/DefaultApplicationContext.java
  
  Index: DefaultApplicationContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel/DefaultApplicationContext.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- DefaultApplicationContext.java	13 Jul 2002 10:07:14 -0000	1.20
  +++ DefaultApplicationContext.java	13 Jul 2002 19:39:11 -0000	1.21
  @@ -21,6 +21,9 @@
   import org.apache.avalon.phoenix.interfaces.ManagerException;
   import org.apache.avalon.phoenix.interfaces.SystemManager;
   import org.apache.avalon.phoenix.metadata.SarMetaData;
  +import org.apache.avalon.phoenix.metadata.BlockListenerMetaData;
  +import org.apache.avalon.excalibur.i18n.Resources;
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.excalibur.threadcontext.ThreadContext;
   import org.apache.excalibur.threadcontext.impl.DefaultThreadContextPolicy;
   import org.apache.log.Hierarchy;
  @@ -30,11 +33,15 @@
    * Manage the "frame" in which Applications operate.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  + * @author <a href="mailto:proyal@apache.org">Peter Royal</a>
    */
   class DefaultApplicationContext
       extends AbstractLogEnabled
       implements ApplicationContext, Serviceable, Initializable
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( DefaultApplicationContext.class );
  +
       //Log Hierarchy for application
       private final Hierarchy m_hierarchy;
   
  @@ -155,15 +162,47 @@
        * @return the Configuration
        */
       public Configuration getConfiguration( final String component )
  -        throws ConfigurationException
  +      throws ConfigurationException
       {
           final Configuration configuration =
               m_repository.getConfiguration( m_metaData.getName(),
                                              component );
   
  -        m_validator.isValid( m_metaData.getName(), component, configuration );
  +        //no validation of listeners just yet..
  +        if( hasBlockListener( component, this.m_metaData.getListeners() ) )
  +        {
  +            return configuration;
  +        }
  +        else if( m_validator.isValid( m_metaData.getName(), component, configuration )
)
  +        {
  +
  +            return configuration;
  +        }
  +        else
  +        {
  +            throw new ConfigurationException( REZ.getString( "applicationcontext.error.invalidconfig",
component ) );
  +        }
  +    }
  +
  +    /**
  +     * Return true if specified array contains entry with specified name.
  +     *
  +     * @param name the blocks name
  +     * @param listeners the set of BlockListenerMetaData objects to search
  +     * @return true if block present, false otherwise
  +     */
  +    private boolean hasBlockListener( final String name,
  +                                      final BlockListenerMetaData[] listeners )
  +    {
  +        for( int i = 0; i < listeners.length; i++ )
  +        {
  +            if( listeners[i].getName().equals( name ) )
  +            {
  +                return true;
  +            }
  +        }
   
  -        return configuration;
  +        return false;
       }
   
       /**
  
  
  
  1.7       +2 -0      jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel/Resources.properties,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Resources.properties	5 Mar 2002 12:39:22 -0000	1.6
  +++ Resources.properties	13 Jul 2002 19:39:11 -0000	1.7
  @@ -12,3 +12,5 @@
   frame.warn.thread-pools=Warning: Configuring ThreadPools via server.xml\nis a deprecated
feature and developers should\nuse a ThreadManager Block to access ThreadPools\nand remove
<threads/> entry from server.xml file.
   frame.error.thread.missing=No such thread pool {0}.
   frame.error.thread.create=Error creating thread pool {0}.
  +
  +applicationcontext.error.invalidconfig=Block "{0}" has invalid configuration information
  \ No newline at end of file
  
  
  

--
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