openejb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaskow...@apache.org
Subject svn commit: r453521 - in /incubator/openejb/trunk/openejb3: container/openejb-core/ container/openejb-core/src/main/resources/META-INF/org.apache.openejb/ server/openejb-server/src/main/java/org/apache/openejb/server/ server/openejb-server/src/main/res...
Date Fri, 06 Oct 2006 07:24:22 GMT
Author: jlaskowski
Date: Fri Oct  6 00:24:21 2006
New Revision: 453521

URL: http://svn.apache.org/viewvc?view=rev&rev=453521
Log:
Decouple startup classes and let XBean "assemble" OpenEJB server

Added:
    incubator/openejb/trunk/openejb3/server/openejb-server/src/main/resources/META-INF/openejb-server.xml
  (with props)
Modified:
    incubator/openejb/trunk/openejb3/container/openejb-core/pom.xml
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring2.xml
    incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Main.java
    incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Server.java

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/pom.xml?view=diff&rev=453521&r1=453520&r2=453521
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/pom.xml (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/pom.xml Fri Oct  6 00:24:21 2006
@@ -76,7 +76,7 @@
       <plugin>
         <groupId>org.apache.xbean</groupId>
         <artifactId>maven-xbean-plugin</artifactId>
-        <version>2.6</version>
+        <version>2.7-SNAPSHOT</version>
         <executions>
           <execution>
             <goals>
@@ -85,7 +85,8 @@
           </execution>
         </executions>
         <configuration>
-          <namespace>http://openejb.org/schemas/core</namespace>
+          <!--  namespace>http://openejb.org/schemas/core</namespace -->
+          <namespace>http://openejb.apache.org/schemas/core</namespace>
           <excludedClasses>org.apache.openejb.alt.config.ejb,org.apache.openejb.util.io</excludedClasses>
         </configuration>
       </plugin>
@@ -234,9 +235,17 @@
     <dependency>
       <groupId>org.apache.xbean</groupId>
       <artifactId>xbean-spring</artifactId>
-      <version>2.6</version>
+      <version>2.7-SNAPSHOT</version>
+    </dependency>
+    <!-- FIXME: Why should it be specified here? -->
+    <!-- TODO: Bump up the version to rc4 -->
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring</artifactId>
+      <version>2.0-rc3</version>
     </dependency>
     <!-- END: Spring dependencies -->
 
   </dependencies>
+
 </project>

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml?view=diff&rev=453521&r1=453520&r2=453521
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml
Fri Oct  6 00:24:21 2006
@@ -21,7 +21,7 @@
 <!-- $Rev$ $Date$ -->
 
 <!--<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">-->
-<beans xmlns:o="http://openejb.org/schemas/core">
+<beans xmlns:o="http://openejb.apache.org/schemas/core">
   <o:jdk13ProxyFactory id="proxyFactory"/>
 
   <o:containerSystem id="containerSystem"/>

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring2.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring2.xml?view=diff&rev=453521&r1=453520&r2=453521
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring2.xml
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring2.xml
Fri Oct  6 00:24:21 2006
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 
 <!--<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">-->
-<beans xmlns:o="http://openejb.org/schemas/core">
+<beans xmlns:o="http://openejb.apache.org/schemas/core">
 
   <bean id="proxyFactory" class="org.apache.openejb.util.proxy.Jdk13ProxyFactory" init-method="start"/>
 

Modified: incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Main.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Main.java?view=diff&rev=453521&r1=453520&r2=453521
==============================================================================
--- incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Main.java
(original)
+++ incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Main.java
Fri Oct  6 00:24:21 2006
@@ -23,7 +23,15 @@
 
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.util.JarUtils;
-
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.apache.xbean.spring.context.SpringApplicationContext;
+import org.apache.xbean.spring.context.v2.XBeanXmlBeanFactory;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.core.io.ClassPathResource;
+
+/**
+ * Assemble OpenEJB instance and boot it up 
+ */
 public class Main {
 
     private static final String helpBase = "META-INF/org.apache.openejb.cli/";
@@ -44,6 +52,13 @@
         }
     }
 
+    /**
+     * Parse arguments and override any {@link System} properties returned via {@link System#getProperties()}.
+     *  
+     * @param args command line arguments
+     * @return properties as defined in System and on the command line
+     * @throws DontStartServerException thrown as an indication to not boot up OpenEJB instance,
e.g. after printing out properties, help, etc. 
+     */
     private static Properties parseArguments(String args[]) throws DontStartServerException
{
         Properties props = new Properties();
         props.putAll(System.getProperties());
@@ -173,7 +188,12 @@
     }
 
     private static void initServer(Properties props) throws Exception {
-        Server server = new Server();
+        //Server server = new Server();
+// FIXME: XBeanXmlBeanFactory vs AbstractXmlApplicationContext
+//        XBeanXmlBeanFactory factory = new XBeanXmlBeanFactory(new ClassPathResource("META-INF/openejb-server.xml"));
+//        Server server = (Server) factory.getBean("server");
+        SpringApplicationContext factory = new ClassPathXmlApplicationContext("META-INF/openejb-server.xml");
+        Server server = (Server) factory.getBean("server");
         server.init(props);
         server.start();
     }

Modified: incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Server.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Server.java?view=diff&rev=453521&r1=453520&r2=453521
==============================================================================
--- incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Server.java
(original)
+++ incubator/openejb/trunk/openejb3/server/openejb-server/src/main/java/org/apache/openejb/server/Server.java
Fri Oct  6 00:24:21 2006
@@ -25,6 +25,14 @@
 import org.apache.openejb.util.Messages;
 import org.apache.openejb.util.SafeToolkit;
 
+/**
+ * @org.apache.xbean.XBean 
+ *   namespace="http://openejb.apache.org/schemas/openejb" 
+ *   element="server"
+ *   description="OpenEJB Server"
+ * 
+ * @version $Rev$ $Date$
+ */
 public class Server implements org.apache.openejb.spi.Service {
 
     private SafeToolkit toolkit = SafeToolkit.getToolkit("OpenEJB EJB Server");
@@ -53,7 +61,10 @@
             System.out.println("[init] OpenEJB Remote Server");
         }
 
-        manager = ServiceManager.getManager();
+        // it's injected by XBean
+        // @see openejb-server.xml
+        // FIXME: Remove it once we're certain it works well (which should be in a couple
of commits)
+        //manager = ServiceManager.getManager();
         manager.init();
     }
 
@@ -69,8 +80,6 @@
 
     }
 
-//    public void addService(ServerService )
-
     public static class ServerServiceFactory {
         public ServerService createService(URI location) throws IOException {
             String scheme = location.getScheme();
@@ -79,5 +88,8 @@
         }
     }
 
+    public void setServiceManager(ServiceManager serviceManager) {
+        this.manager = serviceManager;
+    }
 }
 

Added: incubator/openejb/trunk/openejb3/server/openejb-server/src/main/resources/META-INF/openejb-server.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/server/openejb-server/src/main/resources/META-INF/openejb-server.xml?view=auto&rev=453521
==============================================================================
--- incubator/openejb/trunk/openejb3/server/openejb-server/src/main/resources/META-INF/openejb-server.xml
(added)
+++ incubator/openejb/trunk/openejb3/server/openejb-server/src/main/resources/META-INF/openejb-server.xml
Fri Oct  6 00:24:21 2006
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	
+	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.
+	
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<beans>
+	<!-- TODO: Use the following definition - truely XBean-ized one -->
+	<!--  server xmlns="http://openejb.apache.org/schemas/core" / -->
+	<bean id="server" class="org.apache.openejb.server.Server">
+		<property name="serviceManager" ref="serviceManager" />
+	</bean>
+	<bean id="serviceManager" class="org.apache.openejb.server.ServiceManager" factory-method="getManager"
/>
+</beans>

Propchange: incubator/openejb/trunk/openejb3/server/openejb-server/src/main/resources/META-INF/openejb-server.xml
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message