kr.co.hit.live.config.impl
Class PropertiesConfiguratorImpl

java.lang.Object
  extended by kr.co.hit.live.config.impl.PropertiesConfiguratorImpl
All Implemented Interfaces:
Configurator
Direct Known Subclasses:
XMLConfiguratorImpl

public class PropertiesConfiguratorImpl
extends Object
implements Configurator

Configurator의 Property로 구성된 파일을 처리하는 구현 클래스이다. Property 형태로 구성 파일을 정의할 때 "${" 와 "}" 로 둘러싸인 형태의 참조변수 정의가 가능하다. 참조 변수는 실제 값으로 치환되어 반환된다.

Since:
Live 0.1
Version:
$Revision: 1.1 $ $Date: 2006/09/26 08:20:19 $
Author:
노준훈

Field Summary
protected static Properties prop
           LiveFramework의 구성 파일을 메모리에 적재하기 위한 property 오브젝트.
 
Constructor Summary
PropertiesConfiguratorImpl()
           
 
Method Summary
 void clear()
          설정 정보 clear
 void doConfigure(InputStream stream)
           ConfiguratorFactory로 부터 파라메터로 받은 configuration file의 InputStream을 읽어서 메모리에 적재하는 초기화 로직.
 boolean getBoolean(String key)
           시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 boolean형(primitive)으로 리턴한다.
 boolean getBoolean(String key, boolean defaultValue)
           시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 boolean형(primitive)으로 리턴한다.
 int getInt(String key)
           <시스템 프로퍼티 또는 strong>Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 int형(primitive)으로 리턴한다.
 int getInt(String key, int defaultValue)
           시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 int형(primitive)으로 리턴한다.
 Set<Object> getKeySet()
           Configuration으로 정의된 항목들의 Key 집합을 리턴한다.
 long getLong(String key)
           시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 long형(primitive)으로 리턴한다.
 long getLong(String key, long defaultValue)
           시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 long형(primitive)으로 리턴한다.
 String getPath(String key, String defaultPath)
           시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 파일 경로 문자열로 리턴한다.
 String getString(String key)
           시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 String형으로 리턴한다.
 String getString(String key, String defaultValue)
           시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 String형으로 리턴한다.
 void validate(ConfigurationValidator validator)
          주어진 ConfigurationValidator 사용하여 구성정보를 검증한다.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prop

protected static Properties prop

LiveFramework의 구성 파일을 메모리에 적재하기 위한 property 오브젝트.

Constructor Detail

PropertiesConfiguratorImpl

public PropertiesConfiguratorImpl()
Method Detail

doConfigure

public void doConfigure(InputStream stream)
                 throws ConfiguratorException
Description copied from interface: Configurator

ConfiguratorFactory로 부터 파라메터로 받은 configuration file의 InputStream을 읽어서 메모리에 적재하는 초기화 로직.

Specified by:
doConfigure in interface Configurator
Parameters:
stream - configuration file의 stream 오브젝트.
Throws:
ConfiguratorException - 읽혀지는 InputStream의 IOException 발생시.

clear

public void clear()
Description copied from interface: Configurator
설정 정보 clear

Specified by:
clear in interface Configurator

getString

public String getString(String key)
                 throws ConfiguratorException
Description copied from interface: Configurator

시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 String형으로 리턴한다.

Specified by:
getString in interface Configurator
Parameters:
key - 원하고자하는 key값
Returns:
원하고자하는 key값에 해당하는 value
Throws:
ConfiguratorException - key값이 configuration file에 존재하지 않을 경우 발생

getString

public String getString(String key,
                        String defaultValue)
Description copied from interface: Configurator

시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 String형으로 리턴한다.

Specified by:
getString in interface Configurator
Parameters:
key - 원하고자하는 key값
defaultValue - 값이 없을 경우 default값
Returns:
원하고자하는 key값에 해당하는 value

getInt

public int getInt(String key)
           throws ConfiguratorException
Description copied from interface: Configurator

<시스템 프로퍼티 또는 strong>Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 int형(primitive)으로 리턴한다.

Specified by:
getInt in interface Configurator
Parameters:
key - 원하고자하는 key값.
Returns:
원하고자하는 key값에 해당하는 value.
Throws:
ConfiguratorException - value값이 int형으로 가져올 수 없는 데이터 형 일 경우 : NumberFormatExcetion.

getInt

public int getInt(String key,
                  int defaultValue)
Description copied from interface: Configurator

시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 int형(primitive)으로 리턴한다.

Specified by:
getInt in interface Configurator
Parameters:
key - 원하고자하는 key값.
defaultValue - 값이 없을 경우 default값
Returns:
원하고자하는 key값에 해당하는 value.

getBoolean

public boolean getBoolean(String key)
                   throws ConfiguratorException
Description copied from interface: Configurator

시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 boolean형(primitive)으로 리턴한다.

Specified by:
getBoolean in interface Configurator
Parameters:
key - 원하고자하는 key값.
Returns:
원하고자하는 key값에 해당하는 value.
Throws:
ConfiguratorException - value값이 boolean형으로 가져올 수 없는 데이터 형 일 경우.

getBoolean

public boolean getBoolean(String key,
                          boolean defaultValue)
Description copied from interface: Configurator

시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 boolean형(primitive)으로 리턴한다.

Specified by:
getBoolean in interface Configurator
Parameters:
key - 원하고자하는 key값.
defaultValue - 값이 없을 경우 default값
Returns:
원하고자하는 key값에 해당하는 value.

getLong

public long getLong(String key)
             throws ConfiguratorException
Description copied from interface: Configurator

시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 long형(primitive)으로 리턴한다.

Specified by:
getLong in interface Configurator
Parameters:
key - 원하고자하는 key값.
Returns:
원하고자하는 key값에 해당하는 value.
Throws:
ConfiguratorException - value값이 long형으로 가져올 수 없는 데이터 형 일 경우.

getLong

public long getLong(String key,
                    long defaultValue)
Description copied from interface: Configurator

시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 long형(primitive)으로 리턴한다.

Specified by:
getLong in interface Configurator
Parameters:
key - 원하고자하는 key값.
defaultValue - 값이 없을 경우 default값
Returns:
원하고자하는 key값에 해당하는 value.

getPath

public String getPath(String key,
                      String defaultPath)
Description copied from interface: Configurator

시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 파일 경로 문자열로 리턴한다. 문자열에 포함된 디렉토리 분리 문자를 OS에 맞는 문자로 통일시킨다.

Specified by:
getPath in interface Configurator
Parameters:
key - 원하고자하는 key값
Returns:
원하고자하는 key값에 해당하는 value의 경로 문자열

getKeySet

public Set<Object> getKeySet()
Description copied from interface: Configurator

Configuration으로 정의된 항목들의 Key 집합을 리턴한다.

Specified by:
getKeySet in interface Configurator
Returns:
key 집합

validate

public void validate(ConfigurationValidator validator)
              throws ConfiguratorException
Description copied from interface: Configurator
주어진 ConfigurationValidator 사용하여 구성정보를 검증한다.

Specified by:
validate in interface Configurator
Throws:
ConfiguratorException


Copyright © 2014. All Rights Reserved.