org.inria.ns.reflex.xml
Class DelegateResolver

java.lang.Object
  extended by org.inria.ns.reflex.xml.DelegateResolver
All Implemented Interfaces:
Unwrappable, EntityResolver

public class DelegateResolver
extends Object
implements EntityResolver, Unwrappable

Delegate the resolution of entities.

This class doesn't perform the delegation directly when an entity has to be resolved : it rather supplies an input source that will delegate its methods to the underlying resolver.

It supplies itself the right resource when the delegation fails, for example when the underlying system doesn't support a specific URI scheme that is supported in RefleX. This is achieved in last resort because this behaviour must not bypass the wrapped resolver if it can supply itself the resource.

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.structures.Unwrappable
Unwrappable.Unwrapper
 
Field Summary
 
Fields inherited from interface org.inria.ns.reflex.structures.Unwrappable
UNWRAPPER
 
Constructor Summary
DelegateResolver(EntityResolver resolver)
          Create a new delegator.
 
Method Summary
 InputSource resolveEntity(String publicId, String systemId)
          Supply an input source that delegates its methods to the wrapped entity resolver.
 Object unwrap()
          Return the wrapped resolver.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegateResolver

public DelegateResolver(EntityResolver resolver)
Create a new delegator.

Parameters:
resolver - The resolver to delegate, can be null.
Method Detail

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws SAXException,
                                 IOException
Supply an input source that delegates its methods to the wrapped entity resolver. If it fails, return directly the resource from the system ID.

Specified by:
resolveEntity in interface EntityResolver
Parameters:
publicId - The public identifier.
systemId - The system identifier.
Throws:
SAXException
IOException
See Also:
EntityResolver.resolveEntity(java.lang.String, java.lang.String)

unwrap

public Object unwrap()
Return the wrapped resolver.

Specified by:
unwrap in interface Unwrappable
Returns:
The resolver, maybe null.
See Also:
Unwrappable.unwrap(), EntityResolver