Author: pete.muir(a)jboss.org
Date: 2009-03-27 16:21:52 -0400 (Fri, 27 Mar 2009)
New Revision: 2240
Added:
extensions/trunk/tomcat/build/
extensions/trunk/tomcat/build/pom.xml
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/util/Servlets.java
Modified:
extensions/trunk/tomcat/int/
extensions/trunk/tomcat/int/pom.xml
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/discovery/AbstractScanner.java
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/discovery/TomcatWebBeanDiscovery.java
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/discovery/URLScanner.java
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/resources/ReadOnlyNamingContext.java
extensions/trunk/tomcat/pom.xml
Log:
tomcat integration
Added: extensions/trunk/tomcat/build/pom.xml
===================================================================
--- extensions/trunk/tomcat/build/pom.xml (rev 0)
+++ extensions/trunk/tomcat/build/pom.xml 2009-03-27 20:21:52 UTC (rev 2240)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>webbeans-tomcat-parent</artifactId>
+ <groupId>org.jboss.webbeans.tomcat</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.webbeans.tomcat</groupId>
+ <artifactId>webbeans-tomcat</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Web Beans Tomcat module</name>
+ <
url>http://www.seamframework.org/WebBeans</url>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.webbeans.tomcat</groupId>
+ <artifactId>webbeans-tomcat-int</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <artifactSet>
+ <excludes>
+ <exclude>xml-apis:xml-apis</exclude>
+ </excludes>
+ </artifactSet>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Property changes on: extensions/trunk/tomcat/int
___________________________________________________________________
Name: svn:ignore
- .project
.classpath
target
.settings
+ .project
.classpath
target
.settings
bin
Modified: extensions/trunk/tomcat/int/pom.xml
===================================================================
--- extensions/trunk/tomcat/int/pom.xml 2009-03-27 20:19:22 UTC (rev 2239)
+++ extensions/trunk/tomcat/int/pom.xml 2009-03-27 20:21:52 UTC (rev 2240)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>webbeans-tomcat</artifactId>
+ <artifactId>webbeans-tomcat-parent</artifactId>
<groupId>org.jboss.webbeans.tomcat</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
@@ -37,6 +37,11 @@
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-logging</artifactId>
+ </dependency>
</dependencies>
Modified:
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/discovery/AbstractScanner.java
===================================================================
---
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/discovery/AbstractScanner.java 2009-03-27
20:19:22 UTC (rev 2239)
+++
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/discovery/AbstractScanner.java 2009-03-27
20:21:52 UTC (rev 2240)
@@ -18,7 +18,8 @@
import java.net.URL;
-import org.apache.log4j.Logger;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
/**
* Abstract base class for {@link Scanner} providing common functionality
@@ -31,7 +32,7 @@
public abstract class AbstractScanner implements Scanner
{
- private static final Logger log = Logger.getLogger(Scanner.class);
+ private static final Log log = Logging.getLog(Scanner.class);
private final ClassLoader classLoader;
private final TomcatWebBeanDiscovery webBeanDiscovery;
Modified:
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/discovery/TomcatWebBeanDiscovery.java
===================================================================
---
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/discovery/TomcatWebBeanDiscovery.java 2009-03-27
20:19:22 UTC (rev 2239)
+++
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/discovery/TomcatWebBeanDiscovery.java 2009-03-27
20:21:52 UTC (rev 2240)
@@ -18,7 +18,6 @@
import java.io.File;
import java.net.MalformedURLException;
-import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collections;
import java.util.HashSet;
@@ -28,6 +27,7 @@
import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
import org.jboss.webbeans.environment.tomcat.util.Reflections;
+import org.jboss.webbeans.environment.tomcat.util.Servlets;
/**
* The means by which Web Beans are discovered on the classpath. This will only
@@ -78,20 +78,19 @@
scanner.scanResources(new String[] { "beans.xml" });
try
{
- if (servletContext.getResource("/WEB-INF/beans.xml") != null)
+ URL beans = servletContext.getResource("/WEB-INF/beans.xml");
+ if (beans != null)
{
- File[] files = {new
File(servletContext.getResource("/WEB-INF/classes").toURI())};
+ File webInfClasses = Servlets.getRealFile(servletContext,
"/WEB-INF/classes");
+ File[] files = {webInfClasses};
scanner.scanDirectories(files);
+ wbUrls.add(beans);
}
}
catch (MalformedURLException e)
{
throw new IllegalStateException("Error loading resources from servlet
context ", e);
}
- catch (URISyntaxException e)
- {
- throw new IllegalStateException("Error loading resources from servlet
context ", e);
- }
}
}
Modified:
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/discovery/URLScanner.java
===================================================================
---
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/discovery/URLScanner.java 2009-03-27
20:19:22 UTC (rev 2239)
+++
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/discovery/URLScanner.java 2009-03-27
20:21:52 UTC (rev 2240)
@@ -29,7 +29,8 @@
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
-import org.apache.log4j.Logger;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
/**
* Implementation of {@link Scanner} which can scan a {@link URLClassLoader}
@@ -42,7 +43,7 @@
*/
public class URLScanner extends AbstractScanner
{
- private static final Logger log = Logger.getLogger(URLScanner.class);
+ private static final Log log = Logging.getLog(URLScanner.class);
public URLScanner(ClassLoader classLoader, TomcatWebBeanDiscovery webBeanDiscovery)
{
Modified:
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/resources/ReadOnlyNamingContext.java
===================================================================
---
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/resources/ReadOnlyNamingContext.java 2009-03-27
20:19:22 UTC (rev 2239)
+++
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/resources/ReadOnlyNamingContext.java 2009-03-27
20:21:52 UTC (rev 2240)
@@ -55,4 +55,10 @@
return context;
}
+ @Override
+ public void unbind(String key)
+ {
+ // No-op
+ }
+
}
Added:
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/util/Servlets.java
===================================================================
---
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/util/Servlets.java
(rev 0)
+++
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/util/Servlets.java 2009-03-27
20:21:52 UTC (rev 2240)
@@ -0,0 +1,35 @@
+package org.jboss.webbeans.environment.tomcat.util;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.servlet.ServletContext;
+
+public class Servlets
+{
+
+ public static File getRealFile(ServletContext servletContext, String path) throws
MalformedURLException
+ {
+ String realPath = servletContext.getRealPath(path);
+ if (realPath==null) //WebLogic!
+ {
+ URL resourcePath = servletContext.getResource(path);
+ if ((resourcePath != null) &&
(resourcePath.getProtocol().equals("file")))
+ {
+ realPath = resourcePath.getPath();
+ }
+ }
+
+ if (realPath != null)
+ {
+ File file = new File(realPath);
+ if (file.exists())
+ {
+ return file;
+ }
+ }
+ return null;
+ }
+
+}
Modified: extensions/trunk/tomcat/pom.xml
===================================================================
--- extensions/trunk/tomcat/pom.xml 2009-03-27 20:19:22 UTC (rev 2239)
+++ extensions/trunk/tomcat/pom.xml 2009-03-27 20:21:52 UTC (rev 2240)
@@ -1,7 +1,7 @@
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans.tomcat</groupId>
- <artifactId>webbeans-tomcat</artifactId>
+ <artifactId>webbeans-tomcat-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
@@ -11,11 +11,12 @@
<version>1.0.0-SNAPSHOT</version>
</parent>
- <name>Web Beans Tomcat module</name>
+ <name>Web Beans Tomcat aggregator</name>
<
url>http://www.seamframework.org/WebBeans</url>
<modules>
<module>int</module>
+ <module>build</module>
</modules>
<description>
@@ -33,7 +34,7 @@
<url>http://in.relation.to/Bloggers/Pete</url>
</developer>
</developers>
-
+
<build>
<plugins>
<plugin>
@@ -61,7 +62,7 @@
<
tagBase>https://svn.jboss.org/repos/webbeans/extensions/tags</tagBa...
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
- </plugin>
+ </plugin>
</plugins>
<defaultGoal>package</defaultGoal>
@@ -95,6 +96,12 @@
</pluginManagement>
</build>
+ <dependencyManagement>
+ <dependencies>
+
+ </dependencies>
+ </dependencyManagement>
+
<profiles>
</profiles>