站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 jaxrpc API Documentation 英文版文档

TypeMappingImpl (JAXRPC API) - JBoss 3.2.7 jaxrpc API Documentation 英文版文档


org.apache.axis.encoding
Class TypeMappingImpl

java.lang.Object
  extended byorg.apache.axis.encoding.TypeMappingImpl
All Implemented Interfaces:
javax.xml.rpc.encoding.TypeMapping, TypeMapping
Direct Known Subclasses:
DefaultTypeMappingImpl

public class TypeMappingImpl
extends Object
implements TypeMapping

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

Author:
Rich Scheuerle (scheu@us.ibm.com)

Nested Class Summary
 class TypeMappingImpl.Pair
           
 
Field Summary
protected  TypeMapping delegate
           
 
Constructor Summary
TypeMappingImpl(TypeMapping delegate)
          Construct TypeMapping
 
Method Summary
 Class[] getAllClasses()
          Returns an array of all the classes contained within this mapping
 Class getClassForQName(javax.xml.namespace.QName xmlType)
          Gets the Class mapped to QName.
 TypeMapping getDelegate()
          getDelegate gets the new Delegate TypeMapping
 javax.xml.rpc.encoding.DeserializerFactory getDeserializer(Class javaType, javax.xml.namespace.QName xmlType)
          Gets the DeserializerFactory registered for the specified pair of Java type and XML data type.
 javax.xml.rpc.encoding.DeserializerFactory getDeserializer(javax.xml.namespace.QName xmlType)
          Gets the DeserializerFactory registered for the xmlType.
 javax.xml.rpc.encoding.SerializerFactory getSerializer(Class javaType)
          Gets the SerializerFactory registered for the Java type.
 javax.xml.rpc.encoding.SerializerFactory getSerializer(Class javaType, javax.xml.namespace.QName xmlType)
          Gets the SerializerFactory registered for the specified pair of Java type and XML data type.
 String[] getSupportedEncodings()
          Gets the list of encoding styles supported by this TypeMapping object.
 javax.xml.namespace.QName getTypeQName(Class javaType)
          Gets the QName for the type mapped to Class.
 javax.xml.namespace.QName getTypeQNameRecursive(Class javaType)
          Gets the QName for the type mapped to Class.
 javax.xml.namespace.QName getXMLType(Class javaType, javax.xml.namespace.QName xmlType)
          Get the exact XML type QName which will be used when serializing a given Class to a given type QName.
protected  void internalRegister(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.
 boolean isRegistered(Class javaType, javax.xml.namespace.QName xmlType)
          isRegistered returns true if the [javaType, xmlType] pair is registered.
 void register(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(Class javaType, javax.xml.namespace.QName xmlType)
          Removes the DeserializerFactory registered for the specified pair of Java type and XML data type.
 void removeSerializer(Class javaType, javax.xml.namespace.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 setDoAutoTypes(boolean doAutoTypes)
           
 void setSupportedEncodings(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

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

getSupportedEncodings

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

Specified by:
getSupportedEncodings in interface javax.xml.rpc.encoding.TypeMapping
Returns:
String[] of namespace URIs for the supported encoding styles and XML schema namespaces.

setSupportedEncodings

public void setSupportedEncodings(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:
setSupportedEncodings in interface javax.xml.rpc.encoding.TypeMapping
Parameters:
namespaceURIs - String[] of namespace URI's

isRegistered

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

Specified by:
isRegistered in interface javax.xml.rpc.encoding.TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type
Returns:
true if there is a mapping for the given pair, or false if the pair is not specifically registered.

For example if called with (java.lang.String[], soapenc:Array) this routine will return false because this pair is probably not specifically registered. However if getSerializer is called with the same pair, the default TypeMapping will use extra logic to find a serializer (i.e. array serializer)


register

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

Specified by:
register in interface javax.xml.rpc.encoding.TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type
sf - - SerializerFactory
dsf - - DeserializerFactory
Throws:
javax.xml.rpc.JAXRPCException - - If any error during the registration

internalRegister

protected void internalRegister(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.

Parameters:
javaType -
xmlType -
sf -
dsf -
Throws:
javax.xml.rpc.JAXRPCException

getSerializer

public javax.xml.rpc.encoding.SerializerFactory getSerializer(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.

Specified by:
getSerializer in interface javax.xml.rpc.encoding.TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type
Returns:
Registered SerializerFactory
Throws:
javax.xml.rpc.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

getXMLType

public javax.xml.namespace.QName getXMLType(Class javaType,
                                            javax.xml.namespace.QName xmlType)
                                     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.

Parameters:
javaType -
xmlType -
Returns:
the type's QName
Throws:
javax.xml.rpc.JAXRPCException

getDeserializer

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

Specified by:
getDeserializer in interface javax.xml.rpc.encoding.TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type
Returns:
Registered DeserializerFactory
Throws:
javax.xml.rpc.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(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.

Specified by:
removeSerializer in interface javax.xml.rpc.encoding.TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type
Throws:
javax.xml.rpc.JAXRPCException - - If there is error in removing the registered SerializerFactory

removeDeserializer

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

Specified by:
removeDeserializer in interface javax.xml.rpc.encoding.TypeMapping
Parameters:
javaType - - Class of the Java type
xmlType - - Qualified name of the XML data type
Throws:
javax.xml.rpc.JAXRPCException - - If there is error in removing the registered DeserializerFactory

getTypeQNameRecursive

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

Parameters:
javaType - class or type
Returns:
xmlType qname or null

getTypeQName

public javax.xml.namespace.QName getTypeQName(Class javaType)
Description copied from interface: TypeMapping
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 Class getClassForQName(javax.xml.namespace.QName xmlType)
Gets the Class mapped to QName.

Specified by:
getClassForQName in interface TypeMapping
Parameters:
xmlType - qname or null
Returns:
javaType class or type

getSerializer

public javax.xml.rpc.encoding.SerializerFactory getSerializer(Class javaType)
                                                       throws javax.xml.rpc.JAXRPCException
Gets the SerializerFactory registered for the Java type.

Specified by:
getSerializer in interface TypeMapping
Parameters:
javaType - - Class of the Java type
Returns:
Registered SerializerFactory
Throws:
javax.xml.rpc.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 javax.xml.rpc.encoding.DeserializerFactory getDeserializer(javax.xml.namespace.QName xmlType)
                                                           throws javax.xml.rpc.JAXRPCException
Gets the DeserializerFactory registered for the xmlType.

Specified by:
getDeserializer in interface TypeMapping
Parameters:
xmlType - - Qualified name of the XML data type
Returns:
Registered DeserializerFactory
Throws:
javax.xml.rpc.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

setDoAutoTypes

public void setDoAutoTypes(boolean doAutoTypes)

getAllClasses

public Class[] getAllClasses()
Returns an array of all the classes contained within this mapping

Specified by:
getAllClasses in interface TypeMapping


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.