You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2006/09/19 21:17:15 UTC
svn commit: r447933 [4/4] - in /geronimo/sandbox/javaee5: ./
assemblies-jee5/ assemblies-jee5/geronimo-jetty6-jee5/
assemblies-jee5/geronimo-jetty6-jee5/src/
assemblies-jee5/geronimo-jetty6-jee5/src/main/var/config/ configs-jee5/
configs-jee5/jetty6-de...
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/connector/HTTPSConnector.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/connector/HTTPSConnector.java?view=diff&rev=447933&r1=447903&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/connector/HTTPSConnector.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/connector/HTTPSConnector.java Tue Sep 19 12:17:10 2006
@@ -15,14 +15,14 @@
* limitations under the License.
*/
-package org.apache.geronimo.jetty.connector;
+package org.apache.geronimo.jetty6.connector;
import javax.net.ssl.KeyManagerFactory;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.jetty.JettyContainer;
-import org.apache.geronimo.jetty.JettySecureConnector;
+import org.apache.geronimo.jetty6.JettyContainer;
+import org.apache.geronimo.jetty6.JettySecureConnector;
import org.apache.geronimo.management.geronimo.KeystoreManager;
import org.apache.geronimo.management.geronimo.WebManager;
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/connector/JettyConnector.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/connector/JettyConnector.java?view=diff&rev=447933&r1=447903&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/connector/JettyConnector.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/connector/JettyConnector.java Tue Sep 19 12:17:10 2006
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.geronimo.jetty.connector;
+package org.apache.geronimo.jetty6.connector;
import java.net.InetAddress;
import java.net.InetSocketAddress;
@@ -25,8 +25,8 @@
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.gbean.GBeanLifecycle;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.jetty.JettyContainer;
-import org.apache.geronimo.jetty.JettyWebConnector;
+import org.apache.geronimo.jetty6.JettyContainer;
+import org.apache.geronimo.jetty6.JettyWebConnector;
import org.mortbay.jetty.AbstractConnector;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.bio.SocketConnector;
@@ -236,7 +236,7 @@
static {
GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Jetty HTTP Connector", JettyConnector.class);
infoFactory.addReference(CONNECTOR_CONTAINER_REFERENCE, JettyContainer.class, NameFactory.GERONIMO_SERVICE);
- infoFactory.addInterface(JettyWebConnector.class, new String[]{"host", "port", "minThreads", "maxThreads", "bufferSizeBytes", "acceptQueueSize", "lingerMillis", "tcpNoDelay", "redirectPort", "connectUrl", "maxIdleTimeMs", "lowThreads", "lowThreadsMaxIdleTimeMs",},
+ infoFactory.addInterface(JettyWebConnector.class, new String[]{"host", "port", "minThreads", "maxThreads", "bufferSizeBytes", "acceptQueueSize", "lingerMillis", "tcpNoDelay", "redirectPort", "connectUrl", "maxIdleTimeMs"},
new String[]{"host", "port", "redirectPort", "maxThreads", "minThreads"});
infoFactory.setConstructor(new String[]{"JettyContainer"});
GBEAN_INFO = infoFactory.getBeanInfo();
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/BeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/BeforeAfter.java?view=diff&rev=447933&r1=447903&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/BeforeAfter.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/BeforeAfter.java Tue Sep 19 12:17:10 2006
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.jetty.interceptor;
+package org.apache.geronimo.jetty6.interceptor;
import org.mortbay.jetty.Request;
import org.mortbay.jetty.Response;
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/ComponentContextBeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/ComponentContextBeforeAfter.java?view=diff&rev=447933&r1=447903&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/ComponentContextBeforeAfter.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/ComponentContextBeforeAfter.java Tue Sep 19 12:17:10 2006
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.jetty.interceptor;
+package org.apache.geronimo.jetty6.interceptor;
import javax.naming.Context;
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/InstanceContextBeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/InstanceContextBeforeAfter.java?view=diff&rev=447933&r1=447903&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/InstanceContextBeforeAfter.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/InstanceContextBeforeAfter.java Tue Sep 19 12:17:10 2006
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.jetty.interceptor;
+package org.apache.geronimo.jetty6.interceptor;
import java.util.Set;
import javax.resource.ResourceException;
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/ThreadClassloaderBeforeAfter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/ThreadClassloaderBeforeAfter.java?view=diff&rev=447933&r1=447903&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/ThreadClassloaderBeforeAfter.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/interceptor/ThreadClassloaderBeforeAfter.java Tue Sep 19 12:17:10 2006
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.jetty.interceptor;
+package org.apache.geronimo.jetty6.interceptor;
import org.mortbay.jetty.Request;
import org.mortbay.jetty.Response;
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/JettyLogManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/JettyLogManager.java?view=diff&rev=447933&r1=447903&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/JettyLogManager.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/JettyLogManager.java Tue Sep 19 12:17:10 2006
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.jetty.requestlog;
+package org.apache.geronimo.jetty6.requestlog;
import org.apache.geronimo.management.geronimo.WebAccessLog;
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/JettyLogManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/JettyLogManagerImpl.java?view=diff&rev=447933&r1=447903&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/JettyLogManagerImpl.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/JettyLogManagerImpl.java Tue Sep 19 12:17:10 2006
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.jetty.requestlog;
+package org.apache.geronimo.jetty6.requestlog;
import java.io.File;
import java.io.FilenameFilter;
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/JettyRequestLog.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/JettyRequestLog.java?view=diff&rev=447933&r1=447903&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/JettyRequestLog.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/JettyRequestLog.java Tue Sep 19 12:17:10 2006
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.jetty.requestlog;
+package org.apache.geronimo.jetty6.requestlog;
/**
* Interface for the NCSARequestLog GBean
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/NCSARequestLog.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/NCSARequestLog.java?view=diff&rev=447933&r1=447903&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/NCSARequestLog.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/requestlog/NCSARequestLog.java Tue Sep 19 12:17:10 2006
@@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.jetty.requestlog;
+package org.apache.geronimo.jetty6.requestlog;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.gbean.GBeanLifecycle;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.jetty.JettyContainer;
+import org.apache.geronimo.jetty6.JettyContainer;
import org.apache.geronimo.system.serverinfo.ServerInfo;
import org.mortbay.jetty.RequestLog;
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/resources/META-INF/geronimo-dependency.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/resources/META-INF/geronimo-dependency.xml?view=diff&rev=447933&r1=447932&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/resources/META-INF/geronimo-dependency.xml (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/main/resources/META-INF/geronimo-dependency.xml Tue Sep 19 12:17:10 2006
@@ -1,23 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<dep:service xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
- <dep:dependency>
- <dep:groupId>jetty</dep:groupId>
- <dep:artifactId>org.mortbay.jetty</dep:artifactId>
- </dep:dependency>
- <dep:dependency>
- <dep:groupId>tomcat</dep:groupId>
- <dep:artifactId>jasper-compiler</dep:artifactId>
- </dep:dependency>
- <dep:dependency>
- <dep:groupId>tomcat</dep:groupId>
- <dep:artifactId>jasper-compiler-jdt</dep:artifactId>
- </dep:dependency>
- <dep:dependency>
- <dep:groupId>tomcat</dep:groupId>
- <dep:artifactId>jasper-runtime</dep:artifactId>
- </dep:dependency>
- <dep:dependency>
- <dep:groupId>commons-el</dep:groupId>
- <dep:artifactId>commons-el</dep:artifactId>
- </dep:dependency>
+ <dep:dependency>
+ <dep:groupId>org.mortbay.jetty</dep:groupId>
+ <dep:artifactId>jetty</dep:artifactId>
+ </dep:dependency>
+ <dep:dependency>
+ <dep:groupId>org.mortbay.jetty</dep:groupId>
+ <dep:artifactId>jetty-util</dep:artifactId>
+ </dep:dependency>
+ <dep:dependency>
+ <dep:groupId>tomcat</dep:groupId>
+ <dep:artifactId>jasper-compiler</dep:artifactId>
+ </dep:dependency>
+ <dep:dependency>
+ <dep:groupId>tomcat</dep:groupId>
+ <dep:artifactId>jasper-compiler-jdt</dep:artifactId>
+ </dep:dependency>
+ <dep:dependency>
+ <dep:groupId>tomcat</dep:groupId>
+ <dep:artifactId>jasper-runtime</dep:artifactId>
+ </dep:dependency>
+ <dep:dependency>
+ <dep:groupId>commons-el</dep:groupId>
+ <dep:artifactId>commons-el</dep:artifactId>
+ </dep:dependency>
</dep:service>
Copied: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/AbstractWebModuleTest.java (from r447903, geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/AbstractWebModuleTest.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/AbstractWebModuleTest.java?view=diff&rev=447933&p1=geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/AbstractWebModuleTest.java&r1=447903&p2=geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/AbstractWebModuleTest.java&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/AbstractWebModuleTest.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/AbstractWebModuleTest.java Tue Sep 19 12:17:10 2006
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.jetty;
+package org.apache.geronimo.jetty6;
import java.io.File;
import java.net.URL;
@@ -31,7 +31,7 @@
import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
import org.apache.geronimo.connector.outbound.connectiontracking.GeronimoTransactionListener;
-import org.apache.geronimo.jetty.connector.HTTPConnector;
+import org.apache.geronimo.jetty6.connector.HTTPConnector;
import org.apache.geronimo.security.SecurityServiceImpl;
import org.apache.geronimo.security.deploy.DefaultPrincipal;
import org.apache.geronimo.security.deploy.PrincipalInfo;
@@ -62,7 +62,7 @@
private TransactionManager transactionManager;
private ConnectionTrackingCoordinator connectionTrackingCoordinator;
private URL configurationBaseURL;
-
+ protected SessionHandlerFactory sessionHandlerFactory = null;
protected void setUpStaticContentServlet(JettyServletRegistration webModule) throws Exception {
Map staticContentServletInitParams = new HashMap();
@@ -107,7 +107,7 @@
realmName,
null,
0,
- new DefaultSessionHandlerFactory(),
+ sessionHandlerFactory,
policyContextId,
securityRealmName,
defaultPrincipal,
Copied: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/ApplicationTest.java (from r447903, geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/ApplicationTest.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/ApplicationTest.java?view=diff&rev=447933&p1=geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/ApplicationTest.java&r1=447903&p2=geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/ApplicationTest.java&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/ApplicationTest.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/ApplicationTest.java Tue Sep 19 12:17:10 2006
@@ -15,13 +15,21 @@
* limitations under the License.
*/
-package org.apache.geronimo.jetty;
+package org.apache.geronimo.jetty6;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
+import org.apache.geronimo.clustering.SessionManager;
+import org.apache.geronimo.clustering.Session;
+import org.apache.geronimo.clustering.SessionAlreadyExistException;
+import org.apache.geronimo.clustering.SessionListener;
+import org.apache.geronimo.clustering.Node;
+import org.apache.geronimo.clustering.BasicNode;
+import org.apache.geronimo.jetty6.cluster.ClusteredSessionHandlerFactory;
+
/**
* @version $Rev$ $Date$
*/
@@ -37,6 +45,39 @@
assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
assertEquals("Hello World", reader.readLine());
connection.disconnect();
+ }
+
+ public void testApplicationWithSessionHandler() throws Exception {
+ SessionManager sessionManager = new MockSessionManager();
+ sessionHandlerFactory = new ClusteredSessionHandlerFactory(sessionManager);
+ JettyWebAppContext app = setUpAppContext(null, null, null, null, null, null, null, "war1/");
+
+ setUpStaticContentServlet(app);
+
+ HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:5678/test/hello.txt").openConnection();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
+ assertEquals("Hello World", reader.readLine());
+ connection.disconnect();
+ }
+
+ private static class MockSessionManager implements SessionManager {
+
+ Node node = new BasicNode("testNode");
+
+ public Session createSession(String string) throws SessionAlreadyExistException {
+ return null;
+ }
+
+ public void registerListener(SessionListener sessionListener) {
+ }
+
+ public void unregisterListener(SessionListener sessionListener) {
+ }
+
+ public Node getNode() {
+ return node;
+ }
}
}
Copied: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/ClassLoaderTest.java (from r447903, geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/ClassLoaderTest.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/ClassLoaderTest.java?view=diff&rev=447933&p1=geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/ClassLoaderTest.java&r1=447903&p2=geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/ClassLoaderTest.java&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/ClassLoaderTest.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/ClassLoaderTest.java Tue Sep 19 12:17:10 2006
@@ -15,10 +15,9 @@
* limitations under the License.
*/
-package org.apache.geronimo.jetty;
+package org.apache.geronimo.jetty6;
import java.io.File;
-import java.net.MalformedURLException;
import java.net.URL;
import org.apache.geronimo.testsupport.TestSupport;
Copied: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/ContainerTest.java (from r447903, geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/ContainerTest.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/ContainerTest.java?view=diff&rev=447933&p1=geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/ContainerTest.java&r1=447903&p2=geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/ContainerTest.java&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/ContainerTest.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/ContainerTest.java Tue Sep 19 12:17:10 2006
@@ -15,14 +15,14 @@
* limitations under the License.
*/
-package org.apache.geronimo.jetty;
+package org.apache.geronimo.jetty6;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
-import org.apache.geronimo.jetty.app.MockWebServiceContainer;
+import org.apache.geronimo.jetty6.app.MockWebServiceContainer;
/**
* @version $Rev$ $Date$
Copied: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/SecurityTest.java (from r447903, geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/SecurityTest.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/SecurityTest.java?view=diff&rev=447933&p1=geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/SecurityTest.java&r1=447903&p2=geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/SecurityTest.java&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty/SecurityTest.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/SecurityTest.java Tue Sep 19 12:17:10 2006
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.geronimo.jetty;
+package org.apache.geronimo.jetty6;
import java.io.BufferedReader;
import java.io.IOException;
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/app/MockWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/app/MockWebServiceContainer.java?view=diff&rev=447933&r1=447903&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/app/MockWebServiceContainer.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/app/MockWebServiceContainer.java Tue Sep 19 12:17:10 2006
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.jetty.app;
+package org.apache.geronimo.jetty6.app;
import org.apache.geronimo.webservices.WebServiceContainer;
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/connector/HTTPConnectorTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/connector/HTTPConnectorTest.java?view=diff&rev=447933&r1=447903&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/connector/HTTPConnectorTest.java (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/java/org/apache/geronimo/jetty6/connector/HTTPConnectorTest.java Tue Sep 19 12:17:10 2006
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.geronimo.jetty.connector;
+package org.apache.geronimo.jetty6.connector;
import java.net.UnknownHostException;
import java.net.InetSocketAddress;
Modified: geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/resources/services/local.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/resources/services/local.xml?view=diff&rev=447933&r1=447932&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/resources/services/local.xml (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-jetty6/src/test/resources/services/local.xml Tue Sep 19 12:17:10 2006
@@ -1,8 +1,8 @@
<gbeans>
- <gbean class="org.apache.geronimo.jetty.JettyContainerImpl" objectName="geronimo.web:type=WebContainer,container=Jetty">
+ <gbean class="org.apache.geronimo.jetty6.JettyContainerImpl" objectName="geronimo.web:type=WebContainer,container=Jetty">
</gbean>
- <gbean class="org.apache.geronimo.jetty.connector.HTTPConnector" objectName="geronimo.web:type=WebConnector,container=Jetty,port=8080">
+ <gbean class="org.apache.geronimo.jetty6.connector.HTTPConnector" objectName="geronimo.web:type=WebConnector,container=Jetty,port=8080">
<default attribute="Port">5678</default>
<endpoint name="JettyContainer">
<pattern><gbean-name>geronimo.web:type=WebContainer,container=Jetty</gbean-name></pattern>
Copied: geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/pom.xml (from r446966, geronimo/server/trunk/modules/geronimo-web-builder/pom.xml)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/pom.xml?view=diff&rev=447933&p1=geronimo/server/trunk/modules/geronimo-web-builder/pom.xml&r1=446966&p2=geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/pom.xml&r2=447933
==============================================================================
--- geronimo/server/trunk/modules/geronimo-web-builder/pom.xml (original)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/pom.xml Tue Sep 19 12:17:10 2006
@@ -23,96 +23,41 @@
<parent>
<groupId>org.apache.geronimo.modules</groupId>
- <artifactId>modules</artifactId>
+ <artifactId>modules-jee5</artifactId>
<version>1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>geronimo-web-builder</artifactId>
- <name>Geronimo :: Web :: Builder</name>
+ <artifactId>geronimo-web-2.5-builder</artifactId>
+ <name>Geronimo :: Web 2.5 :: Builder</name>
<dependencies>
<dependency>
<groupId>${pom.groupId}</groupId>
- <artifactId>geronimo-j2ee-builder</artifactId>
+ <artifactId>geronimo-web-builder</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>geronimo-security-builder</artifactId>
- <version>${pom.version}</version>
- </dependency>
-
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>geronimo-service-builder</artifactId>
- <version>${pom.version}</version>
- </dependency>
-
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>geronimo-naming-builder</artifactId>
- <version>${pom.version}</version>
+ <groupId>org.apache.geronimo.schema</groupId>
+ <artifactId>geronimo-schema-jee_5</artifactId>
</dependency>
-
<dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>geronimo-test-ddbean</artifactId>
- <version>${pom.version}</version>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
</dependency>
- <!-- might not be needed -->
<dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>geronimo-j2ee</artifactId>
- <version>${pom.version}</version>
+ <groupId>org.apache.geronimo.testsupport</groupId>
+ <artifactId>testsupport-common</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-servlet_2.4_spec</artifactId>
- </dependency>
-
</dependencies>
<build>
<plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>xmlbeans-maven-plugin</artifactId>
- <configuration>
- <sourceSchemas>geronimo-web-1.2.xsd</sourceSchemas>
- </configuration>
- </plugin>
-
- <!--
- HACK: Copy the generated XmlBeans bits for clover
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-resources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <mkdir dir="${pom.basedir}/target/clover/classes"/>
- <copy todir="${pom.basedir}/target/clover/classes">
- <fileset dir="${pom.basedir}/target/classes">
- <include name="schemaorg_apache_xmlbeans/**"/>
- </fileset>
- </copy>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
Added: geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java?view=auto&rev=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java (added)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java Tue Sep 19 12:17:10 2006
@@ -0,0 +1,739 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.web25.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+import javax.security.jacc.WebResourcePermission;
+import javax.security.jacc.WebRoleRefPermission;
+import javax.security.jacc.WebUserDataPermission;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection;
+import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
+import org.apache.geronimo.deployment.xbeans.ServiceDocument;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.geronimo.j2ee.deployment.Module;
+import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
+import org.apache.geronimo.j2ee.deployment.NamingBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.security.jacc.ComponentPermissions;
+import org.apache.geronimo.security.util.URLPattern;
+import org.apache.geronimo.xbeans.javaee.FilterMappingType;
+import org.apache.geronimo.xbeans.javaee.RoleNameType;
+import org.apache.geronimo.xbeans.javaee.SecurityConstraintType;
+import org.apache.geronimo.xbeans.javaee.SecurityRoleRefType;
+import org.apache.geronimo.xbeans.javaee.SecurityRoleType;
+import org.apache.geronimo.xbeans.javaee.ServletMappingType;
+import org.apache.geronimo.xbeans.javaee.ServletType;
+import org.apache.geronimo.xbeans.javaee.UrlPatternType;
+import org.apache.geronimo.xbeans.javaee.WebAppType;
+import org.apache.geronimo.xbeans.javaee.WebResourceCollectionType;
+import org.apache.geronimo.xbeans.javaee.WebAppDocument;
+import org.apache.geronimo.xbeans.geronimo.j2ee.GerSecurityDocument;
+import org.apache.geronimo.schema.SchemaConversionUtils;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlDocumentProperties;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractWebModuleBuilder implements ModuleBuilder {
+ private static final Log log = LogFactory.getLog(AbstractWebModuleBuilder.class);
+
+ private static final QName TAGLIB = new QName(SchemaConversionUtils.JAVAEE_NAMESPACE, "taglib");
+
+ private static final String LINE_SEP = System.getProperty("line.separator");
+
+ protected static final AbstractNameQuery MANAGED_CONNECTION_FACTORY_PATTERN;
+ private static final AbstractNameQuery ADMIN_OBJECT_PATTERN;
+ protected static final AbstractNameQuery STATELESS_SESSION_BEAN_PATTERN;
+ protected static final AbstractNameQuery STATEFUL_SESSION_BEAN_PATTERN;
+ protected static final AbstractNameQuery ENTITY_BEAN_PATTERN;
+ protected final Kernel kernel;
+ protected final NamespaceDrivenBuilderCollection securityBuilders;
+ protected final NamespaceDrivenBuilderCollection serviceBuilders;
+
+ protected final NamingBuilder namingBuilders;
+
+ private static final QName SECURITY_QNAME = GerSecurityDocument.type.getDocumentElementName();
+ private static final QName SERVICE_QNAME = ServiceDocument.type.getDocumentElementName();
+
+ /**
+ * Manifest classpath entries in a war configuration must be resolved relative to the war configuration, not the
+ * enclosing ear configuration. Resolving relative to he war configuration using this offset produces the same
+ * effect as URI.create(module.targetPath()).resolve(mcpEntry) executed in the ear configuration.
+ */
+ private static final URI RELATIVE_MODULE_BASE_URI = URI.create("../");
+
+ protected AbstractWebModuleBuilder(Kernel kernel, Collection securityBuilders, Collection serviceBuilders, NamingBuilder namingBuilders) {
+ this.kernel = kernel;
+ this.securityBuilders = new NamespaceDrivenBuilderCollection(securityBuilders);
+ this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
+ this.namingBuilders = namingBuilders;
+
+ }
+
+ static {
+ MANAGED_CONNECTION_FACTORY_PATTERN = new AbstractNameQuery(null, Collections.singletonMap(NameFactory.J2EE_TYPE, NameFactory.JCA_MANAGED_CONNECTION_FACTORY));
+ ADMIN_OBJECT_PATTERN = new AbstractNameQuery(null, Collections.singletonMap(NameFactory.J2EE_TYPE, NameFactory.JCA_ADMIN_OBJECT));
+ STATELESS_SESSION_BEAN_PATTERN = new AbstractNameQuery(null, Collections.singletonMap(NameFactory.J2EE_TYPE, NameFactory.STATELESS_SESSION_BEAN));
+ STATEFUL_SESSION_BEAN_PATTERN = new AbstractNameQuery(null, Collections.singletonMap(NameFactory.J2EE_TYPE, NameFactory.STATEFUL_SESSION_BEAN));
+ ENTITY_BEAN_PATTERN = new AbstractNameQuery(null, Collections.singletonMap(NameFactory.J2EE_TYPE, NameFactory.ENTITY_BEAN));
+
+ }
+
+ public NamingBuilder getNamingBuilders() {
+ return namingBuilders;
+ }
+
+ //TODO configid these need to be converted to ReferencePatterns
+ protected Set findGBeanDependencies(EARContext earContext) {
+ Set dependencies = new HashSet();
+ dependencies.addAll(earContext.listGBeans(MANAGED_CONNECTION_FACTORY_PATTERN));
+ dependencies.addAll(earContext.listGBeans(ADMIN_OBJECT_PATTERN));
+ dependencies.addAll(earContext.listGBeans(STATELESS_SESSION_BEAN_PATTERN));
+ dependencies.addAll(earContext.listGBeans(STATEFUL_SESSION_BEAN_PATTERN));
+ dependencies.addAll(earContext.listGBeans(ENTITY_BEAN_PATTERN));
+ return dependencies;
+ }
+
+ public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+ return createModule(plan, moduleFile, ".", null, true, null, null, naming, idBuilder);
+ }
+
+ public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+ return createModule(plan, moduleFile, targetPath, specDDUrl, false, (String) moduleContextInfo, earName, naming, idBuilder);
+ }
+
+ protected abstract Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException;
+
+ /**
+ * Some servlets will have multiple url patterns. However, webservice servlets
+ * will only have one, which is what this method is intended for.
+ *
+ * @param webApp
+ * @param contextRoot
+ * @return map of servlet names to path mapped to them. Possibly inaccurate except for web services.
+ */
+ protected Map buildServletNameToPathMap(WebAppType webApp, String contextRoot) {
+ contextRoot = "/" + contextRoot;
+ Map map = new HashMap();
+ ServletMappingType[] servletMappings = webApp.getServletMappingArray();
+ for (int j = 0; j < servletMappings.length; j++) {
+ ServletMappingType servletMapping = servletMappings[j];
+ String servletName = servletMapping.getServletName().getStringValue().trim();
+ UrlPatternType[] urlPatterns = servletMapping.getUrlPatternArray();
+
+ for (int i=0; urlPatterns != null && (i < urlPatterns.length); i++) {
+ map.put(servletName, contextRoot +urlPatterns[i].getStringValue().trim());
+ }
+ }
+ return map;
+ }
+
+ protected String determineDefaultContextRoot(WebAppType webApp, boolean isStandAlone, JarFile moduleFile, String targetPath) {
+
+ if (webApp != null && webApp.getId() != null) {
+ return webApp.getId();
+ }
+
+ if (isStandAlone) {
+ // default configId is based on the moduleFile name
+ return trimPath(new File(moduleFile.getName()).getName());
+ }
+
+ // default configId is based on the module uri from the application.xml
+ return trimPath(targetPath);
+ }
+
+ private String trimPath(String path) {
+
+ if (path == null) {
+ return null;
+ }
+
+ if (path.endsWith(".war")) {
+ path = path.substring(0, path.length() - 4);
+ }
+ if (path.endsWith("/")) {
+ path = path.substring(0, path.length() - 1);
+ }
+
+ return path;
+ }
+
+ public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repositories) throws DeploymentException {
+ EARContext moduleContext;
+ if (module.isStandAlone()) {
+ moduleContext = earContext;
+ } else {
+ Environment environment = module.getEnvironment();
+ Artifact earConfigId = earContext.getConfigID();
+ Artifact configId = new Artifact(earConfigId.getGroupId(), earConfigId.getArtifactId() + "_" + module.getTargetPath(), earConfigId.getVersion(), "car");
+ environment.setConfigId(configId);
+ environment.addDependency(earConfigId, ImportType.ALL);
+ File configurationDir = new File(earContext.getBaseDir(), module.getTargetPath());
+ configurationDir.mkdirs();
+
+ // construct the web app deployment context... this is the same class used by the ear context
+ try {
+ File inPlaceConfigurationDir = null;
+ if (null != earContext.getInPlaceConfigurationDir()) {
+ inPlaceConfigurationDir = new File(earContext.getInPlaceConfigurationDir(), module.getTargetPath());
+ }
+ moduleContext = new EARContext(configurationDir,
+ inPlaceConfigurationDir,
+ environment,
+ ConfigurationModuleType.WAR,
+ module.getModuleName(),
+ earContext);
+ } catch (DeploymentException e) {
+ cleanupConfigurationDir(configurationDir);
+ throw e;
+ }
+ }
+ module.setEarContext(moduleContext);
+ module.setRootEarContext(earContext);
+
+ try {
+ // add the warfile's content to the configuration
+ JarFile warFile = module.getModuleFile();
+ Enumeration entries = warFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = (ZipEntry) entries.nextElement();
+ URI targetPath = new URI(null, entry.getName(), null);
+ if (entry.getName().equals("WEB-INF/web.xml")) {
+ moduleContext.addFile(targetPath, module.getOriginalSpecDD());
+ } else if (entry.getName().startsWith("WEB-INF/lib") && entry.getName().endsWith(".jar")) {
+ moduleContext.addInclude(targetPath, warFile, entry);
+ } else {
+ moduleContext.addFile(targetPath, warFile, entry);
+ }
+ }
+
+ //always add WEB-INF/classes to the classpath regardless of whether
+ //any classes exist
+ moduleContext.getConfiguration().addToClassPath("WEB-INF/classes/");
+
+ // add the manifest classpath entries declared in the war to the class loader
+ // we have to explicitly add these since we are unpacking the web module
+ // and the url class loader will not pick up a manifest from an unpacked dir
+ moduleContext.addManifestClassPath(warFile, RELATIVE_MODULE_BASE_URI);
+
+ } catch (IOException e) {
+ throw new DeploymentException("Problem deploying war", e);
+ } catch (URISyntaxException e) {
+ throw new DeploymentException("Could not construct URI for location of war entry", e);
+ } finally {
+ if (!module.isStandAlone()) {
+ try {
+ moduleContext.flush();
+ } catch (IOException e) {
+ throw new DeploymentException("Problem closing war context", e);
+ }
+ }
+ }
+ }
+
+ protected WebAppDocument convertToServletSchema(XmlObject xmlObject) throws XmlException {
+
+ String schemaLocationURL = "http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
+ String version = "2.5";
+ XmlCursor cursor = xmlObject.newCursor();
+ try {
+ cursor.toStartDoc();
+ cursor.toFirstChild();
+ if ("http://java.sun.com/xml/ns/j2ee".equals(cursor.getName().getNamespaceURI())) {
+ SchemaConversionUtils.convertSchemaVersion(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version);
+ XmlObject result = xmlObject.changeType(WebAppDocument.type);
+ XmlBeansUtil.validateDD(result);
+ return (WebAppDocument) result;
+ }
+
+ if ("http://java.sun.com/xml/ns/javaee".equals(cursor.getName().getNamespaceURI())) {
+ SchemaConversionUtils.convertSchemaVersion(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version);
+ XmlObject result = xmlObject.changeType(WebAppDocument.type);
+ XmlBeansUtil.validateDD(result);
+ return (WebAppDocument) result;
+ }
+
+ //otherwise assume DTD
+ XmlDocumentProperties xmlDocumentProperties = cursor.documentProperties();
+ String publicId = xmlDocumentProperties.getDoctypePublicId();
+ if ("-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN".equals(publicId) ||
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN".equals(publicId)) {
+ XmlCursor moveable = xmlObject.newCursor();
+ try {
+ moveable.toStartDoc();
+ moveable.toFirstChild();
+
+ SchemaConversionUtils.convertToSchema(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version);
+ cursor.toStartDoc();
+ cursor.toChild(SchemaConversionUtils.JAVAEE_NAMESPACE, "web-app");
+ cursor.toFirstChild();
+ SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
+ SchemaConversionUtils.convertToJNDIEnvironmentRefsGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
+ cursor.push();
+ if (cursor.toNextSibling(TAGLIB)) {
+ cursor.toPrevSibling();
+ moveable.toCursor(cursor);
+ cursor.beginElement("jsp-config", SchemaConversionUtils.JAVAEE_NAMESPACE);
+ while (moveable.toNextSibling(TAGLIB)) {
+ moveable.moveXml(cursor);
+ }
+ }
+ cursor.pop();
+ do {
+ String name = cursor.getName().getLocalPart();
+ if ("filter".equals(name) || "servlet".equals(name) || "context-param".equals(name)) {
+ cursor.push();
+ cursor.toFirstChild();
+ SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
+ while (cursor.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "init-param")) {
+ cursor.push();
+ cursor.toFirstChild();
+ SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
+ cursor.pop();
+ }
+ cursor.pop();
+ }
+ } while (cursor.toNextSibling());
+ } finally {
+ moveable.dispose();
+ }
+ }
+ } finally {
+ cursor.dispose();
+ }
+ XmlObject result = xmlObject.changeType(WebAppDocument.type);
+ if (result != null) {
+ XmlBeansUtil.validateDD(result);
+ return (WebAppDocument) result;
+ }
+ XmlBeansUtil.validateDD(xmlObject);
+ return (WebAppDocument) xmlObject;
+ }
+
+
+ protected void addUnmappedJSPPermissions(Set securityRoles, Map rolePermissions) {
+ for (Iterator iter = securityRoles.iterator(); iter.hasNext();) {
+ String roleName = (String) iter.next();
+ addPermissionToRole(roleName, new WebRoleRefPermission("", roleName), rolePermissions);
+ }
+ }
+
+ protected ComponentPermissions buildSpecSecurityConfig(WebAppType webApp, Set securityRoles, Map rolePermissions) {
+ Map uncheckedPatterns = new HashMap();
+ Map uncheckedResourcePatterns = new HashMap();
+ Map uncheckedUserPatterns = new HashMap();
+ Map excludedPatterns = new HashMap();
+ Map rolesPatterns = new HashMap();
+ Set allSet = new HashSet(); // == allMap.values()
+ Map allMap = new HashMap(); //uncheckedPatterns union excludedPatterns union rolesPatterns.
+
+ SecurityConstraintType[] securityConstraintArray = webApp.getSecurityConstraintArray();
+ for (int i = 0; i < securityConstraintArray.length; i++) {
+ SecurityConstraintType securityConstraintType = securityConstraintArray[i];
+ Map currentPatterns;
+ if (securityConstraintType.isSetAuthConstraint()) {
+ if (securityConstraintType.getAuthConstraint().getRoleNameArray().length == 0) {
+ currentPatterns = excludedPatterns;
+ } else {
+ currentPatterns = rolesPatterns;
+ }
+ } else {
+ currentPatterns = uncheckedPatterns;
+ }
+
+ String transport = "";
+ if (securityConstraintType.isSetUserDataConstraint()) {
+ transport = securityConstraintType.getUserDataConstraint().getTransportGuarantee().getStringValue().trim().toUpperCase();
+ }
+
+ WebResourceCollectionType[] webResourceCollectionTypeArray = securityConstraintType.getWebResourceCollectionArray();
+ for (int j = 0; j < webResourceCollectionTypeArray.length; j++) {
+ WebResourceCollectionType webResourceCollectionType = webResourceCollectionTypeArray[j];
+ UrlPatternType[] urlPatternTypeArray = webResourceCollectionType.getUrlPatternArray();
+ for (int k = 0; k < urlPatternTypeArray.length; k++) {
+ UrlPatternType urlPatternType = urlPatternTypeArray[k];
+ String url = urlPatternType.getStringValue().trim();
+ URLPattern pattern = (URLPattern) currentPatterns.get(url);
+ if (pattern == null) {
+ pattern = new URLPattern(url);
+ currentPatterns.put(url, pattern);
+ }
+
+ URLPattern allPattern = (URLPattern) allMap.get(url);
+ if (allPattern == null) {
+ allPattern = new URLPattern(url);
+ allSet.add(allPattern);
+ allMap.put(url, allPattern);
+ }
+
+ String[] httpMethodTypeArray = webResourceCollectionType.getHttpMethodArray();
+ if (httpMethodTypeArray.length == 0) {
+ pattern.addMethod("");
+ allPattern.addMethod("");
+ } else {
+ for (int l = 0; l < httpMethodTypeArray.length; l++) {
+ //TODO is trim OK?
+ String method = (httpMethodTypeArray[l]==null?null:httpMethodTypeArray[l].trim());
+ if (method != null) {
+ pattern.addMethod(method);
+ allPattern.addMethod(method);
+ }
+ }
+ }
+ if (currentPatterns == rolesPatterns) {
+ RoleNameType[] roleNameTypeArray = securityConstraintType.getAuthConstraint().getRoleNameArray();
+ for (int l = 0; l < roleNameTypeArray.length; l++) {
+ RoleNameType roleNameType = roleNameTypeArray[l];
+ String role = roleNameType.getStringValue().trim();
+ if (role.equals("*")) {
+ pattern.addAllRoles(securityRoles);
+ } else {
+ pattern.addRole(role);
+ }
+ }
+ }
+
+ pattern.setTransport(transport);
+ }
+ }
+ }
+
+ PermissionCollection excludedPermissions = new Permissions();
+ PermissionCollection uncheckedPermissions = new Permissions();
+
+ Iterator iter = excludedPatterns.keySet().iterator();
+ while (iter.hasNext()) {
+ URLPattern pattern = (URLPattern) excludedPatterns.get(iter.next());
+ String name = pattern.getQualifiedPattern(allSet);
+ String actions = pattern.getMethods();
+
+ excludedPermissions.add(new WebResourcePermission(name, actions));
+ excludedPermissions.add(new WebUserDataPermission(name, actions));
+ }
+
+ iter = rolesPatterns.keySet().iterator();
+ while (iter.hasNext()) {
+ URLPattern pattern = (URLPattern) rolesPatterns.get(iter.next());
+ String name = pattern.getQualifiedPattern(allSet);
+ String actions = pattern.getMethods();
+ WebResourcePermission permission = new WebResourcePermission(name, actions);
+
+ for (Iterator names = pattern.getRoles().iterator(); names.hasNext();) {
+ String roleName = (String) names.next();
+ addPermissionToRole(roleName, permission, rolePermissions);
+ }
+ }
+
+ iter = uncheckedPatterns.keySet().iterator();
+ while (iter.hasNext()) {
+ URLPattern pattern = (URLPattern) uncheckedPatterns.get(iter.next());
+ String name = pattern.getQualifiedPattern(allSet);
+ String actions = pattern.getMethods();
+
+ addOrUpdatePattern(uncheckedResourcePatterns, name, actions);
+ }
+
+ iter = rolesPatterns.keySet().iterator();
+ while (iter.hasNext()) {
+ URLPattern pattern = (URLPattern) rolesPatterns.get(iter.next());
+ String name = pattern.getQualifiedPattern(allSet);
+ String actions = pattern.getMethodsWithTransport();
+
+ addOrUpdatePattern(uncheckedUserPatterns, name, actions);
+ }
+
+ iter = uncheckedPatterns.keySet().iterator();
+ while (iter.hasNext()) {
+ URLPattern pattern = (URLPattern) uncheckedPatterns.get(iter.next());
+ String name = pattern.getQualifiedPattern(allSet);
+ String actions = pattern.getMethodsWithTransport();
+
+ addOrUpdatePattern(uncheckedUserPatterns, name, actions);
+ }
+
+ /**
+ * A <code>WebResourcePermission</code> and a <code>WebUserDataPermission</code> must be instantiated for
+ * each <tt>url-pattern</tt> in the deployment descriptor and the default pattern "/", that is not combined
+ * by the <tt>web-resource-collection</tt> elements of the deployment descriptor with ever HTTP method
+ * value. The permission objects must be contructed using the qualified pattern as their name and with
+ * actions defined by the subset of the HTTP methods that do not occur in combination with the pattern.
+ * The resulting permissions that must be added to the unchecked policy statements by calling the
+ * <code>addToUncheckedPolcy</code> method on the <code>PolicyConfiguration</code> object.
+ */
+ iter = allSet.iterator();
+ while (iter.hasNext()) {
+ URLPattern pattern = (URLPattern) iter.next();
+ String name = pattern.getQualifiedPattern(allSet);
+ String actions = pattern.getComplementedMethods();
+
+ if (actions.length() == 0) {
+ continue;
+ }
+
+ addOrUpdatePattern(uncheckedResourcePatterns, name, actions);
+ addOrUpdatePattern(uncheckedUserPatterns, name, actions);
+ }
+
+ URLPattern pattern = new URLPattern("/");
+ if (!allSet.contains(pattern)) {
+ String name = pattern.getQualifiedPattern(allSet);
+ String actions = pattern.getComplementedMethods();
+
+ addOrUpdatePattern(uncheckedResourcePatterns, name, actions);
+ addOrUpdatePattern(uncheckedUserPatterns, name, actions);
+ }
+
+ //Create the uncheckedPermissions for WebResourcePermissions
+ iter = uncheckedResourcePatterns.keySet().iterator();
+ while (iter.hasNext()) {
+ UncheckedItem item = (UncheckedItem) iter.next();
+ String actions = (String) uncheckedResourcePatterns.get(item);
+
+ uncheckedPermissions.add(new WebResourcePermission(item.getName(), actions));
+ }
+ //Create the uncheckedPermissions for WebUserDataPermissions
+ iter = uncheckedUserPatterns.keySet().iterator();
+ while (iter.hasNext()) {
+ UncheckedItem item = (UncheckedItem) iter.next();
+ String actions = (String) uncheckedUserPatterns.get(item);
+
+ uncheckedPermissions.add(new WebUserDataPermission(item.getName(), actions));
+ }
+
+ return new ComponentPermissions(excludedPermissions, uncheckedPermissions, rolePermissions);
+
+ }
+
+ protected void addPermissionToRole(String roleName, Permission permission, Map rolePermissions) {
+ PermissionCollection permissionsForRole = (PermissionCollection) rolePermissions.get(roleName);
+ if (permissionsForRole == null) {
+ permissionsForRole = new Permissions();
+ rolePermissions.put(roleName, permissionsForRole);
+ }
+ permissionsForRole.add(permission);
+ }
+
+ private void addOrUpdatePattern(Map patternMap, String name, String actions) {
+ UncheckedItem item = new UncheckedItem(name, actions);
+ String existingActions = (String) patternMap.get(item);
+ if (existingActions != null) {
+ patternMap.put(item, actions + "," + existingActions);
+ return;
+ }
+
+ patternMap.put(item, actions);
+ }
+
+ protected static Set collectRoleNames(WebAppType webApp) {
+ Set roleNames = new HashSet();
+
+ SecurityRoleType[] securityRoles = webApp.getSecurityRoleArray();
+ for (int i = 0; i < securityRoles.length; i++) {
+ roleNames.add(securityRoles[i].getRoleName().getStringValue().trim());
+ }
+
+ return roleNames;
+ }
+
+ protected static void check(WebAppType webApp) throws DeploymentException {
+ checkURLPattern(webApp);
+ checkMultiplicities(webApp);
+ }
+
+ private static void checkURLPattern(WebAppType webApp) throws DeploymentException {
+
+ FilterMappingType[] filterMappings = webApp.getFilterMappingArray();
+ for (int i = 0; i < filterMappings.length; i++) {
+ UrlPatternType[] urlPatterns = filterMappings[i].getUrlPatternArray();
+ for (int j=0; (urlPatterns != null) && (j < urlPatterns.length); j++) {
+ checkString(urlPatterns[j].getStringValue().trim());
+ }
+ }
+
+ ServletMappingType[] servletMappings = webApp.getServletMappingArray();
+ for (int i = 0; i < servletMappings.length; i++) {
+ UrlPatternType[] urlPatterns = servletMappings[i].getUrlPatternArray();
+ for (int j=0; (urlPatterns != null) && (j < urlPatterns.length); j++) {
+ checkString(urlPatterns[j].getStringValue().trim());
+ }
+ }
+
+ SecurityConstraintType[] constraints = webApp.getSecurityConstraintArray();
+ for (int i = 0; i < constraints.length; i++) {
+ WebResourceCollectionType[] collections = constraints[i].getWebResourceCollectionArray();
+ for (int j = 0; j < collections.length; j++) {
+ UrlPatternType[] patterns = collections[j].getUrlPatternArray();
+ for (int k = 0; k < patterns.length; k++) {
+ checkString(patterns[k].getStringValue().trim());
+ }
+ }
+ }
+ }
+
+ protected static void checkString(String pattern) throws DeploymentException {
+ //j2ee_1_4.xsd explicitly requires preserving all whitespace. Do not trim.
+ if (pattern.indexOf(0x0D) >= 0) throw new DeploymentException("<url-pattern> must not contain CR(#xD)");
+ if (pattern.indexOf(0x0A) >= 0) throw new DeploymentException("<url-pattern> must not contain LF(#xA)");
+ }
+
+ private static void checkMultiplicities(WebAppType webApp) throws DeploymentException {
+ if (webApp.getSessionConfigArray().length > 1) throw new DeploymentException("Multiple <session-config> elements found");
+ if (webApp.getJspConfigArray().length > 1) throw new DeploymentException("Multiple <jsp-config> elements found");
+ if (webApp.getLoginConfigArray().length > 1) throw new DeploymentException("Multiple <login-config> elements found");
+ }
+
+ private boolean cleanupConfigurationDir(File configurationDir)
+ {
+ LinkedList cannotBeDeletedList = new LinkedList();
+
+ if (!DeploymentUtil.recursiveDelete(configurationDir,cannotBeDeletedList)) {
+ // Output a message to help user track down file problem
+ log.warn("Unable to delete " + cannotBeDeletedList.size() +
+ " files while recursively deleting directory "
+ + configurationDir + LINE_SEP +
+ "The first file that could not be deleted was:" + LINE_SEP + " "+
+ ( !cannotBeDeletedList.isEmpty() ? cannotBeDeletedList.getFirst() : "") );
+ return false;
+ }
+ return true;
+ }
+
+ protected void processRoleRefPermissions(ServletType servletType, Set securityRoles, Map rolePermissions) {
+ String servletName = servletType.getServletName().getStringValue().trim();
+ //WebRoleRefPermissions
+ SecurityRoleRefType[] securityRoleRefTypeArray = servletType.getSecurityRoleRefArray();
+ Set unmappedRoles = new HashSet(securityRoles);
+ for (int j = 0; j < securityRoleRefTypeArray.length; j++) {
+ SecurityRoleRefType securityRoleRefType = securityRoleRefTypeArray[j];
+ String roleName = securityRoleRefType.getRoleName().getStringValue().trim();
+ String roleLink = securityRoleRefType.getRoleLink().getStringValue().trim();
+ //jacc 3.1.3.2
+ /* The name of the WebRoleRefPermission must be the servlet-name in whose
+ * context the security-role-ref is defined. The actions of the WebRoleRefPermission
+ * must be the value of the role-name (that is the reference), appearing in the security-role-ref.
+ * The deployment tools must call the addToRole method on the PolicyConfiguration object to add the
+ * WebRoleRefPermission object resulting from the translation to the role
+ * identified in the role-link appearing in the security-role-ref.
+ */
+ addPermissionToRole(roleLink, new WebRoleRefPermission(servletName, roleName), rolePermissions);
+ unmappedRoles.remove(roleName);
+ }
+ for (Iterator iterator = unmappedRoles.iterator(); iterator.hasNext();) {
+ String roleName = (String) iterator.next();
+ addPermissionToRole(roleName, new WebRoleRefPermission(servletName, roleName), rolePermissions);
+ }
+// servletData.setAttribute("webRoleRefPermissions", webRoleRefPermissions);
+ }
+
+ protected void buildSubstitutionGroups(XmlObject gerWebApp, boolean hasSecurityRealmName, Module module, EARContext earContext) throws DeploymentException {
+ XmlObject[] securityElements = XmlBeansUtil.selectSubstitutionGroupElements(SECURITY_QNAME, gerWebApp);
+ if (securityElements.length > 0 && !hasSecurityRealmName) {
+ throw new DeploymentException("You have supplied a security configuration for web app " + module.getName() + " but no security-realm-name to allow login");
+ }
+ securityBuilders.build(gerWebApp, earContext, module.getEarContext());
+ serviceBuilders.build(gerWebApp, earContext, module.getEarContext());
+ }
+
+ class UncheckedItem {
+ final static int NA = 0x00;
+ final static int INTEGRAL = 0x01;
+ final static int CONFIDENTIAL = 0x02;
+
+ private int transportType = NA;
+ private String name;
+
+ public UncheckedItem(String name, String actions) {
+ setName(name);
+ setTransportType(actions);
+ }
+
+ public boolean equals(Object o) {
+ UncheckedItem item = (UncheckedItem) o;
+ return item.getKey().equals(this.getKey());
+ }
+
+ public String getKey() {
+ return (name + transportType);
+ }
+
+ public int hashCode() {
+ return getKey().hashCode();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getTransportType() {
+ return transportType;
+ }
+
+ public void setTransportType(String actions) {
+ String[] tokens = actions.split(":", 2);
+ if (tokens.length == 2) {
+ if (tokens[1].equals("INTEGRAL")) {
+ this.transportType = INTEGRAL;
+ } else if (tokens[1].equals("CONFIDENTIAL")) {
+ this.transportType = CONFIDENTIAL;
+ }
+ }
+ }
+ }
+}
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java?view=auto&rev=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java (added)
+++ geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java Tue Sep 19 12:17:10 2006
@@ -0,0 +1,152 @@
+/*
+ * 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.web25.deployment;
+
+import java.net.URL;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.jar.JarFile;
+
+import org.apache.geronimo.testsupport.XmlBeansTestSupport;
+import org.apache.geronimo.j2ee.deployment.Module;
+import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlOptions;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class SchemaConversionTest extends XmlBeansTestSupport {
+
+ private ClassLoader classLoader = this.getClass().getClassLoader();
+ private XmlOptions options = new XmlOptions();
+ private WebModuleBuilder webModuleBuilder = new WebModuleBuilder(null);
+
+ public void testWeb24To25Transform() throws Exception {
+ URL srcXml = classLoader.getResource("j2ee_1_4schema/web-2-24.xml");
+ URL expectedOutputXml = classLoader.getResource("javaee_5schema/web-2-25.xml");
+ XmlObject xmlObject = XmlObject.Factory.parse(srcXml, options);
+ xmlObject = webModuleBuilder.convertToServletSchema(xmlObject);
+ XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
+ System.out.println(xmlObject.toString());
+ System.out.println(expected.toString());
+ List problems = new ArrayList();
+ boolean ok = compareXmlObjects(xmlObject, expected, problems);
+ assertTrue("Differences: " + problems, ok);
+ xmlObject = webModuleBuilder.convertToServletSchema(xmlObject);
+ boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
+ assertTrue("Differences: " + problems, ok2);
+ }
+
+ public void testWeb23To25Transform() throws Exception {
+ URL srcXml = classLoader.getResource("j2ee_1_3dtd/web-23.xml");
+ URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/web-25.xml");
+ XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
+ xmlObject = webModuleBuilder.convertToServletSchema(xmlObject);
+ XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
+ System.out.println(xmlObject.toString());
+ System.out.println(expected.toString());
+ List problems = new ArrayList();
+ boolean ok = compareXmlObjects(xmlObject, expected, problems);
+ assertTrue("Differences: " + problems, ok);
+ xmlObject = webModuleBuilder.convertToServletSchema(xmlObject);
+ boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
+ assertTrue("Differences: " + problems, ok2);
+ }
+
+ public void testWeb23To25OtherTransform() throws Exception {
+ URL srcXml = classLoader.getResource("j2ee_1_3dtd/web-1-23.xml");
+ URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/web-1-25.xml");
+ XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
+ xmlObject = webModuleBuilder.convertToServletSchema(xmlObject);
+// System.out.println(xmlObject.toString());
+ XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
+ List problems = new ArrayList();
+ boolean ok = compareXmlObjects(xmlObject, expected, problems);
+ assertTrue("Differences: " + problems, ok);
+ xmlObject = webModuleBuilder.convertToServletSchema(xmlObject);
+ boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
+ assertTrue("Differences: " + problems, ok2);
+ }
+
+ public void testWeb22To25Transform1() throws Exception {
+ URL srcXml = classLoader.getResource("j2ee_1_2dtd/web-1-22.xml");
+ URL expectedOutputXml = classLoader.getResource("j2ee_1_2dtd/web-1-25.xml");
+ XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
+ xmlObject = webModuleBuilder.convertToServletSchema(xmlObject);
+ XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
+// System.out.println(xmlObject.toString());
+// System.out.println(expected.toString());
+ List problems = new ArrayList();
+ boolean ok = compareXmlObjects(xmlObject, expected, problems);
+ assertTrue("Differences: " + problems, ok);
+ xmlObject = webModuleBuilder.convertToServletSchema(xmlObject);
+ boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
+ assertTrue("Differences: " + problems, ok2);
+ }
+
+ public void testWebRejectBad25() throws Exception {
+ URL srcXml = classLoader.getResource("javaee_5schema/web-1-25.xml");
+ XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
+ try {
+ webModuleBuilder.convertToServletSchema(xmlObject);
+ fail("doc src/test-data/javaee_5schema/web-1-25.xml is invalid, should not have validated");
+ } catch (XmlException e) {
+ //expected
+ }
+ }
+
+ public void testParseWeb25() throws Exception {
+ URL srcXml = classLoader.getResource("javaee_5schema/web-2-25.xml");
+ XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
+ webModuleBuilder.convertToServletSchema(xmlObject);
+ }
+
+ private static class WebModuleBuilder extends AbstractWebModuleBuilder {
+
+ protected WebModuleBuilder(Kernel kernel) {
+ super(kernel, null, null, null);
+ }
+
+ protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, boolean standAlone, String contextRoot, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+ return null;
+ }
+
+ public void initContext(EARContext earContext, Module module, ClassLoader classLoader) throws DeploymentException {
+ }
+
+ public void addGBeans(EARContext earContext, Module module, ClassLoader classLoader, Collection repositories) throws DeploymentException {
+ }
+
+ public String getSchemaNamespace() {
+ return null;
+ }
+ }
+
+
+}
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/sandbox/javaee5/modules-jee5/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/sandbox/javaee5/modules-jee5/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/modules-jee5/pom.xml?view=diff&rev=447933&r1=447932&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/modules-jee5/pom.xml (original)
+++ geronimo/sandbox/javaee5/modules-jee5/pom.xml Tue Sep 19 12:17:10 2006
@@ -48,6 +48,8 @@
<module>geronimo-transaction-jta11</module>
<module>geronimo-persistence-jpa10</module>
<module>geronimo-jetty6</module>
+ <module>geronimo-web-2.5-builder</module>
+ <module>geronimo-jetty6-builder</module>
</modules>
</project>
Modified: geronimo/sandbox/javaee5/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/javaee5/pom.xml?view=diff&rev=447933&r1=447932&r2=447933
==============================================================================
--- geronimo/sandbox/javaee5/pom.xml (original)
+++ geronimo/sandbox/javaee5/pom.xml Tue Sep 19 12:17:10 2006
@@ -54,7 +54,7 @@
<tomcatVersion>5.5.15</tomcatVersion>
<!--
- HACK: Used by uddi-jetty and uddi-tomcat config plans
+ HACK: Used by uddi-jetty6 and uddi-tomcat config plans
-->
<tranqlVendorsVersion>1.1</tranqlVendorsVersion>
</properties>
@@ -64,6 +64,13 @@
<dependency>
+ <groupId>org.apache.geronimo.testsupport</groupId>
+ <artifactId>testsupport-common</artifactId>
+ <version>1.2-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
<version>1.0-SNAPSHOT</version>
@@ -76,9 +83,21 @@
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.schema</groupId>
+ <artifactId>geronimo-schema-jee_5</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
- <version>6.0-SNAPSHOT</version>
+ <version>6.1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ <version>6.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>