All Packages Class Hierarchy This Package Previous Next Index
Class asjava.uniobjects.UniSession
java.lang.Object
|
+----asjava.uniclientlibs.UniConnection
|
+----asjava.uniobjects.UniSession
- public class UniSession
- extends UniConnection
UniSession
acts as the central object for any database connection,
controlling access to any and all child objects. It controls information regarding
the connection. It is from this object that the various sub-objects are created,
such as the UniSelectList
, UniFile
, UniSubroutine
and other objects. Multiple sessions can be created, up to UniJava.getMaxSessions
- Version:
- Version 1.0
- Author:
- David T. Meeks
-
atVariableArray
-
-
uniCommand
-
-
uniNLSLocale
-
-
uniNLSMap
-
-
UniSession()
- Constructor for this class.
-
UniSession(UniSession)
- Constructor for this class.
-
command()
- Creates the command object for this session
-
command(Object)
- Creates the command object for this session, uses the passed in argument as the default command to run
-
connect()
- Opens up the session on the host identified with the
setHost
method.
-
connect(Object, int, Object, Object, Object)
-
Establishes connection to the Host/Port passed in, using the Username, Password, and
initial account path passed in.
-
connect(Object, int, Object, Object, Object, Object, Object)
-
Establishes connection to the Host passed in, using the Username, Password, and
initial account path passed in.
-
connect(Object, Object, Object, Object)
-
Establishes connection to the Host passed in, using the Username, Password, and
initial account path passed in.
-
connect(Object, Object, Object, Object, Object, int, Object)
-
Establishes connection to the Host passed in, using the Username, Password, and
initial account path passed in.
-
connect(Object, Object, Object, Object, Object, Object)
-
Establishes connection to the Host passed in, using the Username, Password, and
initial account path passed in.
-
disconnect()
- Terminates an active connection.
-
dynArray()
- Creates an empty dynamic array
-
dynArray(Object)
- Creates a dynamic array from the given object
-
getAtVariable(int)
- returns the current value of the
-
getDefaultBlockingStrategy()
- returns the default blocking strategy for this session.
-
getDefaultLockStrategy()
- returns the default locking strategy for this session.
-
getDefaultReleaseStrategy()
-
returns the default release strategy for this session.
-
getMaxOpenFiles()
- returns the maximum number of
UniFile
objects we can open at any one time.
-
getNumOpenFiles()
- returns the current number of open
UniFile
objects.
-
getValue(int)
- used to get a AT value from the server
-
iconv(Object, Object)
- converts an input string into a UniVerse internal storage format using the
conversion format specified.
-
isCommandActive()
- checks to see if a command is in an active state
-
nlsLocale()
- If NLS is enabled on the server machine, this method will return an active
UniNLSlocale
object, which can then be used to manipulate server-side NLS Locale settings.
-
nlsMap()
- If NLS is enabled on the server machine, this method will return an active
UniNLSmap
object, which can then be used to manipulate server-side NLS Map settings.
-
oconv(Object, Object)
- converts an output string into a UniVerse output storage format using the
conversion format specified.
-
open(Object)
- returns a new
UniFile
object.
-
openDict(Object)
- returns a new
UniDictionary
object.
-
openFile(Object)
- returns a new
UniFile
object.
-
openSeq(Object, Object, boolean)
- returns a new
UniSequentialFile
object.
-
releaseTaskLock(int)
- used to release a
TaskLock
that was set previously using the setTaskLock
method.
-
selectList(int)
- returns a newly created
UniSelectList
object
-
setAtVariable(int, Object)
- sets the given
-
setCompressionThreshold(int)
-
sets the current
CompressionThreshold
value.
-
setDefaultBlockingStrategy(int)
- sets the default blocking strategy
-
setDefaultEncryptionType(int)
- sets the current default encryption type to be used for this session.
-
setDefaultLockStrategy(int)
- sets the default locking strategy
-
setDefaultReleaseStrategy(int)
- sets the default release strategy
-
setTaskLock(int)
- used to set on of the 64 UniVerse synchronization locks.
-
setTimeout(int)
- Sets the UniRPC timeout value.
-
status()
- returns information concerning the state of certain operations.
-
subroutine(Object, int)
-
returns a new
UniSubroutine
representing the new subroutine object created.
-
transaction()
- returns a new
UniTransaction
object to allow transactional control
of the session.
uniCommand
protected UniCommand uniCommand
uniNLSLocale
protected UniNLSlocale uniNLSLocale
uniNLSMap
protected UniNLSmap uniNLSMap
atVariableArray
protected String atVariableArray[]
UniSession
public UniSession()
- Constructor for this class. It establishes the
UniRPCConnection
object.
UniSession
public UniSession(UniSession aSession) throws UniSessionException
- Constructor for this class. It establishes the
UniRPCConnection
object.
This version multiplexes the connection through an existing connection
- Parameters:
- aSession - UniSession representing an existing active session
- Throws: UniSessionException
- is thrown if an error occurs
command
public UniCommand command() throws UniSessionException
- Creates the command object for this session
- Throws: UniSessionException
- is thrown if there is no active connection or if their is an error
establishing the
UniCommand
object
command
public UniCommand command(Object aCommandString) throws UniSessionException
- Creates the command object for this session, uses the passed in argument as the default command to run
- Parameters:
- aCommandString - String representing the server-side command/stored procedure to be run. Performs
an automatic
UniCommand.setCommand()
as a convenience.
- Throws: UniSessionException
- is thrown if there is no active connection or if their is an error
establishing the
UniCommand
object
connect
public void connect() throws UniSessionException
- Opens up the session on the host identified with the
setHost
method.
It uses the values established with the setUserName, setPassword, setAccountPath,
setProxyHost, and setProxySecurityToken
methods. If an error occurs during
the connection request, a UniSessionException is thrown.
- Throws: UniSessionException
- is thrown if the connection cannot be established
- See Also:
- setUserName, setHostName, setHostPort, setPassword, setAccountPath, setProxyHost, setProxyPort, setProxySecurityToken
connect
public void connect(Object aHost,
Object aUser,
Object aPass,
Object aPath) throws UniSessionException
- Establishes connection to the Host passed in, using the Username, Password, and
initial account path passed in.
- Parameters:
- aHost - String representing the host to connect to. Either the name of the host
or the IP address (ex. 192.102.111.1)
- aUser - String representing the user name on the server machine.
- aPass - String representing the password on the server machine
- aPath - String representing the account path to log into on the server machine
- Throws: UniSessionException
- is thrown if the connection cannot be made
connect
public void connect(Object aHost,
int aPortNumber,
Object aUser,
Object aPass,
Object aPath) throws UniSessionException
- Establishes connection to the Host/Port passed in, using the Username, Password, and
initial account path passed in.
- Parameters:
- aHost - String representing the host to connect to. Either the name of the host
or the IP address (ex. 192.102.111.1)
- aPortNumber - integer representing the port to connect to
- aUser - String representing the user name on the server machine.
- aPass - String representing the password on the server machine
- aPath - String representing the account path to log into on the server machine
- Throws: UniSessionException
- is thrown if the connection cannot be made
connect
public void connect(Object aHost,
Object aUser,
Object aPass,
Object aPath,
Object aProxyHost,
Object aProxyToken) throws UniSessionException
- Establishes connection to the Host passed in, using the Username, Password, and
initial account path passed in.
- Parameters:
- aHost - String representing the host to connect to. Either the name of the host
or the IP address (ex. 192.102.111.1)
- aUser - String representing the user name on the server machine.
- aPass - String representing the password on the server machine
- aPath - String representing the account path to log into on the server machine
- aProxyHost - String representing the proxy host to connect to. Either the name
of the host or the IP address.
- aProxyToken - string representing the Proxy password
- Throws: UniSessionException
- is thrown if the connection cannot be made
connect
public void connect(Object aHost,
Object aUser,
Object aPass,
Object aPath,
Object aProxyHost,
int aProxyPort,
Object aProxyToken) throws UniSessionException
- Establishes connection to the Host passed in, using the Username, Password, and
initial account path passed in.
- Parameters:
- aHost - String representing the host to connect to. Either the name of the host
or the IP address (ex. 192.102.111.1)
- aUser - String representing the user name on the server machine.
- aPass - String representing the password on the server machine
- aPath - String representing the account path to log into on the server machine
- aProxyHost - String representing the proxy host to connect to. Either the name
of the host or the IP address.
- aProxyToken - string representing the Proxy password
- Throws: UniSessionException
- is thrown if the connection cannot be made
connect
public void connect(Object aHost,
int aHostPort,
Object aUser,
Object aPass,
Object aPath,
Object aProxyHost,
Object aProxyToken) throws UniSessionException
- Establishes connection to the Host passed in, using the Username, Password, and
initial account path passed in.
- Parameters:
- aHost - String representing the host to connect to. Either the name of the host
or the IP address (ex. 192.102.111.1)
- aUser - String representing the user name on the server machine.
- aPass - String representing the password on the server machine
- aPath - String representing the account path to log into on the server machine
- aProxyHost - String representing the proxy host to connect to. Either the name
of the host or the IP address.
- aProxyToken - string representing the Proxy password
- Throws: UniSessionException
- is thrown if the connection cannot be made
disconnect
public void disconnect() throws UniSessionException
- Terminates an active connection. If the connection has not been established, will just return
- Throws: UniSessionException
- occurs is an error occurs during the termination
- See Also:
- connect
dynArray
public UniDynArray dynArray()
- Creates an empty dynamic array
dynArray
public UniDynArray dynArray(Object aString)
- Creates a dynamic array from the given object
- Parameters:
- aString - object by which the dynamic array will be initialized with
getAtVariable
public String getAtVariable(int aTokenVal) throws UniSessionException
- returns the current value of the @variable specified by the input parameter. Valid
values for the input value are:
- Token (Value) UniVerse @Variable
- AT_LOGNAME(1) @LOGNAME
- AT_PATH(2) @PATH
- AT_USERNO(3) @USERNO
- AT_WHO(4) @WHO
- AT_TRANSACTION(5) @TRANSACTION
- AT_DATA_PENDING(6) @DATA.PENDING
- AT_USER_RETURN_CODE(7) @USER.RETURN.CODE
- AT_SYSTEM_RETURN_CODE(8) @SYSTEM.RETURN.CODE
- AT_NULL_STR(9) @NULL.STR
- AT_SCHEMA(10) @SCHEMA
- Parameters:
- aTokenVal - integer representing which @variable to return.
- Returns:
- String representing the @variable requested
- Throws: UniSessionException
- is thrown if an illegal argument is passed in
- See Also:
- setAtVariable
getDefaultBlockingStrategy
public int getDefaultBlockingStrategy()
- returns the default blocking strategy for this session. This controls the default behavior of what
requests that block on another lock do. It can be overriden by individual objects or requests.
Valid values are:
- WAIT_ON_LOCKED (1) - If record is locked, wait until it is released.
- RETURN_ON_LOCKED (2) - Return a value to the
status
method to indicate the state of the
lock. This is the default value.
- Returns:
- integer representing the current default blocking strategy
- See Also:
- setDefaultBlockingStrategy
getDefaultLockStrategy
public int getDefaultLockStrategy()
- returns the default locking strategy for this session. This controls the default behavior of what
type of lock is to be set when data is manipulated. It can be overriden by individual objects or requests.
Valid values are:
- NO_LOCKS (0) - no locking is to be performed. This is the default.
- EXCLUSIVE_UPDATE (1) - Set an exclusive update lock (READU)
- SHARED_READ (2) - Sets a shared read lock (READL)
- Returns:
- integer representing the current default locking strategy
- See Also:
- setDefaultLockStrategy
getDefaultReleaseStrategy
public int getDefaultReleaseStrategy()
- returns the default release strategy for this session. This controls the default behavior of what
requests that manipulate data does to existing locks. It can be overriden by individual objects or requests.
Valid values are:
- WRITE_RELEASE (1) - Releases the lock when the record is written. This is the default.
- READ_RELEASE (2) - Releases the lock when the record is read.
- EXPLICIT_RELEASE (4) - maintains locks as specified by the
LockStrategy
.
requires an unlockRecord
method to unlock the record.
- CHANGE_RELEASE (8) - releases the lock whenever a new value is assigned to the recordID property via
the
setRecordID
method.
getMaxOpenFiles
public int getMaxOpenFiles()
- returns the maximum number of
UniFile
objects we can open at any one time.
A return value of 0 means there is no limit.
- Returns:
- integer representing the maximum number of files that can be opened.
getNumOpenFiles
public int getNumOpenFiles()
- returns the current number of open
UniFile
objects.
- Returns:
- integer representing the number of currently active
UniFile
objects
iconv
public UniString iconv(Object aString,
Object aConvCode) throws UniStringException
- converts an input string into a UniVerse internal storage format using the
conversion format specified. The
status
function can be used
after this method to determine the status of the iconv
method.
- Parameters:
- aInputString - input string that is to be converted
- aConvCode - conversion code used to convert the string
- Returns:
- UniString representing the newly converted string
- Throws: UniStringException
- is thrown if an error occurs
- See Also:
- oconv, status
nlsLocale
public UniNLSlocale nlsLocale() throws UniSessionException
- If NLS is enabled on the server machine, this method will return an active
UniNLSlocale
object, which can then be used to manipulate server-side NLS Locale settings.
- Returns:
- UniNLSlocale object representing the state of the server-side NLS Locale.
- Throws: UniSessionException
- is thrown if an error occurs
- See Also:
- nlsMap
nlsMap
public UniNLSmap nlsMap() throws UniSessionException
- If NLS is enabled on the server machine, this method will return an active
UniNLSmap
object, which can then be used to manipulate server-side NLS Map settings.
- Returns:
- UniNLSmap object representing the state of the server-side NLS map.
- Throws: UniSessionException
- is thrown if an error occurs
- See Also:
- nlsLocale
oconv
public UniString oconv(Object aString,
Object aConvCode) throws UniStringException
- converts an output string into a UniVerse output storage format using the
conversion format specified. The
status
function can be used
after this method to determine the status of the oconv
method.
- Parameters:
- aInputString - input string that is to be converted
- aConvCode - conversion code used to convert the string
- Returns:
- UniString representing the newly converted string
- Throws: UniStringException
- is thrown if an error occurs
- See Also:
- iconv, status
openFile
public UniFile openFile(Object aFileName) throws UniSessionException
- returns a new
UniFile
object.
- Parameters:
- aFileName - name of the universe file to be opened.
- Returns:
- UniFile object representing the newly opened file
- Throws: UniSessionException
- is thrown if there is an error
open
public UniFile open(Object aFileName) throws UniSessionException
- returns a new
UniFile
object.
- Parameters:
- aFileName - name of the universe file to be opened.
- Returns:
- UniFile object representing the newly opened file
- Throws: UniSessionException
- is thrown if there is an error
openDict
public UniDictionary openDict(Object aFileName) throws UniSessionException
- returns a new
UniDictionary
object.
- Parameters:
- aFileName - name of the universe dictionary file to be opened.
- Returns:
- UniDictionary object representing the newly opened dictionary file
- Throws: UniSessionException
- is thrown if there is an error
openSeq
public UniSequentialFile openSeq(Object aFileName,
Object aRecordID,
boolean aCreateFlag) throws UniSessionException
- returns a new
UniSequentialFile
object.
- Parameters:
- aFileName - name of the sequential file to be opened. A UniVerse Type 1 or 19 file
- aRecordID - refers to a record within the file, optionally created if it does not exist
- aCreateFlag - boolean denoting whether or not the file should be created if it does not exist.
- Returns:
- UniSequentialFile object representing the newly opened sequential file
- Throws: UniSessionException
- is thrown if there is an error
releaseTaskLock
public void releaseTaskLock(int aLockNum) throws UniSessionException
- used to release a
TaskLock
that was set previously using the setTaskLock
method.
- Parameters:
- aLockNum - integer representing which of the 64 UniVerse task locks is to be set.
- Throws: UniSessionException
- is thrown if an error occurs.
- See Also:
- setTaskLock
selectList
public UniSelectList selectList(int aSelectListNumber) throws UniSessionException
- returns a newly created
UniSelectList
object
- Parameters:
- aSelectListNumber - which UniVerse select list to create
- Returns:
- UniSelectList object
- Throws: UniSessionException
- is thrown if an error occurs
setAtVariable
public void setAtVariable(int aTokenVal,
Object aAtVariable) throws UniSessionException
- sets the given @variable to the value passed in. Only affects UniObjectsTokens.AT_USER_RETURN_CODE
(value = 7 )
- Parameters:
- aTokenVal - integer representing which @variable to set
- aAtVariable - String representing the @variables new value
- Throws: UniSessionException
- is thrown if an invalid aTokenVal is passed in
- See Also:
- getAtVariable
setCompressionThreshold
public void setCompressionThreshold(int aCompressionThresholdVal) throws UniSessionException
- sets the current
CompressionThreshold
value.
- Parameters:
- aCompressionThresholdVal - integer representing the amount, in bytes, to set the compression
threshold to
- Throws: UniSessionException
- is thrown if an invalid aCompressionThresholdVal is passed in
setDefaultBlockingStrategy
public void setDefaultBlockingStrategy(int aBlockingStrategy) throws UniSessionException
- sets the default blocking strategy
- Parameters:
- aBlockingStrategy - integer representing the default blocking strategy
- Throws: UniSessionException
- is thrown if an invalid aBlockingStrategy is passed in
- See Also:
- getDefaultBlockingStrategy
setDefaultEncryptionType
public void setDefaultEncryptionType(int aEncryptionType) throws UniSessionException
- sets the current default encryption type to be used for this session. All subobjects will inherit this
value unless specifically overriden. It controls the type of encryption that is to be used for data transfer.
Valid values are:
- NO_ENCRYPTION (0) - no encryption is to be done. This is the default value.
- INTERNAL_ENCRYPTION (1) - use UniVerse internal encryption.
/ul>
- Parameters:
- aType - integer representing the type of encryption that is to be used.
- Throws: UniSessionException
- is thrown if an invalid aType is passed in
setDefaultLockStrategy
public void setDefaultLockStrategy(int aLockingStrategy) throws UniSessionException
- sets the default locking strategy
- Parameters:
- aLockingStrategy - integer representing the default locking strategy
- Throws: UniSessionException
- is thrown if an invalid aLockingStrategy is passed in
- See Also:
- getDefaultLockStrategy
setDefaultReleaseStrategy
public void setDefaultReleaseStrategy(int aReleaseStrategy) throws UniSessionException
- sets the default release strategy
- Parameters:
- aReleaseStrategy - integer representing the default release strategy
- Throws: UniSessionException
- is thrown if an invalid aReleaseStrategy is passed in
- See Also:
- getDefaultReleaseStrategy
setTaskLock
public void setTaskLock(int aLockNum) throws UniSessionException
- used to set on of the 64 UniVerse synchronization locks.
- Parameters:
- aLockNum - integer representing which one of the 64 UniVerse synchronization locks is to be set
- Throws: UniSessionException
- is thrown is an error occurs in obtaining the task lock
- See Also:
- releaseTaskLock
setTimeout
public void setTimeout(int aTimeoutVal) throws UniSessionException
- Sets the UniRPC timeout value. Initially, it is set to 0, indicating no timeout is to occur. If it is set
to a value > 0, the UniRPC will timeout after that many seconds.
- Parameters:
- aTimeoutVal - integer representing the number of seconds the UniRPC should wait until it times out.
- Throws: UniSessionException
- is thrown if the timeout cannot be set
status
public int status()
- returns information concerning the state of certain operations. See those methods for more details
- Returns:
- s integer representing the status of the last operation performed.
- See Also:
- connect
subroutine
public UniSubroutine subroutine(Object aSubName,
int aNumArgs) throws UniSessionException
- returns a new
UniSubroutine
representing the new subroutine object created.
- Parameters:
- aSubName - String representing the name of the subroutine to be executed on the server.
- aNumArgs - integer representing the number of arguments this subroutine has
- Returns:
- UniSubroutine object representing the new subroutine
- Throws: UniSessionException
- is thrown if an error occurs
transaction
public UniTransaction transaction() throws UniSessionException
- returns a new
UniTransaction
object to allow transactional control
of the session.
- Returns:
- UniTransaction object allow modification of the sessions transactional behavior
- Throws: UniSessionException
- is thrown if an error occurs
getValue
protected String getValue(int key) throws UniSessionException
- used to get a AT value from the server
- Parameters:
- key - integer representing the key value requested
- Returns:
- String representing the UniVerse session @variable
- Throws: UniSessionException
- is thrown if an error occurs
isCommandActive
protected boolean isCommandActive()
- checks to see if a command is in an active state
- Returns:
- boolean stating whether we are in the middle of a command execution or not
All Packages Class Hierarchy This Package Previous Next Index