geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1022717 - in /geronimo/server/trunk/plugins/openwebbeans: geronimo-openwebbeans-builder/ geronimo-openwebbeans-builder/src/main/java/org/apache/geronimo/openwebbeans/deployment/ geronimo-openwebbeans/src/main/java/org/apache/geronimo/openw...
Date Thu, 14 Oct 2010 21:18:50 GMT
Author: djencks
Date: Thu Oct 14 21:18:49 2010
New Revision: 1022717

URL: http://svn.apache.org/viewvc?rev=1022717&view=rev
Log:
GERONIMO-5050 commit a slightly modified version of jarek's patch which helps get some of
the jcdi tck passing

Added:
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoWebBeansPlugin.java
  (with props)
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OsgiMetaDataScannerService.java
  (with props)
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/resources/
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/resources/META-INF/
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/resources/META-INF/services/
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
Modified:
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/pom.xml
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/src/main/java/org/apache/geronimo/openwebbeans/deployment/OpenWebBeansModuleBuilderExtension.java
    geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OpenWebBeansGBean.java
    geronimo/server/trunk/plugins/openwebbeans/openwebbeans-deployer/src/main/plan/plan.xml
    geronimo/server/trunk/plugins/openwebbeans/openwebbeans/src/main/history/dependencies.xml
    geronimo/server/trunk/plugins/openwebbeans/openwebbeans/src/main/plan/plan.xml

Modified: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/pom.xml?rev=1022717&r1=1022716&r2=1022717&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/pom.xml (original)
+++ geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/pom.xml Thu Oct
14 21:18:49 2010
@@ -39,6 +39,12 @@
             <artifactId>geronimo-j2ee-builder</artifactId>
             <version>${project.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-web</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         
         <dependency>
             <groupId>org.apache.geronimo.modules</groupId>

Modified: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/src/main/java/org/apache/geronimo/openwebbeans/deployment/OpenWebBeansModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/src/main/java/org/apache/geronimo/openwebbeans/deployment/OpenWebBeansModuleBuilderExtension.java?rev=1022717&r1=1022716&r2=1022717&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/src/main/java/org/apache/geronimo/openwebbeans/deployment/OpenWebBeansModuleBuilderExtension.java
(original)
+++ geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans-builder/src/main/java/org/apache/geronimo/openwebbeans/deployment/OpenWebBeansModuleBuilderExtension.java
Thu Oct 14 21:18:49 2010
@@ -40,9 +40,12 @@ import org.apache.geronimo.j2ee.deployme
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
 import org.apache.geronimo.j2ee.deployment.WebModule;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.openwebbeans.OpenWebBeansGBean;
+import org.apache.geronimo.web.info.WebAppInfo;
 import org.apache.openejb.jee.WebApp;
 import org.apache.webbeans.servlet.WebBeansConfigurationListener;
 import org.apache.xbean.finder.ClassFinder;
@@ -108,24 +111,20 @@ public class OpenWebBeansModuleBuilderEx
             return;
         }
         
-        // Don't do anything for now
-        if (true) {
+        WebModule webModule = (WebModule) module;
+                
+        if (!hasBeansXml(bundle)) {
             return;
         }
         
-        WebModule webModule = (WebModule) module;
-        WebApp webApp = (WebApp) webModule.getSpecDD();
-
         EARContext moduleContext = module.getEarContext();
         Map sharedContext = module.getSharedContext();
-
-        // add the ServletContextListener to the web app context
+        //add the ServletContextListener to the web app context
         GBeanData webAppData = (GBeanData) sharedContext.get(WebModule.WEB_APP_DATA);
-
-        // add web beans listener
-        Object value = webAppData.getAttribute("listenerClassNames");
-        if (value instanceof Collection && !((Collection) value).contains(CONTEXT_LISTENER_NAME))
{
-            ((Collection<String>) value).add(CONTEXT_LISTENER_NAME);
+        // add myfaces listener
+        WebAppInfo webAppInfo = (WebAppInfo) webAppData.getAttribute("webAppInfo");
+        if (webAppInfo != null && !webAppInfo.listeners.contains(CONTEXT_LISTENER_NAME))
{
+            webAppInfo.listeners.add(CONTEXT_LISTENER_NAME);
         }
         AbstractName moduleName = moduleContext.getModuleName();
         Map<EARContext.Key, Object> buildingContext = new HashMap<EARContext.Key,
Object>();
@@ -134,46 +133,39 @@ public class OpenWebBeansModuleBuilderEx
         //use the same holder object as the web app.
         Holder holder = NamingBuilder.INJECTION_KEY.get(sharedContext);
         buildingContext.put(NamingBuilder.INJECTION_KEY, holder);
-        
+
+        WebApp webApp = webModule.getSpecDD();
         XmlObject jettyWebApp = webModule.getVendorDD();
 
         ClassFinder classFinder = createOpenWebBeansClassFinder(webApp, webModule);
         webModule.setClassFinder(classFinder);
 
-        namingBuilders.buildNaming(webApp, jettyWebApp, webModule, buildingContext);
+        namingBuilders.buildNaming(webApp, jettyWebApp, webModule, buildingContext);    
+        
+        AbstractName webBeansGBeanName = moduleContext.getNaming().createChildName(moduleName,
"webbeans-lifecycle", "webbeans");
+        GBeanData providerData = new GBeanData(webBeansGBeanName, OpenWebBeansGBean.class);
+        try {
+            moduleContext.addGBean(providerData);
+        } catch (GBeanAlreadyExistsException e) {
+            throw new DeploymentException("Duplicate webbean config gbean in web module",
e);
+        }
+
+        //make the web app start second after the webbeans machinery
+        webAppData.addDependency(webBeansGBeanName);
     }
 
+    private boolean hasBeansXml(Bundle bundle) {
+        return bundle.getEntry("WEB-INF/beans.xml") != null || bundle.getResource("META-INF/beans.xml")
!= null;                
+    }
+   
     protected ClassFinder createOpenWebBeansClassFinder(WebApp webApp, WebModule webModule)
-            throws DeploymentException {
+        throws DeploymentException {
         List<Class> classes = getManagedClasses(webApp, webModule);
         return new ClassFinder(classes);
-    }
-
-    /**
-     * getManagedClasses()
-     * <p/>
-     * <p>
-     * Locations to search for the webbean configuration file(s):
-     * <ol>
-     * <li>META-INF/beans.xml
-     * <li>WEB-INF/beans.xml
-     * </ol>
-     * <p/>
-     * <p>
-     * <strong>Notes:</strong>
-     * <ul>
-     * </ul>
-     * 
-     * @param webApp
-     *            spec DD for module
-     * @param webModule
-     *            module being deployed
-     * @return list of all bean classes from libs that contains beans.xml.
-     * @throws org.apache.geronimo.common.DeploymentException
-     *           
-     */
+    }    
+ 
     private List<Class> getManagedClasses(WebApp webApp, WebModule webModule) throws
DeploymentException {     
         return Collections.EMPTY_LIST;
-    }    
-
+    }  
+    
 }

Added: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoWebBeansPlugin.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoWebBeansPlugin.java?rev=1022717&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoWebBeansPlugin.java
(added)
+++ geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoWebBeansPlugin.java
Thu Oct 14 21:18:49 2010
@@ -0,0 +1,101 @@
+/*
+ * 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.openwebbeans;
+
+import java.security.Principal;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+import org.apache.webbeans.spi.SecurityService;
+import org.apache.webbeans.spi.TransactionService;
+import org.apache.webbeans.spi.plugins.AbstractOwbPlugin;
+import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
+import org.apache.webbeans.spi.plugins.OpenWebBeansJavaEEPlugin;
+
+public class GeronimoWebBeansPlugin 
+    extends AbstractOwbPlugin 
+    implements OpenWebBeansJavaEEPlugin, OpenWebBeansEjbPlugin, TransactionService, SecurityService
{
+
+    public <T> Bean<T> defineSessionBean(Class<T> clazz,
+                                         ProcessAnnotatedType<T> processAnnotateTypeEvent)
{
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Object getSessionBeanProxy(Bean<?> bean,
+                                      Class<?> iface,
+                                      CreationalContext<?> creationalContext) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean isSessionBean(Class<?> clazz) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean isSingletonBean(Class<?> clazz) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean isStatefulBean(Class<?> clazz) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean isStatelessBean(Class<?> clazz) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public Transaction getTransaction() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public TransactionManager getTransactionManager() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public UserTransaction getUserTransaction() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void registerTransactionSynchronization(TransactionPhase phase,
+                                                   ObserverMethod<? super Object> observer,
+                                                   Object event) throws Exception {
+        // TODO Auto-generated method stub        
+    }
+
+    public Principal getCurrentPrincipal() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoWebBeansPlugin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoWebBeansPlugin.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/GeronimoWebBeansPlugin.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OpenWebBeansGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OpenWebBeansGBean.java?rev=1022717&r1=1022716&r2=1022717&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OpenWebBeansGBean.java
(original)
+++ geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OpenWebBeansGBean.java
Thu Oct 14 21:18:49 2010
@@ -17,35 +17,66 @@
  * under the License.
  */
 
-
 package org.apache.geronimo.openwebbeans;
 
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
-
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.webbeans.config.OpenWebBeansConfiguration;
+import org.apache.webbeans.spi.JNDIService;
+import org.apache.webbeans.web.context.WebContextsService;
+import org.apache.webbeans.web.lifecycle.WebContainerLifecycle;
+import org.osgi.framework.BundleContext;
 
 /**
- * For help on using gbean annotations see:
- * http://cwiki.apache.org/GMOxDOC22/gbean-annotations.html
  *  
  * @version $Rev: 698441 $ $Date: 2008-09-24 00:10:08 -0700 (Wed, 24 Sep 2008) $
  */
 @GBean
 public class OpenWebBeansGBean implements GBeanLifecycle {
     
-
-    public OpenWebBeansGBean() {
+    public OpenWebBeansGBean(@ParamSpecial(type = SpecialAttributeType.bundleContext) final
BundleContext bundleContext,
+                             @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader
classLoader) {
+        setConfiguration(OpenWebBeansConfiguration.getInstance());
     }
 
+    private void setConfiguration(OpenWebBeansConfiguration configuration) {
+        configuration.setProperty(OpenWebBeansConfiguration.APPLICATION_IS_JSP, "true");
+        
+        configuration.setProperty(OpenWebBeansConfiguration.CONTAINER_LIFECYCLE, WebContainerLifecycle.class.getName());
+        configuration.setProperty(OpenWebBeansConfiguration.JNDI_SERVICE, NoopJndiService.class.getName());
+        configuration.setProperty(OpenWebBeansConfiguration.SCANNER_SERVICE, OsgiMetaDataScannerService.class.getName());
+        configuration.setProperty(OpenWebBeansConfiguration.CONTEXTS_SERVICE, WebContextsService.class.getName());
+    }
 
     public void doStart() {
+        System.out.println("Start OpenWebBeansGBean");
     }
 
     public void doStop() {
+        System.out.println("Stop OpenWebBeansGBean");
     }
 
     public void doFail() {
         doStop();
     }
+    
+    public static class NoopJndiService implements JNDIService {
+
+        public void bind(String name, Object object) {
+            System.out.println("Bind");
+        }
+
+        public <T> T lookup(String name, Class<? extends T> expectedClass) {
+            System.out.println("Lookup");
+            return null;
+        }
+
+        public void unbind(String name) {
+            System.out.println("Unbind");
+        }
+        
+    }
 
 }

Added: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OsgiMetaDataScannerService.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OsgiMetaDataScannerService.java?rev=1022717&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OsgiMetaDataScannerService.java
(added)
+++ geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OsgiMetaDataScannerService.java
Thu Oct 14 21:18:49 2010
@@ -0,0 +1,221 @@
+/*
+ * 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.openwebbeans;
+
+import org.apache.webbeans.exception.WebBeansDeploymentException;
+import org.apache.webbeans.logger.WebBeansLogger;
+import org.apache.webbeans.spi.ScannerService;
+
+import org.apache.xbean.finder.BundleAssignableClassFinder;
+import org.apache.xbean.osgi.bundle.util.BundleClassFinder;
+import org.apache.xbean.osgi.bundle.util.BundleResourceFinder;
+import org.apache.xbean.osgi.bundle.util.BundleUtils;
+import org.apache.xbean.osgi.bundle.util.ClassDiscoveryFilter;
+import org.apache.xbean.osgi.bundle.util.DiscoveryRange;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+import javax.servlet.ServletContext;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+
+/**
+ * In an OSGi environment, resources will not be delivered in
+ * jars or file URLs, but as 'bundle://'.
+ * This {@link org.apache.webbeans.spi.ScannerService} parses for all classes
+ * in such a bundle.
+ */
+public class OsgiMetaDataScannerService implements ScannerService
+{
+    private WebBeansLogger logger = WebBeansLogger.getLogger(OsgiMetaDataScannerService.class);
+
+    private boolean configured = false;
+
+    protected ServletContext servletContext = null;
+    private static final String META_INF_BEANS_XML = "META-INF/beans.xml";
+    private static final String WEB_INF_BEANS_XML = "WEB-INF/beans.xml";
+
+    /** All classes which have to be scanned for Bean information */
+    private Set<Class<?>> beanClasses = new HashSet<Class<?>>();
+
+    /** the URLs of all META-INF/beans.xml files */
+    private Set<URL> beanXMLs = new HashSet<URL>();
+
+    /**contains all the JARs we found with valid beans.xml in it */
+    private Set<String> beanArchiveJarNames = new HashSet<String>();
+
+    @Override
+    public void init(Object object)
+    {
+        if (object instanceof ServletContext)
+        {
+            servletContext = (ServletContext) object;
+        }
+    }
+
+    @Override
+    public void scan() throws WebBeansDeploymentException
+    {
+        logger.info("Using OsgiMetaDataScannerService!");
+        Bundle mainBundle = BundleUtils.getContextBundle(true);
+
+
+        ServiceReference reference = mainBundle.getBundleContext().getServiceReference(PackageAdmin.class.getName());
+        try
+        {
+            PackageAdmin packageAdmin = (PackageAdmin) mainBundle.getBundleContext().getService(reference);
+
+            // search for all META-INF/beans.xml files
+            findBeansXml(mainBundle, packageAdmin);
+
+            // search for all classes
+            findBeanClasses(mainBundle, packageAdmin);
+        }
+        catch(Exception e)
+        {
+            throw new WebBeansDeploymentException("problem while scanning OSGi bundle", e);
+        }
+        finally
+        {
+            mainBundle.getBundleContext().ungetService(reference);
+        }
+
+    }
+
+    private void findBeanClasses(Bundle mainBundle, PackageAdmin packageAdmin)
+    {
+        BundleClassFinder bundleClassFinder =
+                new BundleAssignableClassFinder(packageAdmin, mainBundle,
+                                                new Class<?>[]{Object.class},
+                                                new ClassDiscoveryFilter()
+         {
+
+            @Override
+            public boolean directoryDiscoveryRequired(String directory)
+            {
+                return true;
+            }
+
+            @Override
+            public boolean jarFileDiscoveryRequired(String jarUrl)
+            {
+                boolean isValidBeanArchive = beanArchiveJarNames.contains(jarUrl);
+                return isValidBeanArchive;
+            }
+
+            @Override
+            public boolean packageDiscoveryRequired(String packageName)
+            {
+                return true;
+            }
+
+            @Override
+            public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange)
+            {
+                return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
+            }
+        });
+
+        Set<String> acceptedClassNames = bundleClassFinder.find();
+        for (String clsName : acceptedClassNames)
+        {
+            try
+            {
+                Class<?> cls = mainBundle.loadClass(clsName);
+                beanClasses.add(cls);
+            }
+            catch(Exception e)
+            {
+                logger.info("cannot load class from bundle: " + clsName);
+            }
+        }
+    }
+
+    private void findBeansXml(Bundle mainBundle, PackageAdmin packageAdmin)
+            throws Exception
+    {
+        BundleResourceFinder brfXmlJar =  new BundleResourceFinder(packageAdmin, mainBundle,
"", META_INF_BEANS_XML);
+
+        BundleResourceFinder.ResourceFinderCallback rfCallback = new BundleResourceFinder.ResourceFinderCallback()
+        {
+
+            public boolean foundInDirectory(Bundle bundle, String basePath, URL url) throws
Exception
+            {
+                logger.info("adding the following beans.xml URL: " + url);
+                beanXMLs.add(url);
+                return true;
+            }
+
+            public boolean foundInJar(Bundle bundle, String jarName, ZipEntry entry, InputStream
in) throws Exception
+            {
+                URL jarURL = bundle.getEntry(jarName);
+                URL beansUrl = new URL("jar:" + jarURL.toString() + "!/" + entry.getName());
+
+                logger.info("adding the following beans.xml URL: " + beansUrl);
+
+                beanXMLs.add(beansUrl);
+                beanArchiveJarNames.add(jarName);
+                return true;
+            }
+
+        };
+
+        brfXmlJar.find(rfCallback);
+
+        // TODO I found no other way to find WEB-INF/beanx.xml directly
+        Enumeration<URL> urls = mainBundle.findEntries("", "beans.xml", true);
+        boolean webBeansXmlFound = false;
+        while(urls != null && urls.hasMoreElements())
+        {
+            URL webBeansXml = urls.nextElement();
+            if (!webBeansXml.toExternalForm().endsWith("/" + WEB_INF_BEANS_XML))
+            {
+                continue;
+            }
+
+            if (webBeansXmlFound)
+            {
+                throw new WebBeansDeploymentException("found more than WEB-INF/beans.xml
file!" + webBeansXml); 
+            }
+
+            logger.info("adding the following WEB-INF/beans.xml URL: " + webBeansXml);
+            beanXMLs.add(webBeansXml);
+            webBeansXmlFound = true;
+
+        }
+
+    }
+
+    @Override
+    public Set<URL> getBeanXmls()
+    {
+        return beanXMLs;
+    }
+
+    @Override
+    public Set<Class<?>> getBeanClasses()
+    {
+        return beanClasses;
+    }
+}

Propchange: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OsgiMetaDataScannerService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OsgiMetaDataScannerService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/java/org/apache/geronimo/openwebbeans/OsgiMetaDataScannerService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin?rev=1022717&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
(added)
+++ geronimo/server/trunk/plugins/openwebbeans/geronimo-openwebbeans/src/main/resources/META-INF/services/org.apache.webbeans.spi.plugins.OpenWebBeansPlugin
Thu Oct 14 21:18:49 2010
@@ -0,0 +1,18 @@
+#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.
+
+org.apache.geronimo.openwebbeans.GeronimoWebBeansPlugin

Modified: geronimo/server/trunk/plugins/openwebbeans/openwebbeans-deployer/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/openwebbeans-deployer/src/main/plan/plan.xml?rev=1022717&r1=1022716&r2=1022717&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/openwebbeans-deployer/src/main/plan/plan.xml
(original)
+++ geronimo/server/trunk/plugins/openwebbeans/openwebbeans-deployer/src/main/plan/plan.xml
Thu Oct 14 21:18:49 2010
@@ -33,6 +33,25 @@
                         <type>car</type>
                     </dependency>
                 </dependencies>
+                <!-- Import added so that MyFaces can discover 
+                     META-INF/faces-config.xml in openwebbeans-jsf bundle -->
+                <import-package>org.apache.webbeans.jsf</import-package>
+                <import-package>javassist</import-package>
+                <import-package>javassist.bytecode</import-package>
+                <import-package>javassist.bytecode.annotation</import-package>
+                <import-package>javassist.bytecode.stackmap</import-package>
+                <import-package>javassist.compiler</import-package>
+                <import-package>javassist.compiler.ast</import-package>
+                <import-package>javassist.convert</import-package>
+                <import-package>javassist.expr</import-package>
+                <import-package>javassist.runtime</import-package>
+                <import-package>javassist.scopedpool</import-package>
+                <import-package>javassist.tools</import-package>
+                <import-package>javassist.tools.reflect</import-package>
+                <import-package>javassist.tools.rmi</import-package>
+                <import-package>javassist.tools.web</import-package>
+                <import-package>javassist.util</import-package>
+                <import-package>javassist.util.proxy</import-package>
             </environment>
         </xml-attribute>
     </gbean>

Modified: geronimo/server/trunk/plugins/openwebbeans/openwebbeans/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/openwebbeans/src/main/history/dependencies.xml?rev=1022717&r1=1022716&r2=1022717&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/openwebbeans/src/main/history/dependencies.xml
(original)
+++ geronimo/server/trunk/plugins/openwebbeans/openwebbeans/src/main/history/dependencies.xml
Thu Oct 14 21:18:49 2010
@@ -32,11 +32,6 @@
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.geronimo.bundles</groupId>
-        <artifactId>scannotation</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
         <groupId>org.apache.geronimo.configs</groupId>
         <artifactId>j2ee-server</artifactId>
         <type>car</type>
@@ -48,40 +43,10 @@
     </dependency>
     <dependency>
         <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-annotation_1.1_spec</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-atinject_1.0_spec</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-el_2.2_spec</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-interceptor_1.1_spec</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-jcdi_1.0_spec</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
         <artifactId>geronimo-jsp_2.2_spec</artifactId>
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.geronimo.specs</groupId>
-        <artifactId>geronimo-validation_1.0_spec</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
         <groupId>org.apache.myfaces.core</groupId>
         <artifactId>myfaces-api</artifactId>
         <type>jar</type>
@@ -93,11 +58,6 @@
     </dependency>
     <dependency>
         <groupId>org.apache.openwebbeans</groupId>
-        <artifactId>openwebbeans-impl</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.openwebbeans</groupId>
         <artifactId>openwebbeans-jsf</artifactId>
         <type>jar</type>
     </dependency>
@@ -108,11 +68,6 @@
     </dependency>
     <dependency>
         <groupId>org.apache.openwebbeans</groupId>
-        <artifactId>openwebbeans-spi</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.openwebbeans</groupId>
         <artifactId>openwebbeans-web</artifactId>
         <type>jar</type>
     </dependency>
@@ -131,9 +86,4 @@
         <artifactId>org.apache.servicemix.bundles.dom4j</artifactId>
         <type>jar</type>
     </dependency>
-    <dependency>
-        <groupId>org.apache.servicemix.bundles</groupId>
-        <artifactId>org.apache.servicemix.bundles.javassist</artifactId>
-        <type>jar</type>
-    </dependency>
 </plugin-artifact>

Modified: geronimo/server/trunk/plugins/openwebbeans/openwebbeans/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openwebbeans/openwebbeans/src/main/plan/plan.xml?rev=1022717&r1=1022716&r2=1022717&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openwebbeans/openwebbeans/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/openwebbeans/openwebbeans/src/main/plan/plan.xml Thu Oct
14 21:18:49 2010
@@ -20,6 +20,4 @@
 
 <module xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
 
-    <gbean name="OpenWebBeansGBean" class="org.apache.geronimo.openwebbeans.OpenWebBeansGBean"/>
-
 </module>



Mime
View raw message