[jboss-cvs] JBossAS SVN: r81351 - in projects/webbeans-ri-int/trunk: jbossas and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Nov 20 05:56:56 EST 2008
Author: alesj
Date: 2008-11-20 05:56:56 -0500 (Thu, 20 Nov 2008)
New Revision: 81351
Added:
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/WebBeanDiscoveryEnvVDFConnector.java
projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/JBossWebBeansMetaData.java
projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/JBossWebBeansMetaDataDeployer.java
projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/WebBeanDiscoveryDeployer.java
projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/WebBeanDiscoveryEnvironment.java
Removed:
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaData.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaDataDeployer.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryDeployer.java
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryEnvironment.java
Modified:
projects/webbeans-ri-int/trunk/jbossas/pom.xml
projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryImpl.java
projects/webbeans-ri-int/trunk/microcontainer/pom.xml
projects/webbeans-ri-int/trunk/pom.xml
Log:
Moved deployers to proper place.
Modified: projects/webbeans-ri-int/trunk/jbossas/pom.xml
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/pom.xml 2008-11-20 09:58:06 UTC (rev 81350)
+++ projects/webbeans-ri-int/trunk/jbossas/pom.xml 2008-11-20 10:56:56 UTC (rev 81351)
@@ -15,10 +15,15 @@
<!-- Global dependencies -->
<dependency>
+ <groupId>org.jboss.webbeans.integration</groupId>
+ <artifactId>webbeans-ri-int-microcontainer</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-common-core</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-spi</artifactId>
@@ -113,6 +118,21 @@
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-ri</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
<!-- Test dependencies -->
<dependency>
<groupId>org.jboss.test</groupId>
@@ -160,20 +180,5 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-ri</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </dependency>
-
- </dependencies>
+ </dependencies>
</project>
Deleted: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaData.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaData.java 2008-11-20 09:58:06 UTC (rev 81350)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaData.java 2008-11-20 10:56:56 UTC (rev 81351)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.webbeans.integration.jbossas;
-
-import java.io.Serializable;
-import java.net.URL;
-
-import org.jboss.virtual.VirtualFile;
-
-/**
- * JBoss WebBeans custom meta data
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class JBossWebBeansMetaData implements Serializable
-{
- private static final long serialVersionUID = 1l;
-
- private VirtualFile file;
-
- public JBossWebBeansMetaData(VirtualFile file)
- {
- if (file == null)
- throw new IllegalArgumentException("Null file");
- this.file = file;
- }
-
- public URL getURL() throws Exception
- {
- return file.toURL();
- }
-}
\ No newline at end of file
Deleted: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaDataDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaDataDeployer.java 2008-11-20 09:58:06 UTC (rev 81350)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaDataDeployer.java 2008-11-20 10:56:56 UTC (rev 81351)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.webbeans.integration.jbossas;
-
-import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * JBoss WBD deployer.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class JBossWebBeansMetaDataDeployer extends AbstractVFSParsingDeployer<JBossWebBeansMetaData>
-{
- public JBossWebBeansMetaDataDeployer()
- {
- super(JBossWebBeansMetaData.class);
- setName("jboss-web-beans.xml");
- }
-
- protected JBossWebBeansMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossWebBeansMetaData root) throws Exception
- {
- return new JBossWebBeansMetaData(file);
- }
-}
\ No newline at end of file
Deleted: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryDeployer.java 2008-11-20 09:58:06 UTC (rev 81350)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryDeployer.java 2008-11-20 10:56:56 UTC (rev 81351)
@@ -1,168 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.webbeans.integration.jbossas;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.classloading.spi.visitor.ClassFilter;
-import org.jboss.classloading.spi.visitor.ResourceContext;
-import org.jboss.classloading.spi.visitor.ResourceFilter;
-import org.jboss.classloading.spi.visitor.ResourceVisitor;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.vfs.spi.deployer.AbstractOptionalVFSRealDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
-
-/**
- * WBD deployer.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class WebBeanDiscoveryDeployer extends AbstractOptionalVFSRealDeployer<JBossWebBeansMetaData>
-{
- public WebBeanDiscoveryDeployer()
- {
- super(JBossWebBeansMetaData.class);
- addOutput(WebBeanDiscovery.class);
- }
-
- public void deploy(VFSDeploymentUnit unit, JBossWebBeansMetaData deployment) throws DeploymentException
- {
- VFSDeploymentUnit topUnit = unit.getTopLevel();
- WebBeanDiscoveryEnvironment environment = topUnit.getAttachment(WebBeanDiscoveryEnvironment.class.getName(), WebBeanDiscoveryEnvironment.class);
- if (environment == null)
- {
- environment = new WebBeanDiscoveryEnvironment();
- topUnit.addAttachment(WebBeanDiscoveryEnvironment.class.getName(), environment);
- }
-
- List<URL> urls = new ArrayList<URL>();
-
- try
- {
- if (deployment != null)
- {
- // do some custom stuff
- }
-
- Iterable<VirtualFile> classpaths = getClassPaths(unit);
- for (VirtualFile cp : classpaths)
- {
- VirtualFile wbXml = cp.getChild("META-INF/web-beans.xml");
- if (wbXml != null)
- {
- // add url
- environment.addWebBeansXmlURL(wbXml.toURL());
- // add classes
- urls.add(cp.toURL());
- }
- }
-
- // handle war slightly different
- VirtualFile warWbXml = unit.getFile("WEB-INF/web-beans.xml");
- if (warWbXml != null)
- {
- environment.addWebBeansXmlURL(warWbXml.toURL());
-
- VirtualFile classes = unit.getFile("WEB-INF/classes");
- if (classes != null)
- urls.add(classes.toURL());
- }
- }
- catch (Exception e)
- {
- throw DeploymentException.rethrowAsDeploymentException("Cannot deploy WBD.", e);
- }
-
- if (urls.isEmpty() == false)
- {
- Module module = unit.getAttachment(Module.class);
- if (module == null)
- {
- VFSDeploymentUnit parent = unit.getParent();
- while (parent != null && module == null)
- {
- module = parent.getAttachment(Module.class);
- parent = parent.getParent();
- }
- if (module == null)
- throw new DeploymentException("No module in deployment unit's hierarchy: " + unit.getName());
- }
-
- WBDiscoveryVisitor visitor = new WBDiscoveryVisitor(environment);
- module.visit(visitor, ClassFilter.INSTANCE, null, urls.toArray(new URL[urls.size()]));
- }
- }
-
- /**
- * Get the matching class paths that belong to this deployment unit.
- *
- * @param unit the deployment unit
- * @return matching class paths
- * @throws Exception for any error
- */
- protected Iterable<VirtualFile> getClassPaths(VFSDeploymentUnit unit) throws Exception
- {
- List<VirtualFile> classpath = unit.getClassPath();
- if (classpath != null && classpath.isEmpty() == false)
- {
- List<VirtualFile> matching = new ArrayList<VirtualFile>();
- VirtualFile root = unit.getRoot();
- for (VirtualFile cp : classpath)
- {
- VirtualFile check = cp;
- while (check != null && check.equals(root) == false)
- check = check.getParent();
-
- if (check != null)
- matching.add(cp);
- }
- return matching;
- }
- return Collections.emptySet();
- }
-
- private class WBDiscoveryVisitor implements ResourceVisitor
- {
- private WebBeanDiscoveryEnvironment wbdi;
-
- private WBDiscoveryVisitor(WebBeanDiscoveryEnvironment wbdi)
- {
- this.wbdi = wbdi;
- }
-
- public ResourceFilter getFilter()
- {
- return ClassFilter.INSTANCE;
- }
-
- public void visit(ResourceContext resource)
- {
- wbdi.addWebBeanClass(resource.loadClass());
- }
- }
-}
\ No newline at end of file
Deleted: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryEnvironment.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryEnvironment.java 2008-11-20 09:58:06 UTC (rev 81350)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryEnvironment.java 2008-11-20 10:56:56 UTC (rev 81351)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.webbeans.integration.jbossas;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
-
-/**
- * WBD impl.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class WebBeanDiscoveryEnvironment
-{
- private Set<Class<?>> classes = new HashSet<Class<?>>();
- private Set<URL> urls = new HashSet<URL>();
-
- public void addWebBeanClass(Class<?> clazz)
- {
- classes.add(clazz);
- }
-
- public void addWebBeansXmlURL(URL url)
- {
- urls.add(url);
- }
-
- public Iterable<Class<?>> getWebBeanClasses()
- {
- return classes;
- }
-
- public Iterable<URL> getWebBeansXml()
- {
- return urls;
- }
-
- public Map<Class<?>, EjbDescriptor<?>> discoverEjbs()
- {
- return new HashMap<Class<?>, EjbDescriptor<?>>();
- }
-}
\ No newline at end of file
Modified: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryImpl.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryImpl.java 2008-11-20 09:58:06 UTC (rev 81350)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryImpl.java 2008-11-20 10:56:56 UTC (rev 81351)
@@ -1,28 +1,31 @@
package org.jboss.webbeans.integration.jbossas;
import java.net.URL;
+import java.util.Collections;
import java.util.Map;
-
import javax.servlet.ServletContext;
import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
-import org.jboss.webbeans.integration.jbossas.vdf.VFSDeploymentUnitVDFConnector;
+import org.jboss.webbeans.integration.jbossas.vdf.WebBeanDiscoveryEnvVDFConnector;
+import org.jboss.webbeans.integration.microcontainer.WebBeanDiscoveryEnvironment;
public class WebBeanDiscoveryImpl implements WebBeanDiscovery
-{
-
+{
private WebBeanDiscoveryEnvironment environment;
public WebBeanDiscoveryImpl(ServletContext servletContext)
{
- environment = new VFSDeploymentUnitVDFConnector(servletContext).getUtility().getAttachment(WebBeanDiscoveryEnvironment.class);
+ WebBeanDiscoveryEnvVDFConnector connector = new WebBeanDiscoveryEnvVDFConnector(servletContext);
+ if (connector.isValid() == false)
+ throw new IllegalArgumentException("Cannot find web-beans discovery in deployment: " + servletContext);
+
+ environment = connector.getUtility();
}
public Map<Class<?>, EjbDescriptor<?>> discoverEjbs()
{
- // TODO Auto-generated method stub
- return null;
+ return Collections.emptyMap();
}
public Iterable<Class<?>> discoverWebBeanClasses()
Added: projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/WebBeanDiscoveryEnvVDFConnector.java
===================================================================
--- projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/WebBeanDiscoveryEnvVDFConnector.java (rev 0)
+++ projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/vdf/WebBeanDiscoveryEnvVDFConnector.java 2008-11-20 10:56:56 UTC (rev 81351)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.webbeans.integration.jbossas.vdf;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.webbeans.integration.microcontainer.WebBeanDiscoveryEnvironment;
+
+/**
+ * WebBeanDiscoveryEnv VDF connector.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WebBeanDiscoveryEnvVDFConnector extends BaseAttachmentVDFConnector<WebBeanDiscoveryEnvironment>
+{
+ public WebBeanDiscoveryEnvVDFConnector(ServletContext servletContext)
+ {
+ super(servletContext);
+ }
+
+ protected Class<WebBeanDiscoveryEnvironment> getAttachmentType()
+ {
+ return WebBeanDiscoveryEnvironment.class;
+ }
+}
Modified: projects/webbeans-ri-int/trunk/microcontainer/pom.xml
===================================================================
--- projects/webbeans-ri-int/trunk/microcontainer/pom.xml 2008-11-20 09:58:06 UTC (rev 81350)
+++ projects/webbeans-ri-int/trunk/microcontainer/pom.xml 2008-11-20 10:56:56 UTC (rev 81351)
@@ -22,6 +22,11 @@
<!-- Global dependencies -->
<dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-ri</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-common-core</artifactId>
</dependency>
Copied: projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/JBossWebBeansMetaData.java (from rev 81349, projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaData.java)
===================================================================
--- projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/JBossWebBeansMetaData.java (rev 0)
+++ projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/JBossWebBeansMetaData.java 2008-11-20 10:56:56 UTC (rev 81351)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.webbeans.integration.microcontainer;
+
+import java.io.Serializable;
+import java.net.URL;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * JBoss WebBeans custom meta data
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JBossWebBeansMetaData implements Serializable
+{
+ private static final long serialVersionUID = 1l;
+
+ private VirtualFile file;
+
+ public JBossWebBeansMetaData(VirtualFile file)
+ {
+ if (file == null)
+ throw new IllegalArgumentException("Null file");
+ this.file = file;
+ }
+
+ public URL getURL() throws Exception
+ {
+ return file.toURL();
+ }
+}
\ No newline at end of file
Property changes on: projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/JBossWebBeansMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/JBossWebBeansMetaDataDeployer.java (from rev 81349, projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/JBossWebBeansMetaDataDeployer.java)
===================================================================
--- projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/JBossWebBeansMetaDataDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/JBossWebBeansMetaDataDeployer.java 2008-11-20 10:56:56 UTC (rev 81351)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.webbeans.integration.microcontainer;
+
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * JBoss WBD deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JBossWebBeansMetaDataDeployer extends AbstractVFSParsingDeployer<JBossWebBeansMetaData>
+{
+ public JBossWebBeansMetaDataDeployer()
+ {
+ super(JBossWebBeansMetaData.class);
+ setName("jboss-web-beans.xml");
+ }
+
+ protected JBossWebBeansMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossWebBeansMetaData root) throws Exception
+ {
+ return new JBossWebBeansMetaData(file);
+ }
+}
\ No newline at end of file
Property changes on: projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/JBossWebBeansMetaDataDeployer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/WebBeanDiscoveryDeployer.java (from rev 81349, projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryDeployer.java)
===================================================================
--- projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/WebBeanDiscoveryDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/WebBeanDiscoveryDeployer.java 2008-11-20 10:56:56 UTC (rev 81351)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.webbeans.integration.microcontainer;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.visitor.ClassFilter;
+import org.jboss.classloading.spi.visitor.ResourceContext;
+import org.jboss.classloading.spi.visitor.ResourceFilter;
+import org.jboss.classloading.spi.visitor.ResourceVisitor;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.vfs.spi.deployer.AbstractOptionalVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * WBD deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WebBeanDiscoveryDeployer extends AbstractOptionalVFSRealDeployer<JBossWebBeansMetaData>
+{
+ public WebBeanDiscoveryDeployer()
+ {
+ super(JBossWebBeansMetaData.class);
+ addOutput(WebBeanDiscoveryEnvironment.class);
+ }
+
+ public void deploy(VFSDeploymentUnit unit, JBossWebBeansMetaData deployment) throws DeploymentException
+ {
+ VFSDeploymentUnit topUnit = unit.getTopLevel();
+ WebBeanDiscoveryEnvironment environment = topUnit.getAttachment(WebBeanDiscoveryEnvironment.class);
+ if (environment == null)
+ {
+ environment = new WebBeanDiscoveryEnvironment();
+ topUnit.addAttachment(WebBeanDiscoveryEnvironment.class, environment);
+ }
+
+ List<URL> urls = new ArrayList<URL>();
+
+ try
+ {
+ if (deployment != null)
+ {
+ // do some custom stuff
+ }
+
+ Iterable<VirtualFile> classpaths = getClassPaths(unit);
+ for (VirtualFile cp : classpaths)
+ {
+ VirtualFile wbXml = cp.getChild("META-INF/web-beans.xml");
+ if (wbXml != null)
+ {
+ // add url
+ environment.addWebBeansXmlURL(wbXml.toURL());
+ // add classes
+ urls.add(cp.toURL());
+ }
+ }
+
+ // handle war slightly different
+ VirtualFile warWbXml = unit.getFile("WEB-INF/web-beans.xml");
+ if (warWbXml != null)
+ {
+ environment.addWebBeansXmlURL(warWbXml.toURL());
+
+ VirtualFile classes = unit.getFile("WEB-INF/classes");
+ if (classes != null)
+ urls.add(classes.toURL());
+ }
+ }
+ catch (Exception e)
+ {
+ throw DeploymentException.rethrowAsDeploymentException("Cannot deploy WBD.", e);
+ }
+
+ if (urls.isEmpty() == false)
+ {
+ Module module = unit.getAttachment(Module.class);
+ if (module == null)
+ {
+ VFSDeploymentUnit parent = unit.getParent();
+ while (parent != null && module == null)
+ {
+ module = parent.getAttachment(Module.class);
+ parent = parent.getParent();
+ }
+ if (module == null)
+ throw new DeploymentException("No module in deployment unit's hierarchy: " + unit.getName());
+ }
+
+ WBDiscoveryVisitor visitor = new WBDiscoveryVisitor(environment);
+ module.visit(visitor, ClassFilter.INSTANCE, null, urls.toArray(new URL[urls.size()]));
+ }
+ }
+
+ /**
+ * Get the matching class paths that belong to this deployment unit.
+ *
+ * @param unit the deployment unit
+ * @return matching class paths
+ * @throws Exception for any error
+ */
+ protected Iterable<VirtualFile> getClassPaths(VFSDeploymentUnit unit) throws Exception
+ {
+ List<VirtualFile> classpath = unit.getClassPath();
+ if (classpath != null && classpath.isEmpty() == false)
+ {
+ List<VirtualFile> matching = new ArrayList<VirtualFile>();
+ VirtualFile root = unit.getRoot();
+ for (VirtualFile cp : classpath)
+ {
+ VirtualFile check = cp;
+ while (check != null && check.equals(root) == false)
+ check = check.getParent();
+
+ if (check != null)
+ matching.add(cp);
+ }
+ return matching;
+ }
+ return Collections.emptySet();
+ }
+
+ private class WBDiscoveryVisitor implements ResourceVisitor
+ {
+ private WebBeanDiscoveryEnvironment wbdi;
+
+ private WBDiscoveryVisitor(WebBeanDiscoveryEnvironment wbdi)
+ {
+ this.wbdi = wbdi;
+ }
+
+ public ResourceFilter getFilter()
+ {
+ return ClassFilter.INSTANCE;
+ }
+
+ public void visit(ResourceContext resource)
+ {
+ wbdi.addWebBeanClass(resource.loadClass());
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/WebBeanDiscoveryDeployer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/WebBeanDiscoveryEnvironment.java (from rev 81349, projects/webbeans-ri-int/trunk/jbossas/src/main/java/org/jboss/webbeans/integration/jbossas/WebBeanDiscoveryEnvironment.java)
===================================================================
--- projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/WebBeanDiscoveryEnvironment.java (rev 0)
+++ projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/WebBeanDiscoveryEnvironment.java 2008-11-20 10:56:56 UTC (rev 81351)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.webbeans.integration.microcontainer;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.webbeans.bootstrap.spi.EjbDescriptor;
+
+/**
+ * WBD impl.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WebBeanDiscoveryEnvironment
+{
+ private Set<Class<?>> classes = new HashSet<Class<?>>();
+ private Set<URL> urls = new HashSet<URL>();
+
+ public void addWebBeanClass(Class<?> clazz)
+ {
+ classes.add(clazz);
+ }
+
+ public void addWebBeansXmlURL(URL url)
+ {
+ urls.add(url);
+ }
+
+ public Iterable<Class<?>> getWebBeanClasses()
+ {
+ return classes;
+ }
+
+ public Iterable<URL> getWebBeansXml()
+ {
+ return urls;
+ }
+
+ public Map<Class<?>, EjbDescriptor<?>> discoverEjbs()
+ {
+ return new HashMap<Class<?>, EjbDescriptor<?>>();
+ }
+}
\ No newline at end of file
Property changes on: projects/webbeans-ri-int/trunk/microcontainer/src/main/java/org/jboss/webbeans/integration/microcontainer/WebBeanDiscoveryEnvironment.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: projects/webbeans-ri-int/trunk/pom.xml
===================================================================
--- projects/webbeans-ri-int/trunk/pom.xml 2008-11-20 09:58:06 UTC (rev 81350)
+++ projects/webbeans-ri-int/trunk/pom.xml 2008-11-20 10:56:56 UTC (rev 81351)
@@ -186,10 +186,21 @@
<dependencies>
<dependency>
+ <groupId>org.jboss.webbeans.integration</groupId>
+ <artifactId>webbeans-ri-int-microcontainer</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.webbeans.integration</groupId>
+ <artifactId>webbeans-ri-int-jbossas</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-client</artifactId>
<version>${version.jboss.deployers}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-client-spi</artifactId>
More information about the jboss-cvs-commits
mailing list