com.gemstone.gbjgci

## Class GbjGciSession

- java.lang.Object
- - com.gemstone.gbjgci.GbjGciSession

- Direct Known Subclasses:
    GbjSession

      public class GbjGciSession
      extends java.lang.Object

  GbjGciSessions represent GemStone sessions.

  Much of the core functionality of the GBJ class GbjSession has been moved to this class, providing sufficient functionality for a "GBJ lite".

  Version:
    3.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `isDEBUG` Enables log.fine* messages
    `boolean` | `monitorChangedObjects` Flag used to control if changed objects should be monitored

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GbjGciSession()` Create an instance of GbjGciSession

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkErrors()` Check for asynchronous errors on this session .
    `GbjGciObject` | `execute(GbjGciObject execStrObj)` Execute a GS/S Smalltalk String (represented as a GS Object)
    `GbjGciObject` | `execute(java.lang.String execStr)` Execute a GS/S Smalltalk String (represented as a java String)
    `byte[]` | `getBytes(GbjGciObject obj, long startIndex, int numBytes)` Retrieve the designated bytes from this byte-based GS object.
    `GbjGciObject[]` | `getNamedObjs(GbjGciObject obj, long startIndex, int numObjs)` Retrieve the designated GS objects from the named instvars for this GS object.
    `void` | `getNamedObjs(GbjGciObject obj, long startIndex, int numObjs, GbjGciObject[] objs)`
    `GbjGciObject[]` | `getObjs(GbjGciObject obj, long startIndex, int numObjs)` Retrieve the designated GS objects from this indexable GS object
    `void` | `getObjs(GbjGciObject obj, long startIndex, int numObjs, GbjGciObject[] objs)`
    `int` | `getSessionId()` Return the session ID for this session .
    `boolean` | `isKindOf(GbjGciObject obj, GbjGciObject cls)` Return true if this GS object is a member of the designated GS class or one of it's subclasses.
    `boolean` | `isLoggedIn()` Return true if this session is logged in
    `void` | `login(java.lang.String serverName, java.lang.String gemnetName, java.lang.String userName, java.lang.String password, java.lang.String hostUserName, java.lang.String hostPassword)` Login a GS session using this GbjGciSession.
    `void` | `logout()` Logout the GS session associated with this GbjGciSession
    `void` | `mapGsToJavaClass(GbjGciObject gsClass, GbjGciObject javaExample)` Map instances of a GemStone class to a designated java class, represented by an example instance.
    `void` | `mapGsToJavaClass(java.lang.String gsClassName, GbjGciObject javaExample)` Map instances of a GemStone class to a designated java class, represented by an example instance.
    `GbjGciObject` | `objectNamed(java.lang.String name)` Return the GS object with this name in the DB.
    `GbjGciObject` | `objectNamedOrNil(java.lang.String name)`
    `GbjGciObject` | `objWithOop(long oopValue)` Return the GS object with the designed oop.
    `GbjGciObject` | `perform(GbjGciObject receiver, java.lang.String selector, GbjGciObject[] args, int numArgs)` Execute a Smalltalk method against a designated receiver using these arguments.
    `void` | `putBytes(GbjGciObject obj, long startIndex, int numBytes, byte[] bytes)` Write the designated bytes to this byte-based GS object.
    `void` | `putNamedObjs(GbjGciObject obj, long startIndex, int numObjs, GbjGciObject[] objs)` Write the designated GS objects to the named instvars for this GS object.
    `void` | `putObjs(GbjGciObject obj, long startIndex, int numObjs, GbjGciObject[] objs)` Write the designated GS objects to this indexable GS object.
    `int` | `serialNum()`
    `GbjGciObject` | `serverContinue(GbjGciObject gsProcess, boolean errFlag, GbjGciObject stResult, GbjGciObject javaRes, java.lang.String errMsg, java.lang.String errStack)` Return control back to the server after handling a client forwarder error.
    `static void` | `waitForDebug()`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### isDEBUG

          public static boolean isDEBUG

      Enables log.fine* messages

    - #### monitorChangedObjects

          public boolean monitorChangedObjects

      Flag used to control if changed objects should be monitored

  - ### Constructor Detail

    - #### GbjGciSession

          public GbjGciSession()

      Create an instance of GbjGciSession

  - ### Method Detail

    - #### mapGsToJavaClass

          public void mapGsToJavaClass(java.lang.String gsClassName,
                                       GbjGciObject javaExample)

      Map instances of a GemStone class to a designated java class, represented by an example instance. Defines a mapping such that any instances of the GemStone class (and its subclasses) that are returned to java, will be represented as instances of the desired java class (which must be a subclass of GbjGciObject). The java class is indicated by an example instance which is used as a template.
      Parameters:
        `gsClassName` - Name of the GemStone class
        `javaExample` - An instance of the java class

    - #### mapGsToJavaClass

          public void mapGsToJavaClass(GbjGciObject gsClass,
                                       GbjGciObject javaExample)

      Map instances of a GemStone class to a designated java class, represented by an example instance. Defines a mapping such that any instances of the GemStone class (and its subclasses) that are returned to java, will be represented as instances of the desired java class (which must be a subclass of GbjGciObject). The java class is indicated by an example instance which is used as a template.
      Parameters:
        `gsClass` - GS object of the GemStone class
        `javaExample` - An instance of the java class

    - #### waitForDebug

          public static void waitForDebug()

    - #### login

          public void login(java.lang.String serverName,
                            java.lang.String gemnetName,
                            java.lang.String userName,
                            java.lang.String password,
                            java.lang.String hostUserName,
                            java.lang.String hostPassword)

      Login a GS session using this GbjGciSession.

      Parameters:
        `serverName` - The name of the GS stone process.
        `gemnetName` - The name of the Gem Service. If null, the default "gemnetobject" is used.
        `userName` - The GS username for the session.
        `password` - The GS password for this username.
        `hostUserName` - The OS username for this session (if needed).
        `hostPassword` - The OS password for this OS username (if needed).
      Throws:
        `GbjException` - thrown on any error

    - #### logout

          public void logout()

      Logout the GS session associated with this GbjGciSession
      Throws:
        `GbjException` - thrown on any error

    - #### execute

          public GbjGciObject execute(java.lang.String execStr)

      Execute a GS/S Smalltalk String (represented as a java String)
      Parameters:
        `execStr` - The Smalltalk string to execute.
      Returns:
        a GS object representing the results of execution.
      Throws:
        `GbjException` - thrown on any error

    - #### serverContinue

          public GbjGciObject serverContinue(GbjGciObject gsProcess,
                                             boolean errFlag,
                                             GbjGciObject stResult,
                                             GbjGciObject javaRes,
                                             java.lang.String errMsg,
                                             java.lang.String errStack)

      Return control back to the server after handling a client forwarder error.

      This method should only be used by GbjSession.

    - #### execute

          public GbjGciObject execute(GbjGciObject execStrObj)

      Execute a GS/S Smalltalk String (represented as a GS Object)
      Parameters:
        `execStrObj` - The Smalltalk string to execute.
      Returns:
        a GS object representing the results of execution.
      Throws:
        `GbjException` - thrown on any error

    - #### perform

          public GbjGciObject perform(GbjGciObject receiver,
                                      java.lang.String selector,
                                      GbjGciObject[] args,
                                      int numArgs)

      Execute a Smalltalk method against a designated receiver using these arguments.
      Parameters:
        `receiver` - The GS object to execute this method against.
        `selector` - The method to execute.
        `args` - The list of arguments.
        `numArgs` - The number of arguments in the list.
      Returns:
        a GS object representing the results of execution.
      Throws:
        `GbjException` - thrown on any error

    - #### getBytes

          public byte[] getBytes(GbjGciObject obj,
                                 long startIndex,
                                 int numBytes)

      Retrieve the designated bytes from this byte-based GS object.
      Parameters:
        `obj` - The GS object to retrieve the bytes from.
        `startIndex` - The starting index (1-based)
        `numBytes` - The number of bytes to retrieve
      Returns:
        the retrieved bytes
      Throws:
        `GbjException` - thrown on any error

    - #### objWithOop

          public GbjGciObject objWithOop(long oopValue)

      Return the GS object with the designed oop.
      Parameters:
        `oopValue` - The oop to search for.
      Returns:
        the GS object with this oop (if it exists)
      Throws:
        `GbjException` - thrown on any error

    - #### getObjs

          public GbjGciObject[] getObjs(GbjGciObject obj,
                                        long startIndex,
                                        int numObjs)

      Retrieve the designated GS objects from this indexable GS object
      Parameters:
        `obj` - The GS object to retrieve the GS objects from.
        `startIndex` - The starting index (1-based)
        `numObjs` - The number of objects to retrieve
      Returns:
        An array of GS objects containing the results
      Throws:
        `GbjException` - thrown on any error

    - #### getObjs

          public void getObjs(GbjGciObject obj,
                              long startIndex,
                              int numObjs,
                              GbjGciObject[] objs)

    - #### getNamedObjs

          public GbjGciObject[] getNamedObjs(GbjGciObject obj,
                                             long startIndex,
                                             int numObjs)

      Retrieve the designated GS objects from the named instvars for this GS object.
      Parameters:
        `obj` - The GS object to retrieve the GS objects from.
        `startIndex` - The starting index (1-based)
        `numObjs` - The number of objects to retrieve
      Returns:
        An array of GS objects containing the results
      Throws:
        `GbjException` - thrown on any error

    - #### getNamedObjs

          public void getNamedObjs(GbjGciObject obj,
                                   long startIndex,
                                   int numObjs,
                                   GbjGciObject[] objs)

    - #### putBytes

          public void putBytes(GbjGciObject obj,
                               long startIndex,
                               int numBytes,
                               byte[] bytes)

      Write the designated bytes to this byte-based GS object.
      Parameters:
        `obj` - The GS object to write the bytes to.
        `startIndex` - The starting index (1-based)
        `numBytes` - The number of bytes to write
        `bytes` - The bytes to write out
      Throws:
        `GbjException` - thrown on any error

    - #### putObjs

          public void putObjs(GbjGciObject obj,
                              long startIndex,
                              int numObjs,
                              GbjGciObject[] objs)

      Write the designated GS objects to this indexable GS object.
      Parameters:
        `obj` - The GS object to write the GS objects to.
        `startIndex` - The starting index (1-based)
        `numObjs` - The number of objects to write
        `objs` - An array of GS objects to write out
      Throws:
        `GbjException` - thrown on any error

    - #### putNamedObjs

          public void putNamedObjs(GbjGciObject obj,
                                   long startIndex,
                                   int numObjs,
                                   GbjGciObject[] objs)

      Write the designated GS objects to the named instvars for this GS object.
      Parameters:
        `obj` - The GS object to write the GS objects to.
        `startIndex` - The starting index (1-based)
        `numObjs` - The number of objects to write
        `objs` - An array of GS objects to write out
      Throws:
        `GbjException` - thrown on any error

    - #### isKindOf

          public boolean isKindOf(GbjGciObject obj,
                                  GbjGciObject cls)

      Return true if this GS object is a member of the designated GS class or one of it's subclasses.
      Parameters:
        `obj` - The GS object to check.
        `cls` - The GS class to check against.
      Returns:
        true/false
      Throws:
        `GbjException` - thrown on any error

    - #### objectNamed

          public GbjGciObject objectNamed(java.lang.String name)

      Return the GS object with this name in the DB. On the server, looks through the symbol list for this session looking for entry with this name, scanning symbol dictionaries in the order listed in the symbol list
      Parameters:
        `name` - String
      Returns:
        GbjGciObject result

    - #### objectNamedOrNil

          public GbjGciObject objectNamedOrNil(java.lang.String name)

    - #### isLoggedIn

          public boolean isLoggedIn()

      Return true if this session is logged in
      Returns:
        boolean result

    - #### getSessionId

          public int getSessionId()

      Return the session ID for this session . Result not usable in thread safe GBJ
      Returns:
        int result

    - #### serialNum

          public int serialNum()

    - #### checkErrors

          public void checkErrors()

      Check for asynchronous errors on this session . has no effect when using the thread safe library