org.vivoweb.harvester.translate
Class XSLTranslator

java.lang.Object
  extended by org.vivoweb.harvester.translate.XSLTranslator

public class XSLTranslator
extends java.lang.Object

Takes XML Files and uses an XSL file to translate the data into the desired ontology

Author:
Stephen V. Williams swilliams@ctrip.ufl.edu

Field Summary
protected  RecordHandler inStore
          record handler for incoming records
protected  RecordHandler outStore
          record handler for storing records
 
Constructor Summary
XSLTranslator(ArgList argumentList)
          Constructor
XSLTranslator(RecordHandler inRecordHandler, RecordHandler outRecordHandler, java.io.InputStream translationStream, boolean force)
          Constructor
XSLTranslator(java.lang.String[] args)
          Constructor
 
Method Summary
 void execute()
          checks again for the necessary file and makes sure that they exist
static void main(java.lang.String... args)
          Main method
 void setTranslation(java.io.File transFile)
          Set translation file from a file
 void setTranslation(java.io.InputStream transFileStream)
          Set translation file from an inputSteam
static void xmlTranslate(java.io.InputStream inStream, java.io.OutputStream outStream, java.io.InputStream translationStream)
          using the javax xml transform factory this method uses the xsl to translate XML into the desired format designated in the xsl.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inStore

protected RecordHandler inStore
record handler for incoming records


outStore

protected RecordHandler outStore
record handler for storing records

Constructor Detail

XSLTranslator

public XSLTranslator(java.lang.String[] args)
              throws java.io.IOException
Constructor

Parameters:
args - commandline arguments
Throws:
java.io.IOException - error creating task

XSLTranslator

public XSLTranslator(ArgList argumentList)
              throws java.io.IOException
Constructor

Parameters:
argumentList -
  • translationStream the file that details the translation from the original xml to the target format
  • inRecordHandler the files/records that require translation
  • outRecordHandler the output record for the translated files
  • force translate all input records, even if previously processed
Throws:
java.io.IOException - error reading files

XSLTranslator

public XSLTranslator(RecordHandler inRecordHandler,
                     RecordHandler outRecordHandler,
                     java.io.InputStream translationStream,
                     boolean force)
              throws java.io.IOException
Constructor

Parameters:
translationStream - the file that details the translation from the original xml to the target format
inRecordHandler - the files/records that require translation
outRecordHandler - the output record for the translated files
force - translate all input records, even if previously processed
Throws:
java.io.IOException - error reading files
Method Detail

setTranslation

public void setTranslation(java.io.InputStream transFileStream)
                    throws java.io.IOException
Set translation file from an inputSteam

Parameters:
transFileStream - valid type of translation file is xslt
Throws:
java.io.IOException - error reading from stream

setTranslation

public void setTranslation(java.io.File transFile)
                    throws java.io.IOException
Set translation file from a file

Parameters:
transFile - valid type of translation file is xslt
Throws:
java.io.IOException - error reading from file

execute

public void execute()
             throws java.io.IOException
checks again for the necessary file and makes sure that they exist

Throws:
java.io.IOException - error processing

xmlTranslate

public static void xmlTranslate(java.io.InputStream inStream,
                                java.io.OutputStream outStream,
                                java.io.InputStream translationStream)
                         throws java.io.IOException
using the javax xml transform factory this method uses the xsl to translate XML into the desired format designated in the xsl.

Parameters:
inStream - the input stream
outStream - the output stream
translationStream - the stream for the xsl
Throws:
java.io.IOException - error translating

main

public static void main(java.lang.String... args)
Main method

Parameters:
args - commandline arguments