avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/interfaces ExtensionManagerMBean.java
Date Sun, 14 Jul 2002 01:36:30 GMT
donaldp     2002/07/13 18:36:30

  Modified:    lib      excalibur-extension-1.0a.jar
               src/java/org/apache/avalon/phoenix/components/extensions
                        DefaultExtensionManager.java
               src/java/org/apache/avalon/phoenix/interfaces
                        ExtensionManagerMBean.java
  Log:
  Upgrade to the new improved ExtensionManager.
  
  Revision  Changes    Path
  1.7       +234 -211  jakarta-avalon-phoenix/lib/excalibur-extension-1.0a.jar
  
  	<<Binary file>>
  
  
  1.2       +7 -91     jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/extensions/DefaultExtensionManager.java
  
  Index: DefaultExtensionManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/extensions/DefaultExtensionManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultExtensionManager.java	10 May 2002 12:02:12 -0000	1.1
  +++ DefaultExtensionManager.java	14 Jul 2002 01:36:29 -0000	1.2
  @@ -8,8 +8,6 @@
   package org.apache.avalon.phoenix.components.extensions;
   
   import java.io.File;
  -import java.io.IOException;
  -import java.util.StringTokenizer;
   import org.apache.avalon.excalibur.extension.DefaultPackageRepository;
   import org.apache.avalon.excalibur.extension.PackageRepository;
   import org.apache.avalon.framework.activity.Disposable;
  @@ -22,8 +20,6 @@
   import org.apache.avalon.phoenix.interfaces.ExtensionManagerMBean;
   
   /**
  - * PhoenixPackageRepository
  - *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @version $Revision$ $Date$
    */
  @@ -33,17 +29,7 @@
       PackageRepository, ExtensionManagerMBean
   {
       private Logger m_logger;
  -
  -    /**
  -     * An array of path elements. Each element designates a directory
  -     * in which the ExtensionManager should scan for Extensions.
  -     */
  -    private String[] m_path;
  -
  -    public DefaultExtensionManager()
  -    {
  -        super( new File[ 0 ] );
  -    }
  +    private String m_rawPath;
   
       public void enableLogging( final Logger logger )
       {
  @@ -55,98 +41,28 @@
       {
           final String phoenixHome = parameters.getParameter( "phoenix.home" );
           final String defaultExtPath = phoenixHome + File.separator + "ext";
  -        final String rawPath =
  -            parameters.getParameter( "phoenix.ext.path", defaultExtPath );
  -        m_path = split( rawPath, "|" );
  -
  -        final File[] dirs = new File[ m_path.length ];
  -        for( int i = 0; i < dirs.length; i++ )
  -        {
  -            try
  -            {
  -                dirs[ i ] = ( new File( m_path[ i ] ) ).getCanonicalFile();
  -            }
  -            catch( final IOException ioe )
  -            {
  -                throw new ParameterException( "Malformed entry in path '" + m_path[ i ]
+
  -                                              ". Unable to determine file for entry", ioe
);
  -            }
  -        }
  -
  -        for( int i = 0; i < dirs.length; i++ )
  -        {
  -            m_path[ i ] = dirs[ i ].toString();
  -        }
  +        m_rawPath = parameters.getParameter( "phoenix.ext.path", defaultExtPath );
       }
   
       public void initialize()
           throws Exception
       {
  -        final File[] dirs = new File[ m_path.length ];
  -        for( int i = 0; i < dirs.length; i++ )
  -        {
  -            dirs[ i ] = new File( m_path[ i ] );
  -        }
  -
  -        setPath( dirs );
  -
  +        setPath( m_rawPath );
           scanPath();
       }
   
  -    /**
  -     * Retrieve an array of paths where each
  -     * element in array represents a directory
  -     * in which the ExtensionManager will look
  -     * for Extensions.
  -     *
  -     * @return the list of paths to search in
  -     */
  -    public String[] getPaths()
  -    {
  -        return m_path;
  -    }
  -
  -    /**
  -     * Force the ExtensionManager to rescan the paths
  -     * to discover new Extensions that have been added
  -     * or remove old Extensions that have been removed.
  -     *
  -     */
  -    public void rescanPath()
  +    public void dispose()
       {
           clearCache();
  -        scanPath();
       }
   
  -    public void dispose()
  +    public void rescanPath()
       {
  -        clearCache();
  +        super.scanPath();
       }
   
       protected void debug( final String message )
       {
           m_logger.debug( message );
       }
  -
  -
  -    /**
  -     * Splits the string on every token into an array of strings.
  -     *
  -     * @param string the string
  -     * @param onToken the token
  -     * @return the resultant array
  -     */
  -    private static String[] split( final String string, final String onToken )
  -    {
  -        final StringTokenizer tokenizer = new StringTokenizer( string, onToken );
  -        final String[] result = new String[ tokenizer.countTokens() ];
  -
  -        for( int i = 0; i < result.length; i++ )
  -        {
  -            result[ i ] = tokenizer.nextToken();
  -        }
  -
  -        return result;
  -    }
  -
   }
  
  
  
  1.4       +4 -2      jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/interfaces/ExtensionManagerMBean.java
  
  Index: ExtensionManagerMBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/interfaces/ExtensionManagerMBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ExtensionManagerMBean.java	17 Feb 2002 11:15:28 -0000	1.3
  +++ ExtensionManagerMBean.java	14 Jul 2002 01:36:30 -0000	1.4
  @@ -7,6 +7,8 @@
    */
   package org.apache.avalon.phoenix.interfaces;
   
  +import java.io.File;
  +
   /**
    * Management interface to ExtensionManager.
    *
  @@ -25,7 +27,7 @@
        *
        * @return the list of paths to search in
        */
  -    String[] getPaths();
  +    File[] getPaths();
   
       /**
        * Force the ExtensionManager to rescan the paths
  
  
  

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