Enterprise JavaBean 프로젝트(EJB 2.0에서 EJB 2.1로)

J2EE 이주 마법사는 J2EE 1.3 스펙 레벨 EJB 자원에서 J2EE 1.4 스펙 레벨로의 엔터프라이즈 Bean 전개 설명자의 이주를 지원합니다. Stateless 세션 Bean 및 메시지 구동 Bean이 J2EE 1.4로 이주됩니다.

세션 Bean 이주

J2EE 이주 마법사는 J2EE 1.3에서 EJB 프로젝트의 webservices.xml 설명자에서 서비스 인터페이스 엔드포인트(SEI)로 정의된 Stateless 세션 Bean을, Stateless 세션 Bean에 SEI를 설정하여 J2EE 1.4 스펙 레벨로 이주합니다.

J2EE 1.4 스펙에서는 세션 Bean이 웹 서비스 엔드포인트로 사용될 경우 Stateless 세션 Bean에 SEI가 정의되어 있어야 합니다. EJB JAR 파일 이주 중, EJB 프로젝트의 모든 세션 Bean은 서비스 엔드포인트가 EJB 프로젝트의 webservices.xml 설명자에서 사용되는 이름으로 설정됩니다. 다음은 EJB 프로젝트의 메타데이터가 J2EE 1.4 스펙 레벨로 이주하기 전후의 내용을 보여주는 예제입니다.

J2EE 1.3의 EJB 프로젝트: 이주 전에 웹 서비스 엔드포인트 인터페이스로 사용되는 Stateless 세션 Bean을 갖는 webservices.xml 설명자

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE webservices PUBLIC "-//IBM Corporation, Inc.//DTD J2EE 웹 서비스 1.0//EN" 
"http://www.ibm.com/webservices/dtd/j2ee_web_services_1_0.dtd">
   <webservices id="WebServices_1084831328093">
      <webservice-description id="WebServiceDescription_1084831328093">
         <webservice-description-name>EchoEJBService</webservice-description-name>
         <wsdl-file>META-INF/wsdl/EchoEJB.wsdl</wsdl-file>
         <jaxrpc-mapping-file>META-INF/EchoEJB_mapping.xml</jaxrpc-mapping-file>
         <port-component id="PortComponent_1084831328103">
            <port-component-name>EchoEJB</port-component-name>
            <wsdl-port id="WSDLPort_1084831328103">
               <namespaceURI>http://test</namespaceURI>
               <localpart>EchoEJB</localpart>
            </wsdl-port>
            <service-endpoint-interface>test.EchoEJB</service-endpoint-interface>
            <service-impl-bean id="ServiceImplBean_1084831328103">
               <ejb-link>EchoEJB</ejb-link>
            </service-impl-bean>
         </port-component>
      </webservice-description>
   </webservices>
위 예제의 <service-endpoint-interface><service-impl-bean> 태그는 이주 전에 J2EE 1.3 스펙 레벨에서 Stateless 세션 Bean "EchoEJB"를 웹 서비스 설명자의 서비스 엔드포인트로 정의합니다.

J2EE 1.4의 EJB 프로젝트: 이주 프로세스에 의해 작성된 서비스 엔드포인트 인터페이스를 사용하는 동일 Stateless 세션 Bean "EchoEJB"에 대한 EJB 전개 설명자

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
	<display-name>
	EchoEJBProject</display-name>
	<enterprise-beans>
		<session id="EchoEJB">
			<ejb-name>EchoEJB</ejb-name>
			<home>test.EchoEJBHome</home>
			<remote>test.EchoEJB</remote>
			<service-endpoint>test.EchoEJB</service-endpoint>
			<ejb-class>test.EchoEJBBean</ejb-class>
			<session-type>Stateless</session-type>
			<transaction-type>Container</transaction-type>
		</session>
	</enterprise-beans>
</ejb-jar>
위 예제의 <service-endpoint> 태그는 "EchoEJB"를 이주 후의 J2EE 1.4 스펙 레벨에서 서비스 엔드포인트로 정의합니다.

메시지 구동 Bean 이주

J2EE 이주 마법사는 EJB 2.0 메시지 구동 Bean에서 EJB 2.1 JMS(Java™ Message Service) 유형 메시지 구동 Bean으로의 이주를 지원합니다.

메시지 구동 Bean은 JMS(Java Message Service)로부터의 비동기 메시지 처리를 지원하기 위해 EJB 2.0에 소개되었습니다. EJB 2.1 스펙은 메시지 구동 Bean의 정의를 확장하여 JMS 외에도 모든 메시징 시스템을 지원할 수 있습니다.

다음은 이주된 EJB 2.0 메시지 구동 Bean 아티팩트입니다.
  • acknowledgeMode
  • messageSelector
  • destinationType
  • subscriptionDurablity
EJB 2.0 메시지 구동 Bean 요소의 일부는 activation-config 특성으로 바뀝니다. 메시징 서비스를 설명하기 위해 activation-config 특성에 사용된 특성 이름 및 값은 사용되는 메시지 서비스 유형에 따라 다릅니다. 그러나 EJB 2.1은 JMS 기반의 메시지 구동 Bean에 대해 고정된 특성 세트를 정의합니다.

다음은 EJB 2.1에서 요소가 표시되는 방식과 EJB 2.0의 샘플 Bean 요소를 비교하는 예제입니다.

EJB 2.0에서의 메시지 구동 Bean 요소 예제:

<message-driven id="Mdb20">
	  <ejb-name>Mdb</ejb-name>
	  <ejb-class>ejbs.MdbBean</ejb-class>
	  <transaction-type>Bean</transaction-type>
	  <message-selector>mdbMessage</message-selector>
	  <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
	  <message-driven-destination>
		<destination-type>javax.jms.Topic</destination-type>
		<subscription-durability>Durable</subscription-durability>
	   </message-driven-destination>
</message-driven>

EJB 2.1에서의 메시지 구동 Bean 요소 예제:

    <message-driven id="Mdb21">
  <ejb-name>Foo/ejb-name>
  <ejb-class>ejbs.FooBean</ejb-class>
   <messaging-type>javax.jms.MessageListener</messaging-type>
   <transaction-type>Bean/transaction-type>
   <message-destination-type>javax.jms.Topic</message-destination-type>
    <activation-config>
	  <activation-config-property>
	   <activation-config-property-name>destinationType</activation-config-property-name>
	   <activation-config-property-value>javax.jms.Topic</activation-config-property-value>
	  </activation-config-property>
	  <activation-config-property>
	   <activation-config-property-name>subscriptionDurability</activation-config-property-name>
	     <activation-config-property-value>Durable</activation-config-property-value>
	  </activation-config-property>
	  <activation-config-property>
	     <activation-config-property-name>acknowledgeMode</activation-config-property-name>
	     <activation-config-property-value>AutoAcknowledge</activation-config-property-value>
	  </activation-config-property>
	  <activation-config-property>
		<activation-config-property-name>messageSelector</activation-config-property-name>
		<activation-config-property-value>fooSelector</activation-config-property-value>
	  </activation-config-property>
</activation-config>
</message-driven>
관련 참조
웹 프로젝트(Servlet 레벨 2.3에서 Servlet 레벨 2.4로)
커넥터 프로젝트(JCA 1.0에서 JCA 1.5로)
웹 서비스(J2EE 1.3에서 J2EE 1.4로)
J2EE 1.3에서 1.4 스펙 레벨로의 이주
이용약관 | 피드백
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.