BEA Systems, Inc.

WebLogic Server 5.1.0 API Reference

weblogic.workspace.common
Interface WorkspaceDef


public interface WorkspaceDef

Interface for Workspace objects. A Workspace object provides stateful context for each client of a WebLogic Server. Workspaces can persist after clients are disconnected.

Here's an example of how this interface is used:

   T3Client t3 = new T3Client(host); 
   t3.connect();
 
   // Request a Workspace object called "MY_SPACE"
   WorkspaceDef ws = t3.services.workspace().getWorkspace("MY_SPACE");

   // Store a value, FIDO, under the name "DOG"
   ws.store("DOG", "FIDO");
   String dogName = (String) ws.fetch("DOG");
   ws.store("CAT", "MORRIS");

Author:
Copyright (c) 1996-1998, WebLogic, Inc., Copyright (c) 1999 by BEA WebXpress. All Rights Reserved.
Copyright © 2000 BEA Systems, Inc. All Rights Reserved.
See Also:
T3ServicesDef, WorkspaceServicesDef

Field Summary
static int ATTACH
          Constant for use when attaching to an existing Workspace.
static int CREATE
          Constant for use when creating a new Workspace.
static java.lang.String name_separator
          Internal use only.
static int OPEN
          Constant for use when creating a new Workspace, or attaching to an existing one, if a matching one exists.
static java.lang.String primordial_name
          Internal use only.
static int SCOPE_CLIENT
          Constant that indicates the scope for a client workspace.
static int SCOPE_CLUSTER
          Constant that indicates the scope of a cluster workspace.
static int SCOPE_GROUP
          Constant that indicates the scope for a group workspace.
static int SCOPE_SERVER
          Constant that indicates the scope for a server workspace.
 
Method Summary
 void addMonitor(Monitor monitor)
          Adds a Monitor to a Workspace.
 void addMonitor(java.lang.String key, Monitor monitor)
          Adds a Monitor to a Workspace value.
 void destroy()
          Destroys a Workspace.
 java.lang.Object fetch(java.lang.String key)
          Fetches an Object by the specified key from the Workspace but does not remove it from the Workspace.
 java.lang.String getID()
          Retrieves a fully-qualified Workspace identifier.
 java.lang.String getName()
          Retrieves the name of the Workspace.
 WorkspaceDef getWorkspace(java.lang.String name)
          Gets a Workspace object that is a child of this Workspace.
 WorkspaceDef getWorkspace(java.lang.String name, int mode)
          Returns a Workspace object that is a child of this Workspace.
 WorkspaceDef getWorkspace(java.lang.String name, int mode, int scope)
          Returns the workspace object, if it exists, as a child of the scoped workspace.
 java.util.Enumeration keys()
          Returns an Enumeration of all the keys of a Workspace.
 java.lang.Object remove(java.lang.String key)
          Returns an Object by the specified key from the named Workspace and removes it from the Workspace.
 void removeMonitor(Monitor monitor)
          Removes a Monitor from a workspace.
 void removeMonitor(java.lang.String key, Monitor monitor)
          Removes a Monitor from a Workspace value.
 void store(java.lang.String key, java.lang.Object p)
          Stores the specified Object with the specified key in the Workspace.
 java.util.Enumeration subspaces()
          Returns an Enumeration of all the subspace names of this Workspace.
 

Field Detail

ATTACH

public static final int ATTACH
Constant for use when attaching to an existing Workspace. Attempting to attach to an existing Workspace that does not exist will cause an Exception.

CREATE

public static final int CREATE
Constant for use when creating a new Workspace. Attempting to create a Workspace that already exists will cause an Exception.

OPEN

public static final int OPEN
Constant for use when creating a new Workspace, or attaching to an existing one, if a matching one exists.

SCOPE_CLIENT

public static final int SCOPE_CLIENT
Constant that indicates the scope for a client workspace.

SCOPE_GROUP

public static final int SCOPE_GROUP
Constant that indicates the scope for a group workspace.

SCOPE_SERVER

public static final int SCOPE_SERVER
Constant that indicates the scope for a server workspace.

SCOPE_CLUSTER

public static final int SCOPE_CLUSTER
Constant that indicates the scope of a cluster workspace.

name_separator

public static final java.lang.String name_separator
Internal use only.

primordial_name

public static final java.lang.String primordial_name
Internal use only.
Method Detail

store

public void store(java.lang.String key,
                  java.lang.Object p)
           throws T3Exception
Stores the specified Object with the specified key in the Workspace.

Parameters:
key - Key by which the Object can be retrieved
p - Object to be stored
Throws:
T3Exception - if there is an error

fetch

public java.lang.Object fetch(java.lang.String key)
                       throws T3Exception
Fetches an Object by the specified key from the Workspace but does not remove it from the Workspace.

Parameters:
key - Key of the Object to fetch
Returns:
Object to be fetched
Throws:
T3Exception - if there is an error

remove

public java.lang.Object remove(java.lang.String key)
                        throws T3Exception
Returns an Object by the specified key from the named Workspace and removes it from the Workspace.

Parameters:
key - Key of object to remove
Returns:
Object to be removed
Throws:
T3Exception - if there is an error

keys

public java.util.Enumeration keys()
                           throws T3Exception
Returns an Enumeration of all the keys of a Workspace. The keys are those from the immediate Workspace, not of any parent Workspaces.

Returns:
Enumeration
Throws:
T3Exception - if there is an error

subspaces

public java.util.Enumeration subspaces()
                                throws T3Exception
Returns an Enumeration of all the subspace names of this Workspace.

Returns:
Enumeration
Throws:
T3Exception - if there is an error

destroy

public void destroy()
             throws T3Exception
Destroys a Workspace. Destroying a Workspace will recursively destroy all of its child Workspaces.

Throws:
T3Exception - if there is an error

getWorkspace

public WorkspaceDef getWorkspace(java.lang.String name)
                          throws T3Exception
Gets a Workspace object that is a child of this Workspace. By default, the mode is OPEN, meaning that the Workspace is created if it does not already exist.

Parameters:
name - Name of the Workspace
Returns:
WorkspaceDef that is a child of this Workspace
Throws:
T3Exception - if there is an error

getWorkspace

public WorkspaceDef getWorkspace(java.lang.String name,
                                 int mode)
                          throws T3Exception
Returns a Workspace object that is a child of this Workspace. Returns null if it does not exist. Modes for the workspace are defined in weblogic.workspace.common.WorkspaceDef:
CREATE
The Workspace is created and returned, and must not already exist. If it exists, calling this method will cause a T3Exception to be thrown.
ATTACH
The Workspace returned must already exist. If the Workspace does not exist, calling this method will cause a T3Exception to be thrown.
OPEN
An existing Workspace is returned, or created if the Workspace does not exist.

Parameters:
name - Name of the Workspace
mode - CREATE, ATTACH, OPEN
Returns:
WorkspaceDef of the Workspace
Throws:
T3Exception - if there is an error

getWorkspace

public WorkspaceDef getWorkspace(java.lang.String name,
                                 int mode,
                                 int scope)
                          throws T3Exception
Returns the workspace object, if it exists, as a child of the scoped workspace. Returns null if it does not exist. Modes for the workspace are defined in weblogic.workspace.common.WorkspaceDef:
CREATE
The Workspace is created and returned, and must not already exist. If it exists, calling this method will cause a T3Exception to be thrown.
ATTACH
The Workspace returned must already exist. If the Workspace does not exist, calling this method will cause a T3Exception to be thrown.
OPEN
An existing Workspace is returned, or created if the Workspace does not exist.
The scope may be any of the constants in this class:

Parameters:
name - Name of the workspace
mode - CREATE, ATTACH, OPEN
scope - final static ints defined in this class
Returns:
WorkspaceDef
Throws:
T3Exception - if the operation fails

getID

public java.lang.String getID()
Retrieves a fully-qualified Workspace identifier. The identifier is globally unique.

Returns:
Fully-qualified ID

getName

public java.lang.String getName()
Retrieves the name of the Workspace. The Workspace name is assigned by the creator of the Workspace. A named Workspace is created as a user-named subWorkspace of the general Workspace created for each client by the system.

Returns:
Workspace name

addMonitor

public void addMonitor(java.lang.String key,
                       Monitor monitor)
                throws T3Exception
Adds a Monitor to a Workspace value. Workspace values support GetMonitors, SetMonitors, and DestroyMonitors.

Parameters:
key - Key by which a Monitor can be identified
monitor - Monitor for operating on Workspace values
Throws:
T3Exception - if there is an error

removeMonitor

public void removeMonitor(java.lang.String key,
                          Monitor monitor)
                   throws T3Exception
Removes a Monitor from a Workspace value.

Parameters:
key - Key by which a Monitor can be identified
monitor - Monitor for operating on Workspace values
Throws:
T3Exception - if there is an error

addMonitor

public void addMonitor(Monitor monitor)
                throws T3Exception
Adds a Monitor to a Workspace. Workspaces only support DestroyMonitors (current with release 3.0).

Parameters:
monitor - Monitor for operating on Workspace values
Throws:
T3Exception - if there is an error

removeMonitor

public void removeMonitor(Monitor monitor)
                   throws T3Exception
Removes a Monitor from a workspace.

Parameters:
monitor - Monitor for operating on Workspace values
Throws:
T3Exception - if there is an error

Documentation is available at
http://www.weblogic.com/docs51