This topic defines the base interface for all Application View controls.
package com.bea.wlai.control; import com.bea.control.XMLControl; /** * ApplicationView Control base interface */ public interface ApplicationViewControl extends XMLControl { // ------------------------- // Local transaction methods // ------------------------- public void beginLocalTransaction() throws Exception; public void commitLocalTransaction() throws Exception;
public void rollbackLocalTransaction() throws Exception;
// ------------------------- // Async methods // ------------------------- public boolean isAsyncRequestActive(); public String getActiveAsyncRequestID(); public interface Callback }
The methods of this interface may be invoked by any web service or business process with an Application View control instance.
The local transaction methods are not used in a container that controls transactions, such as the process container for WebLogic Integration or the web service container for WebLogic Workshop. This is because the WebLogic Server Transaction Manager (TM) automatically enlists any local resource (a maximum of one) into the active XA transaction. Thus, using application views and adapters that support only local transactions appears the same as using application views and adapters that support XA transactions.
You can have only one local-only resource in the transaction. The business process designer must ensure that only one local resource gets enlisted anywhere within a given set of explicit transaction tags (or the implicit outer transaction tags if none are given explicitly). If a second local-only resource is required, you must separate the first and second resources across transaction tags in the process definition language.
For containers that do not control the outer XA transaction (for example, a WebLogic Portal page group), you can use the local transaction methods. However, you can also start an XA transaction using the javax.transaction.UserTransaction interface, and allow the WebLogic Server Transaction Manager to automatically enlist the local resource.
Note: Any asynchronous service for the JCX is represented as a callback on the JCX. This allows the extension of the base control for callbacks. Asynchronous response callbacks use the XML type to represent the response document.
The following code shows an example of a sub-classed control. This code is automatically created by the control wizard.
package FunctionDemo; import weblogic.jws.*; import com.bea.wlai.control.ApplicationViewControl; import com.bea.xml.XmlObject; /** * This ApplicationView provides some simple services to * create/get/update customers in the sample CUSTOMER_TABLE table. * It also defines an event * indicating a customer record has been updated. * @jc:av-identity name="FunctionDemo.CustomerMgmt" * app="sampleApp" */ public interface CustomerMgmtAppView extends com.bea.control.ControlExtension, ApplicationViewControl {
/** * Get a customer record given first and last name. * @jc:av-service name="GetCustomer" async="false" */ public wlai.functionDemo. customerMgmtGetCustomerResponse.RowsDocument GetCustomer(wlai.functionDemo.customerMgmtGetCustomerRequest. InputDocument request) throws Exception;
/** * Update the customer's email address. * @jc:av-service name="UpdateCustomer" async="false" */
public wlai.functionDemo.customerMgmtUpdateCustomerResponse. RowsAffectedDocument UpdateCustomer(wlai.functionDemo. customerMgmtUpdateCustomerRequest.InputDocument request) throws Exception;
/** * Select all customers in the customer table. * @jc:av-service name="GetAllCustomers" async="true" */ public void GetAllCustomers() throws Exception;
/** * Create a new customer given first and last name, * and date of birth. * @jc:av-service name="CreateCustomer" async="false" */ public wlai.functionDemo. customerMgmtCreateCustomerResponse.RowsAffectedDocument CreateCustomer(wlai.functionDemo. customerMgmtCreateCustomerRequest.InputDocument request) throws Exception;
public interface Callback extends ApplicationViewControl.Callback
{
/** * Async response callback method for * GetAllCustomers service. */ public void onGetAllCustomersResponse(wlai.functionDemo. customerMgmtGetAllCustomersResponse.RowsDocument response);
/** * Callback to handle errors with async service requests. * Note that only one async request can be in flight * for a given control instance at any given time. * * @param errorMsg * The error message text for the failed async request. */ public void onAsyncServiceError(String errorMsg); } }