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 2009/11/19 23:21:55 UTC
svn commit: r882333 [5/11] - in /geronimo/server/trunk/plugins: ./ jetty7/
jetty8/ jetty8/geronimo-jetty7-builder/
jetty8/geronimo-jetty7-clustering-builder-wadi/
jetty8/geronimo-jetty7-clustering-wadi/ jetty8/geronimo-jetty7/
jetty8/geronimo-jetty8-bu...
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/builder/WADIJettyClusteringBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/builder/WADIJettyClusteringBuilder.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/builder/WADIJettyClusteringBuilder.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/builder/WADIJettyClusteringBuilder.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,302 @@
+/**
+ * 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.jetty8.cluster.wadi.builder;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.geronimo.clustering.wadi.BasicWADISessionManager;
+import org.apache.geronimo.clustering.wadi.WADISessionManagerConfigInfo;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.NamespaceDrivenBuilder;
+import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.jetty8.WebAppContextWrapper;
+import org.apache.geronimo.jetty8.cluster.ClusteredSessionHandlerFactory;
+import org.apache.geronimo.jetty8.cluster.wadi.WADIClusteredPreHandlerFactory;
+import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
+import org.apache.geronimo.schema.NamespaceElementConverter;
+import org.apache.geronimo.schema.SchemaConversionUtils;
+import org.apache.geronimo.xbeans.jetty8.cluster.wadi.GerClusteringWadiDocument;
+import org.apache.geronimo.xbeans.jetty8.cluster.wadi.GerClusteringWadiType;
+import org.apache.geronimo.xbeans.geronimo.j2ee.GerClusteringDocument;
+import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+@GBean(name="WADIJettyClusteringBuilder", j2eeType=NameFactory.MODULE_BUILDER)
+public class WADIJettyClusteringBuilder implements NamespaceDrivenBuilder {
+ private static final QName BASE_CLUSTERING_QNAME = GerClusteringDocument.type.getDocumentElementName();
+ private static final QName CLUSTERING_WADI_QNAME = GerClusteringWadiDocument.type.getDocumentElementName();
+ private static final QNameSet CLUSTERING_WADI_QNAME_SET = QNameSet.singleton(CLUSTERING_WADI_QNAME);
+
+ static {
+ SchemaConversionUtils.registerNamespaceConversions(
+ Collections.singletonMap(CLUSTERING_WADI_QNAME.getLocalPart(),
+ new NamespaceElementConverter(CLUSTERING_WADI_QNAME.getNamespaceURI())));
+ }
+
+ private final int defaultSweepInterval;
+ private final int defaultNumPartitions;
+ private final AbstractNameQuery defaultBackingStrategyFactoryName;
+ private final AbstractNameQuery defaultClusterName;
+ private final Environment defaultEnvironment;
+
+ public WADIJettyClusteringBuilder(@ParamAttribute(name=GBEAN_ATTR_DFT_SWEEP_INTERVAL) int defaultSweepInterval,
+ @ParamAttribute(name=GBEAN_ATTR_DFT_NUM_PARTITIONS) int defaultNumPartitions,
+ @ParamAttribute(name=GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME) AbstractNameQuery defaultBackingStrategyFactoryName,
+ @ParamAttribute(name=GBEAN_ATTR_DFT_CLUSTER_NAME) AbstractNameQuery defaultClusterName,
+ @ParamAttribute(name=GBEAN_ATTR_DFT_ENVIRONMENT) Environment defaultEnvironment) {
+ if (defaultSweepInterval < 1) {
+ throw new IllegalArgumentException("defaultSweepInterval is lower than 1");
+ } else if (defaultNumPartitions < 1) {
+ throw new IllegalArgumentException("defaultNumPartitions is lower than 1");
+ } else if (null == defaultBackingStrategyFactoryName) {
+ throw new IllegalArgumentException("defaultBackingStrategyFactoryName is required");
+ } else if (null == defaultClusterName) {
+ throw new IllegalArgumentException("defaultClusterName is required");
+ } else if (null == defaultEnvironment) {
+ throw new IllegalArgumentException("defaultEnvironment is required");
+ }
+ this.defaultSweepInterval = defaultSweepInterval;
+ this.defaultNumPartitions = defaultNumPartitions;
+ this.defaultBackingStrategyFactoryName = defaultBackingStrategyFactoryName;
+ this.defaultClusterName = defaultClusterName;
+ this.defaultEnvironment = defaultEnvironment;
+ }
+
+ public void buildEnvironment(XmlObject container, Environment environment) throws DeploymentException {
+ if (getWadiClusterConfig(container) != null) {
+ EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);
+ }
+ }
+
+ public void build(XmlObject container, DeploymentContext applicationContext, DeploymentContext moduleContext) throws DeploymentException {
+ GerClusteringWadiType clusteringWadiType = getWadiClusterConfig(container);
+ if (clusteringWadiType != null) {
+ GBeanData webModuleData = extractWebModule(moduleContext);
+ try {
+ AbstractName sessionManagerName = addSessionManager(clusteringWadiType, webModuleData, moduleContext);
+ addSessionHandlerFactory(moduleContext, webModuleData, sessionManagerName);
+ addPreHandlerFactory(moduleContext, webModuleData, sessionManagerName);
+ } catch (GBeanAlreadyExistsException e) {
+ throw new DeploymentException("Duplicate GBean", e);
+ }
+ }
+ }
+
+ protected GBeanData extractWebModule(DeploymentContext moduleContext) throws DeploymentException {
+ Configuration configuration = moduleContext.getConfiguration();
+ AbstractNameQuery webModuleQuery = createJettyWebAppContextNameQuery(moduleContext);
+ try {
+ return configuration.findGBeanData(webModuleQuery);
+ } catch (GBeanNotFoundException e) {
+ throw new DeploymentException("Could not locate web module gbean in web app configuration", e);
+ }
+ }
+
+ protected AbstractNameQuery createJettyWebAppContextNameQuery(DeploymentContext moduleContext) {
+ String name = moduleContext.getModuleName().getNameProperty(Jsr77Naming.J2EE_NAME);
+ return new AbstractNameQuery(null,
+ Collections.singletonMap(Jsr77Naming.J2EE_NAME, name),
+ Collections.singleton(WebAppContextWrapper.class.getName()));
+ }
+
+ public QNameSet getSpecQNameSet() {
+ return QNameSet.EMPTY;
+ }
+
+ public QNameSet getPlanQNameSet() {
+ return CLUSTERING_WADI_QNAME_SET;
+ }
+
+ public QName getBaseQName() {
+ return BASE_CLUSTERING_QNAME;
+ }
+
+ protected GerClusteringWadiType getWadiClusterConfig(XmlObject container) throws DeploymentException {
+ XmlObject[] items = container.selectChildren(CLUSTERING_WADI_QNAME_SET);
+ if (items.length > 1) {
+ throw new DeploymentException("Unexpected count of clustering elements in geronimo plan " + items.length + " qnameset: " + CLUSTERING_WADI_QNAME_SET);
+ }
+ if (items.length == 1) {
+ return (GerClusteringWadiType) items[0].copy().changeType(GerClusteringWadiType.type);
+ }
+ return null;
+ }
+
+ protected AbstractName addSessionManager(GerClusteringWadiType clustering,
+ GBeanData webModuleData,
+ DeploymentContext moduleContext) throws GBeanAlreadyExistsException {
+ AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
+ "WADISessionManager", GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+
+ GBeanData beanData = new GBeanData(name, BasicWADISessionManager.class);
+
+ setConfigInfo(clustering, webModuleData, beanData);
+ setCluster(clustering, beanData);
+ setBackingStrategyFactory(clustering, beanData);
+
+ moduleContext.addGBean(beanData);
+
+ return name;
+ }
+
+ protected void setConfigInfo(GerClusteringWadiType clustering, GBeanData webModuleData, GBeanData beanData) {
+ int sweepInterval = getSweepInterval(clustering);
+ int numPartitions = getNumberOfPartitions(clustering);
+ Integer sessionTimeout = getSessionTimeout(webModuleData);
+ boolean disableReplication = isDisableReplication(clustering);
+ boolean deltaReplication = isDeltaReplication(clustering);
+
+ String contextPath = (String) webModuleData.getAttribute("contextPath");
+ URI serviceSpaceName;
+ try {
+ serviceSpaceName = new URI(contextPath);
+ } catch (URISyntaxException e) {
+ throw (AssertionError) new AssertionError("contextPath [" + contextPath + "] cannot be parsed as an URI.").initCause(e);
+ }
+
+ WADISessionManagerConfigInfo configInfo = new WADISessionManagerConfigInfo(serviceSpaceName,
+ sweepInterval,
+ numPartitions,
+ sessionTimeout.intValue(),
+ disableReplication,
+ deltaReplication);
+ beanData.setAttribute(BasicWADISessionManager.GBEAN_ATTR_WADI_CONFIG_INFO, configInfo);
+ }
+
+ protected Integer getSessionTimeout(GBeanData webModuleData) throws AssertionError {
+ Integer sessionTimeout = (Integer) webModuleData.getAttribute(WebAppContextWrapper.GBEAN_ATTR_SESSION_TIMEOUT);
+ if (null == sessionTimeout) {
+ throw new AssertionError();
+ }
+ return sessionTimeout;
+ }
+
+ protected boolean isDeltaReplication(GerClusteringWadiType clustering) {
+ if (clustering.isSetDeltaReplication()) {
+ return clustering.getDeltaReplication();
+ }
+ return false;
+ }
+
+ protected boolean isDisableReplication(GerClusteringWadiType clustering) {
+ if (clustering.isSetDisableReplication()) {
+ return clustering.getDisableReplication();
+ }
+ return false;
+ }
+
+ protected int getNumberOfPartitions(GerClusteringWadiType clustering) {
+ if (clustering.isSetNumPartitions()) {
+ return clustering.getNumPartitions().intValue();
+ }
+ return defaultNumPartitions;
+ }
+
+ protected int getSweepInterval(GerClusteringWadiType clustering) {
+ if (clustering.isSetSweepInterval()) {
+ return clustering.getSweepInterval().intValue();
+ }
+ return defaultSweepInterval;
+ }
+
+ protected void setCluster(GerClusteringWadiType clustering, GBeanData beanData) {
+ Set patterns = new HashSet();
+ if (clustering.isSetCluster()) {
+ addAbstractNameQueries(patterns, clustering.getCluster().getPatternArray());
+ } else {
+ patterns.add(defaultClusterName);
+ }
+ beanData.setReferencePatterns(BasicWADISessionManager.GBEAN_REF_CLUSTER, patterns);
+ }
+
+ protected void setBackingStrategyFactory(GerClusteringWadiType clustering, GBeanData beanData) {
+ Set patterns = new HashSet();
+ if (clustering.isSetBackingStrategyFactory()) {
+ addAbstractNameQueries(patterns, clustering.getBackingStrategyFactory().getPatternArray());
+ } else {
+ patterns.add(defaultBackingStrategyFactoryName);
+ }
+ beanData.setReferencePatterns(BasicWADISessionManager.GBEAN_REF_BACKING_STRATEGY_FACTORY, patterns);
+ }
+
+ protected AbstractName addPreHandlerFactory(DeploymentContext moduleContext,
+ GBeanData webModuleData, AbstractName sessionManagerName) throws GBeanAlreadyExistsException {
+ AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
+ "WADIClusteredPreHandlerFactory", GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+
+ GBeanData beanData = new GBeanData(name, WADIClusteredPreHandlerFactory.class);
+ beanData.setReferencePattern(WADIClusteredPreHandlerFactory.GBEAN_REF_WADI_SESSION_MANAGER, sessionManagerName);
+
+ webModuleData.setReferencePattern(WebAppContextWrapper.GBEAN_REF_PRE_HANDLER_FACTORY, name);
+
+ moduleContext.addGBean(beanData);
+
+ return name;
+ }
+
+ protected AbstractName addSessionHandlerFactory(DeploymentContext moduleContext,
+ GBeanData webModuleData, AbstractName sessionManagerName) throws GBeanAlreadyExistsException {
+ AbstractName name = moduleContext.getNaming().createChildName(moduleContext.getModuleName(),
+ "ClusteredSessionHandlerFactory", GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+
+ GBeanData beanData = new GBeanData(name, ClusteredSessionHandlerFactory.class);
+ beanData.setReferencePattern(ClusteredSessionHandlerFactory.GBEAN_REF_SESSION_MANAGER, sessionManagerName);
+
+ webModuleData.setReferencePattern(WebAppContextWrapper.GBEAN_REF_SESSION_HANDLER_FACTORY, name);
+
+ moduleContext.addGBean(beanData);
+
+ return name;
+ }
+
+ protected void addAbstractNameQueries(Set patterns, GerPatternType[] patternTypes) {
+ for (int i = 0; i < patternTypes.length; i++) {
+ AbstractNameQuery query = ENCConfigBuilder.buildAbstractNameQuery(patternTypes[i], null, null, null);
+ patterns.add(query);
+ }
+ }
+
+ public static final String GBEAN_ATTR_DFT_SWEEP_INTERVAL = "defaultSweepInterval";
+ public static final String GBEAN_ATTR_DFT_NUM_PARTITIONS = "defaultNumPartitions";
+ public static final String GBEAN_ATTR_DFT_BACKING_STRATEGY_FACTORY_NAME = "defaultBackingStrategyFactoryName";
+ public static final String GBEAN_ATTR_DFT_CLUSTER_NAME = "defaultClusterName";
+ public static final String GBEAN_ATTR_DFT_ENVIRONMENT = "defaultEnvironment";
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/builder/WADIJettyClusteringBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/builder/WADIJettyClusteringBuilder.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/builder/WADIJettyClusteringBuilder.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsd/geronimo-clustering-wadi-1.2.xsd
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsd/geronimo-clustering-wadi-1.2.xsd?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsd/geronimo-clustering-wadi-1.2.xsd (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsd/geronimo-clustering-wadi-1.2.xsd Thu Nov 19 22:21:48 2009
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+-->
+
+<xs:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://geronimo.apache.org/xml/ns/clustering-wadi-1.2"
+ xmlns:clust-wadi="http://geronimo.apache.org/xml/ns/clustering-wadi-1.2"
+ xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
+ xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+ <xs:import namespace="http://geronimo.apache.org/xml/ns/naming-1.2" schemaLocation="geronimo-naming-1.2.xsd"/>
+ <xs:import namespace="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" schemaLocation="geronimo-application-2.0.xsd"/>
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+
+ <xs:element name="clustering-wadi" type="clust-wadi:clustering-wadiType" substitutionGroup="app:clustering"/>
+
+ <xs:complexType name="clustering-wadiType">
+ <xs:complexContent>
+ <xs:extension base="app:abstract-clusteringType">
+ <xs:sequence>
+ <xs:element name="sweepInterval" type="xs:integer" minOccurs="0"/>
+ <xs:element name="numPartitions" type="xs:integer" minOccurs="0"/>
+ <xs:element name="cluster" type="naming:gbean-refType" minOccurs="0"/>
+ <xs:element name="disableReplication" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="deltaReplication" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="backing-strategy-factory" type="naming:gbean-refType" minOccurs="0"/>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+</xs:schema>
+
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsd/geronimo-clustering-wadi-1.2.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsd/geronimo-clustering-wadi-1.2.xsd
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsd/geronimo-clustering-wadi-1.2.xsd
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsdconfig/xmlconfig.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsdconfig/xmlconfig.xml?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsdconfig/xmlconfig.xml (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsdconfig/xmlconfig.xml Thu Nov 19 22:21:48 2009
@@ -0,0 +1,25 @@
+<!--
+ 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.
+-->
+<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config"
+ >
+
+ <xb:namespace uri="http://geronimo.apache.org/xml/ns/clustering-wadi-1.2">
+ <xb:package>org.apache.geronimo.xbeans.jetty8.cluster.wadi</xb:package>
+ <xb:prefix>Ger</xb:prefix>
+ </xb:namespace>
+
+</xb:config>
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsdconfig/xmlconfig.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsdconfig/xmlconfig.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-builder-wadi/src/main/xsdconfig/xmlconfig.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/pom.xml?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/pom.xml (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/pom.xml Thu Nov 19 22:21:48 2009
@@ -0,0 +1,51 @@
+<?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$ $Date$ -->
+
+<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.plugins</groupId>
+ <artifactId>jetty8</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-jetty8-clustering-wadi</artifactId>
+ <packaging>bundle</packaging>
+ <name>Geronimo Plugins, Jetty 8 :: Clustering over WADI Core</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>geronimo-clustering-wadi</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>geronimo-jetty8</artifactId>
+ <version>${version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
+
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/AbstractClusteredPreHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/AbstractClusteredPreHandler.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/AbstractClusteredPreHandler.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/AbstractClusteredPreHandler.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,86 @@
+/**
+ * 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.jetty8.cluster;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.geronimo.clustering.ClusteredInvocation;
+import org.apache.geronimo.clustering.ClusteredInvocationException;
+import org.apache.geronimo.jetty8.AbstractPreHandler;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.http.HttpException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractClusteredPreHandler extends AbstractPreHandler {
+
+ public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+ ClusteredInvocation invocation = newClusteredInvocation(target, baseRequest, request, response);
+ try {
+ invocation.invoke();
+ } catch (ClusteredInvocationException e) {
+ Throwable cause = e.getCause();
+ if (cause instanceof HttpException) {
+ throw (HttpException) cause;
+ } else if (cause instanceof IOException) {
+ throw (IOException) cause;
+ } else {
+ throw (IOException) new IOException().initCause(cause);
+ }
+ }
+ }
+
+ protected abstract ClusteredInvocation newClusteredInvocation(String target,
+ Request baseRequest, HttpServletRequest request, HttpServletResponse response);
+
+
+ protected abstract class WebClusteredInvocation implements ClusteredInvocation {
+ protected final String target;
+ protected final Request baseRequest;
+ protected final HttpServletRequest request;
+ protected final HttpServletResponse response;
+
+ protected WebClusteredInvocation(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) {
+ this.target = target;
+ this.baseRequest = baseRequest;
+ this.request = request;
+ this.response = response;
+ }
+
+ protected void invokeLocally() throws ClusteredInvocationException {
+ try {
+ next.handle(target, baseRequest, request, response);
+ } catch (IOException e) {
+ throw new ClusteredInvocationException(e);
+ } catch (ServletException e) {
+ //WHAT DO I DO HERE???
+ throw new ClusteredInvocationException(e);
+ }
+ }
+
+ public String getRequestedSessionId() {
+ return request.getRequestedSessionId();
+ }
+ }
+
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/AbstractClusteredPreHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/AbstractClusteredPreHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/AbstractClusteredPreHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandler.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandler.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandler.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,71 @@
+/**
+ * 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.jetty8.cluster;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.geronimo.jetty8.AbstractPreHandler;
+import org.apache.geronimo.jetty8.PreHandler;
+import org.eclipse.jetty.server.session.SessionHandler;
+import org.eclipse.jetty.server.Request;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class ClusteredSessionHandler extends SessionHandler {
+ private final PreHandler chainedHandler;
+
+ public ClusteredSessionHandler(ClusteredSessionManager sessionManager, PreHandler chainedHandler) {
+ if (null == chainedHandler) {
+ throw new IllegalArgumentException("chainedHandler is required");
+ }
+ this.chainedHandler = chainedHandler;
+ chainedHandler.setNextHandler(new ActualHandler());
+
+ setSessionManager(sessionManager);
+ }
+
+ @Override
+ public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+ setRequestedId(baseRequest, request);
+ try {
+ chainedHandler.handle(target, baseRequest, request, response);
+ } catch (ServletException e) {
+ throw (IOException) new IOException().initCause(e);
+ }
+ }
+
+ protected void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+ super.handle(target, baseRequest, request, response);
+ }
+
+ private class ActualHandler extends AbstractPreHandler {
+
+ public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+ doHandle(target, baseRequest, request, response);
+ }
+ }
+
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandlerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandlerFactory.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandlerFactory.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandlerFactory.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,42 @@
+/**
+ * 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.jetty8.cluster;
+
+import org.apache.geronimo.clustering.SessionManager;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.jetty8.PreHandler;
+import org.apache.geronimo.jetty8.SessionHandlerFactory;
+import org.eclipse.jetty.server.session.SessionHandler;
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class ClusteredSessionHandlerFactory implements SessionHandlerFactory {
+ private final SessionManager sessionManager;
+
+ public ClusteredSessionHandlerFactory(@ParamReference(name=GBEAN_REF_SESSION_MANAGER) SessionManager sessionManager) {
+ this.sessionManager = sessionManager;
+ }
+
+ public SessionHandler createHandler(PreHandler preHandler) {
+ ClusteredSessionManager clusteredSessionManager = new ClusteredSessionManager(sessionManager);
+ return new ClusteredSessionHandler(clusteredSessionManager, preHandler);
+ }
+
+ public static final String GBEAN_REF_SESSION_MANAGER = "SessionManager";
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandlerFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandlerFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionHandlerFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionManager.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionManager.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionManager.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,170 @@
+/**
+ * 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.jetty8.cluster;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.geronimo.clustering.SessionAlreadyExistException;
+import org.apache.geronimo.clustering.SessionListener;
+import org.apache.geronimo.clustering.SessionManager;
+import org.eclipse.jetty.server.session.AbstractSessionManager;
+import org.eclipse.jetty.server.session.HashSessionIdManager;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ClusteredSessionManager extends AbstractSessionManager {
+
+ private final SessionManager sessionManager;
+ private final Map<String, ClusteredSession> idToSession = new HashMap<String, ClusteredSession>();
+
+ public ClusteredSessionManager(SessionManager sessionManager) {
+ this.sessionManager = sessionManager;
+
+ String workerName = sessionManager.getNode().getName();
+ workerName = workerName.replaceAll(" ", "");
+ HashSessionIdManager sessionIdManager = new HashSessionIdManager();
+ sessionIdManager.setWorkerName(workerName);
+ setIdManager(sessionIdManager);
+
+ sessionManager.registerListener(new MigrationListener());
+ }
+
+ @Override
+ protected Session newSession(HttpServletRequest request) {
+ return new ClusteredSession(request);
+ }
+
+ @Override
+ public void complete(HttpSession session) {
+ ClusteredSession clusteredSession = (ClusteredSession) session;
+ clusteredSession.session.onEndAccess();
+ }
+
+ @Override
+ protected void addSession(Session session) {
+ ClusteredSession clusteredSession = (ClusteredSession) session;
+ synchronized (idToSession) {
+ idToSession.put(clusteredSession.getClusterId(), clusteredSession);
+ }
+ }
+
+ @Override
+ protected void removeSession(String idInCluster) {
+ synchronized (idToSession) {
+ idToSession.remove(idInCluster);
+ }
+ }
+
+ @Override
+ public Session getSession(String idInCluster) {
+ synchronized (idToSession) {
+ return idToSession.get(idInCluster);
+ }
+ }
+
+ @Override
+ public int getSessions() {
+ synchronized (idToSession) {
+ return idToSession.size();
+ }
+ }
+
+ @Override
+ public Map getSessionMap() {
+ throw new AssertionError("getSessionMap is never used.");
+ }
+
+ @Override
+ protected void invalidateSessions() {
+ // We do not need to clear idToSession: when the SessionManager GBean is stopped, all the sessions
+ // it defines are migrated to other SessionManagers. These outbound session migrations will remove
+ // them from idToSession.
+ }
+
+ private class MigrationListener implements SessionListener {
+
+ public void notifyInboundSessionMigration(org.apache.geronimo.clustering.Session session) {
+ addSession(new ClusteredSession(session), false);
+ }
+
+ public void notifyOutboundSessionMigration(org.apache.geronimo.clustering.Session session) {
+ ClusteredSession clusteredSession = getClusteredSession(session);
+ removeSession(clusteredSession, false);
+ }
+
+ public void notifySessionDestruction(org.apache.geronimo.clustering.Session session) {
+ ClusteredSession clusteredSession = getClusteredSession(session);
+ removeSession(clusteredSession, true);
+ }
+
+ private ClusteredSession getClusteredSession(org.apache.geronimo.clustering.Session session) throws AssertionError {
+ ClusteredSession clusteredSession;
+ synchronized (idToSession) {
+ clusteredSession = idToSession.remove(session.getSessionId());
+ }
+ if (null == clusteredSession) {
+ throw new AssertionError("Session [" + session + "] is undefined");
+ }
+ return clusteredSession;
+ }
+
+
+ }
+
+ public class ClusteredSession extends Session {
+ private final org.apache.geronimo.clustering.Session session;
+
+ protected ClusteredSession(HttpServletRequest request) {
+ super(request);
+ try {
+ this.session = sessionManager.createSession(getClusterId());
+ } catch (SessionAlreadyExistException e) {
+ throw (IllegalStateException) new IllegalStateException().initCause(e);
+ }
+ initValues();
+ }
+
+ protected ClusteredSession(org.apache.geronimo.clustering.Session session) {
+ super(System.currentTimeMillis(), session.getSessionId());
+ this.session = session;
+ initValues();
+ }
+
+ @Override
+ protected Map newAttributeMap() {
+ return session.getState();
+ }
+
+ @Override
+ protected String getClusterId() {
+ return super.getClusterId();
+ }
+
+ @Override
+ public void invalidate() throws IllegalStateException {
+ super.invalidate();
+ session.release();
+ }
+ }
+
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionManager.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/ClusteredSessionManager.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandler.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandler.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandler.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,87 @@
+/**
+ * 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.jetty8.cluster.wadi;
+
+import java.io.IOException;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.geronimo.clustering.ClusteredInvocation;
+import org.apache.geronimo.clustering.ClusteredInvocationException;
+import org.apache.geronimo.jetty8.cluster.AbstractClusteredPreHandler;
+import org.codehaus.wadi.core.contextualiser.InvocationException;
+import org.codehaus.wadi.core.manager.Manager;
+import org.codehaus.wadi.web.impl.WebInvocation;
+import org.eclipse.jetty.server.Request;
+
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class WADIClusteredPreHandler extends AbstractClusteredPreHandler {
+ private final Manager wadiManager;
+
+ public WADIClusteredPreHandler(Manager wadiManager) {
+ this.wadiManager = wadiManager;
+ }
+
+ protected ClusteredInvocation newClusteredInvocation(String target, Request baseRequest, HttpServletRequest request,
+ HttpServletResponse response) {
+ return new WADIWebClusteredInvocation(target, baseRequest, request, response);
+ }
+
+ protected class WADIWebClusteredInvocation extends WebClusteredInvocation {
+
+ public WADIWebClusteredInvocation(String target, Request baseRequest, HttpServletRequest request,
+ HttpServletResponse response) {
+ super(target, baseRequest, 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(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);
+ }
+ }
+ }
+ }
+
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandlerFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandlerFactory.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandlerFactory.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandlerFactory.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,58 @@
+/**
+ * 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.jetty8.cluster.wadi;
+
+import org.apache.geronimo.clustering.wadi.WADISessionManager;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.jetty8.PreHandler;
+import org.apache.geronimo.jetty8.PreHandlerFactory;
+import org.codehaus.wadi.core.manager.Manager;
+
+
+/**
+ *
+ * @version $Rev$ $Date$
+ */
+public class WADIClusteredPreHandlerFactory implements PreHandlerFactory, GBeanLifecycle {
+
+ private final WADISessionManager sessionManager;
+ private Manager wadiManager;
+
+ public WADIClusteredPreHandlerFactory(@ParamReference(name=GBEAN_REF_WADI_SESSION_MANAGER) WADISessionManager sessionManager) {
+ if (null == sessionManager) {
+ throw new IllegalArgumentException("sessionManager is required");
+ }
+ this.sessionManager = sessionManager;
+ }
+
+ public void doStart() throws Exception {
+ wadiManager = sessionManager.getManager();
+ }
+
+ public void doStop() throws Exception {
+ }
+
+ public void doFail() {
+ }
+
+ public PreHandler createHandler() {
+ return new WADIClusteredPreHandler(wadiManager);
+ }
+
+ public static final String GBEAN_REF_WADI_SESSION_MANAGER = "WADISessionManager";
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandlerFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandlerFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-clustering-wadi/src/main/java/org/apache/geronimo/jetty8/cluster/wadi/WADIClusteredPreHandlerFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/pom.xml?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/pom.xml (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/pom.xml Thu Nov 19 22:21:48 2009
@@ -0,0 +1,132 @@
+<?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$ $Date$ -->
+
+<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.plugins</groupId>
+ <artifactId>jetty8</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-jetty8</artifactId>
+ <packaging>bundle</packaging>
+ <name>Geronimo Plugins, Jetty 8 :: Core</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jacc_1.1_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-security-builder</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.framework</groupId>
+ <artifactId>geronimo-kernel</artifactId>
+ <version>${version}</version>
+ <classifier>tests</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.configs</groupId>
+ <artifactId>transaction-1_6</artifactId>
+ <version>${version}</version>
+ <type>car</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.framework</groupId>
+ <artifactId>jee-specs</artifactId>
+ <version>${version}</version>
+ <type>car</type>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.configs</groupId>
+ <artifactId>webservices-common</artifactId>
+ <type>car</type>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ <version>6.1.15</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-ajp</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-jaspi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-security</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>java.security.auth.login.config</name>
+ <value>${basedir}/src/test/resources/data/login.config</value>
+ </property>
+ </systemProperties>
+ <childDelegation>true</childDelegation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
+
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/AbstractPreHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/AbstractPreHandler.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/AbstractPreHandler.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/AbstractPreHandler.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,83 @@
+/**
+ * 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.jetty8;
+
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.util.component.LifeCycle;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractPreHandler implements PreHandler {
+ protected Handler next;
+
+ public final void setNextHandler(Handler next) {
+ this.next = next;
+ }
+
+ public final Server getServer() {
+ throw new UnsupportedOperationException();
+ }
+
+ public final boolean isFailed() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addLifeCycleListener(LifeCycle.Listener listener) {
+ }
+
+ public void removeLifeCycleListener(LifeCycle.Listener listener) {
+ }
+
+ public final boolean isRunning() {
+ throw new UnsupportedOperationException();
+ }
+
+ public final boolean isStarted() {
+ throw new UnsupportedOperationException();
+ }
+
+ public final boolean isStarting() {
+ throw new UnsupportedOperationException();
+ }
+
+ public final boolean isStopping() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isStopped() {
+ throw new UnsupportedOperationException();
+ }
+
+ public final void setServer(Server server) {
+ throw new UnsupportedOperationException();
+ }
+
+ public final void start() throws Exception {
+ throw new UnsupportedOperationException();
+ }
+
+ public final void stop() throws Exception {
+ throw new UnsupportedOperationException();
+ }
+
+ public void destroy() {
+ }
+
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/AbstractPreHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/AbstractPreHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/AbstractPreHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/DefaultServletHolderWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/DefaultServletHolderWrapper.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/DefaultServletHolderWrapper.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/DefaultServletHolderWrapper.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,51 @@
+/**
+ * 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.jetty8;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@GBean(j2eeType = NameFactory.SERVLET_TEMPLATE)
+public class DefaultServletHolderWrapper extends ServletHolderWrapper {
+
+ public DefaultServletHolderWrapper() {
+ }
+
+ public DefaultServletHolderWrapper(@ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
+ @ParamAttribute(name = "servletName") String servletName,
+ @ParamAttribute(name = "servletClass") String servletClassName,
+ @ParamAttribute(name = "jspFile") String jspFile,
+ @ParamAttribute(name = "initParams") Map initParams,
+ @ParamAttribute(name = "loadOnStartup") Integer loadOnStartup,
+ @ParamAttribute(name = "servletMappings") Set<String> servletMappings,
+ @ParamAttribute(name = "runAsRole") String runAsRole,
+ @ParamReference(name = "JettyServletRegistration", namingType = NameFactory.WEB_MODULE) JettyServletRegistration context) throws Exception {
+ super(objectName, servletName, servletClassName, jspFile, initParams, loadOnStartup, servletMappings, runAsRole, context);
+ }
+
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/DefaultServletHolderWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/DefaultServletHolderWrapper.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/DefaultServletHolderWrapper.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/FilterHolderWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/FilterHolderWrapper.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/FilterHolderWrapper.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/FilterHolderWrapper.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,155 @@
+/**
+ * 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.jetty8;
+
+import java.util.Map;
+
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectorInstanceContext;
+import org.apache.geronimo.connector.outbound.connectiontracking.SharedConnectorInstanceContext;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.jetty8.handler.IntegrationContext;
+import org.eclipse.jetty.servlet.FilterHolder;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@GBean(j2eeType = NameFactory.WEB_FILTER)
+public class FilterHolderWrapper implements GBeanLifecycle {
+
+ private final FilterHolder filterHolder;
+
+ public FilterHolderWrapper(@ParamAttribute(name = "filterName") String filterName,
+ @ParamAttribute(name = "filterClass") String filterClass,
+ @ParamAttribute(name = "initParams") Map initParams,
+ @ParamReference(name = "JettyServletRegistration", namingType = NameFactory.WEB_MODULE) JettyServletRegistration jettyServletRegistration) throws Exception {
+ filterHolder = new InternalFilterHolder(jettyServletRegistration);
+ if (jettyServletRegistration != null) {
+ filterHolder.setName(filterName);
+ filterHolder.setClassName(filterClass);
+ filterHolder.setInitParameters(initParams);
+ (jettyServletRegistration.getServletHandler()).addFilter(filterHolder);
+ }
+ }
+
+ public String getFilterName() {
+ return filterHolder.getName();
+ }
+
+ public void doStart() throws Exception {
+ filterHolder.start();
+ }
+
+ public void doStop() throws Exception {
+ filterHolder.stop();
+ }
+
+ public void doFail() {
+ try {
+ filterHolder.stop();
+ } catch (Exception e) {
+ //ignore?
+ }
+ }
+
+ private static class InternalFilterHolder extends FilterHolder {
+ private final JettyServletRegistration servletRegistration;
+ private boolean destroyed;
+
+ public InternalFilterHolder(JettyServletRegistration servletRegistration) {
+ this.servletRegistration = servletRegistration;
+ }
+
+
+ public synchronized Object newInstance() throws InstantiationException, IllegalAccessException {
+ return servletRegistration.newInstance(_className);
+ }
+
+ public void destroyInstance(Object o) throws Exception {
+ if (!destroyed) {
+ super.destroyInstance(o);
+ servletRegistration.destroyInstance(o);
+ destroyed = true;
+ }
+ }
+
+ @Override
+ public void doStart() throws Exception {
+ IntegrationContext integrationContext = servletRegistration.getIntegrationContext();
+ javax.naming.Context context = integrationContext.setContext();
+ boolean txActive = integrationContext.isTxActive();
+ SharedConnectorInstanceContext newContext = integrationContext.newConnectorInstanceContext(null);
+ ConnectorInstanceContext connectorContext = integrationContext.setConnectorInstance(null, newContext);
+ try {
+ try {
+ super.doStart();
+ } finally {
+ integrationContext.restoreConnectorContext(connectorContext, null, newContext);
+ }
+ } finally {
+ integrationContext.restoreContext(context);
+ integrationContext.completeTx(txActive, null);
+ }
+ }
+
+ @Override
+ public void doStop() throws Exception {
+ IntegrationContext integrationContext = servletRegistration.getIntegrationContext();
+ javax.naming.Context context = integrationContext.setContext();
+ boolean txActive = integrationContext.isTxActive();
+ SharedConnectorInstanceContext newContext = integrationContext.newConnectorInstanceContext(null);
+ ConnectorInstanceContext connectorContext = integrationContext.setConnectorInstance(null, newContext);
+ try {
+ try {
+ super.doStop();
+ } finally {
+ integrationContext.restoreConnectorContext(connectorContext, null, newContext);
+ }
+ } finally {
+ integrationContext.restoreContext(context);
+ integrationContext.completeTx(txActive, null);
+ }
+ }
+
+ }
+
+ public static final GBeanInfo GBEAN_INFO;
+
+ static {
+ GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(FilterHolderWrapper.class, NameFactory.WEB_FILTER);
+ infoBuilder.addAttribute("filterName", String.class, true);
+ infoBuilder.addAttribute("filterClass", String.class, true);
+ infoBuilder.addAttribute("initParams", Map.class, true);
+
+ infoBuilder.addReference("JettyServletRegistration", JettyServletRegistration.class, NameFactory.WEB_MODULE);
+
+ infoBuilder.setConstructor(new String[]{"filterName", "filterClass", "initParams", "JettyServletRegistration"});
+
+ GBEAN_INFO = infoBuilder.getBeanInfo();
+
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/FilterHolderWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/FilterHolderWrapper.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/FilterHolderWrapper.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/GeronimoServletHolder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/GeronimoServletHolder.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/GeronimoServletHolder.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/GeronimoServletHolder.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,94 @@
+/**
+ * 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.jetty8;
+
+import java.io.IOException;
+
+import javax.security.auth.Subject;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectorInstanceContext;
+import org.apache.geronimo.connector.outbound.connectiontracking.SharedConnectorInstanceContext;
+import org.apache.geronimo.jetty8.handler.IntegrationContext;
+import org.apache.geronimo.security.Callers;
+import org.apache.geronimo.security.ContextManager;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.servlet.ServletHolder;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoServletHolder extends ServletHolder {
+
+ private final IntegrationContext integrationContext;
+ private final JettyServletRegistration servletRegistration;
+
+ public GeronimoServletHolder(IntegrationContext integrationContext, JettyServletRegistration servletRegistration) {
+ this.integrationContext = integrationContext;
+ this.servletRegistration = servletRegistration;
+ }
+
+ public synchronized Object newInstance() throws InstantiationException, IllegalAccessException {
+ return servletRegistration.newInstance(_className);
+ }
+
+ public void destroyInstance(Object o) throws Exception {
+ super.destroyInstance(o);
+ servletRegistration.destroyInstance(o);
+ }
+
+ @Override
+ public void doStart() throws Exception {
+ javax.naming.Context context = integrationContext.setContext();
+ boolean txActive = integrationContext.isTxActive();
+ SharedConnectorInstanceContext newContext = integrationContext.newConnectorInstanceContext(null);
+ ConnectorInstanceContext connectorContext = integrationContext.setConnectorInstance(null, newContext);
+ try {
+ try {
+ super.doStart();
+ } finally {
+ integrationContext.restoreConnectorContext(connectorContext, null, newContext);
+ }
+ } finally {
+ integrationContext.restoreContext(context);
+ integrationContext.completeTx(txActive, null);
+ }
+ }
+
+ @Override
+ public void doStop() throws Exception {
+ javax.naming.Context context = integrationContext.setContext();
+ boolean txActive = integrationContext.isTxActive();
+ SharedConnectorInstanceContext newContext = integrationContext.newConnectorInstanceContext(null);
+ ConnectorInstanceContext connectorContext = integrationContext.setConnectorInstance(null, newContext);
+ try {
+ try {
+ super.doStop();
+ } finally {
+ integrationContext.restoreConnectorContext(connectorContext, null, newContext);
+ }
+ } finally {
+ integrationContext.restoreContext(context);
+ integrationContext.completeTx(txActive, null);
+ }
+ }
+
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/GeronimoServletHolder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/GeronimoServletHolder.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/GeronimoServletHolder.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/Host.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/Host.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/Host.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/Host.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,45 @@
+/**
+ * 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.jetty8;
+
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+
+/**
+ * Host gbean for jetty8 containing an array of hosts and virtual hosts
+ */
+@GBean
+public class Host {
+
+ private final String[] hosts;
+ private final String[] virtualHosts;
+
+ public Host(@ParamAttribute(name="hosts")String[] hosts,
+ @ParamAttribute(name="virtualHosts")String[] virtualHosts) {
+ this.hosts = hosts;
+ this.virtualHosts = virtualHosts;
+ }
+
+ public String[] getHosts() {
+ return hosts;
+ }
+
+ public String[] getVirtualHosts() {
+ return virtualHosts;
+ }
+
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/Host.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/Host.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/Host.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyContainer.java?rev=882333&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyContainer.java (added)
+++ geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyContainer.java Thu Nov 19 22:21:48 2009
@@ -0,0 +1,53 @@
+/**
+ * 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.jetty8;
+
+import java.io.File;
+
+import org.apache.geronimo.management.geronimo.WebContainer;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.RequestLog;
+import org.eclipse.jetty.server.Handler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface JettyContainer extends WebContainer {
+ void addListener(Connector listener);
+
+ void removeListener(Connector listener);
+
+ void addContext(Handler context);
+
+ void removeContext(Handler context);
+
+ void resetStats();
+
+ void setStatsOn(boolean on);
+
+ public boolean isStatsOn();
+
+ long getCollectStatisticsStarted();
+
+ void setRequestLog(RequestLog log);
+
+ RequestLog getRequestLog();
+
+ File resolveToJettyHome(String workDir);
+
+}
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyContainer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyContainer.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/main/java/org/apache/geronimo/jetty8/JettyContainer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain