|
WebLogic Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bea.wlai.client.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 stateful session EJB. The session EJB is deployed at WebLogic Server startup, just as any other EJB is. Following this, a second round of deployment occurs which deploys Application Views that have been configured by the user for a particular business purpose. The deployment of an Application View places metadata about the services and events for the Application View into a runtime metadata repository. This repository is currently implemented using JNDI.
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.
It is possible to 'hot deploy' an Application View into a server using the DeploymentManager. Below is an example of the Application View's deployment descriptor for the above example.
The SchemaManager session EJB or the SchemaServlet may be used to add the necessary schemas to the schema repository.
<?xml version="1.0"?> <!DOCTYPE applicationView> <applicationView asyncEnabled="true" connectionFactory="com.bea.adapter.dbms.DBMSConnectionFactory1" name="DBMSAppView1"> <service interactionSpecClass="com.bea.adapter.dbms.cci.InteractionSpecImpl" name="GetSomeData" requestDocumentType="GetSomeDataRequest" responseDocumentType="GetSomeDataResponse"> <interactionSpecProperty name="sql">select * from DATA</interactionSpecProperty> <interactionSpecProperty name="functionName">executeQuery</interactionSpecProperty> </service> </applicationView>Notice that the Application View deployment descriptor contains information about both the service name (name attribute of applicationView element) and the system function name to invoke for the service (interactionSpecProperty with name attribute equal to 'functionName'). Note also that the deployment descriptor contains the 'missing' metadata needed to invoke the system function that was not specified by the invoker of the service (the sql contained in the interactionSpecProperty element with name equal to 'sql').
This deployment descriptor also requires that a connection factory has been deployed to the JNDI name 'com.bea.adapter.dbms.DBMSConnectionFactory1'. The connection factory is deployed similarly to the Application View and contains the information about the physical instance of the EIS to which connections are to be made.
Field Summary | |
static java.lang.String |
APP_VIEW_ID_JMS_FIELD
|
Constructor Summary | |
ApplicationView(javax.naming.Context context,
QualifiedName appViewName)
Create a new ApplicationView with the given name, using the existing given InitialContext. |
|
ApplicationView(javax.naming.Context context,
java.lang.String appViewNameStr)
|
|
ApplicationView(java.util.Hashtable props,
QualifiedName appViewName)
Create a new ApplicationView with the given name, and using a new InitialContext obtained using the given Hashtable of properties. |
Method Summary | |
void |
addEventListener(java.lang.String eventTypeName,
EventListener listener)
Add a listener for events with type given by eventTypeName. |
void |
addEventListener(java.lang.String eventTypeName,
EventListener listener,
java.lang.String uniqueID)
Add a listener for events with type given by eventTypeName. |
protected void |
checkClosed()
Throw an exception if this app view instance is already closed. |
void |
close()
Free any resources being held by this ApplicationView instance. |
protected void |
finalize()
Cleans up this ApplicationView instance when the garbage collector determines this object is no longer needed. |
protected void |
freeAsync()
Free any resources allocated for async service processing. |
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(java.lang.String eventType)
Get IEventDefinition for the given event type. |
javax.naming.Context |
getInitialContext()
Return the InitialContext object representing the connection to the JNDI tree in WLS/WLAI. |
java.lang.String |
getName()
Get this ApplicationView's name. |
QualifiedName |
getQualifiedName()
Get this ApplicationView's qualified name |
IDocumentDefinition |
getRequestDocumentDefinition(java.lang.String serviceName)
Get request DocumentDefinition for the given service. |
IDocumentDefinition |
getResponseDocumentDefinition(java.lang.String serviceName)
Get response IDocumentDefinition for the given service. |
protected void |
initializeAsync()
Initialize member variables required for performing asynchronous service invocation. |
IDocument |
invokeService(java.lang.String serviceName,
IDocument request)
Synchronously invoke the service with the given name, using the request document given. |
IDocument |
invokeService(java.lang.String serviceName,
IDocument request,
boolean autoCreateResponse)
Synchronously invoke the service with the given name, using the request document given. |
void |
invokeService(java.lang.String serviceName,
IDocument request,
IDocument response)
Synchronously invoke the service with the given name, using the request and response documents given. |
java.lang.String |
invokeServiceAsync(java.lang.String serviceName,
IDocument request,
AsyncServiceResponseListener listener)
Asynchronously invoke the service with the given name, and notify the given listener when the response is available. |
java.lang.String |
invokeServiceAsync(java.lang.String serviceName,
IDocument request,
java.lang.String responseQueueJNDIName,
java.util.Map jmsPropertyMap)
Asynchronously invoke the service with the given name, and place the response on the indicated JMS queue when the response is available. |
boolean |
isAsyncEnabled()
Determine if this application view has been set up to allow the user to use the invokeServiceAsync() method. |
java.lang.String[] |
listEventTypes()
List the events this ApplicationView is capable of delivering, and thus the events which may be listened for using addEventListener(). |
java.lang.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 |
removeEventListener(java.lang.String eventType,
EventListener listener)
Remove the given listener from the subscription list for events with type given by eventTypeName. |
void |
setConnectionSpec(javax.resource.cci.ConnectionSpec connectionCriteria)
Sets the connectionSpec for connections made to the EIS. |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String APP_VIEW_ID_JMS_FIELD
Constructor Detail |
public ApplicationView(java.util.Hashtable props, QualifiedName appViewName) throws javax.naming.NamingException, javax.ejb.CreateException, java.rmi.RemoteException
public ApplicationView(javax.naming.Context context, java.lang.String appViewNameStr) throws javax.naming.NamingException, NamespaceException, javax.ejb.CreateException, java.rmi.RemoteException
public ApplicationView(javax.naming.Context context, QualifiedName appViewName) throws javax.naming.NamingException, javax.ejb.CreateException, java.rmi.RemoteException
Method Detail |
protected void finalize() throws java.lang.Throwable
public java.lang.String getName()
public QualifiedName getQualifiedName()
public java.lang.String[] listServiceNames() throws ApplicationViewException, java.rmi.RemoteException
public java.lang.String[] listEventTypes() throws ApplicationViewException, java.rmi.RemoteException
public IDocumentDefinition getRequestDocumentDefinition(java.lang.String serviceName) throws ApplicationViewException, java.rmi.RemoteException
public IDocumentDefinition getResponseDocumentDefinition(java.lang.String serviceName) throws ApplicationViewException, java.rmi.RemoteException
public IEventDefinition getEventDefinition(java.lang.String eventType) throws ApplicationViewException, java.rmi.RemoteException
public IDocument invokeService(java.lang.String serviceName, IDocument request) throws ApplicationViewException, DocumentException, javax.resource.ResourceException, java.rmi.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.
getRequestDocumentDefinition(String)
,
getResponseDocumentDefinition(String)
public IDocument invokeService(java.lang.String serviceName, IDocument request, boolean autoCreateResponse) throws ApplicationViewException, DocumentException, javax.resource.ResourceException, java.rmi.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.
getRequestDocumentDefinition(String)
,
getResponseDocumentDefinition(String)
public void invokeService(java.lang.String serviceName, IDocument request, IDocument response) throws ApplicationViewException, DocumentException, javax.resource.ResourceException, java.rmi.RemoteException
The request document should conform to the document definition given by getRequestDocumentDefinition. The response document should conform to the document definition given by getResponseDocumentDefinition.
getRequestDocumentDefinition(String)
,
getResponseDocumentDefinition(String)
public boolean isAsyncEnabled() throws ApplicationViewException, java.rmi.RemoteException
public java.lang.String invokeServiceAsync(java.lang.String serviceName, IDocument request, AsyncServiceResponseListener listener) throws ApplicationViewException, java.rmi.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.
getRequestDocumentDefinition(String)
,
getResponseDocumentDefinition(String)
,
AsyncServiceResponse
public java.lang.String invokeServiceAsync(java.lang.String serviceName, IDocument request, java.lang.String responseQueueJNDIName, java.util.Map jmsPropertyMap) throws ApplicationViewException, java.rmi.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.
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.
getRequestDocumentDefinition(String)
,
getResponseDocumentDefinition(String)
,
AsyncServiceResponse
public EventContext getEventContext() throws ApplicationViewException, EventContextException
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.public javax.naming.Context getInitialContext()
public void addEventListener(java.lang.String eventTypeName, EventListener listener) throws ApplicationViewException, EventContextException
public void addEventListener(java.lang.String eventTypeName, EventListener listener, java.lang.String uniqueID) throws ApplicationViewException, EventContextException
public void removeEventListener(java.lang.String eventType, EventListener listener) throws ApplicationViewException, EventContextException
public void postEvent(IEvent event) throws ApplicationViewException, EventContextException, DocumentException
protected void initializeAsync() throws ApplicationViewException
protected void freeAsync() throws ApplicationViewException
public void close() throws ApplicationViewException
protected void checkClosed() throws ApplicationViewException
public void setConnectionSpec(javax.resource.cci.ConnectionSpec connectionCriteria)
public javax.resource.cci.ConnectionSpec getConnectionSpec()
|
WebLogic Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |