📄 connect the enterprise with the jca, part 1.htm
字号:
configure when the resource adapter is deployed on the application server. You
can choose from several ways to configure security properties when using
container-managed sign-on. First, with <EM>Configured Identity,</EM> all
resource adapter connections use the same identity when connecting to the EIS
system. Second, with <EM>Principal Mapping,</EM> the principal used when
connecting to the EIS system is based on a combination of the current principal
in the application server and the mapping (which maps how the principal in the
application server will map to a principal in the EIS system). The third is
<EM>Caller Impersonation,</EM> where the principal used in the EIS system
exactly matches the principal in the application server. The fourth is
<EM>Credentials Mapping,</EM> which is similar to Caller Impersonation, except
the type of credentials must be mapped from application server credentials to
EIS credentials.
<P>While it's easiest to configure the security properties at deployment time,
such a strategy proves slightly less flexible because the security properties
cannot change at runtime. As an alternative, you can configure security
properties by <EM>component-managed sign-on,</EM> which allows you to pass
security properties each time a connection is acquired from the resource
adapter.
<P><STRONG>CCI </STRONG><BR>To retrieve and update data, you employ JCA's CCI
layer, a procedure resembling using JDBC to call stored procedures. A JCA
resource adapter is not required to support the CCI layer (the resource adapter
creators can choose their own API set), and, even if the resource adapter does
support CCI, it may also support an API specific for that particular adapter.
<P>The CCI APIs can be divided into four sections: First, the APIs related to
establishing a connection to an EIS, also referred to as the <EM>Connection
Interfaces.</EM> The second area of the CCI APIs cover command execution on an
EIS, referred to as the <EM>Interaction Interfaces.</EM> Third is the
<EM>Record/ResultSet Interfaces,</EM> which encapsulate the query results to an
EIS. The fourth area, referred to as the <EM>Metadata Interfaces,</EM> allows
EIS's metadata (the type of data) to be queried.
<P>After this brief overview of the CCI APIs, it is useful to look at an example
that shows the query of an employee count from an EIS:
<P><CODE>
<P><BR>...<BR> int
count;<BR> try
{<BR> ConnectionSpec
spec = new CciConnectionSpec(user,
password);<BR> Connection
con =
cf.getConnection(spec);<BR><BR> Interaction
ix =
con.createInteraction();<BR> CciInteractionSpec
iSpec = new
CciInteractionSpec();<BR> iSpec.setSchema(user);<BR> iSpec.setFunctionName("EMPLOYEECOUNT");<BR> RecordFactory
rf =
cf.getRecordFactory();<BR> IndexedRecord
iRec =
rf.createIndexedRecord("InputRecord");<BR><BR> Record
rec = ix.execute(iSpec,
iRec);<BR> Iterator
iter =
((IndexedRecord)rec).iterator();<BR> while(iter.hasNext())
{
<BR> Object
obj =
iter.next();<BR> if(obj
instanceof Integer)
{<BR> count
=
((Integer)obj).intValue();<BR> }<BR> }<BR> con.close();<BR> }
<BR> catch(Exception e)
{<BR> e.printStackTrace();<BR> }<BR> System.out.println("Employee
count is: " + count);<BR>...<BR></CODE>
<P><FONT size=+1><STRONG>Limitations of the JCA 1.0 and its future
</STRONG></FONT><BR>The JCA, as its single biggest weakness, lacks an
asynchronous communication vehicle. As a consequence, pulling information out of
an EIS proves straightforward, but having an EIS send information (for instance
data updates) to your system is not currently in the JCA specification.
<P>In another major weakness, the JCA specification lacks a common API for data
access. The CCI mentioned above is optional, so no dependable mechanism exists
that a developer can use to access data using JCA (only the system contracts are
guaranteed to be consistent).
<P>The good news is that most of the current JCA's limitations will be addressed
in the specification's next version, JCA 2.0, currently in development as JSR
(Java Specification Request) 112. Version 2.0 will address asynchronous
capabilities, JMS integration with JCA, metadata for the CCI layer, and XML use
in the CCI layer.
<P><FONT size=+1><STRONG>Wrap up </STRONG></FONT><BR>This article provided an
overview the of the JCA 1.0 specification and how it fits into the EAI product
category. While not widely deployed yet, the JCA specification should prove a
critical tool for developing a large J2EE system. Part 2 in the JCA series will
go into the details of JCA by developing a simple JCA adapter. <IMG height=12
src="Connect the enterprise with the JCA, Part 1.files/jw-dingbat.gif" width=22>
<P><BR></P>
<P><STRONG>About the author</STRONG><BR><A href="javascript:openBrWindow()">Dirk
Reinshagen</A>, an architect at Zaplet, Inc., a commercial software vendor in
the San Francisco Bay Area, has more than eight years of software architecture
and development experience. He holds a B.S. in computer science from Tufts
University. <BR></P>
<P>
<UL><A name=resources></A><STRONG>Resources</STRONG> <BR>
<LI>"Connect the Enterprise with the JCA," Dirk Reinshagen
(<EM>JavaWorld</EM>)
<UL>
<LI><A
href="http://www.javaworld.com/javaworld/jw-11-2001/jw-1121-jca.html">Part
1. A look at the J2EE Connector Architecture</A> (November 2001)
<LI><A
href="http://www.javaworld.com/javaworld/jw-02-2002/jw-0201-jca2.html">Part
2. Build your own J2EE Connector Architecture adapter</A> (February 2002)
</LI></UL>
<LI>Dirk Reinshagen's "XML Messaging" series <EM>(JavaWorld):</EM>
<UL>
<LI><A
href="http://www.javaworld.com/javaworld/jw-03-2001/jw-0302-xmlmessaging.html">Part
1: Write a simple XML message broker for custom XML messages</A> (March
2001)
<LI><A
href="http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-xmlmessaging2.html">Part
2: XML messaging the SOAP way</A> (June 2001)
<LI><A
href="http://www.javaworld.com/javaworld/jw-09-2001/jw-0914-xmlmessage3.html?">Part
3: JAXM and ebXML set the new standard for XML messaging</A> (September
2001) </LI></UL>
<LI>The JCA page from java.sun.com: <BR><A
href="http://java.sun.com/j2ee/connector/">http://java.sun.com/j2ee/connector/</A><BR>
<LI>The Java Community Process's JSR 112 page, from which JCA 2.0 will spring:
<BR><A
href="http://www.jcp.org/jsr/detail/112.jsp">http://www.jcp.org/jsr/detail/112.jsp</A><BR>
<LI>For more Java 2 Platform, Enterprise Edition stories, visit the
<STRONG>J2EE</STRONG> section of <EM>JavaWorld</EM>'s Topical Index: <BR><A
href="http://www.javaworld.com/channel_content/jw-j2ee-index.shtml">http://www.javaworld.com/channel_content/jw-j2ee-index.shtml</A><BR>
<LI>Discuss the JCA in our <STRONG>Enterprise Java</STRONG> discussion: <BR><A
href="http://forums.devworld.com/webx?50@@.ee6b80a">http://forums.devworld.com/webx?50@@.ee6b80a</A><BR>
<LI>Sign up for <EM>JavaWorld</EM>'s free <EM>Enterprise Java</EM> newsletter:
<BR><A
href="http://www.idg.net/jw-subscribe">http://www.idg.net/jw-subscribe</A><BR>
<LI>You'll find a wealth of IT-related articles from our sister publications
at <A href="http://www.idg.net/jump?id=1100">IDG.net</A> </LI></UL><BR>
<P></P><!-- REPLACE SIDEBAR --></FONT><!-- ## MAIN CONTENT ENDS HERE ### --></TD><TD
width="8"><IMG height=1
src="Connect the enterprise with the JCA, Part 1.files/spacer.gif" width=8
border=0></TD> </TR></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TBODY>
<TR>
<TD align=middle width=186 bgColor=#006699><NOBR><FONT
face=Verdana,Geneva,Arial,Helvetica,sans-serif size=1></FONT></NOBR><A
href="http://www.javaworld.com/"><IMG height=81
src="Connect the enterprise with the JCA, Part 1.files/top_jwlogo.gif"
width=186 border=0></A></TD>
<TD vAlign=bottom width=8 bgColor=#cccccc><IMG height=8
src="Connect the enterprise with the JCA, Part 1.files/c_blgrylftbottom.gif"
width=8 border=0></TD>
<TD vAlign=center align=middle width="100%" bgColor=#cccccc><!-- BOTTOM 468x60 AD STARTS HERE jw-articles-bottom-ad.txt -->
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD><FONT face=Arial,Helvetica,Sans-serif color=#000000
size=-2>Advertisement: Support JavaWorld, click here!</FONT><BR>
<SCRIPT language=JavaScript
src="Connect the enterprise with the JCA, Part 1.files/spinbox.macworld[2]"></SCRIPT>
<NOSCRIPT><A href="http://spinbox.macworld.com/?SHT=jw-BottomBanner"
target=_top><IMG
src="Connect the enterprise with the JCA, Part 1.files/jw_house468x60.gif"></A>
</NOSCRIPT></TD></TR></TBODY></TABLE><!-- BOTTOM 468x60 AD ENDS HERE --></TD>
<TD width=8><IMG height=8
src="Connect the enterprise with the JCA, Part 1.files/spacer.gif" width=8
border=0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center bgColor=#006699
border=0>
<TBODY>
<TR>
<TD vAlign=center align=middle width="100%"><FONT
face=Verdana,Geneva,Arial,Helvetica,sans-serif color=#ffffff size=1>
<P><BR><A href="http://www.javaworld.com/"><FONT
color=#ffffff>HOME</FONT></A> | <A
href="http://www.javaworld.com/features/index.shtml"><FONT
color=#ffffff>FEATURED TUTORIALS</FONT></A> | <A
href="http://www.javaworld.com/columns/index.shtml"><FONT
color=#ffffff>COLUMNS</FONT></A> | <A
href="http://www.javaworld.com/news-reviews/index.shtml"><FONT
color=#ffffff>NEWS & REVIEWS</FONT></A> | <A
href="http://forums.devworld.com/webx?13@@.ee6b802"><FONT
color=#ffffff>FORUM</FONT></A> | <A
href="http://www.javaworld.com/resources/index.shtml"><FONT
color=#ffffff>JW RESOURCES</FONT></A> | <A
href="http://www.javaworld.com/info/jw-about-index.shtml"><FONT
color=#ffffff>ABOUT JW</FONT></A> | <A
href="http://www.javaworld.com/feedback"><FONT
color=#ffffff>FEEDBACK</FONT></A> </P>
<P><A
href="http://www.javaworld.com/javaworld/common/jw-copyright.html"><FONT
color=#ffffff>Copyright
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -