org.semwebcentral.sweetrules.infrastructure
Class SweetComponentRepositoryManager

java.lang.Object
  extended byorg.semwebcentral.sweetrules.infrastructure.SweetComponentRepositoryManager
All Implemented Interfaces:
ISweetComponentRepositoryManager

public class SweetComponentRepositoryManager
extends java.lang.Object
implements ISweetComponentRepositoryManager

Singleton class of repository manager TODO 1) Handle ISweetInvocationDescriptor/equivalent in searching esp. for translators 2) Enhance searching capability of the class

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

Field Summary
private  ISweetIERepository inferenceEngineRepository
          The inference engine repository object
private  Logger logger
          The logger object
private static SweetComponentRepositoryManager repositoryManagerInstance
          The singleton instance
private  ISweetTranslatorRepository translatorRepository
          The translator repository object
 
Constructor Summary
private SweetComponentRepositoryManager()
          Private constructor ensuring a single instance
 
Method Summary
 void addComponent(java.lang.Object component, boolean overWrite)
          This adds a component belonging to the specified componentRepositoryClass
 java.lang.Object getComponent(java.lang.Object componentDescriptor)
          Returns the component specified by the descriptor
static SweetComponentRepositoryManager getInstance()
          Get method for the singleton object
 java.lang.Object[] searchCompositeComponent(java.lang.Object componentDescriptor)
          Performs a search on the components and returns the match This considers transitive closure
 java.lang.Object[] searchSimpleComponent(java.lang.Object componentDescriptor)
          Performs a search on the components and returns the match
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

repositoryManagerInstance

private static SweetComponentRepositoryManager repositoryManagerInstance
The singleton instance


translatorRepository

private ISweetTranslatorRepository translatorRepository
The translator repository object


inferenceEngineRepository

private ISweetIERepository inferenceEngineRepository
The inference engine repository object


logger

private Logger logger
The logger object

Constructor Detail

SweetComponentRepositoryManager

private SweetComponentRepositoryManager()
Private constructor ensuring a single instance

Method Detail

getInstance

public static SweetComponentRepositoryManager getInstance()
Get method for the singleton object

Returns:
The singleton instance of the SweetComponentRepositoryManager

addComponent

public void addComponent(java.lang.Object component,
                         boolean overWrite)
                  throws SweetException
Description copied from interface: ISweetComponentRepositoryManager
This adds a component belonging to the specified componentRepositoryClass

Specified by:
addComponent in interface ISweetComponentRepositoryManager
Parameters:
component - The component to be added
overWrite - If true it specifies that if the object exists then it should be overWritten
Throws:
SweetException - If either component/componentRepository class is unsupported or
if overWrite is false and the object exists

getComponent

public java.lang.Object getComponent(java.lang.Object componentDescriptor)
                              throws SweetException
Description copied from interface: ISweetComponentRepositoryManager
Returns the component specified by the descriptor

Specified by:
getComponent in interface ISweetComponentRepositoryManager
Parameters:
componentDescriptor - The descriptor of the component desired
Returns:
The desired component if it exists null otherwise
Throws:
SweetException - if the descriptor type is unknown

searchSimpleComponent

public java.lang.Object[] searchSimpleComponent(java.lang.Object componentDescriptor)
                                         throws SweetException
Performs a search on the components and returns the match

Specified by:
searchSimpleComponent in interface ISweetComponentRepositoryManager
Parameters:
componentDescriptor - The descriptor of the component to be searched
Returns:
The component(s) matching the search
Throws:
SweetException - if an error occurs

searchCompositeComponent

public java.lang.Object[] searchCompositeComponent(java.lang.Object componentDescriptor)
                                            throws SweetException
Performs a search on the components and returns the match This considers transitive closure

Specified by:
searchCompositeComponent in interface ISweetComponentRepositoryManager
Parameters:
componentDescriptor - The descriptor of the component to be searched
Returns:
The component(s) matching the search
Throws:
SweetException - if an error occurs