org.apache.jsieve.util
Class SieveToXml

java.lang.Object
  extended by org.apache.jsieve.util.SieveToXml

public class SieveToXml
extends java.lang.Object

Converts Sieve nodes to xml. Settings default to draft-freed-sieve-in-xml-01

Sieve Email Filtering: Sieves and display directives in XML
.

Known limitations

For simplicity, allow elements are out into a single namespace.


Nested Class Summary
static interface SieveToXml.NameMapper
          Maps node names to element names.
static interface SieveToXml.Out
          Simple infoset output.
 
Field Summary
static java.lang.String[] CONTROL_COMMANDS
          Control commands (as listed in RFC 3028)
static java.lang.String DEFAULT_NAME_ACTION_COMMAND
           
static java.lang.String DEFAULT_NAME_ATTRIBUTE
           
static java.lang.String DEFAULT_NAME_CONTROL_COMMAND
           
static java.lang.String DEFAULT_NAME_LIST
           
static java.lang.String DEFAULT_NAME_NUM
           
static java.lang.String DEFAULT_NAME_STRING
           
static java.lang.String DEFAULT_NAME_TAG
           
static java.lang.String DEFAULT_NAME_TEST
           
static java.lang.String DEFAULT_NAMESPACE
           
static java.lang.String DEFAULT_PREFIX
           
 
Constructor Summary
SieveToXml()
           
 
Method Summary
 SieveHandler build(SieveToXml.Out out)
          Builds a handler to writes to the given output.
 SieveToXml.NameMapper getCommandNameMapper()
          Gets mapper for command names.
 java.lang.String getListElementName()
          Gets the element name used for lists.
 java.lang.String getNameAttributeName()
          Gets the name of the attribute to be used to name command and tests.
 java.lang.String getNamespacePrefix()
          Gets the namespace prefix to be used for all elements and attributes.
 java.lang.String getNamespaceUri()
          Gets the namespace URI to be used for all elements and attributes.
 java.lang.String getNumberElementName()
          Gets the name of the element that wraps a numeric argument.
 java.lang.String getStringElementName()
          Gets the name of the element that wraps a string element.
 java.lang.String getTagElementName()
          Gets the name of the element that wraps a tag element.
 SieveToXml.NameMapper getTestNameMapper()
          Gets the mapper for names of test nodes.
 void setCommandNameMapper(SieveToXml.NameMapper commandNameMapper)
          Sets mapper for command names.
 void setListElementName(java.lang.String listElementName)
          Sets the element name used for lists.
 void setNameAttributeName(java.lang.String nameAttributeName)
          Sets the name of the attribute to be used to indicate command and test names.
 void setNamespacePrefix(java.lang.String namespacePrefix)
          Sets the namespace prefix to be used for all elements and attributes.
 void setNamespaceUri(java.lang.String namespaceUri)
          Sets the namespace uri to be used for all elements and attributes.
 void setNumberElementName(java.lang.String numberElementName)
          Sets the name of the element that wraps a numeric argument.
 void setStringElementName(java.lang.String stringElementName)
          Sets the name of the element that wraps a string element.
 void setTagElementName(java.lang.String tagElementName)
          Sets the name of the element that wraps a tag element
 void setTestNameMapper(SieveToXml.NameMapper testNameMapper)
          Sets the mapper for names of test nodes.
static SieveToXml.NameMapper sieveInXmlMapper()
          Creates a mapper which returns values given in draft-freed-sieve-in-xml-01
Sieve Email Filtering: Sieves and display directives in XML.
static SieveToXml.NameMapper uniformMapper(java.lang.String elementLocalName)
          Creates a mapper which will return the same name for any node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NAME_ATTRIBUTE

public static final java.lang.String DEFAULT_NAME_ATTRIBUTE
See Also:
Constant Field Values

DEFAULT_NAME_ACTION_COMMAND

public static final java.lang.String DEFAULT_NAME_ACTION_COMMAND
See Also:
Constant Field Values

DEFAULT_NAME_CONTROL_COMMAND

public static final java.lang.String DEFAULT_NAME_CONTROL_COMMAND
See Also:
Constant Field Values

DEFAULT_NAME_TEST

public static final java.lang.String DEFAULT_NAME_TEST
See Also:
Constant Field Values

DEFAULT_NAME_LIST

public static final java.lang.String DEFAULT_NAME_LIST
See Also:
Constant Field Values

DEFAULT_NAME_NUM

public static final java.lang.String DEFAULT_NAME_NUM
See Also:
Constant Field Values

DEFAULT_NAME_TAG

public static final java.lang.String DEFAULT_NAME_TAG
See Also:
Constant Field Values

DEFAULT_NAME_STRING

public static final java.lang.String DEFAULT_NAME_STRING
See Also:
Constant Field Values

DEFAULT_PREFIX

public static final java.lang.String DEFAULT_PREFIX
See Also:
Constant Field Values

DEFAULT_NAMESPACE

public static final java.lang.String DEFAULT_NAMESPACE
See Also:
Constant Field Values

CONTROL_COMMANDS

public static final java.lang.String[] CONTROL_COMMANDS
Control commands (as listed in RFC 3028)

Constructor Detail

SieveToXml

public SieveToXml()
Method Detail

uniformMapper

public static final SieveToXml.NameMapper uniformMapper(java.lang.String elementLocalName)
Creates a mapper which will return the same name for any node.

Parameters:
elementLocalName - to be returned for all names, not null
Returns:
not null

sieveInXmlMapper

public static final SieveToXml.NameMapper sieveInXmlMapper()
Creates a mapper which returns values given in draft-freed-sieve-in-xml-01
Sieve Email Filtering: Sieves and display directives in XML
.

Returns:
not null

getCommandNameMapper

public SieveToXml.NameMapper getCommandNameMapper()
Gets mapper for command names.

Returns:
not null

setCommandNameMapper

public void setCommandNameMapper(SieveToXml.NameMapper commandNameMapper)
Sets mapper for command names.

Parameters:
commandNameMapper -

getListElementName

public java.lang.String getListElementName()
Gets the element name used for lists.

Returns:
element name used for lists, not null

setListElementName

public void setListElementName(java.lang.String listElementName)
Sets the element name used for lists.

Parameters:
listElementName - not null

getNameAttributeName

public java.lang.String getNameAttributeName()
Gets the name of the attribute to be used to name command and tests.

Returns:
name, or null when not attribute should be written

setNameAttributeName

public void setNameAttributeName(java.lang.String nameAttributeName)
Sets the name of the attribute to be used to indicate command and test names.

Parameters:
nameAttributeName - naming attribute, or null when no attribute should be used

getNamespacePrefix

public java.lang.String getNamespacePrefix()
Gets the namespace prefix to be used for all elements and attributes.

Returns:
namespace prefix, or null when no namespace should be used

setNamespacePrefix

public void setNamespacePrefix(java.lang.String namespacePrefix)
Sets the namespace prefix to be used for all elements and attributes.

Parameters:
namespacePrefix - namespace, or null when no namespace should be used

getNamespaceUri

public java.lang.String getNamespaceUri()
Gets the namespace URI to be used for all elements and attributes.

Returns:
namespace URI, or null when no namespace should be used

setNamespaceUri

public void setNamespaceUri(java.lang.String namespaceUri)
Sets the namespace uri to be used for all elements and attributes.

Parameters:
namespaceUri - namespace URI, or null when no namespace should be used

getNumberElementName

public java.lang.String getNumberElementName()
Gets the name of the element that wraps a numeric argument.

Returns:
not null

setNumberElementName

public void setNumberElementName(java.lang.String numberElementName)
Sets the name of the element that wraps a numeric argument.

Parameters:
numberElementName - not null

getStringElementName

public java.lang.String getStringElementName()
Gets the name of the element that wraps a string element.

Returns:
not null

setStringElementName

public void setStringElementName(java.lang.String stringElementName)
Sets the name of the element that wraps a string element.

Parameters:
stringElementName - not null

getTagElementName

public java.lang.String getTagElementName()
Gets the name of the element that wraps a tag element.

Returns:
not null

setTagElementName

public void setTagElementName(java.lang.String tagElementName)
Sets the name of the element that wraps a tag element

Parameters:
tagElementName - not null

getTestNameMapper

public SieveToXml.NameMapper getTestNameMapper()
Gets the mapper for names of test nodes.

Returns:
not null

setTestNameMapper

public void setTestNameMapper(SieveToXml.NameMapper testNameMapper)
Sets the mapper for names of test nodes.

Parameters:
testNameMapper - not null

build

public SieveHandler build(SieveToXml.Out out)
Builds a handler to writes to the given output.

Parameters:
out - output, not null
Returns:
hanlder, not null


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.