public class Filter extends java.lang.Object implements ConfigElement
Modifier and Type | Class and Description |
---|---|
static class |
Filter.FilterAttr
Class representing a <filter-attr> element.
|
static class |
Filter.FilterClass
Class representing a <filter-class> element.
|
static class |
Filter.FilterItem
Base class for
FilterClass and FilterAttr classes. |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTR_ATTR_NAME
Name of the XML 'attr-name' attribute.
|
static java.lang.String |
ATTR_CLASS_NAME
Name of the XML 'class-name' attribute.
|
static java.lang.String |
ATTR_MERGE_AUTHORITY
Name of the XML 'merge-authority' attribute.
|
static java.lang.String |
ATTR_PUBLISHER
Name of the XML 'publisher' attribute.
|
static java.lang.String |
ATTR_PUBLISHER_CREATE_HOMEDIR
Name of the XML 'publisher-create-homedir' attribute.
|
static java.lang.String |
ATTR_PUBLISHER_OPTIMIZE_MODIFY
Name of the XML 'publisher-optimize-modify' attribute.
|
static java.lang.String |
ATTR_PUBLISHER_TRACK_TEMPLATE_MEMBER
Name of the XML 'publisher-track-template-member' attribute.
|
static java.lang.String |
ATTR_SUBSCRIBER
Name of the XML 'subscriber' attribute.
|
static int |
MERGE_APP
Constant representing the "app" value for the 'merge-authority'
attribute on <filter-attr> elements.
|
static int |
MERGE_DEFAULT
Constant representing the "default" value for the 'merge-authority'
attribute on <filter-attr> elements.
|
static int |
MERGE_EDIR
Constant representing the "edir" value for the 'merge-authority'
attribute on <filter-attr> elements.
|
static int |
MERGE_NONE
Constant representing the "none" value for the 'merge-authority'
attribute on <filter-attr> elements.
|
static int |
PUB
Constant representing the Publisher channel.
|
static int |
SUB
Constant representing the Subscriber channel.
|
static int |
SYNC_IGNORE
Constant representing the "ignore" value for the 'subscriber' and 'publisher'
attributes on <filter-class> and <filter-attr> elements.
|
static int |
SYNC_NOTIFY
Constant representing the "notify" value for the 'subscriber' and 'publisher'
attributes on <filter-attr> elements.
|
static int |
SYNC_RESET
Constant representing the "reset" value for the 'subscriber' and 'publisher'
attributes on <filter-attr> elements.
|
static int |
SYNC_SYNC
Constant representing the "sync" value for the 'subscriber' and 'publisher'
attributes on <filter-class> and <filter-attr> elements.
|
static java.lang.String |
TAG_FILTER
Tag name of the <filter> element.
|
static java.lang.String |
TAG_FILTER_ATTR
Tag name of the <filter-attr> element.
|
static java.lang.String |
TAG_FILTER_CLASS
Tag name of the <filter-class> element.
|
static java.lang.String |
VAL_FALSE
"false"
|
static java.lang.String |
VAL_TRUE
"true"
|
Constructor and Description |
---|
Filter()
Create a new, empty
Filter instance. |
Filter(org.w3c.dom.Element filterElement)
Create a
Filter object from an XML representation. |
Filter(Filter source)
Construct a new
Filter based on an existing Filter . |
Modifier and Type | Method and Description |
---|---|
static boolean |
getBoolean(java.lang.String string)
Get the boolean value corresponding to an XML attribute string value.
|
static java.lang.String |
getBooleanString(boolean value)
Get the XML attribute string value for a boolean value.
|
Filter.FilterClass |
getFilterClass(java.lang.String className)
Get the
FilterClass instance for a class in this Filter instance
if it exists. |
static int |
getMergeAuthorityInt(java.lang.String string)
Get the sync mode constant corresponding to the passed merge authority string
(XML attribute value).
|
static java.lang.String |
getMergeAuthorityString(int auth)
Get the XML attribute value given a merge authority constant (
MERGE_EDIR ,
MERGE_APP , etc.) |
static int |
getSyncModeInt(java.lang.String string)
Get the sync mode constant corresponding to the passed sync mode string
(XML attribute value).
|
static java.lang.String |
getSyncModeString(int mode)
Get the XML attribute value given a sync mode constant (
SYNC_SYNC ,
SYNC_IGNORE , etc.) |
boolean |
hasBeenModified()
Return
true if this instance has been modified. |
java.util.Iterator |
iterator()
Get an
Iterator that returns the FilterClass instances in
this Filter . |
Filter.FilterClass |
newFilterClass(java.lang.String className)
Create a new entry in this
Filter instance for a class,
if such an entry doesn't already exist. |
Filter.FilterClass |
removeFilterClass(java.lang.String className)
Remove the entry for a class from this
Filter instance
if it exists. |
void |
resetModified()
Reset the modified flag for this instance such that
hasBeenModified()
will return false . |
org.w3c.dom.Element |
toV1FilterXML(org.w3c.dom.Node parent,
int channel)
Construct a DirXML 1.x representation of the filter for the passed
channel.
|
org.w3c.dom.Element |
toXML(org.w3c.dom.Node parent)
Create an XML representation for this
Filter object under the passed
Node . |
public static final int SUB
FilterItem.getSyncMode()
, FilterItem.setSyncMode()
and toV1FilterXML()
.public static final int PUB
FilterItem.getSyncMode()
, FilterItem.setSyncMode()
and toV1FilterXML()
.public static final int SYNC_SYNC
getSyncModeString()
, getSyncModeInt()
, FilterItem.getSyncMode()
,
and FilterItem.setSyncMode()
.public static final int SYNC_RESET
getSyncModeString()
, getSyncModeInt()
, FilterItem.getSyncMode()
,
and FilterItem.setSyncMode()
.public static final int SYNC_NOTIFY
getSyncModeString()
, getSyncModeInt()
, FilterItem.getSyncMode()
,
and FilterItem.setSyncMode()
.public static final int SYNC_IGNORE
getSyncModeString()
, getSyncModeInt()
, FilterItem.getSyncMode()
,
and FilterItem.setSyncMode()
.public static final int MERGE_DEFAULT
getMergeAuthorityString()
,
getMergeAuthorityInt()
, FilterAttr.getMergeAuthority()
,
and FilterAttr.setMergeAuthority()
.public static final int MERGE_EDIR
getMergeAuthorityString()
,
getMergeAuthorityInt()
, FilterAttr.getMergeAuthority()
,
and FilterAttr.setMergeAuthority()
.public static final int MERGE_APP
getMergeAuthorityString()
,
getMergeAuthorityInt()
, FilterAttr.getMergeAuthority()
,
and FilterAttr.setMergeAuthority()
.public static final int MERGE_NONE
getMergeAuthorityString()
,
getMergeAuthorityInt()
, FilterAttr.getMergeAuthority()
,
and FilterAttr.setMergeAuthority()
.public static final java.lang.String TAG_FILTER
public static final java.lang.String TAG_FILTER_CLASS
public static final java.lang.String TAG_FILTER_ATTR
public static final java.lang.String ATTR_CLASS_NAME
public static final java.lang.String ATTR_ATTR_NAME
public static final java.lang.String ATTR_PUBLISHER
public static final java.lang.String ATTR_SUBSCRIBER
public static final java.lang.String ATTR_PUBLISHER_CREATE_HOMEDIR
public static final java.lang.String ATTR_PUBLISHER_TRACK_TEMPLATE_MEMBER
public static final java.lang.String ATTR_MERGE_AUTHORITY
public static final java.lang.String ATTR_PUBLISHER_OPTIMIZE_MODIFY
public static final java.lang.String VAL_TRUE
public static final java.lang.String VAL_FALSE
public Filter()
Filter
instance.public Filter(Filter source)
Filter
based on an existing Filter
.source
- Filter
on which to base new instancepublic Filter(org.w3c.dom.Element filterElement) throws XMLException
Filter
object from an XML representation.filterElement
- <filter> element containing representationXMLException
- if XML representation is incorrect in some waypublic boolean hasBeenModified()
true
if this instance has been modified.
The instance is considered to have been modified if a change was made
that affects the persistent representation since:
resetModified()
was last calledhasBeenModified
in interface ConfigElement
true
or false
resetModified()
public void resetModified()
hasBeenModified()
will return false
.resetModified
in interface ConfigElement
hasBeenModified()
public java.util.Iterator iterator()
Iterator
that returns the FilterClass
instances in
this Filter
.Iterator
that returns FilterClass
instancespublic Filter.FilterClass getFilterClass(java.lang.String className)
FilterClass
instance for a class in this Filter
instance
if it exists.className
- name of classFilterClass
instance, or null
public Filter.FilterClass newFilterClass(java.lang.String className)
Filter
instance for a class,
if such an entry doesn't already exist.className
- name of classFilterClass
instancepublic Filter.FilterClass removeFilterClass(java.lang.String className)
Filter
instance
if it exists.className
- name of classFilterClass
instance or null
public org.w3c.dom.Element toXML(org.w3c.dom.Node parent)
Filter
object under the passed
Node
.
Note that the act of creating an XML representation does not reset this instance's
modified flag. It must be reset by calling resetModified()
.toXML
in interface ConfigElement
parent
- Node
under which to construct XML representation.hasBeenModified()
,
resetModified()
public org.w3c.dom.Element toV1FilterXML(org.w3c.dom.Node parent, int channel)
parent
- Node
under which to construct XML representationchannel
- SUB
or PUB
public static java.lang.String getSyncModeString(int mode) throws java.lang.IllegalArgumentException
SYNC_SYNC
,
SYNC_IGNORE
, etc.)mode
- SYNC_SYNC
, SYNC_NOTIFY
,
SYNC_RESET
, SYNC_IGNORE
String
containing the XML attribute value corresponding to the
passed constant ("sync", "notify", "reset", "ignore")java.lang.IllegalArgumentException
- if mode isn't a correct valuepublic static int getSyncModeInt(java.lang.String string) throws java.lang.IllegalArgumentException
string
- XML attribute value ("sync", "notify", "reset", "ignore")SYNC_SYNC
, SYNC_NOTIFY
,
SYNC_RESET
, SYNC_IGNORE
java.lang.IllegalArgumentException
- if string parameter is incorrectpublic static java.lang.String getMergeAuthorityString(int auth) throws java.lang.IllegalArgumentException
MERGE_EDIR
,
MERGE_APP
, etc.)auth
- MERGE_DEFAULT
, MERGE_NONE
,
MERGE_EDIR
, MERGE_APP
String
containing the XML attribute value corresponding to the
passed constant ("default", "none", "edir", "app")java.lang.IllegalArgumentException
- if auth isn't a correct valuepublic static int getMergeAuthorityInt(java.lang.String string) throws java.lang.IllegalArgumentException
string
- XML attribute value ("default", "none", "edir", "app")MERGE_DEFAULT
, MERGE_NONE
,
MERGE_EDIR
, MERGE_APP
java.lang.IllegalArgumentException
- if string parameter is incorrectpublic static java.lang.String getBooleanString(boolean value)
value
- true
or false
public static boolean getBoolean(java.lang.String string) throws java.lang.IllegalArgumentException
string
- "true" or "false"true
or false
java.lang.IllegalArgumentException
- if string parameter isn't one of "true" or "false"