WebLogic Integration


com.bea.schema
Class SOMBasic

java.lang.Object
  |
  +--com.bea.schema.SOMObject
        |
        +--com.bea.schema.SOMBasic
Direct Known Subclasses:
SOMAttribute, SOMElement

public abstract class SOMBasic
extends SOMObject
implements SOMReference

Abstract base class for SOMElement and SOMAttribute. SOMBasic provides the functionality common to both SOMElement and SOMAttribute.

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

Constructor Summary
protected SOMBasic(org.xml.sax.Attributes attrs, SOMObject parent)
          constructor for use with SAX parser, loading SOM from a file.
  SOMBasic(SOMBasic ref)
          Construct an element using another element as a reference.
  SOMBasic(java.lang.String name)
           
 
Method Summary
 SOMAnnotation addAnnotation()
          create a new empty annotation element for this element.
 SOMAnnotation addAnnotation(SOMAnnotation annotation)
          add an annotation to the schema tree.
protected  SOMObject addChild(java.lang.String tagName, org.xml.sax.Attributes attrs)
           
 SOMComplexType addComplexType()
          sets the element type to a newly constructed complexType.
 SOMDocumentation addDocumentation(java.lang.String info)
          adds a documentation element to a new annotation element for this element.
 SOMSequence addSequence()
          adds a SOMSequence to this element.
 SOMSimpleType addSimpleType()
          sets the element type to a newly constructed simpleType.
 boolean contains(SOMObject child)
          Determine if an object is child of this element.
 SOMAnnotation getAnnotation()
          return the associated Annotation object
 java.util.Map getAttributes(boolean getAll)
          retrieve the attributes for this schema element.
 java.lang.String getDefault()
          get the "default" attribute.
 java.lang.String getFixed()
          get the "fixed" attribute.
 java.lang.String getForm()
          get the "form" attribute.
 java.lang.String getName()
          get the "name" attribute.
 SOMReference getRef()
          get the "ref" attribute.
 SOMType getType()
          get the "type" attribute as a SOMType object.
 java.lang.String getTypeName()
          get the "type" attribute as a String.
 boolean isRef()
          Is this element a reference to another element.
 boolean isValidatingContent()
          get the current validation setting
 SOMAnnotation removeAnnotation()
          set the annotation for this type to null.
 void setDefault(java.lang.String p_default)
          The default attribute for an schema element.
 void setFixed(java.lang.String fixed)
          The fixed attribute for an schema element.
 void setForm(java.lang.String form)
          set the "form" attribute.
 void setName(java.lang.String name)
          set the "name" attribute.
 void setRef(SOMReference ref)
          set the element to which this element should reference.
 void setRef(SOMUnresolvedReference ref)
          set the element to which this element should reference.
 SOMType setType(SOMType type)
          sets the type attribute or complexType/simpleType for the element.
 void toXML(java.io.Writer rtn, int indent)
           
 
Methods inherited from class com.bea.schema.SOMObject
addPrefixMapping, attributesToXML, collectEffectivePrefixMappings, doIndent, getContainmentXPath, getEffectivePrefixMappings, getID_UQ, getID, getParent, getParentName, getParentSchema, getPrefixForTargetNamespace, getTargetNamespace, getURIForPrefix, isCircularReference, isSchemaChild, namespacePrefixesToXML, removeNamespaceQualifier, removePrefixMapping, setIndent, setParent, toString, toXML, toXML, toXML, trace, trace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SOMBasic

public SOMBasic(java.lang.String name)

SOMBasic

public SOMBasic(SOMBasic ref)
Construct an element using another element as a reference.
 <element name="name" type="xsd:string">
 
 <element ref="name">
 
 SOMElement name = new SOMElement("name", SOMType.STRING);
 
 SOMElement name_reference = new SOMElement(name);
 
 

Parameters:
ref - the element to be used as a reference point

SOMBasic

protected SOMBasic(org.xml.sax.Attributes attrs,
                   SOMObject parent)
constructor for use with SAX parser, loading SOM from a file.

Parameters:
attrs -  
Method Detail

setName

public void setName(java.lang.String name)
set the "name" attribute. The actual name of the element.

Parameters:
name - the element name

setForm

public void setForm(java.lang.String form)
set the "form" attribute.

If form is present and its actual value is qualified, or if form is absent and the actual value of attributeFormDefault on the <schema>ancestor is qualified, then the actual value of the targetNamespace [attribute] of the parent <schema> element information item, or absent if there is none, otherwise absent.

Valid values for form:

Parameters:
form - qualified or unqualified

setFixed

public void setFixed(java.lang.String fixed)
The fixed attribute for an schema element. This attribute specifies a value for the XML instance document element that is fixed and cannot be any other value.

Setting the fixed attribute causes the default attribute to be erased. fixed and default must not both be present.

Parameters:
fixed - the value for this instance document element

setDefault

public void setDefault(java.lang.String p_default)
The default attribute for an schema element. This attribute specifies a value for the XML instance document element that is default'ed if none is present in the XML instance document.

Setting the default attribute causes the fixed attribute to be erased. fixed and "default" must not both be present.

Parameters:
p_default - The default value for this element

setRef

public void setRef(SOMReference ref)
set the element to which this element should reference.
Specified by:
setRef in interface SOMReference

Parameters:
ref - the element to be referenced

setRef

public void setRef(SOMUnresolvedReference ref)
set the element to which this element should reference.

Parameters:
ref - the element to be referenced

setType

public SOMType setType(SOMType type)
sets the type attribute or complexType/simpleType for the element. To remove the type setting, call setType(null) with a null value. The type value can be a SOMUserDefinedType, like SOMComplexType and SOMSimpleType, or a SOMElementalType, like PrimitiveString (i.e., SOMType.STRING)

Parameters:
type - The type value for this element
Returns:
the type

getName

public java.lang.String getName()
get the "name" attribute.
Specified by:
getName in interface SOMReference


getForm

public java.lang.String getForm()
get the "form" attribute.


getDefault

public java.lang.String getDefault()
get the "default" attribute.


getFixed

public java.lang.String getFixed()
get the "fixed" attribute.


isRef

public boolean isRef()
Is this element a reference to another element. If the getRef method would return null, this method will return false. Otherwise, it will return true.

Returns:
true if getRef method does not return null

getRef

public SOMReference getRef()
get the "ref" attribute.


getType

public SOMType getType()
get the "type" attribute as a SOMType object. Note that this object will have only the local name for the resolved type (if any name was given) to that type. For example if this element refers to a user defined type called 'bar' and this type was defined in a schema with targetNamespace mapped to a prefix of 'foo', then the type attribute in XML would be 'foo:bar', but the SOMType returned from this method would have a name of just 'bar'. If you wish to get back the original qualified type name, use getTypeName() instead.


getTypeName

public java.lang.String getTypeName()
get the "type" attribute as a String. Note that the returned string will represent the exact name specified in the XML for the element's type attribute, including any namespace prefix.


addDocumentation

public SOMDocumentation addDocumentation(java.lang.String info)
adds a documentation element to a new annotation element for this element. This method will create a new annotation at the root under this element and then add the new documentation element to that annotation. Same as the longer process:
 SOMAttribute myAttr ...
 ...
 SOMAnnotation note = myAttr.addAnnotation();
 note.addDocumentation(info);
 

Parameters:
info - The documentation string to be added
Returns:
a reference to the newly created documentation object

addAnnotation

public SOMAnnotation addAnnotation()
create a new empty annotation element for this element. The annotation object is created and then added to the element tree.

Returns:
the newly created annotation object.

addAnnotation

public SOMAnnotation addAnnotation(SOMAnnotation annotation)
add an annotation to the schema tree. If the annotation exists in another tree, it will first be removed and then added to this tree.

Parameters:
annotation - a previously created annotation
Returns:
the annotation that was added.

removeAnnotation

public SOMAnnotation removeAnnotation()
set the annotation for this type to null.

Returns:
the removed annotation, or null if none was present

addComplexType

public SOMComplexType addComplexType()
sets the element type to a newly constructed complexType. This utility method tries to simplify coding for the user by creating a new SOMComplexType and passing it to the setType method.

Returns:
a reference to the newly created complexType

addSimpleType

public SOMSimpleType addSimpleType()
sets the element type to a newly constructed simpleType. This utility method tries to simplify coding for the user by creating a new SOMSimpleType and passing it to the setType method.

Returns:
a reference to the newly created simpleType

addSequence

public SOMSequence addSequence()
adds a SOMSequence to this element. The addSequence method of SOMComplexType is called to create a new SOMSequence under a complexType. If the element type is not a SOMComplexType, the type for this element is replaced by a new SOMComplextType ( see addComplexType() ). If the type was already a SOMComplexType, this method attempts to add an additional or initial sequence to the complexType.

Returns:
a newly created SOMSequence with a parent of SOMComplexType.

addChild

protected SOMObject addChild(java.lang.String tagName,
                             org.xml.sax.Attributes attrs)
                      throws org.xml.sax.SAXException

Overrides:
addChild in class SOMObject

contains

public boolean contains(SOMObject child)
Determine if an object is child of this element.
Specified by:
contains in interface SOMReference

Parameters:
child - the object in question
Returns:
true if the child is contained within this structure

getAnnotation

public SOMAnnotation getAnnotation()
return the associated Annotation object

Returns:
SOMAnnotation

getAttributes

public java.util.Map getAttributes(boolean getAll)
retrieve the attributes for this schema element. If getAll is false, only the attributes that are not set to their default value are returned. If getAll is true, all possible attributes for this element will be returned.

Parameters:
getAll - get all attributes
Returns:
a Hashtable of attributes, where the attribute name and value are stored as strings.

toXML

public void toXML(java.io.Writer rtn,
                  int indent)
           throws java.io.IOException

Overrides:
toXML in class SOMObject

isValidatingContent

public boolean isValidatingContent()
get the current validation setting

Returns:
false if element and attribute content should be validated.

WebLogic Integration

WebLogic Integration (WLI)