dain 2003/11/15 23:18:26
Modified: modules/web/src/java/org/apache/geronimo/web
WebApplication.java
modules/web/src/java/org/apache/geronimo/web/jetty
JettyWebApplication.java
Log:
added support for setting jndi context
Revision Changes Path
1.11 +44 -40
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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- WebApplication.java 30 Oct 2003 07:47:05 -0000 1.10
+++ WebApplication.java 16 Nov 2003 07:18:26 -0000 1.11
@@ -53,77 +53,81 @@
*
* ====================================================================
*/
-
package org.apache.geronimo.web;
import java.net.URI;
+
import org.apache.geronimo.core.service.Component;
import org.apache.geronimo.kernel.management.WebModule;
-
+import org.apache.geronimo.naming.java.ReadOnlyContext;
/**
* The WebApplication interface represents a web application deployable
within a WebContainer.
*
- * It supports the J2EE Management WebModule attributes
+ * It supports the J2EE Management WebModule attributes
*
* @version $Revision$ $Date$
*/
public interface WebApplication extends Component, WebModule {
-
-
/*--------------------------------------------------------------------------------
*/
- /**Get the uri of the webapp
+ /**
+ * Get the uri of the webapp
* @return the URI of the webapp deployment
*/
public URI getURI();
-
- /*
--------------------------------------------------------------------------------------
*/
- /** Setter for the parent classloader for this webapp
+ /**
+ * Setter for the parent classloader for this webapp
* @param loader
*/
- public void setParentClassLoader (ClassLoader loader);
+ public void setParentClassLoader(ClassLoader loader);
- /*
--------------------------------------------------------------------------------------
*/
- /** Getter for the parent classloader for this webapp
- * @param loader
+ /**
+ * Getter for the parent classloader for this webapp
*/
- public ClassLoader getParentClassLoader ();
+ public ClassLoader getParentClassLoader();
-
-
-
- /*
--------------------------------------------------------------------------------------
*/
- /**Get the context path for the webapp
- * @return
+ /**
+ * Get the context path for the webapp
+ * @return
*/
public String getContextPath();
- /*
--------------------------------------------------------------------------------------
*/
- /**Set the context path for the webapp
- * @return
+ /**
+ * Set the context path for the webapp
+ * @param path the context path of the web application
*/
public void setContextPath(String path);
-
-
/*--------------------------------------------------------------------------------
*/
- /** JSR077 WebModule method to expose the
- * contents of the webapp's web.xml file
- *
- * @return the contents of the web.xml as a string
- */
+ /**
+ * JSR077 WebModule method to expose the
+ * contents of the webapp's web.xml file
+ * @return the contents of the web.xml as a string
+ */
public String getDeploymentDescriptor();
-
- /*
--------------------------------------------------------------------------------------
*/
- /**Getter for the class loader delegation model for this webapp
- * @return
- */
- public boolean getJava2ClassloadingCompliance ();
-
- /*
--------------------------------------------------------------------------------------
*/
- /**Set the class loading delegation model for this web application
+
+ /**
+ * Getter for the class loader delegation model for this webapp
+ * @return
+ */
+ public boolean getJava2ClassloadingCompliance();
+
+ /**
+ * Set the class loading delegation model for this web application
* @param state
*/
public void setJava2ClassloadingCompliance(boolean state);
+
+ /**
+ * Gets the JNDI context for the web application.
+ * @return the jndi context
+ */
+ public ReadOnlyContext getContext();
+
+ /**
+ * Sets the JNDI context for the web application.
+ * @param context the jndi context
+ */
+ public void setContext(ReadOnlyContext context);
}
1.4 +46 -65
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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JettyWebApplication.java 30 Oct 2003 07:47:05 -0000 1.3
+++ JettyWebApplication.java 16 Nov 2003 07:18:26 -0000 1.4
@@ -3,12 +3,14 @@
import java.net.URI;
import javax.management.MBeanServer;
import javax.management.ObjectName;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.web.AbstractWebApplication;
import org.apache.geronimo.web.WebContainer;
-import org.mortbay.jetty.servlet.WebApplicationContext;
+import org.apache.geronimo.naming.java.ReadOnlyContext;
+import org.mortbay.jetty.servlet.WebApplicationContext;
/**
@@ -20,113 +22,92 @@
* @jmx:mbean extends="org.apache.geronimo.web.AbstractWebApplicationMBean
* @version $Revision$ $Date$
*/
-public class JettyWebApplication extends AbstractWebApplication implements
JettyWebApplicationMBean
-{
- private WebApplicationContext jettyContext = null;
+public class JettyWebApplication extends AbstractWebApplication implements
JettyWebApplicationMBean {
+ private WebApplicationContext jettyContext;
+ private ReadOnlyContext context;
private final Log log = LogFactory.getLog(getClass());
- public JettyWebApplication ()
- {
+ public JettyWebApplication() {
super();
- jettyContext = new WebApplicationContext ();
-
- try
- {
- objectName = new ObjectName ("jetty:role=WebApplication,
instance="+hashCode());
- }
- catch (Exception e)
- {
- log.warn (e.getMessage());
+ jettyContext = new JettyWebApplicationContext();
+
+ try {
+ objectName = new ObjectName("jetty:role=WebApplication,
instance=" + hashCode());
+ } catch (Exception e) {
+ log.warn(e.getMessage());
}
}
- public JettyWebApplication(URI uri)
- {
+ public JettyWebApplication(URI uri) {
super(uri);
- jettyContext = new WebApplicationContext(uri.toString());
-
- try
- {
- objectName = new ObjectName ("jetty:role=WebApplication,
uri="+ObjectName.quote(uri.toString()));
- }
- catch (Exception e)
- {
- throw new IllegalStateException (e.getMessage());
+ jettyContext = new JettyWebApplicationContext(uri.toString());
+
+ try {
+ objectName = new ObjectName("jetty:role=WebApplication, uri=" +
ObjectName.quote(uri.toString()));
+ } catch (Exception e) {
+ throw new IllegalStateException(e.getMessage());
}
}
-
-
- public ObjectName preRegister (MBeanServer server, ObjectName
objectName) throws Exception
- {
- return super.preRegister (server,objectName);
+
+ public ObjectName preRegister(MBeanServer server, ObjectName objectName)
throws Exception {
+ return super.preRegister(server, objectName);
}
- public void setParentClassLoader (ClassLoader loader)
- {
- jettyContext.setParentClassLoader (loader);
+ public void setParentClassLoader(ClassLoader loader) {
+ jettyContext.setParentClassLoader(loader);
}
- public ClassLoader getParentClassLoader()
- {
+ public ClassLoader getParentClassLoader() {
return jettyContext.getParentClassLoader();
}
-
-
-
- public void setContextPath (String path)
- {
+ public void setContextPath(String path) {
jettyContext.setContextPath(path);
}
- public String getContextPath ()
- {
+ public String getContextPath() {
return jettyContext.getContextPath();
}
-
- public String getDeploymentDescriptor ()
- {
+ public String getDeploymentDescriptor() {
//TODO
return null;
}
-
-
- public boolean getJava2ClassloadingCompliance ()
- {
+ public boolean getJava2ClassloadingCompliance() {
return jettyContext.isClassLoaderJava2Compliant();
}
- public void setJava2ClassloadingCompliance (boolean state)
- {
+ public void setJava2ClassloadingCompliance(boolean state) {
jettyContext.setClassLoaderJava2Compliant(state);
}
-
- WebApplicationContext getJettyContext ()
- {
+ WebApplicationContext getJettyContext() {
return jettyContext;
}
+ public ReadOnlyContext getContext() {
+ return context;
+ }
- public void doStart () throws Exception
- {
+ public void setContext(ReadOnlyContext context) {
+ this.context = context;
+ }
+
+ public void doStart() throws Exception {
super.doStart();
String defaultDescriptor = null;
- URI defaultDescriptorURI =
((WebContainer)getContainer()).getDefaultWebXmlURI();
+ URI defaultDescriptorURI = ((WebContainer)
getContainer()).getDefaultWebXmlURI();
if (defaultDescriptorURI != null)
defaultDescriptor = defaultDescriptorURI.toString();
jettyContext.setDefaultsDescriptor(defaultDescriptor);
jettyContext.start();
-
- log.debug (jettyContext.getFileClassPath());
- }
+ log.debug(jettyContext.getFileClassPath());
+ }
- public void doStop () throws Exception
- {
+ public void doStop() throws Exception {
super.doStop();
jettyContext.stop();
}
-}
+}