com.poscoict.glueframework.dao.manager
Class GlueQueryLoader

java.lang.Object
  extended by com.poscoict.glueframework.dao.manager.GlueQueryLoader
All Implemented Interfaces:
GlueCacheLoader, org.springframework.beans.factory.InitializingBean

public class GlueQueryLoader
extends Object
implements GlueCacheLoader, org.springframework.beans.factory.InitializingBean

쿼리정보(GlueQueryDefinition)를 로딩하여 서비스하는 클래스.
config path에 존재하는 모든 xxx-query.glue_sql( or xxx-query.xml ) 파일 정보를 로딩하여 GlueQueryDefinition 을 생성한 후 java.util.HashMap을 구성한다.
config path에 존재하는 query file의 naming 및 확장자에 유의한다. Application do not use this class.

 bean property 설정
 - rootPath : (선택) default는 'query'
 
 - extraQueryFiles : (선택)
 
 
 
 [sample]
 
 사용예 1 : application의 classpath에서 query 폴더에 있는 쿼리파일을 로딩함.
 <bean id="queryLoader" class="com.poscoict.glueframework.dao.manager.GlueQueryLoader"/>
 
 사용예 2 : application의 classpath에서 rootPath 로 지정된 폴더에 있는 쿼리파일을 로딩함.
 <bean id="queryLoader" class="com.poscoict.glueframework.dao.manager.GlueQueryLoader">
   <property name="rootPath" value = "ext/query"/>
 </bean>
 
 사용예 3 : application의 classpath에서 rootPath 로 지정된 property에 해당하는 폴더에 있는 쿼리파일을 로딩함.
 <bean id="queryLoader" class="com.poscoict.glueframework.dao.manager.GlueQueryLoader">
   <property name="rootPath" value = "queryLoader.rootPath"/>
 </bean>
 queryLoader.rootPath=ext/query 라고 glue.properties에 정의되어 있어야 함.
 
 사용예 4 : application의 classpath의 rootPath외의 query 파일을 로딩함.
 <bean id="queryLoader" class="com.poscoict.glueframework.dao.manager.GlueQueryLoader">
   <property name="extraQueryFiles">
     <list>
       <value>master-query/easyaccess-query.glue_sql</value>
     </list>
   </property>
 </bean>
 glue-master.jar에 master-query/easyaccess-query.glue_sql 이 있고, 해당 jar파일은 classpath에 잡혀 있음.
 
 


Field Summary
protected static String QUERYMAP
          xxx-query.glue_sql
 
Constructor Summary
GlueQueryLoader()
           
 
Method Summary
 void afterPropertiesSet()
           
 String getRootPath()
          getter method.
 Object loadCacheObject(Object cacheKey, String regionName)
          주어진 캐쉬 영역명에 해당하는 캐쉬영역에서 캐쉬 키를 사용하여 오브젝트를 로딩함
 void setExtraQueryFiles(List<String> extraQueryFiles)
          setter method for DI.
 void setPathEncoding(String pathEncoding)
          setter method for DI.
 void setRootPath(String queryRoot)
          setter method for DI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUERYMAP

protected static final String QUERYMAP
xxx-query.glue_sql

See Also:
Constant Field Values
Constructor Detail

GlueQueryLoader

public GlueQueryLoader()
Method Detail

loadCacheObject

public Object loadCacheObject(Object cacheKey,
                              String regionName)
                       throws GlueException
Description copied from interface: GlueCacheLoader
주어진 캐쉬 영역명에 해당하는 캐쉬영역에서 캐쉬 키를 사용하여 오브젝트를 로딩함

Specified by:
loadCacheObject in interface GlueCacheLoader
Parameters:
cacheKey - 캐쉬 키
regionName - 캐쉬 영역명
Returns:
캐쉬된 오브젝트
Throws:
GlueException - - 캐쉬관련 에러발생 시

setRootPath

public void setRootPath(String queryRoot)
setter method for DI.
 <bean id="queryLoader" class="com.poscoict.glueframework.dao.manager.GlueQueryLoader">
     <property name="rootPath" value="ext/query"/>
 </bean>
 

Parameters:
queryRoot - 2가지 type이 가능. directory의 구분자는 슬래시(/)인지 역슬래시(\)인지 확인필요함.
 1. Class Loader를 이용한 상대경로 지정
 <property name="rootPath" value="ext/query"/> 일 경우 
     ==> Thread.currentThread().getContextClassLoader().getResource( "ext/query" ) 가 사용됨. 
 2. glue.properties 이용한 절대 경로 지정
 
     ext/query=C://apache-tomcat-7.0.47
     ==> Thread.currentThread().getContextClassLoader().getResource( "C://apache-tomcat-7.0.47" ) 가 사용됨.
 

setExtraQueryFiles

public void setExtraQueryFiles(List<String> extraQueryFiles)
setter method for DI.

Parameters:
extraQueryFiles -

setPathEncoding

public void setPathEncoding(String pathEncoding)
setter method for DI.

Parameters:
pathEncoding -

getRootPath

public String getRootPath()
getter method.

Returns:
rootPath

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception


Copyright © 2013–2014 POSCO ICT SW제품기술팀. All rights reserved.