tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1206854 - in /openejb/trunk/openejb/container: openejb-core/ openejb-core/src/main/java/org/apache/openejb/assembler/classic/ openejb-core/src/main/java/org/apache/openejb/cdi/ openejb-core/src/main/resources/ openejb-osgi/ openejb-osgi/sr...
Date Sun, 27 Nov 2011 21:51:09 GMT
Author: rmannibucau
Date: Sun Nov 27 21:51:07 2011
New Revision: 1206854

URL: http://svn.apache.org/viewvc?rev=1206854&view=rev
Log:
trying to make a simple deployment working under OSGi

Added:
    openejb/trunk/openejb/container/openejb-core/src/main/resources/juli.properties
    openejb/trunk/openejb/container/openejb-osgi/src/main/resources/embedded.juli.properties
    openejb/trunk/openejb/container/openejb-osgi/src/main/resources/juli.properties
Modified:
    openejb/trunk/openejb/container/openejb-core/pom.xml
    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java
    openejb/trunk/openejb/container/openejb-osgi/pom.xml
    openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java

Modified: openejb/trunk/openejb/container/openejb-core/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/pom.xml?rev=1206854&r1=1206853&r2=1206854&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/pom.xml (original)
+++ openejb/trunk/openejb/container/openejb-core/pom.xml Sun Nov 27 21:51:07 2011
@@ -20,68 +20,441 @@
 
 <!-- $Rev$ $Date$ -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <parent>
-        <artifactId>container</artifactId>
-        <groupId>org.apache.openejb</groupId>
-        <version>4.0.0-beta-2-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>openejb-core</artifactId>
-    <packaging>jar</packaging>
-    <name>OpenEJB :: Container :: Core</name>
-    <properties>
-        <openejb.osgi.import.pkg>
-            org.apache.activemq.ra;resolution:=optional,
-            org.apache.commons.dbcp.managed;resolution:=optional,
-            oracle.toplink.*;resolution:=optional,
-            org.apache.openjpa.*;resolution:=optional,
-            org.eclipse.persistence.*;resolution:=optional,
-            org.hibernate.*;resolution:=optional,
-            org.quartz.*;resolution:=optional,
-            org.hsqldb.jdbc;resolution:=optional,
-            javax.enterprise.deploy*;resolution:=optional,
-            javax.jms*;resolution:=optional,
-            javax.mail*;resolution:=optional,
-            javax.xml.registry*;resolution:=optional,
-            javax.xml.rpc*;resolution:=optional,
-            org.apache.activemq*;resolution:=optional,
-            org.apache.kahadb*;resolution:=optional,
-            org.apache.catalina*;resolution:=optional,
-            org.apache.commons.dbcp*;resolution:=optional,
-            org.apache.xerces*;resolution:=optional,
-            org.apache.xml.resolver*;resolution:=optional,
-            org.junit*;resolution:=optional,
-            javax.annotation;version="[1.1.0,2.0.0)",
-            javax.annotation.security;version="[1.1.0,2.0.0)",
-            javax.annotation.sql;version="[1.1.0,2.0.0)",
-            javax.transaction;version="[1.1.0,2.0.0)",
-            javax.transaction.xa;version="[1.1.0,2.0.0)",
-            javax.ejb;version=3.1,
-            javax.ejb.embeddable;version=3.1,
-            javax.ejb.spi;version=3.1,
-            javax.xml.ws,
-            *
-        </openejb.osgi.import.pkg>
-        <openejb.osgi.export>
-            !org.apache.openejb.client,
-            org.apache.openejb*;version=${openejb.osgi.export.version}
-        </openejb.osgi.export>
-    </properties>
-    <build>
-        <resources>
-            <resource>
-                <directory>src/main/resources</directory>
-                <filtering>true</filtering>
-            </resource>
-        </resources>
-        <testResources>
-            <testResource>
-                <directory>src/test/resources</directory>
-                <filtering>true</filtering>
-            </testResource>
-        </testResources>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>container</artifactId>
+    <groupId>org.apache.openejb</groupId>
+    <version>4.0.0-beta-2-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>openejb-core</artifactId>
+  <packaging>jar</packaging>
+  <name>OpenEJB :: Container :: Core</name>
+  <properties>
+    <openejb.osgi.import.pkg>
+      org.apache.activemq.ra;resolution:=optional,
+      org.apache.commons.dbcp.managed;resolution:=optional,
+      oracle.toplink.*;resolution:=optional,
+      org.apache.openjpa.*;resolution:=optional,
+      org.eclipse.persistence.*;resolution:=optional,
+      org.hibernate.*;resolution:=optional,
+      org.quartz.*;resolution:=optional,
+      org.hsqldb.jdbc;resolution:=optional,
+      javax.enterprise.deploy*;resolution:=optional,
+      javax.jms*;resolution:=optional,
+      javax.mail*;resolution:=optional,
+      javax.xml.registry*;resolution:=optional,
+      javax.xml.rpc*;resolution:=optional,
+      org.apache.activemq*;resolution:=optional,
+      org.apache.kahadb*;resolution:=optional,
+      org.apache.catalina*;resolution:=optional,
+      org.apache.commons.dbcp*;resolution:=optional,
+      org.apache.xerces*;resolution:=optional,
+      org.apache.xml.resolver*;resolution:=optional,
+      org.junit*;resolution:=optional,
+      javax.annotation*;version=1.1,
+      javax.transaction*;version=1.1,
+      javax.ejb*;version=3.1,
+      javax.xml.ws,
+      *
+    </openejb.osgi.import.pkg>
+    <openejb.osgi.export>
+      !org.apache.openejb.client,
+      org.apache.openejb.cdi.*;version=${openejb.osgi.export.version},
+      org.apache.openejb*;version=${openejb.osgi.export.version}
+    </openejb.osgi.export>
+  </properties>
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>true</filtering>
+      </testResource>
+    </testResources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.3.2</version>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+          <compilerArguments>
+            <endorseddirs>${openejb.build.endorsed}</endorseddirs>
+          </compilerArguments>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>copy</id>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>copy</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.apache.openejb</groupId>
+                  <artifactId>openejb-javaagent</artifactId>
+                  <version>${project.version}</version>
+                  <outputDirectory>${project.build.directory}</outputDirectory>
+                </artifactItem>
+              </artifactItems>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkMode>pertest</forkMode>
+          <testNGArtifactName>none:none</testNGArtifactName>
+          <argLine>-Xmx256m -Djava.endorsed.dirs=${openejb.build.endorsed} "-javaagent:${basedir}/target/openejb-javaagent-${project.version}.jar"
-enableassertions</argLine>
+          <workingDirectory>${basedir}/target</workingDirectory>
+          <systemPropertyVariables>
+            <openejb.home>${basedir}/target/test-classes</openejb.home>
+            <log4j.configuration>file:///${basedir}/target/classes/embedded.logging.properties</log4j.configuration>
+          </systemPropertyVariables>
+          <excludes>
+            <exclude>**/TestHandler.java</exclude>
+            <exclude>org/apache/openejb/cdi/**</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>test-testng</id>
+            <phase>test</phase>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <configuration>
+              <junitArtifactName>none:none</junitArtifactName>
+              <excludes>
+                <exclude>**</exclude>
+              </excludes>
+              <includes>
+                <include>org/apache/openejb/cdi/**</include>
+              </includes>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <target>
+                <tstamp>
+                  <format property="TSTAMP" pattern="hh:mm" />
+                </tstamp>
+                <replace file="target/classes/openejb-version.properties" token="@DATE-REPLACED-BY-MAVEN@"
value="${DSTAMP}" />
+                <replace file="target/classes/openejb-version.properties" token="@TIME-REPLACED-BY-MAVEN@"
value="${TSTAMP}" />
+                <property name="compile_classpath" refid="maven.compile.classpath" />
+                <java classname="org.apache.openejb.util.MakeTxLookup">
+                  <arg value="${project.build.directory}" />
+                  <classpath>
+                    <pathelement path="${compile_classpath}" />
+                  </classpath>
+                </java>
+              </target>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <mainClass>org.apache.openejb.cli.Bootstrap</mainClass>
+              <!--<addClasspath>true</addClasspath>-->
+            </manifest>
+            <manifestEntries>
+              <Class-Path>openejb-loader-${project.version}.jar openejb-client-${project.version}.jar
+                xbean-finder-shaded-${xbeanVersion}.jar xbean-asm-shaded-${xbeanVersion}.jar
+              </Class-Path>
+              <J2EE-DeploymentFactory-Implementation-Class>
+                org.apache.openejb.config.VmDeploymentFactory
+              </J2EE-DeploymentFactory-Implementation-Class>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rat-maven-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>src/main/resources/META-INF/org.apache.openejb.cli/validate.examples</exclude>
+            <exclude>src/main/resources/META-INF/org.apache.openejb.cli/validate.help</exclude>
+            <exclude>src/main/resources/META-INF/org.apache.openejb.resource.jdbc.DataSourcePlugin/*</exclude>
+            <exclude>src/main/resources/META-INF/services/org/apache/activemq/broker/openejb</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>mbean-annotation-api</artifactId>
+      <version>4.0.0-beta-2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>javaee-api</artifactId>
+    </dependency>
+    <!-- required for endorsed dir support -->
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-annotation_1.1_spec</artifactId>
+      <version>1.0.1</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-loader</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-javaagent</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-jee</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-itests-app</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-itests-beans</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-itests-interceptor-beans</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>openejb-itests-client</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
+    </dependency>
+
+    <!-- ActiveMQ -->
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-ra</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-core</artifactId>
+      <exclusions>
+        <exclusion>
+          <artifactId>jasypt</artifactId>
+          <groupId>org.jasypt</groupId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-context</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.osgi</groupId>
+          <artifactId>org.osgi.core</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.components</groupId>
+      <artifactId>geronimo-connector</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.components</groupId>
+      <artifactId>geronimo-transaction</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.objectweb.howl</groupId>
+      <artifactId>howl</artifactId>
+    </dependency>
+    <!-- JavaMail -->
+    <dependency>
+      <groupId>org.apache.geronimo.javamail</groupId>
+      <artifactId>geronimo-javamail_1.4_mail</artifactId>
+    </dependency>
+    <!-- End: JavaMail -->
+    <dependency>
+      <groupId>org.apache.xbean</groupId>
+      <artifactId>xbean-asm-shaded</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.xbean</groupId>
+      <artifactId>xbean-finder-shaded</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.xbean</groupId>
+      <artifactId>xbean-reflect</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.xbean</groupId>
+      <artifactId>xbean-naming</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.xbean</groupId>
+      <artifactId>xbean-bundleutils</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-dbcp</groupId>
+      <artifactId>commons-dbcp</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-pool</groupId>
+      <artifactId>commons-pool</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.swizzle</groupId>
+      <artifactId>swizzle-stream</artifactId>
+    </dependency>
+    <!-- added temporarily till we get a fixed version of the dep report plugin -->
+    <!--<dependency>-->
+      <!--<groupId>commons-logging</groupId>-->
+      <!--<artifactId>commons-logging</artifactId>-->
+    <!--</dependency>-->
+    <!-- webservices  -->
+    <dependency>
+      <groupId>wsdl4j</groupId>
+      <artifactId>wsdl4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.quartz-scheduler</groupId>
+      <artifactId>quartz</artifactId>
+    </dependency>
+    <!-- Dependency of Quartz -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+    </dependency>
+    <!-- Dependency of Quartz -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>xmlunit</groupId>
+      <artifactId>xmlunit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>xml-apis</groupId>
+      <artifactId>xml-apis</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.swizzle</groupId>
+      <artifactId>swizzle-confluence</artifactId>
+      <version>1.1</version>
+      <type>jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openwebbeans</groupId>
+      <artifactId>openwebbeans-impl</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openwebbeans</groupId>
+      <artifactId>openwebbeans-spi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openwebbeans</groupId>
+      <artifactId>openwebbeans-ejb</artifactId>
+      <exclusions>
+      	<exclusion>
+      		<groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-ejb_3.1_spec</artifactId>
+      	</exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openwebbeans</groupId>
+      <artifactId>openwebbeans-ee</artifactId>
+    </dependency>
+    <dependency>
+      <artifactId>openwebbeans-ee-common</artifactId>
+      <groupId>org.apache.openwebbeans</groupId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openwebbeans</groupId>
+      <artifactId>openwebbeans-web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openjpa</groupId>
+      <artifactId>openjpa</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.bval</groupId>
+      <artifactId>bval-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.bval</groupId>
+      <artifactId>bval-jsr303</artifactId>
+    </dependency>
+  </dependencies>
+  <profiles>
+    <profile>
+      <id>openejb.debug</id>
+      <build>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?rev=1206854&r1=1206853&r2=1206854&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
(original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
Sun Nov 27 21:51:07 2011
@@ -42,6 +42,7 @@ import org.apache.openejb.cdi.CdiScanner
 import org.apache.openejb.cdi.CustomELAdapter;
 import org.apache.openejb.cdi.ManagedSecurityService;
 import org.apache.openejb.cdi.OpenEJBTransactionService;
+import org.apache.openejb.cdi.OptimizedLoaderService;
 import org.apache.openejb.core.ConnectorReference;
 import org.apache.openejb.core.CoreContainerSystem;
 import org.apache.openejb.core.CoreUserTransaction;
@@ -82,6 +83,7 @@ import org.apache.openejb.util.proxy.Pro
 import org.apache.openejb.util.proxy.ProxyManager;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.spi.ContextsService;
+import org.apache.webbeans.spi.LoaderService;
 import org.apache.webbeans.spi.ResourceInjectionService;
 import org.apache.webbeans.spi.ScannerService;
 import org.apache.webbeans.spi.TransactionService;
@@ -882,6 +884,7 @@ public class Assembler extends Assembler
             services.put(ResourceInjectionService.class, new CdiResourceInjectionService());
             services.put(ScannerService.class, new CdiScanner());
             services.put(ELAdaptor.class, new CustomELAdapter(appContext));
+            services.put(LoaderService.class, new OptimizedLoaderService());
             final Properties properties = new Properties();
             properties.setProperty(org.apache.webbeans.spi.SecurityService.class.getName(),
ManagedSecurityService.class.getName());
             webBeansContext = new WebBeansContext(services, properties);

Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java?rev=1206854&r1=1206853&r2=1206854&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java
(original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java
Sun Nov 27 21:51:07 2011
@@ -30,6 +30,7 @@ import org.apache.webbeans.config.WebBea
 import org.apache.webbeans.spi.ContainerLifecycle;
 import org.apache.webbeans.spi.ContextsService;
 import org.apache.webbeans.spi.ConversationService;
+import org.apache.webbeans.spi.LoaderService;
 import org.apache.webbeans.spi.ResourceInjectionService;
 import org.apache.webbeans.spi.ScannerService;
 import org.apache.webbeans.spi.SecurityService;
@@ -82,6 +83,7 @@ public class ThreadSingletonServiceImpl 
         services.put(ContextsService.class, new CdiAppContextsService(true));
         services.put(ResourceInjectionService.class, new CdiResourceInjectionService());
         services.put(ScannerService.class, new CdiScanner());
+        services.put(LoaderService.class, new OptimizedLoaderService());
 
         optional(services, ConversationService.class, "org.apache.webbeans.jsf.DefaultConversationService");
 

Added: openejb/trunk/openejb/container/openejb-core/src/main/resources/juli.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/resources/juli.properties?rev=1206854&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/resources/juli.properties (added)
+++ openejb/trunk/openejb/container/openejb-core/src/main/resources/juli.properties Sun Nov
27 21:51:07 2011
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+
+# TODO: using files
+.level = INFO
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = INFO
+java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
+

Modified: openejb/trunk/openejb/container/openejb-osgi/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-osgi/pom.xml?rev=1206854&r1=1206853&r2=1206854&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-osgi/pom.xml (original)
+++ openejb/trunk/openejb/container/openejb-osgi/pom.xml Sun Nov 27 21:51:07 2011
@@ -66,14 +66,44 @@
             <Import-Package>
                             javax.transaction;version="[1.1,1.2)",
                             javax.transaction.xa;version="[1.1,1.2)",
+                            !org.apache.openejb.core.osgi.impl,
                             org.apache.openejb*;version="[3.1,4.2)",
+                            org.apache.openejb.core;version="[3.1,4.2)";resolution:=optional,
+                            org.apache.openejb.core.stateless;version="[3.1,4.2)";resolution:=optional,
+                            org.apache.openejb.core.stateful;version="[3.1,4.2)";resolution:=optional,
+                            org.apache.openejb.core.mdb;version="[3.1,4.2)";resolution:=optional,
+                            org.apache.openejb.core.managed;version="[3.1,4.2)";resolution:=optional,
                             org.apache.openejb.resource;version="[3.1,4.2)",
+                            org.apache.openejb.resource.jdbc;version="[3.1,4.2)";resolution:=optional,
+                            org.apache.openejb.resource.activemq;version="[3.1,4.2)";resolution:=optional,
+                            org.apache.openejb.resource.quartz;version="[3.1,4.2)";resolution:=optional,
                             org.apache.openejb.core.security;version="[3.1,4.2)",
+                            org.apache.openejb.cdi;version="[3.1,4.2)",
                             javax.naming,
-                            javax.jms,
                             org.apache.commons.logging,
                             org.apache.activemq.ra,
                             org.osgi.framework;version="[1.4,1.6)",
+                            org.apache.commons.dbcp.managed;resolution:=optional,
+                            oracle.toplink.*;resolution:=optional,
+                            org.apache.openjpa.*;resolution:=optional,
+                            org.eclipse.persistence.*;resolution:=optional,
+                            org.hibernate.*;resolution:=optional,
+                            org.quartz.*;resolution:=optional,
+                            org.hsqldb.jdbc;resolution:=optional,
+                            javax.enterprise.deploy;resolution:=optional,
+                            javax.jms;resolution:=optional,
+                            javax.mail;resolution:=optional,
+                            javax.xml.registry;resolution:=optional,
+                            javax.xml.rpc;resolution:=optional,
+                            org.apache.activemq;resolution:=optional,
+                            org.apache.kahadb;resolution:=optional,
+                            org.apache.commons.dbcp;resolution:=optional,
+                            org.apache.xerces;resolution:=optional,
+                            org.apache.xml.resolver;resolution:=optional,
+                            org.junit;resolution:=optional,
+                            javax.annotation;version=1.1,
+                            javax.ejb;version=3.1,
+                            javax.xml.ws,
                             *
             </Import-Package>
             <Include-Resource>${pom.basedir}/src/main/resources</Include-Resource>

Modified: openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java?rev=1206854&r1=1206853&r2=1206854&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
(original)
+++ openejb/trunk/openejb/container/openejb-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
Sun Nov 27 21:51:07 2011
@@ -32,6 +32,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.URL;
 import java.util.Enumeration;
 import java.util.Properties;
@@ -54,44 +55,50 @@ public class Deployer implements BundleL
     }
 
     private void deploy(Bundle bundle) {
+        final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(new OSGIClassLoader(bundle));
+
         LOGGER.info(String.format("[Deployer] Bundle %s has been started", bundle.getSymbolicName()));
 
         LOGGER.info(String.format("[Deployer] Checking whether it's an EJB module"));
-        Enumeration<URL> e = bundle.findEntries("META-INF", "ejb-jar.xml", false);
-        if (e != null && e.hasMoreElements()) {
-            URL ejbJarUrl = e.nextElement();
+        try {
+            Enumeration<URL> e = bundle.findEntries("META-INF", "ejb-jar.xml", false);
+            if (e != null && e.hasMoreElements()) {
+                URL ejbJarUrl = e.nextElement();
 
-            LOGGER.info("[Deployer] It's an EJB module: " + ejbJarUrl);
+                LOGGER.info("[Deployer] It's an EJB module: " + ejbJarUrl);
 
-            LOGGER.info("[Deployer] Deploying onto OpenEJB");
+                LOGGER.info("[Deployer] Deploying onto OpenEJB");
 
-            String location = bundle.getLocation();
-            LOGGER.info("[Deployer] bundle location: " + location);
-            try {
-                File file = new File(new URL(location).getFile());
+                String location = bundle.getLocation();
+                LOGGER.info("[Deployer] bundle location: " + location);
                 try {
-                    DeploymentLoader deploymentLoader = new DeploymentLoader();
-                    AppModule appModule = deploymentLoader.load(file);
-
-                    ConfigurationFactory configurationFactory = new ConfigurationFactory();
-                    AppInfo appInfo = configurationFactory.configureApplication(appModule);
-
-                    Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
-                    LOGGER.debug("Assembler : " + assembler);
-                    LOGGER.debug("AppInfo id: " + appInfo.appId);
-                    assembler.createApplication(appInfo);
-
-                    LOGGER.info("[Deployer] Application deployed: " + appInfo.path);
-
-                    registerService(bundle, appInfo);
-
-                } catch (Exception ex) {
-                    ex.printStackTrace();
+                    File file = new File(new URL(location).getFile());
+                    try {
+                        DeploymentLoader deploymentLoader = new DeploymentLoader();
+                        AppModule appModule = deploymentLoader.load(file);
+
+                        ConfigurationFactory configurationFactory = new ConfigurationFactory();
+                        AppInfo appInfo = configurationFactory.configureApplication(appModule);
+
+                        Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
+                        LOGGER.debug("Assembler : " + assembler);
+                        LOGGER.debug("AppInfo id: " + appInfo.appId);
+                        assembler.createApplication(appInfo);
+
+                        LOGGER.info("[Deployer] Application deployed: " + appInfo.path);
+
+                        registerService(bundle, appInfo);
+
+                    } catch (Exception ex) {
+                        LOGGER.error("can't deploy " + ejbJarUrl.toExternalForm(), ex);
+                    }
+                } catch (Exception ex1) {
+                    LOGGER.error("can't deploy " + ejbJarUrl.toExternalForm(), ex1);
                 }
-            } catch (Exception ex1) {
-                ex1.printStackTrace();
             }
-
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldCl);
         }
     }
 
@@ -119,14 +126,59 @@ public class Deployer implements BundleL
             for (EnterpriseBeanInfo ejbInfo : ejbJarInfo.enterpriseBeans) {
                 try {
                     context.registerService(ejbInfo.businessRemote.toArray(new String[ejbInfo.businessRemote.size()]),
bundle.loadClass(
-                            ejbInfo.ejbClass).newInstance(), new Properties());
+                        ejbInfo.ejbClass).newInstance(), new Properties());
                     LOGGER.info(String.format(
-                            "[Deployer] Service object %s registered under the class names:
%s", ejbInfo.ejbClass,
-                            ejbInfo.businessRemote));
+                        "[Deployer] Service object %s registered under the class names: %s",
ejbInfo.ejbClass,
+                        ejbInfo.businessRemote));
                 } catch (Exception e) {
                     e.printStackTrace();
                 }
             }
         }
     }
+
+    private class OSGIClassLoader extends ClassLoader {
+        private final Bundle backingBundle;
+
+        public OSGIClassLoader(Bundle bundle) {
+            super(null);
+            backingBundle = bundle;
+        }
+
+        protected Class findClass(String name) throws ClassNotFoundException {
+            try {
+                return this.backingBundle.loadClass(name);
+            } catch (ClassNotFoundException cnfe) {
+                throw new ClassNotFoundException(name + " not found from bundle [" + backingBundle.getSymbolicName()
+ "]", cnfe);
+            } catch (NoClassDefFoundError ncdfe) {
+                NoClassDefFoundError e = new NoClassDefFoundError(name + " not found from
bundle [" + backingBundle + "]");
+                e.initCause(ncdfe);
+                throw e;
+            }
+        }
+
+        protected URL findResource(String name) {
+            return backingBundle.getResource(name);
+        }
+
+        protected Enumeration findResources(String name) throws IOException {
+            return backingBundle.getResources(name);
+        }
+
+        public URL getResource(String name) {
+            return findResource(name);
+        }
+
+        protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException
{
+            Class clazz = findClass(name);
+            if (resolve) {
+                resolveClass(clazz);
+            }
+            return clazz;
+        }
+
+        public String toString() {
+            return "OSGIClassLoader for [" + backingBundle + "]";
+        }
+    }
 }

Added: openejb/trunk/openejb/container/openejb-osgi/src/main/resources/embedded.juli.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-osgi/src/main/resources/embedded.juli.properties?rev=1206854&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-osgi/src/main/resources/embedded.juli.properties
(added)
+++ openejb/trunk/openejb/container/openejb-osgi/src/main/resources/embedded.juli.properties
Sun Nov 27 21:51:07 2011
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+.level = INFO
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = INFO
+java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
+

Added: openejb/trunk/openejb/container/openejb-osgi/src/main/resources/juli.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-osgi/src/main/resources/juli.properties?rev=1206854&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-osgi/src/main/resources/juli.properties (added)
+++ openejb/trunk/openejb/container/openejb-osgi/src/main/resources/juli.properties Sun Nov
27 21:51:07 2011
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+
+# TODO: using files
+.level = INFO
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = INFO
+java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
+



Mime
View raw message