Dain,

Just a couple of things on the changes to support JNDI contexts:

   + could the method signatures on the interface WebApplication
     be changed to the more generic:
      public javax.naming.Context getContext();
      public void setContext (javax.naming.Context context);

     We've said that ReadOnlyContext was a temporary solution, plus
     we might want to plug in an entirely different JNDI impl, so
     it would be better to keep the interface as generic as possible.

   + could you move the methods:
     public javax.naming.Context getContext() {
        return context;
     }
     public void setContext(javax.naming.Context context) {
       this.context = context;
     }

     into AbstractWebContainer as they will be applicable for all
     types of web containers, not just Jetty.

I'd make these changes myself, but I don't want to make any changes if you're rushing to get stuff done.

Jan


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();
}
-} +}




Reply via email to