org.drools.smf
Class DefaultSemanticsRepository

java.lang.Object
  extended by org.drools.smf.DefaultSemanticsRepository
All Implemented Interfaces:
SemanticsRepository

public final class DefaultSemanticsRepository
extends Object
implements SemanticsRepository

Default SemanticsRepository which uses discovery to autoload semantic modules.

Any semantic module that conforms to the SMF contract will be discovered and autoloaded upon first access of the DefaultSemanticsRepository.

To be discovered, the module should be in a jar with a module descriptor located at /META-INF/drools-semantics.properties.

Version:
$Id: DefaultSemanticsRepository.java,v 1.4 2004/06/22 17:17:27 bob Exp $
Author:
bob mcwhirter

Method Summary
static SemanticsRepository getInstance()
          Retrieve the singleton instance.
 SemanticModule[] getSemanticModules()
          Retieve all SemanticModules.
protected  void init()
          Initialize and perform discovery.
protected  void loadConfig(String path)
           
protected  void loadConfig(URL url)
           
protected  void loadSemantics(String semanticsName)
           
 SemanticModule lookupSemanticModule(String uri)
          Lookup a SemanticModule by URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SemanticsRepository getInstance()
                                       throws IOException,
                                              SemanticsReaderException
Retrieve the singleton instance.

Returns:
The singleton instance.
Throws:
Exception - If an error occurs while performing discovery and loading of the semantic modules.
IOException
SemanticsReaderException

init

protected void init()
             throws IOException,
                    SemanticsReaderException
Initialize and perform discovery.

Throws:
Exception - If an error occurs while performing discovery and loading of the semantic modules.
IOException
SemanticsReaderException

loadConfig

protected void loadConfig(String path)
                   throws IOException,
                          SemanticsReaderException
Throws:
IOException
SemanticsReaderException

loadConfig

protected void loadConfig(URL url)
                   throws IOException,
                          SemanticsReaderException
Throws:
IOException
SemanticsReaderException

loadSemantics

protected void loadSemantics(String semanticsName)
                      throws IOException,
                             SemanticsReaderException
Throws:
IOException
SemanticsReaderException

lookupSemanticModule

public SemanticModule lookupSemanticModule(String uri)
                                    throws NoSuchSemanticModuleException
Description copied from interface: SemanticsRepository
Lookup a SemanticModule by URI.

Specified by:
lookupSemanticModule in interface SemanticsRepository
Parameters:
uri - The URI.
Returns:
The bound SemanticModule.
Throws:
NoSuchSemanticModuleException - If no module is bound to the URI.
See Also:
SemanticsRepository

getSemanticModules

public SemanticModule[] getSemanticModules()
Description copied from interface: SemanticsRepository
Retieve all SemanticModules.

Specified by:
getSemanticModules in interface SemanticsRepository
Returns:
All semantic modules.
See Also:
SemanticsRepository


Copyright © 2001-2005 The Codehaus. All Rights Reserved.