Class GlueStaticContext
java.lang.Object
com.poscoict.glueframework.context.GlueStaticContext
각종 고정정보에 접근하는 Class. 이 Class는 IoC용 XML은 applicationContext.xml 에 근거에 Bean 인스턴스가 생성되며 사용된다. 이 Class는 그외 Property 정보에 대한 API를 제공한다. 그외 IoC용
XML의 Bean 인스턴스는 GlueBeanFactory를 이용하는 별개의 모듈을 필요하다.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean라이선스 유효여부를 확인한다.static voidapplicationContext.xml에 정의 되어 있는 Bean Class를 소멸시킨다.static GlueBeanFactoryapplicationContext.xml 또는 Spring Boot ApplicationContext에 정의된 Bean Class를 호출하기 위한 GlueBeanFactory를 Return 한다.static StringgetCustomProperty(String key) Custom Properties 파일에서 key에 해당하는 프로퍼티를 얻는다.
Custom Properties 파일 지정 방법: glue.properties 파일에 glue.custom.property=d:\\config\\custom.properties 라고 지정한다.static StringgetCustomProperty(String key, String defaultValue) Custom Properties 파일에서 key에 해당하는 프로퍼티를 얻는다.
Custom Properties 파일 지정 방법: glue.properties 파일에 glue.custom.property=d:\\config\\custom.properties 라고 지정한다.static LocalegetDefaultLocale(String localeInfo) 입력값에 근거한 Localestatic Localeglue.properties의 property "default.ui.locale" 에 근거한 Localestatic StringgetGlueProperty(String key) glue.properties에서 Key에 해당하는 Property 값을 Return 한다.static StringgetGlueProperty(String key, String defaultValue) glue.properties에서 Key에 해당하는 Property 값을 Return 한다.static com.poscoict.license.LicenseAPI.LicenseMode라이선스 모드를 반환한다.static StringgetResourceMessage(String key) Locale정보에 근거한 다국어 지원 Method.static StringgetResourceMessage(String key, Object[] arguments) Locale정보에 근거한 다국어 지원 Method.static StringgetResourceMessage(String key, Object[] arguments, Locale locale) Locale정보에 근거한 다국어 지원 Method.static StringgetResourceMessage(String beanName, String key, Object[] arguments, Locale locale) Locale정보에 근거한 다국어 지원 Method.static StringgetResourceMessage(String key, Locale locale) Locale정보에 근거한 다국어 지원 Method.static StringgetSystemProperty(String key) SystemProperty는 java를 실행시 -D Option으로 정의한 Property를 의미 한다.static StringgetSystemProperty(String key, String defaultValue) SystemProperty는 java를 실행시 -D Option으로 정의한 Property를 의미 한다.static StringgetTimeZoneFormat(Date date, int offset) 해당 TimeZone 기준 날짜.시간 표현 Method.static StringgetTimeZoneFormat(Date date, int offset, String textformate) 해당 TimeZone 기준 날짜.시간 표현 Method.static StringgetTimeZoneFormat(Date date, String timezoneid) 해당 TimeZone 기준 날짜.시간 표현 Method.static StringgetTimeZoneFormat(Date date, String timezoneid, String textformate) 해당 TimeZone 기준 날짜.시간 표현 Method.static booleanisAudit()Audit 설정 유무 확인. glue.properties 파일에 "audit.insert.key" 와 "audit.update.key" 의 존재 유무static voidglue.properties 를 다시 loading 하는 method.static voidstatic voidsetApplicationContext(ApplicationContext context) Deprecated.static voidsetBootBeanFactory(GlueBeanFactory factory) 26.06.09 pd299368 Spring Boot 환경에서 이미 생성된GlueBeanFactory인스턴스를 등록한다.
-
Field Details
-
config
- See Also:
-
-
Constructor Details
-
GlueStaticContext
public GlueStaticContext()
-
-
Method Details
-
reloadLicense
public static void reloadLicense() -
reloadGlueProperties
public static void reloadGlueProperties()glue.properties 를 다시 loading 하는 method. -
setApplicationContext
Deprecated.GlueBeanFactoryBootImpl인스턴스를 2개 생성하는 문제로setBootBeanFactory(GlueBeanFactory)사용 권장26.06.02 pd299368 GlueBeanBootFactoryImpl 기반으로 Boot ApplicationContexct 관련부분 추가 Spring Boot 환경에서는GlueCoreAutoConfiguration이 자동으로 이 메서드를 호출한다. 기존 XML 방식 대신 Boot의 ApplicationContext를 사용하도록 처리- Parameters:
context- Spring Boot ApplicationContext
-
setBootBeanFactory
26.06.09 pd299368 Spring Boot 환경에서 이미 생성된GlueBeanFactory인스턴스를 등록한다.setApplicationContext(ApplicationContext)와 달리 새 인스턴스를 생성하지 않으므로GlueBeanFactoryBootImpl초기화 로그가 2회 출력되는 문제를 방지한다.GlueCoreAutoConfiguration.glueBeanFactory()에서 호출한다.- Parameters:
factory- 이미 생성된 GlueBeanFactoryBootImpl 인스턴스
-
getBeanFactory
applicationContext.xml 또는 Spring Boot ApplicationContext에 정의된 Bean Class를 호출하기 위한 GlueBeanFactory를 Return 한다.
Spring Boot 환경:
setApplicationContext(ApplicationContext)가 호출되어 있으면 Boot ApplicationContext를 래핑한GlueBeanFactoryBootImpl을 반환한다.
Boot 환경인데setApplicationContext()가 아직 호출되지 않은 경우(초기화 순서 문제)IllegalStateException을 던져applicationContext.xml로딩 시도를 차단한다.
기존 Spring MVC 환경: ClassPath에서applicationContext.xml을 로딩한GlueBeanFactoryImpl을 반환한다.GlueBeanFactory beanFactory = GlueStaticContext.getBeanFactory(); GlueGenericDao dao = (GlueGenericDao)beanFactory.getBeanObject("bizdao");- Returns:
- GlueBeanFactory BeanFactory
- Throws:
IllegalStateException- Spring Boot 환경에서 GlueBeanFactory가 아직 초기화되지 않은 경우
-
destroyApplictionContext
public static void destroyApplictionContext()applicationContext.xml에 정의 되어 있는 Bean Class를 소멸시킨다. -
getSystemProperty
SystemProperty는 java를 실행시 -D Option으로 정의한 Property를 의미 한다.
System.getProperty(key)와 동일한 Return 값을 가진다.- Parameters:
key- System Property key- Returns:
- String System Property value
-
getSystemProperty
SystemProperty는 java를 실행시 -D Option으로 정의한 Property를 의미 한다.
System.getProperty(key)와 동일한 Return 값을 가진다.- Parameters:
key- System Property keydefaultValue- System Property가 없을 경우의 defalut 값- Returns:
- String System Property value
-
getGlueProperty
glue.properties에서 Key에 해당하는 Property 값을 Return 한다.
glue.properties의 내용은 key=value로 되어 있고 해당 파일은 반드시 CONFIG_PATH에 존재 하여야 한다.- Parameters:
key- glue.properties의 key 값- Returns:
- String User Property Value
-
getGlueProperty
glue.properties에서 Key에 해당하는 Property 값을 Return 한다.
glue.properties의 내용은 key=value로 되어 있고 해당 파일은 반드시 CONFIG_PATH에 존재 하여야 한다.- Parameters:
key- glue.properties의 key 값defaultValue- glue.properties 파일이 없거나, 주어진 key가 존재하지 않을 경우의 default 값- Returns:
- User Property Value
-
getCustomProperty
Custom Properties 파일에서 key에 해당하는 프로퍼티를 얻는다.
Custom Properties 파일 지정 방법: glue.properties 파일에 glue.custom.property=d:\\config\\custom.properties 라고 지정한다. 프로퍼티 파일위치 및 파일명은 User가 임의로 부여할 수 있다.- Parameters:
key- 프로퍼티 키- Returns:
- 프로퍼티 값
-
getCustomProperty
Custom Properties 파일에서 key에 해당하는 프로퍼티를 얻는다.
Custom Properties 파일 지정 방법: glue.properties 파일에 glue.custom.property=d:\\config\\custom.properties 라고 지정한다. 프로퍼티 파일위치 및 파일명은 User가 임의로 부여할 수 있다.- Parameters:
key- 프로퍼티 키defaultValue- 프로퍼티 값이 없을 경우의 default 값- Returns:
- 프로퍼티 값
-
getTimeZoneFormat
해당 TimeZone 기준 날짜.시간 표현 Method. Text Format은 Default 값(yyyy-MM-dd HH:mm:ss (z Z))- Parameters:
date- Text 형태로 변환 할 Dateoffset- Text 형태로 변환 시 적용 할 TimeZone 시간대 offset값- Returns:
- 해당 TimeZone 기준 날짜.시간
-
getTimeZoneFormat
해당 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 형태로 변환 할 Dateoffset- Text 형태로 변환 시 적용 할 TimeZone 시간대 offset값textformate- Text 형태로 변환 시 적용 될 Text Format (Default 값 : yyyy-MM-dd HH:mm:ss (z Z))- Returns:
- 해당 TimeZone 기준 날짜.시간
-
getTimeZoneFormat
해당 TimeZone 기준 날짜.시간 표현 Method. Text Format은 Default 값(yyyy-MM-dd HH:mm:ss (z Z))- Parameters:
date- Text 형태로 변환 할 Datetimezoneid- Text 형태로 변환 시 적용 할 TimeZone ID- Returns:
- 해당 TimeZone 기준 날짜.시간
-
getTimeZoneFormat
해당 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 형태로 변환 할 Datetimezoneid- Text 형태로 변환 시 적용 할 TimeZone IDtextformate- Text 형태로 변환 시 적용 될 Text Format (Default 값 : yyyy-MM-dd HH:mm:ss (z Z))- Returns:
- 해당 TimeZone 기준 날짜.시간
-
getResourceMessage
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:
- resourceMessage
-
getResourceMessage
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"),Integer.valueOf(3)}; String str = GlueStaticContext.getResourceMessage("msg002", arg);- Parameters:
key-arguments-- Returns:
- resourceMessage
-
getResourceMessage
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:
- resourceMessage
-
getResourceMessage
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"),Integer.valueOf(3)}; String str = GlueStaticContext.getResourceMessage("msg002", arg, Locale.getDefault());- Parameters:
key-arguments-locale-- Returns:
- resourceMessage
-
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"),Integer.valueOf(3)}; String str = GlueStaticContext.getResourceMessage("msgSrc", "msg002", arg, Locale.getDefault());- Parameters:
beanName- bean id가 "messageSource" 이 아닌 경우의 bean id.key-arguments-locale-- Returns:
- resourceMessage
-
getDefaultUILocale
glue.properties의 property "default.ui.locale" 에 근거한 Locale- Returns:
- default ui Locale
-
getDefaultLocale
입력값에 근거한 Locale- Parameters:
localeInfo- "ko_KR" 형태의 문자열.- Returns:
- localeInfo를 "_"로 구분해서 Locale.of("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:
- 라이선스 유효여부
-
GlueBeanFactoryBootImpl인스턴스를 2개 생성하는 문제로setBootBeanFactory(GlueBeanFactory)사용 권장