디렉토리 존재 체크
개요
비즈니스 로직을 처리하면서 필요시 디렉토리의 존재를 확인할 수 있는 공통 기능을 제공한다.
본 기능은 전자정부 표준프레임워크 공통컴포넌트 요소기술 내에 구성되어 있다.
설명
① 대상 디렉토리가 존재하는지 확인하는 기능 ② 특정위치 이하로 대상 디렉토리가 존재하는지 확인하는 기능 ③ 대상 디렉토리의 최종수정일자가 특정구간내에 포함되는 경우에 한해서 존재여부를 확인하는 기능 ④ 대상 디렉토리가 특정 소유자에 의해 생성된 경우에 한해서 존재여부를 확인하는 기능(WINDOWS 시스템에서는 지원하지 않음)
관련소스
| 유형 | 대상소스명 | 설명 | 비고 |
|---|---|---|---|
| Service | egovframework.com.utl.service.EgovFileTool.java | 파일관리 툴 요소기술 클래스 | |
| JSP | WEB_INF/jsp/egovframework/cmm/utl/EgovDrctryExst.jsp | 테스트 페이지 |
메소드
| 결과값 | 메소드명 | 설명 | 내용 |
|---|---|---|---|
| boolean | getExistDirectory(String targetDirPath) | 디렉토리 확인 | 대상 디렉토리경로(targetDirPath)를 입력받아 확인한다. 성공시 true, 실패시 flase를 리턴 |
| ArrayList | getExistDirectory(String baseDirPath, String targetDirName, int cnt) | 디렉토리 확인 | 확인할 위치기준 디렉토리경로(baseDirPath)를 입력받아 하위디렉토리중 대상디렉토리(targetDirPath)가 존재하는지 확인한다. 성공시 확인된 절대경로를 문자열정보로 LIST에 담아서 리턴 |
| boolean | getExistDirectory(String targetDirPath, String fromDate, String toDate) | 디렉토리 확인 | 대상 디렉토리경로(targetDirPath)를 입력받아 생성일자가 조건구간(fromDate과 toDate사이)내에 포함되는지 확인한다. 성공시 true, 실패시 false를 리턴 |
| boolean | getExistDirectory(String targetDirPath, String owner) | 디렉토리 확인 | 대상 디렉토리경로(targetDirPath)를 입력받아 디렉토리 소유자조건(owner)에 일치하는지 확인한다. 성공시 true, 실패시 false 리턴 |
Input
- targetDirPath: String 타입의 절대경로를 포함하는 확인대상 디렉토리경로(예, /product/jeus/egovProps/tmp/dir1)
- baseDirPath: String 타입의 절대경로를 포함하는 확인할 위치기준 디렉토리경로(예, /product/jeus/egovProps/tmp)
- targetDirName: String 타입의 확인대상 디렉토리명(예, dir1)
- cnt : int 타입의 디렉토리 존재 확인할 반복횟수 (예, 10)
- fromDate : String 타입의 날짜정보 (예, 20090101)
- toDate : String 타입의 날짜정보 (예, 20090731)
- owner : String 타입의 사용자계정명 (예, jeus)
Output
- boolean 타입 : 존재여부 true / false
- ArrayList 타입 : 기준경로 이하로 존재하는 디렉토리 목록 {“/user/com”, “user/com/com”, “user/adt/com”}
* 메소드의 입력항목 중에서 fromDate, toDate항목은 Validation 체크가 적용됨(요소기술_validation_체크 참조)
환경설정
N/A
사용방법
import egovframework.com.utl.sim.service.EgovFileTool; String targetDirPath1 = "/user/com/dir1"; boolean result1 = EgovFileTool.getExistDirectory(targetDirPath1); String targetDirPath1 = "/user/com/dir2"; String targetDirPath1 = "dir22"; int matchCnt = 1; ArrayList result2 = EgovFileTool.getExistDirectory(baseDirPath2, targetDirPath2, matchCnt); String targetDirPath3 = "/user/com/dir3"; String fromDate3 = "20090101"; String toDate3 = "20090131"; boolean result3 = EgovFileTool.getExistDirectory(targetDirPath3, fromDate3, toDate3); String targetDirPath4 = "/user/com/dir4"; String ownerName4 = "com"; boolean result4 = EgovFileTool.getExistDirectory(targetDirPath4, ownerName4);
참고자료
N/A