asjava.uniclientlibs
Class UniConnection

java.lang.Object
  extended byasjava.uniclientlibs.UniConnection
Direct Known Subclasses:
UniSession

public abstract class UniConnection
extends java.lang.Object

UniConnection acts as the central object for any database connection, controlling access to any network related elements. It controls information regarding the connection. It cannot be instantiated by itself, but instead is used as the foundation for other connection/session objects, such as the UniSession object.

Since:
UNICLIENTLIBS 1.0
Version:
Version 1.0
Author:
David T. Meeks

Field Summary
protected  java.lang.String accountPath
           
protected  int compressionThreshold
           
 asjava.unirpc.UniRPCConnection connection
           
protected  int encryptionType
           
protected  java.lang.String hostName
           
protected  int hostPort
           
protected  int hostType
           
protected  asjava.unirpc.UniRPCPacket inPacket
           
protected  boolean isActive
           
protected  boolean isNLSEnabled
           
protected  boolean isNLSLocalesEnabled
           
protected  boolean isNLSUnidataSession
           
protected  boolean isRPCError
           
protected  java.lang.String licenseToken
           
protected  asjava.unirpc.UniRPCPacket outPacket
           
protected  java.lang.String password
           
protected  java.lang.String proxyHost
           
protected  int proxyPort
           
protected  java.lang.String proxySecurityToken
           
protected  int timeout
           
protected  int transport
           
protected  java.lang.String uniConnectionString
           
protected  java.lang.String uniDataSourceType
           
protected  java.lang.String[] uniMarkCharacters
           
protected  java.lang.String uniSubKey
           
protected  java.lang.String userName
           
 
Constructor Summary
UniConnection()
           
 
Method Summary
protected  java.lang.String encrypt(java.lang.String aString)
          This method is used to encrypt a given string into an internal format that is understood by the server
 java.lang.String getAccountPath()
          returns the account path being used for the connection
 int getCompressionThreshold()
          returns the current CompressionThreshold.
 java.lang.String getConnectionString()
          returns the current connection string, which is the string used to connect to a particular database type.
 java.lang.String getDataSourceType()
          returns the current data source type, which can be either "UNIVERSE" or "UNIDATA".
 int getDefaultEncryptionType()
          returns the current default encryption type to be used for this session.
 java.lang.String getDeviceSubkey()
          gets the device subkey used in client-side licensing.
 java.lang.String getHostName()
          returns the name of the host we are connecting to.
 int getHostPort()
          returns the port number used for this connection.
 int getHostType()
          returns a value representing the type of host the session is connected to.
 asjava.unirpc.UniRPCPacket getInPacket()
           
 java.lang.String getMarkCharacter(int aMarkChar)
          returns the specified mark characters.
 asjava.unirpc.UniRPCPacket getOutPacket()
           
 java.lang.String getPassword()
          returns the password used to establish the connection to the host system
 java.lang.String getProxyHost()
          returns the name of the ProxyHost being used for this connection
 int getProxyPort()
          returns the port number that the ProxyHost resides on
 java.lang.String getProxyToken()
          returns the security string (password) used for validation on the ProxyHost
 boolean getRPCError()
           
 int getServerVersion()
          returns the current version of the host RPC version
 int getTimeout()
          returns the current RPC timeout period.
 int getTransport()
          returns the type of network transport being used.
 java.lang.String getUserName()
          returns the current user name used for this connection
 boolean isActive()
          boolean method that indicates true if a connection has been successfully established.
 boolean isCompressionEnabled()
          boolean method that indicates true if a data compression is available for this UniSession.
 boolean isEncryptionEnabled()
          boolean method that indicates true if data encryption is available for this UniSession.
 boolean isNLSEnabled()
          boolean method that indicates true if the server this object is connected to is currently NLS enabled.
 boolean isNLSLocalesEnabled()
          boolean method that indicates true if the server this object is connected to is currently NLS locales enabled.
 void setAccountPath(java.lang.Object aAccountPath)
          sets the account path to be used for the connection
 void setAccountPath(java.lang.String aAccountPath)
          sets the account path to be used for the connection
 void setCompressionThresholdInt(int aCompressionThresholdVal)
          sets the current CompressionThreshold value.
 void setConnectionString(java.lang.Object connString)
          sets connection string to be used for server connection
 void setConnectionString(java.lang.String connString)
          sets connection string to be used for server connection
 void setDataSourceType(java.lang.Object dataSourceType)
          sets data source type to connect to.
 void setDataSourceType(java.lang.String dataSourceType)
          sets data source type to connect to.
 void setDefaultEncryptionTypeInt(int aType)
          sets the current default encryption type to be used for this session.
 void setDeviceSubkey(java.lang.Object subKey)
          sets up the device subkey for use in client-side licensing.
 void setHostName(java.lang.Object aHostName)
          sets the host name to establish the connection to.
 void setHostName(java.lang.String aHostName)
          sets the host name to establish the connection to.
 void setHostPort(int aHostPort)
          sets the port number the connection should connect to on the server side.
 void setPassword(java.lang.Object aPassword)
          sets the password to be used for the server-side connection
 void setPassword(java.lang.String aPassword)
          sets the password to be used for the server-side connection
 void setProxyHost(java.lang.Object aProxyHost)
          sets the host name of the ProxyServer to connect to
 void setProxyHost(java.lang.String aProxyHost)
          sets the host name of the ProxyServer to connect to
 void setProxyPort(int aProxyPort)
          sets the port number on the ProxyServer that should be used for the connection
 void setProxyToken(java.lang.Object aProxyToken)
          sets the ProxyServer security token (password) to be used for connection validation
 void setRPCError(boolean isRPCError)
           
 void setTimeoutInt(int aTimeoutVal)
          Sets the UniRPC timeout value.
 void setTransport(int aTransportType)
          Used to establish which type of network transport should be used.
 void setUserName(java.lang.Object aUserName)
          sets the user name that is to be used in the connection to the remote server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

public asjava.unirpc.UniRPCConnection connection

inPacket

protected asjava.unirpc.UniRPCPacket inPacket

outPacket

protected asjava.unirpc.UniRPCPacket outPacket

accountPath

protected java.lang.String accountPath

hostName

protected java.lang.String hostName

password

protected java.lang.String password

userName

protected java.lang.String userName

uniMarkCharacters

protected java.lang.String[] uniMarkCharacters

uniConnectionString

protected java.lang.String uniConnectionString

uniDataSourceType

protected java.lang.String uniDataSourceType

proxyHost

protected java.lang.String proxyHost

proxySecurityToken

protected java.lang.String proxySecurityToken

licenseToken

protected java.lang.String licenseToken

uniSubKey

protected java.lang.String uniSubKey

hostPort

protected int hostPort

proxyPort

protected int proxyPort

transport

protected int transport

compressionThreshold

protected int compressionThreshold

timeout

protected int timeout

encryptionType

protected int encryptionType

hostType

protected int hostType

isNLSEnabled

protected boolean isNLSEnabled

isNLSLocalesEnabled

protected boolean isNLSLocalesEnabled

isActive

protected boolean isActive

isRPCError

protected boolean isRPCError

isNLSUnidataSession

protected boolean isNLSUnidataSession
Constructor Detail

UniConnection

public UniConnection()
Method Detail

getAccountPath

public java.lang.String getAccountPath()
returns the account path being used for the connection

Returns:
String representing the account path being used for the current connection.
Since:
UNICLIENTLIBS 1.0
See Also:
setAccountPath(java.lang.Object)

getCompressionThreshold

public int getCompressionThreshold()
returns the current CompressionThreshold. Whenever a data packet is transferred that exceeds the CompressionThreshold, it will be compressed using an internal compression algorithm. This will be done for performance reasons. By default, it is set to 0, which represents no compression is to be done. Any non-zero value will enable compression.

Returns:
integer representing the compression threshold, in bytes
Since:
UNICLIENTLIBS 1.0

getConnectionString

public java.lang.String getConnectionString()
returns the current connection string, which is the string used to connect to a particular database type. By default, this will be "DEFCS". This value relates to what is in the uvrpcservices file on the server.

Returns:
String representing the current connection string
Since:
UNICLIENTLIBS 1.0
See Also:
setConnectionString(java.lang.Object)

getDataSourceType

public java.lang.String getDataSourceType()
returns the current data source type, which can be either "UNIVERSE" or "UNIDATA".

Returns:
String representing the current data source type
Since:
UNICLIENTLIBS 1.0
See Also:
setDataSourceType(java.lang.Object)

getDefaultEncryptionType

public int getDefaultEncryptionType()
returns 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:

getDeviceSubkey

public java.lang.String getDeviceSubkey()
gets the device subkey used in client-side licensing. This is used to establish differentiation between multiple applications running on the same device, making connections to the same server. It allows a level of connection pooling.

Returns:
String representing the subkey to be used
Since:
UNICLIENTLIBS 1.0
See Also:
setDeviceSubkey(java.lang.Object)

getHostName

public java.lang.String getHostName()
returns the name of the host we are connecting to. It will return the value as specified in either the setHostName or connect methods.

Returns:
String representing the host name we are connected to.
Since:
UNICLIENTLIBS 1.0
See Also:
setHostName(java.lang.String)

getHostPort

public int getHostPort()
returns the port number used for this connection.

Returns:
integer representing the port number for this connection
Since:
UNIBOJECTS 1.0
See Also:
setHostPort(int)

getHostType

public int getHostType()
returns a value representing the type of host the session is connected to. Valid values are:

Returns:
integer representing the type of host we are connected to.
Since:
UNICLIENTLIBS 1.0

getServerVersion

public int getServerVersion()
returns the current version of the host RPC version

Returns:
integer representing the current RPC version.
  • a value of 1 represents an old server, where
  • a value of 2 or greater represents a new server
  • a value of -1 represents an error condition
Since:
UNICLIENTLIBS 1.0

getMarkCharacter

public java.lang.String getMarkCharacter(int aMarkChar)
                                  throws UniConnectionException
returns the specified mark characters. It will return the specified mark character based on the following list:

Parameters:
aMarkChar - integer representing which character to obtain
Returns:
String representing the requested mark character
Throws:
UniConnectionException - is thrown if an error occurs
Since:
UNICLIENTLIBS 1.0

getPassword

public java.lang.String getPassword()
returns the password used to establish the connection to the host system

Returns:
String representing the password being used for the connection
Since:
UNICLIENTLIBS 1.0
See Also:
setPassword(java.lang.Object)

getProxyHost

public java.lang.String getProxyHost()
returns the name of the ProxyHost being used for this connection

Returns:
String representing the name of the ProxyHost
Since:
UNICLIENTLIBS 1.0
See Also:
setProxyHost(java.lang.Object)

getProxyPort

public int getProxyPort()
returns the port number that the ProxyHost resides on

Returns:
integer representing the ProxyHost port number
Since:
UNICLIENTLIBS 1.0
See Also:
setProxyPort(int)

getProxyToken

public java.lang.String getProxyToken()
returns the security string (password) used for validation on the ProxyHost

Returns:
String representing the password used for ProxyHost validation
Since:
UNICLIENTLIBS 1.0
See Also:
setProxyToken(java.lang.Object)

getTimeout

public int getTimeout()
returns the current RPC timeout period. This value is used to timeout RPC requests. The default value is 0, which means no timeout period.

Returns:
integer representing the current timeout interval for the RPC
Since:
UNICLIENTLIBS 1.0

getTransport

public int getTransport()
returns the type of network transport being used. Currently, only TCP/IP is supported.

Returns:
integer representing the type of network transport being used.
Since:
UNICLIENTLIBS 1.0
See Also:
setTransport(int)

getUserName

public java.lang.String getUserName()
returns the current user name used for this connection

Returns:
String representing the user name used for this connection
Since:
UNICLIENTLIBS 1.0
See Also:
setUserName(java.lang.Object)

isActive

public boolean isActive()
boolean method that indicates true if a connection has been successfully established. It is false if the connection has not been established.

Returns:
boolean representing the state of the connection
Since:
UNICLIENTLIBS 1.0

isCompressionEnabled

public boolean isCompressionEnabled()
boolean method that indicates true if a data compression is available for this UniSession. It is false if the connection does not support data compression.

Returns:
boolean representing the availability of data compression
Since:
UNICLIENTLIBS 1.0

isEncryptionEnabled

public boolean isEncryptionEnabled()
boolean method that indicates true if data encryption is available for this UniSession. It is false if this session does not support encryption.

Returns:
boolean representing the availability of data encryption
Since:
UNICLIENTLIBS 1.0

isNLSEnabled

public boolean isNLSEnabled()
boolean method that indicates true if the server this object is connected to is currently NLS enabled. It will return false if the server is not NLS aware.

Returns:
boolean representing the state of NLS on the server
Since:
UNICLIENTLIBS 1.0

isNLSLocalesEnabled

public boolean isNLSLocalesEnabled()
boolean method that indicates true if the server this object is connected to is currently NLS locales enabled. It will return false if the server is not NLS locales aware.

Returns:
boolean representing the state of NLS locales on the server
Since:
UNICLIENTLIBS 1.0

setAccountPath

public void setAccountPath(java.lang.Object aAccountPath)
sets the account path to be used for the connection

Parameters:
aAccountPath - object representing which account to connect to
Since:
UNICLIENTLIBS 1.0
See Also:
getAccountPath()

setAccountPath

public void setAccountPath(java.lang.String aAccountPath)
sets the account path to be used for the connection

Parameters:
aAccountPath - String representing which account to connect to
Since:
UNICLIENTLIBS 1.0
See Also:
getAccountPath()

setCompressionThresholdInt

public void setCompressionThresholdInt(int aCompressionThresholdVal)
                                throws UniConnectionException
sets the current CompressionThreshold value.

Parameters:
aCompressionThresholdVal - integer representing the amount, in bytes, to set the compression threshold to
Throws:
UniConnectionException - is thrown if an invalid aCompressionThresholdVal is passed in
Since:
UNICLIENTLIBS 1.0

setConnectionString

public void setConnectionString(java.lang.Object connString)
sets connection string to be used for server connection

Parameters:
connString - object representing the connection string to be used.
Since:
UNICLIENTLIBS 1.0
See Also:
getConnectionString()

setConnectionString

public void setConnectionString(java.lang.String connString)
sets connection string to be used for server connection

Parameters:
connString - string representing the connection string to be used.
Since:
UNICLIENTLIBS 1.0
See Also:
getConnectionString()

setDataSourceType

public void setDataSourceType(java.lang.Object dataSourceType)
                       throws UniConnectionException
sets data source type to connect to. By default, it's UNIVERSE. Changing this value will also change the default connection string

Parameters:
dataSourceType - object representing the datasource type.
Throws:
UniConnectionException - is thrown is an invalid data source type is specified
Since:
UNICLIENTLIBS 1.0
See Also:
getDataSourceType()

setDataSourceType

public void setDataSourceType(java.lang.String dataSourceType)
                       throws UniConnectionException
sets data source type to connect to. By default, it's UNIVERSE. Changing this value will also change the default connection string

Parameters:
dataSourceType - string representing the datasource type.
Throws:
UniConnectionException - is thrown is an invalid data source type is specified
Since:
UNICLIENTLIBS 1.0
See Also:
getDataSourceType()

setDefaultEncryptionTypeInt

public void setDefaultEncryptionTypeInt(int aType)
                                 throws UniConnectionException
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:

setDeviceSubkey

public void setDeviceSubkey(java.lang.Object subKey)
sets up the device subkey for use in client-side licensing. This is used to establish differentiation between multiple applications running on the same device, making connections to the same server. It allows a level of connection pooling.

Parameters:
subKey - String representing the subkey to be used
Since:
UNICLIENTLIBS 1.0
See Also:
getDeviceSubkey()

setHostName

public void setHostName(java.lang.String aHostName)
sets the host name to establish the connection to.

Parameters:
aHostName - String representing the name of the host to connect to
Since:
UNICLIENTLIBS 1.0
See Also:
getHostName()

setHostName

public void setHostName(java.lang.Object aHostName)
sets the host name to establish the connection to.

Parameters:
aHostName - object representing the name of the host to connect to
Since:
UNICLIENTLIBS 1.0
See Also:
getHostName()

setHostPort

public void setHostPort(int aHostPort)
sets the port number the connection should connect to on the server side.

Parameters:
aHostPort - integer representing the hostside port number to connect to
Since:
UNICLIENTLIBS 1.0
See Also:
getHostPort()

setPassword

public void setPassword(java.lang.Object aPassword)
sets the password to be used for the server-side connection

Parameters:
aPassword - object representing the password to be used for the connection
Since:
UNICLIENTLIBS 1.0
See Also:
getPassword()

setPassword

public void setPassword(java.lang.String aPassword)
sets the password to be used for the server-side connection

Parameters:
aPassword - String representing the password to be used for the connection
Since:
UNICLIENTLIBS 1.0
See Also:
getPassword()

setProxyHost

public void setProxyHost(java.lang.Object aProxyHost)
sets the host name of the ProxyServer to connect to

Parameters:
aProxyHost - object representing the name of the ProxyServer to connect to
Since:
UNICLIENTLIBS 1.0
See Also:
getProxyHost()

setProxyHost

public void setProxyHost(java.lang.String aProxyHost)
sets the host name of the ProxyServer to connect to

Parameters:
aProxyHost - String representing the name of the ProxyServer to connect to
Since:
UNICLIENTLIBS 1.0
See Also:
getProxyHost()

setProxyPort

public void setProxyPort(int aProxyPort)
sets the port number on the ProxyServer that should be used for the connection

Parameters:
aProxyPort - integer reprenting the port number that should be used for the connection to the ProxyServer.
Since:
UNICLIENTLIBS 1.0
See Also:
getProxyPort()

setProxyToken

public void setProxyToken(java.lang.Object aProxyToken)
sets the ProxyServer security token (password) to be used for connection validation

Parameters:
aProxyToken - String representing the secutiry token (password) to be used for connection validation
Since:
UNICLIENTLIBS 1.0
See Also:
getProxyToken()

setTimeoutInt

public void setTimeoutInt(int aTimeoutVal)
                   throws UniConnectionException
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:
UniConnectionException - is thrown if the timeout cannot be set
Since:
UNICLIENTLIBS 1.0

setTransport

public void setTransport(int aTransportType)
Used to establish which type of network transport should be used. The only currently supported network transport mechanism is TCP/IP

Parameters:
aTransportType - integer representing the type of network transport should be used.
Since:
UNICLIENTLIBS 1.0
See Also:
getTransport()

setUserName

public void setUserName(java.lang.Object aUserName)
sets the user name that is to be used in the connection to the remote server

Parameters:
aUserName - String representing the server-side username used for connection purposes.
Since:
UNICLIENTLIBS 1.0
See Also:
getUserName(), UniSession.connect()

encrypt

protected java.lang.String encrypt(java.lang.String aString)
This method is used to encrypt a given string into an internal format that is understood by the server


getInPacket

public asjava.unirpc.UniRPCPacket getInPacket()

getOutPacket

public asjava.unirpc.UniRPCPacket getOutPacket()

getRPCError

public boolean getRPCError()
Returns:
Returns the isRPCError.

setRPCError

public void setRPCError(boolean isRPCError)
Parameters:
isRPCError - The isRPCError to set.