cziegeler    02/04/24 01:25:43

  Modified:    monitor/src/java/org/apache/avalon/excalibur/monitor
                        MonitorableURLSource.java
               sourceresolve/src/java/org/apache/excalibur/source/impl
                        SourceResolverImpl.java URLSource.java
  Added:       all/lib  jdom.jar
               xmlbundle/lib saxpath.jar
  Log:
  Adding jdom where it is really required
  
  Revision  Changes    Path
  1.3       +0 -0      jakarta-avalon-excalibur/all/lib/jdom.jar
  
        <<Binary file>>
  
  
  1.2       +4 -9      
jakarta-avalon-excalibur/monitor/src/java/org/apache/avalon/excalibur/monitor/MonitorableURLSource.java
  
  Index: MonitorableURLSource.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/monitor/src/java/org/apache/avalon/excalibur/monitor/MonitorableURLSource.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MonitorableURLSource.java 23 Apr 2002 15:35:27 -0000      1.1
  +++ MonitorableURLSource.java 24 Apr 2002 08:25:42 -0000      1.2
  @@ -16,7 +16,7 @@
    * This adds the <code>Monitorable</code> interface to the URLSource.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2002/04/23 15:35:27 $
  + * @version CVS $Revision: 1.2 $ $Date: 2002/04/24 08:25:42 $
    */
   
   public class MonitorableURLSource
  @@ -25,15 +25,10 @@
   {
   
       /**
  -     * Construct a new object from a <code>URL</code>.
  -     * @param parameters This is optional
  +     * Constructor
        */
  -    public MonitorableURLSource( URL url,
  -         Map parameters )
  -        throws IOException
  -    {
  -        super( url, parameters );
  -    }
  +    public MonitorableURLSource() {}
  +
       /**
        *  Get the corresponding Resource object for monitoring.
        */
  
  
  
  1.2       +63 -6     
jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/SourceResolverImpl.java
  
  Index: SourceResolverImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/SourceResolverImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SourceResolverImpl.java   19 Apr 2002 09:05:37 -0000      1.1
  +++ SourceResolverImpl.java   24 Apr 2002 08:25:42 -0000      1.2
  @@ -24,6 +24,9 @@
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.logger.LogEnabled;
  +import org.apache.avalon.framework.parameters.ParameterException;
  +import org.apache.avalon.framework.parameters.Parameters;
  +import org.apache.avalon.framework.parameters.Parameterizable;
   import org.apache.avalon.framework.thread.ThreadSafe;
   import org.apache.excalibur.source.*;
   
  @@ -48,13 +51,14 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
  - * @version $Id: SourceResolverImpl.java,v 1.1 2002/04/19 09:05:37 cziegeler 
Exp $
  + * @version $Id: SourceResolverImpl.java,v 1.2 2002/04/24 08:25:42 cziegeler 
Exp $
    */
   public class SourceResolverImpl
       extends AbstractLogEnabled
       implements Composable,
       Contextualizable,
       Disposable,
  +    Parameterizable,
       SourceResolver,
       ThreadSafe
   {
  @@ -73,6 +77,9 @@
        */
       protected URL m_baseURL;
   
  +    /** The URLSource class used */
  +    protected Class m_urlSourceClass;
  +
       /**
        * Get the context
        */
  @@ -133,6 +140,30 @@
       }
   
       /**
  +     * Configure
  +     */
  +    public void parameterize(Parameters pars)
  +    throws ParameterException
  +    {
  +        final String urlSourceClassName = pars.getParameter("url-source",
  +                         "org.apache.excalibur.source.impl.URLSource");
  +        ClassLoader loader = Thread.currentThread().getContextClassLoader();
  +        if( loader == null )
  +        {
  +            loader = this.getClass().getClassLoader();
  +        }
  +        try
  +        {
  +            this.m_urlSourceClass = loader.loadClass( urlSourceClassName );
  +        }
  +        catch (ClassNotFoundException cnfe)
  +        {
  +            this.getLogger().error("Class not found: " + urlSourceClassName, 
cnfe);
  +            throw new ParameterException("Class not found: " + 
urlSourceClassName, cnfe);
  +        }
  +    }
  +
  +    /**
        * Get a <code>Source</code> object.
        */
       public Source resolveURI( String location )
  @@ -248,18 +279,44 @@
               {
                   if( this.getLogger().isDebugEnabled() == true )
                   {
  -                    getLogger().debug( "Making URL from " + systemID );
  +                    this.getLogger().debug( "Making URL from " + systemID );
  +                }
  +                try
  +                {
  +                    final URLSource urlSource =
  +                             (URLSource)this.m_urlSourceClass.newInstance();
  +                    urlSource.init( new URL( systemID ), parameters );
  +                    source = urlSource;
  +                }
  +                catch( MalformedURLException mue )
  +                {
  +                    throw mue;
  +                }
  +                catch (Exception ie)
  +                {
  +                    throw new ComponentException("Unable to create new 
instance of " +
  +                                                 this.m_urlSourceClass, ie);
                   }
  -                source = new URLSource( new URL( systemID ), parameters );
               }
               catch( MalformedURLException mue )
               {
                   if( this.getLogger().isDebugEnabled() )
                   {
  -                    getLogger().debug( "Making URL - MalformedURLException 
in getURL:", mue );
  -                    getLogger().debug( "Making URL a File (assuming that it 
is full path):" + systemID );
  +                    this.getLogger().debug( "Making URL - 
MalformedURLException in getURL:", mue );
  +                    this.getLogger().debug( "Making URL a File (assuming 
that it is full path):" + systemID );
  +                }
  +                try
  +                {
  +                    final URLSource urlSource =
  +                             (URLSource)this.m_urlSourceClass.newInstance();
  +                    urlSource.init( ( new File( systemID ) ).toURL(), 
parameters );
  +                    source = urlSource;
  +                }
  +                catch (Exception ie)
  +                {
  +                    throw new ComponentException("Unable to create new 
instance of " +
  +                                                 this.m_urlSourceClass, ie);
                   }
  -                source = new URLSource( ( new File( systemID ) ).toURL(), 
parameters );
               }
           }
           if( source instanceof LogEnabled )
  
  
  
  1.5       +9 -4      
jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/URLSource.java
  
  Index: URLSource.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/URLSource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- URLSource.java    23 Apr 2002 15:35:27 -0000      1.4
  +++ URLSource.java    24 Apr 2002 08:25:42 -0000      1.5
  @@ -24,7 +24,7 @@
    * Description of a source which is described by an URL.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.4 $ $Date: 2002/04/23 15:35:27 $
  + * @version CVS $Revision: 1.5 $ $Date: 2002/04/24 08:25:42 $
    */
   
   public class URLSource
  @@ -69,11 +69,16 @@
       protected boolean isPost = false;
   
       /**
  -     * Construct a new object from a <code>URL</code>.
  +     * Constructor
  +     */
  +    public URLSource() {}
  +
  +    /**
  +     * Initialize a new object from a <code>URL</code>.
        * @param parameters This is optional
        */
  -    public URLSource( URL url,
  -                      Map parameters )
  +    public void init(URL url,
  +                     Map parameters )
           throws IOException
       {
           this.systemId = url.toExternalForm();
  
  
  
  1.3       +0 -0      jakarta-avalon-excalibur/xmlbundle/lib/saxpath.jar
  
        <<Binary file>>
  
  

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

Reply via email to