You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by pr...@apache.org on 2003/03/17 04:46:23 UTC

cvs commit: avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel DefaultApplicationContext.java

proyal      2003/03/16 19:46:22

  Modified:    src/java/org/apache/avalon/phoenix/interfaces
                        ApplicationContext.java
               src/java/org/apache/avalon/phoenix/components/kernel
                        DefaultApplicationContext.java
  Log:
  Make InstrumentManager and Instrumentable name creation
  available to applications
  
  Revision  Changes    Path
  1.23      +16 -0     avalon-phoenix/src/java/org/apache/avalon/phoenix/interfaces/ApplicationContext.java
  
  Index: ApplicationContext.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/interfaces/ApplicationContext.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ApplicationContext.java	1 Mar 2003 08:39:15 -0000	1.22
  +++ ApplicationContext.java	17 Mar 2003 03:46:22 -0000	1.23
  @@ -14,6 +14,7 @@
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.phoenix.containerkit.profile.PartitionProfile;
   import org.apache.excalibur.threadcontext.ThreadContext;
  +import org.apache.excalibur.instrument.InstrumentManager;
   
   /**
    * Manage the "context" in which Applications operate.
  @@ -96,4 +97,19 @@
        * @return the Logger
        */
       Logger getLogger( String name );
  +
  +    /**
  +     * Get the instrument manager to use for this application
  +     *
  +     * @return the InstrumentManager
  +     */
  +    InstrumentManager getInstrumentManager();
  +
  +    /**
  +     * Get the name to use for the instrumentables for the specified component
  +     *
  +     * @param component the component
  +     * @return the name to use for Instrumentables
  +     */
  +    String getInstrumentableName( String component);
   }
  
  
  
  1.36      +29 -2     avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel/DefaultApplicationContext.java
  
  Index: DefaultApplicationContext.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/java/org/apache/avalon/phoenix/components/kernel/DefaultApplicationContext.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- DefaultApplicationContext.java	1 Mar 2003 08:39:14 -0000	1.35
  +++ DefaultApplicationContext.java	17 Mar 2003 03:46:22 -0000	1.36
  @@ -13,6 +13,7 @@
   import java.io.InputStream;
   import java.util.HashMap;
   import java.util.Map;
  +
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.activity.Initializable;
  @@ -33,6 +34,7 @@
   import org.apache.avalon.phoenix.interfaces.Kernel;
   import org.apache.avalon.phoenix.interfaces.ManagerException;
   import org.apache.avalon.phoenix.interfaces.SystemManager;
  +import org.apache.excalibur.instrument.InstrumentManager;
   import org.apache.excalibur.threadcontext.ThreadContext;
   import org.apache.excalibur.threadcontext.impl.DefaultThreadContextPolicy;
   
  @@ -64,6 +66,9 @@
       //Validator to validate configuration against
       private ConfigurationValidator m_validator;
   
  +    //InstrumentManager to register instruments with
  +    private InstrumentManager m_instrumentManager;
  +
       ///Place to expose Management beans
       private SystemManager m_systemManager;
   
  @@ -133,6 +138,7 @@
           m_validator = (ConfigurationValidator)serviceManager.
               lookup( ConfigurationValidator.ROLE );
           m_kernel = (Kernel)serviceManager.lookup( Kernel.ROLE );
  +        m_instrumentManager = (InstrumentManager)serviceManager.lookup( InstrumentManager.ROLE );
       }
   
       public void initialize()
  @@ -181,13 +187,13 @@
           {
               public void run()
               {
  -                schedulShutdown();
  +                scheduleShutdown();
               }
           };
           thread.start();
       }
   
  -    private void schedulShutdown()
  +    private void scheduleShutdown()
       {
           try
           {
  @@ -325,6 +331,27 @@
           final SystemManager appContext =
               m_systemManager.getSubContext( null, "application" );
           return appContext.getSubContext( getName(), "block" );
  +    }
  +
  +    /**
  +     * Get the instrument manager to use for this application
  +     *
  +     * @return the InstrumentManager
  +     */
  +    public InstrumentManager getInstrumentManager()
  +    {
  +        return m_instrumentManager;
  +    }
  +
  +    /**
  +     * Get the name to use for the instrumentables for the specified component
  +     *
  +     * @param component the component
  +     * @return the name to use for Instrumentables
  +     */
  +    public String getInstrumentableName( String component )
  +    {
  +        return ContainerConstants.ROOT_INSTRUMENT_CATEGORY + "." + getName() + "." + component;
       }
   
       private String getName()
  
  
  

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