From 98c3820679201b0b2fff7087c6c7dd4cc56205e3 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 14 Jan 2024 16:55:50 +0900 Subject: [PATCH] =?UTF-8?q?Init=E3=82=92=E5=BB=83=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/processor/DocumentProcessor.java | 2 -- .../processor/impl/DocumentProcessorImpl.java | 20 +++++++++---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/processor/src/main/java/one/nem/lacerta/processor/DocumentProcessor.java b/processor/src/main/java/one/nem/lacerta/processor/DocumentProcessor.java index 1f8e77c6..75c8fd39 100644 --- a/processor/src/main/java/one/nem/lacerta/processor/DocumentProcessor.java +++ b/processor/src/main/java/one/nem/lacerta/processor/DocumentProcessor.java @@ -21,6 +21,4 @@ public interface DocumentProcessor { int getPageCount(); DocumentDetail getDocumentDetail(); - void init() throws Exception; // TODO-rca: 例外処理 - } 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 3badf9cc..7f97fa66 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 @@ -24,6 +24,8 @@ import one.nem.lacerta.utils.LacertaLogger; import one.nem.lacerta.utils.XmlMetaParser; import one.nem.lacerta.utils.repository.DeviceInfoUtils; +import one.nem.lacerta.vcs.LacertaVcs; +import one.nem.lacerta.vcs.factory.LacertaVcsFactory; public class DocumentProcessorImpl implements DocumentProcessor{ @@ -36,38 +38,34 @@ public class DocumentProcessorImpl implements DocumentProcessor{ private XmlMetaModel xmlMetaModel; private Path documentRootPath; private FileManager fileManager; + private LacertaVcs lacertaVcs; // Injection private final FileManagerFactory fileManagerFactory; private final LacertaLogger logger; private final XmlMetaParser xmlMetaParser; - + private final LacertaVcsFactory lacertaVcsFactory; private final DeviceInfoUtils deviceInfoUtils; @AssistedInject - public DocumentProcessorImpl(FileManagerFactory fileManagerFactory, LacertaLogger logger, XmlMetaParser xmlMetaParser, DeviceInfoUtils deviceInfoUtils, @Assisted DocumentDetail documentDetail) { + public DocumentProcessorImpl(FileManagerFactory fileManagerFactory, LacertaLogger logger, XmlMetaParser xmlMetaParser, LacertaVcsFactory lacertaVcsFactory, DeviceInfoUtils deviceInfoUtils, @Assisted DocumentDetail documentDetail) { this.fileManagerFactory = fileManagerFactory; this.logger = logger; this.xmlMetaParser = xmlMetaParser; if (documentDetail == null) { throw new IllegalArgumentException("documentDetail must not be null"); } + this.lacertaVcsFactory = lacertaVcsFactory; this.documentDetail = documentDetail; this.deviceInfoUtils = deviceInfoUtils; - } - @Override - public void init() throws Exception{ - logger.debug("init", "called"); - // Init Variables + // Init this.documentRootPath = deviceInfoUtils.getExternalStorageDirectory().resolve(this.documentDetail.getMeta().getId()); logger.debug("init", "documentRootPath: " + this.documentRootPath); - this.fileManager = fileManagerFactory.create(this.documentRootPath).enableAutoCreateParent(); //Initialize FileManager - - - logger.debug("init", "fileManager created"); + this.lacertaVcs = lacertaVcsFactory.create(this.documentDetail.getMeta().getId()); } + @Override public void addNewPageToLast(Bitmap bitmap) throws Exception{ logger.debug("addNewPageToLast", "called");