1. EJB Ant Task

JEUS를 기반으로 EJB 컴포넌트를 개발할 때 작업을 편리하게 수행할 수 있도록 몇 가지의 Ant Task를 제공한다.

1.1. appcompiler

appcompiler Ant Task는 pre-deployment 작업 후 EJB 모듈 또는 개별적인 EJB Bean에 대해서 필요한 RMI Stub과 Skeleton 클래스를 임의로 생성하는 경우 사용한다. 또한 이것은 클라이언트에서 원격지에 있는 디플로이된 Bean과 통신할 때 필요한 클래스 파일들 즉 EJB 클라이언트 JAR를 생성할 수 있다.

다음은 appcompiler Ant Task 속성에 대한 설명이다.

속성 설명

jeusHome

JEUS_HOME을 설정한다. (String 타입)

client

생성될 Stub 클래스들이 포함될 클라이언트 뷰 파일을 설정한다. (String 타입)

keep

컴파일 과정에서 생성된 소스를 유지할 것인지를 설정한다. (기본값: false)

jspmap

servlet-mapping table(jeus_jspmap.xml)을 생성할 것인지를 설정한다.

(기본값: false)

ejbJar

컴파일할 때 사용할 ejb-jar.xml 파일을 설정한다. (String 타입)

jeusEjbDd

컴파일할 때 사용할 jeus-ejb-dd.xml 파일을 설정한다. (String 타입)

name

deploy에 사용할 이름을 설정한다. (String 타입)

target

컴파일할 대상 애플리케이션, stand-alone 모듈 파일을 설정한다. (필수 입력항목, String 타입)

예제

다음은 build.xml을 작성한 예제와 build.xml을 통해 appcompiler를 실행하는 예제이다.

  • build.xml 작성 예제

    appcompiler Ant Task build 파일 예제 : <build.xml>
    <?xml version="1.0"?>
    
    <project name="example" default="appcompiler" basedir=".">
      <property environment="env"/>
      <!-- jeus.home project property is required
           when you run the various tasks in an ant jvm and
           one of the various tasks requirs JEUS_HOME information -->
      <property name="jeus.home" value="${env.JEUS_HOME}"/>
    
      <!-- set properties to be needed for appcompiler task -->
      <property name="client" value="client_view.jar"/>
      <property name="keep" value="false"/>
      <property name="jspmap" value="false"/>
      <property name="ejbjar" value="ejb-jar.xml"/>
      <property name="jeusejbdd" value="jeus-ejb-dd.xml"/>
      <property name="targetfile" value="ejb"/>
    
      <!-- set the library-classpath or to run the task class -->
      <path id="jeus.libraries">
        <fileset dir="${jeus.home}/lib/system" includes="*.jar"/>
      </path>
    
      <!-- include the task definition resource file -->
      <taskdef resource="jeus/util/ant/jeusant.properties">
        <classpath>
          <path refid="jeus.libraries"/>
        </classpath>
      </taskdef>
    
      <target name="init">
      </target>
    
      <!-- appcompiler task -->
      <target name="appcompiler" depends="init">
        <appcompiler jeusHome="${jeus.home}"
                     client="${client}"
                     keep="${keep}"
                     jspmap="${jspmap}"
                     ejbJar="${ejbjar}"
                     jeusEjbDd="${jeusejbdd}"
                     target="${targetfile}"/>
      </target>
    
    </project>
  • 실행 예제

    $ ant appcompiler
    Buildfile: build.xml
    
    init:
    
    appcompiler:
    
    BUILD SUCCESSFUL
    Total time: 3 minutes 7 seconds

1.2. ejbddinit

ejbddinit Ant Task는 JEUS EJB DD를 생성할 때 이용한다. ejbddinit에 대한 자세한 설명은 ejbddinit을 참고한다.

다음은 ejbddinit Ant Task의 속성에 대한 설명이다.

속성 설명

propertyFile

ejbddinit 실행할 때 참조할 프로퍼티 파일을 지정한다. (String 타입)

logginginglevel

ejbddinit 실행할 때 화면에 출력되는 로그의 레벨을 지정한다.

이 레벨은 Jave SE logging API의 레벨을 따른다. (기본값: INFO)

target

ejbddint 실행 대상이 되는 EJB 모듈의 경로를 지정한다. EJB 모듈은 JAR archive 또는 디렉터리일 수 있다.

(필수 입력항목, 프로퍼티 파일이 Target 정보를 설정한 경우 생략 가능)

ejbddinit Ant Task 스크립트에 제한적으로 ejbddinit 프로퍼티를 설정할 수 있다.

ejbddinit 프로퍼티 파일의 프로퍼티는 ejbddinit Ant Task 스크립트에서 다음과 같은 규칙으로 설정되어야 한다. ejbddinit 프로퍼티에 대한 자세한 내용은 프로퍼티 목록을 참고한다.

ejbddinit 프로퍼티 파일 ejbddinit Ant 스크립트

export-name=%{ejb-class}

<property name="export-name" value="%{ejb-class}"/>

thread-max=100

<property name="thread-max" value="100"/>

HelloBean.export-port=55555

build.xml에서는 특정 EJB 컴포넌트(HelloBean)에 대한 ejbddinit 프로퍼티 설정이 불가능

ejbddinit 프로퍼티 파일과 같이 Ant 스크립트에서도 export-name 프로퍼티에 대하여 "%{ejb-class}"와 같은 패턴을 사용할 수 있다. export-name과 관련된 패턴 사용에 관한 내용은 export-name 프로퍼티에 대한 패턴 지원을 참고한다.

Ant 스크립트에서는 특정 EJB 컴포넌트에 대한 ejbddinit 프로퍼티 설정은 지원하지 않으므로 특정 EJB 컴포넌트에 대한 ejbddinit 프로퍼티 설정이 필요한 경우에는 ejbddinit 프로퍼티 파일을 따로 작성해야 한다. 특정 EJB 컴포넌트에 대한 설정은 ejbddinit 프로퍼티 파일과 Ant 스크립트의 공통 설정보다 우선한다. ejbddinit 프로퍼티 파일과 ejbddinit Ant 스크립트에 동일한 설정이 존재할 경우에는 Ant 스크립트의 설정을 우선한다.

예제

ejbddinit Ant 스크립트 작성 예와 ejbddinit Ant Task를 실행하는 예는 아래와 같다.

  • ejbddinit Ant 스크립트 작성 예

    ejbddinit Ant 스크립트 예제
    <?xml version="1.0"?>
    <project name="example" default="ejbddinit" basedir=".">
      <property environment="env"/>
      <!-- jeus.home project property is required
           when you run the various tasks in an ant jvm and
           one of the various tasks requirs JEUS_HOME information -->
      <property name="jeus.home" value="${env.JEUS_HOME}"/>
    
      <!-- set properties to be needed for ejbddinit task -->
      <property name="targetfile" value="ejb.jar"/>
      <property name="logginglevel" value="FINE"/>
      <property name="propertyfile" value="ejbddinit.properties"/>
    
      <!-- set properties to be needed for ejbddinit properties -->
      <property name="export-name" value="%{ejb-class}"/>
      <property name="thread-max" value="100"/>
    
      <!-- set the library-classpath or to run the task class -->
      <path id="jeus.libraries">
        <fileset dir="${jeus.home}/lib/system" includes="*.jar"/>
      </path>
    
      <!-- include the task definition resource file -->
      <taskdef resource="jeus/util/ant/jeusant.properties">
        <classpath>
          <path refid="jeus.libraries"/>
        </classpath>
      </taskdef>
    
      <target name="init">
      </target>
    
      <!-- ejbddinit task -->
      <target name="ejbddinit" depends="init">
        <ejbddinit loggingLevel="${logginglevel}"
                   property="${propertyfile}"
                   target="${targetfile}"
                   exportName="${export-name}"
                   threadMax="${thread-max}">
        </ejbddinit>
      </target>
    </project>
  • ejbddinit Ant Task 실행 예

    $ ant ejbddinit
    Buildfile: build.xml
    
    init:
    
    ejbddinit:
    [ejbddinit] LoadFile: /jeus/sample/ejbddinit.properties
    [ejbddinit] Source=/jeus/sample/ejbddinit/ejb.jar
    [ejbddinit] Successfully configured the parameters.
    [ejbddinit] Deployment descriptor initialization started.
    [ejbddinit] Creating JEUS descriptors.
    [ejbddinit] Deployment descriptor initialization finished.
    
    BUILD SUCCESSFUL
    Total time: 2 seconds