diff --git a/source/src/main/java/one/nem/lacerta/source/file/FileManager.java b/source/src/main/java/one/nem/lacerta/source/file/FileManager.java index e7c04605..f5b3ae33 100644 --- a/source/src/main/java/one/nem/lacerta/source/file/FileManager.java +++ b/source/src/main/java/one/nem/lacerta/source/file/FileManager.java @@ -37,6 +37,10 @@ public interface FileManager { void saveDocument(Document document, String fileName); void saveDocument(Document document, Path path); + Document loadDocument(String fileName); + Document loadDocument(Path path); + + boolean isExist(Path path); boolean isExist(String fileName); diff --git a/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java b/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java index 12c9ebe8..f6c58aed 100644 --- a/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java +++ b/source/src/main/java/one/nem/lacerta/source/file/impl/FileManagerImpl.java @@ -13,6 +13,8 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.List; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; @@ -243,6 +245,26 @@ public class FileManagerImpl implements FileManager { // TODO-rca 実装する } + @Override + public Document loadDocument(String fileName) { + try { + File file = getFile(fileName); + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document document = builder.parse(file); + return document; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + @Override + public Document loadDocument(Path path) { + // TODO-rca 実装する + return null; + } + @Override public boolean isExist(Path path) { logger.debug("isExist", "called");