You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gd...@apache.org on 2007/12/11 09:34:00 UTC
svn commit: r603174 [2/3] - in /geronimo/server/trunk:
assemblies/geronimo-tomcat6-javaee5/
plugins/jetty/geronimo-jetty6-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty6/cluster/wadi/builder/
plugins/jetty/jetty6-clustering-builder-wad...
Added: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/LICENSE.txt?rev=603174&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/LICENSE.txt (added)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/LICENSE.txt Tue Dec 11 00:33:18 2007
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
Added: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/NOTICE.txt?rev=603174&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/NOTICE.txt (added)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/NOTICE.txt Tue Dec 11 00:33:18 2007
@@ -0,0 +1,5 @@
+Apache Geronimo
+Copyright 2003-2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
Added: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/pom.xml?rev=603174&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/pom.xml (added)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/pom.xml Tue Dec 11 00:33:18 2007
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+
+<!-- $Rev: 598023 $ $Date: 2007-11-26 05:08:16 +1100 (Mon, 26 Nov 2007) $ -->
+
+<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>
+
+ <parent>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>modules</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>geronimo-tomcat6-clustering-wadi</artifactId>
+ <name>Geronimo Modules :: Tomcat Clustering over WADI</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>geronimo-clustering-wadi</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>geronimo-tomcat6</artifactId>
+ <version>${version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
+
Added: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValve.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValve.java?rev=603174&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValve.java (added)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValve.java Tue Dec 11 00:33:18 2007
@@ -0,0 +1,319 @@
+/*
+ * 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.tomcat.cluster.wadi;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.FilterChain;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.geronimo.clustering.ClusteredInvocation;
+import org.apache.geronimo.clustering.ClusteredInvocationException;
+import org.apache.geronimo.tomcat.cluster.AbstractClusteredValve;
+import org.codehaus.wadi.core.contextualiser.InvocationException;
+import org.codehaus.wadi.core.manager.Manager;
+import org.codehaus.wadi.web.impl.WebInvocation;
+
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class WADIClusteredValve extends AbstractClusteredValve {
+ private final Manager wadiManager;
+
+ public WADIClusteredValve(Manager wadiManager) {
+ this.wadiManager = wadiManager;
+ }
+
+ protected ClusteredInvocation newClusteredInvocation(Request request, Response response) {
+ return new WADIWebClusteredInvocation(request, response);
+ }
+
+ protected class WADIWebClusteredInvocation extends WebClusteredInvocation {
+
+ public WADIWebClusteredInvocation(Request request, Response response) {
+ super(request, response);
+ }
+
+ public void invoke() throws ClusteredInvocationException {
+ WebInvocation invocation = new WebInvocation(5000);
+ FilterChain chainAdapter = new FilterChain() {
+ public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
+ try {
+ invokeLocally();
+ } catch (ClusteredInvocationException e) {
+ throw (IOException) new IOException().initCause(e);
+ }
+ }
+ };
+ invocation.init(null == request? NoOpHttpServletRequest.SINGLETON: request, response, chainAdapter);
+ try {
+ wadiManager.contextualise(invocation);
+ } catch (InvocationException e) {
+ Throwable throwable = e.getCause();
+ if (throwable instanceof IOException) {
+ throw new ClusteredInvocationException(throwable);
+ } else if (throwable instanceof ServletException) {
+ throw new ClusteredInvocationException(throwable);
+ } else {
+ throw new ClusteredInvocationException(e);
+ }
+ }
+ }
+ }
+
+ protected static class NoOpHttpServletRequest implements HttpServletRequest {
+ public static final NoOpHttpServletRequest SINGLETON = new NoOpHttpServletRequest();
+
+ public String getAuthType() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getContextPath() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Cookie[] getCookies() {
+ throw new UnsupportedOperationException();
+ }
+
+ public long getDateHeader(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getHeader(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Enumeration getHeaderNames() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Enumeration getHeaders(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getIntHeader(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getMethod() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getPathInfo() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getPathTranslated() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getQueryString() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getRemoteUser() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getRequestURI() {
+ throw new UnsupportedOperationException();
+ }
+
+ public StringBuffer getRequestURL() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getRequestedSessionId() {
+ return null;
+ }
+
+ public String getServletPath() {
+ throw new UnsupportedOperationException();
+ }
+
+ public HttpSession getSession() {
+ throw new UnsupportedOperationException();
+ }
+
+ public HttpSession getSession(boolean arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Principal getUserPrincipal() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isRequestedSessionIdFromCookie() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isRequestedSessionIdFromURL() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isRequestedSessionIdFromUrl() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isRequestedSessionIdValid() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isUserInRole(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getAttribute(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Enumeration getAttributeNames() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getCharacterEncoding() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getContentLength() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getContentType() {
+ throw new UnsupportedOperationException();
+ }
+
+ public ServletInputStream getInputStream() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getLocalAddr() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getLocalName() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getLocalPort() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Locale getLocale() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Enumeration getLocales() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getParameter(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Map getParameterMap() {
+ throw new UnsupportedOperationException();
+ }
+
+ public Enumeration getParameterNames() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String[] getParameterValues(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getProtocol() {
+ throw new UnsupportedOperationException();
+ }
+
+ public BufferedReader getReader() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getRealPath(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getRemoteAddr() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getRemoteHost() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getRemotePort() {
+ throw new UnsupportedOperationException();
+ }
+
+ public RequestDispatcher getRequestDispatcher(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getScheme() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getServerName() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getServerPort() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isSecure() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAttribute(String arg0) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setAttribute(String arg0, Object arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setCharacterEncoding(String arg0) throws UnsupportedEncodingException {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+
+}
Added: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValveRetriever.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValveRetriever.java?rev=603174&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValveRetriever.java (added)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-clustering-wadi/src/main/java/org/apache/geronimo/tomcat/cluster/wadi/WADIClusteredValveRetriever.java Tue Dec 11 00:33:18 2007
@@ -0,0 +1,78 @@
+/*
+ * 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.tomcat.cluster.wadi;
+
+import org.apache.geronimo.clustering.wadi.WADISessionManager;
+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.tomcat.ObjectRetriever;
+import org.codehaus.wadi.core.manager.Manager;
+
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class WADIClusteredValveRetriever implements ObjectRetriever, GBeanLifecycle {
+ private final WADISessionManager sessionManager;
+ private Manager wadiManager;
+
+ public WADIClusteredValveRetriever(WADISessionManager sessionManager) {
+ this.sessionManager = sessionManager;
+ }
+
+ public Object getInternalObject() {
+ return new WADIClusteredValve(wadiManager);
+ }
+
+ public void doStart() throws Exception {
+ wadiManager = sessionManager.getManager();
+ }
+
+ public void doStop() throws Exception {
+ }
+
+ public void doFail() {
+ }
+
+ public static final GBeanInfo GBEAN_INFO;
+ public static final String GBEAN_REF_WADI_SESSION_MANAGER = "WADISessionManager";
+
+ static {
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("WADI Clustered Valve Retriever",
+ WADIClusteredValveRetriever.class,
+ NameFactory.GERONIMO_SERVICE);
+
+ infoFactory.addReference(GBEAN_REF_WADI_SESSION_MANAGER,
+ WADISessionManager.class,
+ NameFactory.GERONIMO_SERVICE);
+
+ infoFactory.setConstructor(new String[]{GBEAN_REF_WADI_SESSION_MANAGER});
+
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+
+}
Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/pom.xml?rev=603174&r1=603173&r2=603174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/pom.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/pom.xml Tue Dec 11 00:33:18 2007
@@ -33,6 +33,11 @@
<name>Geronimo Modules :: Tomcat</name>
<dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-clustering</artifactId>
+ <version>${version}</version>
+ </dependency>
<!-- g-transaction, g-system comes from this -->
<dependency>
Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java?rev=603174&r1=603173&r2=603174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java Tue Dec 11 00:33:18 2007
@@ -138,6 +138,11 @@
//Set a UserTransactionBeforeAfter
interceptor = new UserTransactionBeforeAfter(interceptor, index++, ctx.getUserTransaction());
+ Valve clusteredValve = ctx.getClusteredValve();
+ if (null != clusteredValve) {
+ addValve(clusteredValve);
+ }
+
//Set the BeforeAfters as a valve
GeronimoBeforeAfterValve geronimoBAValve = new GeronimoBeforeAfterValve(interceptor, index);
addValve(geronimoBAValve);
Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java?rev=603174&r1=603173&r2=603174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java Tue Dec 11 00:33:18 2007
@@ -22,65 +22,65 @@
import javax.transaction.UserTransaction;
+import org.apache.InstanceManager;
import org.apache.catalina.Context;
import org.apache.catalina.Manager;
import org.apache.catalina.Realm;
-import org.apache.InstanceManager;
+import org.apache.catalina.Valve;
import org.apache.catalina.ha.CatalinaCluster;
import org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.tomcat.util.SecurityHolder;
-import org.apache.geronimo.security.credentialstore.CredentialStore;
/**
* @version $Rev$ $Date$
*/
public interface TomcatContext {
+ String getContextPath();
- public String getContextPath();
+ void setContext(Context ctx);
- public void setContext(Context ctx);
+ Context getContext();
- public Context getContext();
+ String getDocBase();
- public String getDocBase();
+ SecurityHolder getSecurityHolder();
- public SecurityHolder getSecurityHolder();
+ String getVirtualServer();
- public String getVirtualServer();
+ ClassLoader getClassLoader();
- public ClassLoader getClassLoader();
+ UserTransaction getUserTransaction();
- public UserTransaction getUserTransaction();
+ javax.naming.Context getJndiContext();
- public javax.naming.Context getJndiContext();
+ Kernel getKernel();
- public Kernel getKernel();
+ Set getApplicationManagedSecurityResources();
- public Set getApplicationManagedSecurityResources();
+ TrackedConnectionAssociator getTrackedConnectionAssociator();
- public TrackedConnectionAssociator getTrackedConnectionAssociator();
+ Set getUnshareableResources();
- public Set getUnshareableResources();
+ Realm getRealm();
- public Realm getRealm();
+ Valve getClusteredValve();
- public List getValveChain();
+ List getValveChain();
- public List getLifecycleListenerChain();
-
- public CatalinaCluster getCluster();
+ List getLifecycleListenerChain();
- public Manager getManager();
+ CatalinaCluster getCluster();
- public boolean isCrossContext();
+ Manager getManager();
- public String getWorkDir();
+ boolean isCrossContext();
- public boolean isDisableCookies();
+ String getWorkDir();
- public Map getWebServices();
+ boolean isDisableCookies();
- public InstanceManager getInstanceManager();
+ Map getWebServices();
+ InstanceManager getInstanceManager();
}
Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java?rev=603174&r1=603173&r2=603174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java Tue Dec 11 00:33:18 2007
@@ -17,7 +17,6 @@
package org.apache.geronimo.tomcat;
-import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
@@ -59,13 +58,11 @@
import org.apache.geronimo.management.J2EEApplication;
import org.apache.geronimo.management.J2EEServer;
import org.apache.geronimo.management.StatisticsProvider;
-import org.apache.geronimo.management.geronimo.WebConnector;
import org.apache.geronimo.management.geronimo.WebContainer;
import org.apache.geronimo.management.geronimo.WebModule;
import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
import org.apache.geronimo.security.jacc.RunAsSource;
import org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean;
-import org.apache.geronimo.tomcat.connector.TomcatWebConnector;
import org.apache.geronimo.tomcat.stats.ModuleStats;
import org.apache.geronimo.tomcat.util.SecurityHolder;
import org.apache.geronimo.transaction.GeronimoUserTransaction;
@@ -83,72 +80,45 @@
private static Log log = LogFactory.getLog(TomcatWebAppContext.class);
protected final TomcatContainer container;
-
private final ClassLoader classLoader;
-
protected Context context = null;
-
private String path = null;
-
private String docBase = null;
-
private String virtualServer = null;
-
private final Realm realm;
-
private final List valveChain;
-
private final List listenerChain;
-
private final CatalinaCluster catalinaCluster;
-
private final Manager manager;
-
private final boolean crossContext;
-
private final String workDir;
-
private final boolean disableCookies;
-
private final UserTransaction userTransaction;
-
private final javax.naming.Context componentContext;
-
private final Kernel kernel;
-
private final Set unshareableResources;
-
private final Set applicationManagedSecurityResources;
-
private final TrackedConnectionAssociator trackedConnectionAssociator;
-
private final SecurityHolder securityHolder;
-
private final RunAsSource runAsSource;
-
private final J2EEServer server;
-
private final Map webServices;
-
private final String objectName;
-
private final String originalSpecDD;
-
private final URL configurationBaseURL;
-
private final Holder holder;
-
private final RuntimeCustomizer contextCustomizer;
// JSR 77
-
private final String j2EEServer;
-
private final String j2EEApplication;
// statistics
private ModuleStats statsProvider;
private boolean reset = true;
+
+ private final Valve clusteredValve;
+
public TomcatWebAppContext(
ClassLoader classLoader,
String objectName,
@@ -164,10 +134,11 @@
TomcatContainer container,
RunAsSource runAsSource,
ObjectRetriever tomcatRealm,
+ ObjectRetriever clusteredValveRetriever,
ValveGBean tomcatValveChain,
LifecycleListenerGBean lifecycleListenerChain,
CatalinaClusterGBean cluster,
- ManagerGBean manager,
+ ObjectRetriever managerRetriever,
boolean crossContext,
String workDir,
boolean disableCookies,
@@ -178,7 +149,6 @@
J2EEApplication application,
Kernel kernel)
throws Exception {
-
assert classLoader != null;
assert configurationBaseUrl != null;
assert transactionManager != null;
@@ -186,6 +156,11 @@
assert componentContext != null;
assert container != null;
+ if (null != clusteredValveRetriever) {
+ clusteredValve = (Valve) clusteredValveRetriever.getInternalObject();
+ } else {
+ clusteredValve = null;
+ }
this.objectName = objectName;
URI root;
@@ -265,8 +240,8 @@
}
//Add the manager
- if (manager != null) {
- this.manager = (Manager) manager.getInternalObject();
+ if (managerRetriever != null) {
+ this.manager = (Manager) managerRetriever.getInternalObject();
} else {
this.manager = null;
}
@@ -424,6 +399,10 @@
return realm;
}
+ public Valve getClusteredValve() {
+ return clusteredValve;
+ }
+
public List getValveChain() {
return valveChain;
}
@@ -567,6 +546,8 @@
}
public static final GBeanInfo GBEAN_INFO;
+ public static final String GBEAN_REF_CLUSTERED_VALVE_RETRIEVER = "ClusteredValveRetriever";
+ public static final String GBEAN_REF_MANAGER_RETRIEVER = "ManagerRetriever";
static {
GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic("Tomcat WebApplication Context", TomcatWebAppContext.class, NameFactory.WEB_MODULE);
@@ -589,10 +570,11 @@
infoBuilder.addReference("Container", TomcatContainer.class, NameFactory.GERONIMO_SERVICE);
infoBuilder.addReference("RunAsSource", RunAsSource.class, NameFactory.JACC_MANAGER);
infoBuilder.addReference("TomcatRealm", ObjectRetriever.class);
+ infoBuilder.addReference(GBEAN_REF_CLUSTERED_VALVE_RETRIEVER, ObjectRetriever.class);
infoBuilder.addReference("TomcatValveChain", ValveGBean.class);
infoBuilder.addReference("LifecycleListenerChain", LifecycleListenerGBean.class, LifecycleListenerGBean.J2EE_TYPE);
infoBuilder.addReference("Cluster", CatalinaClusterGBean.class, CatalinaClusterGBean.J2EE_TYPE);
- infoBuilder.addReference("Manager", ManagerGBean.class);
+ infoBuilder.addReference(GBEAN_REF_MANAGER_RETRIEVER, ObjectRetriever.class);
infoBuilder.addAttribute("crossContext", boolean.class, true);
infoBuilder.addAttribute("workDir", String.class, true);
infoBuilder.addAttribute("disableCookies", boolean.class, true);
@@ -620,10 +602,11 @@
"Container",
"RunAsSource",
"TomcatRealm",
+ GBEAN_REF_CLUSTERED_VALVE_RETRIEVER,
"TomcatValveChain",
"LifecycleListenerChain",
"Cluster",
- "Manager",
+ GBEAN_REF_MANAGER_RETRIEVER,
"crossContext",
"workDir",
"disableCookies",
Added: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValve.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValve.java?rev=603174&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValve.java (added)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValve.java Tue Dec 11 00:33:18 2007
@@ -0,0 +1,84 @@
+/*
+ * 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.tomcat.cluster;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.catalina.valves.ValveBase;
+import org.apache.geronimo.clustering.ClusteredInvocation;
+import org.apache.geronimo.clustering.ClusteredInvocationException;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public abstract class AbstractClusteredValve extends ValveBase {
+
+ @Override
+ public void invoke(Request request, Response response) throws IOException, ServletException {
+ ClusteredInvocation invocation = newClusteredInvocation(request, response);
+ try {
+ invocation.invoke();
+ } catch (ClusteredInvocationException e) {
+ Throwable cause = e.getCause();
+ if (cause instanceof ServletException) {
+ throw (ServletException) cause;
+ } else if (cause instanceof IOException) {
+ throw (IOException) cause;
+ } else {
+ throw (IOException) new IOException().initCause(e);
+ }
+ }
+ }
+
+ protected abstract ClusteredInvocation newClusteredInvocation(Request request, Response response);
+
+ protected abstract class WebClusteredInvocation implements ClusteredInvocation {
+ protected final Request request;
+ protected final Response response;
+
+ protected WebClusteredInvocation(Request request, Response response) {
+ this.request = request;
+ this.response = response;
+ }
+
+ protected void invokeLocally() throws ClusteredInvocationException {
+ try {
+ next.invoke(request, response);
+ } catch (IOException e) {
+ throw new ClusteredInvocationException(e);
+ } catch (ServletException e) {
+ throw new ClusteredInvocationException(e);
+ }
+ }
+
+ public String getRequestedSessionId() {
+ if (null == request) {
+ return null;
+ }
+ return request.getRequestedSessionId();
+ }
+ }
+
+}
Added: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManager.java?rev=603174&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManager.java (added)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManager.java Tue Dec 11 00:33:18 2007
@@ -0,0 +1,128 @@
+/*
+ * 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.tomcat.cluster;
+
+import java.io.IOException;
+
+import org.apache.catalina.Session;
+import org.apache.catalina.session.StandardManager;
+import org.apache.catalina.session.StandardSession;
+import org.apache.geronimo.clustering.SessionAlreadyExistException;
+import org.apache.geronimo.clustering.SessionListener;
+import org.apache.geronimo.clustering.SessionManager;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class ClusteredManager extends StandardManager {
+ private final SessionManager sessionManager;
+
+ public ClusteredManager(SessionManager sessionManager) {
+ if (null == sessionManager) {
+ throw new IllegalArgumentException("sessionManager is required");
+ }
+ this.sessionManager = sessionManager;
+
+ sessionManager.registerListener(new MigrationListener());
+ }
+
+ @Override
+ public Session createEmptySession() {
+ return new ClusteredSession();
+ }
+
+ @Override
+ protected void doLoad() throws ClassNotFoundException, IOException {
+ }
+
+ @Override
+ protected void doUnload() throws IOException {
+ }
+
+ @Override
+ public void backgroundProcess() {
+ }
+
+ private class MigrationListener implements SessionListener {
+
+ public void notifyInboundSessionMigration(org.apache.geronimo.clustering.Session session) {
+ add(new ClusteredSession(session));
+ }
+
+ public void notifyOutboundSessionMigration(org.apache.geronimo.clustering.Session session) {
+ ClusteredSession clusteredSession = getClusteredSession(session);
+ remove(clusteredSession);
+ }
+
+ public void notifySessionDestruction(org.apache.geronimo.clustering.Session session) {
+ ClusteredSession clusteredSession = getClusteredSession(session);
+ remove(clusteredSession);
+ }
+
+ protected ClusteredSession getClusteredSession(org.apache.geronimo.clustering.Session session) {
+ return (ClusteredSession) ClusteredManager.this.sessions.get(session.getSessionId());
+ }
+ }
+
+ public class ClusteredSession extends StandardSession {
+ private org.apache.geronimo.clustering.Session session;
+
+ protected ClusteredSession() {
+ super(ClusteredManager.this);
+ }
+
+ protected ClusteredSession(org.apache.geronimo.clustering.Session session) {
+ super(ClusteredManager.this);
+ this.session = session;
+
+ attributes = session.getState();
+
+ super.setId(session.getSessionId());
+ setValid(true);
+ setNew(false);
+ }
+
+ @Override
+ public void setId(String id) {
+ super.setId(id);
+ try {
+ session = sessionManager.createSession(id);
+ } catch (SessionAlreadyExistException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ }
+
+ attributes = session.getState();
+ }
+
+ @Override
+ public void invalidate() throws IllegalStateException {
+ super.invalidate();
+ session.release();
+ }
+
+ @Override
+ public void endAccess() {
+ super.endAccess();
+ session.onEndAccess();
+ }
+ }
+
+}
Added: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerRetriever.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerRetriever.java?rev=603174&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerRetriever.java (added)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerRetriever.java Tue Dec 11 00:33:18 2007
@@ -0,0 +1,67 @@
+/*
+ * 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.tomcat.cluster;
+
+import org.apache.geronimo.clustering.SessionManager;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.tomcat.ObjectRetriever;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class ClusteredManagerRetriever implements ObjectRetriever {
+ private final SessionManager sessionManager;
+
+ public ClusteredManagerRetriever(SessionManager sessionManager) {
+ if (null == sessionManager) {
+ throw new IllegalArgumentException("sessionManager is required");
+ }
+ this.sessionManager = sessionManager;
+ }
+
+ public Object getInternalObject() {
+ return new ClusteredManager(sessionManager);
+ }
+
+ public static final GBeanInfo GBEAN_INFO;
+ public static final String GBEAN_REF_SESSION_MANAGER = "SessionManager";
+
+ static {
+ GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Clustered Manager Retriever",
+ ClusteredManagerRetriever.class,
+ NameFactory.GERONIMO_SERVICE);
+
+ infoFactory.addReference(GBEAN_REF_SESSION_MANAGER, SessionManager.class, NameFactory.GERONIMO_SERVICE);
+
+ infoFactory.addInterface(ObjectRetriever.class);
+
+ infoFactory.setConstructor(new String[]{GBEAN_REF_SESSION_MANAGER});
+
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+
+}
Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java?rev=603174&r1=603173&r2=603174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java Tue Dec 11 00:33:18 2007
@@ -82,6 +82,7 @@
container,
runAsSource,
tomcatRealm,
+ null,
valveChain,
null,
null,
Added: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValveTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValveTest.java?rev=603174&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValveTest.java (added)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/cluster/AbstractClusteredValveTest.java Tue Dec 11 00:33:18 2007
@@ -0,0 +1,123 @@
+/*
+ * 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.tomcat.cluster;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import org.apache.catalina.Valve;
+import org.apache.catalina.connector.Request;
+import org.apache.catalina.connector.Response;
+import org.apache.geronimo.clustering.ClusteredInvocation;
+import org.apache.geronimo.clustering.ClusteredInvocationException;
+
+import com.agical.rmock.extension.junit.RMockTestCase;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class AbstractClusteredValveTest extends RMockTestCase {
+
+ private AbstractClusteredValve valve;
+ private Request request;
+ private Response response;
+ private Valve nextValve;
+
+ @Override
+ protected void setUp() throws Exception {
+ valve = new AbstractClusteredValve() {
+ @Override
+ protected ClusteredInvocation newClusteredInvocation(Request request, Response response) {
+ return new WebClusteredInvocation(request, response) {
+ public void invoke() throws ClusteredInvocationException {
+ invokeLocally();
+ }
+ };
+ }
+ };
+
+ nextValve = (Valve) mock(Valve.class);
+ valve.setNext(nextValve);
+
+ request = new Request();
+ response = new Response();
+ }
+
+ public void testSuccessfulInvocation() throws Exception {
+ nextValve.invoke(request, response);
+
+ startVerification();
+
+ valve.invoke(request, response);
+ }
+
+ public void testIOEIsUnwrapped() throws Exception {
+ nextValve.invoke(request, response);
+ IOException expected = new IOException();
+ modify().throwException(expected);
+
+ startVerification();
+
+ try {
+ valve.invoke(request, response);
+ } catch (IOException e) {
+ assertSame(expected, e);
+ }
+ }
+
+ public void testSEIsUnwrapped() throws Exception {
+ nextValve.invoke(request, response);
+ ServletException expected = new ServletException();
+ modify().throwException(expected);
+
+ startVerification();
+
+ try {
+ valve.invoke(request, response);
+ } catch (ServletException e) {
+ assertSame(expected, e);
+ }
+ }
+
+ public void testCIEIsWrappedAsIOE() throws Exception {
+ final ClusteredInvocationException expected = new ClusteredInvocationException();
+ valve = new AbstractClusteredValve() {
+ @Override
+ protected ClusteredInvocation newClusteredInvocation(Request request, Response response) {
+ return new WebClusteredInvocation(request, response) {
+ public void invoke() throws ClusteredInvocationException {
+ throw expected;
+ }
+ };
+ }
+ };
+
+ startVerification();
+
+ try {
+ valve.invoke(request, response);
+ } catch (IOException e) {
+ assertSame(expected, e.getCause());
+ }
+ }
+
+}
Added: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerTest.java?rev=603174&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerTest.java (added)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/cluster/ClusteredManagerTest.java Tue Dec 11 00:33:18 2007
@@ -0,0 +1,192 @@
+/*
+ * 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.tomcat.cluster;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.Session;
+import org.apache.geronimo.clustering.SessionListener;
+import org.apache.geronimo.clustering.SessionManager;
+
+import com.agical.rmock.core.describe.ExpressionDescriber;
+import com.agical.rmock.core.match.operator.AbstractExpression;
+import com.agical.rmock.extension.junit.RMockTestCase;
+
+/**
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class ClusteredManagerTest extends RMockTestCase {
+ private SessionManager sessionManager;
+ private SessionListener sessionListener;
+ private String sessionId;
+ private Context context;
+
+ @Override
+ protected void setUp() throws Exception {
+ sessionId = "sessionId";
+
+ sessionManager = (SessionManager) mock(SessionManager.class);
+ sessionManager.registerListener(null);
+ modify().args(new AbstractExpression() {
+ public void describeWith(ExpressionDescriber arg0) throws IOException {
+ }
+
+ public boolean passes(Object arg0) {
+ sessionListener = (SessionListener) arg0;
+ return true;
+ }
+ });
+
+ context = (Context) mock(Context.class);
+
+ context.getSessionTimeout();
+ modify().returnValue(10);
+
+ context.addPropertyChangeListener(null);
+ modify().args(is.NOT_NULL);
+
+ context.getApplicationLifecycleListeners();
+ modify().multiplicity(expect.from(0));
+
+ context.getApplicationEventListeners();
+ modify().multiplicity(expect.from(0));
+ }
+
+ public void testCreatedSession() throws Exception {
+ recordCreateUnderlyingSession();
+
+ startVerification();
+
+ ClusteredManager manager = newManager();
+ Session createdSession = manager.createSession(null);
+ assertTrue(createdSession.isValid());
+
+ HttpSession httpSession = createdSession.getSession();
+ assertEquals("value", httpSession.getAttribute("key"));
+ assertTrue(httpSession.isNew());
+
+ assertSame(createdSession, manager.findSession(sessionId));
+ }
+
+ public void testSessionDestructionRemovesSession() throws Exception {
+ org.apache.geronimo.clustering.Session underlyingSession = recordCreateUnderlyingSession();
+
+ startVerification();
+
+ ClusteredManager manager = newManager();
+ manager.createSession(null);
+
+ sessionListener.notifySessionDestruction(underlyingSession);
+
+ assertNull(manager.findSession(sessionId));
+ }
+
+ public void testOutboundSessionDestructionRemovesSession() throws Exception {
+ org.apache.geronimo.clustering.Session underlyingSession = recordCreateUnderlyingSession();
+
+ startVerification();
+
+ ClusteredManager manager = newManager();
+ manager.createSession(null);
+
+ sessionListener.notifyOutboundSessionMigration(underlyingSession);
+
+ assertNull(manager.findSession(sessionId));
+ }
+
+ public void testInboundSessionMigrationAddsSession() throws Exception {
+ org.apache.geronimo.clustering.Session underlyingSession =
+ (org.apache.geronimo.clustering.Session) mock(org.apache.geronimo.clustering.Session.class);
+ recordUnderlyingSessionState(underlyingSession);
+
+ startVerification();
+
+ ClusteredManager manager = newManager();
+
+ sessionListener.notifyInboundSessionMigration(underlyingSession);
+
+ Session foundSession = manager.findSession(sessionId);
+ assertNotNull(foundSession);
+
+ assertTrue(foundSession.isValid());
+
+ HttpSession httpSession = foundSession.getSession();
+ assertEquals("value", httpSession.getAttribute("key"));
+ assertFalse(httpSession.isNew());
+ }
+
+ public void testInvalidateSessionReleasesUnderlyingSession() throws Exception {
+ org.apache.geronimo.clustering.Session underlyingSession =recordCreateUnderlyingSession();
+ underlyingSession.release();
+
+ startVerification();
+
+ ClusteredManager manager = newManager();
+ Session session = manager.createSession(null);
+ HttpSession httpSession = session.getSession();
+ httpSession.invalidate();
+ }
+
+ public void testSessionEndAccessTriggersOnEndAccess() throws Exception {
+ org.apache.geronimo.clustering.Session underlyingSession =recordCreateUnderlyingSession();
+ underlyingSession.onEndAccess();
+
+ startVerification();
+
+ ClusteredManager manager = newManager();
+ Session session = manager.createSession(null);
+ session.endAccess();
+ }
+
+ private org.apache.geronimo.clustering.Session recordCreateUnderlyingSession() throws Exception {
+ org.apache.geronimo.clustering.Session underlyingSession = sessionManager.createSession(sessionId);
+ recordUnderlyingSessionState(underlyingSession);
+
+ return underlyingSession;
+ }
+
+ private void recordUnderlyingSessionState(org.apache.geronimo.clustering.Session underlyingSession) {
+ underlyingSession.getSessionId();
+ modify().multiplicity(expect.from(0)).returnValue(sessionId);
+
+ underlyingSession.getState();
+ Map attributes = new HashMap();
+ attributes.put("key", "value");
+ modify().returnValue(attributes);
+ }
+
+ private ClusteredManager newManager() {
+ ClusteredManager manager = new ClusteredManager(sessionManager) {
+ @Override
+ protected synchronized String generateSessionId() {
+ return sessionId;
+ }
+ };
+ manager.setContainer(context);
+ return manager;
+ }
+
+}
Modified: geronimo/server/trunk/plugins/tomcat/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/pom.xml?rev=603174&r1=603173&r2=603174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/pom.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/pom.xml Tue Dec 11 00:33:18 2007
@@ -35,5 +35,9 @@
<module>geronimo-tomcat6-builder</module>
<module>tomcat6</module>
<module>tomcat6-deployer</module>
+ <module>geronimo-tomcat6-clustering-wadi</module>
+ <module>geronimo-tomcat6-clustering-builder-wadi</module>
+ <module>tomcat6-clustering-wadi</module>
+ <module>tomcat6-clustering-builder-wadi</module>
</modules>
</project>
Added: geronimo/server/trunk/plugins/tomcat/tomcat6-clustering-builder-wadi/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/tomcat6-clustering-builder-wadi/LICENSE.txt?rev=603174&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/tomcat6-clustering-builder-wadi/LICENSE.txt (added)
+++ geronimo/server/trunk/plugins/tomcat/tomcat6-clustering-builder-wadi/LICENSE.txt Tue Dec 11 00:33:18 2007
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+