geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r785478 [1/2] - in /geronimo/server/trunk/plugins/jetty7: geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/ geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/ geronimo-jetty7-clustering-w...
Date Wed, 17 Jun 2009 05:57:24 GMT
Author: djencks
Date: Wed Jun 17 05:57:23 2009
New Revision: 785478

URL: http://svn.apache.org/viewvc?rev=785478&view=rev
Log:
GERONIMO-4689 Cleanup code in jetty7 integration

Added:
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/IntegrationContext.java   (with props)
Removed:
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/AbstractImmutableHandler.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/ComponentContextHandler.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/GeronimoUserIdentityWrapper.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/InstanceContextHandler.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/LifecycleCommand.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/ThreadClassloaderHandler.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/UserTransactionHandler.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/interceptor/
Modified:
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/AbstractClusteredPreHandler.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/Host.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/InternalJettyServletHolder.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyDefaultServletHolder.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyEJBWebServiceContext.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyFilterHolder.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyFilterMapping.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyJspServletHolder.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyPOJOWebServiceHolder.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyServletHolder.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyServletRegistration.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyWebAppContext.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/GeronimoUserIdentity.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/JettySecurityHandler.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/TwistyWebAppContext.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/JettyIdentityService.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/AbstractWebModuleTest.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/GBeanInfoTest.java
    geronimo/server/trunk/plugins/jetty7/jetty7/src/main/history/dependencies.xml

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java Wed Jun 17 05:57:23 2009
@@ -21,6 +21,7 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.StringWriter;
+import java.io.Serializable;
 import static java.lang.Boolean.FALSE;
 import static java.lang.Boolean.TRUE;
 import java.net.URL;
@@ -98,12 +99,12 @@
 import org.apache.geronimo.schema.ElementConverter;
 import org.apache.geronimo.schema.NamespaceElementConverter;
 import org.apache.geronimo.schema.SchemaConversionUtils;
+import org.apache.geronimo.security.jaas.ConfigurationFactory;
 import org.apache.geronimo.security.jacc.ComponentPermissions;
 import org.apache.geronimo.security.jaspi.AuthConfigProviderGBean;
+import org.apache.geronimo.security.jaspi.ServerAuthConfigGBean;
 import org.apache.geronimo.security.jaspi.ServerAuthContextGBean;
 import org.apache.geronimo.security.jaspi.ServerAuthModuleGBean;
-import org.apache.geronimo.security.jaspi.ServerAuthConfigGBean;
-import org.apache.geronimo.security.jaas.ConfigurationFactory;
 import org.apache.geronimo.web.deployment.GenericToSpecificPlanConverter;
 import org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder;
 import org.apache.geronimo.xbeans.geronimo.web.jetty.JettyAuthenticationType;
@@ -639,7 +640,7 @@
         FilterMappingType[] filterMappingArray = webApp.getFilterMappingArray();
         for (FilterMappingType filterMappingType : filterMappingArray) {
             String filterName = filterMappingType.getFilterName().getStringValue().trim();
-            GBeanData filterMappingData = new GBeanData(JettyFilterMapping.GBEAN_INFO);
+            GBeanData filterMappingData = new GBeanData(JettyFilterMapping.class);
             if (previous != null) {
                 filterMappingData.addDependency(previous);
             }
@@ -707,7 +708,7 @@
             moduleContext.addGBean(filterGBeanData);
             //add a mapping to /*
 
-            GBeanData filterMappingGBeanData = new GBeanData(JettyFilterMapping.GBEAN_INFO);
+            GBeanData filterMappingGBeanData = new GBeanData(JettyFilterMapping.class);
             if (previous != null) {
                 filterMappingGBeanData.addDependency(previous);
             }
@@ -1013,7 +1014,7 @@
         if (hosts.length > 0 || virtualHosts.length > 0) {
             //use name same as module
             AbstractName hostName = earContext.getNaming().createChildName(webModuleData.getAbstractName(), "Host", "Host");
-            GBeanData hostData = new GBeanData(hostName, Host.GBEAN_INFO);
+            GBeanData hostData = new GBeanData(hostName, Host.class);
             hostData.setAttribute("hosts", hosts);
             hostData.setAttribute("virtualHosts", virtualHosts);
             earContext.addGBean(hostData);
@@ -1100,7 +1101,7 @@
                 throw new DeploymentException("Could not load javax.servlet.Servlet in web classloader", e); // TODO identify web app in message
             }
             if (baseServletClass.isAssignableFrom(servletClass)) {
-                servletData = new GBeanData(servletAbstractName, JettyServletHolder.GBEAN_INFO);
+                servletData = new GBeanData(servletAbstractName, JettyServletHolder.class);
                 servletData.setAttribute("servletClass", servletClassName);
             } else {
                 servletData = new GBeanData(pojoWebServiceTemplate);
@@ -1123,7 +1124,7 @@
                 }
             }
         } else if (servletType.isSetJspFile()) {
-            servletData = new GBeanData(servletAbstractName, JettyServletHolder.GBEAN_INFO);
+            servletData = new GBeanData(servletAbstractName, JettyServletHolder.class);
             servletData.setAttribute("jspFile", servletType.getJspFile().getStringValue().trim());
             servletData.setAttribute("servletClass", jspServlet.getServletClassName());
             initParams.put("development", "false");
@@ -1218,7 +1219,7 @@
         return GBEAN_INFO;
     }
 
-    static class StartupOrderComparator implements Comparator<ServletType> {
+    static class StartupOrderComparator implements Comparator<ServletType>, Serializable {
         /**
          * comparator that compares first on the basis of startup order, and then on the lexicographical
          * ordering of servlet name.  Since the servlet names have a uniqueness constraint, this should

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java Wed Jun 17 05:57:23 2009
@@ -253,7 +253,7 @@
         Object pojoWebServiceTemplate = null;
         WebServiceBuilder webServiceBuilder = new UnavailableWebServiceBuilder();
 
-        GBeanData containerData = bootstrap.addGBean("JettyContainer", JettyContainerImpl.GBEAN_INFO);
+        GBeanData containerData = bootstrap.addGBean("JettyContainer", JettyContainerImpl.class);
         AbstractName containerName = containerData.getAbstractName();
         containerData.setAttribute("jettyHome", new File(BASEDIR, "target/var/jetty").toString());
         containerData.setReferencePattern("ServerInfo", serverInfo.getAbstractName());

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/AbstractClusteredPreHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/AbstractClusteredPreHandler.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/AbstractClusteredPreHandler.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-clustering-wadi/src/main/java/org/apache/geronimo/jetty7/cluster/AbstractClusteredPreHandler.java Wed Jun 17 05:57:23 2009
@@ -25,8 +25,8 @@
 import org.apache.geronimo.clustering.ClusteredInvocation;
 import org.apache.geronimo.clustering.ClusteredInvocationException;
 import org.apache.geronimo.jetty7.AbstractPreHandler;
-import org.eclipse.jetty.io.HttpException;
 import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.http.HttpException;
 
 /**
  * @version $Rev$ $Date$

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/Host.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/Host.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/Host.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/Host.java Wed Jun 17 05:57:23 2009
@@ -16,23 +16,20 @@
  */
 package org.apache.geronimo.jetty7;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
 
 /**
  * Host gbean for jetty7 containing an array of hosts and virtual hosts
  */
+@GBean
 public class Host {
 
     private final String[] hosts;
     private final String[] virtualHosts;
 
-    public Host() {
-        hosts = null;
-        virtualHosts = null;
-    }
-
-    public Host(String[] hosts, String[] virtualHosts) {
+    public Host(@ParamAttribute(name="hosts")String[] hosts, 
+                @ParamAttribute(name="virtualHosts")String[] virtualHosts) {
         this.hosts = hosts;
         this.virtualHosts = virtualHosts;
     }
@@ -45,17 +42,4 @@
         return virtualHosts;
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(Host.class, "Host");
-        infoBuilder.addAttribute("hosts", String[].class, true);
-        infoBuilder.addAttribute("virtualHosts", String[].class, true);
-        infoBuilder.setConstructor(new String[] {"hosts", "virtualHosts"});
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 }

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/InternalJettyServletHolder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/InternalJettyServletHolder.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/InternalJettyServletHolder.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/InternalJettyServletHolder.java Wed Jun 17 05:57:23 2009
@@ -24,10 +24,10 @@
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
-import javax.servlet.UnavailableException;
 
-import org.apache.geronimo.jetty7.handler.AbstractImmutableHandler;
-import org.apache.geronimo.jetty7.handler.LifecycleCommand;
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectorInstanceContext;
+import org.apache.geronimo.connector.outbound.connectiontracking.SharedConnectorInstanceContext;
+import org.apache.geronimo.jetty7.handler.IntegrationContext;
 import org.apache.geronimo.security.Callers;
 import org.apache.geronimo.security.ContextManager;
 import org.eclipse.jetty.server.Request;
@@ -38,15 +38,12 @@
  */
 public class InternalJettyServletHolder extends ServletHolder {
 
-    private static final ThreadLocal<String> currentServletName = new ThreadLocal<String>();
-
-    private final AbstractImmutableHandler lifecycleChain;
+    private final IntegrationContext integrationContext;
     private final Subject runAsSubject;
     private final JettyServletRegistration servletRegistration;
-    private boolean stopped;
 
-    public InternalJettyServletHolder(AbstractImmutableHandler lifecycleChain, Subject runAsSubject, JettyServletRegistration servletRegistration) {
-        this.lifecycleChain = lifecycleChain;
+    public InternalJettyServletHolder(IntegrationContext integrationContext, Subject runAsSubject, JettyServletRegistration servletRegistration) {
+        this.integrationContext = integrationContext;
         this.runAsSubject = runAsSubject;
         this.servletRegistration = servletRegistration;
     }
@@ -58,22 +55,16 @@
      * current JettyServletHolder.
      */
     public void handle(Request baseRequest, ServletRequest request, ServletResponse response)
-            throws ServletException, UnavailableException, IOException {
-        String oldServletName = getCurrentServletName();
-        setCurrentServletName(getName());
-        try {
-            if (runAsSubject == null) {
+            throws ServletException, IOException {
+        if (runAsSubject == null) {
+            super.handle(baseRequest, request, response);
+        } else {
+            Callers oldCallers = ContextManager.pushNextCaller(runAsSubject);
+            try {
                 super.handle(baseRequest, request, response);
-            } else {
-                Callers oldCallers = ContextManager.pushNextCaller(runAsSubject);
-                try {
-                    super.handle(baseRequest, request, response);
-                } finally {
-                    ContextManager.popCallers(oldCallers);
-                }
+            } finally {
+                ContextManager.popCallers(oldCallers);
             }
-        } finally {
-            setCurrentServletName(oldServletName);
         }
     }
 
@@ -83,60 +74,43 @@
     }
 
     public void destroyInstance(Object o) throws Exception {
-        if (!stopped) {
-            super.destroyInstance(o);
-            servletRegistration.destroyInstance(o);
-        }
-    }
-
-    /**
-     * Provide the thread's current JettyServletHolder
-     *
-     * @return the thread's current JettyServletHolder
-     * TODO remove
-     */
-    static String getCurrentServletName() {
-        return currentServletName.get();
-    }
-
-    static void setCurrentServletName(String servletName) {
-        currentServletName.set(servletName);
+        super.destroyInstance(o);
+        servletRegistration.destroyInstance(o);
     }
 
+    @Override
     public void doStart() throws Exception {
-        LifecycleCommand lifecycleCommand = new StartCommand();
-        lifecycleChain.lifecycleCommand(lifecycleCommand);
-    }
-
-    public void doStop() {
-        LifecycleCommand lifecycleCommand = new StopCommand();
+        javax.naming.Context context = integrationContext.setContext();
+        boolean txActive = integrationContext.isTxActive();
+        SharedConnectorInstanceContext newContext = integrationContext.newConnectorInstanceContext(null);
+        ConnectorInstanceContext connectorContext = integrationContext.setConnectorInstance(null, newContext);
         try {
-            lifecycleChain.lifecycleCommand(lifecycleCommand);
-        } catch (Exception e) {
-            //ignore????
-        }
-    }
-
-    private void internalDoStart() throws Exception {
-        super.doStart();
-    }
-
-    private void internalDoStop() {
-        super.doStop();
-        stopped = true;
-    }
-
-    public class StartCommand implements LifecycleCommand {
-
-        public void lifecycleMethod() throws Exception {
-            internalDoStart();
+            try {
+                super.doStart();
+            } finally {
+                integrationContext.restoreConnectorContext(connectorContext, null, newContext);
+            }
+        } finally {
+            integrationContext.restoreContext(context);
+            integrationContext.completeTx(txActive, null);
         }
     }
 
-    public class StopCommand implements LifecycleCommand {
-
-        public void lifecycleMethod() throws Exception {
-            internalDoStop();
+    @Override
+    public void doStop() throws Exception {
+        javax.naming.Context context = integrationContext.setContext();
+        boolean txActive = integrationContext.isTxActive();
+        SharedConnectorInstanceContext newContext = integrationContext.newConnectorInstanceContext(null);
+        ConnectorInstanceContext connectorContext = integrationContext.setConnectorInstance(null, newContext);
+        try {
+            try {
+                super.doStop();
+            } finally {
+                integrationContext.restoreConnectorContext(connectorContext, null, newContext);
+            }
+        } finally {
+            integrationContext.restoreContext(context);
+            integrationContext.completeTx(txActive, null);
         }
     }
 

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java Wed Jun 17 05:57:23 2009
@@ -23,30 +23,34 @@
 
 import javax.management.j2ee.statistics.Stats;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.management.LazyStatisticsProvider;
 import org.apache.geronimo.management.geronimo.NetworkConnector;
 import org.apache.geronimo.management.geronimo.WebManager;
 import org.apache.geronimo.management.geronimo.stats.JettyWebContainerStatsImpl;
+import org.apache.geronimo.security.jaas.ConfigurationFactory;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.webservices.SoapHandler;
 import org.apache.geronimo.webservices.WebServiceContainer;
-import org.apache.geronimo.security.jaas.ConfigurationFactory;
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.handler.StatisticsHandler;
-import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.server.RequestLog;
+import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.handler.ContextHandlerCollection;
 import org.eclipse.jetty.server.handler.DefaultHandler;
+import org.eclipse.jetty.server.handler.HandlerCollection;
 import org.eclipse.jetty.server.handler.RequestLogHandler;
-import org.eclipse.jetty.server.RequestLog;
-import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.StatisticsHandler;
 
 /**
  * @version $Rev$ $Date$
  */
+@GBean
 public class JettyContainerImpl implements JettyContainer, SoapHandler, GBeanLifecycle, LazyStatisticsProvider {
     /**
      * The default value of JETTY_HOME variable
@@ -61,17 +65,19 @@
     private final ServerInfo serverInfo;
     private File jettyHomeDir;
     private JettyWebContainerStatsImpl stats;
-//    private final Map realms = new HashMap();
     // list of handlers
     private StatisticsHandler statsHandler = new StatisticsHandler();
     private HandlerCollection handlerCollection = new HandlerCollection();
     private ContextHandlerCollection contextHandlerCollection = new ContextHandlerCollection();
     private DefaultHandler defaultHandler = new DefaultHandler();
     private RequestLogHandler requestLogHandler = new RequestLogHandler();
-//    private boolean statsHandlerInPlace = false;
-    private boolean statsOn=false;
+    //    private boolean statsHandlerInPlace = false;
+    private boolean statsOn = false;
 
-    public JettyContainerImpl(String objectName, WebManager manager, String jettyHome, ServerInfo serverInfo) {
+    public JettyContainerImpl(@ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
+                              @ParamReference(name = "WebManager") WebManager manager,
+                              @ParamAttribute(name = "jettyHome") String jettyHome,
+                              @ParamReference(name = "ServerInfo") ServerInfo serverInfo) {
         this.objectName = objectName;
         this.jettyHome = jettyHome;
         this.serverInfo = serverInfo;
@@ -133,7 +139,7 @@
     public boolean isStatsOn() {
         return statsOn;
     }
-    
+
     public void setStatsOn(boolean on) {
         try {
             if (on) {
@@ -155,7 +161,7 @@
 //                }
             }
             statsOn = on;
-        } catch(Exception e) {
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
@@ -165,26 +171,26 @@
             stats.setLastSampleTime();
 
             /* set active request range values */
-            stats.getActiveRequestCountImpl().setCurrent((long)statsHandler.getRequestsActive());
-            stats.getActiveRequestCountImpl().setLowWaterMark((long)statsHandler.getRequestsActiveMin());
-            stats.getActiveRequestCountImpl().setHighWaterMark((long)statsHandler.getRequestsActiveMax());
-    
+            stats.getActiveRequestCountImpl().setCurrent((long) statsHandler.getRequestsActive());
+            stats.getActiveRequestCountImpl().setLowWaterMark((long) statsHandler.getRequestsActiveMin());
+            stats.getActiveRequestCountImpl().setHighWaterMark((long) statsHandler.getRequestsActiveMax());
+
             /* set request duration time values, avg = Totaltime/Count */
             /* set active request count */
-            stats.getRequestDurationImpl().setCount((long)statsHandler.getRequests());
-            stats.getRequestDurationImpl().setMaxTime((long)statsHandler.getRequestsDurationMax());
-            stats.getRequestDurationImpl().setMinTime((long)statsHandler.getRequestsDurationMin());
-            stats.getRequestDurationImpl().setTotalTime((long)statsHandler.getRequestsDurationTotal());
-    
+            stats.getRequestDurationImpl().setCount((long) statsHandler.getRequests());
+            stats.getRequestDurationImpl().setMaxTime((long) statsHandler.getRequestsDurationMax());
+            stats.getRequestDurationImpl().setMinTime((long) statsHandler.getRequestsDurationMin());
+            stats.getRequestDurationImpl().setTotalTime((long) statsHandler.getRequestsDurationTotal());
+
             /* set request count values*/
-            stats.getResponses1xxImpl().setCount((long)statsHandler.getResponses1xx());
-            stats.getResponses2xxImpl().setCount((long)statsHandler.getResponses2xx());
-            stats.getResponses3xxImpl().setCount((long)statsHandler.getResponses3xx());
-            stats.getResponses4xxImpl().setCount((long)statsHandler.getResponses4xx());
-            stats.getResponses5xxImpl().setCount((long)statsHandler.getResponses5xx());
-    
+            stats.getResponses1xxImpl().setCount((long) statsHandler.getResponses1xx());
+            stats.getResponses2xxImpl().setCount((long) statsHandler.getResponses2xx());
+            stats.getResponses3xxImpl().setCount((long) statsHandler.getResponses3xx());
+            stats.getResponses4xxImpl().setCount((long) statsHandler.getResponses4xx());
+            stats.getResponses5xxImpl().setCount((long) statsHandler.getResponses5xx());
+
             /* set elapsed time for stats collection */
-            stats.getStatsOnMsImpl().setCount((long)statsHandler.getStatsOnMs());
+            stats.getStatsOnMsImpl().setCount((long) statsHandler.getStatsOnMs());
         }
         return stats;
     }
@@ -205,7 +211,7 @@
         contextHandlerCollection.removeHandler(context);
     }
 
-   ///TODO figure out strings1 param
+    ///TODO figure out strings1 param
     public void addWebService(String contextPath, String[] virtualHosts, WebServiceContainer webServiceContainer, ConfigurationFactory configurationFactory, String realmName, String transportGuarantee, String authMethod, String[] strings1, ClassLoader classLoader) throws Exception {
 //        InternalJAASJettyRealm internalJAASJettyRealm = securityRealmName == null ? null : addRealm(securityRealmName);
 //        JettyEJBWebServiceContext webServiceContext = new JettyEJBWebServiceContext(contextPath, webServiceContainer, internalJAASJettyRealm, realmName, transportGuarantee, authMethod, classLoader);
@@ -264,34 +270,4 @@
         }
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic("Jetty Web Container", JettyContainerImpl.class);
-        infoBuilder.addAttribute("statsOn", Boolean.TYPE, true);
-        infoBuilder.addAttribute("collectStatisticsStarted", Long.TYPE, false);
-        infoBuilder.addAttribute("objectName", String.class, false);
-        infoBuilder.addAttribute("jettyHome", String.class, true);
-
-        infoBuilder.addReference("WebManager", WebManager.class);
-        infoBuilder.addReference("ServerInfo", ServerInfo.class, "GBean");
-
-        // this is needed because the getters/setters are not added automatically
-        infoBuilder.addOperation("setStatsOn", new Class[] { boolean.class }, "void");
-        infoBuilder.addOperation("resetStats");
-
-        infoBuilder.addInterface(SoapHandler.class);
-        infoBuilder.addInterface(JettyContainer.class);
-        infoBuilder.addInterface(LazyStatisticsProvider.class);
-
-        infoBuilder.setConstructor(new String[]{"objectName", "WebManager", "jettyHome", "ServerInfo"});
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
-
 }

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyDefaultServletHolder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyDefaultServletHolder.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyDefaultServletHolder.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyDefaultServletHolder.java Wed Jun 17 05:57:23 2009
@@ -20,33 +20,32 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 
 /**
  * @version $Rev$ $Date$
  */
+@GBean(j2eeType = NameFactory.SERVLET_TEMPLATE)
 public class JettyDefaultServletHolder extends JettyServletHolder {
 
     public JettyDefaultServletHolder() {
     }
 
-    public JettyDefaultServletHolder(String objectName, String servletName, String servletClassName, String jspFile, Map initParams, Integer loadOnStartup, Set<String> servletMappings, String runAsRole, JettyServletRegistration context) throws Exception {
+    public JettyDefaultServletHolder(@ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
+                                     @ParamAttribute(name = "servletName") String servletName,
+                                     @ParamAttribute(name = "servletClass") String servletClassName,
+                                     @ParamAttribute(name = "jspFile") String jspFile,
+                                     @ParamAttribute(name = "initParams") Map initParams,
+                                     @ParamAttribute(name = "loadOnStartup") Integer loadOnStartup,
+                                     @ParamAttribute(name = "servletMappings") Set<String> servletMappings,
+                                     @ParamAttribute(name = "runAsRole") String runAsRole,
+                                     @ParamReference(name = "JettyServletRegistration", namingType = NameFactory.WEB_MODULE) JettyServletRegistration context) throws Exception {
         super(objectName, servletName, servletClassName, jspFile, initParams, loadOnStartup, servletMappings, runAsRole, context);
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(JettyDefaultServletHolder.class, JettyServletHolder.GBEAN_INFO, NameFactory.SERVLET_TEMPLATE);
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
-
 }

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyEJBWebServiceContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyEJBWebServiceContext.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyEJBWebServiceContext.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyEJBWebServiceContext.java Wed Jun 17 05:57:23 2009
@@ -32,7 +32,7 @@
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.Response;
 import org.eclipse.jetty.server.handler.ContextHandler;
-import org.eclipse.jetty.io.HttpException;
+import org.eclipse.jetty.http.HttpException;
 
 /**
  * Delegates requests to a WebServiceContainer which is presumably for an EJB WebService.

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyFilterHolder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyFilterHolder.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyFilterHolder.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyFilterHolder.java Wed Jun 17 05:57:23 2009
@@ -18,26 +18,30 @@
 
 import java.util.Map;
 
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectorInstanceContext;
+import org.apache.geronimo.connector.outbound.connectiontracking.SharedConnectorInstanceContext;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.jetty7.handler.LifecycleCommand;
+import org.apache.geronimo.jetty7.handler.IntegrationContext;
 import org.eclipse.jetty.servlet.FilterHolder;
 
 /**
  * @version $Rev$ $Date$
  */
+@GBean(j2eeType = NameFactory.WEB_FILTER)
 public class JettyFilterHolder implements GBeanLifecycle {
 
     private final FilterHolder filterHolder;
 
-    //todo consider an interface instead of this constructor for endpoint use.
-    public JettyFilterHolder() {
-        filterHolder = null;
-    }
-
-    public JettyFilterHolder(String filterName, String filterClass, Map initParams, JettyServletRegistration jettyServletRegistration) throws Exception {
+    public JettyFilterHolder(@ParamAttribute(name = "filterName") String filterName,
+                             @ParamAttribute(name = "filterClass") String filterClass,
+                             @ParamAttribute(name = "initParams") Map initParams,
+                             @ParamReference(name = "JettyServletRegistration", namingType = NameFactory.WEB_MODULE) JettyServletRegistration jettyServletRegistration) throws Exception {
         filterHolder = new InternalFilterHolder(jettyServletRegistration);
         if (jettyServletRegistration != null) {
             filterHolder.setName(filterName);
@@ -87,35 +91,43 @@
                 destroyed = true;
             }
         }
-        
-        public void doStop() {
-            LifecycleCommand lifecycleCommand = (new LifecycleCommand() {
-                public void lifecycleMethod() throws Exception {
-                    internalDoStop();
-                }
-            });
-            try {
-                this.servletRegistration.getLifecycleChain().lifecycleCommand(lifecycleCommand);
-            } catch (Exception e) {
-                //ignore????
-            }
-        }
-        
+
+        @Override
         public void doStart() throws Exception {
-            LifecycleCommand lifecycleCommand = (new LifecycleCommand() {
-                public void lifecycleMethod() throws Exception {
-                    internalDoStart();
+            IntegrationContext integrationContext = servletRegistration.getIntegrationContext();
+            javax.naming.Context context = integrationContext.setContext();
+            boolean txActive = integrationContext.isTxActive();
+            SharedConnectorInstanceContext newContext = integrationContext.newConnectorInstanceContext(null);
+            ConnectorInstanceContext connectorContext = integrationContext.setConnectorInstance(null, newContext);
+            try {
+                try {
+                    super.doStart();
+                } finally {
+                    integrationContext.restoreConnectorContext(connectorContext, null, newContext);
                 }
-            });
-            this.servletRegistration.getLifecycleChain().lifecycleCommand(lifecycleCommand);
-        }
-        
-        private void internalDoStart() throws Exception {
-            super.doStart();
+            } finally {
+                integrationContext.restoreContext(context);
+                integrationContext.completeTx(txActive, null);
+            }
         }
 
-        private void internalDoStop() {
-            super.doStop();
+        @Override
+        public void doStop() throws Exception {
+            IntegrationContext integrationContext = servletRegistration.getIntegrationContext();
+            javax.naming.Context context = integrationContext.setContext();
+            boolean txActive = integrationContext.isTxActive();
+            SharedConnectorInstanceContext newContext = integrationContext.newConnectorInstanceContext(null);
+            ConnectorInstanceContext connectorContext = integrationContext.setConnectorInstance(null, newContext);
+            try {
+                try {
+                    super.doStop();
+                } finally {
+                    integrationContext.restoreConnectorContext(connectorContext, null, newContext);
+                }
+            } finally {
+                integrationContext.restoreContext(context);
+                integrationContext.completeTx(txActive, null);
+            }
         }
 
     }

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyFilterMapping.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyFilterMapping.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyFilterMapping.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyFilterMapping.java Wed Jun 17 05:57:23 2009
@@ -26,6 +26,9 @@
 import org.apache.geronimo.gbean.ReferenceCollection;
 import org.apache.geronimo.gbean.ReferenceCollectionEvent;
 import org.apache.geronimo.gbean.ReferenceCollectionListener;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.eclipse.jetty.servlet.FilterMapping;
 import org.eclipse.jetty.servlet.ServletHandler;
@@ -33,6 +36,7 @@
 /**
  * @version $Rev$ $Date$
  */
+@GBean(j2eeType = NameFactory.URL_WEB_FILTER_MAPPING)
 public class JettyFilterMapping extends FilterMapping {
 
     private final String[] urlPatterns;
@@ -45,28 +49,15 @@
     private final JettyFilterMapping previous;
     private final JettyServletRegistration jettyServletRegistration;
 
-    //todo use an interface for endpoints.
-    public JettyFilterMapping() {
-        this.urlPatterns = null;
-        this.requestDispatch = false;
-        this.forwardDispatch = false;
-        this.includeDispatch = false;
-        this.errorDispatch = false;
-        this.jettyFilterHolder = null;
-        this.jettyServletHolders = null;
-        this.previous = null;
-        this.jettyServletRegistration = null;
-    }
-
-    public JettyFilterMapping(String[] urlPatterns,
-            boolean requestDispatch,
-            boolean forwardDispatch,
-            boolean includeDispatch,
-            boolean errorDispatch,
-            JettyFilterHolder jettyFilterHolder,
-            Collection<ServletNameSource> jettyServletHolders,
-            JettyFilterMapping previous,
-            JettyServletRegistration jettyServletRegistration) {
+    public JettyFilterMapping(@ParamAttribute(name = "urlPatterns")String[] urlPatterns,
+            @ParamAttribute(name = "requestDispatch")boolean requestDispatch,
+            @ParamAttribute(name = "forwardDispatch")boolean forwardDispatch,
+            @ParamAttribute(name = "includeDispatch")boolean includeDispatch,
+            @ParamAttribute(name = "errorDispatch")boolean errorDispatch,
+            @ParamReference(name="Filter", namingType = NameFactory.WEB_FILTER)JettyFilterHolder jettyFilterHolder,
+            @ParamReference(name="Servlets", namingType = NameFactory.SERVLET)Collection<ServletNameSource> jettyServletHolders,
+            @ParamReference(name="Previous", namingType = NameFactory.URL_WEB_FILTER_MAPPING)JettyFilterMapping previous,
+            @ParamReference(name="JettyServletRegistration", namingType = NameFactory.WEB_MODULE)JettyServletRegistration jettyServletRegistration) {
         this.urlPatterns = urlPatterns;
         this.requestDispatch = requestDispatch;
         this.forwardDispatch = forwardDispatch;
@@ -174,35 +165,4 @@
         return jettyServletRegistration;
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(JettyFilterMapping.class, NameFactory.URL_WEB_FILTER_MAPPING);
-        infoBuilder.addAttribute("urlPatterns", String[].class, true);
-        infoBuilder.addAttribute("requestDispatch", boolean.class, true);
-        infoBuilder.addAttribute("forwardDispatch", boolean.class, true);
-        infoBuilder.addAttribute("includeDispatch", boolean.class, true);
-        infoBuilder.addAttribute("errorDispatch", boolean.class, true);
-
-        infoBuilder.addReference("Filter", JettyFilterHolder.class, NameFactory.WEB_FILTER);
-        infoBuilder.addReference("Servlets", JettyServletHolder.class, NameFactory.SERVLET);
-        infoBuilder.addReference("Previous", JettyFilterMapping.class, NameFactory.URL_WEB_FILTER_MAPPING);
-        infoBuilder.addReference("JettyServletRegistration", JettyServletRegistration.class, NameFactory.WEB_MODULE);
-
-        infoBuilder.setConstructor(new String[]{"urlPatterns",
-                "requestDispatch",
-                "forwardDispatch",
-                "includeDispatch",
-                "errorDispatch",
-                "Filter",
-                "Servlets",
-                "Previous",
-                "JettyServletRegistration"});
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 }

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyJspServletHolder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyJspServletHolder.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyJspServletHolder.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyJspServletHolder.java Wed Jun 17 05:57:23 2009
@@ -23,33 +23,32 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 
 /**
  * @version $Rev$ $Date$
  */
+@GBean(j2eeType = NameFactory.SERVLET_TEMPLATE)
 public class JettyJspServletHolder extends JettyServletHolder {
 
     public JettyJspServletHolder() {
     }
 
-    public JettyJspServletHolder(String objectName, String servletName, String servletClassName, String jspFile, Map initParams, Integer loadOnStartup, Set servletMappings, String runAsRole, JettyServletRegistration context) throws Exception {
+    public JettyJspServletHolder(@ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
+                                 @ParamAttribute(name = "servletName") String servletName,
+                                 @ParamAttribute(name = "servletClass") String servletClassName,
+                                 @ParamAttribute(name = "jspFile") String jspFile,
+                                 @ParamAttribute(name = "initParams") Map initParams,
+                                 @ParamAttribute(name = "loadOnStartup") Integer loadOnStartup,
+                                 @ParamAttribute(name = "servletMappings") Set<String> servletMappings,
+                                 @ParamAttribute(name = "runAsRole") String runAsRole,
+                                 @ParamReference(name = "JettyServletRegistration", namingType = NameFactory.WEB_MODULE) JettyServletRegistration context) throws Exception {
         super(objectName, servletName, servletClassName, jspFile, initParams, loadOnStartup, servletMappings, runAsRole, context);
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(JettyJspServletHolder.class, JettyServletHolder.GBEAN_INFO, NameFactory.SERVLET_TEMPLATE);
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
-
 }

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java Wed Jun 17 05:57:23 2009
@@ -31,6 +31,9 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.ReferencePatterns;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.jetty7.connector.AJP13Connector;
 import org.apache.geronimo.jetty7.connector.HTTPBlockingConnector;
 import org.apache.geronimo.jetty7.connector.HTTPSSelectChannelConnector;
@@ -60,6 +63,8 @@
  *
  * @version $Rev:386276 $ $Date$
  */
+
+@GBean
 public class JettyManagerImpl implements WebManager {
     private static final Logger log = LoggerFactory.getLogger(JettyManagerImpl.class);
 
@@ -124,7 +129,7 @@
 
     private final Kernel kernel;
 
-    public JettyManagerImpl(Kernel kernel) {
+    public JettyManagerImpl(@ParamSpecial(type = SpecialAttributeType.kernel)Kernel kernel) {
         this.kernel = kernel;
     }
 
@@ -408,17 +413,4 @@
         }
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Jetty Web Manager", JettyManagerImpl.class);
-        infoFactory.addAttribute("kernel", Kernel.class, false);
-        infoFactory.addInterface(WebManager.class);
-        infoFactory.setConstructor(new String[]{"kernel"});
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 }

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyPOJOWebServiceHolder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyPOJOWebServiceHolder.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyPOJOWebServiceHolder.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyPOJOWebServiceHolder.java Wed Jun 17 05:57:23 2009
@@ -29,14 +29,15 @@
 import javax.servlet.UnavailableException;
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.webservices.POJOWebServiceServlet;
 import org.apache.geronimo.webservices.WebServiceContainer;
-import org.apache.geronimo.webservices.WebServiceContainerInvoker;
 import org.apache.geronimo.webservices.WebServiceContainerFactory;
+import org.apache.geronimo.webservices.WebServiceContainerInvoker;
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.servlet.ServletHolder;
 
@@ -47,44 +48,37 @@
  *
  * @version $Rev$ $Date$
  */
+
+@GBean(j2eeType = NameFactory.SERVLET_WEB_SERVICE_TEMPLATE)
 public class JettyPOJOWebServiceHolder implements ServletNameSource, GBeanLifecycle {
     private final ServletHolder servletHolder;
     private final WebServiceContainer webServiceContainer;
-    private final Set servletMappings;
+    private final Set<String> servletMappings;
     private final JettyServletRegistration context;
     private final String pojoClassName;
 
-    //todo consider interface instead of this constructor for endpoint use.
-    public JettyPOJOWebServiceHolder() {
-        servletHolder = null;
-        webServiceContainer = null;
-        servletMappings = null;
-        context = null;
-        pojoClassName = null;
-    }
-
-    public JettyPOJOWebServiceHolder(String pojoClassName,
-                                     String servletName,
-                                     Map initParams,
-                                     Integer loadOnStartup,
-                                     Set servletMappings,
-                                     String runAsRole, 
-                                     WebServiceContainerFactory webServiceContainerFactory,
-                                     JettyServletRegistration context) throws Exception {
-        Subject runAsSubject = context == null? null: context.getSubjectForRole(runAsRole);
-        servletHolder = new InternalJettyServletHolder(context == null? null: context.getLifecycleChain(), runAsSubject, context);
+    public JettyPOJOWebServiceHolder(@ParamAttribute(name = "pojoClassName") String pojoClassName,
+                                     @ParamAttribute(name = "servletName") String servletName,
+                                     @ParamAttribute(name = "initParams") Map<String, String> initParams,
+                                     @ParamAttribute(name = "loadOnStartup") Integer loadOnStartup,
+                                     @ParamAttribute(name = "servletMappings") Set<String> servletMappings,
+                                     @ParamAttribute(name = "runAsRole") String runAsRole,
+                                     @ParamReference(name = "WebServiceContainerFactory") WebServiceContainerFactory webServiceContainerFactory,
+                                     @ParamReference(name = "JettyServletRegistration", namingType = NameFactory.WEB_MODULE) JettyServletRegistration context) throws Exception {
+        Subject runAsSubject = context == null ? null : context.getSubjectForRole(runAsRole);
+        servletHolder = new InternalJettyServletHolder(context == null ? null : context.getIntegrationContext(), runAsSubject, context);
         //context will be null only for use as "default servlet info holder" in deployer.
 
         this.pojoClassName = pojoClassName;
         this.context = context;
-        this.webServiceContainer = webServiceContainerFactory == null? null: webServiceContainerFactory.getWebServiceContainer();
+        this.webServiceContainer = webServiceContainerFactory == null ? null : webServiceContainerFactory.getWebServiceContainer();
         this.servletMappings = servletMappings;
-        if (context != null) {            
+        if (context != null) {
             servletHolder.setName(servletName);
             servletHolder.setClassName(POJOWebServiceServlet.class.getName());
             servletHolder.setInitParameters(initParams);
             if (loadOnStartup != null) {
-                servletHolder.setInitOrder(loadOnStartup.intValue());
+                servletHolder.setInitOrder(loadOnStartup);
             }
         }
     }
@@ -107,7 +101,6 @@
         //  TODO There has to be some way to get this in on the Servlet's init method.
 //        request.setAttribute(POJOWebServiceServlet.WEBSERVICE_CONTAINER, webServiceContainer);
 
-        InternalJettyServletHolder.setCurrentServletName(getServletName());
         PolicyContext.setHandlerData(Request.getRequest((HttpServletRequest) request));
 
         servletHolder.handle(baseRequest, request, response);
@@ -153,37 +146,4 @@
         }
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(JettyPOJOWebServiceHolder.class, NameFactory.SERVLET_WEB_SERVICE_TEMPLATE);
-        //todo replace with interface
-//        infoBuilder.addInterface(ServletHolder.class);
-
-        infoBuilder.addAttribute("pojoClassName", String.class, true);
-        infoBuilder.addAttribute("servletName", String.class, true);
-        infoBuilder.addAttribute("initParams", Map.class, true);
-        infoBuilder.addAttribute("loadOnStartup", Integer.class, true);
-        infoBuilder.addAttribute("servletMappings", Set.class, true);
-        infoBuilder.addAttribute("runAsRole", String.class, true);
-        infoBuilder.addReference("WebServiceContainerFactory", WebServiceContainerFactory.class);
-        infoBuilder.addReference("JettyServletRegistration", JettyServletRegistration.class);
-
-        infoBuilder.setConstructor(new String[]{"pojoClassName",
-                "servletName",
-                "initParams",
-                "loadOnStartup",
-                "servletMappings",
-                "runAsRole",
-                "WebServiceContainerFactory",
-                "JettyServletRegistration"});
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
-
 }

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyServletHolder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyServletHolder.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyServletHolder.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyServletHolder.java Wed Jun 17 05:57:23 2009
@@ -18,14 +18,15 @@
 
 import java.util.Map;
 import java.util.Set;
-import java.util.Enumeration;
-import java.net.URL;
 
 import javax.security.auth.Subject;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.management.Servlet;
 import org.eclipse.jetty.servlet.ServletHolder;
@@ -40,6 +41,8 @@
  *
  * @version $Rev$ $Date$
  */
+
+@GBean(j2eeType = NameFactory.SERVLET)
 public class JettyServletHolder implements ServletNameSource, Servlet, GBeanLifecycle {
 
 
@@ -54,18 +57,18 @@
         objectName = null;
     }
 
-    public JettyServletHolder(String objectName,
-            String servletName,
-            String servletClassName,
-            String jspFile,
-            Map initParams,
-            Integer loadOnStartup,
-            Set<String> servletMappings,
-            String runAsRole,
-            JettyServletRegistration context) throws Exception {
+    public JettyServletHolder(@ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
+                              @ParamAttribute(name = "servletName") String servletName,
+                              @ParamAttribute(name = "servletClass") String servletClassName,
+                              @ParamAttribute(name = "jspFile") String jspFile,
+                              @ParamAttribute(name = "initParams") Map initParams,
+                              @ParamAttribute(name = "loadOnStartup") Integer loadOnStartup,
+                              @ParamAttribute(name = "servletMappings") Set<String> servletMappings,
+                              @ParamAttribute(name = "runAsRole") String runAsRole,
+                              @ParamReference(name = "JettyServletRegistration", namingType = NameFactory.WEB_MODULE) JettyServletRegistration context) throws Exception {
         servletRegistration = context;
-        Subject runAsSubject = context == null? null: context.getSubjectForRole(runAsRole);
-        servletHolder = new InternalJettyServletHolder(context == null? null: context.getLifecycleChain(), runAsSubject, servletRegistration);
+        Subject runAsSubject = context == null ? null : context.getSubjectForRole(runAsRole);
+        servletHolder = new InternalJettyServletHolder(context == null ? null : context.getIntegrationContext(), runAsSubject, servletRegistration);
         servletHolder.setName(servletName);
         servletHolder.setClassName(servletClassName);
         //context will be null only for use as "default servlet info holder" in deployer.
@@ -127,40 +130,4 @@
         }
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(JettyServletHolder.class, NameFactory.SERVLET);
-        //todo replace with interface
-//        infoBuilder.addInterface(ServletHolder.class);
-
-        infoBuilder.addAttribute("servletName", String.class, true);
-        infoBuilder.addAttribute("servletClass", String.class, true);
-        infoBuilder.addAttribute("jspFile", String.class, true);
-        infoBuilder.addAttribute("initParams", Map.class, true);
-        infoBuilder.addAttribute("loadOnStartup", Integer.class, true);
-        infoBuilder.addAttribute("servletMappings", Set.class, true);
-        infoBuilder.addAttribute("runAsRole", String.class, true);
-        infoBuilder.addAttribute("objectName", String.class, false);
-        infoBuilder.addInterface(Servlet.class);
-
-        infoBuilder.addReference("JettyServletRegistration", JettyServletRegistration.class, NameFactory.WEB_MODULE);
-
-        infoBuilder.setConstructor(new String[]{"objectName",
-                "servletName",
-                "servletClass",
-                "jspFile",
-                "initParams",
-                "loadOnStartup",
-                "servletMappings",
-                "runAsRole",
-                "JettyServletRegistration"});
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyServletRegistration.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyServletRegistration.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyServletRegistration.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyServletRegistration.java Wed Jun 17 05:57:23 2009
@@ -21,9 +21,9 @@
 import javax.security.auth.Subject;
 import javax.security.auth.login.LoginException;
 
+import org.apache.geronimo.jetty7.handler.IntegrationContext;
 import org.eclipse.jetty.servlet.ServletHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
-import org.apache.geronimo.jetty7.handler.AbstractImmutableHandler;
 
 /**
  * @version $Rev$ $Date$
@@ -38,11 +38,11 @@
 
     ClassLoader getWebClassLoader();
 
-    AbstractImmutableHandler getLifecycleChain();
-
     Object newInstance(String className) throws InstantiationException, IllegalAccessException;
 
     void destroyInstance(Object o) throws Exception;
 
     Subject getSubjectForRole(String role) throws LoginException;
+
+    IntegrationContext getIntegrationContext();
 }

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyWebAppContext.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyWebAppContext.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyWebAppContext.java Wed Jun 17 05:57:23 2009
@@ -46,13 +46,8 @@
 import org.apache.geronimo.j2ee.annotation.LifecycleMethod;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.j2ee.management.impl.InvalidObjectNameException;
-import org.apache.geronimo.jetty7.handler.AbstractImmutableHandler;
-import org.apache.geronimo.jetty7.handler.ComponentContextHandler;
-import org.apache.geronimo.jetty7.handler.InstanceContextHandler;
-import org.apache.geronimo.jetty7.handler.LifecycleCommand;
-import org.apache.geronimo.jetty7.handler.ThreadClassloaderHandler;
+import org.apache.geronimo.jetty7.handler.IntegrationContext;
 import org.apache.geronimo.jetty7.handler.TwistyWebAppContext;
-import org.apache.geronimo.jetty7.handler.UserTransactionHandler;
 import org.apache.geronimo.jetty7.security.SecurityHandlerFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.ObjectNameUtil;
@@ -63,14 +58,13 @@
 import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
 import org.apache.geronimo.security.jacc.RunAsSource;
 import org.apache.geronimo.transaction.GeronimoUserTransaction;
-import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.http.MimeTypes;
 import org.eclipse.jetty.security.SecurityHandler;
+import org.eclipse.jetty.server.session.SessionHandler;
 import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
 import org.eclipse.jetty.servlet.ServletHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.eclipse.jetty.servlet.ServletMapping;
-import org.eclipse.jetty.server.session.SessionHandler;
-import org.eclipse.jetty.http.MimeTypes;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -92,13 +86,11 @@
     private final ClassLoader webClassLoader;
     private final JettyContainer jettyContainer;
 
-//    private final String webAppRoot;
     private final URL configurationBaseURL;
     private String displayName;
 
     private final String objectName;
-    private final TwistyWebAppContext webAppContext;//delegate
-    private final AbstractImmutableHandler lifecycleChain;
+    private final TwistyWebAppContext webAppContext;
     private final Context componentContext;
     private final Holder holder;
     private final RunAsSource runAsSource;
@@ -109,47 +101,48 @@
 
     public static final String GBEAN_REF_SESSION_HANDLER_FACTORY = "SessionHandlerFactory";
     public static final String GBEAN_REF_PRE_HANDLER_FACTORY = "PreHandlerFactory";
+    private IntegrationContext integrationContext;
 
 
-    public JettyWebAppContext(@ParamSpecial(type = SpecialAttributeType.objectName)String objectName,
-                              @ParamAttribute(name = "contextPath")String contextPath,
-                              @ParamAttribute(name = "deploymentDescriptor")String originalSpecDD,
-                              @ParamAttribute(name = "componentContext")Map<String, Object> componentContext,
-                              @ParamSpecial(type = SpecialAttributeType.classLoader)ClassLoader classLoader,
-                              @ParamAttribute(name = "configurationBaseUrl")URL configurationBaseUrl,
-                              @ParamAttribute(name = "unshareableResources")Set unshareableResources,
-                              @ParamAttribute(name = "applicationManagedSecurityResources")Set applicationManagedSecurityResources,
-                              @ParamAttribute(name = "displayName")String displayName,
-                              @ParamAttribute(name = "contextParamMap")Map contextParamMap,
-                              @ParamAttribute(name = "listenerClassNames")Collection<String> listenerClassNames,
-                              @ParamAttribute(name = "distributable")boolean distributable,
-                              @ParamAttribute(name = "mimeMap")Map mimeMap,
-                              @ParamAttribute(name = "welcomeFiles")String[] welcomeFiles,
-                              @ParamAttribute(name = "localeEncodingMapping")Map<String, String> localeEncodingMapping,
-                              @ParamAttribute(name = "errorPages")Map errorPages,
-                              @ParamAttribute(name = "tagLibMap")Map<String, String> tagLibMap,
-                              @ParamAttribute(name = "compactPath")boolean compactPath,
-
-                              @ParamAttribute(name = GBEAN_ATTR_SESSION_TIMEOUT)int sessionTimeoutSeconds,
-                              @ParamReference(name = GBEAN_REF_SESSION_HANDLER_FACTORY)SessionHandlerFactory handlerFactory,
-                              @ParamReference(name = GBEAN_REF_PRE_HANDLER_FACTORY)PreHandlerFactory preHandlerFactory,
-
-                              @ParamAttribute(name = "policyContextID")String policyContextID,
-                              @ParamAttribute(name = "securityRealmName")String securityRealmName,
-                              @ParamReference(name = "SecurityHandlerFactory")SecurityHandlerFactory securityHandlerFactory,
-                              @ParamReference(name = "RunAsSource")RunAsSource runAsSource,
-
-                              @ParamAttribute(name = "holder")Holder holder,
-
-                              @ParamReference(name = "Host")Host host,
-                              @ParamReference(name = "TransactionManager")TransactionManager transactionManager,
-                              @ParamReference(name = "TrackedConnectionAssociator")TrackedConnectionAssociator trackedConnectionAssociator,
-                              @ParamReference(name = "JettyContainer")JettyContainer jettyContainer,
-                              @ParamReference(name = "ContextCustomizer")RuntimeCustomizer contextCustomizer,
-
-                              @ParamReference(name = "J2EEServer")J2EEServer server,
-                              @ParamReference(name = "J2EEApplication")J2EEApplication application,
-                              @ParamSpecial(type = SpecialAttributeType.kernel)Kernel kernel) throws Exception {
+    public JettyWebAppContext(@ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
+                              @ParamAttribute(name = "contextPath") String contextPath,
+                              @ParamAttribute(name = "deploymentDescriptor") String originalSpecDD,
+                              @ParamAttribute(name = "componentContext") Map<String, Object> componentContext,
+                              @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader,
+                              @ParamAttribute(name = "configurationBaseUrl") URL configurationBaseUrl,
+                              @ParamAttribute(name = "workDir") String workDir,
+                              @ParamAttribute(name = "unshareableResources") Set<String> unshareableResources,
+                              @ParamAttribute(name = "applicationManagedSecurityResources") Set<String> applicationManagedSecurityResources,
+                              @ParamAttribute(name = "displayName") String displayName,
+                              @ParamAttribute(name = "contextParamMap") Map<String, String> contextParamMap,
+                              @ParamAttribute(name = "listenerClassNames") Collection<String> listenerClassNames,
+                              @ParamAttribute(name = "distributable") boolean distributable,
+                              @ParamAttribute(name = "mimeMap") Map mimeMap,
+                              @ParamAttribute(name = "welcomeFiles") String[] welcomeFiles,
+                              @ParamAttribute(name = "localeEncodingMapping") Map<String, String> localeEncodingMapping,
+                              @ParamAttribute(name = "errorPages") Map errorPages,
+                              @ParamAttribute(name = "tagLibMap") Map<String, String> tagLibMap,
+                              @ParamAttribute(name = "compactPath") boolean compactPath,
+
+                              @ParamAttribute(name = GBEAN_ATTR_SESSION_TIMEOUT) int sessionTimeoutSeconds,
+                              @ParamReference(name = GBEAN_REF_SESSION_HANDLER_FACTORY) SessionHandlerFactory handlerFactory,
+                              @ParamReference(name = GBEAN_REF_PRE_HANDLER_FACTORY) PreHandlerFactory preHandlerFactory,
+
+                              @ParamAttribute(name = "policyContextID") String policyContextID,
+                              @ParamReference(name = "SecurityHandlerFactory") SecurityHandlerFactory securityHandlerFactory,
+                              @ParamReference(name = "RunAsSource") RunAsSource runAsSource,
+
+                              @ParamAttribute(name = "holder") Holder holder,
+
+                              @ParamReference(name = "Host") Host host,
+                              @ParamReference(name = "TransactionManager") TransactionManager transactionManager,
+                              @ParamReference(name = "TrackedConnectionAssociator") TrackedConnectionAssociator trackedConnectionAssociator,
+                              @ParamReference(name = "JettyContainer") JettyContainer jettyContainer,
+                              @ParamReference(name = "ContextCustomizer") RuntimeCustomizer contextCustomizer,
+
+                              @ParamReference(name = "J2EEServer") J2EEServer server,
+                              @ParamReference(name = "J2EEApplication") J2EEApplication application,
+                              @ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel) throws Exception {
 
         assert componentContext != null;
         assert classLoader != null;
@@ -157,6 +150,9 @@
         assert transactionManager != null;
         assert trackedConnectionAssociator != null;
         assert jettyContainer != null;
+        if (contextPath == null || !contextPath.startsWith("/")) {
+            throw new IllegalArgumentException("context contextPath must be non-null and start with '/', not " + contextPath);
+        }
 
         this.holder = holder == null ? Holder.EMPTY : holder;
 
@@ -187,17 +183,20 @@
 
         ServletHandler servletHandler = new ServletHandler();
 
-        webAppContext = new TwistyWebAppContext(securityHandler, sessionHandler, servletHandler, null);
-        if (contextPath == null || !contextPath.startsWith("/")) {
-            throw new IllegalArgumentException("context contextPath must be non-null and start with '/', not " + contextPath);
-        }
+        //wrap the web app context with the jndi handler
+        GeronimoUserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
+        this.componentContext = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext, userTransaction, kernel, classLoader);
+        integrationContext = new IntegrationContext(this.componentContext, unshareableResources, applicationManagedSecurityResources, trackedConnectionAssociator, userTransaction);
+        webAppContext = new TwistyWebAppContext(securityHandler, sessionHandler, servletHandler, null, integrationContext, classLoader);
         webAppContext.setContextPath(contextPath);
         //See Jetty-386.  Setting this to true can expose secured content.
         webAppContext.setCompactPath(compactPath);
 
-        //wrap the web app context with the jndi handler
-        GeronimoUserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
-        this.componentContext = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext, userTransaction, kernel, classLoader);
+        if (workDir == null) {
+            workDir = contextPath;
+        }
+        this.webAppContext.setTempDirectory(jettyContainer.resolveToJettyHome(workDir));
+
 
         //install jasper injection support if required
         if (contextCustomizer != null) {
@@ -211,19 +210,6 @@
             }
         }
 
-        // localize access to next
-        {
-            //install the other handlers inside the web app context
-            Handler next = webAppContext.newTwistyHandler();
-            next = new ThreadClassloaderHandler(next, classLoader);
-
-            next = new InstanceContextHandler(next, unshareableResources, applicationManagedSecurityResources, trackedConnectionAssociator);
-            next = new UserTransactionHandler(next, userTransaction);
-            next = new ComponentContextHandler(next, this.componentContext);
-            webAppContext.setTwistyHandler(next);
-
-            lifecycleChain = (AbstractImmutableHandler) next;
-        }
         MimeTypes mimeTypes = new MimeTypes();
         mimeTypes.setMimeMap(mimeMap);
         webAppContext.setMimeTypes(mimeTypes);
@@ -307,25 +293,18 @@
         return this.webAppContext.getContextPath();
     }
 
-    public void setWorkDir(@ParamAttribute(name = "workDir") String workDir) {
-        if(workDir == null) {
-            return;
-        }
-        this.webAppContext.setTempDirectory(jettyContainer.resolveToJettyHome(workDir));
-    }
-    
     public ClassLoader getWebClassLoader() {
         return webClassLoader;
     }
 
-    public AbstractImmutableHandler getLifecycleChain() {
-        return lifecycleChain;
-    }
-
     public Subject getSubjectForRole(String role) throws LoginException {
         return runAsSource.getSubjectForRole(role);
     }
 
+    public IntegrationContext getIntegrationContext() {
+        return integrationContext;
+    }
+
     public Object newInstance(String className) throws InstantiationException, IllegalAccessException {
         if (className == null) {
             throw new InstantiationException("no class loaded");
@@ -346,18 +325,13 @@
     public void doStart() throws Exception {
         // reset the classsloader... jetty likes to set it to null when stopping
         this.webAppContext.setClassLoader(webClassLoader);
-//        this.webAppContext.setWar(webAppRoot);
-
-        getLifecycleChain().lifecycleCommand(new StartCommand());
+        jettyContainer.addContext(webAppContext);
+        webAppContext.start();
     }
 
     public void doStop() throws Exception {
-        getLifecycleChain().lifecycleCommand(new StopCommand());
-
-        // need to release the JSF factories. Otherwise, we'll leak ClassLoaders.
-        //should be done in a myfaces gbean
-//        FactoryFinder.releaseFactories();
-
+        webAppContext.stop();
+        jettyContainer.removeContext(webAppContext);
         log.debug("JettyWebAppContext stopped");
     }
 
@@ -370,27 +344,6 @@
 
         log.warn("JettyWebAppContext failed");
     }
-
-    public class StartCommand implements LifecycleCommand {
-
-        public void lifecycleMethod() throws Exception {
-            //order seems backwards... .maybe container is calling start itself???
-            jettyContainer.addContext(webAppContext);
-            webAppContext.start();
-        }
-    }
-
-    public class StopCommand implements LifecycleCommand {
-
-        public void lifecycleMethod() throws Exception {
-            webAppContext.stop();
-            //TODO is this order correct?
-            for (EventListener listener : webAppContext.getEventListeners()) {
-                destroyInstance(listener);
-            }
-            jettyContainer.removeContext(webAppContext);
-        }
-    }
     //pass through attributes.  They should be constructor params
 
     public void setLocaleEncodingMapping(@ParamAttribute(name = "localeEncodingMapping")Map<String, String> localeEncodingMap) {
@@ -510,8 +463,6 @@
                 this.webAppContext.getServletHandler().addServletMapping(servletMapping);
             }
         }
-//        LifecycleCommand lifecycleCommand = new LifecycleCommand.StartCommand(servletHolder);
-//        lifecycleChain.lifecycleCommand(lifecycleCommand);
         if (objectName != null) {
             synchronized (servletNames) {
                 servletNames.add(objectName);
@@ -531,8 +482,6 @@
 //                webAppContext.getServletHandler().removeServletMapping(servletMapping);
 //            }
 //        }
-//        LifecycleCommand lifecycleCommand = new LifecycleCommand.StopCommand(servletHolder);
-//        lifecycleChain.lifecycleCommand(lifecycleCommand);
         if (objectName != null) {
             synchronized (servletNames) {
                 servletNames.remove(objectName);

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/GeronimoUserIdentity.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/GeronimoUserIdentity.java?rev=785478&r1=785477&r2=785478&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/GeronimoUserIdentity.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/GeronimoUserIdentity.java Wed Jun 17 05:57:23 2009
@@ -30,11 +30,14 @@
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.eclipse.jetty.server.UserIdentity;
 import org.eclipse.jetty.security.RunAsToken;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev$ $Date$
  */
 public class GeronimoUserIdentity implements UserIdentity {
+    private final Logger log = LoggerFactory.getLogger(GeronimoUserIdentity.class);
 
     private final Subject subject;
     private final Principal userPrincipal;
@@ -59,11 +62,23 @@
     }
 
     public String[] getRoles() {
-        throw new RuntimeException("Not implemented");
-    }
-
-    public boolean isUserInRole(String role) {
-        throw new RuntimeException("Not implemented");
+        RuntimeException e = new RuntimeException("Not implemented");
+        log.info("getRoles called on identity " + this, e);
+        throw e;
+    }
+
+    public boolean isUserInRole(String role, Scope scope) {
+
+        String servletName = scope.getName();
+        if (servletName == null || servletName.equals("jsp")) {
+            servletName = "";
+        }
+        try {
+            acc.checkPermission(new WebRoleRefPermission(servletName, role));
+            return true;
+        } catch (AccessControlException e) {
+            return false;
+        }
     }
 
     //jaspi called from FormAuthenticator.valueUnbound (when session is unbound)
@@ -75,47 +90,8 @@
         return acc;
     }
 
-//    public RunAsToken getOldRunAsToken() {
-//        throw new RuntimeException("Not implemented");
-//    }
-//
-//    public void setOldRunAsToken(RunAsToken oldRunAsToken) {
-//        throw new RuntimeException("Not implemented");
-//    }
-//
-//    private static class NamedUserIdentity extends GeronimoUserIdentity {
-//        private final String servletName;
-//        private RunAsToken oldRunAsToken;
-//
-//        private NamedUserIdentity(GeronimoUserIdentity gui, String servletName) {
-//            super(gui.subject, gui.userPrincipal, gui.acc);
-//            // JACC v1.0 section B.19
-//            if (servletName == null || servletName.equals("jsp")) {
-//                servletName = "";
-//            }
-//            this.servletName = servletName;
-//        }
-//
-//        public boolean isUserInRole(String role) {
-//            if (servletName == null || servletName.equals("jsp")) {
-//                servletName = "";
-//            }
-//            try {
-//                getAccessControlContext().checkPermission(new WebRoleRefPermission(servletName, role));
-//                return true;
-//            } catch (AccessControlException e) {
-//                return false;
-//            }
-//        }
-//
-//        public RunAsToken getOldRunAsToken() {
-//            return oldRunAsToken;
-//        }
-//
-//        public void setOldRunAsToken(RunAsToken oldRunAsToken) {
-//            this.oldRunAsToken = oldRunAsToken;
-//        }
-//    }
-
-
+    @Override
+    public String toString() {
+        return "GeronimoUserIdentity[Subject: " + subject + ", Principal: " + userPrincipal + ", acc: " + acc + "]";
+    }
 }



Mime
View raw message