Apache CXF API

org.apache.cxf.aegis.type.encoded
Class SoapRefRegistry

java.lang.Object
  extended by org.apache.cxf.aegis.type.encoded.SoapRefRegistry

public class SoapRefRegistry
extends Object

SoapRefRegistry handles resolving all SOAP encoded references. After each object is unmarshalled if the xml contained a SOAP id attribute it is registered with that attribute. As each object is unmarshalled if any nested elements have a SOAP ref attribute it, the references is registered. If there is a object instance already registered with the referenced id, the SOAP reference is immediately set. Otherwise, the reference is set when an object instance is registered with the id. This allows for the objects to occur in any order in the XML document.

Note: only the StructType and TraillingBlocks register objects with this class.


Constructor Summary
SoapRefRegistry()
           
 
Method Summary
 void addInstance(String id, Object instance)
          Add an object instance to the registry.
 void addRef(String id, SoapRef soapRef)
          Adds a reference to the specified id.
static SoapRefRegistry get(Context context)
          Get the SoapRefRegistry stored in the context, and if necessary create a new one.
 Set<String> getIds()
          Gets the ids of the registered object instances.
 SortedMap<String,List<SoapRef>> getUnresolvedRefs()
          Gets the unresolved SOAP references by referenced id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoapRefRegistry

public SoapRefRegistry()
Method Detail

get

public static SoapRefRegistry get(Context context)
Get the SoapRefRegistry stored in the context, and if necessary create a new one.

Parameters:
context - the unmarshal context
Returns:
the SoapRefRegistry; never null

addInstance

public void addInstance(String id,
                        Object instance)
Add an object instance to the registry.

Parameters:
id - the unique identifier of the instance
instance - the instance
Throws:
DatabindingException - if another object instance is already registered with the id

addRef

public void addRef(String id,
                   SoapRef soapRef)
Adds a reference to the specified id. If an object is already registered with the specified id, the SOAP reference will immedately be set. Otherwise, the reference will be set when an object is registered with the specified id.

Parameters:
id - the id of the referenced object instance
soapRef - the reference to set

getIds

public Set<String> getIds()
Gets the ids of the registered object instances.

Returns:
the ids of the registered object instances

getUnresolvedRefs

public SortedMap<String,List<SoapRef>> getUnresolvedRefs()
Gets the unresolved SOAP references by referenced id.

Returns:
the unresolved SOAP references by referenced id

Apache CXF API

Apache CXF