/*
* Meviz - Various tools collection to work with multimedia.
* Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.AbstractFile;
import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.DirectoryFile;
import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.GeneralFile;
+import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.MevizSpecialFile;
import eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes.Picture;
/**
}
+ private AbstractFile getAbstractFile(final File parentDirectory,
+ final File file, final String fileName) throws IOException,
+ ImageFormatError {
+
+ if (file.isDirectory())
+ return new DirectoryFile(parentDirectory, fileName);
+
+ final String fileExtension = FilePathParser.getFileExtension(fileName)
+ .toLowerCase();
+
+ if (AbstractIndexer.isImage(fileExtension))
+ return new Picture(parentDirectory, fileName);
+
+ if (fileExtension.equals("meviz"))
+ return new MevizSpecialFile(parentDirectory, fileName);
+
+ return new GeneralFile(parentDirectory, fileName);
+ }
+
public AbstractFile getFile(final String fileName) throws IOException {
return fileNameToFileMap.get(fileName);
}
final String fileName = file.getName();
- final AbstractFile abstractFile;
-
- if (file.isDirectory())
- abstractFile = new DirectoryFile(parentDirectory, fileName);
- else {
- final String fileExtension = FilePathParser.getFileExtension(
- fileName).toLowerCase();
-
- if (AbstractIndexer.isImage(fileExtension))
- abstractFile = new Picture(parentDirectory, fileName);
- else
- abstractFile = new GeneralFile(parentDirectory, fileName);
- }
+ final AbstractFile abstractFile = getAbstractFile(parentDirectory,
+ file, fileName);
fileNameToFileMap.put(fileName, abstractFile);
--- /dev/null
+package eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes;
+
+import java.io.File;
+import java.io.IOException;
+
+public class MevizSpecialFile extends AbstractFile {
+
+ private static final long serialVersionUID = -8749190459653455640L;
+
+ public MevizSpecialFile(final File parentDirectory, final String fileName)
+ throws IOException {
+ super(parentDirectory, fileName);
+ }
+
+ @Override
+ protected void updateFileMetainfo(final File parentDirectory)
+ throws IOException {
+ }
+
+}