|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Implementation of this interface can be passed to XMI reader/consumer
(using XMIInputConfig.setReferenceResolver(org.netbeans.api.xmi.XMIReferenceResolver)
method) to enable custom resolving of hrefs.
If an XMIReferenceResolver is registered for an XMI consumer, the XMI consumer will call
register(java.lang.String, java.lang.String, javax.jmi.reflect.RefObject)
for each object that it successfuly deserialized from the XMI file.
At the end of the document the XMI consumer will call resolve(org.netbeans.api.xmi.XMIReferenceResolver.Client, javax.jmi.reflect.RefPackage, java.lang.String, org.netbeans.api.xmi.XMIInputConfig, java.util.Collection)
passing all the
hrefs found in the document and an object that implements XMIReferenceResolver.Client
to receive callbacks.
Implementation of XMIReferenceResolver should try to
resolve these hrefs and make callbacks to the passed client (by calling
XMIReferenceResolver.Client.resolvedReference(java.lang.String, javax.jmi.reflect.RefObject)
) for each resolved href.
Note, that in some obscure cases, the XMI consumer may call register(java.lang.String, java.lang.String, javax.jmi.reflect.RefObject)
method
even during the execution of XMIReferenceResolver.Client.resolvedReference(java.lang.String, javax.jmi.reflect.RefObject)
method
in case when XMI consumer had to postpone creation of some object because of unresolved
reference to an object within an attribute (i.e. if an unresolved object was part of
an attribute value).
IMPORTANT: During the whole XMI reading, the XMI consumer should
hold a lock on the used XMIReferenceResolver instance to avoid concurrency problems.
Nested Class Summary | |
static interface |
XMIReferenceResolver.Client
|
Method Summary | |
void |
register(String systemId,
String xmiId,
javax.jmi.reflect.RefObject object)
Registers an object that can be resolved. |
void |
resolve(XMIReferenceResolver.Client client,
javax.jmi.reflect.RefPackage extent,
String systemId,
XMIInputConfig configuration,
Collection hrefs)
Resolves external references and calls XMIReferenceResolver.Client.resolvedReference(java.lang.String, javax.jmi.reflect.RefObject) for each. |
Method Detail |
public void register(String systemId, String xmiId, javax.jmi.reflect.RefObject object)
Implementation of this interface should remember all the registered objects and use them for resolving hrefs.
systemId
- URI of the document that called this method (the URI is essential for
correct resolution of cyclic and relative references).xmiId
- XMI ID of the object deserialized from XMI. If XMI ID for the object
is not available, this method should not be called.object
- Object deserialized from XMI.public void resolve(XMIReferenceResolver.Client client, javax.jmi.reflect.RefPackage extent, String systemId, XMIInputConfig configuration, Collection hrefs) throws javax.jmi.xmi.MalformedXMIException, IOException
XMIReferenceResolver.Client.resolvedReference(java.lang.String, javax.jmi.reflect.RefObject)
for each.
Before returning from this method (only in case of outermost call to it - i.e. this
does not hold for nested recursive calls from XMI consumers created from within this
method) the instance of this class should be restored to its initial state (all
registered references should be forgotten).
client
- Implementation of callback method used for reference resolving notifications.extent
- Target package (for resolved objects).systemId
- URI of the document where href is used. This parameter is provided only
if it is known by XMI consumer, otherwise null
is passed.configuration
- Configuration to be used for XMI consumer used for reading
external XMI document to resolve the href (if needed).hrefs
- References to be resolved.
javax.jmi.xmi.MalformedXMIException
- Thrown
to indicate an error (element cannot be resolved, etc.)
IOException
- I/O error during XMI reading.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |