org.apache.axis.encoding
Class TypeMappingImpl

java.lang.Object
  |
  +--org.apache.axis.encoding.TypeMappingImpl
All Implemented Interfaces:
TypeMapping, TypeMapping
Direct Known Subclasses:
DefaultTypeMappingImpl

public class TypeMappingImpl
extends java.lang.Object
implements TypeMapping

Author:
Rich Scheuerle (scheu@us.ibm.com) This is the implementation of the axis TypeMapping interface (which extends the JAX-RPC TypeMapping interface). A TypeMapping is obtained from the singleton TypeMappingRegistry using the namespace of the webservice. The TypeMapping contains the tuples {Java type, SerializerFactory, DeserializerFactory, Type QName) So if you have a Web Service with the namespace "XYZ", you call the TypeMappingRegistry.getTypeMapping("XYZ"). The wsdl in your web service will use a number of types. The tuple information for each of these will be accessed via the TypeMapping. Because every web service uses the soap, schema, wsdl primitives, we could pre-populate the TypeMapping with these standard tuples. Instead, if the namespace/class matches is not found in the TypeMapping the request is delegated to the Default TypeMapping or another TypeMapping

Inner Class Summary
 class TypeMappingImpl.Pair
           
 
Field Summary
protected  TypeMapping delegate
           
protected static org.apache.commons.logging.Log log
           
 
Constructor Summary
TypeMappingImpl(TypeMapping delegate)
          Construct TypeMapping
 
Method Summary
 java.lang.Class getClassForQName(QName xmlType)
          Gets the Class mapped to QName.
 TypeMapping getDelegate()
          getDelegate gets the new Delegate TypeMapping
 DeserializerFactory getDeserializer(java.lang.Class javaType, QName xmlType)
          Gets the DeserializerFactory registered for the specified pair of Java type and XML data type.
 DeserializerFactory getDeserializer(QName xmlType)
          Gets the DeserializerFactory registered for the specified pair of Java type and XML data type.
 SerializerFactory getSerializer(java.lang.Class javaType)
          Gets the SerializerFactory registered for the specified pair of Java type and XML data type.
 SerializerFactory getSerializer(java.lang.Class javaType, QName xmlType)
          Gets the SerializerFactory registered for the specified pair of Java type and XML data type.
 java.lang.String[] getSupportedNamespaces()
          Gets the list of encoding styles supported by this TypeMapping object.
 QName getTypeQName(java.lang.Class javaType)
          Gets the QName for the type mapped to Class.
 boolean isRegistered(java.lang.Class javaType, QName xmlType)
          isRegistered returns true if the [javaType, xmlType] pair is registered.
 void register(java.lang.Class javaType, QName xmlType, SerializerFactory sf, DeserializerFactory dsf)
          Registers SerializerFactory and DeserializerFactory for a specific type mapping between an XML type and Java type.
 void removeDeserializer(java.lang.Class javaType, QName xmlType)
          Removes the DeserializerFactory registered for the specified pair of Java type and XML data type.
 void removeSerializer(java.lang.Class javaType, QName xmlType)
          Removes the SerializerFactory registered for the specified pair of Java type and XML data type.
 void setDelegate(TypeMapping delegate)
          setDelegate sets the new Delegate TypeMapping
 void setSupportedNamespaces(java.lang.String[] namespaceURIs)
          Sets the list of encoding styles supported by this TypeMapping object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log

delegate

protected TypeMapping delegate
Constructor Detail

TypeMappingImpl

public TypeMappingImpl(TypeMapping delegate)
Construct TypeMapping
Method Detail

setDelegate

public void setDelegate(TypeMapping delegate)
setDelegate sets the new Delegate TypeMapping
Specified by:
setDelegate in interface TypeMapping

getDelegate

public TypeMapping getDelegate()
getDelegate gets the new Delegate TypeMapping
Specified by:
getDelegate in interface TypeMapping

getSupportedNamespaces

public java.lang.String[] getSupportedNamespaces()
Gets the list of encoding styles supported by this TypeMapping object.
Specified by:
getSupportedNamespaces in interface TypeMapping
Returns:
String[] of namespace URIs for the supported encoding styles and XML schema namespaces.

setSupportedNamespaces

public void setSupportedNamespaces(java.lang.String[] namespaceURIs)
Sets the list of encoding styles supported by this TypeMapping object. (Not sure why this is useful...this information is automatically updated during registration.
Specified by:
setSupportedNamespaces in interface TypeMapping
Parameters:
namespaceURIs - String[] of namespace URI's

isRegistered

public boolean isRegistered(java.lang.Class javaType,
                            QName xmlType)
isRegistered returns true if the [javaType, xmlType] pair is registered.
Specified by:
isRegistered in interface TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type

register

public void register(java.lang.Class javaType,
                     QName xmlType,
                     SerializerFactory sf,
                     DeserializerFactory dsf)
              throws JAXRPCException
Registers SerializerFactory and DeserializerFactory for a specific type mapping between an XML type and Java type.
Specified by:
register in interface TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type
sf - - SerializerFactory
dsf - - DeserializerFactory
Throws:
JAXRPCException - - If any error during the registration

getSerializer

public SerializerFactory getSerializer(java.lang.Class javaType,
                                       QName xmlType)
                                throws JAXRPCException
Gets the SerializerFactory registered for the specified pair of Java type and XML data type.
Specified by:
getSerializer in interface TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type
Returns:
Registered SerializerFactory
Throws:
JAXRPCException - - If there is no registered SerializerFactory for this pair of Java type and XML data type java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified

getSerializer

public SerializerFactory getSerializer(java.lang.Class javaType)
                                throws JAXRPCException
Description copied from interface: TypeMapping
Gets the SerializerFactory registered for the specified pair of Java type and XML data type.
Specified by:
getSerializer in interface TypeMapping
Following copied from interface: org.apache.axis.encoding.TypeMapping
Parameters:
javaType - - Class of the Java type
Returns:
Registered SerializerFactory
Throws:
JAXRPCException - - If there is no registered SerializerFactory for this pair of Java type and XML data type java.lang.IllegalArgumentException If invalid or unsupported XML/Java type is specified

getDeserializer

public DeserializerFactory getDeserializer(java.lang.Class javaType,
                                           QName xmlType)
                                    throws JAXRPCException
Gets the DeserializerFactory registered for the specified pair of Java type and XML data type.
Specified by:
getDeserializer in interface TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type
Returns:
Registered DeserializerFactory
Throws:
JAXRPCException - - If there is no registered DeserializerFactory for this pair of Java type and XML data type java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified

getDeserializer

public DeserializerFactory getDeserializer(QName xmlType)
                                    throws JAXRPCException
Description copied from interface: TypeMapping
Gets the DeserializerFactory registered for the specified pair of Java type and XML data type.
Specified by:
getDeserializer in interface TypeMapping
Following copied from interface: org.apache.axis.encoding.TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type
Returns:
Registered DeserializerFactory
Throws:
JAXRPCException - - If there is no registered DeserializerFactory for this pair of Java type and XML data type java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified

removeSerializer

public void removeSerializer(java.lang.Class javaType,
                             QName xmlType)
                      throws JAXRPCException
Removes the SerializerFactory registered for the specified pair of Java type and XML data type.
Specified by:
removeSerializer in interface TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type
Throws:
JAXRPCException - - If there is error in removing the registered SerializerFactory java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified

removeDeserializer

public void removeDeserializer(java.lang.Class javaType,
                               QName xmlType)
                        throws JAXRPCException
Removes the DeserializerFactory registered for the specified pair of Java type and XML data type.
Specified by:
removeDeserializer in interface TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type
Throws:
JAXRPCException - - If there is error in removing the registered DeserializerFactory java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified

getTypeQName

public QName getTypeQName(java.lang.Class javaType)
Gets the QName for the type mapped to Class.
Specified by:
getTypeQName in interface TypeMapping
Parameters:
javaType - class or type
Returns:
xmlType qname or null

getClassForQName

public java.lang.Class getClassForQName(QName xmlType)
Gets the Class mapped to QName.
Specified by:
getClassForQName in interface TypeMapping
Parameters:
xmlType - qname or null
Returns:
javaType class or type


Copyright © 2001 Apache XML Project. All Rights Reserved.