JCA 연결 팩토리 구성
JCA(Java™ EE Connector Architecture) 스펙을 준수하는 연결 팩토리를 구성할 수 있습니다.
이 태스크 정보
참고: Liberty의 JCA 지원을 구성하려면 일부 다른 문서 편집기
또는 WebSphere® Application Server Developer Tools for Eclipse의 서버 구성 편집기의 소스 보기를 사용하여
server.xml 파일을 편집해야 합니다. 이 주제에서는 MyAdapter라는 고유 ID가 있는 자원 어댑터가 이미 서버에 구성되어 있다고 가정하고
자원 어댑터 구성에 대한 문서에서 세부사항을 참조합니다. 기본 시나리오를 구성하는 엔드-투-엔드 예제는 다음 단계에서 제공됩니다.
참고: WebSphere®
Development Tools(WDT)의 디자인 보기에서는 연결 팩토리, 관리 오브젝트, 활성화 스펙 및 자원 어댑터에 대한
서버 구성의 특성 하위 요소를 편집할 수 없습니다.
프로시저
예
다음 예제를 사용하여 두 개의 연결 팩토리와 고유한 인터페이스 클래스 이름을 가진 자원 어댑터를 구성하는 방법을 학습하십시오.
다음 스니펫은 ra.xml 파일에 있으며, MyAdapter 자원 어댑터는 고유한 인터페이스 클래스 이름과 두 개의 연결 팩토리를 제공합니다.
<connection-definition>
<config-property>
<config-property-name>ServerName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>com.vendor.adapter.ConnectionFactoryImpl</connectionfactory-impl-class>
</connection-defintion>
<connection-definition>
<config-property>
<config-property-name>ServerName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
<connectionfactory-impl-class>com.vendor.adapter.DataSourceImpl</connectionfactory-impl-class>
</connection-defintion>
다음은 이 시나리오를 위한 서버 구성의 예제입니다. <connectionFactory jndiName="eis/cf">
<properties.MyAdapter.ConnectionFactory serverName="localhost"/>
</connectionFactory>
<connectionFactory jndiName="jdbc/ds">
<properties.MyAdapter.DataSource serverName="localhost"/>
</connectionFactory>
다음 예제를 사용하여 두 개의 연결 팩토리와 고유한 구현 클래스 이름을 가진 자원 어댑터를 구성하는 방법을 학습하십시오.
다음 스니펫은 ra.xml 파일에 있으며, MyAdapter 자원 어댑터는 고유한 구현 클래스 이름과 두 개의 연결 팩토리를 제공합니다.
<connection-definition>
<config-property>
<config-property-name>ServerName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>com.vendor.adapter.ConnectionFactoryImpl</connectionfactory-impl-class>
</connection-defintion>
<connection-definition>
<config-property>
<config-property-name>ServerName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<connectionfactory-interface>com.vendor.adapter.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>com.vendor.adapter.MyConnectionFactoryImpl</connectionfactory-impl-class>
</connection-defintion>
다음은 이 시나리오를 위한 서버 구성의 예제입니다. <connectionFactory jndiName="eis/cf1">
<properties.MyAdapter.ConnectionFactoryImpl serverName="localhost"/>
</connectionFactory>
<connectionFactory jndiName="eis/cf2">
<properties.MyAdapter.MyConnectionFactoryImpl serverName="localhost"/>
</connectionFactory>
다음 예제를 사용하여 두 개의 연결 팩토리가 있고 단순 인터페이스와 구현 클래스 이름이 모두 고유하지 않은 자원 어댑터를 구성하는 방법을 학습하십시오.
다음 스니펫은 ra.xml 파일에 있으며, MyAdapter 자원 어댑터는 단순 인터페이스와 구현 클래스 이름이 둘 다 고유하지 않은 두 개의 연결 팩토리를 제공합니다.
<connection-definition>
<config-property>
<config-property-name>ServerName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>com.vendor.adapter.ConnectionFactoryImpl</connectionfactory-impl-class>
</connection-defintion>
<connection-definition>
<config-property>
<config-property-name>HostName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
</config-property>
<connectionfactory-interface>com.vendor.adapter.custom.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>com.vendor.adapter.custom.ConnectionFactoryImpl</connectionfactory-impl-class>
</connection-defintion>
다음은 이 시나리오를 위한 서버 구성의 예제입니다. <connectionFactory jndiName="eis/cci-cf">
<properties.MyAdapter.javax.resource.cci.ConnectionFactory serverName="localhost"/>
</connectionFactory>
<connectionFactory jndiName="eis/custom-cf">
<properties.MyAdapter.com.vendor.adapter.custom.ConnectionFactory hostName="localhost"/>
</connectionFactory>
구성 요소 이름의 접미부를 대체할 수 있습니다. 구성 요소 이름의
접미부를 대체하는 방법에 대해 학습하려면 JCA 구성 요소 사용자 정의에 대한 정보를 참조하십시오.