Home » openejb-3.1.2-src » org.apache » openejb » webadmin » httpd » [javadoc | source]

    1   /**
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   package org.apache.openejb.webadmin.httpd;
   18   
   19   import java.util.HashMap;
   20   
   21   import javax.ejb.CreateException;
   22   import javax.ejb.SessionBean;
   23   import javax.ejb.SessionContext;
   24   import javax.ejb.Stateless;
   25   import javax.ejb.RemoteHome;
   26   
   27   import org.apache.openejb.core.stateful.StatefulEjbObjectHandler;
   28   import org.apache.openejb.util.proxy.ProxyManager;
   29   
   30   /**
   31    * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
   32    */
   33   @Stateless(name = "httpd/session")
   34   @RemoteHome(WebSessionHome.class)
   35   public class WebSessionBean implements SessionBean {
   36   
   37       private SessionContext ctx;
   38       private HashMap attributes;
   39   
   40       public void ejbCreate() throws CreateException {
   41           attributes = new HashMap();
   42       }
   43   
   44       public String getId() {
   45           Object obj = ProxyManager.getInvocationHandler(ctx.getEJBObject());
   46           StatefulEjbObjectHandler handler = (StatefulEjbObjectHandler) obj;
   47           return handler.getRegistryId() + "";
   48       }
   49   
   50   //    private void uberHack() throws Exception {
   51   //        org.apache.catalina.core.StandardWrapperFacade standardWrapperFacade = (org.apache.catalina.core.StandardWrapperFacade)config;
   52   //        org.apache.catalina.core.ContainerBase containerBase = (org.apache.catalina.core.ContainerBase)standardWrapperFacade.config;
   53   //        org.apache.catalina.core.ContainerBase containerBase2 = (org.apache.catalina.core.ContainerBase)containerBase.parent;
   54   //        java.util.HashMap children = (java.util.HashMap)containerBase2.children;
   55   //        org.apache.catalina.core.StandardWrapper standardWrapper = (org.apache.catalina.core.StandardWrapper) children.get("jsp");
   56   //        org.apache.jasper.servlet.JspServlet jspServlet = (org.apache.jasper.servlet.JspServlet)standardWrapper.instance;
   57   //        jspServlet.rctxt;
   58   //    }
   59   
   60       public Object getAttribute(String name) {
   61           return attributes.get(name);
   62       }
   63   
   64       public void setAttribute(String name, Object value) {
   65           attributes.put(name, value);
   66       }
   67   
   68       public void removeAttribute(String name) {
   69           attributes.remove(name);
   70       }
   71   
   72       public void ejbActivate() {
   73   
   74       }
   75   
   76       public void ejbPassivate() {
   77   
   78       }
   79   
   80       public void ejbRemove() {
   81   
   82       }
   83   
   84       public void setSessionContext(SessionContext ctx) {
   85           this.ctx = ctx;
   86       }
   87   }

Home » openejb-3.1.2-src » org.apache » openejb » webadmin » httpd » [javadoc | source]