org.drools.io
Class RuleSetReader

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.drools.io.RuleSetReader
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class RuleSetReader
extends org.xml.sax.helpers.DefaultHandler

RuleSet loader.

Version:
$Id: RuleSetReader.java,v 1.46 2005/02/04 02:13:38 mproctor Exp $
Author:
bob mcwhirter

Field Summary
static String RULES_NAMESPACE_URI
          Namespace URI for the general tags.
 
Constructor Summary
RuleSetReader()
          Construct.
RuleSetReader(RuleBaseContext factoryContext)
          Construct.
RuleSetReader(javax.xml.parsers.SAXParser parser)
          Construct.
RuleSetReader(javax.xml.parsers.SAXParser parser, RuleBaseContext context)
          Construct.
RuleSetReader(javax.xml.parsers.SAXParser parser, SemanticsRepository repo)
          Construct.
RuleSetReader(SemanticsRepository repo)
          Construct.
RuleSetReader(SemanticsRepository repo, RuleBaseContext context)
          Construct.
RuleSetReader(SemanticsRepository repo, javax.xml.parsers.SAXParser parser)
          Construct.
RuleSetReader(SemanticsRepository repo, javax.xml.parsers.SAXParser parser, RuleBaseContext context)
          Construct.
 
Method Summary
 void characters(char[] chars, int start, int len)
           
protected  Configuration endConfiguration()
          End a configuration node.
 void endElement(String uri, String localName, String qname)
           
 void error(org.xml.sax.SAXParseException x)
           
 void fatalError(org.xml.sax.SAXParseException x)
           
(package private)  Object getCurrent()
           
 RuleBaseContext getFactoryContext()
           
 org.xml.sax.Locator getLocator()
          Get the Locator.
(package private)  Object getParent(Class parent)
           
(package private)  LinkedList getParents()
           
(package private)  Object getPeer()
           
 RuleSet getRuleSet()
           
 SemanticsRepository getSemanticsRepository()
           
(package private)  SemanticModule lookupSemanticModule(String uri, String localName)
           
 RuleSet read(org.xml.sax.InputSource in)
          Read a RuleSet from an InputSource.
 RuleSet read(InputStream inputStream)
          Read a RuleSet from an InputStream.
 RuleSet read(Reader reader)
          Read a RuleSet from a Reader.
 RuleSet read(String url)
          Read a RuleSet from a URL.
 RuleSet read(URL url)
          Read a RuleSet from a URL.
 org.xml.sax.InputSource resolveEntity(String publicId, String systemId)
           
 void setLocator(org.xml.sax.Locator locator)
           
(package private)  void setRuleSet(RuleSet ruleSet)
           
protected  void startConfiguration(String name, org.xml.sax.Attributes attrs)
          Start a configuration node.
 void startDocument()
           
 void startElement(String uri, String localName, String qname, org.xml.sax.Attributes attrs)
           
 void warning(org.xml.sax.SAXParseException x)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RULES_NAMESPACE_URI

public static final String RULES_NAMESPACE_URI
Namespace URI for the general tags.

See Also:
Constant Field Values
Constructor Detail

RuleSetReader

public RuleSetReader()
Construct.

Uses the default JAXP SAX parser and the default classpath-based DefaultSemanticModule.


RuleSetReader

public RuleSetReader(javax.xml.parsers.SAXParser parser)
Construct.

Uses the default classpath-based DefaultSemanticModule.

Parameters:
parser - The SAX parser.

RuleSetReader

public RuleSetReader(SemanticsRepository repo)
Construct.

Parameters:
repo - The semantics repository.

RuleSetReader

public RuleSetReader(RuleBaseContext factoryContext)
Construct.

Parameters:
factoryContext -

RuleSetReader

public RuleSetReader(SemanticsRepository repo,
                     javax.xml.parsers.SAXParser parser)
Construct.

Parameters:
repo - The semantics repository.
parser - The SAX parser.

RuleSetReader

public RuleSetReader(SemanticsRepository repo,
                     RuleBaseContext context)
Construct.

Parameters:
repo - The semantics repository.

RuleSetReader

public RuleSetReader(javax.xml.parsers.SAXParser parser,
                     SemanticsRepository repo)
Construct.

Parameters:
parser -
repo - The semantics repository.

RuleSetReader

public RuleSetReader(javax.xml.parsers.SAXParser parser,
                     RuleBaseContext context)
Construct.

Parameters:
parser -
context -

RuleSetReader

public RuleSetReader(SemanticsRepository repo,
                     javax.xml.parsers.SAXParser parser,
                     RuleBaseContext context)
Construct.

Parameters:
repo - The semantics repository.
parser - The SAX parser.
Method Detail

read

public RuleSet read(URL url)
             throws org.xml.sax.SAXException,
                    IOException
Read a RuleSet from a URL.

Parameters:
url - The rule-set URL.
Returns:
The rule-set.
Throws:
org.xml.sax.SAXException
IOException

read

public RuleSet read(Reader reader)
             throws org.xml.sax.SAXException,
                    IOException
Read a RuleSet from a Reader.

Parameters:
reader - The reader containing the rule-set.
Returns:
The rule-set.
Throws:
org.xml.sax.SAXException
IOException

read

public RuleSet read(InputStream inputStream)
             throws org.xml.sax.SAXException,
                    IOException
Read a RuleSet from an InputStream.

Parameters:
inputStream - The input-stream containing the rule-set.
Returns:
The rule-set.
Throws:
org.xml.sax.SAXException
IOException

read

public RuleSet read(String url)
             throws org.xml.sax.SAXException,
                    IOException
Read a RuleSet from a URL.

Parameters:
url - The rule-set URL.
Returns:
The rule-set.
Throws:
org.xml.sax.SAXException
IOException

read

public RuleSet read(org.xml.sax.InputSource in)
             throws org.xml.sax.SAXException,
                    IOException
Read a RuleSet from an InputSource.

Parameters:
in - The rule-set input-source.
Returns:
The rule-set.
Throws:
org.xml.sax.SAXException
IOException

getSemanticsRepository

public SemanticsRepository getSemanticsRepository()

setRuleSet

void setRuleSet(RuleSet ruleSet)

getRuleSet

public RuleSet getRuleSet()

getFactoryContext

public RuleBaseContext getFactoryContext()

setLocator

public void setLocator(org.xml.sax.Locator locator)
See Also:
ContentHandler

getLocator

public org.xml.sax.Locator getLocator()
Get the Locator.

Returns:
The locator.

startDocument

public void startDocument()
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler

startElement

public void startElement(String uri,
                         String localName,
                         String qname,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri -
localName -
qname -
attrs -
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler

endElement

public void endElement(String uri,
                       String localName,
                       String qname)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri -
localName -
qname -
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler

startConfiguration

protected void startConfiguration(String name,
                                  org.xml.sax.Attributes attrs)
Start a configuration node.

Parameters:
name - Tag name.
attrs - Tag attributes.

characters

public void characters(char[] chars,
                       int start,
                       int len)
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
chars -
start -
len -
See Also:
ContentHandler

endConfiguration

protected Configuration endConfiguration()
End a configuration node.

Returns:
The configuration.

lookupSemanticModule

SemanticModule lookupSemanticModule(String uri,
                                    String localName)
                              throws org.xml.sax.SAXParseException
Throws:
org.xml.sax.SAXParseException

getParents

LinkedList getParents()

getParent

Object getParent(Class parent)

getPeer

Object getPeer()

getCurrent

Object getCurrent()

resolveEntity

public org.xml.sax.InputSource resolveEntity(String publicId,
                                             String systemId)
Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Overrides:
resolveEntity in class org.xml.sax.helpers.DefaultHandler

warning

public void warning(org.xml.sax.SAXParseException x)
Specified by:
warning in interface org.xml.sax.ErrorHandler
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler

error

public void error(org.xml.sax.SAXParseException x)
Specified by:
error in interface org.xml.sax.ErrorHandler
Overrides:
error in class org.xml.sax.helpers.DefaultHandler

fatalError

public void fatalError(org.xml.sax.SAXParseException x)
                throws org.xml.sax.SAXParseException
Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXParseException


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