org.shiwa.fgi.iwir
Class XMLHandler

java.lang.Object
  extended by org.shiwa.fgi.iwir.XMLHandler

public final class XMLHandler
extends java.lang.Object

The Class XMLHandler provides a simple interface for handling IWIR workflow objects.


Method Summary
static IWIR readFile(java.io.File file)
          Constructs the object representation of an IWIR workflow reading from a file.
static IWIR readFile(java.lang.String path)
          Constructs the object representation of an IWIR workflow reading from a file from a given path.
static IWIR readStream(java.io.InputStream in)
          Constructs the object representation of an IWIR workflow from an InputStream.
static IWIR readString(java.lang.String s)
          Constructs the object representation of an IWIR workflow from a String.
static void validateAgainstSchema(java.io.File file)
          Validate against schema.
static void validateAgainstSchema(java.io.InputStream is)
          Validate against schema.
static void validateAgainstSchema(IWIR iwir)
          Validate against schema.
static void writeFile(IWIR i, java.io.File file)
          Writes an IWIR object to a given file.
static void writeFile(IWIR i, java.lang.String path)
          Writes an IWIR object to a given path.
static void writeOut(IWIR i, java.io.OutputStream out)
          Writes an IWIR object to a given OutputStream.
static java.lang.String writeString(IWIR i)
          Returns a String representation of an IWIR object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readString

public static IWIR readString(java.lang.String s)
                       throws NotWellFormedException
Constructs the object representation of an IWIR workflow from a String. Validates the IWIR object against the XML schema. Validates the IWIR object after reading calling the validate method of IWIR object.

Parameters:
s - the the String to read.
Returns:
the IWIR object
Throws:
NotWellFormedException - if the workflow is not well formed

writeString

public static java.lang.String writeString(IWIR i)
                                    throws NotWellFormedException
Returns a String representation of an IWIR object. Validates the IWIR object against the XML schema. Validates the IWIR object before writing calling the validate method of the IWIR object.

Parameters:
i - the IWIR object
Returns:
the string
Throws:
NotWellFormedException - if the workflow is not well formed

readStream

public static IWIR readStream(java.io.InputStream in)
                       throws NotWellFormedException
Constructs the object representation of an IWIR workflow from an InputStream. Validates the IWIR object against the XML schema. Validates the IWIR object after reading calling the validate method of IWIR object.

Parameters:
in - the InputStream
Returns:
the IWIR object
Throws:
NotWellFormedException - if the workflow is not well formed

writeOut

public static void writeOut(IWIR i,
                            java.io.OutputStream out)
                     throws java.io.IOException,
                            NotWellFormedException
Writes an IWIR object to a given OutputStream. Validates the IWIR object against the XML schema. Validates the IWIR object before writing calling the validate method of the IWIR object.

Parameters:
i - the IWIR object
out - the OutputStream
Throws:
java.io.IOException - Signals that an I/O exception has occurred.
NotWellFormedException - if the workflow is not well formed

readFile

public static IWIR readFile(java.lang.String path)
                     throws java.io.FileNotFoundException,
                            NotWellFormedException
Constructs the object representation of an IWIR workflow reading from a file from a given path. Validates the IWIR object against the XML schema. Validates the IWIR object after reading calling the validate method of IWIR object.

Parameters:
path - the path to the file
Returns:
the IWIR object
Throws:
java.io.FileNotFoundException - the file not found exception
NotWellFormedException - if the work flow is not well formed

readFile

public static IWIR readFile(java.io.File file)
                     throws java.io.FileNotFoundException,
                            NotWellFormedException
Constructs the object representation of an IWIR workflow reading from a file. Validates the IWIR object against the XML schema. Validates the IWIR object after reading calling the validate method of IWIR object.

Parameters:
file - the file to read
Returns:
the IWIR object
Throws:
java.io.FileNotFoundException - the file not found exception
NotWellFormedException - if the workflow is not wellformed

writeFile

public static void writeFile(IWIR i,
                             java.lang.String path)
                      throws java.io.FileNotFoundException,
                             java.io.IOException,
                             NotWellFormedException
Writes an IWIR object to a given path. Validates the IWIR object against the XML schema. Validates the IWIR object before writing calling the validate method of the IWIR object.

Parameters:
i - the IWIR object
path - the path to the file
Throws:
java.io.FileNotFoundException - if file can not be found
java.io.IOException - Signals that an I/O exception has occurred.
NotWellFormedException - if the workflow is not well formed

writeFile

public static void writeFile(IWIR i,
                             java.io.File file)
                      throws java.io.FileNotFoundException,
                             java.io.IOException,
                             NotWellFormedException
Writes an IWIR object to a given file. Validates the IWIR object against the XML schema. Validates the IWIR object before writing calling the validate method of the IWIR object.

Parameters:
i - the IWIR object
file - the file to write into
Throws:
java.io.FileNotFoundException - if file can not be found
java.io.IOException - Signals that an I/O exception has occurred.
NotWellFormedException - if the workflow is not well formed

validateAgainstSchema

public static void validateAgainstSchema(java.io.InputStream is)
                                  throws NotWellFormedException
Validate against schema.

Parameters:
is - the is
Throws:
NotWellFormedException - if workflow is not wellformed

validateAgainstSchema

public static void validateAgainstSchema(java.io.File file)
                                  throws java.io.FileNotFoundException,
                                         NotWellFormedException
Validate against schema.

Parameters:
file - the file
Throws:
java.io.FileNotFoundException - if fille can not be found
NotWellFormedException - if workflow is not wellformed

validateAgainstSchema

public static void validateAgainstSchema(IWIR iwir)
                                  throws NotWellFormedException
Validate against schema.

Parameters:
iwir - the iwir
Throws:
NotWellFormedException - if workflow is not wellformed