Methods Summary |
---|
public void | clear()Removes all TypeMappings and namespaceURIs from this TypeMappingRegistry.
mapTM.clear();
|
public javax.xml.rpc.encoding.TypeMapping | createTypeMapping()Creates a new empty TypeMapping object for the specified
encoding style or XML schema namespace.
TypeMappingImpl impl = new TypeMappingImpl();
TypeMappingDelegate del = new TypeMappingDelegate(impl);
del.setNext(defaultDelTM);
return del;
|
public void | delegate(TypeMappingRegistry secondaryTMR)delegate
Changes the contained type mappings to delegate to
their corresponding types in the secondary TMR.
if (isDelegated || secondaryTMR == null || secondaryTMR == this) {
return;
}
isDelegated = true;
String[] keys = secondaryTMR.getRegisteredEncodingStyleURIs();
TypeMappingDelegate otherDefault =
((TypeMappingRegistryImpl)secondaryTMR).defaultDelTM;
if (keys != null) {
for (int i=0; i < keys.length; i++) {
try {
String nsURI = keys[i];
TypeMappingDelegate tm = (TypeMappingDelegate) mapTM.get(nsURI);
if (tm == null) {
tm = (TypeMappingDelegate)createTypeMapping();
tm.setSupportedEncodings(new String[] { nsURI });
register(nsURI, tm);
}
if (tm != null) {
// Get the secondaryTMR's TM'
TypeMappingDelegate del = (TypeMappingDelegate)
((TypeMappingRegistryImpl)secondaryTMR).mapTM.get(nsURI);
while (del.next != null) {
TypeMappingDelegate nu = new TypeMappingDelegate(del.delegate);
tm.setNext(nu);
if (del.next == otherDefault) {
nu.setNext(defaultDelTM);
break;
}
del = del.next;
tm = nu;
}
}
} catch (Exception e) {
}
}
}
// Change our defaultDelTM to delegate to the one in
// the secondaryTMR
if (defaultDelTM.delegate != TypeMappingDelegate.placeholder) {
defaultDelTM.setNext(otherDefault);
} else {
defaultDelTM.delegate = otherDefault.delegate;
}
|
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.
if (version == null || version.equals("1.0") || version.equals("1.2")) {
TypeMappingImpl.dotnet_soapenc_bugfix = false;
// Do nothing, just register SOAPENC mapping
} else if (version.equals("1.1")) {
TypeMappingImpl.dotnet_soapenc_bugfix = true;
// Do nothing, no SOAPENC mapping
return;
} else if (version.equals("1.3")) {
// Reset the default TM to the JAXRPC version, then register SOAPENC
defaultDelTM = new TypeMappingDelegate(
DefaultJAXRPC11TypeMappingImpl.getSingleton());
} else {
throw new RuntimeException(
Messages.getMessage("j2wBadTypeMapping00"));
}
registerSOAPENCDefault(
new TypeMappingDelegate(DefaultSOAPEncodingTypeMappingImpl.
getSingleton()));
|
public javax.xml.rpc.encoding.TypeMapping | getDefaultTypeMapping()Return the default TypeMapping
return defaultDelTM;
|
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.
TypeMappingDelegate del = (TypeMappingDelegate) mapTM.get(encodingStyle);
if (del == null || del.delegate instanceof DefaultTypeMappingImpl) {
del = (TypeMappingDelegate)createTypeMapping();
del.setSupportedEncodings(new String[] {encodingStyle});
register(encodingStyle, del);
}
return del;
|
public java.lang.String[] | getRegisteredEncodingStyleURIs()Gets a list of namespace URIs registered with this TypeMappingRegistry.
java.util.Set s = mapTM.keySet();
if (s != null) {
String[] rc = new String[s.size()];
int i = 0;
java.util.Iterator it = s.iterator();
while(it.hasNext()) {
rc[i++] = (String) it.next();
}
return rc;
}
return null;
|
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.
// namespaceURI = "";
TypeMapping del = (TypeMappingDelegate) mapTM.get(namespaceURI);
if (del == null) {
del = (TypeMapping)getDefaultTypeMapping();
}
return del;
|
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
// namespaceURI = "";
if (mapping == null ||
!(mapping instanceof TypeMappingDelegate)) {
throw new IllegalArgumentException(
Messages.getMessage("badTypeMapping"));
}
if (namespaceURI == null) {
throw new java.lang.IllegalArgumentException(
Messages.getMessage("nullNamespaceURI"));
}
TypeMappingDelegate del = (TypeMappingDelegate)mapping;
TypeMappingDelegate old = (TypeMappingDelegate)mapTM.get(namespaceURI);
if (old == null) {
del.setNext(defaultDelTM);
} else {
del.setNext(old);
}
mapTM.put(namespaceURI, del);
return old; // Needs works
|
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.
if (mapping == null ||
!(mapping instanceof TypeMappingDelegate)) {
throw new IllegalArgumentException(
Messages.getMessage("badTypeMapping"));
}
/* Don't allow this call after the delegate() method since
* the TMR's TypeMappings will be using the default type mapping
* of the secondary TMR.
*/
if (defaultDelTM.getNext() != null) {
throw new IllegalArgumentException(
Messages.getMessage("defaultTypeMappingSet"));
}
defaultDelTM = (TypeMappingDelegate)mapping;
|
private void | registerSOAPENCDefault(TypeMappingDelegate mapping)Force registration of the given mapping as the SOAPENC default mapping
// This get a bit ugly as we do not want to just overwrite
// an existing type mapping for SOAP encodings. This happens
// when {client,server}-config.wsdd defines a type mapping for
// instance.
if (!mapTM.containsKey(Constants.URI_SOAP11_ENC)) {
mapTM.put(Constants.URI_SOAP11_ENC, mapping);
} else {
// We have to make sure the default type mapping is
// at the end of the chain.
// This is important if the default is switched to
// the JAX_RPC 1.1 default type mapping!
TypeMappingDelegate del =
(TypeMappingDelegate) mapTM.get(Constants.URI_SOAP11_ENC);
while (del.getNext() != null && ! (del.delegate instanceof DefaultTypeMappingImpl)) {
del = del.getNext();
}
del.setNext(defaultDelTM);
}
if (!mapTM.containsKey(Constants.URI_SOAP12_ENC)) {
mapTM.put(Constants.URI_SOAP12_ENC, mapping);
} else {
// We have to make sure the default type mapping is
// at the end of the chain.
// This is important if the default is switched to
// the JAX_RPC 1.1 default type mapping!
TypeMappingDelegate del =
(TypeMappingDelegate) mapTM.get(Constants.URI_SOAP12_ENC);
while (del.getNext() != null && ! (del.delegate instanceof DefaultTypeMappingImpl)) {
del = del.getNext();
}
del.setNext(defaultDelTM);
}
// Just do this unconditionally in case we used mapping.
// This is important if the default is switched to
// the JAX_RPC 1.1 default type mapping!
mapping.setNext(defaultDelTM);
|
public boolean | removeTypeMapping(javax.xml.rpc.encoding.TypeMapping mapping)Removes the TypeMapping for the namespace.
String[] ns = getRegisteredEncodingStyleURIs();
boolean rc = false;
for (int i=0; i < ns.length; i++) {
if (getTypeMapping(ns[i]) == mapping) {
rc = true;
unregisterTypeMapping(ns[i]);
}
}
return rc;
|
public javax.xml.rpc.encoding.TypeMapping | unregisterTypeMapping(java.lang.String namespaceURI)Unregisters the TypeMapping for the namespace.
return (TypeMappingDelegate)mapTM.remove(namespaceURI);
|