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

Quick Search    Search Deep

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

java.lang.Object
  extended byorg.apache.axis.encoding.TypeMappingRegistryImpl
All Implemented Interfaces:
java.io.Serializable, javax.xml.rpc.encoding.TypeMappingRegistry, TypeMappingRegistry

public class TypeMappingRegistryImpl
extends java.lang.Object
implements TypeMappingRegistry

The TypeMappingRegistry keeps track of the individual TypeMappings.

The TypeMappingRegistry for axis contains a default type mapping that is set for either SOAP 1.1 or SOAP 1.2 The default type mapping is a singleton used for the entire runtime and should not have anything new registered in it.

Instead the new TypeMappings for the deploy and service are made in a separate TypeMapping which is identified by the soap encoding. These new TypeMappings delegate back to the default type mapping when information is not found.

So logically we have:

         TMR
         | |  
         | +---------------> DefaultTM 
         |                      ^
         |                      |
         +----> TM --delegate---+
 
But in the implementation, the TMR references "delegate" TypeMappings (TM') which then reference the actual TM's

So the picture is really:

         TMR
         | |  
         | +-----------TM'------> DefaultTM 
         |              ^
         |              |
         +-TM'-> TM ----+
 
This extra indirection is necessary because the user may want to change the default type mapping. In such cases, the TMR just needs to adjust the TM' for the DefaultTM, and all of the other TMs will properly delegate to the new one. Here's the picture:
         TMR
         | |  
         | +-----------TM'--+     DefaultTM 
         |              ^   |
         |              |   +---> New User Defined Default TM
         +-TM'-> TM ----+
 
The other reason that it is necessary is when a deploy has a TMR, and then TMR's are defined for the individual services in such cases the delegate() method is invoked on the service to delegate to the deploy TMR
       Deploy TMR
         | |  
         | +-----------TM'------> DefaultTM 
         |              ^
         |              |
         +-TM'-> TM ----+

       Service TMR
         | |  
         | +-----------TM'------> DefaultTM 
         |              ^
         |              |
         +-TM'-> TM ----+

    ServiceTMR.delegate(DeployTMR)

       Deploy TMR
         | |  
         | +------------TM'------> DefaultTM 
         |              ^ ^ 
         |              | |
         +-TM'-> TM ----+ |
           ^              |
   +-------+              |
   |                      |
   |   Service TMR        |
   |     | |              |
   |     | +----------TM'-+               
   |     |              
   |     |              
   |     +-TM'-> TM +
   |                |
   +----------------+
 
So now the service uses the DefaultTM of the Deploy TMR, and the Service TM properly delegates to the deploy's TM. And if either the deploy defaultTM or TMs change, the links are not broken.


Field Summary
private  TypeMappingDelegate defaultDelTM
           
private  boolean isDelegated
           
private  java.util.HashMap mapTM
           
 
Constructor Summary
TypeMappingRegistryImpl()
          Construct TypeMappingRegistry
TypeMappingRegistryImpl(boolean registerDefaults)
           
TypeMappingRegistryImpl(TypeMappingImpl tm)
          Construct TypeMappingRegistry
 
Method Summary
 void clear()
          Removes all TypeMappings and namespaceURIs from this TypeMappingRegistry.
 javax.xml.rpc.encoding.TypeMapping createTypeMapping()
          Creates a new empty TypeMapping object for the specified encoding style or XML schema namespace.
 void delegate(TypeMappingRegistry secondaryTMR)
          delegate Changes the contained type mappings to delegate to their corresponding types in the secondary TMR.
 void doRegisterFromVersion(java.lang.String version)
          Set up the default type mapping (and the SOAP encoding type mappings) as per the passed "version" option.
 javax.xml.rpc.encoding.TypeMapping getDefaultTypeMapping()
          Return the default TypeMapping
 TypeMapping getOrMakeTypeMapping(java.lang.String encodingStyle)
          Obtain a type mapping for the given encodingStyle.
 java.lang.String[] getRegisteredEncodingStyleURIs()
          Gets a list of namespace URIs registered with this TypeMappingRegistry.
 javax.xml.rpc.encoding.TypeMapping getTypeMapping(java.lang.String namespaceURI)
          Gets the TypeMapping for the namespace.
 javax.xml.rpc.encoding.TypeMapping register(java.lang.String namespaceURI, javax.xml.rpc.encoding.TypeMapping mapping)
          The method register adds a TypeMapping instance for a specific namespace
 void registerDefault(javax.xml.rpc.encoding.TypeMapping mapping)
          The method register adds a default TypeMapping instance.
private  void registerSOAPENCDefault(TypeMappingDelegate mapping)
          Force registration of the given mapping as the SOAPENC default mapping
 boolean removeTypeMapping(javax.xml.rpc.encoding.TypeMapping mapping)
          Removes the TypeMapping for the namespace.
 javax.xml.rpc.encoding.TypeMapping unregisterTypeMapping(java.lang.String namespaceURI)
          Unregisters the TypeMapping for the namespace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapTM

private java.util.HashMap mapTM

defaultDelTM

private TypeMappingDelegate defaultDelTM

isDelegated

private boolean isDelegated
Constructor Detail

TypeMappingRegistryImpl

public TypeMappingRegistryImpl(TypeMappingImpl tm)
Construct TypeMappingRegistry


TypeMappingRegistryImpl

public TypeMappingRegistryImpl()
Construct TypeMappingRegistry


TypeMappingRegistryImpl

public TypeMappingRegistryImpl(boolean registerDefaults)
Method Detail

delegate

public void delegate(TypeMappingRegistry secondaryTMR)
delegate Changes the contained type mappings to delegate to their corresponding types in the secondary TMR.

Specified by:
delegate in interface TypeMappingRegistry

register

public javax.xml.rpc.encoding.TypeMapping register(java.lang.String namespaceURI,
                                                   javax.xml.rpc.encoding.TypeMapping mapping)
The method register adds a TypeMapping instance for a specific namespace

Specified by:
register in interface javax.xml.rpc.encoding.TypeMappingRegistry

registerDefault

public void registerDefault(javax.xml.rpc.encoding.TypeMapping mapping)
The method register adds a default TypeMapping instance. If a specific TypeMapping is not found, the default TypeMapping is used.

Specified by:
registerDefault in interface javax.xml.rpc.encoding.TypeMappingRegistry

doRegisterFromVersion

public void doRegisterFromVersion(java.lang.String version)
Set up the default type mapping (and the SOAP encoding type mappings) as per the passed "version" option.


registerSOAPENCDefault

private void registerSOAPENCDefault(TypeMappingDelegate mapping)
Force registration of the given mapping as the SOAPENC default mapping


getTypeMapping

public javax.xml.rpc.encoding.TypeMapping getTypeMapping(java.lang.String namespaceURI)
Gets the TypeMapping for the namespace. If not found, the default TypeMapping is returned.

Specified by:
getTypeMapping in interface javax.xml.rpc.encoding.TypeMappingRegistry

getOrMakeTypeMapping

public TypeMapping getOrMakeTypeMapping(java.lang.String encodingStyle)
Obtain a type mapping for the given encodingStyle. If no specific mapping exists for this encodingStyle, we will create and register one before returning it.

Specified by:
getOrMakeTypeMapping in interface TypeMappingRegistry

unregisterTypeMapping

public javax.xml.rpc.encoding.TypeMapping unregisterTypeMapping(java.lang.String namespaceURI)
Unregisters the TypeMapping for the namespace.

Specified by:
unregisterTypeMapping in interface javax.xml.rpc.encoding.TypeMappingRegistry

removeTypeMapping

public boolean removeTypeMapping(javax.xml.rpc.encoding.TypeMapping mapping)
Removes the TypeMapping for the namespace.

Specified by:
removeTypeMapping in interface javax.xml.rpc.encoding.TypeMappingRegistry

createTypeMapping

public javax.xml.rpc.encoding.TypeMapping createTypeMapping()
Creates a new empty TypeMapping object for the specified encoding style or XML schema namespace.

Specified by:
createTypeMapping in interface javax.xml.rpc.encoding.TypeMappingRegistry

getRegisteredEncodingStyleURIs

public java.lang.String[] getRegisteredEncodingStyleURIs()
Gets a list of namespace URIs registered with this TypeMappingRegistry.

Specified by:
getRegisteredEncodingStyleURIs in interface javax.xml.rpc.encoding.TypeMappingRegistry

clear

public void clear()
Removes all TypeMappings and namespaceURIs from this TypeMappingRegistry.

Specified by:
clear in interface javax.xml.rpc.encoding.TypeMappingRegistry

getDefaultTypeMapping

public javax.xml.rpc.encoding.TypeMapping getDefaultTypeMapping()
Return the default TypeMapping

Specified by:
getDefaultTypeMapping in interface javax.xml.rpc.encoding.TypeMappingRegistry