donaldp     2002/07/13 03:07:14

  Modified:    src/java/org/apache/avalon/phoenix/components/kernel
                        DefaultApplicationContext.java
  Log:
  Line length shortened below 100
  
  Revision  Changes    Path
  1.20      +31 -17    
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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultApplicationContext.java    2 Jul 2002 01:02:12 -0000       1.19
  +++ DefaultApplicationContext.java    13 Jul 2002 10:07:14 -0000      1.20
  @@ -8,6 +8,7 @@
   package org.apache.avalon.phoenix.components.kernel;
   
   import java.util.HashMap;
  +import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  @@ -16,8 +17,9 @@
   import org.apache.avalon.framework.service.Serviceable;
   import org.apache.avalon.phoenix.interfaces.ApplicationContext;
   import org.apache.avalon.phoenix.interfaces.ConfigurationRepository;
  -import org.apache.avalon.phoenix.interfaces.SystemManager;
   import org.apache.avalon.phoenix.interfaces.ConfigurationValidator;
  +import org.apache.avalon.phoenix.interfaces.ManagerException;
  +import org.apache.avalon.phoenix.interfaces.SystemManager;
   import org.apache.avalon.phoenix.metadata.SarMetaData;
   import org.apache.excalibur.threadcontext.ThreadContext;
   import org.apache.excalibur.threadcontext.impl.DefaultThreadContextPolicy;
  @@ -31,7 +33,7 @@
    */
   class DefaultApplicationContext
       extends AbstractLogEnabled
  -    implements ApplicationContext, Serviceable
  +    implements ApplicationContext, Serviceable, Initializable
   {
       //Log Hierarchy for application
       private final Hierarchy m_hierarchy;
  @@ -50,6 +52,7 @@
   
       ///Place to expose Management beans
       private SystemManager m_systemManager;
  +    private SystemManager m_blockManager;
   
       private final SarMetaData m_metaData;
   
  @@ -74,10 +77,16 @@
               lookup( ConfigurationRepository.ROLE );
           m_systemManager = (SystemManager)serviceManager.
               lookup( SystemManager.ROLE );
  -        m_validator = (ConfigurationValidator) serviceManager.
  +        m_validator = (ConfigurationValidator)serviceManager.
               lookup( ConfigurationValidator.ROLE );
       }
   
  +    public void initialize()
  +        throws Exception
  +    {
  +        m_blockManager = getManagementContext();
  +    }
  +
       public SarMetaData getMetaData()
       {
           return m_metaData;
  @@ -124,8 +133,7 @@
                                 final Object object )
           throws Exception
       {
  -        final String longName = getServiceName( name, service );
  -        m_systemManager.register( longName, object, new Class[]{service} );
  +        m_blockManager.register( name, object, new Class[]{service} );
       }
   
       /**
  @@ -137,17 +145,7 @@
       public void unexportObject( final String name, final Class service )
           throws Exception
       {
  -        final String longName = getServiceName( name, service );
  -        m_systemManager.unregister( longName );
  -    }
  -
  -    /**
  -     * Utility method to get the JMX-ized name of service to export
  -     */
  -    private String getServiceName( final String name, final Class service )
  -    {
  -        return name + ",application=" + getMetaData().getName() +
  -            ",role=" + service.getName();
  +        m_blockManager.unregister( name );
       }
   
       /**
  @@ -159,10 +157,26 @@
       public Configuration getConfiguration( final String component )
           throws ConfigurationException
       {
  -        final Configuration configuration = m_repository.getConfiguration( 
m_metaData.getName(), component );
  +        final Configuration configuration =
  +            m_repository.getConfiguration( m_metaData.getName(),
  +                                           component );
   
           m_validator.isValid( m_metaData.getName(), component, configuration 
);
   
           return configuration;
  +    }
  +
  +    /**
  +     *  Returns the local SystemManager where the blocks should be registered
  +     *  for management.
  +     *
  +     *  TODO: context should probably be passed in by reference from the 
kernel
  +     */
  +    private SystemManager getManagementContext()
  +        throws ManagerException
  +    {
  +        final SystemManager appContext =
  +            m_systemManager.getSubContext( null, "application" );
  +        return appContext.getSubContext( m_metaData.getName(), "block" );
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to