WebLogic Integration


com.bea.schema
Class SOMObject

java.lang.Object
  |
  +--com.bea.schema.SOMObject
Direct Known Subclasses:
SOMAnnotation, SOMAppInfo, SOMAttributeGroup, SOMBasic, SOMExtension, SOMFacet, SOMGroupType, SOMList, SOMSchema, SOMSimpleContent, SOMType, SOMUnion, SOMUnresolvedReference

public abstract class SOMObject
extends java.lang.Object
implements java.io.Serializable

abstract base class for all SOM classes

Author:
Copyright © 2000, 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
SOMSchema, Serialized Form

Constructor Summary
SOMObject()
           
 
Method Summary
protected  SOMObject addChild(java.lang.String tagName, org.xml.sax.Attributes attrs)
          for use with the SAX parser while loading a SOM from a file.
protected  void addPrefixMapping(java.lang.String prefix, java.lang.String uri)
          add a new prefix mapping to this object.
protected  void attributesToXML(java.io.Writer rtn, java.util.Map attrs)
          internal utility to print attributes to XML used in toXML().
protected  void collectEffectivePrefixMappings(java.util.Map mappings)
           
protected  void doIndent(java.io.Writer buf, int indent)
           
 java.lang.String getContainmentXPath()
           
 java.util.Map getEffectivePrefixMappings()
          get a map of all the prefix->URI mappings that are in effect for this SOMObject.
 java.lang.String getID_UQ()
          get the unqualified ID (no namespace).
abstract  java.lang.String getID()
          Returns a printable element tag for this Schema Object
 SOMObject getParent()
          get a reference to the parent object
 java.lang.String getParentName()
          get the name of the nearest named parent for this object
 SOMSchema getParentSchema()
          get a reference to the parent schema for this object
 java.lang.String getPrefixForTargetNamespace()
          get an appropriate namespace prefix for the current target namespace, or null if no prefix can be found or no target namespace has been set.
 java.lang.String getTargetNamespace()
          get the value of the targetNamespace attribute for this schema, or null if none was specified.
 java.lang.String getURIForPrefix(java.lang.String prefix)
          get the URI mapped to a given namespace prefix within this SOMObject, or null if no URI is mapped to the given prefix.
 boolean isCircularReference(SOMReference reference)
           
 boolean isSchemaChild()
          determines if the immediate parent object is the schema element.
protected  void namespacePrefixesToXML(java.io.Writer rtn)
          internal utility to print namespace prefix mapping attributes into output XML.
static java.lang.String removeNamespaceQualifier(java.lang.String value)
          remove the namespace qualifier from a string.
protected  java.lang.String removePrefixMapping(java.lang.String prefix)
          remove a new prefix mapping from this object.
static void setIndent(java.lang.String indentToken)
          Allows the user to specify a token to be used for the indent when formatting output XML.
 void setParent(SOMObject parent)
           
 java.lang.String toString()
          The String representation of the XML Schema Object.
 java.lang.String toXML()
          The String representation of the XML Schema Object.
 java.lang.String toXML(java.lang.String encoding)
          The String representation of the XML Schema Object.
 void toXML(java.io.Writer rtn)
          Outputs a formatted XML representation of SOMObject.
abstract  void toXML(java.io.Writer rtn, int indent)
          Outputs a formatted XML representation of SOMObject.
protected static boolean trace(int lvl)
           
protected static void trace(java.lang.String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SOMObject

public SOMObject()
Method Detail

addChild

protected SOMObject addChild(java.lang.String tagName,
                             org.xml.sax.Attributes attrs)
                      throws org.xml.sax.SAXException
for use with the SAX parser while loading a SOM from a file.

Parameters:
tagName - tag name from parser
attrs - attributes from parser
Returns:
the newly created object from the input arguments
Throws:
org.xml.sax.SAXException -  

addPrefixMapping

protected void addPrefixMapping(java.lang.String prefix,
                                java.lang.String uri)
add a new prefix mapping to this object. A prefix mapping will appear as an xmlns:="" attribute on the root element for this object.


removePrefixMapping

protected java.lang.String removePrefixMapping(java.lang.String prefix)
remove a new prefix mapping from this object. A prefix mapping appears as an xmlns:="" attribute on the root element for this object.

Returns:
The URI to which this prefix was mapped (or null if no mapping)

getEffectivePrefixMappings

public java.util.Map getEffectivePrefixMappings()
get a map of all the prefix->URI mappings that are in effect for this SOMObject. This will always return non-null, but if no mappings are in effect, the map will be empty.


getURIForPrefix

public java.lang.String getURIForPrefix(java.lang.String prefix)
get the URI mapped to a given namespace prefix within this SOMObject, or null if no URI is mapped to the given prefix.


collectEffectivePrefixMappings

protected void collectEffectivePrefixMappings(java.util.Map mappings)


getTargetNamespace

public java.lang.String getTargetNamespace()
get the value of the targetNamespace attribute for this schema, or null if none was specified.


getPrefixForTargetNamespace

public java.lang.String getPrefixForTargetNamespace()
get an appropriate namespace prefix for the current target namespace, or null if no prefix can be found or no target namespace has been set.


toString

public java.lang.String toString()
The String representation of the XML Schema Object. Uses java.io.StringWriter to create a serialized XML Schema.

Returns:
formatted XML
Overrides:
toString in class java.lang.Object

toXML

public java.lang.String toXML()
The String representation of the XML Schema Object. This method calls the toXML(Writer, int) method using OutputStreamWriter with UTF-8 encoding. If an IOException occurs in the underlying Writer, the exception is discarded and an empty or partial String is returned.

Returns:
printable XML Schema.

toXML

public java.lang.String toXML(java.lang.String encoding)
The String representation of the XML Schema Object. This method calls the toXML(Writer, int) method using OutputStreamWriter with the specified encoding. If an IOException occurs in the underlying Writer, the exception is discarded and an empty or partial String is returned.

Returns:
printable XML Schema.

toXML

public void toXML(java.io.Writer rtn)
           throws java.io.IOException
Outputs a formatted XML representation of SOMObject. Indent is set to zero.

Parameters:
rtn - printable XML Schema
Throws:
java.io.IOException - if IOExcpetion is thrown by underlying java.io.Writer

toXML

public abstract void toXML(java.io.Writer rtn,
                           int indent)
                    throws java.io.IOException
Outputs a formatted XML representation of SOMObject.

Parameters:
rtn - printable XML Schema
indent - the indent level for formatting at which to start this schema object.
Throws:
java.io.IOException - if IOExcpetion is thrown by underlying java.io.Writer

namespacePrefixesToXML

protected void namespacePrefixesToXML(java.io.Writer rtn)
                               throws java.io.IOException
internal utility to print namespace prefix mapping attributes into output XML.


attributesToXML

protected void attributesToXML(java.io.Writer rtn,
                               java.util.Map attrs)
                        throws java.io.IOException
internal utility to print attributes to XML used in toXML().

The Map used is not reusable. The Map is not guaranteed to be the same after this method completes.

Parameters:
rtn - the output stream
attrs - the attributes to be written to the stream
Throws:
java.io.IOException -  

getParentSchema

public SOMSchema getParentSchema()
get a reference to the parent schema for this object

Returns:
The parent SOMSchema for this object or null if the object doesn't have a schema parent.

getParentName

public java.lang.String getParentName()
get the name of the nearest named parent for this object

Returns:
The name of the nearest named parent for this object.

getContainmentXPath

public java.lang.String getContainmentXPath()


getParent

public SOMObject getParent()
get a reference to the parent object

Returns:
The parent object for this object in the tree

setParent

public void setParent(SOMObject parent)


isSchemaChild

public boolean isSchemaChild()
determines if the immediate parent object is the schema element. If the immediate parent object of this object is an instance of a SOMSchema, this method returns true, and otherwise false.

Returns:
true if getParent() is instanceof SOMSchema

getID

public abstract java.lang.String getID()
Returns a printable element tag for this Schema Object

Returns:
String representation of the element tag

doIndent

protected void doIndent(java.io.Writer buf,
                        int indent)
                 throws java.io.IOException


getID_UQ

public java.lang.String getID_UQ()
get the unqualified ID (no namespace). By default, all schema elements are prefixed with the namespace xsd. With getID_UQ(), the xsd: is stripped off and the unqualified ID is returned.

Returns:
Unqualified ID

removeNamespaceQualifier

public static java.lang.String removeNamespaceQualifier(java.lang.String value)
remove the namespace qualifier from a string. For example, if the string "xsd:element" was passed by value, the value "element" would be returned.

Parameters:
value - qualified data
Returns:
substring of data following the colon

setIndent

public static void setIndent(java.lang.String indentToken)
Allows the user to specify a token to be used for the indent when formatting output XML. The default is two spaces, " ". To set the output to be tabbed indenting, use
setIndent("\t");

Parameters:
indentToken -  

isCircularReference

public boolean isCircularReference(SOMReference reference)


trace

protected static final boolean trace(int lvl)


trace

protected static final void trace(java.lang.String msg)


WebLogic Integration

WebLogic Integration (WLI)