ServiceLoader 설정

Application의 용도에 따라 GlueService Meta와 관련된 bean 설정을 수정합니다.
Web Appliclation 용도일 경우엔 MetaData 동기화와 관련된 Cache 설정도 수정합니다.

  1. Web Application 용
  2. Scheduled Job Application 용
  • serviceLoaderclass 속성 값은 com.posco.glue.reuse.PoscoServiceLoader 로 변경합니다.
    serviceLoaderdataSource property의 값은 Meta용 DataSource를 참고하도록 합니다.
    serviceLoaderqueryExtraBindingInfo property의 값은 법인코드를 입력합니다( 상수, 변수 가능)
    queryLoaderextraQueryFiles property에 libquery/posco-meta-access-query.glue_sql 를 추가합니다.
    <bean id="serviceLoader" class="com.posco.glue.reuse.PoscoServiceLoader">
        <property name="dataSource" ref=". . ."/>
        <property name="queryManager" ref="queryManager"/>
        <property name="queryExtraBindingInfo">
            <list>
                <value>. . .</value>
            </list>
        </property>
    </bean>
    . . .
    <bean id="queryLoader" class="com.poscoict.glueframework.dao.manager.GlueQueryLoader">
        <property name="extraQueryFiles">
            <list>
                . . .
                <value>libquery/posco-meta-access-query.glue_sql</value>
            </list>
        </property>
    </bean>
    

    serviceLoaderdataSource property의 값은 다음과 같이 2가지 중 하나로 설정할 수 있습니다.

    1. Web Application 용의 dataSource

      <bean id="serviceLoader" class="com.posco.glue.reuse.PoscoServiceLoader">
          <property name="dataSource" ref="m0a-ds"/>
          . . .
      </bean>
      <bean id="m0a-ds" class="org.springframework.jndi.JndiObjectFactoryBean"> 
          <property name="jndiName" value="jdbc/rw/M00A10DS"/> 
          . . . 
      </bean>
      
    2. Scheduled Job Application 용의 dataSource

      <bean id="serviceLoader" class="com.posco.glue.reuse.PoscoServiceLoader">
          <property name="dataSource" ref="m0a-ds"/>
          . . .
      </bean>
      <bean id="m0a-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
          <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
          <property name="url" value=". . ." />
          <property name="username" value=". . ." />
          <property name="password" value=". . ." />
          <property name="defaultAutoCommit" value="false" />
          <property name="minIdle" value="0" />
          <property name="maxActive" value="-1" />
          <property name="maxIdle" value="1000" />
      </bean>
      

    serviceLoaderqueryExtraBindingInfo property의 값은 다음과 같이 2가지 중 하나로 설정할 수 있습니다.

    1. 상수 사용 queryExtraBindingInfo

      <bean id="serviceLoader" class="com.posco.glue.reuse.PoscoServiceLoader">
          . . .
          <property name="queryExtraBindingInfo">
              <list>
                  <value>BZ</value>
              </list>
          </property>
      </bean>
      
    2. 변수 사용 queryExtraBindingInfo

      <bean id="serviceLoader" class="com.posco.glue.reuse.PoscoServiceLoader">
          . . .
          <property name="queryExtraBindingInfo">
              <list>
                  <value>${GCS_COMP_CODE}</value>
              </list>
          </property>
      </bean>
      

CacheManager 설정

Application의 용도에 따라 캐싱과 관련된 bean 및 설정파일(ehcache.xml)을 수정합니다.
Web Appliclation 용도일 경우엔 MetaData 동기화 기능을 사용하기 위해 다음과 같이 수정합니다.

  • cacheManager 의 bean에 location property를 추가합니다(MetaData 동기화와 관련된 설정을 위해 ehcache.xml은 war에 패키징 하지 않습니다).
    <bean id="cacheManager" class="com.poscoict.glueframework.cache.ehcache.GlueEhCacheManager">
        <property name="location" value="file:${CONFIG_PATH}/ehcache.xml"/>
    </bean>
    
  • MetaData 동기화와 관련된 설정을 위해, ehcache.xml 에 cacheManagerPeerListenerFactory 을 다음과 같이 추가합니다.
    cacheManagerPeerListenerFactoryproperties 속성의 hostName과 port 정보는 Meta Manager(M0AA20APP.ear)의 ehcache.xml 에 rmiUrls에 포함됩니다. (참고)
    <?xml version="1.0" encoding="UTF-8"?>
    <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
        updateCheck="false" name="__DEFAULT__">
        <cacheManagerPeerListenerFactory
            class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
            properties="hostName=172.31.47.161, port=40001, socketTimeoutMillis=2000" />
        <cache ...>
    </ehcache>
    
  • MetaData 동기화와 관련된 설정을 위해, ehcache.xml 에 <cache name="_service-region"..> 부분을 다음과 같이 수정합니다.
    cacheeternal 속성값은 false로 변경되며, 그외 추가 속성이 있습니다.
    cachecacheEventListenerFactory 요소가 추가됩니다.
    <cache name="_service-region" maxElementsInMemory="500" 
           maxElementsOnDisk="0" eternal="false" timeToIdleSeconds="0" timeToLiveSeconds="0" memoryStoreEvictionPolicy="LRU" >
        <cacheEventListenerFactory 
            class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" 
            properties="replicateAsynchronously=true, replicatePuts=false, replicateUpdates=false, replicateUpdatesViaCopy=false, replicateRemovals=false" />
    </cache>
    

applicationContext.xml 예

다음을 참고해서 applicationContext.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.0.xsd">
    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value="file:${CONFIG_PATH}/M60A010WEB.properties" />
        <property name="ignoreUnresolvablePlaceholders" value="true" />
    </bean>
    <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">
        <property name="location" value="file:${CONFIG_PATH}/ehcache.xml"/>
    </bean>
    <bean id="serviceLoader" class="com.posco.glue.reuse.PoscoServiceLoader">
        <property name="dataSource" ref="meta-service-dataSource"/>
        <property name="queryManager" ref="queryManager"/>
        <property name="queryExtraBindingInfo">
            <list>
                <value>${M60A010WEB.serviceLoader.GCS_COMP_CODE}</value>
            </list>
        </property>
    </bean>
    <bean id="meta-service-dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> 
        <property name="jndiName" value="jdbc/rw/M00A10DS"/> 
        <property name="resourceRef" value="false"/> 
    </bean>
    <bean id="queryManager" class="com.poscoict.glueframework.dao.manager.GlueQueryManagerImpl">
        <property name="cacheManager" ref="cacheManager" />
        <property name="queryLoader" ref="queryLoader" />
    </bean>
    <bean id="queryLoader" class="com.poscoict.glueframework.dao.manager.GlueQueryLoader">
        <property name="extraQueryFiles">
            <list>
                <value>libquery/posco-meta-access-query.glue_sql</value>
            </list>
        </property>
    </bean>
</beans>

ehcache.xml 예

다음을 참고해서 ehcache.xml 을 수정합니다. (참고)

<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
    updateCheck="false" name="__DEFAULT__">

    <cacheManagerPeerListenerFactory
        class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
        properties="hostName=172.31.47.146, port=40001, socketTimeoutMillis=2000" />

    <cache name="_default-region" maxElementsInMemory="500" eternal="true" />
    <cache name="_sql-region" maxElementsInMemory="500" eternal="true" />
    <cache name="_message-definition-region" maxElementsInMemory="500" eternal="true" />
    <cache name="_service-region" maxElementsInMemory="500" eternal="false" 
           maxElementsOnDisk="0" timeToIdleSeconds="0" timeToLiveSeconds="0" memoryStoreEvictionPolicy="LRU" >
        <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" 
            properties="replicateAsynchronously=true, replicatePuts=false, replicateUpdates=false, replicateUpdatesViaCopy=false, replicateRemovals=false">
        </cacheEventListenerFactory>
    </cache>
    <cache name="_column-region" maxElementsInMemory="500" eternal="true" />
</ehcache>