|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.novell.nds.dirxml.engine.gcv.GCValue
public abstract class GCValue
Base class for all Global Configuration Value types.
Nested Class Summary | |
---|---|
static class |
GCValue.IllegalCloneStateException
Unchecked exception designed to be thrown when an "impossible" exception occurs during a cloneValue execution. |
static class |
GCValue.XmlComment
Class for representing XML comments. |
static class |
GCValue.XmlItem
Abstract class for representing XML processing instructions and comments. |
static class |
GCValue.XmlProcessingInstruction
Class for representing XML processing instructions. |
Field Summary | |
---|---|
protected boolean |
modified
|
protected GCParent |
parent
|
static int |
TYPE_BOOLEAN
Integer constant representing "boolean" value type |
static int |
TYPE_DN
Integer constant representing "dn" value type |
static int |
TYPE_DN_REF
Integer constant representing "dn-ref" value type |
static int |
TYPE_ENUM
Integer constant representing "enum" value type |
static int |
TYPE_GCV_REF
Integer constant representing "gcv-ref" element |
static int |
TYPE_GROUP
Integer constant representing "group" element |
static int |
TYPE_HEADER
Integer constant representing "header" element |
static int |
TYPE_INTEGER
Integer constant representing "integer" value type |
static int |
TYPE_LIST
Integer constant representing "list" value type |
static int |
TYPE_PASSWORD_REF
Integer constant representing "password-ref" value type |
static int |
TYPE_REAL
Integer constant representing "real" value type |
static int |
TYPE_STRING
Integer constant representing "string" value type |
static int |
TYPE_STRUCTURED
|
static int |
TYPE_SUBORDINATES
Integer constant representing "subordinates" element |
protected List |
xmlItems
|
Method Summary | |
---|---|
void |
addXmlComment(String data)
Add an XML comment that will appear under the <definition> element when this GCValue is serialized. |
protected void |
addXmlItems(Element definition)
Append any XML processing instructions or comments as children of the passed element. |
void |
addXmlProcessingInstruction(String target,
String data)
Add an XML processing instruction that will appear under the <definition> element when this GCValue is serialized. |
protected void |
cloneCommon(GCValue newValue)
Helper function for derived classes to implement cloneValue . |
abstract GCValue |
cloneValue(String name)
Clone this GCValue instance and return the cloned instance. |
static GCValue |
construct(String name,
String displayName,
int type)
Construct a GCValue object given the name, display name, and type. |
static GCValue |
construct(String name,
String displayName,
String displayNameRef,
int type)
Construct a GCValue object given the name, display name, and type. |
static GCValue |
constructGCVRef(String name)
Construct a GCVRef instance. |
static GCValue |
constructGCVRef(String name,
String driverParamName)
Construct a GCVRef instance. |
static GCValue |
constructGroup(GCOwner owner)
Construct a GCGroup instance. |
static GCValue |
constructHeader(String displayName,
GCOwner owner)
Construct a GCHeader instance. |
static GCValue |
constructStructuredValue(String name,
String displayName,
GCOwner owner)
Construct a GCStructuredValue instance. |
static GCValue |
constructSubordinates(String activeValue,
GCOwner owner)
Construct a GCSubordinates instance. |
String |
getDescription()
Get the description, if any, of this value. |
String |
getDescriptionRef()
Return the description localization reference, if any. |
String |
getDisplayName()
Return the display name of this value. |
String |
getDisplayNameRef()
Return the display name localization reference, if any. |
boolean |
getHidden()
Get whether this GCV should be hidden in the user interface. |
boolean |
getMandatory()
Return whether the UI should require a value be entered for this GCV. |
String |
getName()
Return the name of this value. |
GCOwner |
getOwner()
Return the owner, if any. |
GCParent |
getParent()
Return the parent value, if any. |
int |
getType()
Return the int value representing the type of this value. |
String |
getTypeString()
Return the String identifying the type of this value. |
abstract String |
getValue()
Get the current value for this instance. |
Iterator |
getXmlItemsIterator()
Get an Iterator that will iterator through any processing instructions
and comments that may be attached to this GCValue . |
Node |
getXMLValue(Document document)
Return an XML node representing this GCV's value. |
boolean |
hasBeenModified()
Return true if this instance has been modified. |
void |
localize(LocalizedMessageSource messageSource)
Localize the display name and/or descriptions if there are localization refs for them. |
abstract void |
parseValue(String value)
Parse the passed value based on the type and instance rules for this value. |
void |
resetModified()
Reset the modified flag for this instance such that hasBeenModified()
will return false . |
void |
setDescription(String description)
Set the description for this value. |
void |
setDescriptionRef(String descriptionRef)
Set the description localization reference. |
void |
setDisplayName(String displayName)
Set the display name of this value. |
void |
setDisplayNameRef(String displayNameRef)
Set the display name localization reference. |
void |
setHidden(boolean hidden)
Set whether this GCV should be hidden in the user interface. |
void |
setMandatory(boolean mandatory)
Set whether this GCV should require a value. |
abstract void |
setValue(String value)
Set the value for this instance. |
Element |
toXML(Node parent)
Create an XML representation for this instance under the passed Node . |
static int |
typeFromString(String typeString)
Return an integer constant based on a type string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_STRING
"string"
value type
public static final int TYPE_BOOLEAN
"boolean"
value type
public static final int TYPE_INTEGER
"integer"
value type
public static final int TYPE_REAL
"real"
value type
public static final int TYPE_DN
"dn"
value type
public static final int TYPE_ENUM
"enum"
value type
public static final int TYPE_PASSWORD_REF
"password-ref"
value type
public static final int TYPE_GCV_REF
"gcv-ref"
element
public static final int TYPE_HEADER
"header"
element
public static final int TYPE_GROUP
"group"
element
public static final int TYPE_SUBORDINATES
"subordinates"
element
public static final int TYPE_LIST
"list"
value type
public static final int TYPE_DN_REF
"dn-ref"
value type
public static final int TYPE_STRUCTURED
protected boolean modified
protected GCParent parent
protected List xmlItems
Method Detail |
---|
public static GCValue construct(String name, String displayName, int type) throws GCVException
GCValue
object given the name, display name, and type.
The constructed object may not be complete. For example, an "enum"
object will not have any enum choices, nor will the value be set.
name
- The name of the Global Configuration ValuedisplayName
- The user-interface name of the GCV.type
- The type of value to construct (TYPE_STRING
, TYPE_BOOLEAN
, etc.).
GCValue
-based object.
GCVException
- thrown if name
or displayName
is null
or empty, or if the type is not valid.public static GCValue constructHeader(String displayName, GCOwner owner) throws GCVException
GCHeader
instance.
displayName
- display value for header
GCHeader
instance.
GCVException
- thrown if displayName
is invalidpublic static GCValue constructGroup(GCOwner owner) throws GCVException
GCGroup
instance.
owner
- GCOwner
instance that owns the group.
GCGroup
instance.
GCVException
- not thrownpublic static GCValue constructSubordinates(String activeValue, GCOwner owner) throws GCVException
GCSubordinates
instance.
owner
- GCOwner
instance that owns the group.activeValue
- "active-value"
attribute value.
GCSubordinates
instance.
GCVException
- thrown if activeValue
is incorrect.public static GCValue constructGCVRef(String name) throws GCVException
GCVRef
instance.
name
- name of GCV to reference.
GCVRef
instance.
GCVException
- thrown if name
is null
or empty.public static GCValue constructGCVRef(String name, String driverParamName) throws GCVException
GCVRef
instance.
name
- name of GCV to reference.driverParamName
- name of driver parameter to use (may be null
). If
non-null
, the value must be a valid XML Name.
GCVRef
instance.
GCVException
- thrown if name
is null
or empty.public static GCValue constructStructuredValue(String name, String displayName, GCOwner owner) throws GCVException
GCStructuredValue
instance.
name
- of the Control Value.displayName
- The user-interface name of the Control Value.owner
- GCOwner
instance that will own the GCStructuredValue
instance
GCStructuredValue
instance
GCVException
public static GCValue construct(String name, String displayName, String displayNameRef, int type) throws GCVException
GCValue
object given the name, display name, and type.
The constructed object may not be complete. For example, an "enum"
object will not have any enum choices, nor will the value be set.
name
- The name of the Global Configuration ValuedisplayName
- The user-interface name of the GCV.displayNameRef
- A localized string identifier that can be used to obtain a
localized version of the display name, given a LocalizedMessageSource instance.type
- The type of value to construct (TYPE_STRING
, TYPE_BOOLEAN
, etc.).
GCValue
-based object.
GCVException
- thrown if the name or display name is null
or empty, or if the type is not valid.public abstract GCValue cloneValue(String name)
GCValue
instance and return the cloned instance.
the
- name for the cloned value.
protected void cloneCommon(GCValue newValue)
cloneValue
.
Clones data common to all GCValue
instances.
newValue
- the value to which to copypublic GCParent getParent()
null
)public GCOwner getOwner()
null
)public 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 called
hasBeenModified
in interface ConfigElement
true
or false
resetModified()
public void resetModified()
hasBeenModified()
will return false
.
resetModified
in interface ConfigElement
hasBeenModified()
public String getName()
String
(never null
).public int getType()
int
value representing the type of this value.
TYPE_STRING
, TYPE_BOOLEAN
, etc.public String getTypeString()
String
identifying the type of this value.
null
).public String getDisplayName()
null
).public void setDisplayName(String displayName) throws GCVArgumentException
displayName
- non-null
, non-empty String
for display purposes.
GCVArgumentException
- thrown if displayName
is null
or empty.public String getDisplayNameRef()
null
.public void setDisplayNameRef(String displayNameRef)
displayNameRef
- A string identifier in a Properties
collection that can be
used with LocalizedMessageSource
.public String getDescription()
null
, or an empty string.
String
, or null
public void setDescription(String description)
description
- Description String
(may be empty or null
).public String getDescriptionRef()
null
.public void setDescriptionRef(String descriptionRef)
descriptionRef
- A string identifier in a Properties
collection that can be
used with LocalizedMessageSource
.public void setHidden(boolean hidden)
hidden
- true
or false
public boolean getHidden()
true
or false
public void setMandatory(boolean mandatory)
true
- or false
public boolean getMandatory()
public void addXmlProcessingInstruction(String target, String data)
GCValue
is serialized.
target
- the target string for the processing instructiondata
- the data string for the processing instructionpublic void addXmlComment(String data)
GCValue
is serialized.
data
- the comment stringpublic Iterator getXmlItemsIterator()
Iterator
that will iterator through any processing instructions
and comments that may be attached to this GCValue
. The returned
Iterator instance supports Iterator.remove()
.
Iterator
public abstract void parseValue(String value) throws GCVException
The type rules are lexicographic and value-based. For example,
an integer must consist of only characters '0'
through '9'
, with an
optional leading '-'
. In addition, the integer value represented by
the string must not exceed java.lang.Integer.MIN_VALUE
and
java.lang.Integer.MAX_VALUE
.
The instance rules depend on the instance of the value. If, for example,
this instance is an "integer"
type and there is a range restriction, then
the passed value must fall within the range restriction.
value
- Value String
to parse
GCVException
- thrown if value is not correct for this value instance.public abstract String getValue()
null
,
but the value may not be correct if it has not yet been set. For example,
a newly-constructed "enum"
object will have an empty, invalid value of ""
.
String
public abstract void setValue(String value) throws GCVException
parseValue()
must not throw an exception when
passed the value.
value
- Value String
for this instance.
GCVException
- thrown if value is not correct for this value instance.public Node getXMLValue(Document document)
Text
node containing the value
returned by getValue()
. Certain GCV types (e.g., "list"
) may
return more structured data.
document
- the Document
to use to create nodes.
Node
that is the root of the XML representation.public Element toXML(Node parent)
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.
Element
hasBeenModified()
,
resetModified()
public void localize(LocalizedMessageSource messageSource)
If the display name or description has a localization refs, but the localized string
cannot be located in the passed LocalizedMessageSource
they are left unlocalized.
messageSource
- Source for localized strings.public static int typeFromString(String typeString)
e.g., "integer"
-> TYPE_INTEGER
typeString
- string describing type ("string"
, "integer"
, "enum"
, etc.)
TYPE_STRING
, TYPE_INTEGER
, TYPE_ENUM
) or -1
if string
is invalid.protected void addXmlItems(Element definition)
definition
- the <definition> element (or <group>, <gcv-ref>, etc.,
element for derived classes)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |