com.bbn.swede.tools.translator
Class AbstractTranslator

java.lang.Object
  extended bycom.bbn.swede.tools.translator.AbstractTranslator
All Implemented Interfaces:
ITranslator
Direct Known Subclasses:
JenaTranslator

public abstract class AbstractTranslator
extends Object
implements ITranslator

This is the default implementation of the ITranslator interface. It provides some utility methods to make it easier to implement translators, and is intended to be subclassed - clients must implement:

To access the prexisting OWL representation of the file to translate, use the method #getOWLDocumentFor(File) or #getOWLDocumentFor(IFile)

Author:
aperezlo
See Also:
IOWLDocument

Constructor Summary
AbstractTranslator()
           
 
Method Summary
 String doTranslation(IFile inputFile, OutputStream outputStream, String inputFormatExtension, String outputFormatExtension)
           
protected  File getFileFor(IFile iFile)
          Convenience method to transform an IFile into its matching java.io.File representation.
protected  IFile getIFileFor(File javaFile)
          Gets an IFile for the particular File object.
protected  IOWLDocument getOWLDocumentFor(IFile file)
          Gets a SWeDE IOWLDocument if one exists for the given IFile.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bbn.swede.tools.translator.ITranslator
doTranslation
 

Constructor Detail

AbstractTranslator

public AbstractTranslator()
Method Detail

getOWLDocumentFor

protected IOWLDocument getOWLDocumentFor(IFile file)
Gets a SWeDE IOWLDocument if one exists for the given IFile. This method returns an IOWLDocument if one exists, and null otherwise.

Parameters:
file - the IFile
Returns:
an IOWLDocument associated with file if one exists, or null otherwise

getIFileFor

protected IFile getIFileFor(File javaFile)
Gets an IFile for the particular File object. This method will only return an IFile if it can be said to exist(), which means that an open Eclipse project owns a matching resource. If the IFile can be created for the file, but the file does not exist, this method returns null.

Parameters:
javaFile - a java.io.File for which an IFile is desired.
Returns:
an IFile for the particular javaFile if one exists, null otherwise

getFileFor

protected File getFileFor(IFile iFile)
Convenience method to transform an IFile into its matching java.io.File representation. This method returns null if there is no file in the filesystem that matches the absolute full path of the submitted iFile.

Parameters:
iFile - the IFile for which the local java.io.File is desired
Returns:
the corresponding java.io.File for iFile if it exists on the filesystem, null otherwise

doTranslation

public String doTranslation(IFile inputFile,
                            OutputStream outputStream,
                            String inputFormatExtension,
                            String outputFormatExtension)
                     throws Exception
Throws:
Exception


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