home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / samples.z / Session.java < prev    next >
Text File  |  1996-12-09  |  2KB  |  76 lines

  1. /*
  2.  * Session.java
  3.  *
  4.  *
  5.  * Copyright 1996 Sybase, Inc. All rights reserved.
  6.  */
  7.  
  8. /**
  9.  * <P>The Session class provides an interface to the NetImpact Dynamo session.
  10.  *
  11.  * <P>A Dynamo session supports methods to set or get string values,
  12.  * which are associated by Dynamo to a current browser session.
  13.  *
  14.  * <P>Lifetime: created from DynamoConnection.getSession()
  15.  * Note that a public variable called session  will be predefined for
  16.  * each Java servlet, in the runtime startup.
  17.  * The session object is part of the Java servlet and will be lost when
  18.  * the servlet finishes; however, Dynamo will save session values set with
  19.  * session.setValue() for up to 5 minutes. Another servlet can access those
  20.  * values if accessed from the same browser within that time limit.
  21.  *
  22.  * <P>See SQL Anywhere documentation on NetImpact Dynamo for a description
  23.  * of the session object.
  24.  */
  25.  
  26.  
  27. public class Session extends DynamoConnection 
  28. //*******************************************
  29. {
  30.  
  31.     //-------------------------------------------------------------
  32.     // Constructor
  33.     //-------------------------------------------------------------
  34.     
  35.     /**
  36.      * Constructs a new Session object with the specified handle
  37.      * @param handle handle to Dynamo client
  38.      */
  39.      
  40.     public Session(int handle)
  41.     //***********************
  42.     {
  43.         super();
  44.     setHandle(handle);
  45.     }
  46.     
  47.     
  48.     //-------------------------------------------------------------
  49.     // Public Methods
  50.     //-------------------------------------------------------------
  51.     
  52.     /**
  53.      * Returns the value of the specified variable name
  54.      * @param variable name of the variable whose value is to be returned
  55.      * @return value of named variable or null
  56.      * @exception DynamoException If the handle to Dynamo is invalid
  57.      */
  58.      
  59.     public native String getValue(String variable) throws DynamoException;
  60.     //*******************************************************************
  61.     
  62.     /**
  63.      * Sets the named variable to the value specified
  64.      * @param name name of the variable
  65.      * @param value value of the variable 
  66.      * @return true for success; false otherwise
  67.      * @exception DynamoException If the handle to Dynamo is invalid
  68.      */
  69.      
  70.     public native boolean setValue(String variable, String value)
  71.         throws DynamoException;
  72.     //***********************************************************
  73.     
  74. };
  75.  
  76.