org.apache.ws.commons.schema.resolver
Class DefaultURIResolver

java.lang.Object
  extended by org.apache.ws.commons.schema.resolver.DefaultURIResolver
All Implemented Interfaces:
CollectionURIResolver, URIResolver

public class DefaultURIResolver
extends Object
implements CollectionURIResolver

This resolver provides the means of resolving the imports and includes of a given schema document. The system will call this default resolver if there is no other resolver present in the system.


Constructor Summary
DefaultURIResolver()
           
 
Method Summary
 String getCollectionBaseURI()
          Get the base URI derived from a schema collection.
protected  URL getFileURL(URL contextURL, String path)
          Method getFileURL
protected  URL getURL(URL contextURL, String spec)
          This is essentially a call to "new URL(contextURL, spec)" with extra handling in case spec is a file.
protected  boolean isAbsolute(String uri)
          Find whether a given uri is relative or not
 org.xml.sax.InputSource resolveEntity(String namespace, String schemaLocation, String baseUri)
          Try to resolve a schema location to some data.
 void setCollectionBaseURI(String collectionBaseURI)
          set the collection base URI, which serves as a fallback from the base of the immediate schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultURIResolver

public DefaultURIResolver()
Method Detail

resolveEntity

public org.xml.sax.InputSource resolveEntity(String namespace,
                                             String schemaLocation,
                                             String baseUri)
Try to resolve a schema location to some data.

Specified by:
resolveEntity in interface URIResolver
Parameters:
namespace - targt namespace.
schemaLocation - system ID.
baseUri - base URI for the schema.

isAbsolute

protected boolean isAbsolute(String uri)
Find whether a given uri is relative or not

Parameters:
uri -
Returns:
boolean

getURL

protected URL getURL(URL contextURL,
                     String spec)
              throws IOException
This is essentially a call to "new URL(contextURL, spec)" with extra handling in case spec is a file.

Parameters:
contextURL -
spec -
Throws:
IOException

getFileURL

protected URL getFileURL(URL contextURL,
                         String path)
                  throws IOException
Method getFileURL

Parameters:
contextURL -
path -
Throws:
IOException

getCollectionBaseURI

public String getCollectionBaseURI()
Get the base URI derived from a schema collection. It serves as a fallback from the specified base.

Specified by:
getCollectionBaseURI in interface CollectionURIResolver
Returns:
URI

setCollectionBaseURI

public void setCollectionBaseURI(String collectionBaseURI)
set the collection base URI, which serves as a fallback from the base of the immediate schema.

Specified by:
setCollectionBaseURI in interface CollectionURIResolver
Parameters:
collectionBaseURI - the URI.


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.