Class GlueServiceDBLoader
java.lang.Object
com.poscoict.glueframework.biz.control.GlueServiceDBLoader
- All Implemented Interfaces:
GlueCacheLoader
,InitializingBean
CacheLoader 구현체. GlueServiceDBLoader는 Cache에서 해당 Service객체(GlueService)를 찾고 없으면 DB을 읽어서 Cache에 저장한다.
Bean Property
- dataSource : (필수)
- queryManager : (선택)
- queryIdMap : (선택)
예제
사용 예# 1 : 제공된 Table을 사용하는 경우
<bean id="serviceLoader" class="com.poscoict.glueframework.biz.control.GlueServiceDBLoader">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="dataSource" .../>
사용 예# 2 : glue-core에 포함된 query file을 로딩해서 사용할 경우.
<bean id="serviceLoader" class="com.poscoict.glueframework.biz.control.GlueServiceDBLoader">
<property name="dataSource" ref="dataSource"/>
<property name="queryManager" ref="queryManager"/>
</bean>
<bean id="dataSource" .../>
<bean id="queryManager" class="com.poscoict.glueframework.dao.manager.GlueQueryManagerImpl">
<property name="cacheManager" ref="cacheManager" />
<property name="queryLoader" ref="queryLoader" />
</bean>
<bean id="cacheManager" .../>
<bean id="queryLoader" class="com.poscoict.glueframework.dao.manager.GlueQueryLoader">
<property name="extraQueryFiles">
<list>
<value>com/poscoict/glueframework/biz/control/GlueServiceDBLoader-query.glue_sql</value>
</list>
</property>
</bean>
사용 예#3 : Table를 Customizing 한 경우, query file을 추가해서 사용하는 경우.
<bean id="serviceLoader" class="com.poscoict.glueframework.biz.control.GlueServiceDBLoader">
<property name="dataSource" ref="dataSource"/>
<property name="queryManager" ref="queryManager"/>
<property name="queryIdMap">
<map>
<entry key="serviceList" value="meta.service.list.select" />
<entry key="serviceInfo" value="meta.service.select" />
<entry key="transactionManagerInfo" value="meta.tx.select" />
<entry key="activityList" value="meta.activity.select" />
<entry key="transitionInfo" value="meta.transition.select" />
<entry key="propertyInfo" value="meta.property.select" />
</map>
</property>
</bean>
<bean id="dataSource" .../>
<bean id="queryManager" class="com.poscoict.glueframework.dao.manager.GlueQueryManagerImpl">
<property name="cacheManager" ref="cacheManager" />
<property name="queryLoader" ref="queryLoader" />
</bean>
<bean id="cacheManager" .../>
<bean id="queryLoader" class="com.poscoict.glueframework.dao.manager.GlueQueryLoader">
<property name="extraQueryFiles">
<list>
<value>query_user/serviceLoader-query.glue_sql</value>
</list>
</property>
</bean>
참고 : serviceLoader-query.glue_sql
- isNamed="false"임.
- 6개의 query를 작성하며, bindinig은 순서와 개수는 맞춰야함.
- column name 이 다르면 alias를 이용해 맞춰야 함.
<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="serviceLoader용 SQL 예제" xmlns="http://www.poscoict.com/glueframework/query">
<query id="meta.service.list.select" desc="" resultType="" isNamed="false"><![CDATA[select SERVICE_NAME from SERVICE_INFO]]></query>
<query id="meta.service.select" desc="" resultType="" isNamed="false"><![CDATA[select INITIAL_ACTIVITY from SERVICE_INFO where SERVICE_NAME=?]]></query>
<query id="meta.tx.select" desc="" resultType="" isNamed="false"><![CDATA[select TX_NAME, TX_VAL from SERVICE_TX_MAPPING where SERVICE_NAME=?]]></query>
<query id="meta.activity.select" desc="" resultType="" isNamed="false"><![CDATA[select ACTIVITY_NAME, ACTIVITY_CLASS from SERVICE_ACTIVITY_INFO where SERVICE_NAME=?]]></query>
<query id="meta.transition.select" desc="" resultType="" isNamed="false"><![CDATA[select TRANSITION_NAME, TRANSITION_VAL from SERVICE_ACTIVITY_FLOW where SERVICE_NAME=? and ACTIVITY_NAME=?]]></query>
<query id="meta.property.select" desc="" resultType="" isNamed="false"><![CDATA[select PROPERTY_NAME, PROPERTY_VAL from SERVICE_ACTIVITY_PROPERTY where SERVICE_NAME=? and ACTIVITY_NAME=?]]></query>
</queryMap>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
loadCacheObject
(Object cacheKey, String regionName) 주어진 캐쉬 영역명에 해당하는 캐쉬영역에서 캐쉬 키를 사용하여 오브젝트를 로딩함void
setDataSource
(DataSource dataSource) setter method for DI.void
setQueryIdMap
(Map<String, String> queryIdMap) setter method for DI.void
setQueryManager
(GlueQueryManager queryManager) setter method for DI.
-
Constructor Details
-
GlueServiceDBLoader
public GlueServiceDBLoader()생성자(constructor).
-
-
Method Details
-
setDataSource
setter method for DI.- Parameters:
dataSource
-
-
setQueryManager
setter method for DI.- Parameters:
queryManager
-
-
setQueryIdMap
setter method for DI.- Parameters:
queryIdMap
-
-
loadCacheObject
Description copied from interface:GlueCacheLoader
주어진 캐쉬 영역명에 해당하는 캐쉬영역에서 캐쉬 키를 사용하여 오브젝트를 로딩함- Specified by:
loadCacheObject
in interfaceGlueCacheLoader
- Parameters:
cacheKey
- 캐쉬 키regionName
- 캐쉬 영역명- Returns:
- 캐쉬된 오브젝트
- Throws:
GlueException
- 캐쉬관련 에러발생 시
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
Exception
-