com.bbn.swede.tools.translator
Class TranslationRunner

java.lang.Object
  extended byjava.lang.Thread
      extended bycom.bbn.swede.tools.translator.TranslationRunner
All Implemented Interfaces:
Runnable

public class TranslationRunner
extends Thread

This is a utility class designed to wrap the run of a translation operation. It can be used by clients, but is not intended to be subclassed.

Author:
aperezlo

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TranslationRunner(ITranslator trans)
          Create a new TranslationRunner for the given translator.
 
Method Summary
 void configure(File input, OutputStream output, String inputFormat, String outputFormat)
          Configure this translation runner with the arguments for a single run of the given translator.
 String getErrorString()
          Retrieves the error string generated by the translator during the last run.
 Exception getException()
          Retrieves the uncaught exception generated by the translator during the last run.
 void run()
          Run this translation as a separate thread.
 void runBlocked()
          Run this translation and block the invoking thread until the translation is finished.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TranslationRunner

public TranslationRunner(ITranslator trans)
Create a new TranslationRunner for the given translator.

Parameters:
trans - the translator that this runner will use
Method Detail

configure

public void configure(File input,
                      OutputStream output,
                      String inputFormat,
                      String outputFormat)
Configure this translation runner with the arguments for a single run of the given translator. These arguments are passed directly to the ITranslator.doTranslation(File, OutputStream, String, String) method, and have the same significance as do the parameters to that method.

Parameters:
input -
output -
inputFormat -
outputFormat -
See Also:
ITranslator.doTranslation(File, OutputStream, String, String)

getErrorString

public String getErrorString()
Retrieves the error string generated by the translator during the last run.

Returns:
The error string, if any error was generated

getException

public Exception getException()
Retrieves the uncaught exception generated by the translator during the last run.

Returns:
The uncaught exception, if any was thrown.

run

public void run()
Run this translation as a separate thread.

See Also:
Runnable.run()

runBlocked

public void runBlocked()
Run this translation and block the invoking thread until the translation is finished.



Copyright © 2004-2005 BBN Technologies. All Rights Reserved.