org.drools.io
Class RuleSetReader

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.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.38 2004/11/28 20:01:12 mproctor Exp $
Author:
bob mcwhirter

Field Summary
static String RULES_NAMESPACE_URI
          Namespace URI for the general tags.
 
Constructor Summary
RuleSetReader()
          Construct.
RuleSetReader(javax.xml.parsers.SAXParser parser)
          Construct.
RuleSetReader(SemanticsRepository repo)
          Construct.
RuleSetReader(SemanticsRepository repo, javax.xml.parsers.SAXParser parser)
          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()
           
 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,
                     javax.xml.parsers.SAXParser parser)
Construct.

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

RuleSetReader

public RuleSetReader(SemanticsRepository repo)
Construct.

Parameters:
repo - The semantics repository.
Method Detail

read

public RuleSet read(URL url)
             throws Exception
Read a RuleSet from a URL.

Parameters:
url - The rule-set URL.
Returns:
The rule-set.
Throws:
Exception - If an error occurs during the parse.

read

public RuleSet read(Reader reader)
             throws Exception
Read a RuleSet from a Reader.

Parameters:
reader - The reader containing the rule-set.
Returns:
The rule-set.
Throws:
Exception - If an error occurs during the parse.

read

public RuleSet read(InputStream inputStream)
             throws Exception
Read a RuleSet from an InputStream.

Parameters:
inputStream - The input-stream containing the rule-set.
Returns:
The rule-set.
Throws:
Exception - If an error occurs during the parse.

read

public RuleSet read(String url)
             throws Exception
Read a RuleSet from a URL.

Parameters:
url - The rule-set URL.
Returns:
The rule-set.
Throws:
Exception - If an error occurs during the parse.

read

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

Parameters:
in - The rule-set input-source.
Returns:
The rule-set.
Throws:
Exception - If an error occurs during the parse.

getSemanticsRepository

public SemanticsRepository getSemanticsRepository()

setRuleSet

void setRuleSet(RuleSet ruleSet)

getRuleSet

public RuleSet getRuleSet()

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()

startElement

public void startElement(String uri,
                         String localName,
                         String qname,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler

endElement

public void endElement(String uri,
                       String localName,
                       String qname)
                throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler

startConfiguration

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

Parameters:
name - Tag name.
attrs - Tag attributes.
Throws:
org.xml.sax.SAXException - If an error occurs during parse.

characters

public void characters(char[] chars,
                       int start,
                       int len)
                throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException
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)
                                      throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

warning

public void warning(org.xml.sax.SAXParseException x)

error

public void error(org.xml.sax.SAXParseException x)

fatalError

public void fatalError(org.xml.sax.SAXParseException x)
                throws org.xml.sax.SAXParseException
Throws:
org.xml.sax.SAXParseException


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