kr.co.hit.live.web.mapper
Class CachedMapReader

java.lang.Object
  extended by kr.co.hit.live.web.mapper.CachedMapReader
All Implemented Interfaces:
MapReader
Direct Known Subclasses:
AutoReloadMapReader

public class CachedMapReader
extends Object
implements MapReader

주어진 ID에 해당되는 ActionMap 객체를 반환해주는 클래스이다. 내부적으로 MapParser를 사용하여 Map 정의 파일(xml)을 파싱하며, MapDirectory를 사용하여 Map 정의 파일에 대한 File 객체를 얻어온다.

한번 파싱되어 생성된 ActionMap 객체는 내부에 캐싱하여 재사용한다.

Since:
4.0
Author:
김형도

Field Summary
protected  Map<String,ActionMap> cache
          한번 파싱되어 생성된 ActionMap 객체를 저장해 놓는다.
protected  MapDirectory mapDir
          Map 파일 객체를 얻어오기 위한 MapDirectory 객체
 
Constructor Summary
CachedMapReader(String root)
          생성자.
 
Method Summary
protected  void cacheMap(String id, ActionMap smap)
          주어진 ActionMap 객체를 cahch에 저장한다.
 ActionMap getMap(String path, String id)
          주어진 ID에 해당되는 SubmissionMap 객체를 반환한다.
 String getPath()
          Map 파일을 얻어 오기 위하여 사용하는 디렉토리 경로나 DB 주소 등의 정보를 리턴한다.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected Map<String,ActionMap> cache
한번 파싱되어 생성된 ActionMap 객체를 저장해 놓는다.


mapDir

protected MapDirectory mapDir
Map 파일 객체를 얻어오기 위한 MapDirectory 객체

Constructor Detail

CachedMapReader

public CachedMapReader(String root)
생성자. Map 파일이 있는 디렉토리의 위치를 지정하여 생성한다.

Parameters:
root -
Method Detail

getPath

public String getPath()
Description copied from interface: MapReader
Map 파일을 얻어 오기 위하여 사용하는 디렉토리 경로나 DB 주소 등의 정보를 리턴한다.

Specified by:
getPath in interface MapReader

getMap

public ActionMap getMap(String path,
                        String id)
                 throws IOException,
                        SAXException
Description copied from interface: MapReader
주어진 ID에 해당되는 SubmissionMap 객체를 반환한다. 해당 Map 파일이 존재하지 않거나 Xml 파싱시 오류가 발행한 경우에는 null을 반환한다.

Specified by:
getMap in interface MapReader
Parameters:
path - map 파일이 있는 상대 경로
id - map 파일의 ID
Returns:
Throws:
IOException
SAXException

cacheMap

protected void cacheMap(String id,
                        ActionMap smap)
주어진 ActionMap 객체를 cahch에 저장한다.

Parameters:
id -
smap -


Copyright © 2014. All Rights Reserved.