mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
ファイルマネージャーを共用するように
This commit is contained in:
parent
bc5d0edd68
commit
e54cc07e9d
|
@ -25,9 +25,12 @@ public class DocumentProcessorImpl implements DocumentProcessor{
|
||||||
|
|
||||||
// Magic Numbers
|
// Magic Numbers
|
||||||
private static final String DEFAULT_SAVE_DIR = "raw";
|
private static final String DEFAULT_SAVE_DIR = "raw";
|
||||||
|
|
||||||
|
// Variables
|
||||||
private final DocumentDetail documentDetail;
|
private final DocumentDetail documentDetail;
|
||||||
private XmlMetaModel xmlMetaModel;
|
private XmlMetaModel xmlMetaModel;
|
||||||
private Path documentRootPath;
|
private Path documentRootPath;
|
||||||
|
private FileManager fileManager;
|
||||||
|
|
||||||
// Injection
|
// Injection
|
||||||
private final FileManagerFactory fileManagerFactory;
|
private final FileManagerFactory fileManagerFactory;
|
||||||
|
@ -51,19 +54,19 @@ public class DocumentProcessorImpl implements DocumentProcessor{
|
||||||
this.documentRootPath = documentDetail.getPath().getFullPath();
|
this.documentRootPath = documentDetail.getPath().getFullPath();
|
||||||
logger.debug("init", "documentRootPath: " + this.documentRootPath);
|
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");
|
logger.debug("init", "fileManager created");
|
||||||
|
|
||||||
fileManager.autoCreateDir(this.documentRootPath);
|
this.fileManager.autoCreateDir(this.documentRootPath);
|
||||||
|
|
||||||
// rawディレクトリInit
|
// rawディレクトリInit
|
||||||
fileManager.autoCreateDir(DEFAULT_SAVE_DIR);
|
this.fileManager.autoCreateDir(DEFAULT_SAVE_DIR);
|
||||||
|
|
||||||
// xmlファイルの読み込み
|
// xmlファイルの読み込み
|
||||||
if (fileManager.isExist("meta.xml")) {
|
if (fileManager.isExist("meta.xml")) {
|
||||||
logger.debug("init", "meta.xml found");
|
logger.debug("init", "meta.xml found");
|
||||||
try {
|
try {
|
||||||
xmlMetaModel = xmlMetaParser.deserialize(fileManager.loadDocument("meta.xml"));
|
xmlMetaModel = xmlMetaParser.deserialize(this.fileManager.loadDocument("meta.xml"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.debug("init", "meta.xml parse failed");
|
logger.debug("init", "meta.xml parse failed");
|
||||||
logger.trace("init", e.getMessage());
|
logger.trace("init", e.getMessage());
|
||||||
|
@ -79,7 +82,7 @@ public class DocumentProcessorImpl implements DocumentProcessor{
|
||||||
xmlMetaModel.setPages(new ArrayList<>());
|
xmlMetaModel.setPages(new ArrayList<>());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fileManager.saveDocument(xmlMetaParser.serialize(xmlMetaModel), "meta.xml");
|
this.fileManager.saveDocument(xmlMetaParser.serialize(xmlMetaModel), "meta.xml");
|
||||||
logger.debug("init", "meta.xml saved");
|
logger.debug("init", "meta.xml saved");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("init", "meta.xml save failed");
|
logger.error("init", "meta.xml save failed");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user