|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.novell.nds.dirxml.shimhost.NameMap
Class encapsulating DirXML Mapping Rule functionality.
This class can read and write an XML representation of the DirXML Mapping Rule and can be examined and edited programmatically.
To map the class names and attribute names in an XML document use the
mapXML() method.
| Nested Class Summary | |
static class |
NameMap.AttrMap
"Read-only" class for examining a single attribute mapping. |
static class |
NameMap.ClassMap
"Read-only" class for examining the class mappings for a NameMap instance. |
| Field Summary | |
static String |
ANY_CLASS
Special class name used to specify "any class" for attributes that should be mapped regardless of class. |
static String |
ATTR_ATTR_NAME
Name for XML attribute 'attr-name'. |
static String |
ATTR_CLASS_NAME
Name for XML attribute 'class-name'. |
static int |
FROM_APP
Parameter for mapXML(), specifying document to be mapped is being received
from the application shim. |
static String |
TAG_APP_NAME
Tag name for XML element 'app-name'. |
static String |
TAG_ATTR_NAME
Tag name for XML element 'attr-name'. |
static String |
TAG_ATTR_NAME_MAP
Tag name for XML element 'attr-name-map'. |
static String |
TAG_CLASS_NAME
Tag name for XML element 'class-name'. |
static String |
TAG_NDS_NAME
Tag name for XML element 'nds-name'. |
static int |
TO_APP
Parameter for mapXML(), specifying document to be mapped is being sent
to the application shim. |
| Constructor Summary | |
NameMap()
Create an empty NameMap instance. |
|
NameMap(Element element)
Construct a NameMap instance from an XML representation. |
|
| Method Summary | |
void |
addAttrMapping(String classNdsName,
String attrNdsName,
String attrAppName)
Add a mapping for an attribute. |
void |
addClassMapping(String ndsName,
String appName)
Add a mapping for a class. |
NameMap.ClassMap |
getClassMap(String ndsName)
Get a read-only object for a class that indicates the class and attribute name mappings. |
boolean |
hasBeenModified()
Return true if this instance has been modified.
|
Iterator |
iterator()
Get an Iterator that will iterate through the class and attribute mappings in
this instance.
|
String |
mapAppAttrName(String appAttrName,
String appClassName)
Map an application attribute name into the corresponding name in the "nds" or "DirXML" namespace. |
String |
mapAppClassName(String appClassName)
Map an application class name to the corresponding name in the "nds" or "DirXML" namespace. |
String |
mapNdsAttrName(String ndsAttrName,
String ndsClassName)
Map an attribute name in the "nds" or "DirXML" namespace into the corresponding name in application namespace. |
String |
mapNdsClassName(String ndsClassName)
Map an nds or dirxml class name to the corresponding application class name. |
void |
mapXML(Node parent,
int direction)
Map an XML document subtree. |
void |
removeAttrMapping(String classNdsName,
String attrNdsName)
Remove an attribute mapping. |
void |
removeClassMapping(String ndsName)
Remove a mapping for a class. |
void |
resetModified()
Reset the modified flag for this instance such that hasBeenModified()
will return false. |
Element |
toXML(Node parent)
Create an XML representation of this NameMap instance.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int TO_APP
mapXML(), specifying document to be mapped is being sent
to the application shim.
mapXML(org.w3c.dom.Node, int),
Constant Field Valuespublic static final int FROM_APP
mapXML(), specifying document to be mapped is being received
from the application shim.
mapXML(org.w3c.dom.Node, int),
Constant Field Valuespublic static final String TAG_ATTR_NAME_MAP
public static final String TAG_CLASS_NAME
public static final String TAG_ATTR_NAME
public static final String TAG_NDS_NAME
public static final String TAG_APP_NAME
public static final String ATTR_CLASS_NAME
public static final String ATTR_ATTR_NAME
public static final String ANY_CLASS
| Constructor Detail |
public NameMap()
NameMap instance.
public NameMap(Element element)
throws XMLException
NameMap instance from an XML representation.
element - <attr-name-map> element containing XML representation
XMLException - if the XML representation is somehow invalid.| Method Detail |
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 ConfigElementtrue or falseresetModified(),
toXML(org.w3c.dom.Node)public void resetModified()
hasBeenModified()
will return false.
resetModified in interface ConfigElementhasBeenModified()public void addClassMapping(String ndsName,
String appName)
throws IllegalArgumentException
ndsName - name of class in "nds" or "DirXML" spaceappName - name of class in application space
IllegalArgumentException - if the parameter ndsName is null, empty,
or equal to ANY_CLASS.public void removeClassMapping(String ndsName)
throws IllegalArgumentException
ndsName - name of class in "nds" or "DirXML" space
IllegalArgumentException - if the parameter ndsName is null, empty,
or equal to ANY_CLASS.public void addAttrMapping(String classNdsName,
String attrNdsName,
String attrAppName)
throws IllegalArgumentException,
IllegalStateException
ANY_CLASS for
the classNdsName parameter.
If the specified mapping already exists, no action is taken.
The if classNdsName is not ANY_CLASS the class mapping must already exist.
classNdsName - name of class in "nds" or "DirXML" space, or ANY_CLASSattrNdsName - name of attribute in "nds" or "DirXML" spaceattrAppName - name of attribute in application space
IllegalArgumentException - if classNdsName is null or empty,
or either attrNdsName or attrAppName
is null or empty
IllegalStateException - if a class mapping for classNdsName doesn't existpublic void removeAttrMapping(String classNdsName,
String attrNdsName)
throws IllegalArgumentException
To remove a non-class-specific mapping use ANY_CLASS as the classNdsName value.
classNdsName - name of class in "nds" or "DirXML" space, or ANY_CLASSattrNdsName - name of attribute in "nds" or "DirXML" space
IllegalArgumentException - if classNdsName is null or empty,
or attrNdsName is null or emptypublic NameMap.ClassMap getClassMap(String ndsName)
throws IllegalArgumentException
To get the non-class-specific attribute mappings specify ANY_CLASS for the ndsName
parameter value.
ndsName - name of class in "nds" or "DirXML" space, or ANY_CLASS
null if there is no mapping for the passed name
IllegalArgumentException - if ndsName is null or emptypublic String mapAppClassName(String appClassName)
throws IllegalArgumentException
appClassName - name of application class (may not be null)
IllegalArgumentException - if appClassName is null or emptypublic String mapAppAttrName(String appAttrName,
String appClassName)
If appClassName is null or empty then ANY_CLASS is used as the class name.
appAttrName - attribute name in the application namespaceappClassName - class name to use for class-specific mapping (may be null)
null if no mapping existspublic String mapNdsClassName(String ndsClassName)
throws IllegalArgumentException
ndsClassName - name of application class (may not be null)
IllegalArgumentException - if ndsClassName is null or emptypublic String mapNdsAttrName(String ndsAttrName,
String ndsClassName)
If ndsClassName is null or empty then ANY_CLASS is used as the class name.
ndsAttrName - attribute name in the "nds" or "DirXML" namespacendsClassName - class name to use for class-specific mapping (may be null)
null if no mapping existspublic Iterator iterator()
Iterator that will iterate through the class and attribute mappings in
this instance.
The Iterator's next() method will return ClassMap instances.
NameMap.ClassMappublic Element toXML(Node parent)
NameMap instance.
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 ConfigElementparent - Node under which to create XML representation
hasBeenModified(),
resetModified()public void mapXML(Node parent,
int direction)
throws IllegalArgumentException
parent - root of subtree to mapdirection - TO_APP or FROM_APP
IllegalArgumentException - if direction isn't one of TO_APP or FROM_APP
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||