Title: [944] branches/container-classloading: Moved container package to separate jar to prove that it solves the classloading issues in trader example.
Revision
944
Author
mauro
Date
2008-09-21 17:54:41 -0500 (Sun, 21 Sep 2008)

Log Message

Moved container package to separate jar to prove that it solves the classloading issues in trader example.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: branches/container-classloading/examples/trader/pom.xml (943 => 944)

--- branches/container-classloading/examples/trader/pom.xml	2008-09-21 22:37:30 UTC (rev 943)
+++ branches/container-classloading/examples/trader/pom.xml	2008-09-21 22:54:41 UTC (rev 944)
@@ -11,6 +11,11 @@
 
   <dependencies>
     <dependency>
+      <groupId>org.jbehave</groupId>
+      <artifactId>jbehave-container</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+    <dependency>
       <groupId>org.picocontainer.script</groupId>
       <artifactId>picocontainer-script-core</artifactId>
       <version>2.0</version>

Modified: branches/container-classloading/examples/trader/src/main/java/org/jbehave/examples/trader/container/TraderContainer.java (943 => 944)

--- branches/container-classloading/examples/trader/src/main/java/org/jbehave/examples/trader/container/TraderContainer.java	2008-09-21 22:37:30 UTC (rev 943)
+++ branches/container-classloading/examples/trader/src/main/java/org/jbehave/examples/trader/container/TraderContainer.java	2008-09-21 22:54:41 UTC (rev 944)
@@ -1,9 +1,13 @@
 package org.jbehave.examples.trader.container;
 
+import org.jbehave.container.pico.XMLPicoContainer;
 
+
 //FIXME there are classloading issues (only using maven plugin) if TraderContainer extends the XMLPicoContainer cointained in core
 //Not quite sure what the root cause is - need more investigation. 
-public class TraderContainer extends XMLContainer {
+//NOTE separating jbehave-core from jbehave-container jar fixes the problem!  Possible issue with classloader hierarchy?  Could d
+//it bite somewhere else too - eg in a webapp container?
+public class TraderContainer extends XMLPicoContainer {
 
     public TraderContainer(ClassLoader classLoader) {
         super("org/jbehave/examples/trader/container/trader.xml", classLoader);

Property changes: branches/container-classloading/jbehave-container

Name: svn:ignore
   + target

Added: branches/container-classloading/jbehave-container/pom.xml (0 => 944)

--- branches/container-classloading/jbehave-container/pom.xml	                        (rev 0)
+++ branches/container-classloading/jbehave-container/pom.xml	2008-09-21 22:54:41 UTC (rev 944)
@@ -0,0 +1,26 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.jbehave</groupId>
+    <artifactId>jbehave</artifactId>
+    <version>2.1-SNAPSHOT</version>
+  </parent>
+  <packaging>jar</packaging>
+  <artifactId>jbehave-container</artifactId>
+  <name>JBehave Container</name>
+  <description>The JBehave container module</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.jbehave</groupId>
+      <artifactId>jbehave-core</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.picocontainer.script</groupId>
+      <artifactId>picocontainer-script-core</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>
Property changes on: branches/container-classloading/jbehave-container/pom.xml
___________________________________________________________________
Name: svn:executable
   + *

Copied: branches/container-classloading/jbehave-container/src/behaviour/org/jbehave/container/AComponent.java (from rev 943, branches/container-classloading/jbehave-core/src/behaviour/org/jbehave/container/AComponent.java) (0 => 944)

--- branches/container-classloading/jbehave-container/src/behaviour/org/jbehave/container/AComponent.java	                        (rev 0)
+++ branches/container-classloading/jbehave-container/src/behaviour/org/jbehave/container/AComponent.java	2008-09-21 22:54:41 UTC (rev 944)
@@ -0,0 +1,5 @@
+package org.jbehave.container;
+
+public class AComponent {
+
+}

Property changes: branches/container-classloading/jbehave-container/src/behaviour/org/jbehave/container/AComponent.java

Name: svn:mergeinfo
   + 

Copied: branches/container-classloading/jbehave-container/src/behaviour/org/jbehave/container/AnotherComponent.java (from rev 943, branches/container-classloading/jbehave-core/src/behaviour/org/jbehave/container/AnotherComponent.java) (0 => 944)

--- branches/container-classloading/jbehave-container/src/behaviour/org/jbehave/container/AnotherComponent.java	                        (rev 0)
+++ branches/container-classloading/jbehave-container/src/behaviour/org/jbehave/container/AnotherComponent.java	2008-09-21 22:54:41 UTC (rev 944)
@@ -0,0 +1,5 @@
+package org.jbehave.container;
+
+public class AnotherComponent {
+
+}

Property changes: branches/container-classloading/jbehave-container/src/behaviour/org/jbehave/container/AnotherComponent.java

Name: svn:mergeinfo
   + 

Copied: branches/container-classloading/jbehave-container/src/behaviour/org/jbehave/container/pico (from rev 943, branches/container-classloading/jbehave-core/src/behaviour/org/jbehave/container/pico) ( => )


Property changes on: branches/container-classloading/jbehave-container/src/behaviour/org/jbehave/container/pico
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: branches/container-classloading/jbehave-container/src/java/org/jbehave/container/ComponentNotFoundException.java (from rev 943, branches/container-classloading/jbehave-core/src/java/org/jbehave/container/ComponentNotFoundException.java) (0 => 944)

--- branches/container-classloading/jbehave-container/src/java/org/jbehave/container/ComponentNotFoundException.java	                        (rev 0)
+++ branches/container-classloading/jbehave-container/src/java/org/jbehave/container/ComponentNotFoundException.java	2008-09-21 22:54:41 UTC (rev 944)
@@ -0,0 +1,15 @@
+package org.jbehave.container;
+
+/**
+ * Thrown when no component is found for a given key or type in the container
+ * 
+ * @author Mauro Talevi
+ */
[EMAIL PROTECTED]("serial")
+public class ComponentNotFoundException extends RuntimeException {
+
+    public ComponentNotFoundException(String message) {
+        super(message);
+    }
+
+}

Property changes: branches/container-classloading/jbehave-container/src/java/org/jbehave/container/ComponentNotFoundException.java

Name: svn:mergeinfo
   + 

Copied: branches/container-classloading/jbehave-container/src/java/org/jbehave/container/Container.java (from rev 943, branches/container-classloading/jbehave-core/src/java/org/jbehave/container/Container.java) (0 => 944)

--- branches/container-classloading/jbehave-container/src/java/org/jbehave/container/Container.java	                        (rev 0)
+++ branches/container-classloading/jbehave-container/src/java/org/jbehave/container/Container.java	2008-09-21 22:54:41 UTC (rev 944)
@@ -0,0 +1,32 @@
+package org.jbehave.container;
+
+/**
+ * Container represents a simple facade to access components from lightweight
+ * containers. Different implementations will provide adapters to different
+ * containers.
+ * 
+ * @author Mauro Talevi
+ */
+public interface Container {
+
+    /**
+     * Returns a component of a given type
+     * 
+     * @param type the component Class type
+     * @return The component instance of type <T>
+     * @throws ComponentNotFoundException when component not found
+     */
+    <T> T getComponent(Class<T> type);
+
+    /**
+     * Returns a component for a given type and key. It first looks up the
+     * components by type and then from these the one with the provided key.
+     * 
+     * @param type the component Class type
+     * @param key the component Object key
+     * @return The component instance of type <T>
+     * @throws ComponentNotFoundException when component not found
+     */
+    <T> T getComponent(Class<T> type, Object key);
+
+}

Property changes: branches/container-classloading/jbehave-container/src/java/org/jbehave/container/Container.java

Name: svn:mergeinfo
   + 

Copied: branches/container-classloading/jbehave-container/src/java/org/jbehave/container/ContainerSteps.java (from rev 943, branches/container-classloading/jbehave-core/src/java/org/jbehave/container/ContainerSteps.java) (0 => 944)

--- branches/container-classloading/jbehave-container/src/java/org/jbehave/container/ContainerSteps.java	                        (rev 0)
+++ branches/container-classloading/jbehave-container/src/java/org/jbehave/container/ContainerSteps.java	2008-09-21 22:54:41 UTC (rev 944)
@@ -0,0 +1,45 @@
+package org.jbehave.container;
+
+import org.jbehave.container.pico.XMLPicoContainerSteps;
+import org.jbehave.scenario.steps.Steps;
+import org.jbehave.scenario.steps.StepsConfiguration;
+
+/**
+ * <p>
+ * Abstract steps decorator which adds container support. Users need to extend
+ * this class and provide a concrete implementation of Container.
+ * </p>
+ * <p>
+ * Concrete implementations provided are [EMAIL PROTECTED] XMLPicoContainerSteps}.
+ * </p>
+ * 
+ * @author Mauro Talevi
+ */
+public abstract class ContainerSteps extends Steps {
+
+    private Container container;
+
+    public ContainerSteps(String containerResource) {
+        this(containerResource, Thread.currentThread().getContextClassLoader());
+    }
+
+    public ContainerSteps(String containerResource, ClassLoader classLoader) {    
+        this(containerResource, classLoader, new StepsConfiguration());
+    }
+
+    public ContainerSteps(String containerResource, ClassLoader classLoader, StepsConfiguration configuration) {
+        super(configuration);
+        container = createContainer(containerResource, classLoader);
+    }
+
+    public <T> T component(Class<T> type) {
+        return container.getComponent(type);
+    }
+
+    public <T> T getComponent(Class<T> type, Object key) {
+        return container.getComponent(type, key);
+    }
+
+    protected abstract Container createContainer(String containerResource, ClassLoader classLoader);
+
+}

Property changes: branches/container-classloading/jbehave-container/src/java/org/jbehave/container/ContainerSteps.java

Name: svn:mergeinfo
   + 

Copied: branches/container-classloading/jbehave-container/src/java/org/jbehave/container/pico (from rev 943, branches/container-classloading/jbehave-core/src/java/org/jbehave/container/pico) ( => )


Property changes on: branches/container-classloading/jbehave-container/src/java/org/jbehave/container/pico
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: branches/container-classloading/jbehave-core/src/behaviour/org/jbehave/container/AComponent.java (943 => 944)

--- branches/container-classloading/jbehave-core/src/behaviour/org/jbehave/container/AComponent.java	2008-09-21 22:37:30 UTC (rev 943)
+++ branches/container-classloading/jbehave-core/src/behaviour/org/jbehave/container/AComponent.java	2008-09-21 22:54:41 UTC (rev 944)
@@ -1,5 +0,0 @@
-package org.jbehave.container;
-
-public class AComponent {
-
-}

Deleted: branches/container-classloading/jbehave-core/src/behaviour/org/jbehave/container/AnotherComponent.java (943 => 944)

--- branches/container-classloading/jbehave-core/src/behaviour/org/jbehave/container/AnotherComponent.java	2008-09-21 22:37:30 UTC (rev 943)
+++ branches/container-classloading/jbehave-core/src/behaviour/org/jbehave/container/AnotherComponent.java	2008-09-21 22:54:41 UTC (rev 944)
@@ -1,5 +0,0 @@
-package org.jbehave.container;
-
-public class AnotherComponent {
-
-}

Deleted: branches/container-classloading/jbehave-core/src/java/org/jbehave/container/ComponentNotFoundException.java (943 => 944)

--- branches/container-classloading/jbehave-core/src/java/org/jbehave/container/ComponentNotFoundException.java	2008-09-21 22:37:30 UTC (rev 943)
+++ branches/container-classloading/jbehave-core/src/java/org/jbehave/container/ComponentNotFoundException.java	2008-09-21 22:54:41 UTC (rev 944)
@@ -1,15 +0,0 @@
-package org.jbehave.container;
-
-/**
- * Thrown when no component is found for a given key or type in the container
- * 
- * @author Mauro Talevi
- */
[EMAIL PROTECTED]("serial")
-public class ComponentNotFoundException extends RuntimeException {
-
-    public ComponentNotFoundException(String message) {
-        super(message);
-    }
-
-}

Deleted: branches/container-classloading/jbehave-core/src/java/org/jbehave/container/Container.java (943 => 944)

--- branches/container-classloading/jbehave-core/src/java/org/jbehave/container/Container.java	2008-09-21 22:37:30 UTC (rev 943)
+++ branches/container-classloading/jbehave-core/src/java/org/jbehave/container/Container.java	2008-09-21 22:54:41 UTC (rev 944)
@@ -1,32 +0,0 @@
-package org.jbehave.container;
-
-/**
- * Container represents a simple facade to access components from lightweight
- * containers. Different implementations will provide adapters to different
- * containers.
- * 
- * @author Mauro Talevi
- */
-public interface Container {
-
-    /**
-     * Returns a component of a given type
-     * 
-     * @param type the component Class type
-     * @return The component instance of type <T>
-     * @throws ComponentNotFoundException when component not found
-     */
-    <T> T getComponent(Class<T> type);
-
-    /**
-     * Returns a component for a given type and key. It first looks up the
-     * components by type and then from these the one with the provided key.
-     * 
-     * @param type the component Class type
-     * @param key the component Object key
-     * @return The component instance of type <T>
-     * @throws ComponentNotFoundException when component not found
-     */
-    <T> T getComponent(Class<T> type, Object key);
-
-}

Deleted: branches/container-classloading/jbehave-core/src/java/org/jbehave/container/ContainerSteps.java (943 => 944)

--- branches/container-classloading/jbehave-core/src/java/org/jbehave/container/ContainerSteps.java	2008-09-21 22:37:30 UTC (rev 943)
+++ branches/container-classloading/jbehave-core/src/java/org/jbehave/container/ContainerSteps.java	2008-09-21 22:54:41 UTC (rev 944)
@@ -1,45 +0,0 @@
-package org.jbehave.container;
-
-import org.jbehave.container.pico.XMLPicoContainerSteps;
-import org.jbehave.scenario.steps.Steps;
-import org.jbehave.scenario.steps.StepsConfiguration;
-
-/**
- * <p>
- * Abstract steps decorator which adds container support. Users need to extend
- * this class and provide a concrete implementation of Container.
- * </p>
- * <p>
- * Concrete implementations provided are [EMAIL PROTECTED] XMLPicoContainerSteps}.
- * </p>
- * 
- * @author Mauro Talevi
- */
-public abstract class ContainerSteps extends Steps {
-
-    private Container container;
-
-    public ContainerSteps(String containerResource) {
-        this(containerResource, Thread.currentThread().getContextClassLoader());
-    }
-
-    public ContainerSteps(String containerResource, ClassLoader classLoader) {    
-        this(containerResource, classLoader, new StepsConfiguration());
-    }
-
-    public ContainerSteps(String containerResource, ClassLoader classLoader, StepsConfiguration configuration) {
-        super(configuration);
-        container = createContainer(containerResource, classLoader);
-    }
-
-    public <T> T component(Class<T> type) {
-        return container.getComponent(type);
-    }
-
-    public <T> T getComponent(Class<T> type, Object key) {
-        return container.getComponent(type, key);
-    }
-
-    protected abstract Container createContainer(String containerResource, ClassLoader classLoader);
-
-}

Modified: branches/container-classloading/pom.xml (943 => 944)

--- branches/container-classloading/pom.xml	2008-09-21 22:37:30 UTC (rev 943)
+++ branches/container-classloading/pom.xml	2008-09-21 22:54:41 UTC (rev 944)
@@ -12,6 +12,7 @@
 
   <modules>
     <module>jbehave-core</module>
+    <module>jbehave-container</module>
     <module>jbehave-maven-plugin</module>
   </modules>
 


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to