JCA - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

JCA

Description:

By EIS we refer to Applications like CICS, IMS, Tandem ... Iterator iter = ((IndexedRecord)rec).iterator(); while(iter.hasNext()) { Object obj = iter.next ... – PowerPoint PPT presentation

Number of Views:162
Avg rating:3.0/5.0
Slides: 13
Provided by: esbenp
Category:
Tags: jca | iter

less

Transcript and Presenter's Notes

Title: JCA


1
JCA
  • J2EE Connector Architecture
  • JCA also called J2C by IBM
  • Author Esben P. Graven

2
What is JCA?
  • A Java standard to access multiple EIS
  • By EIS we refer to Applications like CICS, IMS,
    Tandem Pathway, Custom NT Applications etc.
  • Based on drivers
  • These are called Resource Adapters
  • Simple design
  • Easy to use
  • Easy to develop -)

3
Why do we need it ??
  • Complements JDBC and JMS
  • Non-relational and synchronous (for now)
  • Clear analogy to JDBC for NON-RELATIONAL systems
  • Avoid the tight coupling using a proprietary
    driver creates
  • With a standard available, we can swap either
    source or driver
  • Similarity between systems
  • Treat disparate/heterogeneous systems as
    homogeneous resources
  • Allow for uniform access to heterogeneous
    implementations /protocols
  • Create a market for first and third party driver
    developers
  • Will generally increase the amount of available
    adapters
  • Main target are EAI and general tool support
  • Tightly and transparently integrates Transaction
    and Security

4
The contents (three parts)
  • Common Client Interface (CCI)
  • Resembles the coding needed in JDBC to call a
    Stored Procedure
  • Has four partsConnection Establishing, Command
    Execution, Result retrieval and Interfaces
    description through metadata
  • System Contract
  • The SPI for J2EE container to Connection and
    Transactional management and Security
    enforcement
  • Resource Adapter (Resembles JDBC driver)
  • Implementation of the system contract. Being
    establisment, pool and closing connections,
    besides propagating Security andTransactional
    context

Application server
Container Contract
EJB
CCI API
System Contract
Resource Adapter
Specific API
Mainframe (EIS)
5
A detailed picture of components
6
Why have both EJB and JCA?
  • Thesis 1) Services could also be exposed via
    either proprietary JAVA APIs or JNI on a
    specific platform (e.g. App. Server on OS/390)
  • I a) This creates a tight coupling
  • II a) Is one way - cross App. server events
    requires Messaging
  • III a) - JNI requires App. Server on the given
    platform -JNI do not propagate security and
    transaction context, and proprietary API probably
    will not either
  • IV a) Definitely not supportable by tools
  • Thesis 2) All implementation will be EJB
  • I b) EJB were architected for Business logic.
    Similar discussion could be held on JDBC
  • II b) The Ia) and IIa) from above still apply.
    Spaghetti will result
  • III b) No PlugnPlay EJBs do not expose similar
    methods, needs mapping
  • IV b) Pure EJB will be VERY far into the future.
    If ever (remember Shelf-ware)

Inevitable Result !
Desired Result ?
EJB/APP J2EE server Other shapes
other technology
7
Is web services not solving Integration?
  • Too loosly coupled
  • Web Services provide a uniform standards based
    technique for exposing application functionality
    on the web
  • Can not be optimised
  • Transactional, Security currently missing
  • No Connection pooling
  • Costly Marshalling
  • UDDI currently not targetfor tool support
  • Functional Accessibility
  • Which functionality do you wanttoo expose to
    whom - the normalapplication / server challenge
  • Internal in app, in the company, on the web

Layers / domains aggregates to each other - they
do NOT shield
B2B domain interaction, unknown /indefinite set
of systems
Web Services
Corporate domain cross application integration,
known/controlled set of systems
EJB
Applicationdevelopment
8
Steps in using JCA - if not from a tool
  • Establish a JNDI context for your session. User
    name and password are required to access the EIS.
  • Use the JNDI lookup method to locate the
    ConnectionFactory for the resource adapter.
  • Use the ConnectionFactory method getConnection to
    open the connection.
  • Use the Connection method createInteraction to
    create a new Interaction instance. All operations
    on the underlying EIS are done through an
    Interaction object.
  • Instantiate an object representing the
    InteractionSpec interface.
  • Use the ConnectionFactory method getRecordFactory
    to get a reference to the RecordFactory.
  • Create Record instances as necessary using the
    appropriate RecordFactory create method, such as
    createIndexedRecord. Be sure to establish whether
    the record is for input, output, or both input
    and output (inout).
  • If you are managing your own transaction and
    persistence, begin a transaction so that you can
    recover if a problem occurs.
  • Perform the desired operation on the data store.
    The example in this article uses database stored
    procedures to operate on the database. Note that
    the elements in the Record instances need to map
    to the appropriate parameters in the stored
    procedures.
  • If you manage your own transaction, commit the
    transaction or rollback if there are errors.
  • Close the connection to the EIS

9
Code snippet (from JavaWorld)
  • Import javax.resource.cci., jaxax.resource.Resour
    ceException
  • try
  • ConnectionSpec spec new CciConnectionSpec(user,
    password)
  • Connection con cf.getConnection(spec)
  • Interaction ix con.createInteraction()
  • CciInteractionSpec iSpec new
    CciInteractionSpec()
  • iSpec.setSchema(user)
  • iSpec.setFunctionName("EMPLOYEECOUNT")
  • RecordFactory rf cf.getRecordFactory()
  • IndexedRecord iRec rf.createIndexedRecord("Inpu
    tRecord")
  • Record rec ix.execute(iSpec, iRec)
  • Iterator iter ((IndexedRecord)rec).iterator()
  • while(iter.hasNext())
  • Object obj iter.next()
  • if(obj instanceof Integer) count
    ((Integer)obj).intValue()
  • con.close()

10
Current Limitations
  • Application Events
  • JCA 1.0 effectively addresses a J2EE application
    client interacting with the external system
    application. The case where an EIS application
    needs to generate an event in or connect to a
    J2EE application server is not handled.
  • Asynchronous Work with Applications
  • JCA 1.0 tackles interactions with EIS
    applications. It does not handle cases where the
    interactions with the EIS application need to be
    asynchronous.
  • Adapter Metadata
  • The JCA 1.0 specification does not address
    adapter metadata. A tool that needs to work with
    the JCA adapter does not have a standard way to
    query the adapter about its interactions and
    their expected inputs and outputs.
  • Work with XML Based External Systems
  • It is becoming more commonplace for external
    systems to expose their functionality in the form
    of an XML based protocol. This common case is
    ignored by the JCA specification and therefore
    different approaches to handling XML based
    external systems are offered by different tool
    vendors and adapter providers.
  • CCI as a Mandatory Requirement
  • Without making CCI mandatory, tools cannot deal
    with JCA generically.

11
A wrong and a right way of INTEGRATION
  • With JCA 1.0 communication is one-way and left
    picture is reasonable
  • With BEA-JCA or JCA 2.0 communication is
    bi-directional and the right picture is the right
    way

EIS
Meta data repository
Producer
JCA
Producer Consumer
EAI J2EE
EJB
EIS
J C A
J C A
Producer Consumer
Deployed in server to avoid complex code for
transaction/security propagation
EJB
Consumer
12
Resources
  • "Connect the Enterprise with the JCA," Dirk
    Reinshagen (JavaWorld)
  • Part 1. A look at the J2EE Connector Architecture
    (November 2001)
  • Part 2. Build your own J2EE Connector
    Architecture adapter (February 2002)
  • The JCA page from java.sun.com
    http//java.sun.com/j2ee/connector/
  • The Java Community Process's JSR 112 page, from
    which JCA 2.0 will spring http//www.jcp.org/jsr
    /detail/112.jsp
Write a Comment
User Comments (0)
About PowerShow.com