You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/10/02 21:51:52 UTC
svn commit: r701226 [1/2] - in /geronimo/gshell/trunk: ./ gshell-assembly/
gshell-assembly/src/main/underlay/etc/
gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/
gshell-remote/gshell-whisper/ gshell-re...
Author: jdillon
Date: Thu Oct 2 12:51:51 2008
New Revision: 701226
URL: http://svn.apache.org/viewvc?rev=701226&view=rev
Log:
Initial refactoring to remove dependency on spring-context and ApplicationContext stuff, just using a BeanFactory, will re-implement some of the AC goodies later when needed
Added:
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java (contents, props changed)
- copied, changed from r700417, geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LifecycleProcessor.java (contents, props changed)
- copied, changed from r700417, geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/LoggingProcessorTest-context.xml (contents, props changed)
- copied, changed from r700417, geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationFactoryBean.java (contents, props changed)
- copied, changed from r700417, geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsConfiguredEvent.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationScope.java (contents, props changed)
- copied, changed from r700417, geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationConfiguredEvent.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsFactoryBean.java (with props)
Removed:
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerSupport.java
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/ClassPathLoadingTest.java
Modified:
geronimo/gshell/trunk/gshell-assembly/pom.xml
geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/log4j.xml
geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java
geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.java
geronimo/gshell/trunk/gshell-remote/gshell-whisper/pom.xml
geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTest.java
geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocatorTest.java
geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportFactoryTest.java
geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTest-context.xml
geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocatorTest-context.xml
geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportFactoryTest-context.xml
geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml
geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java
geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest.java
geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/resources/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest-context.xml
geronimo/gshell/trunk/gshell-support/gshell-plexus/pom.xml
geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java
geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/LoggingProcessorTest.java
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java
geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/builder/ShellBuilderImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/resources/META-INF/spring/components.xml
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/pom.xml
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginManagerImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/HistoryImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/test/java/org/apache/geronimo/gshell/wisdom/config/PluginParserTest.java
geronimo/gshell/trunk/pom.xml
Modified: geronimo/gshell/trunk/gshell-assembly/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/pom.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/pom.xml Thu Oct 2 12:51:51 2008
@@ -53,16 +53,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-file</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-http-lightweight</artifactId>
- </dependency>
</dependencies>
<build>
Modified: geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/log4j.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/log4j.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/log4j.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/log4j.xml Thu Oct 2 12:51:51 2008
@@ -89,6 +89,10 @@
<level value="INFO"/>
</logger>
+ <logger name="org.apache.geronimo.gshell.spring.LifecycleProcessor">
+ <level value="INFO"/>
+ </logger>
+
<logger name="org.apache.geronimo.gshell.spring.BeanContainerContext">
<level value="INFO"/>
</logger>
Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java Thu Oct 2 12:51:51 2008
@@ -28,6 +28,7 @@
import org.apache.geronimo.gshell.shell.Shell;
import org.apache.geronimo.gshell.spring.BeanContainer;
import org.apache.geronimo.gshell.spring.BeanContainerAware;
+import org.apache.geronimo.gshell.spring.BeanContainerImpl;
import org.apache.geronimo.gshell.whisper.transport.Session;
import java.util.UUID;
@@ -59,7 +60,9 @@
// Create a new container which will be the parent for our remote shells
String id = "gshell.remote-shell[" + UUID.randomUUID() + "]";
context.container = container.createChild(id);
- context.container.start();
+ context.container.loadBeans(new String[] {
+ "classpath*:META-INF/spring/components.xml"
+ });
// Setup the shell context and related components
context.io = new RemoteIO(session);
Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.java (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.java Thu Oct 2 12:51:51 2008
@@ -50,10 +50,7 @@
shell.close();
shell = null;
- container.stop();
- container.close();
container = null;
-
io = null;
variables = null;
pk = null;
Modified: geronimo/gshell/trunk/gshell-remote/gshell-whisper/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-whisper/pom.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-whisper/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-whisper/pom.xml Thu Oct 2 12:51:51 2008
@@ -87,12 +87,6 @@
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-spring</artifactId>
<classifier>tests</classifier>
Modified: geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTest.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTest.java (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTest.java Thu Oct 2 12:51:51 2008
@@ -146,13 +146,15 @@
private TransportFactoryLocator locator;
private TransportFactoryLocator getLocator() {
- TransportFactoryLocator locator = (TransportFactoryLocator) applicationContext.getBean("transportFactoryLocator");
+ TransportFactoryLocator locator = getBeanContainer().getBean("transportFactoryLocator", TransportFactoryLocator.class);
assertNotNull(locator);
return locator;
}
- protected void onSetUp() throws Exception {
+ protected void setUp() throws Exception {
+ super.setUp();
+
locator = getLocator();
}
Modified: geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocatorTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocatorTest.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocatorTest.java (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocatorTest.java Thu Oct 2 12:51:51 2008
@@ -34,23 +34,17 @@
public class TransportFactoryLocatorTest
extends SpringTestSupport
{
- private TransportFactoryLocator locator;
-
private TransportFactoryLocator getLocator() {
- TransportFactoryLocator locator = (TransportFactoryLocator) applicationContext.getBean("transportFactoryLocator");
+ TransportFactoryLocator locator = getBeanContainer().getBean("transportFactoryLocator", TransportFactoryLocator.class);
assertNotNull(locator);
return locator;
}
- protected void onSetUp() throws Exception {
- locator = getLocator();
- }
-
public void testLocate_vm() throws Exception {
URI uri = new URI("vm://local:1");
- TransportFactory factory = locator.locate(uri);
+ TransportFactory factory = getLocator().locate(uri);
assertTrue(factory instanceof VmTransportFactory);
@@ -60,7 +54,7 @@
public void testLocate_tcp() throws Exception {
URI uri = new URI("tcp://localhost:9999");
- TransportFactory factory = locator.locate(uri);
+ TransportFactory factory = getLocator().locate(uri);
assertTrue(factory instanceof TcpTransportFactory);
@@ -70,7 +64,7 @@
public void testLocate_ssl() throws Exception {
URI uri = new URI("ssl://localhost:9999");
- TransportFactory factory = locator.locate(uri);
+ TransportFactory factory = getLocator().locate(uri);
assertTrue(factory instanceof SslTransportFactory);
@@ -81,7 +75,7 @@
URI uri = new URI("unknown://localhost:9999");
try {
- locator.locate(uri);
+ getLocator().locate(uri);
fail();
}
catch (InvalidLocationException expected) {}
@@ -91,7 +85,7 @@
URI uri = new URI("localhost");
try {
- locator.locate(uri);
+ getLocator().locate(uri);
fail();
}
catch (InvalidLocationException expected) {}
Modified: geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportFactoryTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportFactoryTest.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportFactoryTest.java (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportFactoryTest.java Thu Oct 2 12:51:51 2008
@@ -41,13 +41,15 @@
private URI uri;
private TransportFactoryLocator getLocator() {
- TransportFactoryLocator locator = (TransportFactoryLocator) applicationContext.getBean("transportFactoryLocator");
+ TransportFactoryLocator locator = getBeanContainer().getBean("transportFactoryLocator", TransportFactoryLocator.class);
assertNotNull(locator);
return locator;
}
- protected void onSetUp() throws Exception {
+ protected void setUp() throws Exception {
+ super.setUp();
+
uri = new URI("vm://local:1");
factory = getLocator().locate(uri);
Modified: geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTest-context.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTest-context.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTest-context.xml (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTest-context.xml Thu Oct 2 12:51:51 2008
@@ -22,12 +22,8 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <context:annotation-config/>
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="transportFactoryLocator" class="org.apache.geronimo.gshell.whisper.transport.TransportFactoryLocatorImpl">
<property name="factories">
Modified: geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocatorTest-context.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocatorTest-context.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocatorTest-context.xml (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/transport/TransportFactoryLocatorTest-context.xml Thu Oct 2 12:51:51 2008
@@ -22,12 +22,8 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <context:annotation-config/>
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="transportFactoryLocator" class="org.apache.geronimo.gshell.whisper.transport.TransportFactoryLocatorImpl">
<property name="factories">
Modified: geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportFactoryTest-context.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportFactoryTest-context.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportFactoryTest-context.xml (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-whisper/src/test/resources/org/apache/geronimo/gshell/whisper/transport/vm/VmTransportFactoryTest-context.xml Thu Oct 2 12:51:51 2008
@@ -22,12 +22,8 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <context:annotation-config/>
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="transportFactoryLocator" class="org.apache.geronimo.gshell.whisper.transport.TransportFactoryLocatorImpl">
<property name="factories">
Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml Thu Oct 2 12:51:51 2008
@@ -67,25 +67,56 @@
<dependency>
<groupId>org.apache.maven.artifact</groupId>
<artifactId>maven-artifact</artifactId>
+ <version>3.0-alpha-1</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
+ <version>2.1.0-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact-manager</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-provider-api</artifactId>
+ <version>1.0-beta-4</version>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-file</artifactId>
+ <version>1.0-beta-4</version>
+ <scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-http-lightweight</artifactId>
+ <version>1.0-beta-4</version>
+ <exclusions>
+ <exclusion>
+ <groupId>jtidy</groupId>
+ <artifactId>jtidy</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-spring</artifactId>
<classifier>tests</classifier>
Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java Thu Oct 2 12:51:51 2008
@@ -19,17 +19,15 @@
package org.apache.geronimo.gshell.artifact;
-import org.springframework.beans.factory.FactoryBean;
+import org.apache.geronimo.gshell.plexus.Slf4jLoggingManager;
+import org.codehaus.plexus.DefaultContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.DefaultContainerConfiguration;
-import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.classworlds.ClassWorld;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.geronimo.gshell.plexus.Slf4jLoggingManager;
-
-import javax.annotation.PostConstruct;
+import org.springframework.beans.factory.FactoryBean;
/**
* Creates {@link ArtifactManager} beans.
@@ -41,10 +39,7 @@
{
private final Logger log = LoggerFactory.getLogger(getClass());
- private PlexusContainer container;
-
- @PostConstruct
- private void init() throws Exception {
+ private PlexusContainer createContainer() throws Exception {
DefaultContainerConfiguration config = new DefaultContainerConfiguration();
// When running under ClassWorlds already, then set the containers realm to the current realm
@@ -59,15 +54,17 @@
config.setRealm(classRealm);
}
- container = new DefaultPlexusContainer(config);
+ DefaultPlexusContainer container = new DefaultPlexusContainer(config);
container.setLoggerManager(new Slf4jLoggingManager());
log.debug("Constructed Plexus container: {}", container);
+
+ return container;
}
-
+
public Object getObject() throws Exception {
- Object target = container.lookup(ArtifactManager.class);
+ Object target = createContainer().lookup(ArtifactManager.class);
log.debug("Using ArtifactManager: {}", target);
Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest.java Thu Oct 2 12:51:51 2008
@@ -30,7 +30,7 @@
extends SpringTestSupport
{
public void testProcessor() throws Exception {
- ArtifactManager artifactManager = (ArtifactManager) applicationContext.getBean("artifactManager");
+ ArtifactManager artifactManager = getBeanContainer().getBean("artifactManager", ArtifactManager.class);
assertNotNull(artifactManager);
}
}
\ No newline at end of file
Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/resources/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest-context.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/resources/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest-context.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/resources/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest-context.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/test/resources/org/apache/geronimo/gshell/artifact/ArtifactManagerFactoryTest-context.xml Thu Oct 2 12:51:51 2008
@@ -22,14 +22,8 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <context:annotation-config/>
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="artifactManager" class="org.apache.geronimo.gshell.artifact.ArtifactManagerFactory"/>
Modified: geronimo/gshell/trunk/gshell-support/gshell-plexus/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-plexus/pom.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-plexus/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-plexus/pom.xml Thu Oct 2 12:51:51 2008
@@ -42,16 +42,39 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
+ <version>1.0-beta-1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
-
+
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
+ <version>1.0-beta-1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
+
</dependencies>
</project>
\ No newline at end of file
Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml Thu Oct 2 12:51:51 2008
@@ -47,53 +47,47 @@
<groupId>org.slf4j</groupId>
<artifactId>jcl104-over-slf4j</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.0_spec</artifactId>
- <version>1.1.1</version>
- </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
+ <version>2.5.5</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
- <!--
- FIXME: Try to get ride of this dependency, or put it on a diet, cause it has was too muck crap we don't want/need/care about... and its 462K
- -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </dependency>
-
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
+ <version>2.5.5</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
-
+
<dependency>
- <groupId>org.jmock</groupId>
- <artifactId>jmock-junit3</artifactId>
- <scope>test</scope>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ <version>1.1.1</version>
</dependency>
-
+
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java Thu Oct 2 12:51:51 2008
@@ -17,7 +17,6 @@
* under the License.
*/
-
package org.apache.geronimo.gshell.spring;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
@@ -37,12 +36,8 @@
ClassRealm getClassRealm();
- void start();
-
- void stop();
+ void loadBeans(String[] locations) throws Exception;
- void close();
-
<T> T getBean(Class<T> type);
<T> T getBean(String name, Class<T> requiredType);
@@ -56,6 +51,4 @@
BeanContainer createChild(String id, List<URL> classPath);
BeanContainer createChild(String id);
-
- // Object configure(Object bean);
}
Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java Thu Oct 2 12:51:51 2008
@@ -41,6 +41,10 @@
public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException {
assert bean != null;
+ //
+ // TODO: Support ResourceLoaderAware like ApplicationContextAwareProcessor does
+ //
+
if (bean instanceof BeanContainerAware) {
((BeanContainerAware)bean).setBeanContainer(container);
}
Copied: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java (from r700417, geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java?p2=geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java&p1=geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java&r1=700417&r2=701226&rev=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java Thu Oct 2 12:51:51 2008
@@ -19,123 +19,37 @@
package org.apache.geronimo.gshell.spring;
-import org.codehaus.plexus.classworlds.ClassWorld;
-import org.codehaus.plexus.classworlds.realm.ClassRealm;
-import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
-import org.springframework.beans.FatalBeanException;
-import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
-import org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
-
-import java.net.URL;
-import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.BeanFactoryAware;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
/**
- * Default {@link BeanContainer} implementation.
+ * ???
*
* @version $Rev$ $Date$
*/
-public class BeanContainerImpl
- extends BeanContainerSupport
+public class BeanContainerContext
+ extends DefaultListableBeanFactory
{
- private static final String REALM_ID = "gshell";
-
- private final BeanContainer parent;
-
- private final BeanContainerContext context;
-
- private final ClassRealm classRealm;
-
- private static ClassRealm createDefaultClassRealm(final ClassLoader cl) {
- assert cl != null;
-
- try {
- return new ClassWorld().newRealm(REALM_ID, cl);
- }
- catch (DuplicateRealmException e) {
- // Should never happen
- throw new Error(e);
- }
- }
-
- public BeanContainerImpl(final ClassLoader cl) {
- this(createDefaultClassRealm(cl), null);
- }
-
- private BeanContainerImpl(final ClassRealm classRealm, final BeanContainerImpl parent) {
- assert classRealm != null;
- // parent may be null
-
- this.parent = parent;
- this.classRealm = classRealm;
-
- // Construct the container and add customizations
- context = new BeanContainerContext(classRealm, parent != null ? parent.context : null);
- context.setDisplayName(classRealm.getId());
- context.registerShutdownHook();
-
- // Attach processors
- context.addBeanPostProcessor(new CommonAnnotationBeanPostProcessor());
- context.addBeanPostProcessor(new AutowiredAnnotationBeanPostProcessor());
- context.addBeanPostProcessor(new RequiredAnnotationBeanPostProcessor());
- context.addBeanFactoryPostProcessor(new LoggingProcessor());
- context.addBeanPostProcessor(new BeanContainerAwareProcessor(this));
-
- // Refresh to load things up
- context.refresh();
- }
-
- protected ConfigurableApplicationContext getContext() {
- return context;
- }
+ private final Logger log = LoggerFactory.getLogger(getClass());
- public BeanContainer getParent() {
- return parent;
+ //
+ // TODO: Add more muck to support stuff in AbstractApplicationContext here, move some of the container bits from BeanContainerImpl into here.
+ //
+
+ public BeanContainerContext(final BeanContainerContext parent) {
+ super(parent);
}
- public ClassRealm getClassRealm() {
- return classRealm;
- }
+ public void addBeanPostProcessor(final BeanPostProcessor processor) {
+ assert processor != null;
- public BeanContainer createChild(final String id, final List<URL> classPath) {
- assert id != null;
- // classPath may be null
-
- if (log.isTraceEnabled()) {
- log.trace("Creating child container: {}", id);
- if (classPath != null) {
- log.trace("Classpath:");
- for (URL url : classPath) {
- log.trace(" {}", url);
- }
- }
- }
-
- ClassRealm childRealm;
- try {
- childRealm = classRealm.createChildRealm(id);
- }
- catch (DuplicateRealmException e) {
- throw new FatalBeanException("Failed to create child container realm: " + id, e);
+ if (processor instanceof BeanFactoryAware) {
+ ((BeanFactoryAware)processor).setBeanFactory(this);
}
- if (classPath != null) {
- for (URL url : classPath) {
- childRealm.addURL(url);
- }
- }
-
- return new BeanContainerImpl(childRealm, this);
- }
-
- /*
- public Object configure(final Object bean) {
- assert bean != null;
-
- context.getAutowireCapableBeanFactory().autowireBean(bean);
-
- return bean;
+ super.addBeanPostProcessor(processor);
}
- */
}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java Thu Oct 2 12:51:51 2008
@@ -22,14 +22,29 @@
import org.codehaus.plexus.classworlds.ClassWorld;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.FatalBeanException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
-import org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
+import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
+import org.springframework.beans.factory.xml.ResourceEntityResolver;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.beans.support.ResourceEditorRegistrar;
+import org.springframework.core.io.DefaultResourceLoader;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.ResourceLoader;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* Default {@link BeanContainer} implementation.
@@ -37,27 +52,23 @@
* @version $Rev$ $Date$
*/
public class BeanContainerImpl
- extends BeanContainerSupport
+ implements BeanContainer
{
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
private static final String REALM_ID = "gshell";
- private final BeanContainer parent;
+ private final ClassRealm classRealm;
+
+ private final BeanContainerImpl parent;
+
+ private final ResourcePatternResolver resourceLoader;
private final BeanContainerContext context;
- private final ClassRealm classRealm;
+ private final List<BeanFactoryPostProcessor> beanFactoryPostProcessors = new ArrayList<BeanFactoryPostProcessor>();
- private static ClassRealm createDefaultClassRealm(final ClassLoader cl) {
- assert cl != null;
-
- try {
- return new ClassWorld().newRealm(REALM_ID, cl);
- }
- catch (DuplicateRealmException e) {
- // Should never happen
- throw new Error(e);
- }
- }
+ private final Set<Resource> resources = new LinkedHashSet<Resource>();
public BeanContainerImpl(final ClassLoader cl) {
this(createDefaultClassRealm(cl), null);
@@ -70,42 +81,103 @@
this.parent = parent;
this.classRealm = classRealm;
- // Construct the container and add customizations
- context = new BeanContainerContext(classRealm, parent != null ? parent.context : null);
- context.setDisplayName(classRealm.getId());
- context.registerShutdownHook();
+ //
+ // TODO: Move most of this to BeanContainerContext
+ //
+
+ // Construct the bean factory
+ context = new BeanContainerContext(parent != null ? parent.getContext() : null);
+ context.setBeanClassLoader(classRealm);
+ context.registerResolvableDependency(BeanFactory.class, context);
+
+ // Setup resource loading
+ resourceLoader = new PathMatchingResourcePatternResolver(new DefaultResourceLoader(classRealm));
+ context.addPropertyEditorRegistrar(new ResourceEditorRegistrar(resourceLoader));
+ context.registerResolvableDependency(ResourceLoader.class, resourceLoader);
- // Attach processors
- context.addBeanPostProcessor(new CommonAnnotationBeanPostProcessor());
- context.addBeanPostProcessor(new AutowiredAnnotationBeanPostProcessor());
- context.addBeanPostProcessor(new RequiredAnnotationBeanPostProcessor());
- context.addBeanFactoryPostProcessor(new LoggingProcessor());
+ // Add support for BeanContainerAware
context.addBeanPostProcessor(new BeanContainerAwareProcessor(this));
+ context.ignoreDependencyInterface(BeanContainerAware.class);
- // Refresh to load things up
- context.refresh();
- }
+ // Hook up annotation processing
+ context.addBeanPostProcessor(new AutowiredAnnotationBeanPostProcessor());
+ context.addBeanPostProcessor(new LifecycleProcessor());
- protected ConfigurableApplicationContext getContext() {
- return context;
+ // Add automatic trace logging of loaded beans
+ beanFactoryPostProcessors.add(new LoggingProcessor());
}
+ public ClassRealm getClassRealm() {
+ return classRealm;
+ }
+
public BeanContainer getParent() {
return parent;
}
- public ClassRealm getClassRealm() {
- return classRealm;
+ public BeanContainerContext getContext() {
+ return context;
}
+ public void loadBeans(final String[] locations) throws Exception {
+ assert locations != null;
+
+ log.debug("Loading beans");
+
+ for (String location : locations) {
+ Resource[] resources = resourceLoader.getResources(location);
+
+ for (Resource resource : resources) {
+ if (parent != null && parent.isOwnedResource(resource)) {
+ log.trace("Omitting resource owned by parent: {}", resource);
+ }
+ else {
+ log.trace("Adding resource: {}", resource);
+ this.resources.add(resource);
+ }
+ }
+ }
+
+ XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
+ reader.setResourceLoader(resourceLoader);
+ reader.setEntityResolver(new ResourceEntityResolver(resourceLoader));
+
+ log.debug("Loading bean definitions from {} resources", resources.size());
+
+ reader.loadBeanDefinitions(resources.toArray(new Resource[resources.size()]));
+
+ for (BeanFactoryPostProcessor processor : beanFactoryPostProcessors) {
+ processor.postProcessBeanFactory(context);
+ }
+ }
+
+ private boolean isOwnedResource(final Resource resource) {
+ assert resource != null;
+
+ if (resources.contains(resource)) {
+ return true;
+ }
+ else if (parent != null) {
+ return parent.isOwnedResource(resource);
+ }
+
+ return false;
+ }
+
+ //
+ // TODO: Bring back start/stop/destroy support
+ //
+
public BeanContainer createChild(final String id, final List<URL> classPath) {
assert id != null;
// classPath may be null
if (log.isTraceEnabled()) {
log.trace("Creating child container: {}", id);
+
if (classPath != null) {
log.trace("Classpath:");
+
for (URL url : classPath) {
log.trace(" {}", url);
}
@@ -129,13 +201,75 @@
return new BeanContainerImpl(childRealm, this);
}
- /*
- public Object configure(final Object bean) {
- assert bean != null;
+ public <T> T getBean(final Class<T> type) {
+ assert type != null;
+
+ log.trace("Getting bean of type: {}", type);
- context.getAutowireCapableBeanFactory().autowireBean(bean);
+ String[] names = getContext().getBeanNamesForType(type);
+
+ if (names.length == 0) {
+ throw new NoSuchBeanDefinitionException(type, "No bean defined for type: " + type);
+ }
+ if (names.length > 1) {
+ throw new NoSuchBeanDefinitionException(type, "No unique bean defined for type: " + type + ", found matches: " + Arrays.asList(names));
+ }
+
+ return getBean(names[0], type);
+ }
- return bean;
+ @SuppressWarnings({"unchecked"})
+ public <T> T getBean(final String name, final Class<T> requiredType) {
+ assert name != null;
+ assert requiredType != null;
+
+ log.trace("Getting bean named '{}' of type: {}", name, requiredType);
+
+ return (T) getContext().getBean(name, requiredType);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public <T> Map<String,T> getBeans(final Class<T> type) {
+ assert type != null;
+
+ log.trace("Getting beans of type: {}", type);
+
+ return (Map<String,T>) getContext().getBeansOfType(type);
+ }
+
+ public String[] getBeanNames() {
+ log.trace("Getting bean names");
+
+ return getContext().getBeanDefinitionNames();
+ }
+
+ public String[] getBeanNames(final Class type) {
+ assert type != null;
+
+ log.trace("Getting bean names of type: {}", type);
+
+ return getContext().getBeanNamesForType(type);
+ }
+
+ public BeanContainer createChild(final String id) {
+ assert id != null;
+
+ return createChild(id, null);
+ }
+
+ //
+ // TODO: See if we can drop the need for this.
+ //
+
+ private static ClassRealm createDefaultClassRealm(final ClassLoader cl) {
+ assert cl != null;
+
+ try {
+ return new ClassWorld().newRealm(REALM_ID, cl);
+ }
+ catch (DuplicateRealmException e) {
+ // Should never happen
+ throw new Error(e);
+ }
}
- */
}
\ No newline at end of file
Copied: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LifecycleProcessor.java (from r700417, geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LifecycleProcessor.java?p2=geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LifecycleProcessor.java&p1=geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java&r1=700417&r2=701226&rev=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessor.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LifecycleProcessor.java Thu Oct 2 12:51:51 2008
@@ -19,36 +19,24 @@
package org.apache.geronimo.gshell.spring;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor;
+import org.springframework.core.Ordered;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
/**
- * Spring bean post-processor to handle injection of beans which are {@link BeanContainerAware}.
+ * Extention of the Spring {@link InitDestroyAnnotationBeanPostProcessor} to support
+ * {@link PostConstruct} and {PreDestroy} annotations.
*
* @version $Rev$ $Date$
*/
-public class BeanContainerAwareProcessor
- implements BeanPostProcessor
+public class LifecycleProcessor
+ extends InitDestroyAnnotationBeanPostProcessor
{
- private final BeanContainer container;
-
- public BeanContainerAwareProcessor(final BeanContainer container) {
- assert container != null;
-
- this.container = container;
- }
-
- public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException {
- assert bean != null;
-
- if (bean instanceof BeanContainerAware) {
- ((BeanContainerAware)bean).setBeanContainer(container);
- }
-
- return bean;
- }
-
- public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException {
- return bean;
+ public LifecycleProcessor() {
+ setOrder(Ordered.LOWEST_PRECEDENCE - 3);
+ setInitAnnotationType(PostConstruct.class);
+ setDestroyAnnotationType(PreDestroy.class);
}
}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LifecycleProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LifecycleProcessor.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LifecycleProcessor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LifecycleProcessor.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/LifecycleProcessor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java Thu Oct 2 12:51:51 2008
@@ -19,10 +19,6 @@
package org.apache.geronimo.gshell.spring;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-
-import org.jmock.Mockery;
-
import javax.annotation.PostConstruct;
import junit.framework.Assert;
@@ -35,17 +31,11 @@
public class BeanContainerAwareProcessorTest
extends SpringTestSupport
{
- private Mockery context = new Mockery();
-
- protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory) {
- BeanContainer container = context.mock(BeanContainer.class);
- beanFactory.addBeanPostProcessor(new BeanContainerAwareProcessor(container));
- }
-
public void testProcessor() throws Exception {
- Target target = (Target) applicationContext.getBean("target");
+ Target target = getBeanContainer().getBean("target", Target.class);
assertNotNull(target);
assertNotNull(target.container);
+ assertTrue(target.initialized);
}
//
@@ -56,13 +46,16 @@
implements BeanContainerAware
{
public BeanContainer container;
-
+
+ public boolean initialized = false;
+
public void setBeanContainer(BeanContainer container) {
this.container = container;
}
-
+
@PostConstruct
- private void init() {
+ public void init() {
+ initialized = true;
Assert.assertNotNull(container);
}
}
Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/LoggingProcessorTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/LoggingProcessorTest.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/LoggingProcessorTest.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/LoggingProcessorTest.java Thu Oct 2 12:51:51 2008
@@ -29,7 +29,7 @@
{
public void testProcessor() throws Exception {
LoggingProcessor processor = new LoggingProcessor();
- String xml = processor.render(applicationContext.getBeanFactory());
+ String xml = processor.render(getBeanContainer().getContext());
assertNotNull(xml);
System.out.println("XML:\n" + xml);
Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/SpringTestSupport.java Thu Oct 2 12:51:51 2008
@@ -19,17 +19,9 @@
package org.apache.geronimo.gshell.spring;
-import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import junit.framework.TestCase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.codehaus.plexus.classworlds.realm.ClassRealm;
-
-import java.util.Map;
-import java.util.List;
-import java.net.URL;
/**
* Suport for Spring-based tests.
@@ -37,48 +29,35 @@
* @version $Rev$ $Date$
*/
public abstract class SpringTestSupport
- extends AbstractDependencyInjectionSpringContextTests
+ extends TestCase
{
protected final Logger log = LoggerFactory.getLogger(getClass());
+ private BeanContainerImpl container;
+
+ protected void setUp() throws Exception {
+ container = new BeanContainerImpl(getClass().getClassLoader());
+ configure(container);
+ }
+
+ protected void tearDown() throws Exception {
+ container = null;
+ }
+
+ protected void configure(final BeanContainerImpl container) throws Exception {
+ container.loadBeans(getConfigLocations());
+ }
+
protected String[] getConfigLocations() {
return new String[] {
"classpath:" + getClass().getName().replace('.', '/') + "-context.xml"
};
}
- private BeanContainer container;
-
- protected void prepareApplicationContext(final GenericApplicationContext context) {
- assert context != null;
-
- log.debug("Prepare applciation context");
-
- container = new BeanContainerSupport() {
- protected ConfigurableApplicationContext getContext() {
- return context;
- }
-
- public BeanContainer getParent() {
- return null;
- }
-
- public ClassRealm getClassRealm() {
- throw new UnsupportedOperationException();
- }
-
- public BeanContainer createChild(final String id, final List<URL> classPath) {
- throw new UnsupportedOperationException();
- }
- };
+ protected BeanContainerImpl getBeanContainer() {
+ if (container == null) {
+ throw new IllegalStateException();
+ }
+ return container;
}
-
- protected void customizeBeanFactory(final DefaultListableBeanFactory beanFactory) {
- assert beanFactory != null;
-
- log.debug("Customize bean factory");
-
- assert container != null;
- beanFactory.addBeanPostProcessor(new BeanContainerAwareProcessor(container));
- }
}
\ No newline at end of file
Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml Thu Oct 2 12:51:51 2008
@@ -22,12 +22,8 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <context:annotation-config/>
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="target" class="org.apache.geronimo.gshell.spring.BeanContainerAwareProcessorTest$Target"/>
Copied: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/LoggingProcessorTest-context.xml (from r700417, geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/LoggingProcessorTest-context.xml?p2=geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/LoggingProcessorTest-context.xml&p1=geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml&r1=700417&r2=701226&rev=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest-context.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/LoggingProcessorTest-context.xml Thu Oct 2 12:51:51 2008
@@ -22,12 +22,8 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <context:annotation-config/>
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="target" class="org.apache.geronimo.gshell.spring.BeanContainerAwareProcessorTest$Target"/>
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/LoggingProcessorTest-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/LoggingProcessorTest-context.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/LoggingProcessorTest-context.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/LoggingProcessorTest-context.xml
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/resources/org/apache/geronimo/gshell/spring/LoggingProcessorTest-context.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Copied: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationFactoryBean.java (from r700417, geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsConfiguredEvent.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationFactoryBean.java?p2=geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationFactoryBean.java&p1=geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsConfiguredEvent.java&r1=700417&r2=701226&rev=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsConfiguredEvent.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationFactoryBean.java Thu Oct 2 12:51:51 2008
@@ -19,26 +19,40 @@
package org.apache.geronimo.gshell.wisdom.application;
-import org.apache.geronimo.gshell.application.settings.Settings;
-import org.apache.geronimo.gshell.event.Event;
+import org.apache.geronimo.gshell.application.Application;
+import org.apache.geronimo.gshell.application.ApplicationManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.annotation.Autowired;
/**
- * Event fired once settings have been configured.
+ * ???
*
* @version $Rev$ $Date$
*/
-public class SettingsConfiguredEvent
- implements Event
+public class ApplicationFactoryBean
+ implements FactoryBean
{
- private final Settings settings;
-
- public SettingsConfiguredEvent(final Settings settings) {
- assert settings != null;
+ private final Logger log = LoggerFactory.getLogger(getClass());
- this.settings = settings;
+ @Autowired
+ private ApplicationManager applicationManager;
+
+ public Object getObject() throws Exception {
+ assert applicationManager != null;
+ Application app = applicationManager.getApplication();
+
+ log.debug("Applictaion: {}", app);
+
+ return app;
+ }
+
+ public Class getObjectType() {
+ return Application.class;
}
- public Settings getSettings() {
- return settings;
+ public boolean isSingleton() {
+ return true;
}
}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationFactoryBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationFactoryBean.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationFactoryBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationFactoryBean.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationFactoryBean.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationImpl.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationImpl.java Thu Oct 2 12:51:51 2008
@@ -31,8 +31,8 @@
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
-import java.util.Set;
import java.util.LinkedHashSet;
+import java.util.Set;
/**
* Event fired once the application has constructed a shell.
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java Thu Oct 2 12:51:51 2008
@@ -23,6 +23,7 @@
import org.apache.geronimo.gshell.application.ApplicationConfiguration;
import org.apache.geronimo.gshell.application.ApplicationManager;
import org.apache.geronimo.gshell.application.ApplicationSecurityManager;
+import org.apache.geronimo.gshell.application.plugin.PluginManager;
import org.apache.geronimo.gshell.application.settings.SettingsManager;
import org.apache.geronimo.gshell.artifact.ArtifactManager;
import org.apache.geronimo.gshell.event.EventPublisher;
@@ -112,6 +113,9 @@
application = loadApplication(config);
log.debug("Application configured");
+
+ // HACK: Force the plugin manager to boot up before we fire the event
+ applicationContainer.getBean(PluginManager.class);
eventPublisher.publish(new ApplicationConfiguredEvent(application));
}
@@ -176,11 +180,12 @@
List<URL> classPath = createClassPath(artifacts);
BeanContainer child = container.createChild("gshell.application(" + model.getId() + ")", classPath);
-
log.debug("Application container: {}", child);
- child.start();
-
+ child.loadBeans(new String[] {
+ "classpath*:META-INF/spring/components.xml"
+ });
+
applicationContainer = child;
return app;
Copied: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationScope.java (from r700417, geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationConfiguredEvent.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationScope.java?p2=geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationScope.java&p1=geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationConfiguredEvent.java&r1=700417&r2=701226&rev=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationConfiguredEvent.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationScope.java Thu Oct 2 12:51:51 2008
@@ -19,26 +19,30 @@
package org.apache.geronimo.gshell.wisdom.application;
-import org.apache.geronimo.gshell.application.Application;
-import org.apache.geronimo.gshell.event.Event;
+import org.springframework.beans.factory.config.Scope;
+import org.springframework.beans.factory.ObjectFactory;
/**
- * Event fired once the application has been configured.
+ * ???
*
* @version $Rev$ $Date$
*/
-public class ApplicationConfiguredEvent
- implements Event
+public class ApplicationScope
+ implements Scope
{
- private final Application application;
-
- public ApplicationConfiguredEvent(final Application application) {
- assert application != null;
+ public Object get(final String name, final ObjectFactory objectFactory) {
+ return null;
+ }
+
+ public Object remove(final String name) {
+ return null;
+ }
+
+ public void registerDestructionCallback(final String name, final Runnable callback) {
- this.application = application;
}
- public Application getApplication() {
- return application;
+ public String getConversationId() {
+ return null;
}
}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationScope.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationScope.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationScope.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationScope.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationScope.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsFactoryBean.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsFactoryBean.java?rev=701226&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsFactoryBean.java (added)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsFactoryBean.java Thu Oct 2 12:51:51 2008
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.wisdom.application;
+
+import org.apache.geronimo.gshell.application.settings.Settings;
+import org.apache.geronimo.gshell.application.settings.SettingsManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class SettingsFactoryBean
+ implements FactoryBean
+{
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Autowired
+ private SettingsManager settingsManager;
+
+ public Object getObject() throws Exception {
+ assert settingsManager != null;
+ Settings settings = settingsManager.getSettings();
+
+ log.debug("Settings: {}", settings);
+
+ return settings;
+ }
+
+ public Class getObjectType() {
+ return Settings.class;
+ }
+
+ public boolean isSingleton() {
+ return true;
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsFactoryBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsFactoryBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/SettingsFactoryBean.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/builder/ShellBuilderImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/builder/ShellBuilderImpl.java?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/builder/ShellBuilderImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/builder/ShellBuilderImpl.java Thu Oct 2 12:51:51 2008
@@ -61,13 +61,23 @@
private ArtifactManager artifactManager;
- private BeanContainer createContainer() {
- return new BeanContainerImpl(getClassLoader());
+ private BeanContainer createContainer() throws Exception {
+ BeanContainerImpl container = new BeanContainerImpl(getClassLoader());
+ container.loadBeans(new String[] {
+ "classpath*:META-INF/spring/components.xml"
+ });
+
+ return container;
}
private BeanContainer getContainer() {
if (container == null) {
- container = createContainer();
+ try {
+ container = createContainer();
+ }
+ catch (Exception e) {
+ throw new RuntimeException("Failed to create container", e);
+ }
}
return container;
}
@@ -189,8 +199,6 @@
// Initialize the container
BeanContainer container = getContainer();
- container.start();
-
log.debug("Container: {}", container);
//
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/resources/META-INF/spring/components.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/resources/META-INF/spring/components.xml (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/resources/META-INF/spring/components.xml Thu Oct 2 12:51:51 2008
@@ -27,6 +27,10 @@
<bean id="settingsManager" class="org.apache.geronimo.gshell.wisdom.application.SettingsManagerImpl"/>
+ <bean id="settings" class="org.apache.geronimo.gshell.wisdom.application.SettingsFactoryBean"/>
+
<bean id="applicationManager" class="org.apache.geronimo.gshell.wisdom.application.ApplicationManagerImpl"/>
+ <bean id="application" class="org.apache.geronimo.gshell.wisdom.application.ApplicationFactoryBean"/>
+
</beans>
\ No newline at end of file
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/pom.xml?rev=701226&r1=701225&r2=701226&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/pom.xml Thu Oct 2 12:51:51 2008
@@ -78,13 +78,7 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
-
+
<dependency>
<groupId>org.apache.geronimo.gshell.support</groupId>
<artifactId>gshell-spring</artifactId>