kr.co.hit.live.repository
Class LocalFileRepository

java.lang.Object
  extended by kr.co.hit.live.repository.LocalFileRepository
All Implemented Interfaces:
FileRepository

public class LocalFileRepository
extends Object
implements FileRepository

Local file system 기반의 레파지토리 기능을 제공하는 클래스이다. 이 기능을 사용하기 위하여 우선 local file 시스템 설정 정의를 위한 프로퍼티 파일을 작성해야하며, 이 파일 명을 live config 파일에 "live.localfile.config"를 Key로하여 지정해야한다. 설정 정의파일은 다음과 같은 구조이다.

  # temp 파일 저장용
  temp.dir.repository=/himed/file/temp
  temp.dir.local=D:\\temp
 
  # 첨부파일 저장용
  attach.dir.repository=/himed/file/attach
  attach.dir.local=D:\\temp
 

Since:
4.0
Author:
김형도

Field Summary
protected  String LOCAL_FILE_CONFIG_FILE_KEY
          LocalFileSystem 설정 파일을 가져오기 위한 Key. live-config.properties에 정의되어 있다.
 
Constructor Summary
LocalFileRepository(String key)
           
 
Method Summary
 boolean[] deleteFile(String[] filePath)
          레파지토리에서 파일을 삭제한다.
 boolean[] deleteFile(ValueObject fileVO, String pathKey)
          레파지토리에서 파일을 삭제한다.
 void getFile(ValueObject fileVO, String fileDataKey, String getPathKey)
          레파지토리에서 파일을 가져온다.
protected  String getPath(String rawPath)
           
 void storeFile(String localPath, String remotePath)
          저장할 로컬 파일을 경로를 지정하여 해당 파일을 레파지토리에 저장한다.
 void storeFile(ValueObject fileVO, String fileDataKey, String rootPath, String getPathKey, String pathSuffix)
          파일데이터가 byte[] 담겨있는 VO를 받아서 레파지토리에 저장한다.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCAL_FILE_CONFIG_FILE_KEY

protected final String LOCAL_FILE_CONFIG_FILE_KEY
LocalFileSystem 설정 파일을 가져오기 위한 Key. live-config.properties에 정의되어 있다.

See Also:
Constant Field Values
Constructor Detail

LocalFileRepository

public LocalFileRepository(String key)
Method Detail

storeFile

public void storeFile(ValueObject fileVO,
                      String fileDataKey,
                      String rootPath,
                      String getPathKey,
                      String pathSuffix)
               throws LiveException
Description copied from interface: FileRepository
파일데이터가 byte[] 담겨있는 VO를 받아서 레파지토리에 저장한다. 저장된 경로는 VO에 getPathKey로 담아준다. 파일명은 임의로 생성한다.

Specified by:
storeFile in interface FileRepository
Parameters:
fileVO - 파일데이터가 byte[]로 담겨있는 VO
fileDataKey - fileVO에 파일데이터가 담겨있는 컬럼명
rootPath - 저장할 때 사용할 root 경로를 지정한다.
getPathKey - 저장 후 저장된 경로(자동생성)를 VO에 담아줄 때 사용할 컬럼명.
pathSuffix - 저장 경로를 자동생성시 주어진 값을 붙여준다.
Throws:
LiveException

storeFile

public void storeFile(String localPath,
                      String remotePath)
               throws LiveException
Description copied from interface: FileRepository
저장할 로컬 파일을 경로를 지정하여 해당 파일을 레파지토리에 저장한다.

Specified by:
storeFile in interface FileRepository
Throws:
LiveException

getFile

public void getFile(ValueObject fileVO,
                    String fileDataKey,
                    String getPathKey)
             throws LiveException
Description copied from interface: FileRepository
레파지토리에서 파일을 가져온다. 가져올 파일 경로를 담은 컬럼명을 getPathKey로 지정한다. 파일 데이터는 byte[]로 fileVO에 저장되며 이때 저장할 컬럼명을 fileDataKey로 지정한다.

Specified by:
getFile in interface FileRepository
Throws:
LiveException

deleteFile

public boolean[] deleteFile(ValueObject fileVO,
                            String pathKey)
                     throws LiveException
Description copied from interface: FileRepository
레파지토리에서 파일을 삭제한다. 삭제할 파일 경로를 담은 컬럼명을 pathKey로 지정한다. 각 파일별로 삭제 성공여부를 boolean 배열로 반환한다.

Specified by:
deleteFile in interface FileRepository
Returns:
삭제 성공 여부
Throws:
LiveException

deleteFile

public boolean[] deleteFile(String[] filePath)
                     throws LiveException
Description copied from interface: FileRepository
레파지토리에서 파일을 삭제한다. 삭제할 파일 경로들을 배열로 전달한다.

Specified by:
deleteFile in interface FileRepository
Returns:
삭제 성공 여부
Throws:
LiveException

getPath

protected String getPath(String rawPath)


Copyright © 2014. All Rights Reserved.