X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fmeviz%2Fhtmlindexer%2FAbstractIndexer.java;h=84a5868edb0b2f5a15e5ee4ab621be338bbad605;hb=99bc9002a93c8ab224934032a1a5fe0c00d5de96;hp=762fcad8ca0ab5810bcf9b3096ec0b246892e1a0;hpb=e4c678d8e9b77ef2e9c8819bbc8b0240463d6770;p=meviz.git diff --git a/src/main/java/eu/svjatoslav/meviz/htmlindexer/AbstractIndexer.java b/src/main/java/eu/svjatoslav/meviz/htmlindexer/AbstractIndexer.java index 762fcad..84a5868 100644 --- a/src/main/java/eu/svjatoslav/meviz/htmlindexer/AbstractIndexer.java +++ b/src/main/java/eu/svjatoslav/meviz/htmlindexer/AbstractIndexer.java @@ -12,9 +12,31 @@ import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.Picture; public abstract class AbstractIndexer { + public static boolean isImage(final String fileExtension) { + for (final String ext : Constants.SUPPORTED_IMAGE_EXTENSIONS) + if (ext.equals(fileExtension)) + return true; + return false; + } + + public static boolean isOgv(final String fileExtension) { + return fileExtension.equalsIgnoreCase("ogv"); + } + + public static boolean shallFileBeIndexed(final File file) { + + if (file.getName().startsWith(".")) + return false; + if (file.getName().startsWith("index")) + if (file.getName().endsWith(".html")) + return false; + + return true; + } + public void compileHtml(final Layout layout, final DirectoryMetadata directory) - throws UnsupportedEncodingException { + throws UnsupportedEncodingException { for (final AbstractFile file : directory.getFiles()) if (file instanceof GeneralFile) { @@ -26,7 +48,7 @@ public abstract class AbstractIndexer { layout.enlistFile(file); } else if (file instanceof Picture) - layout.enlistImage(file); + layout.enlistImage((Picture) file); else if (file instanceof DirectoryFile) layout.enlistDirectory(file); @@ -40,26 +62,4 @@ public abstract class AbstractIndexer { public abstract String getThumbnailUrl(Picture picture, final Dimension desiredDimension, IndexingContext context); - public static boolean isImage(final String fileExtension) { - for (final String ext : Constants.SUPPORTED_IMAGE_EXTENSIONS) - if (ext.equals(fileExtension)) - return true; - return false; - } - - public static boolean isOgv(final String fileExtension) { - return fileExtension.equalsIgnoreCase("ogv"); - } - - public static boolean shallFileBeIndexed(final File file) { - - if (file.getName().startsWith(".")) - return false; - if (file.getName().startsWith("index")) - if (file.getName().endsWith(".html")) - return false; - - return true; - } - }