You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ri...@apache.org on 2009/10/20 17:40:55 UTC
svn commit: r827705 - in /geronimo/server/trunk/plugins/tomcat:
geronimo-tomcat6-builder/ geronimo-tomcat6/
geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/
geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/
geronimo-tomcat6...
Author: rickmcguire
Date: Tue Oct 20 15:40:54 2009
New Revision: 827705
URL: http://svn.apache.org/viewvc?rev=827705&view=rev
Log:
Commit tomcat plugin changes so far
Modified:
geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/pom.xml
geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/pom.xml
geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorWrapperGBeanStarter.java
geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/pom.xml?rev=827705&r1=827704&r2=827705&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/pom.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6-builder/pom.xml Tue Oct 20 15:40:54 2009
@@ -27,7 +27,7 @@
<artifactId>tomcat</artifactId>
<version>3.0-SNAPSHOT</version>
</parent>
-
+
<groupId>org.apache.geronimo.modules</groupId>
<artifactId>geronimo-tomcat6-builder</artifactId>
<packaging>bundle</packaging>
@@ -122,6 +122,16 @@
</systemProperties>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Import-Package>org.apache.xmlbeans.impl.schema;version="2.4",*</Import-Package>
+ <!--<_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>-->
+ </instructions>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -149,7 +159,7 @@
</execution>
</executions>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
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=827705&r1=827704&r2=827705&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/pom.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/pom.xml Tue Oct 20 15:40:54 2009
@@ -117,6 +117,15 @@
<artifactId>jcl-over-slf4j</artifactId>
<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>j2ee-deployer</artifactId>
Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=827705&r1=827704&r2=827705&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java Tue Oct 20 15:40:54 2009
@@ -53,6 +53,7 @@
import org.apache.geronimo.webservices.SoapHandler;
import org.apache.geronimo.webservices.WebServiceContainer;
import org.apache.naming.resources.DirContextURLStreamHandlerFactory;
+import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -89,12 +90,14 @@
private final String[] applicationListeners;
private final WebManager manager;
private static boolean first = true;
+ private final BundleContext bundleContext;
/**
* GBean constructor (invoked dynamically when the gbean is declared in a plan)
*/
public TomcatContainer(
@ParamSpecial(type= SpecialAttributeType.classLoader)ClassLoader classLoader,
+ @ParamSpecial(type= SpecialAttributeType.bundleContext)BundleContext bundleContext,
@ParamAttribute(name="catalinaHome")String catalinaHome,
@ParamAttribute(name="applicationListeners")String[] applicationListeners,
@@ -108,8 +111,11 @@
@ParamReference(name="WebManager")WebManager manager) throws MalformedObjectNameException, LifecycleException {
if (classLoader == null) throw new IllegalArgumentException("classLoader cannot be null.");
+ if (bundleContext == null) throw new IllegalArgumentException("bundleContext cannot be null.");
if (engineGBean == null && server == null) throw new IllegalArgumentException("Server and EngineGBean cannot both be null.");
+ this.bundleContext = bundleContext;
+
// Register a stream handler factory for the JNDI protocol
URLStreamHandlerFactory streamHandlerFactory =
new DirContextURLStreamHandlerFactory();
@@ -327,14 +333,14 @@
// //anotherCtxObj.setRealm(realm);
// }
// }
-
+
// add application listeners to the new context
if (applicationListeners != null) {
for (String listener : applicationListeners) {
context.addApplicationListener(listener);
}
}
-
+
try {
host.addChild(context);
} catch (IllegalArgumentException ex) {
@@ -349,7 +355,7 @@
if (context != null) {
if (context instanceof GeronimoStandardContext) {
GeronimoStandardContext stdctx = (GeronimoStandardContext) context;
-
+
try {
stdctx.kill();
} catch (Exception e) {
@@ -372,12 +378,12 @@
embedded.removeConnector(connector);
}
- public void addWebService(String contextPath,
- String[] virtualHosts,
+ public void addWebService(String contextPath,
+ String[] virtualHosts,
WebServiceContainer webServiceContainer,
String policyContextId,
- ConfigurationFactory configurationFactory,
- String realmName,
+ ConfigurationFactory configurationFactory,
+ String realmName,
String authMethod,
Properties properties,
ClassLoader classLoader) throws Exception {
@@ -442,4 +448,13 @@
}
+ /**
+ * Returns the configuration BundleContext associated with
+ * this network container.
+ *
+ * @return The BundleContext instance for the container's configuration.
+ */
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
}
Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java?rev=827705&r1=827704&r2=827705&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java Tue Oct 20 15:40:54 2009
@@ -70,7 +70,7 @@
private static final Logger log = LoggerFactory.getLogger(TomcatManagerImpl.class);
private final Kernel kernel;
private TomcatServerConfigManager tomcatServerConfigManager;
-
+
private static final ConnectorType HTTP_BIO = new ConnectorType(Messages.getString("TomcatManagerImpl.0")); //$NON-NLS-1$
private static final ConnectorType HTTPS_BIO = new ConnectorType(Messages.getString("TomcatManagerImpl.1")); //$NON-NLS-1$
private static final ConnectorType HTTP_NIO = new ConnectorType(Messages.getString("TomcatManagerImpl.2")); //$NON-NLS-1$
@@ -87,7 +87,7 @@
HTTPS_APR,
AJP
);
-
+
private static List<ConnectorType> NON_APR_CONNECTOR_TYPES = Arrays.asList(
HTTP_BIO,
HTTPS_BIO,
@@ -95,7 +95,7 @@
HTTPS_NIO,
AJP
);
-
+
private static Map<ConnectorType, List<ConnectorAttribute>> CONNECTOR_ATTRIBUTES = new HashMap<ConnectorType, List<ConnectorAttribute>>();
static {
@@ -104,7 +104,7 @@
addCommonConnectorAttributes(connectorAttributes);
addHttpConnectorAttributes(connectorAttributes);
CONNECTOR_ATTRIBUTES.put(HTTP_BIO, connectorAttributes);
-
+
//******************* HTTPS - BIO CONNECTOR
connectorAttributes = new ArrayList<ConnectorAttribute>();
addCommonConnectorAttributes(connectorAttributes);
@@ -112,14 +112,14 @@
addSslConnectorAttributes(connectorAttributes);
setAttribute(connectorAttributes, "port", 8443); // SSL port
CONNECTOR_ATTRIBUTES.put(HTTPS_BIO, connectorAttributes);
-
+
//******************* HTTP - NIO CONNECTOR
connectorAttributes = new ArrayList<ConnectorAttribute>();
addCommonConnectorAttributes(connectorAttributes);
addHttpConnectorAttributes(connectorAttributes);
addNioConnectorAttributes(connectorAttributes);
CONNECTOR_ATTRIBUTES.put(HTTP_NIO, connectorAttributes);
-
+
//******************* HTTPS - NIO CONNECTOR
connectorAttributes = new ArrayList<ConnectorAttribute>();
addCommonConnectorAttributes(connectorAttributes);
@@ -128,14 +128,14 @@
addNioConnectorAttributes(connectorAttributes);
setAttribute(connectorAttributes, "port", 8443); // SSL port
CONNECTOR_ATTRIBUTES.put(HTTPS_NIO, connectorAttributes);
-
+
//******************* HTTP - APR CONNECTOR
- connectorAttributes = new ArrayList<ConnectorAttribute>();
+ connectorAttributes = new ArrayList<ConnectorAttribute>();
addCommonConnectorAttributes(connectorAttributes);
addHttpConnectorAttributes(connectorAttributes);
addAprConnectorAttributes(connectorAttributes);
CONNECTOR_ATTRIBUTES.put(HTTP_APR, connectorAttributes);
-
+
//******************* HTTPS - APR CONNECTOR
connectorAttributes = new ArrayList<ConnectorAttribute>();
addCommonConnectorAttributes(connectorAttributes);
@@ -156,7 +156,7 @@
connectorAttributes.add(new ConnectorAttribute<String>("sslCARevocationPath", null, Messages.getString("TomcatManagerImpl.36"), String.class)); //$NON-NLS-1$ //$NON-NLS-2$
setAttribute(connectorAttributes, "port", 8443); // SSL port
CONNECTOR_ATTRIBUTES.put(HTTPS_APR, connectorAttributes);
-
+
//******************* AJP CONNECTOR
connectorAttributes = new ArrayList<ConnectorAttribute>();
addCommonConnectorAttributes(connectorAttributes);
@@ -175,13 +175,13 @@
connectorAttributes.add(new ConnectorAttribute<Boolean>("tomcatAuthentication", true, Messages.getString("TomcatManagerImpl.60"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
CONNECTOR_ATTRIBUTES.put(AJP, connectorAttributes);
}
-
+
private static Map<ConnectorType, GBeanInfo> CONNECTOR_GBEAN_INFOS = new HashMap<ConnectorType, GBeanInfo>();
private static List<String> defaultAttributeNames = new ArrayList<String>();
private static AnnotationGBeanInfoFactory annotationGbeanInfoFactory=new AnnotationGBeanInfoFactory();
static {
-
+
CONNECTOR_GBEAN_INFOS.put(HTTP_BIO, annotationGbeanInfoFactory.getGBeanInfo(Http11ConnectorGBean.class));
CONNECTOR_GBEAN_INFOS.put(HTTPS_BIO, annotationGbeanInfoFactory.getGBeanInfo(Https11ConnectorGBean.class));
CONNECTOR_GBEAN_INFOS.put(HTTP_NIO, annotationGbeanInfoFactory.getGBeanInfo(Http11NIOConnectorGBean.class));
@@ -189,7 +189,7 @@
CONNECTOR_GBEAN_INFOS.put(HTTP_APR, annotationGbeanInfoFactory.getGBeanInfo(Http11APRConnectorGBean.class));
CONNECTOR_GBEAN_INFOS.put(HTTPS_APR, annotationGbeanInfoFactory.getGBeanInfo(Https11APRConnectorGBean.class));
CONNECTOR_GBEAN_INFOS.put(AJP, annotationGbeanInfoFactory.getGBeanInfo(AJP13ConnectorGBean.class));
-
+
defaultAttributeNames.add("name");
defaultAttributeNames.add("protocol");
defaultAttributeNames.add("host");
@@ -201,7 +201,7 @@
defaultAttributeNames.add("secure");
defaultAttributeNames.add("sslProtocol");
defaultAttributeNames.add("sslEnabled");
-
+
}
public TomcatManagerImpl(
@@ -244,14 +244,14 @@
* @param connectorName
*/
public void removeConnector(AbstractName connectorAbstractName) {
-
+
try {
kernel.invoke(connectorAbstractName, "doStop");
String connectorName=(String)kernel.getGBeanData(connectorAbstractName).getAttribute("name");
tomcatServerConfigManager.removeConnector(connectorName);
kernel.unloadGBean(connectorAbstractName);
} catch (Exception e) {
- log.error("error when removing connector:"+connectorAbstractName,e);
+ log.error("error when removing connector:"+connectorAbstractName,e);
}
}
@@ -316,17 +316,17 @@
gbeanData.setAttribute(connectorAttribute.getAttributeName(), connectorAttribute.getValue());
initParams.put(connectorAttribute.getAttributeName(), connectorAttribute.getStringValue());
}
-
+
gbeanData.setAttribute("initParams", initParams);
AbstractNameQuery query = new AbstractNameQuery(ServerInfo.class.getName());
Set set = kernel.listGBeans(query);
-
+
AbstractName serverInfo = (AbstractName) set.iterator().next();
gbeanData.setReferencePattern("ServerInfo", serverInfo);
try {
- kernel.loadGBean(gbeanData, container.getClass().getClassLoader());
+ kernel.loadGBean(gbeanData, container.getBundleContext());
kernel.startGBean(name);
} catch (Exception e) {
log.error("Error when adding new tomcat connector" + uniqueName, e);
@@ -411,7 +411,7 @@
}
}
- // see http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
+ // see http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
private static void addCommonConnectorAttributes(List<ConnectorAttribute> connectorAttributes) {
connectorAttributes.add(new ConnectorAttribute<Boolean>("allowTrace", false, Messages.getString("TomcatManagerImpl.80"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
connectorAttributes.add(new ConnectorAttribute<Boolean>("emptySessionPath", false, Messages.getString("TomcatManagerImpl.82"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -425,9 +425,9 @@
connectorAttributes.add(new ConnectorAttribute<Boolean>("useBodyEncodingForURI", false, Messages.getString("TomcatManagerImpl.99"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
connectorAttributes.add(new ConnectorAttribute<Boolean>("useIPVHosts", false, Messages.getString("TomcatManagerImpl.101"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
connectorAttributes.add(new ConnectorAttribute<Boolean>("xpoweredBy", false, Messages.getString("TomcatManagerImpl.103"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
-
+
}
-
+
// see http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
private static void addHttpConnectorAttributes(List<ConnectorAttribute> connectorAttributes) {
connectorAttributes.add(new ConnectorAttribute<Integer>("acceptCount", 10, Messages.getString("TomcatManagerImpl.105"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -453,7 +453,7 @@
connectorAttributes.add(new ConnectorAttribute<Boolean>("tcpNoDelay", true, Messages.getString("TomcatManagerImpl.151"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
connectorAttributes.add(new ConnectorAttribute<Integer>("threadPriority", Thread.NORM_PRIORITY, Messages.getString("TomcatManagerImpl.153"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
// see http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
private static void addSslConnectorAttributes(List<ConnectorAttribute> connectorAttributes) {
connectorAttributes.add(new ConnectorAttribute<String>("algorithm", KeyManagerFactory.getDefaultAlgorithm(), Messages.getString("TomcatManagerImpl.155"), String.class)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -471,7 +471,7 @@
connectorAttributes.add(new ConnectorAttribute<Boolean>("secure", true, Messages.getString("TomcatManagerImpl.170"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
connectorAttributes.add(new ConnectorAttribute<Boolean>("sslEnabled", true, Messages.getString("TomcatManagerImpl.167"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
// see http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
private static void addNioConnectorAttributes(List<ConnectorAttribute> connectorAttributes) {
connectorAttributes.add(new ConnectorAttribute<Boolean>("useSendfile", true, Messages.getString("TomcatManagerImpl.181"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -517,7 +517,7 @@
connectorAttributes.add(new ConnectorAttribute<Boolean>("useSendfile", true, Messages.getString("TomcatManagerImpl.253"), Boolean.class, true)); //$NON-NLS-1$ //$NON-NLS-2$
connectorAttributes.add(new ConnectorAttribute<Integer>("sendfileSize", 1024, Messages.getString("TomcatManagerImpl.255"), Integer.class, true)); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
private static <T> void setAttribute (List<ConnectorAttribute> connectorAttributes, String attributeName, T value) {
for (ConnectorAttribute connectorAttribute : connectorAttributes) {
if (connectorAttribute.getAttributeName().equals(attributeName)) {
@@ -526,10 +526,10 @@
}
}
}
-
+
public ConnectorType getConnectorType(AbstractName connectorName) {
- ConnectorType connectorType = null;
+ ConnectorType connectorType = null;
try {
GBeanInfo info = kernel.getGBeanInfo(connectorName);
boolean found = false;
@@ -555,23 +555,23 @@
} catch (Exception e) {
log.error("Failed to get connector type", e);
}
-
+
return connectorType;
}
/*
* update server.xml based on changes to connectors
* 1, if there's existing <Connector> for connectorName, update it.
- * 2, if there's no existing <Connector> for connectorName, create it. *
+ * 2, if there's no existing <Connector> for connectorName, create it. *
*/
@SuppressWarnings("unchecked")
public void updateConnectorConfig(AbstractName connectorName) throws Exception {
-
+
//1, getting service name
-
+
String serviceName;
-
-
+
+
GBeanData containerGBeanData = null;
try {
@@ -579,70 +579,70 @@
ReferencePatterns rp = connectorGBeanData.getReferencePatterns("TomcatContainer");
containerGBeanData = kernel.getGBeanData(rp.getAbstractName());
-
- Object object = containerGBeanData.getAttribute("serviceName");
+
+ Object object = containerGBeanData.getAttribute("serviceName");
serviceName = (object == null) ? null : object.toString();
} catch (GBeanNotFoundException e) {
-
+
throw new Exception("Can't find connector GBean when updating connector config",e);
} catch (InternalKernelException e) {
-
+
throw new Exception("error to update conector config",e);
}
-
-
-
+
+
+
//2, getting connector name
-
+
Map<String,String> attributesToUpdate=new HashMap<String,String>();
-
- String connectorUniqueName = (String) kernel.getAttribute(connectorName, "name");
-
+
+ String connectorUniqueName = (String) kernel.getAttribute(connectorName, "name");
+
// 3, populate tomcat protocol attribute.
- String tomcatProtocol=(String) kernel.getAttribute(connectorName, "tomcatProtocol");
-
+ String tomcatProtocol=(String) kernel.getAttribute(connectorName, "tomcatProtocol");
+
attributesToUpdate.put("protocol", tomcatProtocol);
-
-
+
+
// 4, remove the unchanged attributes, we don't need to store them back to server.xml.
-
+
ConnectorType connectorType = this.getConnectorType(connectorName);
List<ConnectorAttribute> defaultAttributes = this.getConnectorAttributes(connectorType);
-
+
for (ConnectorAttribute defaultAttribute : defaultAttributes) {
String attributeName = defaultAttribute.getAttributeName();
Object latestAttibuteValue=null;
-
+
try {
latestAttibuteValue=kernel.getAttribute(connectorName, attributeName);
} catch (Exception e) {
-
+
continue;
}
-
-
+
+
if (null == latestAttibuteValue) {
-
+
if(defaultAttributeNames.contains(attributeName)){
-
+
//put default value to attributes listed in defaultAttributeNames.
attributesToUpdate.put(attributeName, defaultAttribute.getStringValue());
-
+
} else {
-
+
continue;
}
} else if(defaultAttribute.getValue()!=null&&defaultAttribute.getValue().equals(latestAttibuteValue)){
-
+
if (defaultAttributeNames.contains(attributeName)) {
attributesToUpdate.put(attributeName, defaultAttribute.getStringValue());
@@ -651,24 +651,24 @@
//don't update the unchanged attributes.
continue;
}
-
+
} else {
//adding changed attributes to attributesToUpdate map.
ConnectorAttribute latestAttibute = new ConnectorAttribute(defaultAttribute);
latestAttibute.setValue(latestAttibuteValue);
- attributesToUpdate.put(attributeName, latestAttibute.getStringValue());
+ attributesToUpdate.put(attributeName, latestAttibute.getStringValue());
}
}
-
-
-
+
+
+
//5, call tomcatServerConfigManager to update connector info in server.xml
-
+
tomcatServerConfigManager.updateConnector(attributesToUpdate, connectorUniqueName, serviceName);
}
-
+
@@ -676,16 +676,16 @@
try {
Connector connector = new Connector("HTTP/1.1");
- if (!connector.getProtocolHandlerClassName().equalsIgnoreCase("org.apache.coyote.http11.Http11AprProtocol")) {
+ if (!connector.getProtocolHandlerClassName().equalsIgnoreCase("org.apache.coyote.http11.Http11AprProtocol")) {
return false;
- }
+ }
} catch (Exception e) {
-
+
return false;
}
return true;
}
-
+
Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorWrapperGBeanStarter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorWrapperGBeanStarter.java?rev=827705&r1=827704&r2=827705&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorWrapperGBeanStarter.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorWrapperGBeanStarter.java Tue Oct 20 15:40:54 2009
@@ -36,13 +36,14 @@
import org.apache.geronimo.system.serverinfo.ServerInfo;
import org.apache.geronimo.tomcat.TomcatContainer;
import org.apache.geronimo.tomcat.TomcatServerGBean;
+import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This class is used to create corresponding connector GBeans based on
* connectors defined in server.xml
- *
+ *
* @version $Rev$ $Date$
*/
@GBean
@@ -51,23 +52,23 @@
private static final Logger log = LoggerFactory.getLogger(ConnectorWrapperGBeanStarter.class);
private final TomcatServerGBean server;
private final TomcatContainer container;
- private final ClassLoader classLoader;
+ private final BundleContext bundleContext;
private final Kernel kernel;
public ConnectorWrapperGBeanStarter(
@ParamReference(name = "Server") TomcatServerGBean server,
@ParamReference(name = "TomcatContainer") TomcatContainer container,
- @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader,
+ @ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext bundleContext,
@ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel) throws Exception {
this.server = server;
this.container = container;
- this.classLoader = classLoader;
+ this.bundleContext = bundleContext;
this.kernel = kernel;
}
- private void buildConnectorGBean(ClassLoader cl, Kernel kernel, Connector conn, TomcatContainer container) {
+ private void buildConnectorGBean(BundleContext context, Kernel kernel, Connector conn, TomcatContainer container) {
GBeanInfo gbeanInfo = this.getConnectorGBeanInfo(conn);
@@ -96,7 +97,7 @@
gbeanData.setReferencePattern("ServerInfo", set.iterator().next());
try {
- kernel.loadGBean(gbeanData, cl);
+ kernel.loadGBean(gbeanData, context);
kernel.startGBean(name);
} catch (Exception e) {
log.error("Error when building connectorGbean for connector: " + conn.getAttribute("address") + ":"
@@ -109,8 +110,8 @@
String className = conn.getProtocolHandlerClassName();
AnnotationGBeanInfoFactory annotationGbeanInfoFactory=new AnnotationGBeanInfoFactory();
-
-
+
+
// BIO
if (className.equalsIgnoreCase("org.apache.coyote.http11.Http11Protocol")) {
if (conn.getScheme().equalsIgnoreCase("https"))
@@ -147,7 +148,7 @@
else
return annotationGbeanInfoFactory.getGBeanInfo(Http11APRConnectorGBean.class);
}
-
+
return null;
}
@@ -162,8 +163,8 @@
Connector[] connectors = server.getService(null).findConnectors();
for (Connector conn : connectors) {
-
- this.buildConnectorGBean(classLoader, kernel, conn, container);
+
+ this.buildConnectorGBean(bundleContext, kernel, conn, container);
}
}
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=827705&r1=827704&r2=827705&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 Oct 20 15:40:54 2009
@@ -18,6 +18,9 @@
import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
import org.apache.geronimo.connector.outbound.connectiontracking.GeronimoTransactionListener;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.osgi.MockBundleContext;
+import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.security.SecurityServiceImpl;
import org.apache.geronimo.security.deploy.PrincipalInfo;
import org.apache.geronimo.security.deploy.SubjectInfo;
@@ -55,7 +58,7 @@
* @version $Rev$ $Date$
*/
public abstract class AbstractWebModuleTest extends TestSupport {
-
+
protected ClassLoader cl = this.getClass().getClassLoader();
protected final static String securityRealmName = "demo-properties-realm";
protected ConnectorGBean connector;
@@ -184,7 +187,9 @@
engine.doStart();
ServerInfo serverInfo = new BasicServerInfo(".");
- container = new TomcatContainer(cl, new File(BASEDIR, "target/var/catalina").toString(), null, null, null, engine, null, serverInfo, null, null);
+ container = new TomcatContainer(cl,
+ new MockBundleContext(getClass().getClassLoader(), "", new HashMap<Artifact, ConfigurationData>(), null),
+ new File(BASEDIR, "target/var/catalina").toString(), null, null, null, engine, null, serverInfo, null, null);
container.doStart();
connector = new Http11ConnectorGBean("HTTP", null, "localhost", port++, container, serverInfo,null);