You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@apache.org on 2001/06/23 02:14:49 UTC

cvs commit: jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/shared SharedSessionBean.java

craigmcc    01/06/22 17:14:48

  Modified:    tester/src/tester/org/apache/tester/shared
                        SharedSessionBean.java
  Log:
  Make SharedSessionBean independent of SessionBean.  It used to be a
  subclass, but that could never work because SessionBean was only loaded
  from a child classloader.
  
  Submitted by:	Remy Maucherat <re...@apache.org>
  
  Revision  Changes    Path
  1.2       +93 -7     jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/shared/SharedSessionBean.java
  
  Index: SharedSessionBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/shared/SharedSessionBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SharedSessionBean.java	2001/06/22 21:57:08	1.1
  +++ SharedSessionBean.java	2001/06/23 00:14:44	1.2
  @@ -63,26 +63,58 @@
   import javax.servlet.http.HttpSessionBindingEvent;
   import javax.servlet.http.HttpSessionBindingListener;
   import javax.servlet.http.HttpSessionEvent;
  -import org.apache.tester.SessionBean;
   
   
   /**
    * Simple JavaBean to use for session attribute tests.  It is Serializable
    * so that instances can be saved and restored across server restarts.
    * <p>
  - * This bean is functionally equivalent to
  - * <code>org.apache.tester.SessionBean</code>, but will be deployed inside
  - * <code>$CATALINA_HOME/lib/tester-shared.jar</code> instead of inside
  - * <code>/WEB-INF/lib/tester.jar</code>.
  + * This is functionally equivalent to <code>SessionBean</code>, but stored
  + * in a different package so that it gets deployed into a JAR file under
  + * <code>$CATALINA_HOME/lib</code>.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2001/06/22 21:57:08 $
  + * @version $Revision: 1.2 $ $Date: 2001/06/23 00:14:44 $
    */
   
  -public class SharedSessionBean extends SessionBean implements
  +public class SharedSessionBean implements
       HttpSessionActivationListener, HttpSessionBindingListener, Serializable {
   
   
  +    // ------------------------------------------------------------- Properties
  +
  +
  +    /**
  +     * The lifecycle events that have happened on this bean instance.
  +     */
  +    protected String lifecycle = "";
  +
  +    public String getLifecycle() {
  +        return (this.lifecycle);
  +    }
  +
  +    public void setLifecycle(String lifecycle) {
  +        this.lifecycle = lifecycle;
  +    }
  +
  +
  +    /**
  +     * A string property.
  +     */
  +    protected String stringProperty = "Default String Property Value";
  +
  +    public String getStringProperty() {
  +        return (this.stringProperty);
  +    }
  +
  +    public void setStringProperty(String stringProperty) {
  +        this.stringProperty = stringProperty;
  +    }
  +
  +
  +    // --------------------------------------------------------- Public Methods
  +
  +
       /**
        * Return a string representation of this bean.
        */
  @@ -94,6 +126,60 @@
           sb.append(this.stringProperty);
           sb.append("]");
           return (sb.toString());
  +
  +    }
  +
  +
  +    // ---------------------------------- HttpSessionActivationListener Methods
  +
  +
  +    /**
  +     * Receive notification that this session was activated.
  +     *
  +     * @param event The session event that has occurred
  +     */
  +    public void sessionDidActivate(HttpSessionEvent event) {
  +
  +        lifecycle += "/sda";
  +
  +    }
  +
  +
  +    /**
  +     * Receive notification that this session will be passivated.
  +     *
  +     * @param event The session event that has occurred
  +     */
  +    public void sessionWillPassivate(HttpSessionEvent event) {
  +
  +        lifecycle += "/swp";
  +
  +    }
  +
  +
  +    // ------------------------------------- HttpSessionBindingListener Methods
  +
  +
  +    /**
  +     * Receive notification that this attribute has been bound.
  +     *
  +     * @param event The session event that has occurred
  +     */
  +    public void valueBound(HttpSessionBindingEvent event) {
  +
  +        lifecycle += "/vb";
  +
  +    }
  +
  +
  +    /**
  +     * Receive notification that this attribute has been unbound.
  +     *
  +     * @param event The session event that has occurred
  +     */
  +    public void valueUnbound(HttpSessionBindingEvent event) {
  +
  +        lifecycle += "/vu";
   
       }