electric.xml.io
Class Namespaces

java.lang.Object
  extended byelectric.xml.io.Namespaces
All Implemented Interfaces:
ISchemaConstants

public final class Namespaces
extends java.lang.Object
implements ISchemaConstants

Namespaces is the storehouse of a list of IQNamed. Among these are Types and SchemaEntries from a schema, and if you're based around a WSDL, the Ports, Parts, Messages, PortTypes and Bindings associated with the WSDL.

Author:
webMethods

Field Summary
 
Fields inherited from interface electric.xml.io.schema.ISchemaConstants
ABSTRACT, ALL, ANNOTATION, ANY, ANY_ATTRIBUTE, ANY_TYPE, ANY_URI, ARRAY, ARRAY_PREFIX, ARRAY_TYPE, ATTRIBUTE, ATTRIBUTE_FORM_DEFAULT, ATTRIBUTE_GROUP, BASE, BASE_64_BINARY, BOOLEAN, BYTE, CHOICE, COMPLEX_CONTENT, COMPLEX_TYPE, DATE_TIME, DECIMAL, DOMINANT_SIMPLE_TYPE_NAMES, DOUBLE, DURATION, ELEMENT, ELEMENT_FORM_DEFAULT, ENUMERATION, EXTENSION, FLOAT, FORM, FRACTION_DIGITS, GROUP, HEX_BINARY, HREF, ID, IMPORT, INCLUDE, INSTANCE_SUFFIX, INT, INTEGER, LENGTH, LONG, MAX_EXCLUSIVE, MAX_INCLUSIVE, MAX_LENGTH, MAX_OCCURS, MIN_EXCLUSIVE, MIN_INCLUSIVE, MIN_LENGTH, MIN_OCCURS, NAME, NAMESPACE, NIL, NILLABLE, NOTATION, NULL, ONE, PATTERN, POUND_ID, PROCESS_CONTENTS, QNAME, QUALIFIED, REDEFINE, REF, RESTRICTION, ROOT, SCHEMA, SCHEMA_LOCATION, SEQUENCE, SHORT, SIMPLE_CONTENT, SIMPLE_TYPE, SOAP_ENCODING, SOAP_ENCODING_ARRAY, SOAP12_ENCODING, SOAP12_ENCODING_ARRAY, SOAPENC, STAR, STRING, TARGET_NAMESPACE, TIME, TOTAL_DIGITS, TYPE, UNBOUNDED, UNQUALIFIED, UNSIGNED_SHORT, USE, VALUE, WHITESPACE, WSDL_ARRAY, WSDL_HTTP, WSDL_MIME, WSDL_NAMESPACE, WSDL_SOAP, XSD_BOOLEAN, XSD_BYTE, XSD_DOUBLE, XSD_FLOAT, XSD_INT, XSD_LONG, XSD_PREFIX, XSD_SHORT, XSD_STRING, XSD_UNSIGNED_SHORT, XSI_PREFIX, ZERO
 
Constructor Summary
Namespaces(java.lang.String version)
           
Namespaces(java.lang.String version, java.lang.String encodingStyle)
          Construct a Namespaces object for a given version of XML Schema.
 
Method Summary
 void addItem(IQNamed item)
           
 void cacheSchema(Schema schema)
           
 Schema createSchema(java.lang.String targetNamespace, boolean qualifyElements, boolean qualifyAttributes)
           
 Schema findSchema(java.lang.String targetNamespace)
           
 Type getCachedTypeWithJavaClass(java.lang.Class javaClass)
          Return the type that maps to this javaClass if one has been cached.
 Type getCachedTypeWithJavaName(java.lang.String javaName)
          Search only the cached types in this namespaces for a type representing the javaName.
 java.lang.String getEncodingStyle()
           
 boolean getEnforceEncodingStyle()
           
 IQNamed getItem(java.lang.String qname, java.lang.Class javaClass)
          Give me the IQNamed item for the qname that is an instance of the javaClass.
 IQNamed getItem(java.lang.String namespace, java.lang.String name, java.lang.Class javaClass)
          Give me the item represented by the namespace and name that is an instance of the java class.
 IQNamed[] getItems()
           
 java.util.Enumeration getItems(java.lang.Class javaClass)
          Give me all the IQNamed items that are instances of a certain class.
 Schema getSchema(java.lang.String targetNamespace)
           
 Type getTypeWithJavaClass(java.lang.Class javaClass)
          Return the dominant type for the specified javaClass.
 Type getTypeWithQName(Element element, java.lang.String qname)
           
 Type getTypeWithQName(java.lang.String qname)
          Return a type for the given qname.
 Type getTypeWithQName(java.lang.String namespace, java.lang.String name)
           
 Type getTypeWithSchema(java.lang.String namespace, java.lang.String name, Element schema)
          Probably not suitable for external use.
 java.lang.String getVersion()
           
 void removeItem(IQNamed item)
           
 void setEncodingStyle(java.lang.String encodingStyle)
           
 void setEnforceEncodingStyle(boolean enforce)
           
 void setVersion(java.lang.String version)
          This is used in mappings to set the version of XSD after the product has been started up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Namespaces

public Namespaces(java.lang.String version)
Parameters:
version -

Namespaces

public Namespaces(java.lang.String version,
                  java.lang.String encodingStyle)
Construct a Namespaces object for a given version of XML Schema. This will create a default ArrayType that represents Object[], a SerializeType and initialize all the default SimpleTypes for this schema to be the dominant types for their respective classes.

Parameters:
version -
Method Detail

setEncodingStyle

public void setEncodingStyle(java.lang.String encodingStyle)
Parameters:
encodingStyle -

getEncodingStyle

public java.lang.String getEncodingStyle()
Returns:
the encodingStyle.

setEnforceEncodingStyle

public void setEnforceEncodingStyle(boolean enforce)
Parameters:
enforce - true if only types that match this namespace's encoding style are allowed.

getEnforceEncodingStyle

public boolean getEnforceEncodingStyle()
Returns:
true if only type that match the encodingStyle are included in this namespace, false if any type is allowed.

getVersion

public java.lang.String getVersion()

setVersion

public void setVersion(java.lang.String version)
This is used in mappings to set the version of XSD after the product has been started up.

Parameters:
version -

getItems

public IQNamed[] getItems()

getItems

public java.util.Enumeration getItems(java.lang.Class javaClass)
Give me all the IQNamed items that are instances of a certain class. Common parameters to this method include Type, ArrayType, ComplexType, SOAPBinding, etc.

Parameters:
javaClass -

addItem

public void addItem(IQNamed item)
Parameters:
item -

removeItem

public void removeItem(IQNamed item)
Parameters:
item -

getItem

public IQNamed getItem(java.lang.String qname,
                       java.lang.Class javaClass)
                throws SchemaException
Give me the IQNamed item for the qname that is an instance of the javaClass. Since it is possible to have a SchemaElement that is named foo:bar, and a type that is named foo:bar without conflict, This method will disambiguate which object you want.

Parameters:
qname -
javaClass -
Throws:
SchemaException

getItem

public IQNamed getItem(java.lang.String namespace,
                       java.lang.String name,
                       java.lang.Class javaClass)
                throws SchemaException
Give me the item represented by the namespace and name that is an instance of the java class.

Parameters:
namespace -
name -
javaClass -
Throws:
SchemaException

getTypeWithJavaClass

public Type getTypeWithJavaClass(java.lang.Class javaClass)
                          throws SchemaException
Return the dominant type for the specified javaClass. First it will go through the cached types, and if it doesn't find one there, it will go through the Mappings subsystem and see if a type maps to that class. After this, it will go through the TypeFactories and return any type they create. Finally, it will throw a schema exception, if none can be created. (unlikely, as ComplexTypeFactory will return *something* for a class.)

Parameters:
javaClass -
Throws:
SchemaException

getTypeWithQName

public Type getTypeWithQName(java.lang.String qname)
                      throws SchemaException
Return a type for the given qname. Follows the same rules as getTypeForJavaClass(). (cached types, mappings, type factories, schema exception)

Parameters:
qname -
Throws:
SchemaException

getTypeWithQName

public Type getTypeWithQName(java.lang.String namespace,
                             java.lang.String name)
                      throws SchemaException
Parameters:
namespace -
name -
Throws:
SchemaException

getTypeWithQName

public Type getTypeWithQName(Element element,
                             java.lang.String qname)
                      throws SchemaException
Parameters:
element -
qname -
Throws:
SchemaException

getTypeWithSchema

public Type getTypeWithSchema(java.lang.String namespace,
                              java.lang.String name,
                              Element schema)
                       throws SchemaException
Probably not suitable for external use. This method will run through the TypeFactories, and try to create a Type for the element. If one is created, it will be added to this namespace, and returned. Otherwise it will throw a schema exception.

Parameters:
namespace -
name -
schema -
Throws:
SchemaException

cacheSchema

public void cacheSchema(Schema schema)
Parameters:
schema -

getSchema

public Schema getSchema(java.lang.String targetNamespace)
Parameters:
targetNamespace -

findSchema

public Schema findSchema(java.lang.String targetNamespace)
Parameters:
targetNamespace -

createSchema

public Schema createSchema(java.lang.String targetNamespace,
                           boolean qualifyElements,
                           boolean qualifyAttributes)
Parameters:
targetNamespace -
qualifyElements -
qualifyAttributes -

getCachedTypeWithJavaClass

public Type getCachedTypeWithJavaClass(java.lang.Class javaClass)
                                throws SchemaException
Return the type that maps to this javaClass if one has been cached.

Parameters:
javaClass -
Throws:
SchemaException

getCachedTypeWithJavaName

public Type getCachedTypeWithJavaName(java.lang.String javaName)
                               throws SchemaException
Search only the cached types in this namespaces for a type representing the javaName.

Parameters:
javaName -
Throws:
SchemaException


copyright© 2001-2004 by webMethods All Rights Reserved.