기타

이번 장에서는 Glue Framework 기반의 application 개발시 알아야 할 주요 파일들을 다룬다

  1. glue-config.xml
  2. applicationContext.xml
  3. web.xml
  4. dispatcher-servlet.xml
  5. GlueService.xsd
  6. GlueQuery.xsd
  7. GlueLayout.xsd
  8. jaxws-server-endpoint.xml.xml
  9. portlet.xml
  10. portlet-name-portlet.xml
  11. quartz-scheduler.xml
  12. spring-scheduler.xml
  13. glue.properties
  14. license_info_desc.xml

glue-config.xml

glue-config.xmlGlue Plug-In과 관련된 설정 정보로 구성되어 있습니다.
glue-config.xml 파일은 GlueSDK에 포함되어 있으며, Eclipse IDE의 Preference에서 SDK Location(GlueSDK_HOME 이라 함)이 지정되면, Glue Plug-In은 GlueSDK_HOME/config/glue-config.xml 의 내용을 이용합니다.
glue-config.xml 은 activities와 common 으로 구성되어 있습니다. activities 에서는 n개의 activity로 구성되어 있습니다. common은 document, service, query, class-generator, activity-template 로 구성되어 있습니다.
glue-config.xml 의 XML Schema 정의(xsd)를 따르며, GluePluginConfig.xsd 파일은 glue-schema 모듈에 포함되어 있습니다. glue-schema 모듈은 GlueSDK_HOME/lib/gluelib/glue-schema-[version].jar 파일이며, jar 파일내 schemaorg_apache_xmlbeans/src 위치에서 GluePluginConfig.xsd 를 찾을 수 있습니다.

<?xml version="1.0" encoding="UTF-8"?>
<glue-eclise-config
    xmlns="http://www.poscoict.com/glueframework/plugin/config"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.poscoict.com/glueframework/plugin/config
                        GluePluginConfig.xsd ">
    <activities>
        <activity name="Router" icon="icons/activity_router.gif" addSeperator="true">
            <bubble-tip>Default Router Activity</bubble-tip>
            <template>Glue Router template</template>
            <color>green</color>
            <default-properties>
                <property name="class" 
                 value="com.poscoict.glueframework.biz.activity.GlueDefaultRouter" />
            </default-properties>
        </activity>
        <activity name="SubService" icon="icons/activity_subservice.gif">
            <bubble-tip>SubService Activity</bubble-tip>
            <template>Glue SubService template</template>
            <color>lightBlue</color>
            <default-properties>
                <property name="class" 
                 value="com.poscoict.glueframework.biz.activity.GlueSubService" />
                <property name="service-name" value="sample-service" />
                <property name="new-transaction" value="false" />
            </default-properties>
        </activity>
        <!-- 생략  -->
    </activities>
    <common>
        <document>
            <file-type>EUC-KR</file-type>
            <project-name>project-name</project-name>
            <phase>phase</phase>
            <task-name>task-name</task-name>
            <service-id>service-id</service-id>
            <current-date>current-date</current-date>
            <service-brief>service-brief</service-brief>
            <activity-subject>activity-subject</activity-subject>
            <activity-description>activity-description</activity-description>
        </document>
        <service>
            <file-type>UTF-8</file-type>
        </service>
        <query>
            <file-type>UTF-8</file-type>
        </query>
        <class-generator>
            <exclude-package>com.poscoict.glueframework</exclude-package>
        </class-generator>
        <activity-template>
            <![CDATA[ 
package #PACKAGE#;

import com.poscoict.glueframework.biz.activity.GlueActivity;
import com.poscoict.glueframework.biz.control.GlueBizControlConstants;
import com.poscoict.glueframework.context.GlueContext;

public class #CLASS# extends GlueActivity<GlueContext> {
    // Do not define the Class Member Variable!!
    public String runActivity(GlueContext ctx) {
        this.logger.info("test");

        return GlueBizControlConstants.SUCCESS;
    }
}
            ]]>
        </activity-template>
    </common>
</glue-eclise-config>

applicationContext.xml

Glue Framework은 spring 기반의 개발 프레임워크이며, application개발시 applicationContext.xml을 항상 필요로 한다. 그리고 applicationContext.xml에는 serviceManager bean을 포함해야 한다.
다음은 serviceManager를 갖고 있는 applciationContext.xml 의 내용이다. XML 스키마(xsd, XML Schema Definition) 기반의 applicationContext.xml을 사용하고 있다. XML 스키마 대신 DTD를 기반으로 해도 되나, 확장성을 위해 XML 스키마 사용을 권장한다.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                  http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
    <bean id="serviceManager" class="com.poscoict.glueframework.biz.control.GlueServiceManagerImpl">
        <property name="cacheManager" ref="cacheManager" />
        <property name="serviceLoader" ref="serviceLoader" />
    </bean>
    <bean id="cacheManager" class="com.poscoict.glueframework.cache.ehcache.GlueEhCacheManager"/>
    <bean id="serviceLoader" class="com.poscoict.glueframework.biz.control.GlueServiceLoader"/>
</beans>

다음은 DTD(Document Type Definition) 기반의 applicationContext.xml 입니다.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <bean id="serviceManager" class="com.poscoict.glueframework.biz.control.GlueServiceManagerImpl">
        <property name="cacheManager" ref="cacheManager" />
        <property name="serviceLoader" ref="serviceLoader" />
    </bean>
    <bean id="cacheManager" class="com.poscoict.glueframework.cache.ehcache.GlueEhCacheManager"/>
    <bean id="serviceLoader" class="com.poscoict.glueframework.biz.control.GlueServiceLoader"/>
</beans>

web.xml

web application 에서 web.xml 이라 불리는 deployment descriptor는 WEB-INF 디렉토리에 위치해야 한다.
다음은 Eclipse IDE(Eclipse Java EE IDE for Web Developers, Kepler버전)를 통해 servlet spec 별로 생성되는 default web.xml이다.

  • Servlet Spec 3.0 일 경우
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xmlns="http://java.sun.com/xml/ns/javaee" 
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
                                 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
             id="WebApp_ID" 
             version="3.0">
      <display-name>sample</display-name>
      <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
      </welcome-file-list>
    </web-app>
    
  • Sevlet Spec 2.5 일 경우
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xmlns="http://java.sun.com/xml/ns/javaee" 
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
                                 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
             id="WebApp_ID" 
             version="2.5">
      <display-name>test</display-name>
      <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
      </welcome-file-list>
    </web-app>
    
  • Servlet Spec 2.4 일 경우
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" 
         version="2.4" 
         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/web-app_2_4.xsd">
        <display-name>test</display-name>
        <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.htm</welcome-file>
            <welcome-file>index.jsp</welcome-file>
            <welcome-file>default.html</welcome-file>
            <welcome-file>default.htm</welcome-file>
            <welcome-file>default.jsp</welcome-file>
        </welcome-file-list>
    </web-app>
    
  • Servlet Spec 2.3 일 경우
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app id="WebApp_ID">
        <display-name>test</display-name>
        <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.htm</welcome-file>
            <welcome-file>index.jsp</welcome-file>
            <welcome-file>default.html</welcome-file>
            <welcome-file>default.htm</welcome-file>
            <welcome-file>default.jsp</welcome-file>
        </welcome-file-list>
    </web-app>
    

dispatcher-servlet.xml

  • SimpleUrlHandlerMapping 를 사용한 경우
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                            http://www.springframework.org/schema/context
                            http://www.springframework.org/schema/context/spring-context-3.2.xsd
                            http://www.springframework.org/schema/mvc
                            http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
                            http://www.directwebremoting.org/schema/spring-dwr
                            http://www.directwebremoting.org/schema/spring-dwr-3.2.xsd">
    
        <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            <property name="mappings">
                <value>
                    /*.mvc=controller
                </value>
            </property>
        </bean>
        <bean id="controller" class="com.poscoict.glueframework.web.control.spring.GlueSimpleController" />
        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="prefix" value="/springmvc/" />
            <property name="suffix" value=".jsp" />
        </bean>
    </beans>
    
  • BeanNameUrlHandlerMapping 를 사용한 경우
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
                            http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                            http://www.springframework.org/schema/context
                            http://www.springframework.org/schema/context/spring-context-3.2.xsd
                            http://www.springframework.org/schema/mvc
                            http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
                            http://www.directwebremoting.org/schema/spring-dwr
                            http://www.directwebremoting.org/schema/spring-dwr-3.2.xsd">
    
        <bean id="urlMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>
        <bean id="/hello.mvc" class="com.poscoict.glueframework.web.control.spring.GlueSimpleController" />
        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="prefix" value="/springmvc/" />
            <property name="suffix" value=".jsp" />
        </bean>
    </beans>
    

XML Schema

다음은 Glue에서 정의한 XML스키마입니다.

  • GlueService.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://www.poscoict.com/glueframework/service"
        targetNamespace="http://www.poscoict.com/glueframework/service"
        elementFormDefault="qualified">
    
        <xsd:element name="service">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element name="transaction-manager" minOccurs="0" maxOccurs="unbounded">
                        <xsd:complexType>
                            <xsd:attribute name="id" type="xsd:string" use="required" />
                            <xsd:attribute name="commit" type="xsd:boolean" use="required" />
                        </xsd:complexType>
                    </xsd:element>
                    <xsd:element name="activity" minOccurs="1" maxOccurs="unbounded">
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name="transition" minOccurs="1" maxOccurs="unbounded">
                                    <xsd:complexType>
                                        <xsd:attribute name="name" type="xsd:string" use="required" />
                                        <xsd:attribute name="value" type="xsd:string" use="required" />
                                    </xsd:complexType>
                                </xsd:element>
                                <xsd:element name="property" minOccurs="0" maxOccurs="unbounded">
                                    <xsd:complexType>
                                        <xsd:attribute name="name" type="xsd:string" use="required" />
                                        <xsd:attribute name="value" type="xsd:string" use="required" />
                                    </xsd:complexType>
                                </xsd:element>
                            </xsd:sequence>
                            <xsd:attribute name="name" type="xsd:string" use="required" />
                            <xsd:attribute name="class" type="xsd:string" use="required" />
                        </xsd:complexType>
                    </xsd:element>
                </xsd:sequence>
                <xsd:attribute name="name" type="xsd:string" use="required" />
                <xsd:attribute name="initial" type="xsd:string" use="required" />
            </xsd:complexType>
        </xsd:element>
    </xsd:schema>
    
  • GlueQuery.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://www.poscoict.com/glueframework/query"
        targetNamespace="http://www.poscoict.com/glueframework/query" elementFormDefault="qualified">
        <xsd:element name="queryMap">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element name="query" minOccurs="0" maxOccurs="unbounded">
                        <xsd:complexType>
                            <xsd:simpleContent>
                                <xsd:extension base="xsd:string">
                                    <xsd:attribute name="id" type="xsd:string" use="required" />
                                    <xsd:attribute name="desc" type="xsd:string" use="optional" />
                                    <xsd:attribute name="resultType" type="xsd:string" use="optional" />
                                    <xsd:attribute name="isNamed" type="xsd:boolean" use="optional" />
                                </xsd:extension>
                            </xsd:simpleContent>
                        </xsd:complexType>
                    </xsd:element>
                </xsd:sequence>
                <xsd:attribute name="desc" type="xsd:string" use="optional" />
            </xsd:complexType>
        </xsd:element>
    </xsd:schema>
    
  • GlueLayout.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://www.poscoict.com/glueframework/layout"
        targetNamespace="http://www.poscoict.com/glueframework/layout"
        elementFormDefault="qualified">
    
        <xsd:element name="msgs">
            <xsd:complexType>
                <xsd:all>
                    <xsd:element name="msg" minOccurs="1" maxOccurs="1">
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name="attribute" type="attributeType" minOccurs="1" maxOccurs="unbounded"/>
                            </xsd:sequence>
                            <xsd:attribute name="id" type="xsd:string" use="required" />
                            <xsd:attribute name="name" type="xsd:string" use="optional" />
                        </xsd:complexType>
                    </xsd:element>
                </xsd:all>
            </xsd:complexType>
        </xsd:element>
    
        <xsd:complexType name="attributeType">
            <xsd:attribute name="type" use="required" >
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="E"/>
                        <xsd:enumeration value="G"/>
                        <xsd:enumeration value="GE"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="seq" use="required">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:integer">
                        <xsd:minInclusive value="1"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="id" type="xsd:string" use="required" />
            <xsd:attribute name="name" type="xsd:string" use="required" />
            <xsd:attribute name="datatype" use="required">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="STRING"/>
                        <xsd:enumeration value="NUMBER"/>
                        <xsd:enumeration value="DATE"/>
                        <xsd:enumeration value="ARRAY"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="length" use="required">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:integer">
                        <xsd:minInclusive value="1"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
            <xsd:attribute name="precision" use="optional">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:integer">
                        <xsd:minInclusive value="0"/>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:attribute>
        </xsd:complexType>
    </xsd:schema>
    

glue.properties

glue.properties 는 key, value로 구성된 텍스트 파일이며, 일부 예약어를 제외하고 사용자가 얼마든지 추가할 수 있습니다.
다음은 Glue Framework에서 예약한 Glue Property 입니다.

  • audit.insert.key : dao 사용시 audit data와 관련된 property
  • audit.update.key : dao 사용시 audit data와 관련된 property
  • default.file.dir : 상대경로의 File 처리 activity 와 관련된 property
  • default.msg.locale : 다국어 관련 property
  • default.ui.locale : 다국어 관련 property
  • max.upload.file.size : File 처리 activity 와 관련된 property
  • msg.parsing.type : ParseMessage, CreateMessage activity와 관련된 property
  • ucube4.servicebroker.receiver.tcid.length : u-CUBE4 의 Service Broker와 관계된 property
  • glue.custom.property : Custom Property 파일과 관련된 property (GlueAPI 참고)