|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bea.wlai.client.ApplicationView
public class ApplicationView
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 |
---|
public ApplicationView(Hashtable props, QualifiedName appViewName) throws NamingException, javax.ejb.CreateException, RemoteException
getInstanceID
method.
props
- - JNDI context propertiesappViewName
- - qualified application view name.
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.public ApplicationView(Context context, QualifiedName appViewName) throws NamingException, javax.ejb.CreateException, RemoteException
getInstanceID
method.
context
- - JNDI contextappViewName
- - qualified application view name.
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.public ApplicationView(Hashtable props, QualifiedName appViewName, String strDurableClientID) throws NamingException, javax.ejb.CreateException, RemoteException, IllegalArgumentException
props
- - JNDI context propertiesappViewName
- - qualified application view namestrDurableClientID
- - 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.
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.public ApplicationView(Context context, String appViewNameStr) throws NamingException, javax.ejb.CreateException, RemoteException
getInstanceID
method.
context
- - JNDI contextappViewNameStr
- - String representation of the Application View's
qualified name.
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.public ApplicationView(Context context, String appViewNameStr, String strDurableClientID) throws NamingException, javax.ejb.CreateException, RemoteException, IllegalArgumentException
context
- - JNDI contextappViewNameStr
- - 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.
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.public ApplicationView(Context context, String appName, String appViewNameStr, String strDurableClientID) throws NamingException, javax.ejb.CreateException, RemoteException, IllegalArgumentException
context
- - JNDI contextappName
- - 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.
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.public ApplicationView(Context context, QualifiedName appViewName, String strDurableClientID) throws NamingException, javax.ejb.CreateException, RemoteException
context
- - JNDI contextappViewName
- - qualified application view namestrDurableClientID
- - 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.
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.public ApplicationView(Context context, String appName, QualifiedName appViewName) throws NamingException, javax.ejb.CreateException, RemoteException
context
- - JNDI contextappName
- - 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
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.public ApplicationView(Context context, String appName, QualifiedName appViewName, String strDurableClientID) throws NamingException, javax.ejb.CreateException, RemoteException
context
- - JNDI contextappName
- - 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 namestrDurableClientID
- - 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.
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 |
---|
public String getInstanceID()
public String getApplicationName()
public String getName()
public QualifiedName getQualifiedName()
public String[] listServiceNames() throws ApplicationViewException, RemoteException
ApplicationViewException
- If the appViewName or needed
ApplicationView metadata cannot be found.
RemoteException
- If an RMI communication failure occurs.public String[] listEventTypes() throws ApplicationViewException, RemoteException
ApplicationViewException
- If the appViewName or needed
ApplicationView metadata cannot be found.
RemoteException
- If an RMI communication failure occurs.addEventListener
public IDocumentDefinition getRequestDocumentDefinition(String serviceName) throws ApplicationViewException, RemoteException
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.public IDocumentDefinition getResponseDocumentDefinition(String serviceName) throws ApplicationViewException, RemoteException
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.public void setNamespaceEnforcementEnabled(boolean newValue) throws RemoteException
RemoteException
- If an RMI communication failure occurs.public boolean getNamespaceEnforcementEnabled()
public IEventDefinition getEventDefinition(String eventType) throws ApplicationViewException, RemoteException
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.public IVariableSet getVariableSet() throws ApplicationViewException, RemoteException
ApplicationViewException
- If any error occurs accessing deployment
information for this application view.
RemoteException
- If an RMI communication failure occurs.public boolean inLocalTransaction() throws RemoteException, javax.resource.ResourceException
RemoteException
- If an RMI communication failure occurs.
javax.resource.ResourceException
- if called while no transaction is in effectpublic void beginLocalTransaction() throws javax.resource.ResourceException, RemoteException
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.public void commitLocalTransaction() throws javax.resource.ResourceException, RemoteException
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.public void rollbackLocalTransaction() throws javax.resource.ResourceException, RemoteException
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.public IDocument invokeService(String serviceName, IDocument request) throws ApplicationViewSuspendedException, ApplicationViewException, DocumentException, javax.resource.ResourceException, TransactionTimeoutException, RemoteException
The request document should conform to the document definition given by getRequestDocumentDefinition. The response document will conform to the document definition given by getResponseDocumentDefinition.
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
getRequestDocumentDefinition(String)
,
getResponseDocumentDefinition(String)
public IDocument invokeService(String serviceName, IDocument request, boolean autoCreateResponse) throws ApplicationViewSuspendedException, ApplicationViewException, DocumentException, javax.resource.ResourceException, TransactionTimeoutException, RemoteException
The request document should conform to the document definition given by getRequestDocumentDefinition. The response document will conform to the document definition given by getResponseDocumentDefinition.
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
getRequestDocumentDefinition(String)
,
getResponseDocumentDefinition(String)
public IDocument invokeServiceInternal(String serviceName, IDocument request, boolean autoCreateResponse, boolean isAsync) throws ApplicationViewSuspendedException, ApplicationViewException, DocumentException, javax.resource.ResourceException, TransactionTimeoutException, RemoteException
ApplicationViewSuspendedException
ApplicationViewException
DocumentException
javax.resource.ResourceException
TransactionTimeoutException
RemoteException
public String invokeServiceAsync(String serviceName, IDocument request, AsyncServiceResponseListener listener) throws ApplicationViewException, RemoteException
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.
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.getRequestDocumentDefinition(String)
,
getResponseDocumentDefinition(String)
,
AsyncServiceResponse
public String invokeServiceAsync(String serviceName, IDocument request, Map jmsPropertyMap, Serializable userObject) throws ApplicationViewException, RemoteException
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.
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.getRequestDocumentDefinition(String)
,
getResponseDocumentDefinition(String)
,
AsyncServiceResponse
public EventContext getEventContext() throws ApplicationViewException, EventContextException
ApplicationViewException
- If the event destination metadata needed
by this method cannot be found.
EventContextException
- If the underlying event transport layer
cannot be initialized.public EventContext getEventContext(boolean release) throws ApplicationViewException, EventContextException
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.
ApplicationViewException
- If the event destination metadata needed
by this method cannot be found.
EventContextException
- If the underlying event transport layer
cannot be initialized.public Context getInitialContext()
public void addEventListener(String eventTypeName, EventListener listener) throws ApplicationViewException, EventContextException
ApplicationViewException
- If the event destination metadata needed
by this method cannot be found.
EventContextException
- If the underlying event transport layer
cannot be initialized.listEventTypes
public void addEventListener(String eventTypeName, EventListener listener, String uniqueID) throws ApplicationViewException, EventContextException
ApplicationViewException
- If the event destination metadata needed
by this method cannot be found.
EventContextException
- If the underlying event transport layer
cannot be initialized.listEventTypes
public void removeEventListener(String eventType, EventListener listener) throws ApplicationViewException, EventContextException
ApplicationViewException
- If the event destination metadata needed
by this method cannot be found.
EventContextException
- If the underlying event transport layer
cannot be initialized.public void postEvent(IEvent event) throws ApplicationViewException, EventContextException, DocumentException
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.public void recoverAsyncServiceResponses(AsyncServiceResponseListener listener) throws ApplicationViewException
ApplicationViewException
public void close() throws ApplicationViewException
ApplicationViewException
public void setConnectionSpec(javax.resource.cci.ConnectionSpec connectionCriteria)
connectionCriteria
- connection criteria for the EIS.public javax.resource.cci.ConnectionSpec getConnectionSpec()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |