All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.xmlmiddleware.xmldbms.maps.ClassMap

java.lang.Object
   |
   +----org.xmlmiddleware.xmldbms.maps.MapBase
           |
           +----org.xmlmiddleware.xmldbms.maps.ClassMapBase
                   |
                   +----org.xmlmiddleware.xmldbms.maps.ClassMap

public class ClassMap
extends ClassMapBase
Maps an element type as a class; not for general use.

ClassMap contains information about an element type that is viewed as a class and mapped to a class table. It contains the name of the element type and the table, as well as information about a base class map (if any) and maps for attributes, PCDATA, and child element types.

ClassMap inherits from ClassMapBase, which provides an accessor for the element type name and accessors and mutators for attribute, PCDATA, and child element type maps. It adds accessors and mutators for class table, base table, and used class map.

If this ClassMap uses a different ClassMap (which effectively "casts" the element type mapped by this ClassMap to the element type mapped by the other ClassMap), then all mutator methods except useClassMap() return an IllegalStateException.

ClassMaps are stored in the XMLDBMSMap class. They are pointed to by ClassMaps and RelatedClassMaps.

Version:
2.0
Author:
Ronald Bourret, 1998-9, 2001

Method Index

 o addAttributeMap(PropertyMap)
Add a PropertyMap for an attribute.
 o addChildMap(InlineClassMap)
Add an InlineClassMap for a child element type.
 o addChildMap(PropertyMap)
Add a PropertyMap for a child element type.
 o addChildMap(RelatedClassMap)
Add a RelatedClassMap for a child element type.
 o addPCDATAMap(PropertyMap)
Add a PropertyMap for PCDATA.
 o create(String, String)
Create a new ClassMap.
 o create(XMLName)
Create a new ClassMap.
 o createAttributeMap(String, String)
Create a PropertyMap for an attribute and add it to this map.
 o createAttributeMap(XMLName)
Create a PropertyMap for an attribute and add it to this map.
 o createChildPropertyMap(String, String)
Create a PropertyMap for a child element type and add it to this map.
 o createChildPropertyMap(XMLName)
Create a PropertyMap for a child element type and add it to this map.
 o createInlineClassMap(String, String)
Create an InlineClassMap for a child element type and add it to this map.
 o createInlineClassMap(XMLName)
Create an InlineClassMap for a child element type and add it to this map.
 o createPCDATAMap()
Create a new PropertyMap for PCDATA.
 o createRelatedClassMap(String, String)
Create a RelatedClassMap for a child element type and add it to this map.
 o createRelatedClassMap(XMLName)
Create a RelatedClassMap for a child element type and add it to this map.
 o getBaseClassMap()
Get the name of the base ClassMap, if one is being used.
 o getBaseLinkInfo()
Get the LinkInfo used to link the class table to the base class table.
 o getTable()
Get the table to which the class is mapped.
 o getUsedClassMap()
Get the ClassMap used by this ClassMap.
 o removeAllAttributeMaps()
Remove the PropertyMaps for all attributes.
 o removeAllChildMaps()
Remove the maps for all child element types.
 o removeAttributeMap(String)
Remove the PropertyMap for an attribute.
 o removeAttributeMap(String, String)
Remove the PropertyMap for an attribute.
 o removeChildMap(String)
Remove the map for a child element type.
 o removeChildMap(String, String)
Remove the map for a child element type.
 o removePCDATAMap()
Remove the PropertyMap for PCDATA.
 o setBaseClassMap(ClassMap)
Set the base ClassMap.
 o setBaseLinkInfo(LinkInfo)
Set the LinkInfo used to link the class table to the base class table.
 o setTable(Table)
Set the table to which the class is mapped.
 o useClassMap(ClassMap)
Use the ClassMap for a different element type.

Methods

 o create
 public static ClassMap create(String uri,
                               String localName)
Create a new ClassMap.

Parameters:
uri - Namespace URI of the element type being mapped. May be null.
localName - Local name of the element type being mapped.
Returns:
The ClassMap.
 o create
 public static ClassMap create(XMLName elementTypeName)
Create a new ClassMap.

Parameters:
elementTypeName - XMLName of the element type being mapped.
Returns:
The ClassMap.
 o getTable
 public final Table getTable()
Get the table to which the class is mapped.

Returns:
The table.
 o setTable
 public void setTable(Table table)
Set the table to which the class is mapped.

Parameters:
table - The table. May be null.
 o getBaseClassMap
 public final ClassMap getBaseClassMap()
Get the name of the base ClassMap, if one is being used.

Returns:
The base ClassMap. May be null.
 o setBaseClassMap
 public void setBaseClassMap(ClassMap baseClassMap)
Set the base ClassMap.

Parameters:
baseClassMap - The base ClassMap. If there is no base ClassMap, set this to null, in which case the information used to link the class table to the base table is set to null.
 o getBaseLinkInfo
 public final LinkInfo getBaseLinkInfo()
Get the LinkInfo used to link the class table to the base class table.

Returns:
The LinkInfo. The "parent" table is the base class table. Null if the base class table is not used.
 o setBaseLinkInfo
 public void setBaseLinkInfo(LinkInfo baseLinkInfo)
Set the LinkInfo used to link the class table to the base class table.

This method may not be called if the base ClassMap is null.

Setting the baseLinkInfo argument to null when the base ClassMap is non-null is useful if you want the map objects to preserve inheritance information but want to store the data for the class in a single table, rather than in a base table and a class table. Inheritance information can then be used elsewhere, such as when an XML Schema is generated from an XMLDBMSMap.

Parameters:
baseLinkInfo - The LinkInfo. The "parent" table is the base class table. Null if the base class table is not used.
 o getUsedClassMap
 public final ClassMap getUsedClassMap()
Get the ClassMap used by this ClassMap.

The ClassMap returned by this method might use another ClassMap, and so on. It is the responsibility of the calling application to navigate the chain of ClassMaps.

If the returned value is not null, then no other methods may be called to set properties of this ClassMap (except useClassMap()) and the values returned by methods that get properties of this ClassMap are undefined.

Returns:
The ClassMap used by this ClassMap. May be null.
 o useClassMap
 public void useClassMap(ClassMap useClassMap)
Use the ClassMap for a different element type.

Using the ClassMap for a different element type effectively "casts" the element type mapped by this ClassMap to the other element type. For more information, see the description of the <UseClassMap> element type in the XML-DBMS mapping language.

Calling this method with a non-null useClassMap argument sets all other properties (class table, attribute maps, etc.) to their initial state (null, empty, false, etc.)

Parameters:
useClassMap - The ClassMap to use. Set this to null to use the current ClassMap.
 o createAttributeMap
 public PropertyMap createAttributeMap(String uri,
                                       String localName)
Create a PropertyMap for an attribute and add it to this map.

If the attribute has already been mapped, returns the existing PropertyMap.

Parameters:
uri - Namespace URI of the attribute. May be null.
localName - Local name of the attribute.
Returns:
The PropertyMap for the attribute.
Overrides:
createAttributeMap in class ClassMapBase
 o createAttributeMap
 public PropertyMap createAttributeMap(XMLName xmlName)
Create a PropertyMap for an attribute and add it to this map.

If the attribute has already been mapped, returns the existing PropertyMap.

Parameters:
xmlName - XMLName of the attribute.
Returns:
The PropertyMap for the attribute.
Overrides:
createAttributeMap in class ClassMapBase
 o addAttributeMap
 public void addAttributeMap(PropertyMap propMap) throws XMLMiddlewareException
Add a PropertyMap for an attribute.

Parameters:
propMap - PropertyMap for the attribute. Must not be null.
Throws: XMLMiddlewareException
Thrown if the attribute has already been mapped.
Overrides:
addAttributeMap in class ClassMapBase
 o removeAttributeMap
 public void removeAttributeMap(String uri,
                                String localName) throws XMLMiddlewareException
Remove the PropertyMap for an attribute.

Parameters:
uri - Namespace URI of the attribute. May be null.
localName - Local name of the attribute.
Throws: XMLMiddlewareException
Thrown if the attribute has not been mapped.
Overrides:
removeAttributeMap in class ClassMapBase
 o removeAttributeMap
 public void removeAttributeMap(String universalName) throws XMLMiddlewareException
Remove the PropertyMap for an attribute.

Parameters:
universalName - Universal name of the attribute.
Throws: XMLMiddlewareException
Thrown if the attribute has not been mapped.
Overrides:
removeAttributeMap in class ClassMapBase
 o removeAllAttributeMaps
 public void removeAllAttributeMaps()
Remove the PropertyMaps for all attributes.

Overrides:
removeAllAttributeMaps in class ClassMapBase
 o createPCDATAMap
 public PropertyMap createPCDATAMap()
Create a new PropertyMap for PCDATA.

If PCDATA has already been mapped, returns the existing PropertyMap.

Returns:
A PropertyMap for PCDATA.
Overrides:
createPCDATAMap in class ClassMapBase
 o addPCDATAMap
 public void addPCDATAMap(PropertyMap propMap) throws XMLMiddlewareException
Add a PropertyMap for PCDATA.

Parameters:
propMap - PropertyMap for PCDATA. Must not be null.
Throws: XMLMiddlewareException
Thrown if PCDATA has already been mapped.
Overrides:
addPCDATAMap in class ClassMapBase
 o removePCDATAMap
 public void removePCDATAMap() throws XMLMiddlewareException
Remove the PropertyMap for PCDATA.

Throws: XMLMiddlewareException
Thrown if PCDATA has not been mapped.
Overrides:
removePCDATAMap in class ClassMapBase
 o createChildPropertyMap
 public PropertyMap createChildPropertyMap(String uri,
                                           String localName) throws XMLMiddlewareException
Create a PropertyMap for a child element type and add it to this map.

If the child element type has already been mapped as a property, returns the existing PropertyMap.

Parameters:
uri - Namespace URI of the child element type. May be null.
localName - Local name of the child element type.
Returns:
The PropertyMap for the child element type.
Throws: XMLMiddlewareException
Thrown if the child element type is already mapped as a related class or inlined class.
Overrides:
createChildPropertyMap in class ClassMapBase
 o createChildPropertyMap
 public PropertyMap createChildPropertyMap(XMLName elementTypeName) throws XMLMiddlewareException
Create a PropertyMap for a child element type and add it to this map.

If the child element type has already been mapped as a property, returns the existing PropertyMap.

Parameters:
elementTypeName - XMLName of the child element type.
Returns:
The PropertyMap for the child element type.
Throws: XMLMiddlewareException
Thrown if the child element type is already mapped as a related class or inlined class.
Overrides:
createChildPropertyMap in class ClassMapBase
 o createRelatedClassMap
 public RelatedClassMap createRelatedClassMap(String uri,
                                              String localName) throws XMLMiddlewareException
Create a RelatedClassMap for a child element type and add it to this map.

If the child element type has already been mapped as a related class, returns the existing RelatedClassMap.

Parameters:
uri - Namespace URI of the child element type. May be null.
localName - Local name of the child element type.
Returns:
The RelatedClassMap for the child element type.
Throws: XMLMiddlewareException
Thrown if the child element type is already mapped as a property or inlined class.
Overrides:
createRelatedClassMap in class ClassMapBase
 o createRelatedClassMap
 public RelatedClassMap createRelatedClassMap(XMLName elementTypeName) throws XMLMiddlewareException
Create a RelatedClassMap for a child element type and add it to this map.

If the child element type has already been mapped as a related class, returns the existing RelatedClassMap.

Parameters:
elementTypeName - XMLName of the child element type.
Returns:
The RelatedClassMap for the child element type.
Throws: XMLMiddlewareException
Thrown if the child element type is already mapped as a property or inlined class.
Overrides:
createRelatedClassMap in class ClassMapBase
 o createInlineClassMap
 public InlineClassMap createInlineClassMap(String uri,
                                            String localName) throws XMLMiddlewareException
Create an InlineClassMap for a child element type and add it to this map.

If the child element type has already been mapped as an inlined class, returns the existing InlineClassMap.

Parameters:
uri - Namespace URI of the child element type. May be null.
localName - Local name of the child element type.
Returns:
The InlineClassMap for the child element type.
Throws: XMLMiddlewareException
Thrown if the child element type is already mapped as a property or related class.
Overrides:
createInlineClassMap in class ClassMapBase
 o createInlineClassMap
 public InlineClassMap createInlineClassMap(XMLName elementTypeName) throws XMLMiddlewareException
Create an InlineClassMap for a child element type and add it to this map.

If the child element type has already been mapped as an inlined class, returns the existing InlineClassMap.

Parameters:
elementTypeName - XMLName of the child element type.
Returns:
The InlineClassMap for the child element type.
Throws: XMLMiddlewareException
Thrown if the child element type is already mapped as a property or related class.
Overrides:
createInlineClassMap in class ClassMapBase
 o addChildMap
 public void addChildMap(PropertyMap propMap) throws XMLMiddlewareException
Add a PropertyMap for a child element type.

Parameters:
propMap - PropertyMap for the child element type. Must not be null.
Throws: XMLMiddlewareException
Thrown if the child element type has already been mapped.
Overrides:
addChildMap in class ClassMapBase
 o addChildMap
 public void addChildMap(RelatedClassMap relatedClassMap) throws XMLMiddlewareException
Add a RelatedClassMap for a child element type.

The RelatedClassMap is added under the name returned by RelatedClassMap.getElementTypeName(). This may be different from the name returned by RelatedClassMap.getClassMap().getElementTypeName(). That is, the referenced element type might be mapped using the ClassMap for another element type. This effectively "casts" the reference to the second element type. For more information, see the description of the <UseClassMap> element type in the XML-DBMS mapping language.

Parameters:
relatedClassMap - RelatedClassMap for the child element type. Must not be null.
Throws: XMLMiddlewareException
Thrown if the child element type has already been mapped.
Overrides:
addChildMap in class ClassMapBase
 o addChildMap
 public void addChildMap(InlineClassMap inlineClassMap) throws XMLMiddlewareException
Add an InlineClassMap for a child element type.

Parameters:
inlineClassMap - InlineClassMap for the child element type. Must not be null.
Throws: XMLMiddlewareException
Throw if the child element type is already mapped.
Overrides:
addChildMap in class ClassMapBase
 o removeChildMap
 public void removeChildMap(String uri,
                            String localName) throws XMLMiddlewareException
Remove the map for a child element type.

Parameters:
uri - Namespace URI of the child element type. May be null.
localName - Local name of the child element type.
Throws: XMLMiddlewareException
Thrown if the child element type has not been mapped.
Overrides:
removeChildMap in class ClassMapBase
 o removeChildMap
 public void removeChildMap(String universalName) throws XMLMiddlewareException
Remove the map for a child element type.

Parameters:
universalName - Universal name of the child element type.
Throws: XMLMiddlewareException
Thrown if the child element type has not been mapped.
Overrides:
removeChildMap in class ClassMapBase
 o removeAllChildMaps
 public void removeAllChildMaps()
Remove the maps for all child element types.

Overrides:
removeAllChildMaps in class ClassMapBase

All Packages  Class Hierarchy  This Package  Previous  Next  Index