public Language getLanguage() { return bmd.getLanguage(); }
public String getProperty(String key) { return bmd.getProperty(key); }
public boolean isLeftToRight() { return bmd.isLeftToRight(); }
public static String getBookIdentifierPropSuffix(BookMetaData meta) { String moduleVer = null; if (meta.getProperty("Version") != null) { moduleVer = '[' + meta.getProperty("Version") + ']'; } return meta.getInitials() + moduleVer; }
private String normalizeForSearch(String internalKey) { BookMetaData bmd = getBookMetaData(); String keytitle = internalKey; String caseSensitive = bmd.getProperty(SwordBookMetaData.KEY_CASE_SENSITIVE_KEYS); if (!"true".equalsIgnoreCase(caseSensitive) && !BookCategory.DAILY_DEVOTIONS.equals(bmd.getBookCategory())) { return keytitle.toUpperCase(Locale.US); } return keytitle; }
public int compareTo(BookMetaData obj) { int result = this.getBookCategory().compareTo(obj.getBookCategory()); if (result == 0) { result = this.getAbbreviation().compareTo(obj.getAbbreviation()); } if (result == 0) { result = this.getInitials().compareTo(obj.getInitials()); } if (result == 0) { result = this.getName().compareTo(obj.getName()); } return result; }
if (BookCategory.DAILY_DEVOTIONS.equals(bmd.getBookCategory())) { if (bmd.hasFeature(FeatureType.GREEK_DEFINITIONS) || bmd.hasFeature(FeatureType.HEBREW_DEFINITIONS)) { return keytitle; if ("true".equalsIgnoreCase(bmd.getProperty(SwordBookMetaData.KEY_STRONGS_PADDING))) { if (bmd.hasFeature(FeatureType.GREEK_DEFINITIONS) && bmd.hasFeature(FeatureType.HEBREW_DEFINITIONS)) { if (hasTrailingLetter && "naslex".equalsIgnoreCase(bmd.getInitials())) { buf.append(lastLetter); if (hasTrailingLetter && "naslex".equalsIgnoreCase(bmd.getInitials())) { buf.append(lastLetter); if (hasTrailingLetter && "naslex".equalsIgnoreCase(bmd.getInitials())) { buf.append(lastLetter);
protected String getRawText(DataEntry entry) { String cipherKeyString = getBookMetaData().getProperty(SwordBookMetaData.KEY_CIPHER_KEY); byte[] cipherKeyBytes = null; if (cipherKeyString != null) { try { cipherKeyBytes = cipherKeyString.getBytes(getBookMetaData().getBookCharset()); } catch (UnsupportedEncodingException e) { cipherKeyBytes = cipherKeyString.getBytes(); } } return entry.getRawText(cipherKeyBytes); }
@Override public boolean equals(Object obj) { // Since this can not be null if (obj == null) { return false; } // We might consider checking for equality against all BookMetaDatas? // However currently we don't. // Check that that is the same as this // Don't use instanceof since that breaks inheritance if (!obj.getClass().equals(this.getClass())) { return false; } // The real bit ... BookMetaData that = (BookMetaData) obj; return getBookCategory().equals(that.getBookCategory()) && getName().equals(that.getName()) && getInitials().equals(that.getInitials()); }
/** * Returns where the book should be located * @param bookMetaData meta information about the book * @return the URI locating the resource * @throws BookException thrown if an issue is encountered, e.g. missing data files. */ public static URI getExpandedDataPath(BookMetaData bookMetaData) throws BookException { URI loc = NetUtil.lengthenURI(bookMetaData.getLibrary(), bookMetaData.getProperty(SwordBookMetaData.KEY_DATA_PATH)); if (loc == null) { // FIXME(DMS): missing parameter throw new BookException(JSOtherMsg.lookupText("Missing data files for old and new testaments in {0}.")); } return loc; }
public void putProperty(String key, String value) { bmd.putProperty(key, value, false); }
@Override protected String getEntry(RawBackendState state, String name, Testament testament, long index) throws IOException { RandomAccessFile idxRaf; RandomAccessFile txtRaf; idxRaf = state.getIdxRaf(testament); txtRaf = state.getTextRaf(testament); DataIndex dataIndex = getIndex(idxRaf, index); int size = dataIndex.getSize(); if (size == 0) { return ""; } if (size < 0) { log.error("In {}: Verse {} has a bad index size of {}.", getBookMetaData().getInitials(), name, Integer.toString(size)); return ""; } try { File dataFile = getDataTextFile(txtRaf, dataIndex); byte[] textBytes = readTextDataFile(dataFile); decipher(textBytes); return SwordUtil.decode(name, textBytes, getBookMetaData().getBookCharset()); } catch (BookException e) { throw new IOException(e.getMessage()); } }
public void downloadDocument(Book document) throws LucidException { Log.d(TAG, "Download requested"); // ensure SBMD is fully, not just partially, loaded BookMetaData bmd = document.getBookMetaData(); if (bmd!=null && bmd instanceof SwordBookMetaData) { // load full bmd but must retain repo key String repoKey = bmd.getProperty(DownloadManager.REPOSITORY_KEY); ((SwordBookMetaData)bmd).reload(); bmd.setProperty(DownloadManager.REPOSITORY_KEY, repoKey); } if (!downloadQueue.isInQueue(document)) { // the download happens in another thread RepoBase repo = repoFactory.getRepoForBook(document); downloadQueue.addDocumentToDownloadQueue(document, repo); // if a font is required then download that too String font = fontControl.getFontForBook(document); if (!StringUtils.isEmpty(font) && !fontControl.exists(font)) { // the download happens in another thread fontControl.downloadFont(font); } } }
if (book.getBookMetaData().getProperty("Versification") != null) { v11nName = book.getBookMetaData().getProperty("Versification").toString(); boolean includeStrongs = book.getBookMetaData().hasFeature(FeatureType.STRONGS_NUMBERS) && policy.isStrongsIndexed(); boolean includeXrefs = book.getBookMetaData().hasFeature(FeatureType.SCRIPTURE_REFERENCES) && policy.isXrefIndexed(); boolean includeNotes = book.getBookMetaData().hasFeature(FeatureType.FOOTNOTES) && policy.isNoteIndexed(); boolean includeHeadings = book.getBookMetaData().hasFeature(FeatureType.HEADINGS) && policy.isTitleIndexed(); boolean includeMorphology = book.getBookMetaData().hasFeature(FeatureType.MORPHOLOGY) && policy.isMorphIndexed();
osisToHtmlParameters.setLeftToRight(bmd.isLeftToRight()); osisToHtmlParameters.setLanguageCode(book.getLanguage().getCode()); osisToHtmlParameters.setModuleBasePath(book.getBookMetaData().getLocation());
/** * Determine where an index should be stored * * @param book * The book to be indexed * @return A URI to store stuff in * @throws IOException * If there is a problem in finding where to store stuff */ protected URI getStorageArea(Book book) throws IOException { BookMetaData bmd = book.getBookMetaData(); String driverName = bmd.getDriverName(); String bookName = bmd.getInitials(); assert driverName != null; assert bookName != null; //URI driver = NetUtil.lengthenURI(baseFolderURI, driverName); return NetUtil.lengthenURI(baseFolderURI, driverName + NetUtil.SEPARATOR + bookName); }
protected void updateDataFile(long ordinal, File txtFile) throws IOException { String fileName = String.format("%07d\r\n", Long.valueOf(ordinal)); BufferedOutputStream bos = null; try { bos = new BufferedOutputStream(new FileOutputStream(txtFile, true)); bos.write(fileName.getBytes(getBookMetaData().getBookCharset())); } finally { if (bos != null) { bos.close(); } } }
public BookCategory getBookCategory() { return bmd.getBookCategory(); }
public BookDriver getDriver() { return bmd == null ? null : bmd.getDriver(); }
public String getDriverName() { return bmd == null ? null : bmd.getDriverName(); }