org.semwebcentral.sweetrules.infrastructure
Class AbstractSweetTranslatorDescriptor

java.lang.Object
  extended byorg.semwebcentral.sweetrules.infrastructure.AbstractSweetTranslatorDescriptor
All Implemented Interfaces:
java.lang.Cloneable, ISweetTranslatorDescriptor
Direct Known Subclasses:
SweetB2CLPTranslatorDescriptor, SweetB2RTranslatorDescriptor, SweetB2XSBTranslatorDescriptor, SweetBRML2KIFTranslatorDescriptor, SweetBRML2SmodelsTranslatorDescriptor, SweetCLP2BRMLTranslatorDescriptor, SweetCLP2XSBTranslatorDescriptor, SweetCompositeTranslatorDescriptor, SweetJess2RuleMLTranslatorDescriptor, SweetKIF2BRMLTranslatorDescriptor, SweetOWL2RuleMLTranslatorDescriptor, SweetOWL2SWRLXMLTranslatorDescriptor, SweetR2BTranslatorDescriptor, SweetRuleML2JessTranslatorDescriptor, SweetRuleMLFacts2RDFTranslatorDescriptor, SweetSmodels2BRMLTranslatorDescriptor, SweetSWRLRDF2SWRLXMLTranslatorDescriptor, SweetSWRLXML2CLIPSTranslatorDescriptor, SweetSWRLXML2JenaTranslatorDescriptor, SweetSWRLXML2SWRLRDFTranslatorDescriptor, SweetTranslatorDescriptor, SweetXSB2CLPTranslatorDescriptor

public abstract class AbstractSweetTranslatorDescriptor
extends java.lang.Object
implements ISweetTranslatorDescriptor

This is a simple abstract implementation of the ISweetTranslatorDescriptor class which provides simple APIs to get/set data and a simple constructor for purpose of easy extensibility and code reuse

TODO: 1) Enhance the constructor capability

Author:
Shashidhara K Ganjugunte, Dr. Benjamin Grosof, Dr. Said Tabet, Chitravanu Neogy

Field Summary
protected  java.lang.String className
          The class name of the translator
protected  java.lang.String krTranslatorDocContents
          KR translator document contents
protected  Logger logger
          The logger object
protected  ISweetKRDescriptor sourceKRDescriptor
          The source KR descriptor
protected  ISweetKRDescriptor targetKRDescriptor
          The target KR descriptor
protected  ISweetInvocationDescriptor translatorOptionHeader
          The option header for the translator
protected  ISweetCanonicalVersionNumber translatorVersionNumber
          Translator version number
 
Constructor Summary
AbstractSweetTranslatorDescriptor(ISweetKRDescriptor source, ISweetKRDescriptor target, ISweetInvocationDescriptor optionHeader, java.lang.String className)
          Constructor to accept Source and Target KR along with options and the class name of the translator being described These are the minimal parameters are needed for a translator descriptor
 
Method Summary
 java.lang.Object clone()
          The clone method to clone this object
 java.lang.String getKRTranslatorDoc()
          KR translator document describes the translation (including caveats).
 ISweetInvocationDescriptor getOptions()
          Retrieves the currently set options, if no options are explicitly set then the default options are returned.
 ISweetKRDescriptor getSourceKRDescriptor()
          Returns the source format supported by this translator
 ISweetKRDescriptor getTargetKRDescriptor()
          Returns the target format supported by this translator
 java.lang.String getTranslatorClassName()
          Gets the class name of the ISweetTranslator implementation corresponding to this descriptor
 ISweetCanonicalVersionNumber getTranslatorVersionNumber()
          Retreives the version number as an instance of CanonicalVersionNumber, which can further be used to retrieve the native version number if so desired.
 void setKRTranslatorDoc(java.lang.String translatorDocContents)
          KR translator document describes the translation (including caveats).
 void setOptions(ISweetInvocationDescriptor options)
          Sets the options for the translator.
 void setTranslatorClassName(java.lang.String className)
          Sets the class name of the ISweetTranslator implementation corresponding to this descriptor
 void setTranslatorVersionNumber(ISweetCanonicalVersionNumber versionNumber)
          Sets the version number as an instance of CanonicalVersionNumber.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sourceKRDescriptor

protected ISweetKRDescriptor sourceKRDescriptor
The source KR descriptor


targetKRDescriptor

protected ISweetKRDescriptor targetKRDescriptor
The target KR descriptor


krTranslatorDocContents

protected java.lang.String krTranslatorDocContents
KR translator document contents


translatorVersionNumber

protected ISweetCanonicalVersionNumber translatorVersionNumber
Translator version number


translatorOptionHeader

protected ISweetInvocationDescriptor translatorOptionHeader
The option header for the translator


className

protected java.lang.String className
The class name of the translator


logger

protected Logger logger
The logger object

Constructor Detail

AbstractSweetTranslatorDescriptor

public AbstractSweetTranslatorDescriptor(ISweetKRDescriptor source,
                                         ISweetKRDescriptor target,
                                         ISweetInvocationDescriptor optionHeader,
                                         java.lang.String className)
Constructor to accept Source and Target KR along with options and the class name of the translator being described These are the minimal parameters are needed for a translator descriptor

Parameters:
source - The source KR descriptor
target - The target KR descriptor
optionHeader - The options for the translator
className - The class name of the translator being described
Method Detail

getSourceKRDescriptor

public ISweetKRDescriptor getSourceKRDescriptor()
Returns the source format supported by this translator

Specified by:
getSourceKRDescriptor in interface ISweetTranslatorDescriptor
Returns:
the KRDescriptor of the source format

getTargetKRDescriptor

public ISweetKRDescriptor getTargetKRDescriptor()
Returns the target format supported by this translator

Specified by:
getTargetKRDescriptor in interface ISweetTranslatorDescriptor
Returns:
the KRDescriptor of the target format

getKRTranslatorDoc

public java.lang.String getKRTranslatorDoc()
KR translator document describes the translation (including caveats). This API retreives the contents of such a doc if it exists or returns null if it doesn't

Specified by:
getKRTranslatorDoc in interface ISweetTranslatorDescriptor
Returns:
The contents of KR translator document which describes the translation process

setKRTranslatorDoc

public void setKRTranslatorDoc(java.lang.String translatorDocContents)
KR translator document describes the translation (including caveats). This API recieves the contents of such a doc and caches it

Specified by:
setKRTranslatorDoc in interface ISweetTranslatorDescriptor
Parameters:
translatorDocContents - The contents of KR translator document which describes the translation process

getTranslatorVersionNumber

public ISweetCanonicalVersionNumber getTranslatorVersionNumber()
Retreives the version number as an instance of CanonicalVersionNumber, which can further be used to retrieve the native version number if so desired. CanonicalVersionNumber facilitates easier comparison of version numbers

Specified by:
getTranslatorVersionNumber in interface ISweetTranslatorDescriptor
Returns:
The canonical version number of the translator

setTranslatorVersionNumber

public void setTranslatorVersionNumber(ISweetCanonicalVersionNumber versionNumber)
Sets the version number as an instance of CanonicalVersionNumber. CanonicalVersionNumber is an abstraction to ease the task of version number comparsion

Specified by:
setTranslatorVersionNumber in interface ISweetTranslatorDescriptor
Parameters:
versionNumber - The canonical version number of the translator

getOptions

public ISweetInvocationDescriptor getOptions()
Retrieves the currently set options, if no options are explicitly set then the default options are returned. If null is returned then there are no options set, default or otherwise.

Specified by:
getOptions in interface ISweetTranslatorDescriptor
Returns:
The option header which is currently used by the translator

setOptions

public void setOptions(ISweetInvocationDescriptor options)
                throws SweetTranslatorException
Sets the options for the translator.

Specified by:
setOptions in interface ISweetTranslatorDescriptor
Parameters:
options - The option header for setting any options to the translator If it is null the default options are used.
Throws:
TranslatorException - If any option is not supported. Note that there is a difference between "not supported" and "not relevant" options that are not relevant are ignored even if they are specified in the OptionsHeader
SweetTranslatorException

getTranslatorClassName

public java.lang.String getTranslatorClassName()
                                        throws SweetTranslatorException
Gets the class name of the ISweetTranslator implementation corresponding to this descriptor

Specified by:
getTranslatorClassName in interface ISweetTranslatorDescriptor
Returns:
The full class name of ISweetTranslator implementation
Throws:
TranslatorException - if the class name is not set
SweetTranslatorException

setTranslatorClassName

public void setTranslatorClassName(java.lang.String className)
Sets the class name of the ISweetTranslator implementation corresponding to this descriptor

Specified by:
setTranslatorClassName in interface ISweetTranslatorDescriptor
Parameters:
className - Full class name of the ISweetTranslator implementation corresponding to this descriptor

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
The clone method to clone this object

Specified by:
clone in interface ISweetTranslatorDescriptor
Returns:
The cloned object
Throws:
java.lang.CloneNotSupportedException - if an error occurs