com.bea.wlai.client
Class ApplicationView

java.lang.Object
  extended by com.bea.wlai.client.ApplicationView

public class ApplicationView
extends Object

An ApplicationView represents a subset of business functionality available within a Enterprise Information System (EIS). It accepts requests for service invocation from its client, and invokes the proper system functions within the target EIS. An ApplicationView makes use of connections provided by a resource adapter to communicate with the EIS.

A service is a named business function and is NOT the same as a system function within an EIS. The ApplicationView manages the mapping from service name to system function. Services expose a simple XML-based request/response interface. Services are self-describing in that they can return an IDocumentDefinition object for request and response document types that describe the structure and content required for the document type.

An ApplicationView uses an instance of ApplicationViewRemote which is the remote interface to a session EJB. The session EJB is deployed at ApplicationView deployment time. The ApplicationView can be deployed at WebLogic Server startup, just as any other EJB is, or can be deployed during the steady-state runtime of the server (again as any EJB).

The deployment of an Application View places metadata about the services and events for the Application View into a runtime metadata repository. This repository allows efficient execution of services and events at runtime.

The mapping from service to interaction is made possible by this metadata. It includes information about the service's name, and the system function associated with the service. It also stores some (or all) of the data needed to successfully invoke the system function. As a result, the service can require less request data from the invoker of the service, because the ApplicationView can augment the data passed by the invoker with the stored metadata. This is a convenient way to hide the complexity of the underlying system function invocation from the invoker of a service, and comprises much of the power and added value of the ApplicationView.

The following is an example of the use of an ApplicationView...

  // Connect to WebLogic

  Hashtable env = new Hashtable();
  env.put(Context.INITIAL_CONTEXT_FACTORY,
          "weblogic.jndi.WLInitialContextFactory");
  env.put(Context.PROVIDER_URL, "t3://localhost:7001");
  env.put(Context.SECURITY_PRINCIPAL, "bob");
  env.put(Context.SECURITY_CREDENTIALS, "bobspassword");

  InitialContext ctx = new InitialContext(env);

  // Create an ApplicationView using a name that has already been
  // deployed into the server we just connected to

  ApplicationView appView = new ApplicationView(ctx, "DBMSAppView1");

  // Create a request document using the definition stored for this
  // Application View at deployment time.

  IDocumentDefinition rd = appView.getRequestDocumentDefinition();
  IDocument request = rd.createDefaultDocument();

  // Fill in the request with some data.  What you fill in depends on
  // the definition of the request document (i.e. its schema)

  request.setStringInFirst("SomeElement", "SomeData");

  // Invoke the service and retrieve the response document

  IDocument response = appView.invokeService("GetSomeData", request);

  // Dump the response document out as XML

  System.out.println("GetSomeData: " + response.toXML());
 
In the example above, it would require that an Application View named 'DBMSAppView1' had been deployed into the server at 'localhost:7001' and that this Application View contained the service named 'GetSomeData'. In addition, the document types for request/response must have been created and stored into the schema repository prior to invoking the service.


Constructor Summary
ApplicationView(Context context, QualifiedName appViewName)
          Create a new ApplicationView with the given name, within the global AI application, and using a new InitialContext obtained using the given Hashtable of properties.
ApplicationView(Context context, QualifiedName appViewName, String strDurableClientID)
          Creates an application view instance with a specific client ID within the global AI application.
ApplicationView(Context context, String appViewNameStr)
          Create a new ApplicationView with the given name, within the global AI application, and using a new InitialContext obtained using the given Hashtable of properties.
ApplicationView(Context context, String appName, QualifiedName appViewName)
          Creates an application view instance within the given J2EE application.
ApplicationView(Context context, String appName, QualifiedName appViewName, String strDurableClientID)
          Creates an application view instance with a specific client ID within the given J2EE application.
ApplicationView(Context context, String appViewNameStr, String strDurableClientID)
          Creates an application view instance with a specific client ID within the global AI application.
ApplicationView(Context context, String appName, String appViewNameStr, String strDurableClientID)
          Creates an application view instance with a specific client ID within the given J2EE application.
ApplicationView(Hashtable props, QualifiedName appViewName)
          Create a new ApplicationView with the given name, within the global AI application, and using a new InitialContext obtained using the given Hashtable of properties.
ApplicationView(Hashtable props, QualifiedName appViewName, String strDurableClientID)
          Creates an application view instance with a specific client ID within the global AI application.
 
Method Summary
 void addEventListener(String eventTypeName, EventListener listener)
          Add a listener for events with type given by eventTypeName.
 void addEventListener(String eventTypeName, EventListener listener, String uniqueID)
          Add a listener for events with type given by eventTypeName.
 void beginLocalTransaction()
          Begins a local transaction.
 void close()
          Free any resources being held by this ApplicationView instance.
 void commitLocalTransaction()
          Commits a local transaction and closes allocated resources.
 String getApplicationName()
          Get the application name in use by this ApplicationView instance
 javax.resource.cci.ConnectionSpec getConnectionSpec()
          Returns the ConnectionSpec being used by the ApplicationView to connect to the EIS.
 EventContext getEventContext()
          Get an EventContext for posting/listening for events on this ApplicationView.
 EventContext getEventContext(boolean release)
          Get an EventContext for posting/listening for events on this ApplicationView, possibly releasing ownership of the EventContext to the caller.
 IEventDefinition getEventDefinition(String eventType)
          Get IEventDefinition for the given event type.
 Context getInitialContext()
          Return the InitialContext object representing the connection to the JNDI tree in WLS/WLAI.
 String getInstanceID()
          Returns the unique instance ID for this instance.
 String getName()
          Get this ApplicationView's name.
 boolean getNamespaceEnforcementEnabled()
          Is namespace enforcement enabled?
 QualifiedName getQualifiedName()
          Get this ApplicationView's qualified name
 IDocumentDefinition getRequestDocumentDefinition(String serviceName)
          Get request DocumentDefinition for the given service.
 IDocumentDefinition getResponseDocumentDefinition(String serviceName)
          Get response IDocumentDefinition for the given service.
 IVariableSet getVariableSet()
          Get the variable set that is in force for this deployed application view, or null if no variables have been set.
 boolean inLocalTransaction()
          Returns true if the Application View is stateful and a LocalTransaction is in effect.
 IDocument invokeService(String serviceName, IDocument request)
          Synchronously invoke the service with the given name, using the request document given.
 IDocument invokeService(String serviceName, IDocument request, boolean autoCreateResponse)
          Synchronously invoke the service with the given name, using the request document given.
 String invokeServiceAsync(String serviceName, IDocument request, AsyncServiceResponseListener listener)
          Asynchronously invoke the service with the given name, and notify the given listener when the response is available.
 String invokeServiceAsync(String serviceName, IDocument request, Map jmsPropertyMap, Serializable userObject)
          Asynchronously invoke the service with the given name, and place the response on the default response JMS queue when the response is available.
 IDocument invokeServiceInternal(String serviceName, IDocument request, boolean autoCreateResponse, boolean isAsync)
          Internal invokeService method for use by AsyncRequestProcessor, allowing it to indicate this should be counted as an async request internally.
 String[] listEventTypes()
          List the events this ApplicationView is capable of delivering, and thus the events which may be listened for using addEventListener().
 String[] listServiceNames()
          List service names deployed for this ApplicationView.
 void postEvent(IEvent event)
          Post the given event to this ApplicationView, thus notifying any listeners listening on this ApplicationView for events with the type of the given event.
 void recoverAsyncServiceResponses(AsyncServiceResponseListener listener)
          Register a listener for responses that may have been queued while the client application was offline.
 void removeEventListener(String eventType, EventListener listener)
          Remove the given listener from the subscription list for events with type given by eventTypeName.
 void rollbackLocalTransaction()
          Rollsback a local transaction.
 void setConnectionSpec(javax.resource.cci.ConnectionSpec connectionCriteria)
          Sets the connectionSpec for connections made to the EIS.
 void setNamespaceEnforcementEnabled(boolean newValue)
          Indicate that the client requires response IDocument instances and IEvent instances to declare the namespace indicated in the response/event definitions, and force the proper namespace declaration onto the response/event if needed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationView

public ApplicationView(Hashtable props,
                       QualifiedName appViewName)
                throws NamingException,
                       javax.ejb.CreateException,
                       RemoteException
Create a new ApplicationView with the given name, within the global AI application, and using a new InitialContext obtained using the given Hashtable of properties. This constructor creates a unique instance ID for the client. This ID will be used to create durable event listeners and correlate asynchronous requests and responses. The ID is accessible via the getInstanceID method.

Parameters:
props - - JNDI context properties
appViewName - - qualified application view name.
Throws:
NamingException - If the attempt to create an InitialContext fails. or the ApplicationViewHome interface cannot be found in JNDI.
javax.ejb.CreateException - If the attempt to create an ApplicationViewRemote interface fails.
RemoteException - If an RMI communication failure occurs.

ApplicationView

public ApplicationView(Context context,
                       QualifiedName appViewName)
                throws NamingException,
                       javax.ejb.CreateException,
                       RemoteException
Create a new ApplicationView with the given name, within the global AI application, and using a new InitialContext obtained using the given Hashtable of properties. This constructor creates a unique instance ID for the client. This ID will be used to create durable event listeners and correlate asynchronous requests and responses. The ID is accessible via the getInstanceID method.

Parameters:
context - - JNDI context
appViewName - - qualified application view name.
Throws:
NamingException - If the attempt to create an InitialContext fails. or the ApplicationViewHome interface cannot be found in JNDI.
javax.ejb.CreateException - If the attempt to create an ApplicationViewRemote interface fails.
RemoteException - If an RMI communication failure occurs.

ApplicationView

public ApplicationView(Hashtable props,
                       QualifiedName appViewName,
                       String strDurableClientID)
                throws NamingException,
                       javax.ejb.CreateException,
                       RemoteException,
                       IllegalArgumentException
Creates an application view instance with a specific client ID within the global AI application. The ID is used to establish durable event listeners for events generated by this application view. The client application should be able to reproduce this value if it becomes in-active/active. In addition, if using asynchronous services and it is essential to retrieve all asynchronous responses, clients should provide a reproduceable client ID in case their client application fails.

Parameters:
props - - JNDI context properties
appViewName - - qualified application view name
strDurableClientID - - a valid durable client ID; this value should be a valid Java identifier. If the value is null, this class will generate one internally; it can be accessed with the getInstanceID method.
Throws:
NamingException - If the ApplicationViewHome interface cannot be found in JNDI.
javax.ejb.CreateException - If the attempt to create an ApplicationViewRemote interface fails.
RemoteException - If an RMI communication failure occurs.
IllegalArgumentException - if the argument is not a valid durable client ID.

ApplicationView

public ApplicationView(Context context,
                       String appViewNameStr)
                throws NamingException,
                       javax.ejb.CreateException,
                       RemoteException
Create a new ApplicationView with the given name, within the global AI application, and using a new InitialContext obtained using the given Hashtable of properties. This constructor creates a unique instance ID for the client. This ID will be used to create durable event listeners and correlate asynchronous requests and responses. The ID is accessible via the getInstanceID method.

Parameters:
context - - JNDI context
appViewNameStr - - String representation of the Application View's qualified name.
Throws:
NamingException - If the attempt to create an InitialContext fails. or the ApplicationViewHome interface cannot be found in JNDI.
javax.ejb.CreateException - If the attempt to create an ApplicationViewRemote interface fails.
RemoteException - If an RMI communication failure occurs.

ApplicationView

public ApplicationView(Context context,
                       String appViewNameStr,
                       String strDurableClientID)
                throws NamingException,
                       javax.ejb.CreateException,
                       RemoteException,
                       IllegalArgumentException
Creates an application view instance with a specific client ID within the global AI application. The ID is used to establish durable event listeners for events generated by this application view. The client application should be able to reproduce this value if it becomes in-active/active. The application name that will be used for this ApplicationView instance is the value given by the GLOBAL_APP_NAME field of this class.

Parameters:
context - - JNDI context
appViewNameStr - - String representation of the Application View's qualified name.
strDurableClientID - - a valid durable client ID; this value should be a valid Java identifier. If the value is null, this class will generate one internally; it can be accessed with the getInstanceID method.
Throws:
NamingException - If the ApplicationViewHome interface cannot be found in JNDI.
javax.ejb.CreateException - If the attempt to create an ApplicationViewRemote interface fails.
RemoteException - If an RMI communication failure occurs.
IllegalArgumentException - if the argument is not a valid durable client ID.

ApplicationView

public ApplicationView(Context context,
                       String appName,
                       String appViewNameStr,
                       String strDurableClientID)
                throws NamingException,
                       javax.ejb.CreateException,
                       RemoteException,
                       IllegalArgumentException
Creates an application view instance with a specific client ID within the given J2EE application. The ID is used to establish durable event listeners for events generated by this application view. The client application should be able to reproduce this value if it becomes in-active/active.

Parameters:
context - - JNDI context
appName - - The name of the J2EE Application that contains the ApplicationView given by appViewNameStr. This application might be a BEA Platform application or a custom app.
appViewNameStr - - String representation of the Application View's qualified name.
strDurableClientID - - a valid durable client ID; this value should be a valid Java identifier. If the value is null, this class will generate one internally; it can be accessed with the getInstanceID method.
Throws:
NamingException - If the ApplicationViewHome interface cannot be found in JNDI.
javax.ejb.CreateException - If the attempt to create an ApplicationViewRemote interface fails.
RemoteException - If an RMI communication failure occurs.
IllegalArgumentException - if the argument is not a valid durable client ID.

ApplicationView

public ApplicationView(Context context,
                       QualifiedName appViewName,
                       String strDurableClientID)
                throws NamingException,
                       javax.ejb.CreateException,
                       RemoteException
Creates an application view instance with a specific client ID within the global AI application. The ID is used to establish durable event listeners for events generated by this application view. The client application should be able to reproduce this value if it becomes in-active/active.

Parameters:
context - - JNDI context
appViewName - - qualified application view name
strDurableClientID - - a valid durable client ID; this value should be a valid Java identifier. If the value is null, this class will generate one internally; it can be accessed with the getInstanceID method.
Throws:
NamingException - If the ApplicationViewHome interface cannot be found in JNDI.
javax.ejb.CreateException - If the attempt to create an ApplicationViewRemote interface fails.
RemoteException - If an RMI communication failure occurs.

ApplicationView

public ApplicationView(Context context,
                       String appName,
                       QualifiedName appViewName)
                throws NamingException,
                       javax.ejb.CreateException,
                       RemoteException
Creates an application view instance within the given J2EE application.

Parameters:
context - - JNDI context
appName - - The name of the J2EE Application that contains the ApplicationView given by appViewNameStr. This application might be a BEA Platform application or a custom app.
appViewName - - qualified application view name
Throws:
NamingException - If the ApplicationViewHome interface cannot be found in JNDI.
javax.ejb.CreateException - If the attempt to create an ApplicationViewRemote interface fails.
RemoteException - If an RMI communication failure occurs.

ApplicationView

public ApplicationView(Context context,
                       String appName,
                       QualifiedName appViewName,
                       String strDurableClientID)
                throws NamingException,
                       javax.ejb.CreateException,
                       RemoteException
Creates an application view instance with a specific client ID within the given J2EE application. The ID is used to establish durable event listeners for events generated by this application view. The client application should be able to reproduce this value if it becomes in-active/active.

Parameters:
context - - JNDI context
appName - - The name of the J2EE Application that contains the ApplicationView given by appViewNameStr. This application might be a BEA Platform application or a custom app.
appViewName - - qualified application view name
strDurableClientID - - a valid durable client ID; this value should be a valid Java identifier. If the value is null, this class will generate one internally; it can be accessed with the getInstanceID method.
Throws:
NamingException - If the ApplicationViewHome interface cannot be found in JNDI.
javax.ejb.CreateException - If the attempt to create an ApplicationViewRemote interface fails.
RemoteException - If an RMI communication failure occurs.
Method Detail

getInstanceID

public String getInstanceID()
Returns the unique instance ID for this instance.

Returns:
String ID for this instance; never null

getApplicationName

public String getApplicationName()
Get the application name in use by this ApplicationView instance


getName

public String getName()
Get this ApplicationView's name.


getQualifiedName

public QualifiedName getQualifiedName()
Get this ApplicationView's qualified name


listServiceNames

public String[] listServiceNames()
                          throws ApplicationViewException,
                                 RemoteException
List service names deployed for this ApplicationView.

Throws:
ApplicationViewException - If the appViewName or needed ApplicationView metadata cannot be found.
RemoteException - If an RMI communication failure occurs.

listEventTypes

public String[] listEventTypes()
                        throws ApplicationViewException,
                               RemoteException
List the events this ApplicationView is capable of delivering, and thus the events which may be listened for using addEventListener().

Throws:
ApplicationViewException - If the appViewName or needed ApplicationView metadata cannot be found.
RemoteException - If an RMI communication failure occurs.
See Also:
addEventListener

getRequestDocumentDefinition

public IDocumentDefinition getRequestDocumentDefinition(String serviceName)
                                                 throws ApplicationViewException,
                                                        RemoteException
Get request DocumentDefinition for the given service. If the schema for the document type cannot be found, null is returned.

Throws:
ApplicationViewException - If the schema repository cannot be found; the attempt to transport or manipulate the document type's schema fails; the document type's schema text, as stored in the schema repository, cannot be parsed; there is a read error while reading the document type's schema; the lookup of the document type fails; the creation of a SchemaManager remote interface fails; or the serviceName is not defined for this ApplicationView.
RemoteException - If an RMI communication failure occurs.

getResponseDocumentDefinition

public IDocumentDefinition getResponseDocumentDefinition(String serviceName)
                                                  throws ApplicationViewException,
                                                         RemoteException
Get response IDocumentDefinition for the given service. If the schema for the document type cannot be found, null is returned.

Throws:
ApplicationViewException - If the schema repository cannot be found; the attempt to transport or manipulate the document type's schema fails; the document type's schema text, as stored in the schema repository, cannot be parsed; there is a read error while reading the document type's schema; the lookup of the document type fails; the creation of a SchemaManager remote interface fails; or the serviceName is not defined for this ApplicationView.
RemoteException - If an RMI communication failure occurs.

setNamespaceEnforcementEnabled

public void setNamespaceEnforcementEnabled(boolean newValue)
                                    throws RemoteException
Indicate that the client requires response IDocument instances and IEvent instances to declare the namespace indicated in the response/event definitions, and force the proper namespace declaration onto the response/event if needed. Some legacy adapters do not provide responses/events using the namespace declared in the response/event schema This option allows clients that perform schema-based XML checking to use such adapters. This option is disabled by default, because it can have serious performance implications for adapters that return their responses/events as raw XML text (not parsed). In this case, this option will force a parse of the XML text in order to inject the proper namespace declaration.

Throws:
RemoteException - If an RMI communication failure occurs.

getNamespaceEnforcementEnabled

public boolean getNamespaceEnforcementEnabled()
Is namespace enforcement enabled?


getEventDefinition

public IEventDefinition getEventDefinition(String eventType)
                                    throws ApplicationViewException,
                                           RemoteException
Get IEventDefinition for the given event type. If the schema for the event type cannot be found, null is returned.

Throws:
ApplicationViewException - If the schema repository cannot be found; the attempt to transport or manipulate the event type's schema fails; the event type's schema text, as stored in the schema repository, cannot be parsed; or there is a read error while reading the event type's schema.
RemoteException - If an RMI communication failure occurs.

getVariableSet

public IVariableSet getVariableSet()
                            throws ApplicationViewException,
                                   RemoteException
Get the variable set that is in force for this deployed application view, or null if no variables have been set.

Throws:
ApplicationViewException - If any error occurs accessing deployment information for this application view.
RemoteException - If an RMI communication failure occurs.

inLocalTransaction

public boolean inLocalTransaction()
                           throws RemoteException,
                                  javax.resource.ResourceException
Returns true if the Application View is stateful and a LocalTransaction is in effect.

Throws:
RemoteException - If an RMI communication failure occurs.
javax.resource.ResourceException - if called while no transaction is in effect

beginLocalTransaction

public void beginLocalTransaction()
                           throws javax.resource.ResourceException,
                                  RemoteException
Begins a local transaction. The method beginLocalTransaction will acquire a connection using the connection spec passed. This connection is not closed until the client calls commit or rollback, or if the bean is passivated.

Throws:
RemoteException - If an RMI communication failure occurs.
javax.resource.ResourceException - if a transaction is already in effect. Linked - NotSupportedException if called against a stateless session Linked - ConnectionAquisitionException is a connection cannot be acquired Linked - TransactionException if the call to beginTransaction fails.

commitLocalTransaction

public void commitLocalTransaction()
                            throws javax.resource.ResourceException,
                                   RemoteException
Commits a local transaction and closes allocated resources. Commit will throw an Exception if a transaction has not already been started.

Throws:
RemoteException - If an RMI communication failure occurs.
javax.resource.ResourceException - if a transaction has not been started. Linked - NotSupportedException if called while no transaction in effect Linked - TransactionTimeoutException when the bean has been passivated and re-activated Linked - TransactionException if the call to rollback fails.

rollbackLocalTransaction

public void rollbackLocalTransaction()
                              throws javax.resource.ResourceException,
                                     RemoteException
Rollsback a local transaction.

Throws:
RemoteException - If an RMI communication failure occurs.
javax.resource.ResourceException - if a transaction has not been started. Linked - NotSupportedException if called while no transaction is in effect Linked - TransactionTimeoutException when the bean has been passivated and re-activated Linked - TransactionException if the call to rollback fails.

invokeService

public IDocument invokeService(String serviceName,
                               IDocument request)
                        throws ApplicationViewSuspendedException,
                               ApplicationViewException,
                               DocumentException,
                               javax.resource.ResourceException,
                               TransactionTimeoutException,
                               RemoteException
Synchronously invoke the service with the given name, using the request document given. This method is equivalent to calling invokeService(String, IDocument, boolean) with autoCreateResponse false.

The request document should conform to the document definition given by getRequestDocumentDefinition. The response document will conform to the document definition given by getResponseDocumentDefinition.

Throws:
ApplicationViewException - If the service or other resources needed by this method cannot be found in the metadata for this ApplicationView.
DocumentException - If there is an error processing the request or response document.
javax.resource.ResourceException - If there is an error obtaining a connection from the connection factory, or there is some other adapter related error.
RemoteException - If an RMI communication failure occurs.
ApplicationViewSuspendedException
TransactionTimeoutException
See Also:
getRequestDocumentDefinition(String), getResponseDocumentDefinition(String)

invokeService

public IDocument invokeService(String serviceName,
                               IDocument request,
                               boolean autoCreateResponse)
                        throws ApplicationViewSuspendedException,
                               ApplicationViewException,
                               DocumentException,
                               javax.resource.ResourceException,
                               TransactionTimeoutException,
                               RemoteException
Synchronously invoke the service with the given name, using the request document given. If autoCreateResponse is true, this method will attempt to create a default document according to the response document definition, if possible, and pass this to the underlying Interaction. If auto creation fails, the Interaction is allowed to create the response on its own.

The request document should conform to the document definition given by getRequestDocumentDefinition. The response document will conform to the document definition given by getResponseDocumentDefinition.

Throws:
ApplicationViewException - If the service or other resources needed by this method cannot be found in the metadata for this ApplicationView.
DocumentException - If there is an error processing the request or response document.
javax.resource.ResourceException - If there is an error obtaining a connection from the connection factory, or there is some other adapter related error.
RemoteException - If an RMI communication failure occurs.
ApplicationViewSuspendedException
TransactionTimeoutException
See Also:
getRequestDocumentDefinition(String), getResponseDocumentDefinition(String)

invokeServiceInternal

public IDocument invokeServiceInternal(String serviceName,
                                       IDocument request,
                                       boolean autoCreateResponse,
                                       boolean isAsync)
                                throws ApplicationViewSuspendedException,
                                       ApplicationViewException,
                                       DocumentException,
                                       javax.resource.ResourceException,
                                       TransactionTimeoutException,
                                       RemoteException
Internal invokeService method for use by AsyncRequestProcessor, allowing it to indicate this should be counted as an async request internally.

Throws:
ApplicationViewSuspendedException
ApplicationViewException
DocumentException
javax.resource.ResourceException
TransactionTimeoutException
RemoteException

invokeServiceAsync

public String invokeServiceAsync(String serviceName,
                                 IDocument request,
                                 AsyncServiceResponseListener listener)
                          throws ApplicationViewException,
                                 RemoteException
Asynchronously invoke the service with the given name, and notify the given listener when the response is available. The return value is the ID assigned to this invocation request by the server. The given listener will be notified when the response is available, and will receive a AsyncServiceResponse object containing the request ID, response document, and other information.

If errors occur during the processing of an asyncronous service request, the error message is stored into the AsyncServiceResponse object. Users should check the hasError() method of the response to determine if an error has occurred before attempting to process the response document.

The request document should conform to the document definition given by getRequestDocumentDefinition. The response document will conform to the document definition given by getResponseDocumentDefinition.

Throws:
ApplicationViewException - if async messaging couldn't be initialized, or request/response async message queues couldn't be found.
RemoteException - If an RMI communication failure occurs.
See Also:
getRequestDocumentDefinition(String), getResponseDocumentDefinition(String), AsyncServiceResponse

invokeServiceAsync

public String invokeServiceAsync(String serviceName,
                                 IDocument request,
                                 Map jmsPropertyMap,
                                 Serializable userObject)
                          throws ApplicationViewException,
                                 RemoteException
Asynchronously invoke the service with the given name, and place the response on the default response JMS queue when the response is available. The return value is the ID assigned to this invocation request by the server. The response JMS queue will be receive a message when the response is available, and will receive a AsyncServiceResponse object containing the request ID, response document, and other information.

Optionally, the caller can provide a map of JMS property name/value pairs. The name/value pairs must use a String for both name and value. This method will set the desired JMS properties into the async service response message that is posted to the response queue. If this feature is not required, pass jmsPropertyMap null.

Also optionally, the caller can provide a Serializable user object instance to propagate additionaly non-JMS context between the async request and response. Any user object passed to this call will be present on the response returned after the service invocation has been completed. This is the case even in the event of an error invoking the service. If no additional context is required, pass the user object as null.

If errors occur during the processing of an asyncronous service request, the error message is stored into the AsyncServiceResponse object. Users should check the hasError() method of the response to determine if an error has occurred before attempting to process the response document.

The request document should conform to the document definition given by getRequestDocumentDefinition. The response document will conform to the document definition given by getResponseDocumentDefinition.

Throws:
ApplicationViewException - if async messaging couldn't be initialized, or request/response async message queues couldn't be found.
RemoteException - If an RMI communication failure occurs.
See Also:
getRequestDocumentDefinition(String), getResponseDocumentDefinition(String), AsyncServiceResponse

getEventContext

public EventContext getEventContext()
                             throws ApplicationViewException,
                                    EventContextException
Get an EventContext for posting/listening for events on this ApplicationView. It is recommended that you use the convenience methods addEventListener, removeEventListener, and postEvent instead of this method and the EventContext.

Throws:
ApplicationViewException - If the event destination metadata needed by this method cannot be found.
EventContextException - If the underlying event transport layer cannot be initialized.

getEventContext

public EventContext getEventContext(boolean release)
                             throws ApplicationViewException,
                                    EventContextException
Get an EventContext for posting/listening for events on this ApplicationView, possibly releasing ownership of the EventContext to the caller. It is recommended that you use the convenience methods addEventListener, removeEventListener, and postEvent instead of this method and the EventContext.

Parameters:
release - If true, responsibility for closing the EventContext will be given to the caller. This app view instance will no longer hold a reference to the EventContext.
Throws:
ApplicationViewException - If the event destination metadata needed by this method cannot be found.
EventContextException - If the underlying event transport layer cannot be initialized.

getInitialContext

public Context getInitialContext()
Return the InitialContext object representing the connection to the JNDI tree in WLS/WLAI.


addEventListener

public void addEventListener(String eventTypeName,
                             EventListener listener)
                      throws ApplicationViewException,
                             EventContextException
Add a listener for events with type given by eventTypeName. The event type that is being listened for must be present in the list returned by listEventTypes(). Otherwise, no event will ever be delivered to the listener, but no exception is thrown.

Throws:
ApplicationViewException - If the event destination metadata needed by this method cannot be found.
EventContextException - If the underlying event transport layer cannot be initialized.
See Also:
listEventTypes

addEventListener

public void addEventListener(String eventTypeName,
                             EventListener listener,
                             String uniqueID)
                      throws ApplicationViewException,
                             EventContextException
Add a listener for events with type given by eventTypeName. The event type that is being listened for must be present in the list returned by listEventTypes(). Otherwise, no event will ever be delivered to the listener, but no exception is thrown. Using a non-null uniqueID implies a Durable Listener.

Throws:
ApplicationViewException - If the event destination metadata needed by this method cannot be found.
EventContextException - If the underlying event transport layer cannot be initialized.
See Also:
listEventTypes

removeEventListener

public void removeEventListener(String eventType,
                                EventListener listener)
                         throws ApplicationViewException,
                                EventContextException
Remove the given listener from the subscription list for events with type given by eventTypeName.

Throws:
ApplicationViewException - If the event destination metadata needed by this method cannot be found.
EventContextException - If the underlying event transport layer cannot be initialized.

postEvent

public void postEvent(IEvent event)
               throws ApplicationViewException,
                      EventContextException,
                      DocumentException
Post the given event to this ApplicationView, thus notifying any listeners listening on this ApplicationView for events with the type of the given event. Note that any listener that has been added to any ApplicationView object with the name given by getName() will be notified, not just those listeners that have been added to this ApplicationView object.

Throws:
ApplicationViewException - If the event destination metadata needed by this method cannot be found.
EventContextException - If the underlying event transport layer cannot be initialized.
DocumentException - If an error occurs while manipulating the event.

recoverAsyncServiceResponses

public void recoverAsyncServiceResponses(AsyncServiceResponseListener listener)
                                  throws ApplicationViewException
Register a listener for responses that may have been queued while the client application was offline. This method is useful for retrieving responses if the client application fails before it receives all of its async responses. This method should be called immediately after construction and will only be able to receive responses if the same durable client ID is used.

Throws:
ApplicationViewException

close

public void close()
           throws ApplicationViewException
Free any resources being held by this ApplicationView instance. The state will always be closed regardless of the outcome of this method.

Throws:
ApplicationViewException

setConnectionSpec

public void setConnectionSpec(javax.resource.cci.ConnectionSpec connectionCriteria)
Sets the connectionSpec for connections made to the EIS. After the ConnectionSpec is set it will be used to make connections to the EIS when invoking a service. To clear the connection spec, and use the default connection parameters, call this method using null. *

Parameters:
connectionCriteria - connection criteria for the EIS.

getConnectionSpec

public javax.resource.cci.ConnectionSpec getConnectionSpec()
Returns the ConnectionSpec being used by the ApplicationView to connect to the EIS.

Returns:
ConnectionSpec