From e54cc07e9d808f7b3e1298f406568c7b9b659ca0 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 8 Jan 2024 14:37:10 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=83=9E?= =?UTF-8?q?=E3=83=8D=E3=83=BC=E3=82=B8=E3=83=A3=E3=83=BC=E3=82=92=E5=85=B1?= =?UTF-8?q?=E7=94=A8=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processor/impl/DocumentProcessorImpl.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java b/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java index 5345a116..2a1447fd 100644 --- a/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java +++ b/processor/src/main/java/one/nem/lacerta/processor/impl/DocumentProcessorImpl.java @@ -25,9 +25,12 @@ public class DocumentProcessorImpl implements DocumentProcessor{ // Magic Numbers private static final String DEFAULT_SAVE_DIR = "raw"; + + // Variables private final DocumentDetail documentDetail; private XmlMetaModel xmlMetaModel; private Path documentRootPath; + private FileManager fileManager; // Injection private final FileManagerFactory fileManagerFactory; @@ -51,19 +54,19 @@ public class DocumentProcessorImpl implements DocumentProcessor{ this.documentRootPath = documentDetail.getPath().getFullPath(); logger.debug("init", "documentRootPath: " + this.documentRootPath); - FileManager fileManager = fileManagerFactory.create(this.documentRootPath); //Initialize FileManager + this.fileManager = fileManagerFactory.create(this.documentRootPath); //Initialize FileManager logger.debug("init", "fileManager created"); - fileManager.autoCreateDir(this.documentRootPath); + this.fileManager.autoCreateDir(this.documentRootPath); // rawディレクトリInit - fileManager.autoCreateDir(DEFAULT_SAVE_DIR); + this.fileManager.autoCreateDir(DEFAULT_SAVE_DIR); // xmlファイルの読み込み if (fileManager.isExist("meta.xml")) { logger.debug("init", "meta.xml found"); try { - xmlMetaModel = xmlMetaParser.deserialize(fileManager.loadDocument("meta.xml")); + xmlMetaModel = xmlMetaParser.deserialize(this.fileManager.loadDocument("meta.xml")); } catch (Exception e) { logger.debug("init", "meta.xml parse failed"); logger.trace("init", e.getMessage()); @@ -79,7 +82,7 @@ public class DocumentProcessorImpl implements DocumentProcessor{ xmlMetaModel.setPages(new ArrayList<>()); try { - fileManager.saveDocument(xmlMetaParser.serialize(xmlMetaModel), "meta.xml"); + this.fileManager.saveDocument(xmlMetaParser.serialize(xmlMetaModel), "meta.xml"); logger.debug("init", "meta.xml saved"); } catch (Exception e) { logger.error("init", "meta.xml save failed");