Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.axis.encoding
Class TypeMappingImpl  view TypeMappingImpl download TypeMappingImpl.java

java.lang.Object
  extended byorg.apache.axis.encoding.TypeMappingImpl
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DefaultTypeMappingImpl

public class TypeMappingImpl
extends java.lang.Object
implements java.io.Serializable

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


Nested Class Summary
static class TypeMappingImpl.Pair
           
 
Field Summary
private  java.util.HashMap class2Pair
           
protected  java.lang.Boolean doAutoTypes
           
static boolean dotnet_soapenc_bugfix
          Work around a .NET bug with soap encoded types.
protected static org.apache.commons.logging.Log log
           
private  java.util.ArrayList namespaces
           
private  java.util.HashMap pair2DF
           
private  java.util.HashMap pair2SF
           
private  java.util.HashMap qName2Pair
           
 
Constructor Summary
TypeMappingImpl()
          Construct TypeMapping
 
Method Summary
 DeserializerFactory finalGetDeserializer(java.lang.Class javaType, javax.xml.namespace.QName xmlType, TypeMappingDelegate start)
           
 SerializerFactory finalGetSerializer(java.lang.Class javaType)
           
 java.lang.Class[] getAllClasses(TypeMappingDelegate next)
          Returns an array of all the classes contained within this mapping
 java.lang.Class getClassForQName(javax.xml.namespace.QName xmlType, java.lang.Class javaType, TypeMappingDelegate next)
           
 javax.xml.rpc.encoding.DeserializerFactory getDeserializer(java.lang.Class javaType, javax.xml.namespace.QName xmlType, TypeMappingDelegate start)
          Gets the DeserializerFactory registered for the specified pair of Java type and XML data type.
 javax.xml.rpc.encoding.SerializerFactory getSerializer(java.lang.Class javaType, javax.xml.namespace.QName xmlType)
          Gets the SerializerFactory registered for the specified pair of Java type and XML data type.
 java.lang.String[] getSupportedEncodings()
          Gets the list of encoding styles supported by this TypeMapping object.
 javax.xml.namespace.QName getTypeQName(java.lang.Class javaType, TypeMappingDelegate next)
           
 javax.xml.namespace.QName getTypeQNameExact(java.lang.Class javaType, TypeMappingDelegate next)
          Get the QName for this Java class, but only return a specific mapping if there is one.
 javax.xml.namespace.QName getTypeQNameRecursive(java.lang.Class javaType)
          Gets the QName for the type mapped to Class.
 javax.xml.namespace.QName getXMLType(java.lang.Class javaType, javax.xml.namespace.QName xmlType, boolean encoded)
          Get the exact XML type QName which will be used when serializing a given Class to a given type QName.
protected  void internalRegister(java.lang.Class javaType, javax.xml.namespace.QName xmlType, javax.xml.rpc.encoding.SerializerFactory sf, javax.xml.rpc.encoding.DeserializerFactory dsf)
          Internal version of register(), which allows null factories.
private static boolean isArray(java.lang.Class clazz)
           
private  boolean isDotNetSoapEncFixNeeded()
          isDotNetSoapEncFixNeeded - Do we need to compensate for the dotnet bug.
 boolean isRegistered(java.lang.Class javaType, javax.xml.namespace.QName xmlType)
          isRegistered returns true if the [javaType, xmlType] pair is registered.
 void register(java.lang.Class javaType, javax.xml.namespace.QName xmlType, javax.xml.rpc.encoding.SerializerFactory sf, javax.xml.rpc.encoding.DeserializerFactory dsf)
          Registers SerializerFactory and DeserializerFactory for a specific type mapping between an XML type and Java type.
 void removeDeserializer(java.lang.Class javaType, javax.xml.namespace.QName xmlType)
          Removes the DeserializerFactory registered for the specified pair of Java type and XML data type.
 void removeSerializer(java.lang.Class javaType, javax.xml.namespace.QName xmlType)
          Removes the SerializerFactory registered for the specified pair of Java type and XML data type.
 void setDoAutoTypes(boolean doAutoTypes)
           
 void setSupportedEncodings(java.lang.String[] namespaceURIs)
          Sets the list of encoding styles supported by this TypeMapping object.
 boolean shouldDoAutoTypes()
           
 
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

dotnet_soapenc_bugfix

public static boolean dotnet_soapenc_bugfix
Work around a .NET bug with soap encoded types. This is a static property of the type mapping that will cause the class to ignore SOAPENC types when looking up QNames of java types. See getTypeQNameExact().


qName2Pair

private java.util.HashMap qName2Pair

class2Pair

private java.util.HashMap class2Pair

pair2SF

private java.util.HashMap pair2SF

pair2DF

private java.util.HashMap pair2DF

namespaces

private java.util.ArrayList namespaces

doAutoTypes

protected java.lang.Boolean doAutoTypes
Constructor Detail

TypeMappingImpl

public TypeMappingImpl()
Construct TypeMapping

Method Detail

isArray

private static boolean isArray(java.lang.Class clazz)

getSupportedEncodings

public java.lang.String[] getSupportedEncodings()
Gets the list of encoding styles supported by this TypeMapping object.


setSupportedEncodings

public void setSupportedEncodings(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.


isRegistered

public boolean isRegistered(java.lang.Class javaType,
                            javax.xml.namespace.QName xmlType)
isRegistered returns true if the [javaType, xmlType] pair is registered.


register

public void register(java.lang.Class javaType,
                     javax.xml.namespace.QName xmlType,
                     javax.xml.rpc.encoding.SerializerFactory sf,
                     javax.xml.rpc.encoding.DeserializerFactory dsf)
              throws javax.xml.rpc.JAXRPCException
Registers SerializerFactory and DeserializerFactory for a specific type mapping between an XML type and Java type.


internalRegister

protected void internalRegister(java.lang.Class javaType,
                                javax.xml.namespace.QName xmlType,
                                javax.xml.rpc.encoding.SerializerFactory sf,
                                javax.xml.rpc.encoding.DeserializerFactory dsf)
                         throws javax.xml.rpc.JAXRPCException
Internal version of register(), which allows null factories.


getSerializer

public javax.xml.rpc.encoding.SerializerFactory getSerializer(java.lang.Class javaType,
                                                              javax.xml.namespace.QName xmlType)
                                                       throws javax.xml.rpc.JAXRPCException
Gets the SerializerFactory registered for the specified pair of Java type and XML data type.


finalGetSerializer

public SerializerFactory finalGetSerializer(java.lang.Class javaType)

getXMLType

public javax.xml.namespace.QName getXMLType(java.lang.Class javaType,
                                            javax.xml.namespace.QName xmlType,
                                            boolean encoded)
                                     throws javax.xml.rpc.JAXRPCException
Get the exact XML type QName which will be used when serializing a given Class to a given type QName. In other words, if we have: Class TypeQName ---------------------- Base myNS:Base Child myNS:Child and call getXMLType(Child.class, BASE_QNAME), we should get CHILD_QNAME.


getDeserializer

public javax.xml.rpc.encoding.DeserializerFactory getDeserializer(java.lang.Class javaType,
                                                                  javax.xml.namespace.QName xmlType,
                                                                  TypeMappingDelegate start)
                                                           throws javax.xml.rpc.JAXRPCException
Gets the DeserializerFactory registered for the specified pair of Java type and XML data type.


finalGetDeserializer

public DeserializerFactory finalGetDeserializer(java.lang.Class javaType,
                                                javax.xml.namespace.QName xmlType,
                                                TypeMappingDelegate start)

removeSerializer

public void removeSerializer(java.lang.Class javaType,
                             javax.xml.namespace.QName xmlType)
                      throws javax.xml.rpc.JAXRPCException
Removes the SerializerFactory registered for the specified pair of Java type and XML data type.


removeDeserializer

public void removeDeserializer(java.lang.Class javaType,
                               javax.xml.namespace.QName xmlType)
                        throws javax.xml.rpc.JAXRPCException
Removes the DeserializerFactory registered for the specified pair of Java type and XML data type.


getTypeQNameRecursive

public javax.xml.namespace.QName getTypeQNameRecursive(java.lang.Class javaType)
Gets the QName for the type mapped to Class.


getTypeQNameExact

public javax.xml.namespace.QName getTypeQNameExact(java.lang.Class javaType,
                                                   TypeMappingDelegate next)
Get the QName for this Java class, but only return a specific mapping if there is one. In other words, don't do special array processing, etc.


isDotNetSoapEncFixNeeded

private boolean isDotNetSoapEncFixNeeded()
isDotNetSoapEncFixNeeded - Do we need to compensate for the dotnet bug. check the service specific flag before using the global flag


getTypeQName

public javax.xml.namespace.QName getTypeQName(java.lang.Class javaType,
                                              TypeMappingDelegate next)

getClassForQName

public java.lang.Class getClassForQName(javax.xml.namespace.QName xmlType,
                                        java.lang.Class javaType,
                                        TypeMappingDelegate next)

setDoAutoTypes

public void setDoAutoTypes(boolean doAutoTypes)

shouldDoAutoTypes

public boolean shouldDoAutoTypes()

getAllClasses

public java.lang.Class[] getAllClasses(TypeMappingDelegate next)
Returns an array of all the classes contained within this mapping