You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2002/03/05 10:31:03 UTC

cvs commit: jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler DefaultProfilerManager.java ProfilableDescriptor.java ProfilableProxy.java ProfilePointDescriptor.java ProfilerManager.java

leif        02/03/05 01:31:03

  Modified:    src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler
                        DefaultProfilerManager.java
                        ProfilableDescriptor.java ProfilableProxy.java
                        ProfilePointDescriptor.java ProfilerManager.java
  Log:
  Make it possible to look up Profilables and ProflePoints using the names of child
  profile elements.
  
  Revision  Changes    Path
  1.2       +37 -4     jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/DefaultProfilerManager.java
  
  Index: DefaultProfilerManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/DefaultProfilerManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultProfilerManager.java	3 Mar 2002 15:59:43 -0000	1.1
  +++ DefaultProfilerManager.java	5 Mar 2002 09:31:03 -0000	1.2
  @@ -28,7 +28,7 @@
   /**
    *
    * @author <a href="mailto:leif@silveregg.co.jp">Leif Mortenson</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/03/03 15:59:43 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/03/05 09:31:03 $
    * @since 4.1
    */
   public class DefaultProfilerManager
  @@ -159,7 +159,8 @@
        * ProfilerManager Methods
        *-------------------------------------------------------------*/
       /**
  -     * Returns a ProfilableDescriptor based on its name.
  +     * Returns a ProfilableDescriptor based on its name or the name of any
  +     *  of its children.
        *
        * @param profilableName Name of the Profilable being requested.
        *
  @@ -171,11 +172,11 @@
       public ProfilableDescriptor getProfilableDescriptor( String profilableName )
           throws NoSuchProfilableException
       {
  -        ProfilableProxy proxy = (ProfilableProxy)m_profilableProxies.get( profilableName );
  +        ProfilableProxy proxy = getProfilableProxy( profilableName );
           if ( proxy == null )
           {
               throw new NoSuchProfilableException(
  -                "No profilable with name, " + profilableName + ", has been registered." );
  +                "No profilable can be found using name: " + profilableName );
           }
           
           return proxy.getDescriptor();
  @@ -315,6 +316,38 @@
       /*---------------------------------------------------------------
        * Methods
        *-------------------------------------------------------------*/
  +    /**
  +     * Returns a ProfilableDescriptor based on its name or the name of any
  +     *  of its children.
  +     *
  +     * @param profilableName Name of the Profilable being requested.
  +     *
  +     * @return A Descriptor of the requested Profilable or null if not found.
  +     */
  +    private ProfilableProxy getProfilableProxy( String profilableName )
  +    {
  +        String name = profilableName;
  +        while( true )
  +        {
  +            ProfilableProxy proxy = (ProfilableProxy)m_profilableProxies.get( name );
  +            if ( proxy != null )
  +            {
  +                return proxy;
  +            }
  +            
  +            // Assume this is a child name and try looking with the parent name.
  +            int pos = name.lastIndexOf( '.' );
  +            if ( pos > 0 )
  +            {
  +                name = name.substring( 0, pos );
  +            }
  +            else
  +            {
  +                return null;
  +            }
  +        }
  +    }
  +    
       /**
        * Updates the Memory based Profile Points published by the ProfilerManager.
        */
  
  
  
  1.2       +4 -3      jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/ProfilableDescriptor.java
  
  Index: ProfilableDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/ProfilableDescriptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProfilableDescriptor.java	3 Mar 2002 15:59:43 -0000	1.1
  +++ ProfilableDescriptor.java	5 Mar 2002 09:31:03 -0000	1.2
  @@ -14,7 +14,7 @@
    *  Profilable.
    *
    * @author <a href="mailto:leif@silveregg.co.jp">Leif Mortenson</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/03/03 15:59:43 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/03/05 09:31:03 $
    * @since 4.1
    */
   public class ProfilableDescriptor
  @@ -89,7 +89,8 @@
               m_profilableProxy.getProfilePointProxy( profilePointName );
           if ( profilePointProxy == null )
           {
  -            throw new NoSuchProfilePointException( "The requested ProfilePoint does not exist." );
  +            throw new NoSuchProfilePointException(
  +                "No profile point can be found using name: " + profilePointName );
           }
           
           return profilePointProxy.getDescriptor();
  @@ -104,6 +105,6 @@
        */
       public ProfilePointDescriptor[] getProfilePointDescriptors()
       {
  -		return m_profilableProxy.getProfilePointDescriptors();
  +        return m_profilableProxy.getProfilePointDescriptors();
       }
   }
  
  
  
  1.2       +226 -206  jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/ProfilableProxy.java
  
  Index: ProfilableProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/ProfilableProxy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProfilableProxy.java	3 Mar 2002 15:59:43 -0000	1.1
  +++ ProfilableProxy.java	5 Mar 2002 09:31:03 -0000	1.2
  @@ -21,12 +21,12 @@
    * Not Synchronized.
    *
    * @author <a href="mailto:leif@silveregg.co.jp">Leif Mortenson</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/03/03 15:59:43 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/03/05 09:31:03 $
    * @since 4.1
    */
   class ProfilableProxy
  -	extends AbstractLogEnabled
  -	implements Configurable
  +    extends AbstractLogEnabled
  +    implements Configurable
   {
       /** Configured flag. */
       private boolean m_configured;
  @@ -36,251 +36,271 @@
       
       /** The description of the Profilable. */
       private String m_description;
  -	
  -	/** The Descriptor for the Profilable. */
  -	private ProfilableDescriptor m_descriptor;
  +    
  +    /** The Descriptor for the Profilable. */
  +    private ProfilableDescriptor m_descriptor;
       
       /** Map of the ProfilePointProxies owned by this ProfilableProxy. */
       private HashMap m_profilePointProxies = new HashMap();
       
  -	/** Optimized array of the ProfilePointProxies. */
  +    /** Optimized array of the ProfilePointProxies. */
       private ProfilePointProxy[] m_profilePointProxyArray;
  -	
  -	/** Optimized array of the ProfilePointDescriptors. */
  -	private ProfilePointDescriptor[] m_profilePointDescriptorArray;
  -	
  +    
  +    /** Optimized array of the ProfilePointDescriptors. */
  +    private ProfilePointDescriptor[] m_profilePointDescriptorArray;
  +    
       /*---------------------------------------------------------------
  -	 * Constructors
  -	 *-------------------------------------------------------------*/
  +     * Constructors
  +     *-------------------------------------------------------------*/
       /**
  -	 * Creates a new ProfilableProxy.
  -	 *
  -	 * @param name The name used to identify a Profilable.
  -	 */
  +     * Creates a new ProfilableProxy.
  +     *
  +     * @param name The name used to identify a Profilable.
  +     */
       ProfilableProxy( String name )
       {
  -		// Default description equals the name in case it is not set later.
  -		m_description = m_name = name;
  -		
  -		// Create the descriptor
  -		m_descriptor = new ProfilableDescriptor( this );
  -	}
  -	
  -	/*---------------------------------------------------------------
  -	 * Configurable Methods
  -	 *-------------------------------------------------------------*/
  -	/**
  -	 * Configures the Profilable.  Called from the ProfilerManager's
  -	 *  configure method.  The class does not need to be configured to
  -	 *  function correctly.
  -	 *
  -	 * @param configuration Profilable configuration element from the
  -	 *                      ProfilerManager's configuration.
  -	 *
  -	 * @throws ConfigurationException If there are any configuration problems.
  -	 */
  -	public void configure( Configuration configuration )
  -		throws ConfigurationException
  -	{
  -		synchronized(this)
  -		{
  -			// The description is optional
  -			m_description = configuration.getAttribute( "description", m_name );
  -			
  -			if ( getLogger().isDebugEnabled() )
  -			{
  -				getLogger().debug( "Configuring Profilable: " + m_name + " as \"" +
  -					m_description + "\"" );
  -			}
  -			
  -			m_configured = true;
  -			
  -			// Configure any ProfilePoints
  -			Configuration[] profilePointConfs = configuration.getChildren( "profile-point" );
  -			for ( int i = 0; i < profilePointConfs.length; i++ )
  -			{
  -				Configuration profilePointConf = profilePointConfs[i];
  -				String profilePointName = m_name + "." + profilePointConf.getAttribute( "name" );
  -				
  -				ProfilePointProxy profilePointProxy = new ProfilePointProxy( profilePointName );
  -				profilePointProxy.enableLogging( getLogger() );
  -				profilePointProxy.configure( profilePointConf );
  -				m_profilePointProxies.put( profilePointName, profilePointProxy );
  -				
  -				// Clear the optimized arrays
  -				m_profilePointProxyArray = null;
  -				m_profilePointDescriptorArray = null;
  -			}
  -		}
  -	}
  -		
  +        // Default description equals the name in case it is not set later.
  +        m_description = m_name = name;
  +        
  +        // Create the descriptor
  +        m_descriptor = new ProfilableDescriptor( this );
  +    }
  +    
  +    /*---------------------------------------------------------------
  +     * Configurable Methods
  +     *-------------------------------------------------------------*/
  +    /**
  +     * Configures the Profilable.  Called from the ProfilerManager's
  +     *  configure method.  The class does not need to be configured to
  +     *  function correctly.
  +     *
  +     * @param configuration Profilable configuration element from the
  +     *                      ProfilerManager's configuration.
  +     *
  +     * @throws ConfigurationException If there are any configuration problems.
  +     */
  +    public void configure( Configuration configuration )
  +        throws ConfigurationException
  +    {
  +        synchronized(this)
  +        {
  +            // The description is optional
  +            m_description = configuration.getAttribute( "description", m_name );
  +            
  +            if ( getLogger().isDebugEnabled() )
  +            {
  +                getLogger().debug( "Configuring Profilable: " + m_name + " as \"" +
  +                    m_description + "\"" );
  +            }
  +            
  +            m_configured = true;
  +            
  +            // Configure any ProfilePoints
  +            Configuration[] profilePointConfs = configuration.getChildren( "profile-point" );
  +            for ( int i = 0; i < profilePointConfs.length; i++ )
  +            {
  +                Configuration profilePointConf = profilePointConfs[i];
  +                String profilePointName = m_name + "." + profilePointConf.getAttribute( "name" );
  +                
  +                ProfilePointProxy profilePointProxy = new ProfilePointProxy( profilePointName );
  +                profilePointProxy.enableLogging( getLogger() );
  +                profilePointProxy.configure( profilePointConf );
  +                m_profilePointProxies.put( profilePointName, profilePointProxy );
  +                
  +                // Clear the optimized arrays
  +                m_profilePointProxyArray = null;
  +                m_profilePointDescriptorArray = null;
  +            }
  +        }
  +    }
  +        
       /*---------------------------------------------------------------
  -	 * Methods
  -	 *-------------------------------------------------------------*/
  +     * Methods
  +     *-------------------------------------------------------------*/
       /**
  -	 * Returns true if the profilable was configured in the profilables
  -	 *  section of the configuration.
  -	 *
  -	 * @return True if configured.
  -	 */
  +     * Returns true if the profilable was configured in the profilables
  +     *  section of the configuration.
  +     *
  +     * @return True if configured.
  +     */
       boolean isConfigured()
       {
           return m_configured;
       }
       
       /**
  -	 * Gets the name for the Profilable.  The Profilable Name is used to
  -	 *  uniquely identify the Profilable during the configuration of the
  -	 *  Profiler and to gain access to a ProfilableDescriptor through a
  -	 *  ProfilerManager.
  -	 *
  -	 * @return The name used to identify a Profilable.
  -	 */
  +     * Gets the name for the Profilable.  The Profilable Name is used to
  +     *  uniquely identify the Profilable during the configuration of the
  +     *  Profiler and to gain access to a ProfilableDescriptor through a
  +     *  ProfilerManager.
  +     *
  +     * @return The name used to identify a Profilable.
  +     */
       String getName() 
       {
           return m_name;
       }
       
       /**
  -	 * Sets the description for the profilable object.  This description will
  -	 *  be set during the configuration of the profiler if a configuration
  -	 *  exists for this Profilable.
  -	 *
  -	 * @param description The description of the Profilable.
  -	 */
  +     * Sets the description for the profilable object.  This description will
  +     *  be set during the configuration of the profiler if a configuration
  +     *  exists for this Profilable.
  +     *
  +     * @param description The description of the Profilable.
  +     */
       void setDescription( String description )
       {
           m_description = description;
       }
       
       /**
  -	 * Gets the description of the Profilable.
  -	 *
  -	 * @return The description of the Profilable.
  -	 */
  +     * Gets the description of the Profilable.
  +     *
  +     * @return The description of the Profilable.
  +     */
       String getDescription()
       {
           return m_description;
       }
       
  -	/**
  -	 * Returns a Descriptor for the Profilable.
  -	 *
  -	 * @return A Descriptor for the Profilable.
  -	 */
  -	ProfilableDescriptor getDescriptor()
  -	{
  -		return m_descriptor;
  -	}
  -	
  -	/**
  -	 * Adds a ProfilePointProxy to the Profilable.  This method will be
  -	 *  called during the configuration phase of the Profiler if an element
  -	 *  defining the ProfilePoint exists, or if the ProfilePoint registers
  -	 *  itself with the ProfilerManager as it is running.
  -	 * <p>
  -	 * This method should never be called for ProfilePoints which have already
  -	 *  been added.
  -	 *
  -	 * @param profilePointProxy ProfilePointProxy to be added.
  -	 */
  -	void addProfilePointProxy( ProfilePointProxy profilePointProxy )
  -	{
  -		synchronized(this)
  -		{
  -			m_profilePointProxies.put( profilePointProxy.getName(), profilePointProxy );
  -			
  -			// Clear the optimized arrays
  -			m_profilePointProxyArray = null;
  -			m_profilePointDescriptorArray = null;
  -		}
  -	}
  -	
  -    /**
  -	 * Returns a ProfilePointProxy based on its name.
  -	 *
  -	 * @param profilePointName Name of the ProfilePoint being requested.
  -	 *
  -	 * @return The requested ProfilePointProxy or null if does not exist.
  -	 */
  +    /**
  +     * Returns a Descriptor for the Profilable.
  +     *
  +     * @return A Descriptor for the Profilable.
  +     */
  +    ProfilableDescriptor getDescriptor()
  +    {
  +        return m_descriptor;
  +    }
  +    
  +    /**
  +     * Adds a ProfilePointProxy to the Profilable.  This method will be
  +     *  called during the configuration phase of the Profiler if an element
  +     *  defining the ProfilePoint exists, or if the ProfilePoint registers
  +     *  itself with the ProfilerManager as it is running.
  +     * <p>
  +     * This method should never be called for ProfilePoints which have already
  +     *  been added.
  +     *
  +     * @param profilePointProxy ProfilePointProxy to be added.
  +     */
  +    void addProfilePointProxy( ProfilePointProxy profilePointProxy )
  +    {
  +        synchronized(this)
  +        {
  +            m_profilePointProxies.put( profilePointProxy.getName(), profilePointProxy );
  +            
  +            // Clear the optimized arrays
  +            m_profilePointProxyArray = null;
  +            m_profilePointDescriptorArray = null;
  +        }
  +    }
  +    
  +    /**
  +     * Returns a ProfilePointProxy based on its name or the name of any
  +     *  of its children.
  +     *
  +     * @param profilePointName Name of the ProfilePoint being requested.
  +     *
  +     * @return The requested ProfilePointProxy or null if does not exist.
  +     */
       ProfilePointProxy getProfilePointProxy( String profilePointName )
       {
           synchronized(this)
           {
  -            return (ProfilePointProxy)m_profilePointProxies.get( profilePointName );
  +            String name = profilePointName;
  +            while( true )
  +            {
  +                ProfilePointProxy proxy = (ProfilePointProxy)m_profilePointProxies.get( name );
  +                if ( proxy != null )
  +                {
  +                    return proxy;
  +                }
  +                
  +                // Assume this is a child name and try looking with the parent name.
  +                int pos = name.lastIndexOf( '.' );
  +                if ( pos > 0 )
  +                {
  +                    name = name.substring( 0, pos );
  +                }
  +                else
  +                {
  +                    return null;
  +                }
  +            }
           }
       }
       
       /**
  -	 * Returns an array of Proxies to the ProfilePoints in the Profilable.
  -	 *
  -	 * @return An array of Proxies to the ProfilePoints in the Profilable.
  -	 */
  +     * Returns an array of Proxies to the ProfilePoints in the Profilable.
  +     *
  +     * @return An array of Proxies to the ProfilePoints in the Profilable.
  +     */
       ProfilePointProxy[] getProfilePointProxies()
       {
  -		ProfilePointProxy[] proxies = m_profilePointProxyArray;
  -		if ( proxies == null )
  -		{
  -			proxies = updateProfilePointProxyArray();
  -		}
  -		return proxies;
  -    }
  -	
  -	/**
  -	 * Returns an array of Descriptors for the ProfilePoints in the Profilable.
  -	 *
  -	 * @return An array of Descriptors for the ProfilePoints in the Profilable.
  -	 */
  -	ProfilePointDescriptor[] getProfilePointDescriptors()
  -	{
  -		ProfilePointDescriptor[] descriptors = m_profilePointDescriptorArray;
  -		if ( descriptors == null )
  -		{
  -			descriptors = updateProfilePointDescriptorArray();
  -		}
  -		return descriptors;
  -	}
  -	
  -	/**
  -	 * Updates the cached array of ProfilePointProxies taking
  -	 *  synchronization into account.
  -	 *
  -	 * @return An array of the ProfilePointProxies.
  -	 */
  -	private ProfilePointProxy[] updateProfilePointProxyArray()
  -	{
  -		synchronized(this)
  -		{
  -			m_profilePointProxyArray = new ProfilePointProxy[ m_profilePointProxies.size() ];
  -			m_profilePointProxies.values().toArray( m_profilePointProxyArray );
  -			
  -			return m_profilePointProxyArray;
  -		}
  -	}
  -	
  -	/**
  -	 * Updates the cached array of ProfilePointDescriptors taking
  -	 *  synchronization into account.
  -	 *
  -	 * @return An array of the ProfilePointDescriptors.
  -	 */
  -	private ProfilePointDescriptor[] updateProfilePointDescriptorArray()
  -	{
  -		synchronized(this)
  -		{
  -			if ( m_profilePointProxyArray == null )
  -			{
  -				updateProfilePointProxyArray();
  -			}
  -			
  -			m_profilePointDescriptorArray =
  -				new ProfilePointDescriptor[ m_profilePointProxyArray.length ];
  -			for ( int i = 0; i < m_profilePointProxyArray.length; i++ )
  -			{
  -				m_profilePointDescriptorArray[i] = m_profilePointProxyArray[i].getDescriptor();
  -			}
  -			
  -			return m_profilePointDescriptorArray;
  -		}
  -	}
  +        ProfilePointProxy[] proxies = m_profilePointProxyArray;
  +        if ( proxies == null )
  +        {
  +            proxies = updateProfilePointProxyArray();
  +        }
  +        return proxies;
  +    }
  +    
  +    /**
  +     * Returns an array of Descriptors for the ProfilePoints in the Profilable.
  +     *
  +     * @return An array of Descriptors for the ProfilePoints in the Profilable.
  +     */
  +    ProfilePointDescriptor[] getProfilePointDescriptors()
  +    {
  +        ProfilePointDescriptor[] descriptors = m_profilePointDescriptorArray;
  +        if ( descriptors == null )
  +        {
  +            descriptors = updateProfilePointDescriptorArray();
  +        }
  +        return descriptors;
  +    }
  +    
  +    /**
  +     * Updates the cached array of ProfilePointProxies taking
  +     *  synchronization into account.
  +     *
  +     * @return An array of the ProfilePointProxies.
  +     */
  +    private ProfilePointProxy[] updateProfilePointProxyArray()
  +    {
  +        synchronized(this)
  +        {
  +            m_profilePointProxyArray = new ProfilePointProxy[ m_profilePointProxies.size() ];
  +            m_profilePointProxies.values().toArray( m_profilePointProxyArray );
  +            
  +            return m_profilePointProxyArray;
  +        }
  +    }
  +    
  +    /**
  +     * Updates the cached array of ProfilePointDescriptors taking
  +     *  synchronization into account.
  +     *
  +     * @return An array of the ProfilePointDescriptors.
  +     */
  +    private ProfilePointDescriptor[] updateProfilePointDescriptorArray()
  +    {
  +        synchronized(this)
  +        {
  +            if ( m_profilePointProxyArray == null )
  +            {
  +                updateProfilePointProxyArray();
  +            }
  +            
  +            m_profilePointDescriptorArray =
  +                new ProfilePointDescriptor[ m_profilePointProxyArray.length ];
  +            for ( int i = 0; i < m_profilePointProxyArray.length; i++ )
  +            {
  +                m_profilePointDescriptorArray[i] = m_profilePointProxyArray[i].getDescriptor();
  +            }
  +            
  +            return m_profilePointDescriptorArray;
  +        }
  +    }
   }
  
  
  
  1.2       +114 -113  jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/ProfilePointDescriptor.java
  
  Index: ProfilePointDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/ProfilePointDescriptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProfilePointDescriptor.java	3 Mar 2002 15:59:43 -0000	1.1
  +++ ProfilePointDescriptor.java	5 Mar 2002 09:31:03 -0000	1.2
  @@ -14,7 +14,7 @@
    *  ProfilePoint.
    *
    * @author <a href="mailto:leif@silveregg.co.jp">Leif Mortenson</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/03/03 15:59:43 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/03/05 09:31:03 $
    * @since 4.1
    */
   public class ProfilePointDescriptor
  @@ -23,135 +23,135 @@
       private ProfilePointProxy m_profilePointProxy;
       
       /*---------------------------------------------------------------
  -	 * Constructors
  -	 *-------------------------------------------------------------*/
  +     * Constructors
  +     *-------------------------------------------------------------*/
       /**
  -	 * Creates a new ProfilePointDescriptor.
  -	 *
  -	 * @param profilePointProxy ProfilePointProxy being described.
  -	 */
  +     * Creates a new ProfilePointDescriptor.
  +     *
  +     * @param profilePointProxy ProfilePointProxy being described.
  +     */
       ProfilePointDescriptor( ProfilePointProxy profilePointProxy )
       {
           m_profilePointProxy = profilePointProxy;
       }
       
       /*---------------------------------------------------------------
  -	 * Methods
  -	 *-------------------------------------------------------------*/
  +     * Methods
  +     *-------------------------------------------------------------*/
       /**
  -	 * Returns true if the ProfilePoint was configured in the profilables
  -	 *  section of the configuration.
  -	 *
  -	 * @return True if configured.
  -	 */
  +     * Returns true if the ProfilePoint was configured in the profilables
  +     *  section of the configuration.
  +     *
  +     * @return True if configured.
  +     */
       public boolean isConfigured()
       {
           return m_profilePointProxy.isConfigured();
       }
       
       /**
  -	 * Gets the name for the ProfilePoint.  The ProfilePoint Name is used to
  -	 *  uniquely identify the ProfilePoint during the configuration of the
  -	 *  Profiler.  The value should be a string which does not contain spaces
  -	 *  or periods.
  -	 *
  -	 * @return The name used to identify a ProfilePoint.
  -	 */
  +     * Gets the name for the ProfilePoint.  The ProfilePoint Name is used to
  +     *  uniquely identify the ProfilePoint during the configuration of the
  +     *  Profiler.  The value should be a string which does not contain spaces
  +     *  or periods.
  +     *
  +     * @return The name used to identify a ProfilePoint.
  +     */
       public String getName() 
       {
           return m_profilePointProxy.getName();
       }
       
       /**
  -	 * Gets the description of the ProfilePoint.
  -	 *
  -	 * @return The description of the ProfilePoint.
  -	 */
  +     * Gets the description of the ProfilePoint.
  +     *
  +     * @return The description of the ProfilePoint.
  +     */
       public String getDescription()
       {
           return m_profilePointProxy.getDescription();
       }
       
  -	/**
  -	 * Returns the type of the ProfilePoint.
  -	 *
  -	 * @return The type of the ProfilePoint.
  -	 */
  -	public int getType()
  -	{
  -		return m_profilePointProxy.getType();
  -	}
  -	
  -	/**
  -	 * Adds a CounterProfilePointListener to the list of listeners which will
  -	 *  receive updates of the value of the ProfilePoint.
  -	 *
  -	 * @param listener CounterProfilePointListener which will start receiving
  -	 *                 profile updates.
  -	 *
  -	 * @throws IllegalStateException If the ProfilePoint's type is not
  -	 *         ProfilerManager.PROFILE_POINT_TYPE_COUNTER.
  -	 */
  -	public void addCounterProfilePointListener( CounterProfilePointListener listener )
  -	{
  -		m_profilePointProxy.addCounterProfilePointListener( listener );
  -	}
  -	
  -	/**
  -	 * Removes a ProfilePointListener from the list of listeners which will
  -	 *  receive profile events.
  -	 *
  -	 * @param listener ProfilePointListener which will stop receiving profile
  -	 *                 events.
  -	 *
  -	 * @throws IllegalStateException If the ProfilePoint's type is not
  -	 *         ProfilerManager.PROFILE_POINT_TYPE_COUNTER.
  -	 */
  -	public void removeCounterProfilePointListener( CounterProfilePointListener listener )
  -	{
  -		m_profilePointProxy.removeCounterProfilePointListener( listener );
  -	}
  -	
  -	/**
  -	 * Adds a ValueProfilePointListener to the list of listeners which will
  -	 *  receive updates of the value of the ProfilePoint.
  -	 *
  -	 * @param listener ValueProfilePointListener which will start receiving
  -	 *                 profile updates.
  -	 *
  -	 * @throws IllegalStateException If the ProfilePoint's type is not
  -	 *         ProfilerManager.PROFILE_POINT_TYPE_VALUE.
  -	 */
  -	public void addValueProfilePointListener( ValueProfilePointListener listener )
  -	{
  -		m_profilePointProxy.addValueProfilePointListener( listener );
  -	}
  -		
  -	/**
  -	 * Removes a ProfilePointListener from the list of listeners which will
  -	 *  receive profile events.
  -	 *
  -	 * @param listener ProfilePointListener which will stop receiving profile
  -	 *                 events.
  -	 *
  -	 * @throws IllegalStateException If the ProfilePoint's type is not
  -	 *         ProfilerManager.PROFILE_POINT_TYPE_VALUE.
  -	 */
  -	void removeValueProfilePointListener( ValueProfilePointListener listener )
  -	{
  -		m_profilePointProxy.removeValueProfilePointListener( listener );
  -	}
  -	
  -    /**
  -	 * Returns a ProfileSampleDescriptor based on its name.
  -	 *
  -	 * @param profileSampleName Name of the ProfileSample being requested.
  -	 *
  -	 * @return A Descriptor of the requested ProfileSample.
  -	 *
  -	 * @throws NoSuchProfileSampleException If the specified ProfileSample
  -	 *                                      does not exist.
  -	 */
  +    /**
  +     * Returns the type of the ProfilePoint.
  +     *
  +     * @return The type of the ProfilePoint.
  +     */
  +    public int getType()
  +    {
  +        return m_profilePointProxy.getType();
  +    }
  +    
  +    /**
  +     * Adds a CounterProfilePointListener to the list of listeners which will
  +     *  receive updates of the value of the ProfilePoint.
  +     *
  +     * @param listener CounterProfilePointListener which will start receiving
  +     *                 profile updates.
  +     *
  +     * @throws IllegalStateException If the ProfilePoint's type is not
  +     *         ProfilerManager.PROFILE_POINT_TYPE_COUNTER.
  +     */
  +    public void addCounterProfilePointListener( CounterProfilePointListener listener )
  +    {
  +        m_profilePointProxy.addCounterProfilePointListener( listener );
  +    }
  +    
  +    /**
  +     * Removes a ProfilePointListener from the list of listeners which will
  +     *  receive profile events.
  +     *
  +     * @param listener ProfilePointListener which will stop receiving profile
  +     *                 events.
  +     *
  +     * @throws IllegalStateException If the ProfilePoint's type is not
  +     *         ProfilerManager.PROFILE_POINT_TYPE_COUNTER.
  +     */
  +    public void removeCounterProfilePointListener( CounterProfilePointListener listener )
  +    {
  +        m_profilePointProxy.removeCounterProfilePointListener( listener );
  +    }
  +    
  +    /**
  +     * Adds a ValueProfilePointListener to the list of listeners which will
  +     *  receive updates of the value of the ProfilePoint.
  +     *
  +     * @param listener ValueProfilePointListener which will start receiving
  +     *                 profile updates.
  +     *
  +     * @throws IllegalStateException If the ProfilePoint's type is not
  +     *         ProfilerManager.PROFILE_POINT_TYPE_VALUE.
  +     */
  +    public void addValueProfilePointListener( ValueProfilePointListener listener )
  +    {
  +        m_profilePointProxy.addValueProfilePointListener( listener );
  +    }
  +        
  +    /**
  +     * Removes a ProfilePointListener from the list of listeners which will
  +     *  receive profile events.
  +     *
  +     * @param listener ProfilePointListener which will stop receiving profile
  +     *                 events.
  +     *
  +     * @throws IllegalStateException If the ProfilePoint's type is not
  +     *         ProfilerManager.PROFILE_POINT_TYPE_VALUE.
  +     */
  +    void removeValueProfilePointListener( ValueProfilePointListener listener )
  +    {
  +        m_profilePointProxy.removeValueProfilePointListener( listener );
  +    }
  +    
  +    /**
  +     * Returns a ProfileSampleDescriptor based on its name.
  +     *
  +     * @param profileSampleName Name of the ProfileSample being requested.
  +     *
  +     * @return A Descriptor of the requested ProfileSample.
  +     *
  +     * @throws NoSuchProfileSampleException If the specified ProfileSample
  +     *                                      does not exist.
  +     */
       public ProfileSampleDescriptor getProfileSampleDescriptor( String profileSampleName )
           throws NoSuchProfileSampleException
       {
  @@ -159,21 +159,22 @@
               m_profilePointProxy.getProfileSample( profileSampleName );
           if ( profileSample == null )
           {
  -            throw new NoSuchProfileSampleException( "The requested ProfileSample does not exist." );
  +            throw new NoSuchProfileSampleException(
  +                "No profile sample can be found using name: " + profileSampleName );
           }
           
           return profileSample.getDescriptor();
       }
       
       /**
  -	 * Returns an array of Descriptors for the ProfileSamples configured for this
  -	 *  ProfilePoint.
  -	 *
  -	 * @return An array of Descriptors for the ProfileSamples configured for this
  -	 *  ProfilePoint.
  -	 */
  +     * Returns an array of Descriptors for the ProfileSamples configured for this
  +     *  ProfilePoint.
  +     *
  +     * @return An array of Descriptors for the ProfileSamples configured for this
  +     *  ProfilePoint.
  +     */
       public ProfileSampleDescriptor[] getProfileSampleDescriptors()
       {
  -		return m_profilePointProxy.getProfileSampleDescriptors();
  +        return m_profilePointProxy.getProfileSampleDescriptors();
       }
   }
  
  
  
  1.2       +36 -35    jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/ProfilerManager.java
  
  Index: ProfilerManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/altprofile/profiler/ProfilerManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProfilerManager.java	3 Mar 2002 15:59:43 -0000	1.1
  +++ ProfilerManager.java	5 Mar 2002 09:31:03 -0000	1.2
  @@ -14,7 +14,7 @@
   /**
    *
    * @author <a href="mailto:leif@silveregg.co.jp">Leif Mortenson</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/03/03 15:59:43 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/03/05 09:31:03 $
    * @since 4.1
    */
   public interface ProfilerManager
  @@ -28,45 +28,46 @@
       /** Type which identifies ValueProfilePoints. */
       int PROFILE_POINT_TYPE_VALUE   = 2;
       
  -	/**
  -	 * Returns a ProfilableDescriptor based on its name.
  -	 *
  -	 * @param profilableName Name of the Profilable being requested.
  -	 *
  -	 * @return A Descriptor of the requested Profilable.
  -	 *
  -	 * @throws NoSuchProfilableException If the specified Profilable does
  -	 *                                   not exist.
  -	 */
  -	ProfilableDescriptor getProfilableDescriptor( String profilePointName )
  -		throws NoSuchProfilableException;
  -		
  -	/**
  -	 * Returns an array of Descriptors for the Profilables managed by this
  -	 *  ProfilerManager.
  -	 *
  -	 * @return An array of Descriptors for the Profilables managed by this
  -	 *  ProfilerManager.
  -	 */
  -	ProfilableDescriptor[] getProfilableDescriptors();
  +    /**
  +     * Returns a ProfilableDescriptor based on its name or the name of any
  +     *  of its children.
  +     *
  +     * @param profilableName Name of the Profilable being requested.
  +     *
  +     * @return A Descriptor of the requested Profilable.
  +     *
  +     * @throws NoSuchProfilableException If the specified Profilable does
  +     *                                   not exist.
  +     */
  +    ProfilableDescriptor getProfilableDescriptor( String profilePointName )
  +        throws NoSuchProfilableException;
  +        
  +    /**
  +     * Returns an array of Descriptors for the Profilables managed by this
  +     *  ProfilerManager.
  +     *
  +     * @return An array of Descriptors for the Profilables managed by this
  +     *  ProfilerManager.
  +     */
  +    ProfilableDescriptor[] getProfilableDescriptors();
       
       /**
  -	 * Profilable to be registered with the profile manager.  Should be called
  -	 *  happen whenever a Profilable is created.
  -	 *
  -	 * @param profilable Profilable to register with the ProfilerManager.
  -	 * @param configuration The configuration of the Profilable.
  -	 *
  -	 * @throws Exception if there was a problem registering the Profilable.
  -	 */
  +     * Profilable to be registered with the profile manager.  Should be called
  +     *  happen whenever a Profilable is created.
  +     *
  +     * @param profilable Profilable to register with the ProfilerManager.
  +     * @param configuration The configuration of the Profilable.
  +     *
  +     * @throws Exception if there was a problem registering the Profilable.
  +     */
       void registerProfilable( Profilable profilable, Configuration configuration ) throws Exception;
       
       /**
  -	 * Profilable to be unregistered from the profile manager.  Should be
  -	 *  called whenever a Profilable is disposed.
  -	 *
  -	 * @param profilable Profilable to unregister from the ProfilerManager.
  -	 */
  +     * Profilable to be unregistered from the profile manager.  Should be
  +     *  called whenever a Profilable is disposed.
  +     *
  +     * @param profilable Profilable to unregister from the ProfilerManager.
  +     */
       //void unregisterProfilable( Profilable profilable );
   }
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>