A ects2EJBbase base class is provided for Object Integration Gateway EJB session bean implementations. You extend this class to create your EJB session bean components.
This class contains methods for running Gateway objects. The source code for a sample class, ects2EJBSampleBean, is provided later in this chapter to illustrate how to extend the base class for your own EJB component class.
|
|
addSessionParm(String persistKey, String value) throws java.rmi.RemoteException
|
|
addSessionParms(java.util.HashMap persistData) throws java.rmi.RemoteException
|
|
deletePersistData() throws java.rmi.RemoteException
|
|
deletePersistData(String persistKey) throws java.rmi.RemoteException
|
|
ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException
|
Implementation of the javax.ejb.SessionBean interface method.
|
ejbCreate() throws javax.ejb.EJBException, java.rmi.RemoteException
|
Implementation of the javax.ejb.SessionBean interface method. Create without a session pool.
|
ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException
|
Implementation of the javax.ejb.SessionBean interface method.
|
ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException
|
Implementation of the javax.ejb.SessionBean interface method.
|
String getDocument(String docname) throws java.rmi.RemoteException
|
Returns the XML document from the last run method call. The XML document must be of type ROWSET or MSSCHEMA.
|
String getEndMsg() throws java.rmi.RemoteException
|
|
|
|
String getResult() throws java.rmi.RemoteException
|
|
String getSessionParm(String persistKey) throws java.rmi.RemoteException
|
|
|
|
WebRowSet getTable(String docName) throws java.rmi.RemoteException
|
Converts an XML document from the last run method call to a WebRowSet object, and returns the WebRowSet object. The XML document must be of type ROWSET or MSSCHEMA.
|
|
Returns a WebRowSet by parsing an XML document returned as a result of running a defined XML document.
|
openApplication() throws ects2EJBException
|
Obtains an unpooled session with the parameters specified in the deployment descriptor for this EJB.
|
|
Obtains a pooled or unpooled session with the parameters specified in the deployment descriptor for this EJB.
|
openApplication(java.util.HashMap parms, boolean pooled) throws ects2EJBException
|
Obtains a pooled or unpooled session with the parameters supplied in the parms argument. Parameters not supplied in the parms argument are provided by the deployment descriptor for this EJB.
|
removeSessionParm(String persistKey) throws java.rmi.RemoteException
|
|
removeSessionParms() throws java.rmi.RemoteException
|
|
runRule(String RuleName)
throws java.rmi.RemoteException
|
Runs the named rule within the context of the Object Integration Gateway rules framework. The named rule can access data processed via setTable and setDocument. The named rule can also produce and return XML documents, and so on.
|
runTrans(String transname) throws java.rmi.RemoteException
|
|
runXMLDoc(String docname) throws java.rmi.RemoteException
|
|
setDocument(String docname, String document) throws java.rmi.RemoteException
|
Stages one or more XML documents to be sent to the Gateway on the next run method call.
|
setDocument(String docname, WebRowSet wrs) throws java.rmi.RemoteException
|
Stages one or more XML documents to be sent to the Gateway on the next run method call.
|
setPersistData(java.util.HashMap persistData) throws java.rmi.RemoteException
|
|
setTable(WebRowSet wrs) throws java.sql.SQLException, java.rmi.RemoteException
|
Passes the contents of a WebRowSet object to a TIBCO Object Service Broker data table. The method converts the WebRowSet to an XML document so that when the next Gateway object is invoked, the XML document is sent along with any other parameters and loaded into a TIBCO Object Service Broker data table. Since no table name argument is provided, the data table from which the WebRowSet was created is updated.
|
setTable(WebRowSet wrs, String tablename) throws java.sql.SQLException, java.rmi.RemoteException
|
Passes the contents of a WebRowSet object to a TIBCO Object Service Broker data table. The method converts the WebRowSet to an XML document so that when the next Gateway object is invoked, the XML document is sent along with any other parameters and loaded into a TIBCO Object Service Broker data table. Since a table name argument is provided, the specified data table is updated.
|
setUserData(String userdata) throws java.rmi.RemoteException
|
Sets user data (name-value pairs) passed with run method calls. Multiple name-value pairs must be separated using commas. A value that contains a space character must be enclosed in single quotation marks.
|
setUserData(String name, String value) throws java.rmi.RemoteException
|
Sets user data (name-value pairs) passed with run method calls. Each call to this method adds a name-value pair to the userdata collection passed on the next interaction. There are no restrictions on the naming of user data; the same name can be used multiple times.
|
startTran(boolean update) throws java.rmi.RemoteException
|
Starts a bean-managed transaction that can span multiple interactions. The update parameter controls the mode of the TIBCO Object Service Broker transaction started.
|
stopTran(boolean commit) throws java.rmi.RemoteException
|
Stops a bean-managed transaction with either rollback or commit processing.
|
The home interface exposes methods for creating instances of the EJB component class (your extensions of the Object Integration Gateway base class). When a client makes a call to a create() method of the home interface, the return value is the remote interface of your EJB component class.
The remote interface exposes to the client the methods of your EJB session bean component. These are the methods that actually do the work of your Object Integration Gateway application. The remote interface includes methods to run Gateway objects such as transactions.
The deployment descriptor is an XML document that contains information about the EJB components you want to deploy to your EJB container. It should be packaged at the root of your applicationname-ejb.jar file (where
applicationname is the name of your EJB application).
In the deployment descriptor you specify the JNDI names of your EJB component, home interface, and remote interface classes. You can also specify Object Integration Gateway session initialization parameters, and any other values you want passed to your EJB component.
You use WebRowSet objects to manipulate XML document data as recordsets. The WebRowSet class is an implementation of the javax.sql.RowSet interface. For information about the methods available in WebRowSet objects, refer to
“Methods” on page 61.
Because TIBCO Object Service Broker programmers are accustomed to referencing fields by name, the WebRowSet class is extended to let users get data by column name as well as by column number. If a column label is provided in the XML document definition in the TIBCO Object Service Broker UI (as specified in the Root Name field on the Properties tab), this value, and not the column name, is used for the column label property.
The WebRowSet class supports two XML schema types: MSSCHEMA and ROWSET. MSSCHEMA is the preferred schema type of Microsoft, whereas ROWSET is the preferred schema type of Sun Microsystems. MSSCHEMA is the schema type used by Microsoft’s ADO components to encode recordsets. The ROWSET schema is part of a prerelease of the JDBC 3.0 specification. Neither requires a document type definition for validation.
For various reasons, one schema outperforms the other in certain circumstances. You should experiment to determine which schema type best suits your application needs.
Because the WebRowSet object is a completely disconnected recordset, modifications to its data are done without a transactional context. No locks are held, and the data is not guaranteed to remain unchanged while the rowset travels between various servers. It is up to the application programmer to use these disconnected recordsets in such a manner that data integrity is maintained.
A recordset can be created using a wide variety of data sources. You can then use the recordset to populate a WebRowSet object, and send the WebRowSet to the Object Integration Gateway to update a table. Sending data to the Gateway from external data sources is not a supported feature but it should work correctly as long as a compatible table definition can be created. This technique has risks that you need to be aware of:
This section presents code for a sample Object Integration Gateway EJB component class, its home and remote interfaces, and its deployment descriptor file.
The following is sample code for the home interface class. The create () methods of the home interface return an instance of the EJB component’s remote interface to the client.
The following is sample code for the remote interface class. The methods exposed in the remote interface must match the methods of the EJB component class. A client call to a remote interface method is executed by the corresponding method of the EJB component.