tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1405188 - in /openejb/trunk/openejb: container/openejb-core/src/main/java/org/apache/openejb/cdi/ osgi/apache-karafee/ osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/
Date Fri, 02 Nov 2012 22:25:00 GMT
Author: rmannibucau
Date: Fri Nov  2 22:24:59 2012
New Revision: 1405188

URL: http://svn.apache.org/viewvc?rev=1405188&view=rev
Log:
upgrading pax-web version in karafee + simplifying classloders in karafee + updating karafee
cdi extension tracking osgi services to using objectclass property instead of using reflection

Modified:
    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java
    openejb/trunk/openejb/osgi/apache-karafee/pom.xml
    openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
    openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/RegisterOSGIServicesExtension.java

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=1405188&r1=1405187&r2=1405188&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
Fri Nov  2 22:24:59 2012
@@ -18,7 +18,6 @@
 
 package org.apache.openejb.cdi;
 
-import java.util.concurrent.ConcurrentHashMap;
 import org.apache.openejb.AppContext;
 import org.apache.openejb.OpenEJBRuntimeException;
 import org.apache.openejb.assembler.classic.AppInfo;
@@ -45,6 +44,7 @@ import org.apache.webbeans.spi.ScannerSe
 import org.apache.webbeans.spi.SecurityService;
 import org.apache.webbeans.spi.TransactionService;
 import org.apache.webbeans.spi.adaptor.ELAdaptor;
+import org.apache.webbeans.web.intercept.RequestScopedBeanInterceptorHandler;
 
 import java.util.Collections;
 import java.util.Comparator;
@@ -52,7 +52,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import org.apache.webbeans.web.intercept.RequestScopedBeanInterceptorHandler;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * @version $Rev:$ $Date:$

Modified: openejb/trunk/openejb/osgi/apache-karafee/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/osgi/apache-karafee/pom.xml?rev=1405188&r1=1405187&r2=1405188&view=diff
==============================================================================
--- openejb/trunk/openejb/osgi/apache-karafee/pom.xml (original)
+++ openejb/trunk/openejb/osgi/apache-karafee/pom.xml Fri Nov  2 22:24:59 2012
@@ -99,33 +99,6 @@
         </executions>
       </plugin>
       <plugin>
-        <groupId>org.apache.karaf.tooling</groupId>
-        <artifactId>features-maven-plugin</artifactId>
-        <version>${karaf.version}</version>
-        <executions>
-          <execution>
-            <id>add-features-to-repo</id>
-            <phase>generate-resources</phase>
-            <goals>
-              <goal>add-features-to-repo</goal>
-            </goals>
-            <configuration>
-              <descriptors>
-                <descriptor>mvn:org.apache.openejb/openejb-feature/${openejb.version}/xml/features</descriptor>
-                <descriptor>mvn:org.apache.activemq/activemq-karaf/${org.apache.activemq.version}/xml/features</descriptor>
-              </descriptors>
-              <features>
-                <feature>openejb-server</feature>
-                <feature>war</feature>
-                <feature>transaction</feature>
-                <feature>webconsole</feature>
-              </features>
-              <repository>target/repo</repository>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
         <executions>
@@ -169,6 +142,54 @@
           </execution>
         </executions>
       </plugin>
+      <plugin> <!-- quick way to update pax-web from karaf which is a buggy version
(1.1.3), this should be removed when karaf will be upgraded -->
+        <groupId>org.codehaus.gmaven</groupId>
+        <artifactId>gmaven-plugin</artifactId>
+        <version>1.3</version>
+        <executions>
+          <execution>
+            <id>patch-pax-web</id>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>execute</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <source>
+            def karafVersion = project.properties['karaf.version']
+            def file = new File(project.basedir, "target/dependencies/apache-karaf-${karafVersion}/system/org/apache/karaf/assemblies/features/standard/${karafVersion}/standard-${karafVersion}-features.xml")
+            file.write(file.text.replace('1.1.3', '1.1.5'))
+          </source>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.karaf.tooling</groupId>
+        <artifactId>features-maven-plugin</artifactId>
+        <version>${karaf.version}</version>
+        <executions>
+          <execution>
+            <id>add-features-to-repo</id>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>add-features-to-repo</goal>
+            </goals>
+            <configuration>
+              <descriptors>
+                <descriptor>mvn:org.apache.openejb/openejb-feature/${openejb.version}/xml/features</descriptor>
+                <descriptor>mvn:org.apache.activemq/activemq-karaf/${org.apache.activemq.version}/xml/features</descriptor>
+              </descriptors>
+              <features>
+                <feature>openejb-server</feature>
+                <feature>war</feature>
+                <feature>transaction</feature>
+                <feature>webconsole</feature>
+              </features>
+              <repository>target/repo</repository>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-assembly-plugin</artifactId>

Modified: openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java?rev=1405188&r1=1405187&r2=1405188&view=diff
==============================================================================
--- openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
(original)
+++ openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/Deployer.java
Fri Nov  2 22:24:59 2012
@@ -119,11 +119,6 @@ public class Deployer implements BundleL
             return;
         }
 
-        final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
-        final ClassLoader osgiCl = new OSGIClassLoader(bundle, OpenEJBBundleContextHolder.get().getBundle());
-
-        Thread.currentThread().setContextClassLoader(osgiCl);
-
         final Set<Bundle> wiredBundles = BundleUtils.getWiredBundles(bundle);
         final Filter filter = new OSGiPrefixFilter(NewLoaderLogic.getExclusions());
         for (Bundle b : wiredBundles) {
@@ -153,6 +148,11 @@ public class Deployer implements BundleL
             }
         }
 
+        final ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+        final ClassLoader osgiCl = new OSGIClassLoader(bundle, OpenEJBBundleContextHolder.get().getBundle());
+
+        Thread.currentThread().setContextClassLoader(osgiCl);
+
         try {
             try {
                 try {
@@ -164,7 +164,7 @@ public class Deployer implements BundleL
                     }
 
                     LOGGER.info("looking bundle {} in {}", bundle.getBundleId(), bundleDump);
-                    final AppModule appModule = new OSGiDeploymentLoader(bundle).load(bundleDump);
+                    final AppModule appModule = new DeploymentLoader().load(bundleDump);
                     LOGGER.info("deploying bundle #" + bundle.getBundleId() + " as an EJBModule");
 
                     final ConfigurationFactory configurationFactory = new ConfigurationFactory();
@@ -422,25 +422,6 @@ public class Deployer implements BundleL
         }
 
         @Override
-        protected Class findClass(final String name) throws ClassNotFoundException {
-            try {
-                return fallbackBundle.loadClass(name);
-            } catch (Exception ignored) {
-                // no-op
-            }
-
-            try {
-                return this.backingBundle.loadClass(name);
-            } catch (ClassNotFoundException cnfe) {
-                throw new ClassNotFoundException(name + " not found from bundle [" + backingBundle.getSymbolicName()
+ "]", cnfe);
-            } catch (NoClassDefFoundError ncdfe) {
-                final NoClassDefFoundError e = new NoClassDefFoundError(name + " not found
from bundle [" + backingBundle + "]");
-                e.initCause(ncdfe);
-                throw e;
-            }
-        }
-
-        @Override
         protected URL findResource(final String name) {
             URL url = fallbackBundle.getResource(name);
             if (url != null) {
@@ -486,12 +467,32 @@ public class Deployer implements BundleL
         }
 
         @Override
-        protected Class loadClass(final String name, final boolean resolve) throws ClassNotFoundException
{
-            final Class clazz = findClass(name);
-            if (resolve) {
-                resolveClass(clazz);
+        protected Class<?> findClass(final String name) throws ClassNotFoundException
{
+            try {
+                return fallbackBundle.loadClass(name);
+            } catch (Exception ignored) {
+                // no-op
+            }
+
+            try {
+                return this.backingBundle.loadClass(name);
+            } catch (ClassNotFoundException cnfe) {
+                throw new ClassNotFoundException(name + " not found from bundle [" + backingBundle.getSymbolicName()
+ "]", cnfe);
+            } catch (NoClassDefFoundError ncdfe) {
+                final NoClassDefFoundError e = new NoClassDefFoundError(name + " not found
from bundle [" + backingBundle + "]");
+                e.initCause(ncdfe);
+                throw e;
             }
-            return clazz;
+        }
+
+        @Override
+        public Class<?> loadClass(final String name) throws ClassNotFoundException
{
+            return findClass(name);
+        }
+
+        @Override
+        protected Class<?> loadClass(final String name, final boolean resolve) throws
ClassNotFoundException {
+            return findClass(name);
         }
 
         public String toString() {
@@ -507,7 +508,7 @@ public class Deployer implements BundleL
         }
 
         @Override
-        protected ClassLoader getOpenEJBClassLoader() {
+        protected ClassLoader getOpenEJBClassLoader() { // TODO: valid it is still mandatory
             return new OSGIClassLoader(bundle, OpenEJBBundleContextHolder.get().getBundle());
         }
     }

Modified: openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/RegisterOSGIServicesExtension.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/RegisterOSGIServicesExtension.java?rev=1405188&r1=1405187&r2=1405188&view=diff
==============================================================================
--- openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/RegisterOSGIServicesExtension.java
(original)
+++ openejb/trunk/openejb/osgi/openejb-core-osgi/src/main/java/org/apache/openejb/core/osgi/impl/RegisterOSGIServicesExtension.java
Fri Nov  2 22:24:59 2012
@@ -50,19 +50,22 @@ public class RegisterOSGIServicesExtensi
                 final ServiceReference[] services = b.getRegisteredServices();
                 if (services != null) {
                     for (ServiceReference service  : services) {
-                        try {
-                            final Class<?> clazz = serviceClass(service);
-                            if (clazz == null) {
-                                continue;
-                            }
+                        String[] clazz = (String[]) service.getProperty("objectClass");
+                        if (clazz == null) {
+                            continue;
+                        }
 
-                            current.loadClass(clazz.getName());
-                            abd.addBean(new OSGiServiceBean<Object>(service));
-                            LOGGER.debug("added service {} as a CDI Application scoped bean",
clazz.getName());
-                        } catch (NoClassDefFoundError ignored) {
-                            // no-op
-                        } catch (ClassNotFoundException e) {
-                            // can't load the class so no need to register the service
+                        for (String name : clazz) {
+                            try {
+                                current.loadClass(name);
+                                abd.addBean(new OSGiServiceBean<Object>(service));
+                                LOGGER.debug("added service {} as a CDI Application scoped
bean", name);
+                                break;
+                            } catch (NoClassDefFoundError ignored) {
+                                // no-op
+                            } catch (ClassNotFoundException e) {
+                                // can't load the class so no need to register the service
+                            }
                         }
                     }
                 }



Mime
View raw message