com.poscoict.glueframework.dao.manager
Class GlueQueryLoader

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

public class GlueQueryLoader
extends Object
implements GlueCacheLoader, InitializingBean

CacheLoader ±¸Çöü. Äõ¸®Á¤º¸(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 : (¼±ÅÃ)
 
 - loadDesc : (¼±ÅÃ) default´Â 'false'
             true ÀÎ °æ¿ì GlueQuery File¿¡¼­ desc Á¤º¸¸¦ GlueQueryDefinition¿¡ Ãß°¡ÇϹǷΠ´ÙÀ½ ÄÚµå »ç¿ë °¡´ÉÇÔ.
             Strin desc = dao.getQueryManager().getQueryDefinition("emp.select").getDescription();
 
 
 ¿¹Á¦
 »ç¿ë ¿¹# 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¿ÜÀÇ query ÆÄÀÏÀ» ·ÎµùÇÔ. jar ÆÄÀϾȿ¡ master-query/easyaccess-query.glue_sql ÀÌ ÀÖÀ½.
 
     <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>
 
 
 »ç¿ë ¿¹# 4
 - GlueQuery File¿¡¼­ desc Á¤º¸µµ GlueQueryDefinition¿¡ Ãß°¡ÇÒ °æ¿ì
 
     <bean id="queryLoader" class="com.poscoict.glueframework.dao.manager.GlueQueryLoader">
         <property name="loadDesc" value="true"/>
     </bean>
 
 
 
 Âü°í : {name}-query.glue_sql
 
     <query id="emp.select" desc="Type #1" resultType="" isNamed="false">
         <![CDATA[
               select EMPNO, ENAME, JOB, MGR, HIREDATE, SAL,DEPTNO
               from EMP
               where DEPTNO=?
         ]]>
     </query>
 


Field Summary
protected static String QUERYMAP
          Deprecated. 
 
Constructor Summary
GlueQueryLoader()
           
 
Method Summary
 void afterPropertiesSet()
          ÁÖ¾îÁø Á¤º¸·Î Äõ¸®ÆÄÀÏ('*.glue_sql') List¸¦ ±¸¼ºÇÑ´Ù. rootPath(default´Â 'query')¿¡ Á¸ÀçÇÏ´Â ¸ðµç Äõ¸®ÆÄÀÏÀÌ ÇØ´çÇÑ´Ù.
 String getRootPath()
          getter method.
 Object loadCacheObject(Object cacheKey, String regionName)
          ÁÖ¾îÁø ij½¬ ¿µ¿ª¸í¿¡ ÇØ´çÇϴ ij½¬¿µ¿ª¿¡¼­ ij½¬ Å°¸¦ »ç¿ëÇÏ¿© ¿ÀºêÁ§Æ®¸¦ ·ÎµùÇÔ
 void setExtraQueryFiles(List<String> extraQueryFiles)
          setter method for DI.
 void setLoadDesc(boolean loadDesc)
          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

@Deprecated
protected static final String QUERYMAP
Deprecated. 
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
ÁÖ¾îÁø ij½¬ ¿µ¿ª¸í¿¡ ÇØ´çÇϴ ij½¬¿µ¿ª¿¡¼­ ij½¬ Å°¸¦ »ç¿ëÇÏ¿© ¿ÀºêÁ§Æ®¸¦ ·ÎµùÇÔ

Specified by:
loadCacheObject in interface GlueCacheLoader
Parameters:
cacheKey - ij½¬ Å°
regionName - ij½¬ ¿µ¿ª¸í
Returns:
ij½¬µÈ ¿ÀºêÁ§Æ®
Throws:
GlueException - - ij½¬°ü·Ã ¿¡·¯¹ß»ý ½Ã

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 -

setLoadDesc

public void setLoadDesc(boolean loadDesc)
setter method for DI.

Parameters:
loadDesc -

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
ÁÖ¾îÁø Á¤º¸·Î Äõ¸®ÆÄÀÏ('*.glue_sql') List¸¦ ±¸¼ºÇÑ´Ù. rootPath(default´Â 'query')¿¡ Á¸ÀçÇÏ´Â ¸ðµç Äõ¸®ÆÄÀÏÀÌ ÇØ´çÇÑ´Ù.
 
 URL url = GlueFileResourceUtil.getResource( "query" );
 logger.trace( "{}' url : {}", rootPath, url ); ÀÇ °á°ú·Î Á¤¸®ÇÔ.
 
 [was] º° [url °ª] 
 Tomcat    : file:/C:/apache-tomcat-7.0.47/work/Catalina/localhost/sample-ui/WEB-INF/classes/query/
 Tomcat    : file:/C:/apache-tomcat-7.0.47/webapps/sample-ui/WEB-INF/classes/query/
 Tomcat 8  : jar:file:/C:/apache-tomcat-8.0.18/webapps/sample-ui.war!/WEB-INF/classes/query/
 jBoss AS  : vfs:/C:/jboss-eap-6.2/bin/content/sample-ui.war/WEB-INF/classes/query/
 jBoss AS  : vfs:/C:/jboss-eap-6.2/standalone/deployments/sample-ui.war/WEB-INF/classes/query/
 WebLogic  : zip:C:/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_appsdir_sample-ui_war/wq0kqk/war/WEB-INF/lib/_wl_cls_gen.jar!/query
 WebSphere : file:/C:/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/hwangyujin-pcNode01Cell/sample-ui.ear/sample-ui.war/WEB-INF/classes/query/
 Zeus      : 
 java      : jar,  jar:file:/C:/eclipse/workspace-glue-4-sample/sample-schedule-2/build/user-application.jar!/query
 
 
 
(non-Javadoc)

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception
See Also:
InitializingBean.afterPropertiesSet()


Copyright © 2013–2017 POSCO ICT. All rights reserved.