rj.tools.jcsc.rules
Class RulesHandler

java.lang.Object
  extended byrj.tools.jcsc.rules.RulesHandler

public class RulesHandler
extends java.lang.Object

RulesHandler is a helper class which is resoponsibel for saving the rules properties.

Version:
__0.98.1__
Author:
Ralph Jocham

Field Summary
static java.lang.String CHOICE
          choice token
static java.lang.String CHOICES
          choices token
static java.lang.String JCSC
          jcsc token
static java.lang.String RULE
          rule token
static java.lang.String RULES
          rules token
static java.lang.String SEVERITY
          severity token
static java.lang.String TYPE
          type token
static java.lang.String VALUE
          value token
 
Constructor Summary
RulesHandler()
           
 
Method Summary
 void closeTag(java.lang.String tag)
          Close a XML tag
 java.io.InputStream getInputStreamOfZipRulesFile(java.lang.String fileName)
          Returns the InputStream of a rules files from within the JAR file
static Rule getRuleFromMap(java.util.Map rules, java.lang.String name)
          Get the rule from the map of all rules if the rule was not found the default rule is being returned.
 void openTag(java.lang.String tag)
          Print a XML open tag
 void openTag(java.lang.String tag, java.lang.String[] attributes)
          Print a XML open tag with attributes
 void persistRules(java.util.Map map)
          Persist the rules map into the print stream
 void printIndent()
          Print the indent for the xml file
 java.util.Properties readPropertiesRulesFile(java.lang.String fileName)
          Reads a rules .jcsc properties file; only used for conversion from older JCSC versions
 java.util.Map readRulesFile(java.lang.String fileName)
          Read a rules XML file from the file system
 java.util.Map readZipRulesFile(java.lang.String fileName)
          Read a rules XML file from a zip/jar file (rj/tools/jcsc/rules is path)
 void setPrintStream(java.io.PrintStream ps)
          Set the print stream for reading
 void tag(java.lang.String tagName, java.lang.String value)
          Print a XML tag with a value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JCSC

public static final java.lang.String JCSC
jcsc token

See Also:
Constant Field Values

RULES

public static final java.lang.String RULES
rules token

See Also:
Constant Field Values

RULE

public static final java.lang.String RULE
rule token

See Also:
Constant Field Values

TYPE

public static final java.lang.String TYPE
type token

See Also:
Constant Field Values

VALUE

public static final java.lang.String VALUE
value token

See Also:
Constant Field Values

SEVERITY

public static final java.lang.String SEVERITY
severity token

See Also:
Constant Field Values

CHOICES

public static final java.lang.String CHOICES
choices token

See Also:
Constant Field Values

CHOICE

public static final java.lang.String CHOICE
choice token

See Also:
Constant Field Values
Constructor Detail

RulesHandler

public RulesHandler()
Method Detail

setPrintStream

public void setPrintStream(java.io.PrintStream ps)
Set the print stream for reading

Parameters:
ps -

persistRules

public void persistRules(java.util.Map map)
Persist the rules map into the print stream

Parameters:
map -

printIndent

public void printIndent()
Print the indent for the xml file


openTag

public void openTag(java.lang.String tag)
Print a XML open tag

Parameters:
tag -

openTag

public void openTag(java.lang.String tag,
                    java.lang.String[] attributes)
Print a XML open tag with attributes

Parameters:
tag -
attributes -

tag

public void tag(java.lang.String tagName,
                java.lang.String value)
Print a XML tag with a value

Parameters:
tagName -
value -

closeTag

public void closeTag(java.lang.String tag)
Close a XML tag

Parameters:
tag -

getInputStreamOfZipRulesFile

public java.io.InputStream getInputStreamOfZipRulesFile(java.lang.String fileName)
                                                 throws java.io.IOException
Returns the InputStream of a rules files from within the JAR file

Parameters:
fileName -
Returns:
InputStream of rules files
Throws:
java.io.IOException

readZipRulesFile

public java.util.Map readZipRulesFile(java.lang.String fileName)
                               throws java.io.IOException
Read a rules XML file from a zip/jar file (rj/tools/jcsc/rules is path)

Parameters:
fileName -
Returns:
rules map
Throws:
java.io.IOException

readRulesFile

public java.util.Map readRulesFile(java.lang.String fileName)
                            throws java.io.IOException
Read a rules XML file from the file system

Parameters:
fileName -
Returns:
rules map
Throws:
java.io.IOException

readPropertiesRulesFile

public java.util.Properties readPropertiesRulesFile(java.lang.String fileName)
                                             throws java.io.IOException
Reads a rules .jcsc properties file; only used for conversion from older JCSC versions

Parameters:
fileName -
Returns:
rules properties
Throws:
java.io.IOException

getRuleFromMap

public static Rule getRuleFromMap(java.util.Map rules,
                                  java.lang.String name)
Get the rule from the map of all rules if the rule was not found the default rule is being returned.

Parameters:
rules -
name -
Returns:
rule which is default rule if not found


(c) 1999-2005 by Ralph Jocham (rjocham72@netscape.net)
JCSC is released under the terms of the GNU General Public License