org.deckfour.xes.in
Class XParser

java.lang.Object
  extended by org.deckfour.xes.in.XParser
Direct Known Subclasses:
XesXmlParser, XMxmlParser

public abstract class XParser
extends Object

This abstract class describes a parser for reading XES models from a given input stream.

Author:
Christian W. Guenther (christian@deckfour.org)

Constructor Summary
XParser()
           
 
Method Summary
abstract  String author()
          Returns the name of the author of this parser.
abstract  boolean canParse(File file)
          Checks whether this parser can handle the given file.
abstract  String description()
          Returns a brief description of this parser.
abstract  String name()
          Returns the name of this parser or, more specifically, the name of the format it can process.
 List<XLog> parse(File file)
          Parses the given file, and returns the XLog instances extracted.
abstract  List<XLog> parse(InputStream is)
          Parses the given input stream, and returns the XLog instances extracted.
 String toString()
          toString() defaults to name().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XParser

public XParser()
Method Detail

name

public abstract String name()
Returns the name of this parser or, more specifically, the name of the format it can process.


description

public abstract String description()
Returns a brief description of this parser.


author

public abstract String author()
Returns the name of the author of this parser.


canParse

public abstract boolean canParse(File file)
Checks whether this parser can handle the given file.

Parameters:
file - File to check against parser.
Returns:
Whether this parser can handle the given file.

parse

public abstract List<XLog> parse(InputStream is)
                          throws Exception
Parses the given input stream, and returns the XLog instances extracted.

Parameters:
is - Stream to read XLog instances from.
Returns:
A list of XLog instances read from the given input stream. The number of read XLogs is at least one. If no XLog instance could be parsed, the parser is expected to throw an exception.
Throws:
Exception

parse

public List<XLog> parse(File file)
                 throws Exception
Parses the given file, and returns the XLog instances extracted. The file is first checked against this parser, to check whether it can be handled. If the parser cannot handle the given file, or the extraction itself fails, the parser should raise an IOException.

Parameters:
file - The file to be parsed.
Returns:
List of XLog instances parsed from the given file.
Throws:
Exception - Raised in case the parser fails, or the given file cannot be processed.

toString

public String toString()
toString() defaults to name().

Overrides:
toString in class Object