avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl SourceResolverImpl.java
Date Tue, 04 Feb 2003 20:13:00 GMT
bloritsch    2003/02/04 12:12:59

  Modified:    sourceresolve/src/java/org/apache/excalibur/source/impl
                        SourceResolverImpl.java
  Log:
  update sourceresolve with simpler semantics from CVS version of Fortress
  
  Revision  Changes    Path
  1.29      +25 -87    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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- SourceResolverImpl.java	30 Jan 2003 18:11:53 -0000	1.28
  +++ SourceResolverImpl.java	4 Feb 2003 20:12:59 -0000	1.29
  @@ -164,31 +164,9 @@
       {
           m_manager = manager;
   
  -        // Best solution, part of Fortress and above
  -        if ( m_manager.hasService( SourceFactory.ROLE ) )
  +        if ( m_manager.hasService( SourceFactory.ROLE + "Selector" ) )
           {
  -            Object test = m_manager.lookup( SourceFactory.ROLE );
  -            if ( test instanceof ServiceSelector )
  -            {
  -                m_factorySelector = (ServiceSelector) test;
  -            }
  -            else
  -            {
  -                m_manager.release( test );
  -            }
  -        }
  -        // back compatibility hack for ECM
  -        else if ( m_manager.hasService( SourceFactory.ROLE + "Selector" ) )
  -        {
  -            Object test = m_manager.lookup( SourceFactory.ROLE + "Selector" );
  -            if ( test instanceof ServiceSelector )
  -            {
  -                m_factorySelector = (ServiceSelector) test;
  -            }
  -            else
  -            {
  -                m_manager.release( test );
  -            }
  +            m_factorySelector = (ServiceSelector) m_manager.lookup( SourceFactory.ROLE
+ "Selector" );
           }
       }
   
  @@ -293,7 +271,7 @@
           Source source = null;
           // search for a SourceFactory implementing the protocol
           final int protocolPos = systemID.indexOf( ':' );
  -        if( protocolPos != -1 && m_factorySelector != null)
  +        if( protocolPos != -1)
           {
               final String protocol = systemID.substring( 0, protocolPos );
               SourceFactory factory = null;
  @@ -314,41 +292,20 @@
   
           if( null == source )
           {
  -            if ( null == m_factorySelector )
  -            {
  -                SourceFactory factory = null;
  +            SourceFactory factory = null;
   
  -                try
  -                {
  -                    factory = (SourceFactory) m_manager.lookup(SourceFactory.ROLE);
  -                    source = factory.getSource( systemID, parameters );
  -                }
  -                catch (ServiceException se )
  -                {
  -                    throw new SourceException( "Unable to select source factory for " +
systemID, se );
  -                }
  -                finally
  -                {
  -                    m_manager.release(factory);
  -                }
  +            try
  +            {
  +                factory = (SourceFactory) m_factorySelector.select("*");
  +                source = factory.getSource( systemID, parameters );
               }
  -            else
  +            catch (ServiceException se )
               {
  -                SourceFactory factory = null;
  -
  -                try
  -                {
  -                    factory = (SourceFactory) m_factorySelector.select("*");
  -                    source = factory.getSource( systemID, parameters );
  -                }
  -                catch (ServiceException se )
  -                {
  -                    throw new SourceException( "Unable to select source factory for " +
systemID, se );
  -                }
  -                finally
  -                {
  -                    m_factorySelector.release(factory);
  -                }
  +                throw new SourceException( "Unable to select source factory for " + systemID,
se );
  +            }
  +            finally
  +            {
  +                m_factorySelector.release(factory);
               }
           }
   
  @@ -367,45 +324,26 @@
           final String scheme = source.getScheme();
           SourceFactory factory = null;
   
  -        if ( null == m_factorySelector )
  +        try
  +        {
  +            factory = (SourceFactory) m_factorySelector.select(scheme);
  +            factory.release(source);
  +        }
  +        catch (ServiceException se )
           {
               try
               {
  -                factory = (SourceFactory) m_manager.lookup(SourceFactory.ROLE);
  +                factory = (SourceFactory) m_factorySelector.select("*");
                   factory.release(source);
               }
  -            catch (ServiceException se )
  +            catch (ServiceException sse )
               {
                   throw new CascadingRuntimeException( "Unable to select source factory for
" + source.getURI(), se );
               }
  -            finally
  -            {
  -                m_manager.release( factory );
  -            }
           }
  -        else
  +        finally
           {
  -            try
  -            {
  -                factory = (SourceFactory) m_factorySelector.select(scheme);
  -                factory.release(source);
  -            }
  -            catch (ServiceException se )
  -            {
  -                try
  -                {
  -                    factory = (SourceFactory) m_factorySelector.select("*");
  -                    factory.release(source);
  -                }
  -                catch (ServiceException sse )
  -                {
  -                    throw new CascadingRuntimeException( "Unable to select source factory
for " + source.getURI(), se );
  -                }
  -            }
  -            finally
  -            {
  -                m_factorySelector.release( factory );
  -            }
  +            m_factorySelector.release( factory );
           }
       }
   }
  
  
  

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


Mime
View raw message