djencks 2004/01/15 18:19:23
Modified: modules/web/src/java/org/apache/geronimo/web
AbstractWebAccessLog.java
AbstractWebApplication.java
AbstractWebConnector.java AbstractWebContainer.java
WebApplication.java
modules/web/src/java/org/apache/geronimo/web/jetty
JettyWebAccessLog.java JettyWebApplication.java
JettyWebConnector.java JettyWebContainer.java
Log:
Initial GBean-ization
Revision Changes Path
1.3 +91 -63
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebAccessLog.java
Index: AbstractWebAccessLog.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebAccessLog.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractWebAccessLog.java 30 Dec 2003 08:28:57 -0000 1.2
+++ AbstractWebAccessLog.java 16 Jan 2004 02:19:23 -0000 1.3
@@ -58,13 +58,18 @@
package org.apache.geronimo.web;
import java.net.URI;
+import java.util.Arrays;
import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
import org.apache.geronimo.kernel.service.GeronimoAttributeInfo;
-
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GConstructorInfo;
/*
--------------------------------------------------------------------------------------
*/
+
/**
* AbstractWebAccessLog
*
@@ -72,28 +77,46 @@
*/
public abstract class AbstractWebAccessLog implements WebAccessLog {
- protected String logImpl;
+ private static final GBeanInfo GBEAN_INFO;
+
+ protected String logImplementationClass;
protected URI logLocation;
protected String logPattern;
protected String logSuffix;
protected String logPrefix;
protected String logDateFormat;
- protected int rolloverHrs =0;
- protected boolean resolutionEnabled = false;
- protected boolean appendEnabled = true;
+ protected int logRolloverIntervalHrs = 0;
+ protected boolean resolveHostNames = false;
+ protected boolean append = true;
protected int logRetentionDays;
+ //deprecated, remove when GBean only
+ public AbstractWebAccessLog() {
+ }
+ public AbstractWebAccessLog(String logImplementationClass, URI
logLocation, String logPattern, int logRetentionDays,
+ int logRolloverIntervalHrs, String
logPrefix, String logSuffix, String logDateFormat,
+ boolean resolveHostNames, boolean append) {
+ this.logImplementationClass = logImplementationClass;
+ this.logLocation = logLocation;
+ this.logPattern = logPattern;
+ this.logRetentionDays = logRetentionDays;
+ this.logRolloverIntervalHrs = logRolloverIntervalHrs;
+ this.logPrefix = logPrefix;
+ this.logSuffix = logSuffix;
+ this.logDateFormat = logDateFormat;
+ this.resolveHostNames = resolveHostNames;
+ this.append = append;
+ }
/*
--------------------------------------------------------------------------------------
*/
/*
* @param uri
* @see org.apache.geronimo.web.WebAccessLog#setLogLocation(java.net.URI)
*/
- public void setLogLocation(URI uri)
- {
- logLocation = uri;
+ public void setLogLocation(URI uri) {
+ logLocation = uri;
}
/*
--------------------------------------------------------------------------------------
*/
@@ -101,8 +124,7 @@
* @return
* @see org.apache.geronimo.web.WebAccessLog#getLogLocation()
*/
- public URI getLogLocation()
- {
+ public URI getLogLocation() {
return logLocation;
}
@@ -111,14 +133,13 @@
* @param pattern
* @see
org.apache.geronimo.web.WebAccessLog#setLogPattern(java.lang.String)
*/
- public void setLogPattern(String pattern)
- {
- if (pattern.equalsIgnoreCase (NCSA_COMMON_NAME))
+ public void setLogPattern(String pattern) {
+ if (pattern.equalsIgnoreCase(NCSA_COMMON_NAME))
logPattern = NCSA_COMMON_PATTERN;
- else if (pattern.equalsIgnoreCase (NCSA_EXTENDED_NAME))
- logPattern = NCSA_EXTENDED_PATTERN;
- else
- logPattern = pattern;
+ else if (pattern.equalsIgnoreCase(NCSA_EXTENDED_NAME))
+ logPattern = NCSA_EXTENDED_PATTERN;
+ else
+ logPattern = pattern;
}
/*
--------------------------------------------------------------------------------------
*/
@@ -126,9 +147,8 @@
* @return
* @see org.apache.geronimo.web.WebAccessLog#getLogPattern()
*/
- public String getLogPattern()
- {
- return logPattern;
+ public String getLogPattern() {
+ return logPattern;
}
/*
--------------------------------------------------------------------------------------
*/
@@ -136,9 +156,8 @@
* @param days
* @see org.apache.geronimo.web.WebAccessLog#setLogRetentionDays(int)
*/
- public void setLogRetentionDays(int days)
- {
- logRetentionDays = days;
+ public void setLogRetentionDays(int days) {
+ logRetentionDays = days;
}
/*
--------------------------------------------------------------------------------------
*/
@@ -146,9 +165,8 @@
* @return
* @see org.apache.geronimo.web.WebAccessLog#getLogRetentionDays()
*/
- public int getLogRetentionDays()
- {
- return logRetentionDays;
+ public int getLogRetentionDays() {
+ return logRetentionDays;
}
/*
--------------------------------------------------------------------------------------
*/
@@ -156,9 +174,8 @@
* @param state
* @see org.apache.geronimo.web.WebAccessLog#setLogRollover(boolean)
*/
- public void setLogRolloverIntervalHrs(int hrs)
- {
- rolloverHrs = hrs;
+ public void setLogRolloverIntervalHrs(int hrs) {
+ logRolloverIntervalHrs = hrs;
}
/*
--------------------------------------------------------------------------------------
*/
@@ -166,9 +183,8 @@
* @return
* @see org.apache.geronimo.web.WebAccessLog#getLogRollover()
*/
- public int getLogRolloverIntervalHrs()
- {
- return rolloverHrs;
+ public int getLogRolloverIntervalHrs() {
+ return logRolloverIntervalHrs;
}
/*
--------------------------------------------------------------------------------------
*/
@@ -176,8 +192,7 @@
* @param prefix
* @see
org.apache.geronimo.web.WebAccessLog#setLogPrefix(java.lang.String)
*/
- public void setLogPrefix(String prefix)
- {
+ public void setLogPrefix(String prefix) {
logPrefix = prefix;
}
@@ -186,8 +201,7 @@
* @return
* @see org.apache.geronimo.web.WebAccessLog#getLogPrefix()
*/
- public String getLogPrefix()
- {
+ public String getLogPrefix() {
return logPrefix;
}
@@ -196,8 +210,7 @@
* @param suffix
* @see
org.apache.geronimo.web.WebAccessLog#setLogSuffix(java.lang.String)
*/
- public void setLogSuffix(String suffix)
- {
+ public void setLogSuffix(String suffix) {
logSuffix = suffix;
}
@@ -206,8 +219,7 @@
* @return
* @see org.apache.geronimo.web.WebAccessLog#getLogSuffix()
*/
- public String getLogSuffix()
- {
+ public String getLogSuffix() {
return logSuffix;
}
@@ -216,8 +228,7 @@
* @param dateFormat
* @see
org.apache.geronimo.web.WebAccessLog#setLogDateFormat(java.lang.String)
*/
- public void setLogDateFormat(String dateFormat)
- {
+ public void setLogDateFormat(String dateFormat) {
logDateFormat = dateFormat;
}
@@ -226,8 +237,7 @@
* @return
* @see org.apache.geronimo.web.WebAccessLog#getLogDateFormat()
*/
- public String getLogDateFormat()
- {
+ public String getLogDateFormat() {
return logDateFormat;
}
@@ -236,9 +246,8 @@
* @param state
* @see org.apache.geronimo.web.WebAccessLog#setResolveHostNames(boolean)
*/
- public void setResolveHostNames(boolean state)
- {
- resolutionEnabled = state;
+ public void setResolveHostNames(boolean state) {
+ resolveHostNames = state;
}
/*
--------------------------------------------------------------------------------------
*/
@@ -246,9 +255,8 @@
* @return
* @see org.apache.geronimo.web.WebAccessLog#getResolveHostNames()
*/
- public boolean getResolveHostNames()
- {
- return resolutionEnabled;
+ public boolean getResolveHostNames() {
+ return resolveHostNames;
}
/*
--------------------------------------------------------------------------------------
*/
@@ -256,9 +264,8 @@
* @return
* @see org.apache.geronimo.web.WebAccessLog#getAppend()
*/
- public boolean getAppend()
- {
- return appendEnabled;
+ public boolean getAppend() {
+ return append;
}
/*
--------------------------------------------------------------------------------------
*/
@@ -266,9 +273,8 @@
* @param state
* @see org.apache.geronimo.web.WebAccessLog#setAppend(boolean)
*/
- public void setAppend(boolean state)
- {
- appendEnabled = state;
+ public void setAppend(boolean state) {
+ append = state;
}
/*
--------------------------------------------------------------------------------------
*/
@@ -276,9 +282,8 @@
* @return
* @see org.apache.geronimo.web.WebAccessLog#getLogImplementationClass()
*/
- public String getLogImplementationClass()
- {
- return logImpl;
+ public String getLogImplementationClass() {
+ return logImplementationClass;
}
/*
--------------------------------------------------------------------------------------
*/
@@ -286,9 +291,32 @@
* @param classname
* @see
org.apache.geronimo.web.WebAccessLog#setLogImplementationClass(java.lang.String)
*/
- public void setLogImplementationClass(String classname)
- {
- logImpl = classname;
+ public void setLogImplementationClass(String classname) {
+ logImplementationClass = classname;
+ }
+
+ static {
+ GBeanInfoFactory infoFactory = new
GBeanInfoFactory(AbstractWebAccessLog.class.getName());
+ infoFactory.addAttribute(new
GAttributeInfo("LogImplementationClass", true, "class of log implementation. I
think this is speculative"));
+ infoFactory.addAttribute(new GAttributeInfo("LogLocation", true,
"URI indicating where to put the log"));
+ infoFactory.addAttribute(new GAttributeInfo("LogPattern", true,
"NCSA log pattern spec"));
+ infoFactory.addAttribute(new GAttributeInfo("LogRetentionDays",
true, "Number of days to retain logs"));
+ infoFactory.addAttribute(new
GAttributeInfo("LogRolloverIntervalHrs", true, "Hours between log rollovers"));
+ infoFactory.addAttribute(new GAttributeInfo("LogPrefix", true, "file
name prefix for log files"));
+ infoFactory.addAttribute(new GAttributeInfo("LogSuffix", true, "file
name suffix for log files"));
+ infoFactory.addAttribute(new GAttributeInfo("LogDateFormat", true,
"Date format to use in logs, following java.text.DateFormat (??)"));
+ infoFactory.addAttribute(new GAttributeInfo("ResolveHostNames",
true, "Should host names be resolved"));
+ infoFactory.addAttribute(new GAttributeInfo("Append", true, "Should
logs be appended or overwritten (? rolled over)"));
+ infoFactory.setConstructor(new GConstructorInfo(
+ Arrays.asList(new Object[] {"LogImplementationClass",
"LogLocation", "LogPattern", "LogRetentionDays", "LogRolloverIntervalHrs",
"LogPrefix",
+ "LogSuffix", "LogDateFormat", "ResolveHostNames", "Append"}),
+ Arrays.asList(new Object[] {String.class, URI.class,
String.class, Integer.TYPE, Integer.TYPE, String.class, String.class,
String.class, Boolean.TYPE, Boolean.TYPE})
+ ));
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGbeanInfo() {
+ return GBEAN_INFO;
}
public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
1.13 +100 -44
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebApplication.java
Index: AbstractWebApplication.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebApplication.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- AbstractWebApplication.java 30 Dec 2003 08:28:57 -0000 1.12
+++ AbstractWebApplication.java 16 Jan 2004 02:19:23 -0000 1.13
@@ -58,6 +58,7 @@
import java.net.URI;
+import java.util.Arrays;
import javax.management.ObjectName;
import javax.naming.Context;
@@ -67,6 +68,11 @@
import
org.apache.geronimo.deployment.model.geronimo.web.GeronimoWebAppDocument;
import org.apache.geronimo.deployment.model.web.Servlet;
import org.apache.geronimo.deployment.model.web.WebApp;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GConstructorInfo;
+import org.apache.geronimo.gbean.GEndpointInfo;
import org.apache.geronimo.kernel.service.GeronimoMBeanEndpoint;
import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
import org.apache.geronimo.transaction.manager.UserTransactionImpl;
@@ -83,6 +89,8 @@
*/
public abstract class AbstractWebApplication implements WebApplication {
+ private static final GBeanInfo GBEAN_INFO;
+
//uri of the webapp
protected final URI uri;
@@ -108,10 +116,27 @@
protected String contextPath;
//class loading delegation model. Default to web-app scope
- private boolean java2ClassloadingCompliance;
+ private boolean java2ClassLoadingCompliance;
private ClassLoader parentClassLoader;
private UserTransactionImpl userTransaction;
+ public AbstractWebApplication(URI uri, ClassLoader parentClassLoader,
WebApp webApp, GeronimoWebAppDocument geronimoWebAppDocument, String
contextPath,
+ Context context, boolean
java2ClassLoadingCompliance, TransactionManager transactionManager,
TrackedConnectionAssociator trackedConnectionAssociator) {
+ this.uri = uri;
+ this.parentClassLoader = parentClassLoader;
+ this.webApp = webApp;
+ this.geronimoWebAppDoc = geronimoWebAppDocument;
+ this.contextPath = contextPath;
+ this.context = context;
+ this.java2ClassLoadingCompliance = java2ClassLoadingCompliance;
+ userTransaction = new UserTransactionImpl();
+ userTransaction.setTransactionManager(transactionManager);
+
userTransaction.setTrackedConnectionAssociator(trackedConnectionAssociator);
+ }
+
+ /**
+ * @deprecated, remove when GBean -only
+ */
public AbstractWebApplication(WebApplicationContext
webApplicationContext) {
uri = webApplicationContext.uri;
parentClassLoader = webApplicationContext.parentClassLoader;
@@ -120,7 +145,7 @@
contextPath = webApplicationContext.contextPath;
context = webApplicationContext.context;
userTransaction = webApplicationContext.userTransaction;
- java2ClassloadingCompliance =
webApplicationContext.java2ClassLoadingCompliance;
+ java2ClassLoadingCompliance =
webApplicationContext.java2ClassLoadingCompliance;
}
public TransactionManager getTransactionManager() {
@@ -143,7 +168,7 @@
* @return the URI of the webapp
* @see org.apache.geronimo.web.WebApplication#getURI()
*/
- public URI getURI (){
+ public URI getURI() {
return uri;
}
@@ -153,8 +178,8 @@
* webapps wanting to load class will try their own context class loader
first.
* @return true if application is using Java 2 compliant class loading
*/
- public boolean getJava2ClassloadingCompliance() {
- return java2ClassloadingCompliance;
+ public boolean getJava2ClassLoadingCompliance() {
+ return java2ClassLoadingCompliance;
}
@@ -190,7 +215,7 @@
return geronimoWebAppDoc;
}
- public WebApp getWebApp () {
+ public WebApp getWebApp() {
return webApp;
}
//computed info:
@@ -201,18 +226,18 @@
* @see org.apache.geronimo.web.WebApplication#getServlets()
*/
public String[] getServlets() {
- if (servlets == null) {
- if (webApp == null)
- return null;
-
- Servlet[] servletObjs = webApp.getServlet();
- servlets = new String[servletObjs.length];
- for (int i=0; i<servletObjs.length; i++) {
- servlets[i] = servletObjs[i].getServletName();
- }
- }
+ if (servlets == null) {
+ if (webApp == null)
+ return null;
+
+ Servlet[] servletObjs = webApp.getServlet();
+ servlets = new String[servletObjs.length];
+ for (int i = 0; i < servletObjs.length; i++) {
+ servlets[i] = servletObjs[i].getServletName();
+ }
+ }
- return servlets;
+ return servlets;
}
/** JSR077
@@ -223,41 +248,72 @@
*/
public abstract String getDeploymentDescriptor();
- /**JSR077
- * @return ObjectName(s) as string of JVM(s) on which this webapp is
deployed
- * @see org.apache.geronimo.kernel.management.J2EEModule#getJavaVMs()
- */
- public String[] getJavaVMs() {
- // TODO
- return null;
- }
-
-
- /** JSR077
- * @return ObjectName as string of Geronimo server on which this webapp
is deployed
- * @see
org.apache.geronimo.kernel.management.J2EEDeployedObject#getServer()
- */
- public String getServer() {
- // TODO
- return null;
- }
+ /**JSR077
+ * @return ObjectName(s) as string of JVM(s) on which this webapp is
deployed
+ * @see org.apache.geronimo.kernel.management.J2EEModule#getJavaVMs()
+ */
+ public String[] getJavaVMs() {
+ // TODO
+ return null;
+ }
+
+ /** JSR077
+ * @return ObjectName as string of Geronimo server on which this webapp
is deployed
+ * @see
org.apache.geronimo.kernel.management.J2EEDeployedObject#getServer()
+ */
+ public String getServer() {
+ // TODO
+ return null;
+ }
+
+ static {
+ GBeanInfoFactory infoFactory = new
GBeanInfoFactory(AbstractWebApplication.class.getName());
+ infoFactory.addAttribute(new GAttributeInfo("URI", true, "URI of
this web application", Boolean.TRUE, Boolean.FALSE));
+ infoFactory.addAttribute(new GAttributeInfo("ParentClassLoader",
true, "Parent ClassLoader for this web application", Boolean.TRUE,
Boolean.FALSE));
+ infoFactory.addAttribute(new GAttributeInfo("ContextPath", true,
"Context path for this web application", Boolean.TRUE, Boolean.FALSE));
+ infoFactory.addAttribute(new GAttributeInfo("DeploymentDescriptor",
true, "Deployment descriptor of this web application as a String",
Boolean.TRUE, Boolean.FALSE));
+ infoFactory.addAttribute(new GAttributeInfo("GeronimoWebAppDoc",
true, "Geronimo deployment descriptor of this web application as a POJO",
Boolean.TRUE, Boolean.FALSE));
+ infoFactory.addAttribute(new
GAttributeInfo("Java2ClassloadingCompliance", true, "Does this web application
follow Java2 class loading semantics or the servlet spec", Boolean.TRUE,
Boolean.FALSE));
+ infoFactory.addAttribute(new GAttributeInfo("ComponentContext",
true, "Read only jndi context for this web application", Boolean.TRUE,
Boolean.FALSE));
+ infoFactory.addAttribute(new GAttributeInfo("Servlets", false,
"Array of servlet names in this web application", Boolean.TRUE, Boolean.FALSE));
+ infoFactory.addEndpoint(new GEndpointInfo("TransactionManager",
TransactionManager.class.getName()));
+ infoFactory.addEndpoint(new
GEndpointInfo("TrackedConnectionAssociator",
TrackedConnectionAssociator.class.getName()));
+ infoFactory.setConstructor(new GConstructorInfo(
+ Arrays.asList(new Object[]{"URI", "ParentClassLoader",
"WebApp", "GeronimoWebAppDoc", "ContextPath",
+ "Context", "Java2ClassLoadingCompliance",
"TransactionManager", "TrackedConnectionAssociator"}),
+ Arrays.asList(new Object[]{URI.class, ClassLoader.class,
WebApp.class, GeronimoWebAppDocument.class, String.class,
+ Context.class,Boolean.TYPE,
TransactionManager.class, TrackedConnectionAssociator.class})
+ ));
+
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGbeanInfo() {
+ return GBEAN_INFO;
+ }
+
+ /**
+ * @deprecated, remove when GBean -only
+ */
public static GeronimoMBeanInfo getGeronimoMBeanInfo(String
containerName) throws Exception {
GeronimoMBeanInfo mbeanInfo = new GeronimoMBeanInfo();
//should do this individually with comments
mbeanInfo.addOperationsDeclaredIn(WebApplication.class);
+ /*
mbeanInfo.addEndpoint(new GeronimoMBeanEndpoint("WebContainer",
AbstractWebContainer.class.getName(),
ObjectName.getInstance(AbstractWebContainer.BASE_WEB_CONTAINER_NAME +
AbstractWebContainer.CONTAINER_CLAUSE + containerName),
true));
- mbeanInfo.addEndpoint(new
GeronimoMBeanEndpoint("TransactionManager",
- TransactionManager.class.getName(),
-
ObjectName.getInstance("geronimo.transaction:role=TransactionManager"),
- true));
- mbeanInfo.addEndpoint(new
GeronimoMBeanEndpoint("TrackedConnectionAssociator",
- TrackedConnectionAssociator.class.getName(),
-
ObjectName.getInstance("geronimo.connector:role=ConnectionTrackingCoordinator"),
- true));
+ */
+ mbeanInfo.addEndpoint(new GeronimoMBeanEndpoint("TransactionManager",
+ TransactionManager.class.getName(),
+
ObjectName.getInstance("geronimo.transaction:role=TransactionManager"),
+ true));
+ mbeanInfo.addEndpoint(new
GeronimoMBeanEndpoint("TrackedConnectionAssociator",
+ TrackedConnectionAssociator.class.getName(),
+
ObjectName.getInstance("geronimo.connector:role=ConnectionTrackingCoordinator"),
+ true));
return mbeanInfo;
}
1.6 +60 -19
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebConnector.java
Index: AbstractWebConnector.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebConnector.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AbstractWebConnector.java 30 Dec 2003 21:18:35 -0000 1.5
+++ AbstractWebConnector.java 16 Jan 2004 02:19:23 -0000 1.6
@@ -5,6 +5,10 @@
import org.apache.geronimo.kernel.service.GeronimoAttributeInfo;
import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GConstructorInfo;
/**
@@ -21,21 +25,37 @@
public static final String HTTPS_PROTOCOL = "https";
public static final String AJP13_PROTOCOL = "ajp13";
- private int _port = 0;
- private String _protocol = null;
- private String _interface = null;
- private int _maxConnections = 0;
- private int _maxIdleTime = 0;
- private List _contexts = null;
+ private static final GBeanInfo GBEAN_INFO;
+ private int port = 0;
+ private String protocol = null;
+ private String iface = null;
+ private int maxConnections = 0;
+ private int maxIdleTime = 0;
+ private List contexts = null;
+ /**
+ * @deprecated, remove when GBean -only
+ */
+ public AbstractWebConnector() {
+
+ }
+
+ public AbstractWebConnector(String protocol, String iface, int port, int
maxConnections, int maxIdleTime, List contexts) {
+ this.protocol = protocol;
+ this.iface = iface;
+ this.port = port;
+ this.maxConnections = maxConnections;
+ this.maxIdleTime = maxIdleTime;
+ this.contexts = contexts;
+ }
/* (non-Javadoc)
* @see org.apache.geronimo.web.WebConnector#setPort(int)
*/
public void setPort(int port)
{
- _port = port;
+ this.port = port;
}
/* (non-Javadoc)
@@ -43,7 +63,7 @@
*/
public int getPort()
{
- return _port;
+ return port;
}
/* (non-Javadoc)
@@ -51,7 +71,7 @@
*/
public void setProtocol(String protocol)
{
- _protocol = protocol;
+ this.protocol = protocol;
}
/* (non-Javadoc)
@@ -59,7 +79,7 @@
*/
public String getProtocol()
{
- return _protocol;
+ return protocol;
}
/* (non-Javadoc)
@@ -67,7 +87,7 @@
*/
public void setInterface(String iface)
{
- _interface = iface;
+ this.iface = iface;
}
/* (non-Javadoc)
@@ -75,7 +95,7 @@
*/
public String getInterface()
{
- return _interface;
+ return iface;
}
/* (non-Javadoc)
@@ -83,7 +103,7 @@
*/
public void setMaxConnections(int maxConnects)
{
- _maxConnections = maxConnects;
+ maxConnections = maxConnects;
}
/* (non-Javadoc)
@@ -91,7 +111,7 @@
*/
public int getMaxConnections()
{
- return _maxConnections;
+ return maxConnections;
}
/* (non-Javadoc)
@@ -99,7 +119,7 @@
*/
public void setMaxIdleTime(int maxIdleTime)
{
- _maxIdleTime = maxIdleTime;
+ this.maxIdleTime = maxIdleTime;
}
/* (non-Javadoc)
@@ -107,7 +127,7 @@
*/
public int getMaxIdleTime()
{
- return _maxIdleTime;
+ return maxIdleTime;
}
/* (non-Javadoc)
@@ -115,7 +135,7 @@
*/
public void setContexts(String[] contexts)
{
- _contexts = Arrays.asList(contexts);
+ this.contexts = Arrays.asList(contexts);
}
/* (non-Javadoc)
@@ -123,10 +143,31 @@
*/
public String[] getContexts()
{
- return (String[])_contexts.toArray(new String[0]);
+ return (String[])contexts.toArray(new String[0]);
}
+ static {
+ GBeanInfoFactory infoFactory = new
GBeanInfoFactory(AbstractWebConnector.class.getName());
+ infoFactory.addAttribute(new GAttributeInfo("Port", true, "port to
listen on"));
+ infoFactory.addAttribute(new GAttributeInfo("Protocol", true,
"Protocol (hhtp, https, ftp etc) to use"));
+ infoFactory.addAttribute(new GAttributeInfo("Interface", true,
"Interface to listen on"));
+ infoFactory.addAttribute(new GAttributeInfo("MaxConnections", true,
"Maximum number of connections"));
+ infoFactory.addAttribute(new GAttributeInfo("MaxIdleTime", true,
"Maximum idle time (ms??) a connection can be idle before being closed"));
+ infoFactory.addAttribute(new GAttributeInfo("Contexts", true,
"Contexts that must be registered in the web container before this connector
will start accepting connections"));
+ infoFactory.setConstructor(new GConstructorInfo(
+ Arrays.asList(new Object[] {"Protocol", "Interface", "Port",
"MaxConnections", "MaxIdleTime", "Contexts"}),
+ Arrays.asList(new Object[] {String.class, String.class,
Integer.class, Integer.class, Integer.class, List.class})
+ ));
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGbeanInfo() {
+ return GBEAN_INFO;
+ }
+ /**
+ * @deprecated, remove when GBean -only
+ */
public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
GeronimoMBeanInfo mbeanInfo = new GeronimoMBeanInfo();
mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Port", true,
true, "port to listen on"));
1.27 +139 -1
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebContainer.java
Index: AbstractWebContainer.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebContainer.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- AbstractWebContainer.java 30 Dec 2003 08:28:57 -0000 1.26
+++ AbstractWebContainer.java 16 Jan 2004 02:19:23 -0000 1.27
@@ -57,6 +57,9 @@
package org.apache.geronimo.web;
import java.net.URI;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
import javax.management.ObjectName;
@@ -66,6 +69,14 @@
import org.apache.geronimo.kernel.service.GeronimoMBeanEndpointListener;
import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
import org.apache.geronimo.kernel.service.GeronimoAttributeInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GConstructorInfo;
+import org.apache.geronimo.gbean.GEndpointInfo;
+import org.apache.geronimo.gbean.EndpointCollection;
+import org.apache.geronimo.gbean.EndpointCollectionListener;
+import org.apache.geronimo.gbean.EndpointCollectionEvent;
import org.w3c.dom.Document;
/**
@@ -93,6 +104,8 @@
public final static String BASE_WEB_ACCESS_LOG_NAME =
"geronimo.web:type=WebAccessLog";
public final static String CONTAINER_CLAUSE = ",container=";
+ private final static GBeanInfo GBEAN_INFO;
+
private final static Log log =
LogFactory.getLog(AbstractWebContainer.class);
@@ -106,6 +119,48 @@
*/
private Document defaultWebXmlDoc = null;
+ private EndpointCollection webApplications;
+ private EndpointCollection webConnectors;
+ private EndpointCollection webAccessLogs;
+ private final EndpointCollectionListener webApplicationListener = new
EndpointCollectionListener() {
+ public void memberAdded(EndpointCollectionEvent event) {
+ webApplicationAdded((WebApplication)event.getMember());
+ }
+
+ public void memberRemoved(EndpointCollectionEvent event) {
+ webApplicationRemoval((WebApplication)event.getMember());
+ }
+ };
+
+ private final EndpointCollectionListener webConnectorListener = new
EndpointCollectionListener() {
+ public void memberAdded(EndpointCollectionEvent event) {
+ webConnectorAdded((WebConnector)event.getMember());
+ }
+
+ public void memberRemoved(EndpointCollectionEvent event) {
+ webConnectorRemoval((WebConnector)event.getMember());
+ }
+ };
+
+ private final EndpointCollectionListener webAccessLogListener = new
EndpointCollectionListener() {
+ public void memberAdded(EndpointCollectionEvent event) {
+ webAccessLogAdded((WebAccessLog)event.getMember());
+ }
+
+ public void memberRemoved(EndpointCollectionEvent event) {
+ webAccessLogRemoval((WebAccessLog)event.getMember());
+ }
+ };
+
+ //deprecated, remove when GBean-only
+ public AbstractWebContainer() {
+
+ }
+
+ public AbstractWebContainer(URI defaultWebXmlURI, Document
defaultWebXmlDoc) {
+ this.defaultWebXmlURI = defaultWebXmlURI;
+ this.defaultWebXmlDoc = defaultWebXmlDoc;
+ }
/**
* Get the URI of the web defaults.
@@ -144,6 +199,66 @@
// TODO
}
+ public Collection getWebApplications() {
+ return webApplications;
+ }
+
+ public void setWebApplications(Collection webApplications) {
+ if (webApplications == null) {
+
this.webApplications.removeEndpointCollectionListener(webApplicationListener);
+ for (Iterator iterator = this.webApplications.iterator();
iterator.hasNext();) {
+ webApplicationRemoval((WebApplication) iterator.next());
+ }
+ }
+ this.webApplications = (EndpointCollection)webApplications;
+ if (webApplications != null) {
+
this.webApplications.addEndpointCollectionListener(webApplicationListener);
+ for (Iterator iterator = this.webApplications.iterator();
iterator.hasNext();) {
+ webApplicationAdded((WebApplication) iterator.next());
+ }
+ }
+ }
+
+ public Collection getWebConnectors() {
+ return webConnectors;
+ }
+
+ public void setWebConnectors(Collection webConnectors) {
+ if (webConnectors == null) {
+
this.webConnectors.removeEndpointCollectionListener(webConnectorListener);
+ for (Iterator iterator = this.webConnectors.iterator();
iterator.hasNext();) {
+ webConnectorRemoval((WebConnector) iterator.next());
+ }
+ }
+ this.webConnectors = (EndpointCollection)webConnectors;
+ if (webConnectors != null) {
+
this.webConnectors.addEndpointCollectionListener(webConnectorListener);
+ for (Iterator iterator = this.webConnectors.iterator();
iterator.hasNext();) {
+ webConnectorAdded((WebConnector) iterator.next());
+ }
+ }
+ }
+
+ public Collection getWebAccessLogs() {
+ return webAccessLogs;
+ }
+
+ public void setWebAccessLogs(Collection webAccessLogs) {
+ if (webAccessLogs == null) {
+
this.webAccessLogs.removeEndpointCollectionListener(webAccessLogListener);
+ for (Iterator iterator = this.webAccessLogs.iterator();
iterator.hasNext();) {
+ webAccessLogRemoval((WebAccessLog) iterator.next());
+ }
+ }
+ this.webAccessLogs = (EndpointCollection)webAccessLogs;
+ if (webAccessLogs != null) {
+
this.webAccessLogs.addEndpointCollectionListener(webAccessLogListener);
+ for (Iterator iterator = this.webAccessLogs.iterator();
iterator.hasNext();) {
+ webAccessLogAdded((WebAccessLog) iterator.next());
+ }
+ }
+ }
+
/**
* Method called by addComponent after a WebConnector has been added.
*/
@@ -177,6 +292,29 @@
protected void webAccessLogRemoval(WebAccessLog log) {
}
+ static {
+ GBeanInfoFactory infoFactory = new
GBeanInfoFactory(AbstractWebContainer.class.getName());
+ infoFactory.addAttribute(new GAttributeInfo("DefaultWebXmlURI",
true, "Location of web.xml defaults"));
+ infoFactory.addAttribute(new GAttributeInfo("DefaultWebXmlDoc",
true, "Parsed web defaults xml document"));
+ infoFactory.setConstructor(new GConstructorInfo(Arrays.asList(new
Object[] {"DefaultWebXmlURI", "DefaultWebXmlDoc"}),
+ Arrays.asList(new Object[] {URI.class, Document.class})));
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGBeanInfo() {
+ return GBEAN_INFO;
+ }
+
+ /**
+ * @deprecated
+ * @param clazz
+ * @param container
+ * @param webApplicationClass
+ * @param webConnectorClass
+ * @param webAccessLogClass
+ * @return
+ * @throws Exception
+ */
public static GeronimoMBeanInfo getGeronimoMBeanInfo(Class clazz, String
container, Class webApplicationClass, Class webConnectorClass, Class
webAccessLogClass) throws Exception {
GeronimoMBeanInfo mbeanInfo = new GeronimoMBeanInfo();
mbeanInfo.setTargetClass(clazz);
1.15 +3 -3
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/WebApplication.java
Index: WebApplication.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/WebApplication.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- WebApplication.java 30 Dec 2003 08:28:57 -0000 1.14
+++ WebApplication.java 16 Jan 2004 02:19:23 -0000 1.15
@@ -71,7 +71,7 @@
public interface WebApplication {
//extends WebModule {
- //FROM WebModule without the ManagedObject cruft that GeronimoMBean
takes care of.
+ //FROM WebModule without the ManagedObject cruft that GBeanMBean takes
care of.
/**
* Gets the list of servlets contained in the deployed WAR module.
*
@@ -118,7 +118,7 @@
* Getter for the class loader delegation model for this webapp
* @return
*/
- public boolean getJava2ClassloadingCompliance();
+ public boolean getJava2ClassLoadingCompliance();
/**
1.3 +86 -38
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebAccessLog.java
Index: JettyWebAccessLog.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebAccessLog.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JettyWebAccessLog.java 30 Dec 2003 08:28:58 -0000 1.2
+++ JettyWebAccessLog.java 16 Jan 2004 02:19:23 -0000 1.3
@@ -59,18 +59,23 @@
import java.io.File;
import java.lang.reflect.Constructor;
-
-import javax.management.ObjectName;
+import java.net.URI;
+import java.util.Arrays;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GConstructorInfo;
+import org.apache.geronimo.gbean.GOperationInfo;
import org.apache.geronimo.kernel.service.GeronimoAttributeInfo;
-import org.apache.geronimo.kernel.service.GeronimoMBeanEndpoint;
+import org.apache.geronimo.kernel.service.GeronimoMBeanContext;
import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
import org.apache.geronimo.kernel.service.GeronimoMBeanTarget;
-import org.apache.geronimo.kernel.service.GeronimoMBeanContext;
+import org.apache.geronimo.kernel.service.GeronimoOperationInfo;
+import org.apache.geronimo.kernel.service.GeronimoParameterInfo;
import org.apache.geronimo.web.AbstractWebAccessLog;
-import org.apache.geronimo.web.AbstractWebContainer;
import org.mortbay.http.NCSARequestLog;
import org.mortbay.http.RequestLog;
import org.mortbay.jetty.Server;
@@ -83,15 +88,34 @@
* @version $Revision$ $Date$
*/
public class JettyWebAccessLog extends AbstractWebAccessLog implements
GeronimoMBeanTarget {
+
+ private static final GBeanInfo GBEAN_INFO;
+
private final static Log log =
LogFactory.getLog(JettyWebAccessLog.class);
+
private final static Class[] defaultConstructorSignature = new Class[]{};
private final static Object[] defaultConstructorArgs = new Object[]{};
- private JettyWebContainer webContainer;
- private Server jetty;
- private RequestLog jettyLog;
+ //private JettyWebContainer webContainer;
+ //private Server jetty;
+ private RequestLog jettyAccessLog;
private boolean buffering = false;
+ public JettyWebAccessLog(String logImplementationClass, URI logLocation,
String logPattern, int logRetentionDays,
+ int logRolloverIntervalHrs, String logPrefix,
String logSuffix, String logDateFormat,
+ boolean resolveHostNames, boolean append,
boolean buffering) {
+ super(logImplementationClass, logLocation, logPattern,
logRetentionDays, logRolloverIntervalHrs, logPrefix, logSuffix, logDateFormat,
+ resolveHostNames, append);
+ this.buffering = buffering;
+ }
+
+ /**
+ * @deprecated, remove when GBean -only
+ */
+ public JettyWebAccessLog() {
+
+ }
+
/*
--------------------------------------------------------------------------------------
*/
/* Override AbstractWebAccessLog to disable
@@ -123,26 +147,18 @@
}
- /**
- * Set the parent Container for this component
- *
- * @param webContainer a <code>WebContainer</code> value
- */
- public void setWebContainer(JettyWebContainer webContainer) {
- this.webContainer = webContainer;
-
- if (webContainer != null) {
- jetty = (webContainer).getJettyServer();
- } else {
- jetty = null;
- }
+ public void registerLog(Server jetty) throws Exception {
+ jetty.setRequestLog(jettyAccessLog);
+ jettyAccessLog.start();
}
- public JettyWebContainer getWebContainer() {
- return webContainer;
+ public void unregisterLog(Server jetty) throws InterruptedException {
+ //shouldn't we actually unregister?
+ if (jettyAccessLog instanceof NCSARequestLog) {
+ jettyAccessLog.stop();
+ }
}
-
public void setMBeanContext(GeronimoMBeanContext context) {
}
@@ -156,18 +172,18 @@
Class logImplClass =
Thread.currentThread().getContextClassLoader().loadClass(getLogImplementationClass());
//get the default constructor, if it has one
Constructor constructor =
logImplClass.getConstructor(defaultConstructorSignature);
- jettyLog = (RequestLog)
constructor.newInstance(defaultConstructorArgs);
+ jettyAccessLog = (RequestLog)
constructor.newInstance(defaultConstructorArgs);
log.warn("RequestLog does not support rich configuration");
- jetty.setRequestLog(jettyLog);
- jettyLog.start();
+ //jetty.setRequestLog(jettyAccessLog);
+ //jettyAccessLog.start();
return;
}
log.info("Using org.mortbay.http.NCSARequestLog as log impl");
- jettyLog = new NCSARequestLog();
- NCSARequestLog ncsaLog = (NCSARequestLog) jettyLog;
+ jettyAccessLog = new NCSARequestLog();
+ NCSARequestLog ncsaLog = (NCSARequestLog) jettyAccessLog;
// set up the configuration of the access log
ncsaLog.setBuffered(getBuffering());
@@ -209,9 +225,9 @@
filename = filename + (getLogSuffix() == null ? "" :
getLogSuffix()) + ".log";
ncsaLog.setFilename(logDir.getCanonicalPath() + File.separator +
filename);
- jetty.setRequestLog(ncsaLog);
+ //jetty.setRequestLog(ncsaLog);
- ncsaLog.start();
+ //ncsaLog.start();
} catch (Exception e) {
log.error(e);
throw new RuntimeException("Could not start JettyWebAccessLog",
e);
@@ -222,10 +238,10 @@
return false;
}
- public void doStop(){
+ public void doStop() {
try {
- if (jettyLog instanceof NCSARequestLog)
- jettyLog.stop();
+ if (jettyAccessLog instanceof NCSARequestLog)
+ jettyAccessLog.stop();
} catch (InterruptedException e) {
throw new RuntimeException("Could not stop JettyWebAccessLog",
e);
}
@@ -235,15 +251,47 @@
}
- public RequestLog getJettyLog() {
- return jettyLog;
+ public RequestLog getJettyAccessLog() {
+ return jettyAccessLog;
}
+ static {
+ GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty Web
Access Log", "Wrapped Jetty access log", JettyWebAccessLog.class.getName(),
AbstractWebAccessLog.getGbeanInfo());
+ infoFactory.addAttribute(new GAttributeInfo("Buffering", true,
"Should log buffer"));
+ infoFactory.addOperation(new GOperationInfo("registerLog", new
String[]{"Jetty Server"}, new String[]{Server.class.getName()}));
+ infoFactory.addOperation(new GOperationInfo("unregisterLog", new
String[]{"Jetty Server"}, new String[]{Server.class.getName()}));
+ infoFactory.setConstructor(new GConstructorInfo(
+ Arrays.asList(new Object[]{"LogImplementationClass",
"LogLocation", "LogPattern",
+ "LogRetentionDays",
"LogRolloverIntervalHrs", "LogPrefix",
+ "LogSuffix", "LogDateFormat",
"ResolveHostNames",
+ "Append", "Buffering"}),
+ Arrays.asList(new Object[]{String.class, URI.class,
String.class,
+ Integer.TYPE, Integer.TYPE,
String.class,
+ String.class, String.class,
Boolean.TYPE,
+ Boolean.TYPE, Boolean.TYPE})
+ ));
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGbeanInfo() {
+ return GBEAN_INFO;
+ }
+
+
+ /**
+ * @deprecated, remove when GBean -only
+ */
public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
GeronimoMBeanInfo mbeanInfo =
AbstractWebAccessLog.getGeronimoMBeanInfo();
mbeanInfo.setTargetClass(JettyWebAccessLog.class);
mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Buffering",
true, true));
- mbeanInfo.addEndpoint(new GeronimoMBeanEndpoint("WebContainer",
JettyWebContainer.class,
ObjectName.getInstance(AbstractWebContainer.BASE_WEB_CONTAINER_NAME +
AbstractWebContainer.CONTAINER_CLAUSE + "Jetty"), true));
+ mbeanInfo.addOperationInfo(new GeronimoOperationInfo("registerLog",
new GeronimoParameterInfo[] {
+ new GeronimoParameterInfo("Jetty Server", Server.class, "Jetty
server")
+ }, GeronimoOperationInfo.ACTION, "register this log with jetty"));
+ mbeanInfo.addOperationInfo(new
GeronimoOperationInfo("unregisterLog", new GeronimoParameterInfo[] {
+ new GeronimoParameterInfo("Jetty Server", Server.class, "Jetty
server")
+ }, GeronimoOperationInfo.ACTION, "unregister this log with jetty"));
+ //mbeanInfo.addEndpoint(new GeronimoMBeanEndpoint("WebContainer",
JettyWebContainer.class,
ObjectName.getInstance(AbstractWebContainer.BASE_WEB_CONTAINER_NAME +
AbstractWebContainer.CONTAINER_CLAUSE + "Jetty"), true));
return mbeanInfo;
}
}
1.10 +52 -17
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebApplication.java
Index: JettyWebApplication.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebApplication.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- JettyWebApplication.java 30 Dec 2003 08:28:58 -0000 1.9
+++ JettyWebApplication.java 16 Jan 2004 02:19:23 -0000 1.10
@@ -5,15 +5,23 @@
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URL;
+import java.util.Collections;
+
+import javax.naming.Context;
+import javax.transaction.TransactionManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import
org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator;
+import
org.apache.geronimo.deployment.model.geronimo.web.GeronimoWebAppDocument;
+import org.apache.geronimo.deployment.model.web.WebApp;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GOperationInfo;
import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
import org.apache.geronimo.kernel.service.GeronimoOperationInfo;
import org.apache.geronimo.kernel.service.GeronimoParameterInfo;
import org.apache.geronimo.web.AbstractWebApplication;
-import org.apache.geronimo.web.AbstractWebContainer;
-import org.apache.geronimo.web.WebContainer;
import org.mortbay.jetty.servlet.WebApplicationContext;
@@ -27,16 +35,38 @@
*/
public class JettyWebApplication extends AbstractWebApplication {
+ private static final GBeanInfo GBEAN_INFO;
+
+ private static final Log log =
LogFactory.getLog(JettyWebApplication.class);
+
private static String CONTAINER_NAME = "Jetty";
private JettyWebApplicationContext jettyContext;
- private static final Log log =
LogFactory.getLog(JettyWebApplication.class);
- private AbstractWebContainer webContainer;
public JettyWebApplication() {
super(new org.apache.geronimo.web.WebApplicationContext());
}
+ public JettyWebApplication(URI uri, ClassLoader parentClassLoader,
WebApp webApp, GeronimoWebAppDocument geronimoWebAppDocument, String
contextPath,
+ Context context, boolean
java2ClassLoadingCompliance, TransactionManager transactionManager,
TrackedConnectionAssociator trackedConnectionAssociator) {
+ super(uri, parentClassLoader, webApp, geronimoWebAppDocument,
contextPath, context,
+ java2ClassLoadingCompliance, transactionManager,
trackedConnectionAssociator);
+ if (uri == null) {
+ jettyContext = new JettyWebApplicationContext();
+ } else {
+ jettyContext = new JettyWebApplicationContext(uri.toString());
+ }
+ //we could perhaps use geronimo classloading
+ //jettyContext.setClassLoader(classLoader);
+ jettyContext.setParentClassLoader(parentClassLoader);
+ jettyContext.setContextPath(contextPath);
+
jettyContext.setClassLoaderJava2Compliant(java2ClassLoadingCompliance);
+ jettyContext.setComponentContext(context);
+ }
+
+ /**
+ * @deprecated, remove when GBean -only
+ */
public JettyWebApplication(org.apache.geronimo.web.WebApplicationContext
webApplicationContext) {
super(webApplicationContext);
URI uri = webApplicationContext.uri;
@@ -66,16 +96,16 @@
BufferedReader reader = null;
try {
- URL url = new URL (jettyContext.getDeploymentDescriptor());
+ URL url = new URL(jettyContext.getDeploymentDescriptor());
StringBuffer strbuff = new StringBuffer();
- reader = new BufferedReader(new InputStreamReader
(url.openStream()));
+ reader = new BufferedReader(new
InputStreamReader(url.openStream()));
boolean more = true;
while (more) {
- String line = reader.readLine ();
+ String line = reader.readLine();
if (line == null)
more = false;
else
- strbuff.append (line);
+ strbuff.append(line);
}
deploymentDescriptorStr = strbuff.toString();
@@ -83,10 +113,9 @@
return deploymentDescriptorStr;
} catch (IOException e) {
- log.error (e);
+ log.error(e);
return null;
- }
- finally {
+ } finally {
try {
reader.close();
} catch (IOException e) {
@@ -100,18 +129,24 @@
return jettyContext;
}
- public void setWebContainer(WebContainer webContainer) {
- this.webContainer = (AbstractWebContainer) webContainer;
+ static {
+ GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty Web
Application", "Wrapped Jetty application", JettyWebApplication.class.getName(),
AbstractWebApplication.getGbeanInfo());
+ infoFactory.addOperation(new GOperationInfo("getJettyContext",
Collections.EMPTY_LIST));
+ GBEAN_INFO = infoFactory.getBeanInfo();
}
- public WebContainer getWebContainer() {
- return webContainer;
+ public static GBeanInfo getGbeanInfo() {
+ return GBEAN_INFO;
}
+
+ /**
+ * @deprecated, remove when GBean -only
+ */
public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
GeronimoMBeanInfo mbeanInfo =
AbstractWebApplication.getGeronimoMBeanInfo(CONTAINER_NAME);
mbeanInfo.setTargetClass(JettyWebApplication.class.getName());
- mbeanInfo.addOperationInfo(new
GeronimoOperationInfo("getJettyContext", new GeronimoParameterInfo[] {},
GeronimoOperationInfo.INFO, "Retrieve the internal JettyContext"));
+ mbeanInfo.addOperationInfo(new
GeronimoOperationInfo("getJettyContext", new GeronimoParameterInfo[]{},
GeronimoOperationInfo.INFO, "Retrieve the internal JettyContext"));
return mbeanInfo;
}
}
1.7 +35 -3
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebConnector.java
Index: JettyWebConnector.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebConnector.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JettyWebConnector.java 30 Dec 2003 08:28:58 -0000 1.6
+++ JettyWebConnector.java 16 Jan 2004 02:19:23 -0000 1.7
@@ -57,9 +57,14 @@
package org.apache.geronimo.web.jetty;
import java.lang.reflect.Constructor;
+import java.util.Collections;
+import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GOperationInfo;
import org.apache.geronimo.kernel.service.GeronimoMBeanContext;
import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
import org.apache.geronimo.kernel.service.GeronimoMBeanTarget;
@@ -76,12 +81,25 @@
* @version $Revision$ $Date$
*/
public class JettyWebConnector extends AbstractWebConnector implements
GeronimoMBeanTarget {
+ private final static GBeanInfo GBEAN_INFO;
private final static Log log =
LogFactory.getLog(JettyWebConnector.class);
private final static Class[] _defaultConstructorSignature = new
Class[]{};
private final static Object[] _defaultConstructorArgs = new Object[]{};
private HttpListener listener = null;
/**
+ * @deprecated, remove when GBean -only
+ */
+ public JettyWebConnector() {
+
+ }
+
+ public JettyWebConnector(String protocol, String iface, int port, int
maxConnections, int maxIdleTime, List contexts) {
+ super(protocol, iface, port, maxConnections, maxIdleTime, contexts);
+ }
+
+
+ /**
* Set up the port for the Connector to listen on.
* It is not permitted to change the port if the
* connector is in operation.
@@ -133,7 +151,8 @@
/**
* Start the connector
- *
+ * TODO this fishing for the listener class should be done in the
deployer.
+ * TODO This should get a listener as a constructor argument.
*/
public void doStart() {
try {
@@ -222,10 +241,23 @@
return listener;
}
+ static {
+ GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty Web
Connector", "Wrapped Jetty listener", JettyWebConnector.class.getName(),
AbstractWebConnector.getGbeanInfo());
+ infoFactory.addOperation(new GOperationInfo("getListener",
Collections.EMPTY_LIST));
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGbeanInfo() {
+ return GBEAN_INFO;
+ }
+
+ /**
+ * @deprecated, remove when GBean -only
+ */
public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
GeronimoMBeanInfo mbeanInfo =
AbstractWebConnector.getGeronimoMBeanInfo();
mbeanInfo.setTargetClass(JettyWebConnector.class);
- mbeanInfo.addOperationInfo(new GeronimoOperationInfo("getListener",
new GeronimoParameterInfo[] {}, GeronimoOperationInfo.INFO, "Retrieve the
internal HTTP Listener"));
+ mbeanInfo.addOperationInfo(new GeronimoOperationInfo("getListener",
new GeronimoParameterInfo[]{}, GeronimoOperationInfo.INFO, "Retrieve the
internal HTTP Listener"));
return mbeanInfo;
}
1.11 +61 -4
incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebContainer.java
Index: JettyWebContainer.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/jetty/JettyWebContainer.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- JettyWebContainer.java 30 Dec 2003 08:28:58 -0000 1.10
+++ JettyWebContainer.java 16 Jan 2004 02:19:23 -0000 1.11
@@ -56,15 +56,25 @@
package org.apache.geronimo.web.jetty;
+import java.util.Arrays;
+import java.util.Collection;
+import java.net.URI;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.kernel.management.StateManageable;
import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
import org.apache.geronimo.web.AbstractWebContainer;
import org.apache.geronimo.web.WebApplication;
+import org.apache.geronimo.web.WebAccessLog;
import org.apache.geronimo.web.WebConnector;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GEndpointInfo;
+import org.apache.geronimo.gbean.GConstructorInfo;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.WebApplicationContext;
+import org.w3c.dom.Document;
/**
* Base class for jetty web containers.
@@ -73,16 +83,28 @@
* @version $Revision$ $Date$
*/
public class JettyWebContainer extends AbstractWebContainer {
+ private final static GBeanInfo GBEAN_INFO;
private final Log log = LogFactory.getLog(JettyWebContainer.class);
private final Server jettyServer;
+ /**
+ * @deprecated, remove when GBean -only
+ */
+ public JettyWebContainer() throws Exception {
+ jettyServer = new Server();
+ jettyServer.start();
+ }
- public JettyWebContainer() throws Exception
- {
+ public JettyWebContainer(URI defaultWebXmlURI, Document
defaultWebXmlDoc, Collection webApplications, Collection webConnectors,
Collection webAccessLogs) throws Exception {
+ super(defaultWebXmlURI, defaultWebXmlDoc);
jettyServer = new Server();
jettyServer.start();
+ //Does order matter here?
+ setWebApplications(webApplications);
+ setWebAccessLogs(webAccessLogs);
+ setWebConnectors(webConnectors);
}
/**
@@ -175,9 +197,44 @@
} catch (InterruptedException e) {
throw new RuntimeException("could not stop jetty context", e);
}
- jettyServer.removeContext
(((JettyWebApplication)webapp).getJettyContext());
+ jettyServer.removeContext(webApplicationContext);
+ }
+
+ protected void webAccessLogAdded(WebAccessLog webAccessLog) {
+ try {
+ ((JettyWebAccessLog)webAccessLog).registerLog(jettyServer);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
+ protected void WebAccessLogRemoval(WebAccessLog webAccessLog) {
+ try {
+ ((JettyWebAccessLog)webAccessLog).unregisterLog(jettyServer);
+ } catch (InterruptedException e) {
+ log.info(e);
+ //???ignore???
+ }
+ }
+
+ static {
+ GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty Web
Container", "Geronimo integrated Jetty Server",
JettyWebContainer.class.getName(), AbstractWebContainer.getGBeanInfo());
+ infoFactory.addEndpoint(new GEndpointInfo("WebApplications",
JettyWebApplication.class.getName()));
+ infoFactory.addEndpoint(new GEndpointInfo("WebConnectors",
JettyWebConnector.class.getName()));
+ infoFactory.addEndpoint(new GEndpointInfo("WebAccessLogs",
JettyWebAccessLog.class.getName()));
+ infoFactory.setConstructor(new GConstructorInfo(
+ Arrays.asList(new Object[] {"DefaultWebXmlURI",
"DefaultWebXmlDoc", "WebApplications", "WebConnectors", "WebAccessLogs", }),
+ Arrays.asList(new Object[] {URI.class, Document.class,
Collection.class, Collection.class, Collection.class })));
+ GBEAN_INFO = infoFactory.getBeanInfo();
+ }
+
+ public static GBeanInfo getGbeanInfo() {
+ return GBEAN_INFO;
+ }
+
+ /**
+ * @deprecated, remove when GBean -only
+ */
public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
return
AbstractWebContainer.getGeronimoMBeanInfo(JettyWebContainer.class, "Jetty",
JettyWebApplication.class, JettyWebConnector.class, JettyWebAccessLog.class);
}