Class MetaDataFile


  • public class MetaDataFile
    extends MetaDataHolder
    The Class MetaDataFile providing some static functions to read and write meta data files.
    Author:
    Martin Scharm
    • Constructor Detail

      • MetaDataFile

        public MetaDataFile()
    • Method Detail

      • readFile

        public static void readFile​(Path file,
                                    HashMap<String,​ArchiveEntry> entries,
                                    CombineArchive archive,
                                    MetaDataHolder metaMetaHolder,
                                    List<Path> metaDataFiles,
                                    boolean continueOnError,
                                    List<String> errors)
                             throws ParseException,
                                    org.jdom2.JDOMException,
                                    IOException,
                                    CombineArchiveException
        Read a meta data file containing descriptions about the archive and/or its entries given in entries.
        Parameters:
        file - the file containing meta data
        entries - the entries available in the corresponding archive
        archive - the archive which contains this file
        metaMetaHolder - the meta data of meta data
        metaDataFiles - the meta data file to evaluate
        continueOnError - ignore errors and continue (as far as possible)
        errors - the list of occurred errors
        Throws:
        ParseException - the parse exception
        org.jdom2.JDOMException - the jDOM exception
        IOException - Signals that an I/O exception has occurred.
        CombineArchiveException - the combine archive exception
      • addAllMetaToEntry

        public static int addAllMetaToEntry​(Path file,
                                            ArchiveEntry entry)
                                     throws org.jdom2.JDOMException,
                                            IOException
        Adds all descriptions of a file to a single entry, assuming all are about this file (ignoring the actual about!).
        Parameters:
        file - the file containing the meta data
        entry - the entry in the archive
        Returns:
        the number of descriptions added to entry
        Throws:
        org.jdom2.JDOMException - the jDOM exception
        IOException - Signals that an I/O exception has occurred.
      • writeFile

        public static List<File> writeFile​(File baseDir,
                                           HashMap<String,​ArchiveEntry> entries,
                                           CombineArchive archive,
                                           MetaDataHolder metaMetaHolder)
                                    throws IOException,
                                           TransformerException
        Write the meta data about the archive and its entries given in archive and entries to a single meta data file.

        This method will create one meta data file for all description. Thus, the returned list of files will be of size one. The meta data file will be named baseDir/metadata(-[-0-9a-f]+)?.rdf. See writeFiles(File,HashMap,CombineArchive,MetaDataHolder) if you want to store the meta data in a multiple files, one for each entry.

        Parameters:
        baseDir - the base directory to store the file
        entries - the archive entries
        archive - the archive which will contain the files
        metaMetaHolder - the meta data of meta data
        Returns:
        the list of files th the meta data of meta dataat were created (should be always of size one)
        Throws:
        IOException - Signals that an I/O exception has occurred.
        TransformerException - the transformer exception