avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/merlin/merlin-core/src/test/org/apache/avalon/merlin AbstractTestCase.java RepositoryTestCase.java
Date Fri, 09 May 2003 05:40:58 GMT
mcconnell    2003/05/08 22:40:58

  Modified:    merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl
                        StandardBlock.java StandardBlockLoader.java
               merlin/merlin-core/src/java/org/apache/avalon/merlin/kernel/impl
                        DefaultKernel.java
               merlin/merlin-core/src/test/org/apache/avalon/merlin
                        AbstractTestCase.java RepositoryTestCase.java
  Log:
  Eliminated dependency  of the Kernel.getRootBlock() operation and added implementation support
for Kernel.getURL().
  
  Revision  Changes    Path
  1.7       +2 -2      avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/StandardBlock.java
  
  Index: StandardBlock.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/StandardBlock.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StandardBlock.java	8 May 2003 03:02:40 -0000	1.6
  +++ StandardBlock.java	9 May 2003 05:40:57 -0000	1.7
  @@ -258,9 +258,9 @@
        * Return an appliance relative to the supplied path.
        * @param uri the appliance path
        */
  -    public Appliance resolve( String uri )
  +    public Appliance resolveAppliance( String uri )
       {
  -        return m_repository.resolve( uri );
  +        return m_repository.resolveAppliance( uri );
       }
   
       //-------------------------------------------------------------------------------
  
  
  
  1.9       +5 -3      avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/StandardBlockLoader.java
  
  Index: StandardBlockLoader.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/StandardBlockLoader.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StandardBlockLoader.java	8 May 2003 03:02:40 -0000	1.8
  +++ StandardBlockLoader.java	9 May 2003 05:40:57 -0000	1.9
  @@ -96,6 +96,7 @@
   import org.apache.avalon.merlin.block.impl.XMLContainerCreator;
   import org.apache.avalon.merlin.container.impl.DefaultContainer;
   import org.apache.avalon.merlin.kernel.Kernel;
  +import org.apache.avalon.merlin.kernel.KernelLoader;
   import org.apache.avalon.meta.info.DependencyDescriptor;
   import org.apache.avalon.meta.info.InfoDescriptor;
   import org.apache.avalon.meta.info.ServiceDescriptor;
  @@ -142,6 +143,7 @@
   
       private static final XMLTypeCreator TYPE_m_creator = new XMLTypeCreator();
   
  +
       //==============================================================
       // state
       //==============================================================
  @@ -218,9 +220,9 @@
           m_common = (ClassLoader) context.get( "urn:merlin:classloader.common" );
           m_domain = (String) context.get( "urn:merlin:domain" );
           m_repository = (Repository) context.get( Repository.KEY );
  -        if( context.hasEntry( Kernel.BASE_KEY ) )
  +        if( context.hasEntry( KernelLoader.BASE_KEY ) )
           {
  -            m_base = (File) context.get( Kernel.BASE_KEY );
  +            m_base = (File) context.get( KernelLoader.BASE_KEY );
           }
       }
   
  
  
  
  1.16      +19 -4     avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java
  
  Index: DefaultKernel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DefaultKernel.java	8 May 2003 03:02:40 -0000	1.15
  +++ DefaultKernel.java	9 May 2003 05:40:57 -0000	1.16
  @@ -84,6 +84,7 @@
   import org.apache.avalon.meta.model.builder.XMLProfileCreator;
   import org.apache.avalon.merlin.kernel.Kernel;
   import org.apache.avalon.merlin.kernel.KernelException;
  +import org.apache.avalon.merlin.kernel.KernelLoader;
   import org.apache.avalon.meta.model.Category;
   import org.apache.avalon.meta.model.LoggingDirective;
   import org.apache.excalibur.event.command.CommandManager;
  @@ -352,9 +353,9 @@
               m_priority = (String) context.get( "urn:merlin:logging.priority" );
           }
   
  -        if( context.hasEntry( Kernel.BASE_KEY ) )
  +        if( context.hasEntry( KernelLoader.BASE_KEY ) )
           {
  -            m_base = (File) context.get( Kernel.BASE_KEY );
  +            m_base = (File) context.get( KernelLoader.BASE_KEY );
           }
   
           m_contextualized = true;
  @@ -477,7 +478,7 @@
               context.put( "urn:merlin:domain", m_domain );
               if( m_base != null ) 
               {
  -                context.put( Kernel.BASE_KEY, m_base );
  +                context.put( KernelLoader.BASE_KEY, m_base );
               }
               context.makeReadOnly();
   
  @@ -525,6 +526,20 @@
       //==============================================================
       // Kernel
       //==============================================================
  +
  +   /**
  +    * Return the base URL from which services can be resolved.
  +    * @return the base url
  +    */
  +    public URL getURL()
  +    {
  +        if( getRootBlock() == null )
  +        {
  +            final String error = 
  +              "Root block has not been established.";
  +        }
  +        return getRootBlock().getURL();
  +    }
   
      /**
       * Return the root block.
  
  
  
  1.6       +17 -1     avalon-sandbox/merlin/merlin-core/src/test/org/apache/avalon/merlin/AbstractTestCase.java
  
  Index: AbstractTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-core/src/test/org/apache/avalon/merlin/AbstractTestCase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractTestCase.java	29 Apr 2003 14:39:45 -0000	1.5
  +++ AbstractTestCase.java	9 May 2003 05:40:58 -0000	1.6
  @@ -51,6 +51,7 @@
   package org.apache.avalon.merlin;
   
   import java.io.File;
  +import java.net.URL;
   
   import org.apache.avalon.assembly.locator.impl.DefaultLocator;
   import org.apache.avalon.merlin.block.Block;
  @@ -98,13 +99,28 @@
       {
           if( m_kernel != null )
           {
  -            m_kernel.shutdown();
  +            shutdown();
           }
       }
   
       //--------------------------------------------------
       // Kernel
       //--------------------------------------------------
  +
  +   /**
  +    * Return the base URL from which services can be resolved.
  +    * @return the base url
  +    */
  +    public URL getURL()
  +    {
  +        if( m_kernel == null )
  +        {
  +            final String message =
  +              "Kernel has not been initialized.";
  +            throw new IllegalStateException( message );
  +        }
  +        return m_kernel.getURL();
  +    }
   
      /**
       * Return the root block.
  
  
  
  1.3       +7 -4      avalon-sandbox/merlin/merlin-core/src/test/org/apache/avalon/merlin/RepositoryTestCase.java
  
  Index: RepositoryTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-core/src/test/org/apache/avalon/merlin/RepositoryTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RepositoryTestCase.java	26 Apr 2003 12:37:48 -0000	1.2
  +++ RepositoryTestCase.java	9 May 2003 05:40:58 -0000	1.3
  @@ -53,10 +53,13 @@
   
       public void testBlock() throws Exception
       {
  -        System.out.println( "-------------------------------------" );
  -        Block block = super.getRootBlock();
  -        printBlock( "  ", block );
  -        System.out.println( "-------------------------------------" );
  +        // test dissabled as we move towards non-exposure of the 
  +        // block by the kernel
  +
  +        //System.out.println( "-------------------------------------" );
  +        //Block block = super.getRootBlock();
  +        //printBlock( "  ", block );
  +        //System.out.println( "-------------------------------------" );
       }
   
       private void printBlock( String lead, Block block )
  
  
  

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


Mime
View raw message