org.deepfs.fsml
Class ParserRegistry

java.lang.Object
  extended by org.deepfs.fsml.ParserRegistry

public final class ParserRegistry
extends Object

Registry for file parsers.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Bastian Lemke

Constructor Summary
ParserRegistry()
          Constructor.
 
Method Summary
 String[][] availableParsers()
          Returns all available parsers.
 IFileParser getFallbackParser()
          Gets the fallback parser implementation.
 IFileParser getParser(String suffix)
          Gets a parser implementation for given file suffix.
static void register(String suffix, Class<? extends IFileParser> c)
          Registers a parser implementation with the fs parser.
static void registerFallback(Class<? extends IFileParser> c)
          Registers a fallback parser implementation with the fs parser.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParserRegistry

public ParserRegistry()
Constructor.

Method Detail

register

public static void register(String suffix,
                            Class<? extends IFileParser> c)
Registers a parser implementation with the fs parser.

Parameters:
suffix - the suffix to register the parser implementation for
c - the parser implementation class

registerFallback

public static void registerFallback(Class<? extends IFileParser> c)
Registers a fallback parser implementation with the fs parser.

Parameters:
c - the parser implementation class

getParser

public IFileParser getParser(String suffix)
                      throws ParserException
Gets a parser implementation for given file suffix.

Parameters:
suffix - the file suffix to get the parser for
Returns:
the parser implementation or null if no implementation is available
Throws:
ParserException - if the parser could not be loaded

getFallbackParser

public IFileParser getFallbackParser()
                              throws ParserException
Gets the fallback parser implementation.

Returns:
the fallback parser implementation or null if no fallback parser is available
Throws:
ParserException - if the parser could not be loaded

availableParsers

public String[][] availableParsers()
Returns all available parsers.

Returns:
all available parsers