You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2003/10/07 19:44:10 UTC
cvs commit: avalon/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel Kernel.java KernelContext.java KernelException.java
mcconnell 2003/10/07 10:44:10
Modified: merlin/kernel/bootstrap/src/java Merlin.java
merlin/kernel/impl project.xml
merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
DefaultKernel.java DefaultKernelContext.java
merlin/kernel/plugin project.xml
merlin/kernel/spi project.xml
merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel
Kernel.java KernelContext.java KernelException.java
Log:
Improvements to the Kernel interface, KernelContext and DefaultKernel implementation when wortking in an embedded context.
Revision Changes Path
1.2 +1 -2 avalon/merlin/kernel/bootstrap/src/java/Merlin.java
Index: Merlin.java
===================================================================
RCS file: /home/cvs/avalon/merlin/kernel/bootstrap/src/java/Merlin.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Merlin.java 24 Sep 2003 09:32:53 -0000 1.1
+++ Merlin.java 7 Oct 2003 17:44:09 -0000 1.2
@@ -60,7 +60,6 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
-import java.util.StringTokenizer;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -271,7 +270,7 @@
Constructor constructor =
clazz.getConstructor(
new Class[]{ Repository.class, args.getClass() } );
- Object kernel =
+ Object kernelLoader =
constructor.newInstance(
new Object[]{ repository, args } );
}
1.2 +3 -3 avalon/merlin/kernel/impl/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/avalon/merlin/kernel/impl/project.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- project.xml 24 Sep 2003 09:32:54 -0000 1.1
+++ project.xml 7 Oct 2003 17:44:09 -0000 1.2
@@ -9,7 +9,7 @@
<name>Merlin Kernel Implementation</name>
<package>org.apache.avalon.merlin</package>
- <currentVersion>3.0b1</currentVersion>
+ <currentVersion>3.1b1</currentVersion>
<inceptionYear>2002</inceptionYear>
<shortDescription>Merlin Kernel Implementation</shortDescription>
@@ -37,7 +37,7 @@
<dependency>
<groupId>merlin</groupId>
<artifactId>merlin-kernel-spi</artifactId>
- <version>3.0b1</version>
+ <version>3.1b1</version>
</dependency>
<!-- avalon dependecies -->
@@ -55,7 +55,7 @@
<dependency>
<groupId>avalon-activation</groupId>
<artifactId>avalon-activation-impl</artifactId>
- <version>1.0b1</version>
+ <version>1.0b2</version>
</dependency>
<dependency>
1.2 +24 -50 avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java
Index: DefaultKernel.java
===================================================================
RCS file: /home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultKernel.java 24 Sep 2003 09:33:15 -0000 1.1
+++ DefaultKernel.java 7 Oct 2003 17:44:09 -0000 1.2
@@ -64,8 +64,10 @@
import org.apache.avalon.merlin.kernel.KernelRuntimeException;
import org.apache.avalon.activation.appliance.Appliance;
import org.apache.avalon.activation.appliance.Block;
+import org.apache.avalon.activation.appliance.Engine;
import org.apache.avalon.activation.appliance.Composite;
import org.apache.avalon.activation.appliance.ServiceContext;
+import org.apache.avalon.activation.appliance.UnknownServiceException;
import org.apache.avalon.activation.appliance.impl.DefaultBlock;
import org.apache.avalon.activation.appliance.impl.DefaultServiceContext;
import org.apache.avalon.composition.data.TargetDirective;
@@ -92,6 +94,7 @@
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.DefaultConfiguration;
+import org.apache.avalon.framework.Version;
import org.apache.excalibur.mpool.PoolManager;
/**
@@ -378,64 +381,35 @@
}
//--------------------------------------------------------------
- // Home
+ // Kernel
//--------------------------------------------------------------
- /**
- * Resolve a object to a value.
- *
- * @param source the context within the the resolution is applied
- * @return the resolved object
- * @throws Exception if an error occurs
- */
- public Object resolve( Object source ) throws Exception
+ /**
+ * Return the root containment model.
+ * @return the containment model
+ */
+ public ContainmentModel getContainmentModel()
{
- if( m_self.isEnabled() )
- {
- return m_block.resolve( source );
- }
- else
- {
- throw new IllegalStateException( "kernel" );
- }
+ return m_model;
}
- /**
- * Resolve a object to a value relative to a supplied set of
- * interface classes.
- *
- * @param source the aquiring source
- * @param ref the castable service classes
- * @return the resolved object
- * @throws Exception if an error occurs
- */
- public Object resolve( Object source, Class[] ref ) throws Exception
- {
- if( m_self.isEnabled() )
- {
- return m_block.resolve( source, ref );
- }
- else
- {
- throw new IllegalStateException( "kernel" );
- }
- }
-
- /**
- * Release an object
- *
- * @param source the client that obtained the intial reference
- * @param instance the object to be released
- */
- public void release( Object source, Object instance )
+ /**
+ * Return the block matching the supplied model.
+ * @return the containment block
+ */
+ public Block getBlock( ContainmentModel model ) throws KernelException
{
- if( m_self.isEnabled() )
+ if( !m_self.isEnabled() ) throw new IllegalStateException( "kernel" );
+ try
{
- m_block.release( source, instance );
+ return (Block) m_block.resolveAppliance( model.getQualifiedName() );
}
- else
+ catch( Throwable e )
{
- throw new IllegalStateException( "kernel" );
+ final String error =
+ "Unable to resolve block relative to the containment path: ["
+ + model.getPath() + "].";
+ throw new KernelRuntimeException( error, e );
}
}
1.2 +11 -1 avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java
Index: DefaultKernelContext.java
===================================================================
RCS file: /home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultKernelContext.java 24 Sep 2003 09:33:17 -0000 1.1
+++ DefaultKernelContext.java 7 Oct 2003 17:44:10 -0000 1.2
@@ -571,6 +571,16 @@
//--------------------------------------------------------------
/**
+ * Return the Logger for the specified category.
+ * @param category the category path
+ * @return the logging channel
+ */
+ public Logger getLoggerForCategory( final String category )
+ {
+ return m_logging.getLoggerForCategory( category );
+ }
+
+ /**
* Return the kernel logging channel.
* @return the kernel logging channel
*/
1.3 +3 -6 avalon/merlin/kernel/plugin/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/avalon/merlin/kernel/plugin/project.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- project.xml 3 Oct 2003 14:12:10 -0000 1.2
+++ project.xml 7 Oct 2003 17:44:10 -0000 1.3
@@ -30,17 +30,14 @@
<dependency>
<groupId>merlin</groupId>
<artifactId>merlin-kernel-spi</artifactId>
- <version>3.0b1</version>
+ <version>3.1b1</version>
</dependency>
-
<dependency>
<groupId>merlin</groupId>
<artifactId>merlin-kernel-impl</artifactId>
- <version>3.0b1</version>
+ <version>3.1b1</version>
</dependency>
- <!-- avalon -->
-
<dependency>
<groupId>avalon-activation</groupId>
<artifactId>avalon-activation-api</artifactId>
@@ -54,7 +51,7 @@
<dependency>
<groupId>avalon-activation</groupId>
<artifactId>avalon-activation-impl</artifactId>
- <version>1.0b1</version>
+ <version>1.0b2</version>
</dependency>
<dependency>
1.2 +1 -1 avalon/merlin/kernel/spi/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/avalon/merlin/kernel/spi/project.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- project.xml 24 Sep 2003 09:33:21 -0000 1.1
+++ project.xml 7 Oct 2003 17:44:10 -0000 1.2
@@ -9,7 +9,7 @@
<name>Merlin Kernel SPI</name>
<package>org.apache.avalon.merlin</package>
- <currentVersion>3.0b1</currentVersion>
+ <currentVersion>3.1b1</currentVersion>
<inceptionYear>2002</inceptionYear>
<shortDescription>Merlin Kernel SPI</shortDescription>
<description>
1.2 +17 -7 avalon/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/Kernel.java
Index: Kernel.java
===================================================================
RCS file: /home/cvs/avalon/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/Kernel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Kernel.java 24 Sep 2003 09:33:22 -0000 1.1
+++ Kernel.java 7 Oct 2003 17:44:10 -0000 1.2
@@ -50,19 +50,29 @@
package org.apache.avalon.merlin.kernel;
-import java.net.URL;
-
-import org.apache.avalon.activation.appliance.Home;
+import org.apache.avalon.activation.appliance.Block;
+import org.apache.avalon.composition.model.ContainmentModel;
/**
* A Kernel is the root of a containment solution. This interfaces
- * defines the contract for any kernel implementation, core covering
- * management aspects and service resolutiuon aspects.
+ * defines the contract for any kernel implementation covering
+ * management aspects and service resolution aspects.
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version $Revision$ $Date$
*/
-public interface Kernel extends Home, Controller
+public interface Kernel extends Controller
{
+ /**
+ * Return the root containment model.
+ * @return the containment model
+ */
+ ContainmentModel getContainmentModel();
+
+ /**
+ * Return the block matching the supplied model.
+ * @return the containment block
+ */
+ Block getBlock( ContainmentModel model ) throws KernelException;
}
1.2 +7 -0 avalon/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/KernelContext.java
Index: KernelContext.java
===================================================================
RCS file: /home/cvs/avalon/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/KernelContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- KernelContext.java 24 Sep 2003 09:33:22 -0000 1.1
+++ KernelContext.java 7 Oct 2003 17:44:10 -0000 1.2
@@ -98,4 +98,11 @@
*/
TargetDirective[] getTargetDirectives();
+ /**
+ * Return the Logger for the specified category.
+ * @param category the category path
+ * @return the logging channel
+ */
+ Logger getLoggerForCategory( final String category );
+
}
1.2 +2 -2 avalon/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/KernelException.java
Index: KernelException.java
===================================================================
RCS file: /home/cvs/avalon/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/KernelException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- KernelException.java 24 Sep 2003 09:33:22 -0000 1.1
+++ KernelException.java 7 Oct 2003 17:44:10 -0000 1.2
@@ -58,7 +58,7 @@
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version $Revision$ $Date$
*/
-public final class KernelException
+public class KernelException
extends CascadingException
{
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org