|< Day Day Up >|| |
In this section we take a look at development guidelines for J2EE Connectors. Using IBM WebSphere Studio Application Developer V5.0, there are two ways to develop J2EE Connector applications:
Using CCI: An application component uses CCI (Common Client Interface), which is provided by a resource adapter. This is a standard way of developing J2EE Connector applications, regardless of the development tools.
Using the Enterprise services toolkit: Using WebSphere Studio Integration Edition or WebSphere Studio Enterprise Developer, you can develop a J2EE Connector application as an Enterprise Service.
You can implement J2EE Connector connectivity using native CCI in your application with the following steps:
Configure your J2EE Connector resource adapter and connection factory in your integrated development environment.
Create an input and output Record class.
These records implement javax.resource.cci.Record and perform the input and output conversions between application Java data structures and enterprise tier data structures. You can manually code classes using the CCI record framework or you can use a tool such as the VisualAge for Java Enterprise Access Builder. The Enterprise Access Builder allows you to create a CCI record from an existing C or COBOL structure.
The basic configuration of WebSphere Studio Application Developer does not provide a tool to import a C or COBOL structure into a CCI record. With the Enterprise Services toolkit in WebSphere Studio Application Developer Integration Edition, you can import a C or COBOL structure into an enterprise service definition.
Get an instance of the required J2EE Connector ConnectionFactory (usually through a JNDI lookup).
Get an instance of J2EE Connector Connection from the connection factory.
Create an instance of input and output Record using classes developed in step 2.
Create an Interaction instance from the Connection.
Create an InteractionSpec and set the required properties.
Execute the Interaction, passing the InteractionSpec, input Record, and output Record.
Close the Interaction and Connection.
WebSphere Studio Application Developer Integration Edition includes a set of tools and wizards, collectively referred to as the Enterprise Services toolkit. The Enterprise Services toolkit is a fully service-oriented development environment for business and enterprise application integration.
At the heart of the Enterprise Services toolkit programming model are Enterprise Services, or Services for short. Services are used to model different kinds of service providers in a consistent way. Figure 12-3 shows the currently supported providers. Note that in the Enterprise Services world a Web service is just one form of service provider. J2EE Connectors are another.
Figure 12-3: Services supported by WebSphere Studio Integration Edition
The Web Services Invocation Framework (WSIF) provides a standard API to invoke services, no matter how or where the service is provided, as long it is described in WSDL. This API is used by tools such as WebSphere Studio Integration Edition, and runtimes such as IBM WebSphere Application Server V5.0, to construct and manipulate services defined in WSDL documents. The architecture allows new bindings to be added at runtime.
The J2EE Connector Tool Plug-in makes it possible to plug a J2EE Connector-compliant EIS resource adapter, such as the CICS ECI adapter, into the Enterprise Services toolkit provided with WebSphere Studio Integration Edition.
Using the Enterprise Services toolkit, there's no need to write any J2EE Connector code because the Service Definition wizard in WebSphere Studio Integration Edition guides you through the service definition. The wizard generates a WSDL file providing the WSIF with all the information needed to connect to the enterprise tier and to invoke the enterprise application.
You can implement J2EE Connector connectivity in your application using the Enterprise Services toolkit (provided in WebSphere Studio Integration Edition) with the following steps:
Create a J2EE Connector service definition from the corresponding resource adapter in the Service Provider Browser. In the Service Definition wizard you define the following:
Port and portType
Input and output message(s)
A message corresponds to a J2EE Connector Record. You can import the message definition from an existing C or COBOL structure.
Deploy the J2EE Connector service. The Service Deployment wizard allows you to deploy services into WebSphere. By default, the wizard deploys the service as a session EJB. It can also deploy the service as a SOAP service.
Build your application client for accessing the J2EE Connector service. Create an application EJB or servlet, for example, to access the deployed J2EE Connector enterprise service.
The J2EE Connector Architecture CCI provides a common programing interface to application component developers. When you migrate the application component to a different adapter, you only need to change the method calls that are specific to that resource adapter. The classes that are specific to a resource adapter are:
Input and output record classes
For example, IMSConnectionSpec has getGroupName and setGroupName, which are unique to the IMS resource adapter for specifying the IMS Group. Refer to the resource adapter documentation for details.
When you are developing an enterprise service using WebSphere Studio Integration Edition, all the code is generated by the tool. Regenerate the code using a new resource adapter to migrate your application.
|< Day Day Up >|| |