The Web Application Services Class Library consists of object-oriented Java language classes for creating a TUXEDO session.
The Web Application Services Class Library Reference includes the following topics:
This Java package contains all the core Jolt wrapper classes that are neutral to all Web servers. These classes are:
bea.web Package
This class contains the TUXEDO user authentication information. This information may be needed to create a TUXEDO session. If the user does not want to expose the authentication information on the web server, the user may embed the authentication information within a derived class.
The following constructor creates an instance of the UserInfo class.
UserInfo Class
java.lang.Object
|
+----bea.web.UserInfo UserInfo Constructor
UserInfo
This constructor creates an instance of the UserInfo class.
UserInfo
()
The following methods are used in conjunction with the UserInfo class:
voidsetUserName
(Stringusername
)
username
You must set the TUXEDO user name before creating a session pool. This is only required if the user authorization level is specified in TUXEDO.
voidsetUserPassword
(Stringpassword
)
password
You must set the TUXEDO user password before creating a session. This is only required if the user authorization level is specified in TUXEDO.
voidsetUserRole
(Stringuserrole
)
userrole
You must set the TUXEDO user role before creating a session. This is only required if the user authorization level is specified in TUXEDO.
voidsetAppPassword
(Stringpassword
)
password
You must set the TUXEDO application password before creating a session. This is only required if the application or user authorization level is specified in TUXEDO.
java.lang.Object
|
+----java.util.Dictionary
|
+----java.util.Hashtable
|
+----bea.web.SessionPoolManager
This base class represents a session pool manager which manages one or more session pools. Each session pool identified by an ID contains a pool of connections to Jolt servers.
When an HTTP request arrives, the session pool manager uses an ID to find the corresponding session pool to serve the request.
The following methods are used in conjunction with the SessionPoolManager class:
final void done()
Done with this session manager.
final intcreateSessionPool
(Stringaddrs
[], Stringsaddrs
[],
intminCons
, intmaxCons
, UserInfousr
, Stringid
)
addrs
saddrs
minCons
maxCons
usr
id
Create a session pool with multiple restartable connections. The caller provides a unique ID to identify the session pool. If a connection in the session pool is terminated unexpectedly, a new connection will be established to keep the session pool alive. A session pool provides load-balancing among connections and failover capability by letting the user specify a primary server address list and a secondary server address list. The id
must be null for this release.
This method returns the number of successful connections.
final voidstopSessionPool
(Stringid
)
id
Shut down a session pool; all active connections in the session are also terminated immediately. The ID
must be null for this release. This method is part of the administrative class library.
final SessionPool getSessionPool(Stringid
)
id
Get the session pool. If the session pool does not exist, this method will return a null object. The ID
must be null for this release.
A session pool or null if it does not exist.
final voidsuspendSessionPool
(Stringid
, booleanaction
)
id
action
true
to suspend the session pool; false
to resume it.
Suspend this session pool so it will not accept any new requests. It allows the administrator to shut down the session pool gracefully. The ID
must be null for this release. This method is part of the administrative class library.
final void removeSessionPool(Stringid
)
id
Shut down and remove the session pool; all active connections in this session pool are terminated immediately. The ID
must match the id
in createSessionPool()
. This method is part of the administrative class library.
java.lang.Object
|
+----bea.web.SessionPool
This base class represents a session pool that contains one or more connections (sessions) to Jolt servers. The session pool is responsible to select the least busy connection to serve each service call. An application may tie multiple service calls into a transaction. To start a transaction, the session pool selects the least busy connection and puts it in transactional mode.
Unless the number of connections in the session pool is one or the request is engaged in a transaction, there is no guarantee that the service calls in each HTTP request will be served by the same connection. All service calls associated with the transaction are handled by the same connection. The connection is locked until the transaction is committed or aborted. The transaction should be committed or aborted before continuing to another page, unless programmatic arrangements to commit or abort the transaction have been made.
The following methods are used in conjunction with the SessionPool class:
Transaction startTransaction(inttimeout
)
timeout
Start a transaction. The transaction should be committed or aborted before continuing to another page, unless programmatic arrangements to commit or abort the transaction have been made. Otherwise, the connection is locked until the transaction is terminated.
A transaction object, or null if failure occurs.
intgetConnection
(intindex
)
Get a connection. This method is part of the administrative class library.
index
intgetMaxConnections
()
Get the maximum number of connections configured in this session. This method is part of the administrative class library.
intsetMaxConnections
(intmaxCons
)
maxCons
Change the session pool size. Currently shrinking the session pool is disallowed. This method is part of the administrative class library.
The new spool size, or -1 for shrinking the session pool.
booleanisSuspended
()
Check if this session pool is suspended. A suspended session pool does not accept any new requests. This method is part of the administrative class library.
java.lang.Object
|
+----bea.web.Connection
This class represents a connection (session) to a Jolt server and provides simple methods for service invocations and transaction demarcation. This class is a part of the administrative class library.
The following methods are used in conjunction with the Connection class:
final DategetAccessTime
()
Get the last access time of this object.
final StringgetAddr
()
Get the server address.
final intgetErrorCount
()
Get the cumulative system error count.
final intgetUseCount
()
Get the outstanding request count.
booleaninTransaction
()
Check if the connection is in a transaction.
True
if the connection is in a transaction; false
otherwise.
booleanisAlive
()
Check if the connection is still alive.
True
if the connection is still alive; false
otherwise.
java.lang.Object
|
+----bea.web.Transaction
This class is a wrapper for the bea.joltJoltTransaction class. If an error occurs, the method in this class returns an error code instead of throwing an exception.
The following methods are used in conjunction with the Transaction class:
intcommit
()
Commit the transaction.
0 if successful; otherwise, a TUXEDO error number.
introllback
()
Roll back the transaction.
0 if successful; otherwise, a TUXEDO error number.
java.lang.Object
|
+----bea.web.Template
This base class processes a template and replaces tags of the form <%=
name
%>
or indexed tags of the form <%=
name
[
index
]%>
(where name
and index
are user-defined constructs) with values. name
must start with an underscore (_
) or letter and be followed by one or more letters, digits, or underscores. The values from the TemplateData Class are used to populate the tags. If a duplicate name exists in the multiple TemplateData objects, the later element has a higher precedence.
The following methods are used in conjunction with the Template class:
final intload
(Stringpath
)
path
Load the template file into memory. The contents are cached until the unload
method is called.
0 if success; -1 if file cannot be opened.
final voidunload
()
Unload the cached template contents.
java.lang.Object
|
+----java.util.Dictionary
|
+----java.util.Hashtable
|
+----bea.web.TemplateData
This base class extends from java.util.Hashtable
and it provides a fast mechanism to store and retrieve a data element by name and index. The keys in the hash table are the names of the data elements.
The following methods are used in conjunction with the TemplateData class:
voidsetValue
(Stringname
, intindex
, Stringvalue
)
name
index
value
Set the string value of a data element associated with a name and an index.
voidsetValue
(Stringname
, Stringvalue
)
name
value
This method is the same as setValue(
name
,0,
value
)
for a non-octet value.
StringgetValue
(Stringname
, intindex
, StringdefaultValue
)
name
index
defaultValue
Get the string value of a data element associated with a name and an index. Most output data, except carray
(octets) data type, are automatically converted to String. If there is a typecast error, the default value will be returned.
The value of the data element or the default value.
StringgetValue
(Stringname
, StringdefaultValue
)
name
defaultValue
This method is same as getValue(
name
,0,
defaultValue
)
.
The value of the data element, or the default value.
byte[] getBytesValue(Stringname
, intindex
, bytedefval
[])
name
index
defval
Get the octet value of a data element associated with a name and an index. If an output field has carray
(octets) data type, the data remains as byte[]
. The caller must use this method to retrieve the data. If there is a typecast error, the default value will be returned.
The octet value of the data element or the default value.
byte[] getBytesValue(Stringname
, bytedefval
[])
name
defval
This method is same as getBytesValue(name, 0, defval)
method.
The octet value of the data element or the default value.
void setBytesValue(Stringname
, intindex
, bytevalue
[])
name
index
value
Set the octet value of a data element associated with a name and an index. The data element should be defined as carray
in TUXEDO.
void setBytesValue(Stringname
, bytevalue
[])
name
value
This method is same as setBytesValue(name,0,value)
for the octet value.
intgetCount
(Stringname
)
name
Get the occurrence count of a data element.
The count.
java.lang.Object
|
+----java.util.Dictionary
|
+----java.util.Hashtable
|
+----bea.web.TemplateData
|
+----bea.web.Result
This class represents the result set from the service invocation. Most output data types are converted into String
, except carray
which remains as byte[]
. The caller must use the getBytesValue()
methods to get the carray
data. The keys to the hash table are the field names in the result set. Since this class is derived from the TemplateData class, it can be used by the Template class for template processing.
The following methods are used in conjunction with the Result class:
booleanapplicationError
()
Test if an application error occurred in the last service invocation. The application error is equivalent to TPESVCFAIL
in TUXEDO.
True
if an application error occurred; false
otherwise.
intgetApplicationCode
()
Get the application code returned by the service. The application code is same as the tpurcode
in TUXEDO.
The application code.
intgetError
()
Get the system (non-TPESVCFAIL
) error number. The error number is the same as the tperrno
in TUXEDO.
The error number.
intgetErrorDetail
()
Get the detail system error number. This information is available only to TUXEDO 6.4 and then only if the service call has timed out.
The detail system error number, if TUXEDO 6.4; otherwise 0.
StringgetStringError
()
Get the system error message.
The system error message. If it is not a system error, null is returned.
StringgetStringErrorDetail
()
Get the detail system error message. This information is available only to
TUXEDO 6.4 and then only if the service call has timed out.
The detail system error message, if TUXEDO 6.4; otherwise null.
booleannoError()
Test whether no error was encountered in the last service invocation.
True
if no error occurred; false
otherwise.
booleansystemError
()
Test whether a system error occurred in the last service invocation.
True
if a system error occurred; false
otherwise.
The bea.web.ns
package contains the classes specific for the Netscape server-side JavaScript. These classes are:
This class provides a session pool factory for the Netscape-specific The following constructor creates an instance of the SessionPoolManager class.
SessionPoolManager Class
java.lang.Object
|
+----java.util.Dictionary
|
+----java.util.Hashtable
|
+----bea.web.SessionPoolManager
|
+----bea.web.ns.SessionPoolManagerSessionPool
object and provides the conversion from LiveWire JSObject
to Jolt object. The actual implementation of the session pool manager is in its parent class.
SessionPoolManager Constructor
SessionPoolManager
This constructor creates an instance of the SessionPoolManager class.
Synopsis
SessionPoolManager
()
The following method is used in conjunction with the SessionPoolManager class:
int
createSessionPool
(JSObject
addrs
, JSObject
saddrs
,
intminCons
,
intmaxCons
, UserInfousr
, Stringid
)
addrs
saddrs
minCons
maxCons
usr
id
Create a session pool with multiple restartable connections. This method is the same as bea.web.createSessionPool
, except the addrs
and saddrs
parameters are JavaScript Array objects (for example, addrs[0] = "//mach:7000"
).
The number of successful connections.
java.lang.Object
|
+----bea.web.SessionPool
|
+----bea.web.ns.SessionPool
This class extends from the bea.web.SessionPool and it provides an additional call() method that understands Netscape server-side JavaScript object.
The following methods are used in conjunction with the SessionPool class:
Resultcall
(Stringname
, JSObjectindata
)
name
indata
Call a service without involving any transaction. This is equivalent to using the call(name, indata, null)
method.
A Result object.
Resultcall
(Stringname
, JSObjectindata
, Transactiontran
)
name
indata
tran
Call a service with a transaction. The indata
parameter is either a JavaScript Array of name-value pairs or a server-side JavaScript Request object. (A name-value pair is a construct of the form name
=
value
.) The name in the name-value pair should match the parameter name in the Jolt service definition. The member name in the Request object can have a trailing underscore and an index number (as, for example, SBALANCE_0
) if it is a multiple occurrence field. Any nonmatching names in the indata
parameter are ignored. The tran
parameter must be the object returned by the startTransaction()
method.
A Result object.
java.lang.Object
|
+----bea.web.Template
|
+----bea.web.ns.Template
This class extends from bea.web.Template and it provides some additional methods that understands Netscape server-side JavaScript objects.
The following constructor creates an instance of the Template class.
Template
()
A default constructor.
The following methods are used in conjunction with the Template class:
inteval
(JSObjectdata
)
data
Process the cached template with a list of data set and send the processed template to the client. The list must be a JavaScript Array object.
0 if success; -1 for any I/O error.
final inteval
(TemplateDatadata
)
data
Process the cached template with a data set and send the processed template to the client.
0 if success; -1 for any I/O error.
intevalFile
(Stringpath
, JSObjectdata
)
path
data
Process a template file with a list of data sets. The list must be a JavaScript Array object.
0 if success; -1 if the template file cannot be opened or there is an I/O error.
final intevalFile
(Stringpath
, TemplateDatadata
)
path
data
Process a template file with a data set and send the processed template to the client.
0 if success; -1 if the template file cannot be opened or there is an I/O error.
java.lang.Object
|
+----java.util.Dictionary
|
+----java.util.Hashtable
|
+----bea.web.TemplateData
|
+----bea.web.ns.TemplateData
This class represents the data set that can be used by template processing or service invocation to store the result set. It provides an extra method to import the server-side JavaScript request object. The keys to the hash table are the field names in the data set.
The following constructor creates an instance of the TemplateData class.
TemplateData()
A default constructor.
The following method is used in conjunction with the TemplateData class:
voidimportRequest
(JSObjectrequest
)
request
Import the values from the server-side Request into this data set object.