1 16 package org.outerj.daisy.books.publisher.impl; 17 18 import org.outerj.daisy.books.store.BookInstance; 19 20 23 public class BookInstanceLayout { 24 public static String getDocumentStorePath(BookInstance bookInstance, long documentId, long branchId, long languageId) { 25 String storeBasePath = "/data/documents/" + documentId + "_" + branchId + "_" + languageId; 26 String storePath = storeBasePath + ".xml"; 27 int counter = 0; 28 while (bookInstance.exists(storePath)) { 29 counter++; 30 storePath = storeBasePath + "_" + counter + ".xml"; 31 } 32 return storePath; 33 } 34 35 public static String getImageStorePath(long documentId, long branchId, long languageId, long versionId) { 36 return "/data/resources/" + documentId + "_" + branchId + "_" + languageId + "_" + versionId; 37 } 38 39 public static String getResourceStorePath(long documentId, long branchId, long languageId, long versionId, long partTypeId) { 40 return "/data/resources/" + documentId + "_" + branchId + "_" + languageId + "_" + versionId + "_" + partTypeId; 41 } 42 43 public static String geResourceStorePath() { 44 return "/data/resources/"; 45 } 46 47 public static String getDocumentInPublicationStorePath(String documentStorePath, String publicationOutputName) { 48 return "/publications/" + publicationOutputName + "/documents/" + getFileName(documentStorePath); 49 } 50 51 public static String getPublicationOutputPath(String publicationOutputName) { 52 return "/publications/" + publicationOutputName + "/"; 53 } 54 55 public static String getDependenciesPath() { 56 return "/data/dependencies.xml"; 57 } 58 59 public static String getPublicationSpecsPath() { 60 return "/publications/pubspecs.xml"; 61 } 62 63 public static String getProcessedBookDefinitionPath() { 64 return "/data/book_definition_processed.xml"; 65 } 66 67 public static String getPublicationLogPath() { 68 return "/publications/log.txt"; 69 } 70 71 public static String getLinkLogPath() { 72 return "/publications/link_errors.txt"; 73 } 74 75 private static String getFileName(String path) { 76 int slashPos = path.lastIndexOf("/"); 77 if (slashPos == -1) 78 return path; 79 return path.substring(slashPos + 1); 80 } 81 82 } 83 | Popular Tags |