Oracle Email Java API Reference
Release 2(9.0.4)

B10724-01

oracle.mail.sdk.rule
Class RuleParser

java.lang.Object
  |
  +--oracle.mail.sdk.rule.RuleParser

public class RuleParser
extends java.lang.Object

This class provides APIs to store, retrieve and validate rules. Before using this class, you need an OESContext object that has been authenticated.

Since:
9.0
Version:
$Header: RuleParser.java 16-may-2003.16:12:18 haye Exp $
See Also:
OESContext

Constructor Summary
RuleParser()
          Default Constructor
RuleParser(oracle.mail.OESContext thecontext)
          Constructs a RuleParser object with a given authentication context

 

Method Summary
 oracle.xml.parser.v2.XMLDocument fileToDoc(java.lang.String fileName)
          Parse rule data in XML text from a file and return an XMLDocument object.
 java.lang.String getRule()
          Gets a user level rule as XML text as a regular mail user
 java.lang.String getRule(java.lang.String name, java.lang.String ruleType)
          Retrieves rule as XML text as an administrator
 Account getRuleObjects()
          Retrieves rule data as Java objects as a regular mail user
 Account getRuleObjects(java.io.Reader ruleReader)
          Retreives rule data in Java objects given a Reader
 Account getRuleObjects(java.lang.String name, java.lang.String ruleType)
          Retrieves rule data in Java objects for a user as an administrator
 void renameUpdate(java.lang.String oldUsername, java.lang.String newUsername, oracle.mail.ldap.ESDSContext dctx, java.sql.Connection conn)
          Perform rule update as a result of a rename.
 void setAuthContext(oracle.mail.OESContext oes)
          Sets authentication context.
 void setDebugMode(boolean mode)
          Change debug setting (stdout based logging)
 void setEncryptionMode(boolean mode)
          Change password encryption setting
 void setRule(oracle.xml.parser.v2.XMLDocument rule)
          Validate and save rule data in persistent storage.
 void setRuleObjects(Account rules)
          Saves rule to the directory given an Account object
 void setValidation(boolean toValidate)
          Sets rule validation mode.
 oracle.xml.parser.v2.XMLDocument stringToDoc(java.lang.String str)
          Parses rule data in XML text and return an XMLDocument object.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

RuleParser

public RuleParser()
           throws java.lang.Exception
Default Constructor

RuleParser

public RuleParser(oracle.mail.OESContext thecontext)
           throws java.lang.Exception
Constructs a RuleParser object with a given authentication context
Parameters:
thecontext - the authenticated OESContext object
See Also:
OESContext
Method Detail

setDebugMode

public void setDebugMode(boolean mode)
                  throws java.lang.Exception
Change debug setting (stdout based logging)
Parameters:
mode - the debug mode, true for stdout logging, false otherwise

setEncryptionMode

public void setEncryptionMode(boolean mode)
                       throws java.lang.Exception
Change password encryption setting
Parameters:
mode - the encryption mode, true for enable encryption, false otherwise

setValidation

public void setValidation(boolean toValidate)
Sets rule validation mode. Use non-validating mode to save a partially constructed rule.
Parameters:
whether - to validate rules input

setAuthContext

public void setAuthContext(oracle.mail.OESContext oes)
Sets authentication context. An authentication context is an OESContext object that has been used to authenticate a valid user against an LDAP directory.
Parameters:
oes - the OESContext object containing authentication info
See Also:
OESContext

stringToDoc

public oracle.xml.parser.v2.XMLDocument stringToDoc(java.lang.String str)
                                             throws java.lang.Exception
Parses rule data in XML text and return an XMLDocument object. This method can be used to construct a DOM object based on a rule specification in XML format.
Parameters:
str - rule data in XML text
Returns:
an XMLDocument object representing the XML data

fileToDoc

public oracle.xml.parser.v2.XMLDocument fileToDoc(java.lang.String fileName)
                                           throws java.lang.Exception
Parse rule data in XML text from a file and return an XMLDocument object. Note that single quotes are NOT escaped in the process. Therefore the caller must make sure the XML file has all the single quotes (') escaped to two single quotes('').
Parameters:
fileName - file containing XML text
Returns:
an XMLDocument object representing the XML data

getRule

public java.lang.String getRule(java.lang.String name,
                                java.lang.String ruleType)
                         throws java.lang.Exception
Retrieves rule as XML text as an administrator
Parameters:
name - the fully qualified name of the rule owner, can be either a user email address, a domain name or an installation name eg. john.doe@oracle.com, dmv.gov, install1
ruleType - values from ownerType attribute: "user", "domain" or "system"
Returns:
rule content in XML text

getRule

public java.lang.String getRule()
                         throws java.lang.Exception
Gets a user level rule as XML text as a regular mail user
Returns:
rule content in XML text

getRuleObjects

public Account getRuleObjects(java.io.Reader ruleReader)
                       throws java.io.IOException,
                              org.xml.sax.SAXException,
                              oracle.xml.parser.v2.XMLParseException
Retreives rule data in Java objects given a Reader
Parameters:
ruleReader - a Reader object containing rule XML text
Returns:
Account object containing rule data
See Also:
Account

getRuleObjects

public Account getRuleObjects(java.lang.String name,
                              java.lang.String ruleType)
                       throws java.lang.Exception
Retrieves rule data in Java objects for a user as an administrator
Parameters:
name - rule owner name, either a qualified username, domain name or installation name
ruleType - valid values in ownerType attribute: "user", "domain" or "system"
Returns:
Account object containing the rules
See Also:
Account

getRuleObjects

public Account getRuleObjects()
                       throws java.lang.Exception
Retrieves rule data as Java objects as a regular mail user
Returns:
Account object containing the rules
See Also:
Account

setRule

public void setRule(oracle.xml.parser.v2.XMLDocument rule)
             throws java.lang.Exception
Validate and save rule data in persistent storage. This method checks rule's validity if the parser is in validating mode, then saves it in persistent storage and cache the rules in executable form in the database. Passing in an empty rule object (with no rule lists) causes the method to remove all rules from the user.
Parameters:
rule - an XMLDocument object containing rule data
See Also:
XMLDocument

setRuleObjects

public void setRuleObjects(Account rules)
                    throws java.lang.Exception
Saves rule to the directory given an Account object
Parameters:
rules - an Account object containing rule data
See Also:
Account

renameUpdate

public void renameUpdate(java.lang.String oldUsername,
                         java.lang.String newUsername,
                         oracle.mail.ldap.ESDSContext dctx,
                         java.sql.Connection conn)
                  throws java.lang.Exception
Perform rule update as a result of a rename. This should be performed before the actual rename happens in LDAP.
Parameters:
oldUsername - old mail user ID (qualified)
newUsername - new name (qualified)
dctx - authenticated LDAP context
conn - JDBC database connection

Oracle Email Java API Reference
Release 2(9.0.4)

B10724-01

Copyright © 1988, 2003 Oracle Corporation. All Rights Reserved.