⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 j2ee connector programmer's guide.htm

📁 本人收集的关于Java Connector Architecture的资料
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0056)http://jonas.objectweb.org/current/doc/PG_Connector.html -->
<!--- JOnAS: Java(TM) Open Application Server- Copyright (C) 2003 Bull S.A.- Contact: jonas-team@objectweb.org- This library is free software; you can redistribute it and/or- modify it under the terms of the GNU Lesser General Public- License as published by the Free Software Foundation; either- version 2.1 of the License, or any later version.- This library is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU- Lesser General Public License for more details.- You should have received a copy of the GNU Lesser General Public- License along with this library; if not, write to the Free Software- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307- USA- Author: Eric HARDESTY- $Id: PG_Connector.html,v 1.11 2004/04/21 13:55:08 benoitf Exp $--><HTML><HEAD><TITLE>J2EE Connector Programmer's Guide</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK 
href="J2EE Connector Programmer's Guide.files/common.css" rel=stylesheet>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY lang=en>
<H1><A name=PG_Connector></A>J2EE Connector Programmer's Guide</H1>
<P>The content of this guide is the following:</P>
<OL>
  <LI><A 
  href="http://jonas.objectweb.org/current/doc/PG_Connector.html#PG_Connector-Target">Target 
  Audience and Content</A> 
  <LI><A 
  href="http://jonas.objectweb.org/current/doc/PG_Connector.html#PG_Connector-Princip">Principles</A> 

  <LI><A 
  href="http://jonas.objectweb.org/current/doc/PG_Connector.html#PG_Connector-Descriptor">Defining 
  the JOnAS Connector Deployment Descriptor</A> 
  <LI><A 
  href="http://jonas.objectweb.org/current/doc/PG_Connector.html#PG_Connector-Packaging">Resource 
  Adapter (RAR) Packaging</A> 
  <LI><A 
  href="http://jonas.objectweb.org/current/doc/PG_Connector.html#PG_Connector-Use">Use 
  and Deployment of a Resource Adapter</A> 
  <LI><A 
  href="http://jonas.objectweb.org/current/doc/PG_Connector.html#PG_Connector-JDBC">JDBC 
  Resource Adapters</A> 
  <LI><A 
  href="http://jonas.objectweb.org/current/doc/PG_Connector.html#PG_Connector-JCA">Appendix: 
  Connector Architecture Principles</A> </LI></OL>
<H2><A name=PG_Connector-Target></A>Target Audience and Content</H2>
<P>This chapter is provided for advanced JOnAS users concerned with EAI 
(Enterprise Application Integration) and using the J2EE Connector Architecture 
principles (refer to the <A 
href="http://jonas.objectweb.org/current/doc/PG_Connector.html#PG_Connector-JCA">Appendix</A> 
for an introduction to the connectors). The target audience for this guide is 
the Resource Adapter deployer and programmer. It describes the JOnAS specific 
deployment file (<EM>jonas-ra.xml</EM>) and the sample code to access deployed 
RARs.</P>
<H2><A name=PG_Connector-Princip></A>Principles</H2>
<P>Resource Adapters are packaged for deployment in a standard Java programming 
language Archive file called a <EM>rar</EM> file (Resource ARchive), which is 
described in the J2EE Connector Architecture specification.</P>
<P>The standard method for creating the <EM>jonas-ra.xml</EM> file is to use the 
RAConfig tool. For a complete description refer to <A 
href="http://jonas.objectweb.org/current/doc/Tools.html#Tools-raconfig">RAConfig</A>.</P>
<H2><A name=PG_Connector-Descriptor></A>Defining the JOnAS Connector Deployment 
Descriptor</H2>
<P>The <EM>jonas-ra.xml</EM> contains JOnAS specific information describing 
deployment information, logging, pooling, jdbc connections, and RAR config 
property values.</P>
<UL>
  <LI><EM>Deployment Tags</EM>: 
  <UL>
    <LI>jndiname: (Required) Name the RAR will be registered as. This value will 
    be used in the resource-ref section of an EJB. 
    <LI>rarlink: Jndiname of a base RAR file. Useful for deploying multiple 
    connection factories without having to deploy the complete RAR file again. 
    When this is used, the only entry in RAR is a 
    <EM>META-INF/jonas-ra.xml</EM>. 
    <LI>native-lib: Directory where additional files in the RAR should be 
    deployed. </LI></UL>
  <LI><EM>Logging Tags</EM>: 
  <UL>
    <LI>log-enabled: Determines if logging should be enabled for the RAR. 
    <LI>log-topic: Log topic to use for the PrintWriter logger, which allows a 
    separate handler for each deployed RAR. </LI></UL>
  <LI><EM>Pooling Tags</EM>: 
  <UL>
    <LI>pool-init: Initial size of the managed connection pool. 
    <LI>pool-min: Minimum size of the managed connection pool. 
    <LI>pool-max: Maximum size of the managed connection pool. Value of -1 is 
    unlimited. 
    <LI>pool-max-age: Maximum number of milliseconds to keep the managed 
    connection in the pool. Value of 0 is an unlimited amount of time. 
    <LI>pstmt-max: Maximum number of PreparedStatements per managed connection 
    in the pool. Only needed with the JDBC RA of JOnAS or another database 
    vendor's RAR. Value of 0 is unlimited and -1 disables the cache. </LI></UL>
  <LI><EM>JDBC Connection Tags</EM>: Only valid with a Connection implementation 
  of java.sql.Connection. 
  <UL>
    <LI>jdbc-check-level: Level of checking that will be done for the jdbc 
    connection. Values are 0 for no checking, 1 to validate that the connection 
    is not closed before returning it, and greater than 1 to send the 
    jdbc-test-statement. 
    <LI>jdbc-test-statement: Test SQL statement sent on the connection if the 
    jdbc-check-level is set accordingly. </LI></UL>
  <LI><EM>Config Property Value Tags</EM>: 
  <UL>
    <LI>Each entry must correspond to the config-property specified in the 
    <EM>ra.xml</EM> of the RAR file. </LI></UL></LI></UL>
<H3>Deployment Descriptor Examples</H3>
<P>The following portion of a <EM>jonas-ra.xml</EM> file shows the linking to a 
base RAR file named BaseRar. All properties from the base RAR will be inherited 
and any values given in this <EM>jonas-ra.xml</EM> will override the other 
values.</P><PRE>  &lt;jonas-resource&gt;
    &lt;jndiname&gt;rar1&lt;/jndiname&gt;
    &lt;rarlink&gt;BaseRar&lt;/rarlink&gt;
    &lt;native-lib&gt;nativelib&lt;/native-lib&gt;
    &lt;log-enabled&gt;false&lt;/log-enabled&gt;
    &lt;log-topic&gt;com.xxx.rar1&lt;/log-topic&gt;
    &lt;jonas-config-property&gt;
      &lt;jonas-config-property-name&gt;ip&lt;/jonas-config-property-name&gt;
      &lt;jonas-config-property-value&gt;www.xxx.com&lt;/jonas-config-property-value&gt;
    &lt;/jonas-config-property&gt;
    .
    .
  &lt;/jonas-resource&gt;</PRE>
<P>The following portion of a <EM>jonas-ra.xml</EM> file shows the configuration 
of a jdbc rar file.</P><PRE>  &lt;jonas-resource&gt;
    &lt;jndiname&gt;jdbc1&lt;/jndiname&gt;
    &lt;rarlink&gt;&lt;/rarlink&gt;
    &lt;native-lib&gt;nativelib&lt;/native-lib&gt;
    &lt;log-enabled&gt;false&lt;/log-enabled&gt;
    &lt;log-topic&gt;com.xxx.jdbc1&lt;/log-topic&gt;
    &lt;pool-params&gt;
      &lt;pool-init&gt;0&lt;/pool-init&gt;
      &lt;pool-min&gt;0&lt;/pool-min&gt;
      &lt;pool-max&gt;100&lt;/pool-max&gt;
      &lt;pool-max-age&gt;0&lt;/pool-max-age&gt;
      &lt;pstmt-max&gt;20&lt;/pstmt-max&gt;
    &lt;/pool-params&gt;
    &lt;jdbc-conn-params&gt;
      &lt;jdbc_check-level&gt;2&lt;/jdbc_check-level&gt;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -