com.poscoict.glueframework.context
Class GlueStaticContext

java.lang.Object
  extended by com.poscoict.glueframework.context.GlueStaticContext

public final class GlueStaticContext
extends Object

각종 고정정보에 접근하는 Class. 이 Class는 IoC용 XML은 applicationContext.xml 에 근거에 Bean 인스턴스가 생성되며 사용된다. 이 Class는 그외 Property 정보에 대한 API를 제공한다. 그외 IoC용 XML의 Bean 인스턴스는 GlueBeanFactory를 이용하는 별개의 모듈을 필요하다.


Field Summary
static String config
           
 
Constructor Summary
GlueStaticContext()
           
 
Method Summary
static boolean checkLicense()
          라이선스 유효여부를 확인한다.
static void destroyApplictionContext()
          applicationContext.xml에 정의 되어 있는 Bean Class를 소멸시킨다.
static GlueBeanFactory getBeanFactory()
          applicationContext.xml에 정의 되어 있는 Bean Class를 호출 하기 위한 GlueBeanFactory를 Return 한다.
static String getCustomProperty(String key)
          Custom Properties 파일에서 key에 해당하는 프로퍼티를 얻는다.
static Locale getDefaultLocale(String localeInfo)
          입력값에 근거한 Locale
static Locale getDefaultUILocale()
          glue.properties의 property "default.ui.locale" 에 근거한 Locale
static String getGlueProperty(String key)
          glue.properties에서 Key에 해당하는 Property 값을 Return 한다.
static com.poscoict.license.LicenseAPI.LicenseMode getLicenseMode()
          라이선스 모드를 반환한다.
static String getResourceMessage(String key)
          Locale정보에 근거한 다국어 지원 Method.
static String getResourceMessage(String key, Locale locale)
          Locale정보에 근거한 다국어 지원 Method.
static String getResourceMessage(String key, Object[] arguments)
          Locale정보에 근거한 다국어 지원 Method.
static String getResourceMessage(String key, Object[] arguments, Locale locale)
          Locale정보에 근거한 다국어 지원 Method.
static String getResourceMessage(String beanName, String key, Object[] arguments, Locale locale)
          Locale정보에 근거한 다국어 지원 Method.
static String getSystemProperty(String key)
          SystemProperty는 java를 실행시 -D Option으로 정의한 Property를 의미 한다.
static String getTimeZoneFormat(Date date, int offset)
          해당 TimeZone 기준 날짜.시간 표현 Method.
static String getTimeZoneFormat(Date date, int offset, String textformate)
          해당 TimeZone 기준 날짜.시간 표현 Method.
static String getTimeZoneFormat(Date date, String timezoneid)
          해당 TimeZone 기준 날짜.시간 표현 Method.
static String getTimeZoneFormat(Date date, String timezoneid, String textformate)
          해당 TimeZone 기준 날짜.시간 표현 Method.
static boolean isAudit()
          Audit 설정 유무 확인. glue.properties 파일에 "audit.insert.key" 와 "audit.update.key" 의 존재 유무
static void reloadGlueProperties()
          glue.properties 를 다시 loading 하는 method.
static void reloadLicense()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

public static final String config
See Also:
Constant Field Values
Constructor Detail

GlueStaticContext

public GlueStaticContext()
Method Detail

reloadLicense

public static void reloadLicense()

reloadGlueProperties

public static void reloadGlueProperties()
glue.properties 를 다시 loading 하는 method.


getBeanFactory

public static GlueBeanFactory getBeanFactory()
applicationContext.xml에 정의 되어 있는 Bean Class를 호출 하기 위한 GlueBeanFactory를 Return 한다.
사용 방법은 다음과 같다.
 GlueBeanFactory beanFactory = GlueStaticContext.getBeanFactory();
 GlueGenericDao dao = (GlueGenericDao)beanFactory.getBeanObject("bizdao");
 
 위 내용은 applicatonContext.xml에 다음과 같이 정의 되어 있는 경우
 com.poscoict.glueframework.dao.jdbc.GlueJdbcDao를 Return 하게 된다.
 
 <bean id="bizdao" class="com.poscoict.glueframework.dao.jdbc.GlueJdbcDao">
    <property name="dataSource" ref="dataSource"/>
    <property name="queryManager" ref="queryManager"/>
 </bean>
 
 

Returns:
GlueBeanFactory BeanFactory

destroyApplictionContext

public static void destroyApplictionContext()
applicationContext.xml에 정의 되어 있는 Bean Class를 소멸시킨다.


getSystemProperty

public static String getSystemProperty(String key)
SystemProperty는 java를 실행시 -D Option으로 정의한 Property를 의미 한다.
System.getProperty(key)와 동일한 Return 값을 가진다.

Parameters:
key - System Property key
Returns:
String System Property value

getGlueProperty

public static String getGlueProperty(String key)
glue.properties에서 Key에 해당하는 Property 값을 Return 한다.
glue.properties의 내용은 key=value로 되어 있고 해당 파일은 반드시 CONFIG_PATH에 존재 하여야 한다.

Parameters:
key - glue.properties의 key 값
Returns:
String User Property Value

getCustomProperty

public static String getCustomProperty(String key)
Custom Properties 파일에서 key에 해당하는 프로퍼티를 얻는다.
Custom Properties 파일 지정 방법: glue.properties 파일에 glue.custom.property=d:\\config\\custom.properties 라고 지정한다. 프로퍼티 파일위치 및 파일명은 User가 임의로 부여할 수 있다.

Parameters:
key - 프로퍼티 키
Returns:
프로퍼티 값

getTimeZoneFormat

public static String getTimeZoneFormat(Date date,
                                       int offset)
해당 TimeZone 기준 날짜.시간 표현 Method. Text Format은 Default 값(yyyy-MM-dd HH:mm:ss (z Z))

Parameters:
date - Text 형태로 변환 할 Date
timezoneid - Text 형태로 변환 시 적용 할 TimeZone 시간대 offset값
Returns:
해당 TimeZone 기준 날짜.시간

getTimeZoneFormat

public static String getTimeZoneFormat(Date date,
                                       int offset,
                                       String textformate)
해당 TimeZone 기준 날짜.시간 표현 Method.
 1. 사용법(Java Code)
 Date date = new Date();
 String textformat = "yyyy-MM-dd HH:mm:ss (z Z)";
 System.out.println("+05:00::::"+GlueStaticContext.getTimeZoneFormat(date, 5*60, textformat));
 System.out.println("-06:00::::"+GlueStaticContext.getTimeZoneFormat(date, -6*60, textformat));
 

Parameters:
date - Text 형태로 변환 할 Date
offset - Text 형태로 변환 시 적용 할 TimeZone 시간대 offset값
textformate - Text 형태로 변환 시 적용 될 Text Format (Default 값 : yyyy-MM-dd HH:mm:ss (z Z))
Returns:
해당 TimeZone 기준 날짜.시간

getTimeZoneFormat

public static String getTimeZoneFormat(Date date,
                                       String timezoneid)
해당 TimeZone 기준 날짜.시간 표현 Method. Text Format은 Default 값(yyyy-MM-dd HH:mm:ss (z Z))

Parameters:
date - Text 형태로 변환 할 Date
timezoneid - Text 형태로 변환 시 적용 할 TimeZone ID
Returns:
해당 TimeZone 기준 날짜.시간

getTimeZoneFormat

public static String getTimeZoneFormat(Date date,
                                       String timezoneid,
                                       String textformate)
해당 TimeZone 기준 날짜.시간 표현 Method.
 1. 사용법(Java Code)
 Date date = new Date();
 String textformat = "yyyy-MM-dd HH:mm:ss (z Z)";
 System.out.println("Default::::" + GlueStaticContext.getTimeZoneFormat(date, TimeZone.getDefault().getID(), textformat));
 System.out.println("Asia/Seoul::::" + GlueStaticContext.getTimeZoneFormat(date, "Asia/Seoul", textformat));
 System.out.println("Canada/Eastern::::"+GlueStaticContext.getTimeZoneFormat(date, "Canada/Eastern", textformat));
 System.out.println("Asia/Shanghai::::" + GlueStaticContext.getTimeZoneFormat(date, "Asia/Shanghai", textformat));
 
 

Parameters:
date - Text 형태로 변환 할 Date
timezoneid - Text 형태로 변환 시 적용 할 TimeZone ID
textformate - Text 형태로 변환 시 적용 될 Text Format (Default 값 : yyyy-MM-dd HH:mm:ss (z Z))
Returns:
해당 TimeZone 기준 날짜.시간

getResourceMessage

public static String getResourceMessage(String key)
Locale정보에 근거한 다국어 지원 Method.
 1. applicationContext.xml 의 messageSource bean 정의
 <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
     <property name="basenames">
         <list>
             <value>MyResource</value>
         </list>
     </property>
 </bean>
 
 
 2. MyResource_{locale}.properties 파일 생성
 - MyResource_ko_KR.properties 의 내용
 msg001=안녕하세요
 msg002={0}님, 안녕하세요. {1}번째 접속입니다.
 
 - MyResource_en_US.properties 의 내용
 msg001=Hello
 msg002=Hi, {0}!. {1} times.
 - ...
 
 3. 사용법(Java Code)
 String str = GlueStaticContext.getResourceMessage("msg001");
 

Parameters:
key -
Returns:

getResourceMessage

public static String getResourceMessage(String key,
                                        Object[] arguments)
Locale정보에 근거한 다국어 지원 Method.
 1. applicationContext.xml 의 messageSource bean 정의
 <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
     <property name="basenames">
         <list>
             <value>MyResource</value>
         </list>
     </property>
 </bean>
 
 
 2. MyResource_{locale}.properties 파일 생성
 - MyResource_ko_KR.properties 의 내용
 msg001=안녕하세요
 msg002={0}님, 안녕하세요. {1}번째 접속입니다.
 
 - MyResource_en_US.properties 의 내용
 msg001=Hello
 msg002=Hi, {0}!. {1} times.
 - ...
 
 3. 사용법(Java Code)
 Object obj[] = new Object[]{new String("admin"),new Integer(3)};
 String str = GlueStaticContext.getResourceMessage("msg002", arg);
 

Parameters:
key -
arguments -
Returns:

getResourceMessage

public static String getResourceMessage(String key,
                                        Locale locale)
Locale정보에 근거한 다국어 지원 Method.
 1. applicationContext.xml 의 messageSource bean 정의
 <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
     <property name="basenames">
         <list>
             <value>MyResource</value>
         </list>
     </property>
 </bean>
 
 
 2. MyResource_{locale}.properties 파일 생성
 - MyResource_ko_KR.properties 의 내용
 msg001=안녕하세요
 msg002={0}님, 안녕하세요. {1}번째 접속입니다.
 
 - MyResource_en_US.properties 의 내용
 msg001=Hello
 msg002=Hi, {0}!. {1} times.
 - ...
 
 3. 사용법(Java Code)
 String str = GlueStaticContext.getResourceMessage("msg001", Locale.getDefault());
 

Parameters:
key -
locale -
Returns:

getResourceMessage

public static String getResourceMessage(String key,
                                        Object[] arguments,
                                        Locale locale)
Locale정보에 근거한 다국어 지원 Method.
 1. applicationContext.xml 의 messageSource bean 정의
 <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
     <property name="basenames">
         <list>
             <value>MyResource</value>
         </list>
     </property>
 </bean>
 
 
 2. MyResource_{locale}.properties 파일 생성
 - MyResource_ko_KR.properties 의 내용
 msg001=안녕하세요
 msg002={0}님, 안녕하세요. {1}번째 접속입니다.
 
 - MyResource_en_US.properties 의 내용
 msg001=Hello
 msg002=Hi, {0}!. {1} times.
 - ...
 
 3. 사용법(Java Code)
 Object obj[] = new Object[]{new String("admin"),new Integer(3)};
 String str = GlueStaticContext.getResourceMessage("msg002", arg, Locale.getDefault());
 

Parameters:
key -
arguments -
locale -
Returns:

getResourceMessage

public static String getResourceMessage(String beanName,
                                        String key,
                                        Object[] arguments,
                                        Locale locale)
Locale정보에 근거한 다국어 지원 Method.
 1. applicationContext.xml 의 messageSource bean 정의
 <bean id="msgSrc" class="org.springframework.context.support.ResourceBundleMessageSource">
     <property name="basenames">
         <list>
             <value>MyResource</value>
         </list>
     </property>
 </bean>
 
 
 2. MyResource_{locale}.properties 파일 생성
 - MyResource_ko_KR.properties 의 내용
 msg001=안녕하세요
 msg002={0}님, 안녕하세요. {1}번째 접속입니다.
 
 - MyResource_en_US.properties 의 내용
 msg001=Hello
 msg002=Hi, {0}!. {1} times.
 - ...
 
 3. 사용법(Java Code)
 Object obj[] = new Object[]{new String("admin"),new Integer(3)};
 String str = GlueStaticContext.getResourceMessage("msgSrc", "msg002", arg, Locale.getDefault());
 

Parameters:
beanName - - bean id가 "messageSource" 이 아닌 경우의 bean id.
key -
arguments -
locale -
Returns:

getDefaultUILocale

public static Locale getDefaultUILocale()
glue.properties의 property "default.ui.locale" 에 근거한 Locale

Returns:
default ui Locale

getDefaultLocale

public static Locale getDefaultLocale(String localeInfo)
입력값에 근거한 Locale

Parameters:
localeInfo - "ko_KR" 형태의 문자열.
Returns:
localeInfo를 "_"로 구분해서 new Locale("ko", "KR")로 함.

isAudit

public static boolean isAudit()
Audit 설정 유무 확인. glue.properties 파일에 "audit.insert.key" 와 "audit.update.key" 의 존재 유무

Returns:
true이면 Audit 설정 가능

getLicenseMode

public static com.poscoict.license.LicenseAPI.LicenseMode getLicenseMode()
라이선스 모드를 반환한다.

Returns:
라이선스 모드 (EDUCATION, DEVELOPEMENT, PRODUCT)

checkLicense

public static boolean checkLicense()
라이선스 유효여부를 확인한다.

Returns:
라이선스 유효여부


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