public interface TypeMappingRegistry extends java.io.Serializable {
// Public Instance Methods
public abstract void clear( );
public abstract TypeMapping createTypeMapping( );
public abstract TypeMapping getDefaultTypeMapping( );
public abstract String[ ] getRegisteredEncodingStyleURIs( );
public abstract TypeMapping getTypeMapping(String encodingStyleURI);
public abstract TypeMapping register(String encodingStyleURI,
TypeMapping mapping);
public abstract void registerDefault(TypeMapping mapping);
public abstract boolean removeTypeMapping(TypeMapping mapping);
public abstract TypeMapping unregisterTypeMapping(String encodingStyleURI);
}
As its name suggests, the TypeMappingRegistry
interface represents a registry for TypeMapping
objects. On the client side, a TypeMappingRegistry
is associated with a Service object, and a
reference to the single instance for that Service
can be obtained by calling its getTypeMappingRegistry(
) method. On the server side, each service implementation
has its own TypeMappingRegistry that is created by
the code for the tie classes that is generated by utilities such as
wsdeploy or j2eec, which are
described in Chapter 8.
A TypeMappingRegistry maintains a set of mappings
from URIs that represent encoding styles to the
TypeMapping objects that know how to encode and
decode Java types using the rules of that encoding. A typical example
of an encoding style URI is
http://schemas.xmlsoap.org/soap/encoding/, which
represents the SOAP section 5 encoding rules. A
TypeMapping can be registered by calling the
register( ) method, which supplies the encoding
style URI that the TypeMapping handles. Stubs,
ties, dynamic proxies, and Call objects created by
the JAX-RPC reference implementation all have a registry that is
initialized with a TypeMapping that can handle the
SOAP section 5 encoding rules, and another that handles encoding for
document-style operations, which maps the URI equal to the empty
string. To get a type mapping for a given encoding style, use the
getTypeMapping( ) method, passing the appropriate
URI. If no mapping is registered for the given URI,
null is returned, unless a default mapping has
been installed using the registerDefault( )
method. To determine which encoding styles have configured mappings,
use the getRegisteredEncodingStyleURIs( ) method.
To create a TypeMapping, use the
createTypeMapping( ) method, and then use the
methods of the TypeMapping interface to configure
it. The objects returned by this method must subsequently be
registered using the register( ) method before
they can be used. A mapping can be removed by using the
remoteTypeMapping( ) method, which requires a
reference to the TypeMapping object. It returns
false if the mapping was not present in the registry. Since a single
TypeMapping can be registered more than once if it
supports more than one encoding style, this method may remove the
type mapping capability for more than one encoding style. To remove
the association between a TypeMapping and a single
encoding-style URI, use the unregisterTypeMapping(
) method, which affects only the encoding style whose URI
is supplied as its argument. The clear( ) method
removes all useful content in the registry.