public class SourceResolverImpl extends org.apache.avalon.framework.logger.AbstractLogEnabled implements org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.activity.Disposable, SourceResolver, org.apache.avalon.framework.thread.ThreadSafe
SourceResolver.
The source resolving is done relative to a base directory/URI (if
the given location is relative). This implementation looks for the
base URI in the Context object of the "container" for the
"context-root" information. This information can either be a
File object or a URL object.
If the entry does not exist, the system property "user.dir" is used
as the base URI instead.SourceResolver| Modifier and Type | Field and Description |
|---|---|
protected java.net.URL |
m_baseURL
The base URL
|
protected org.apache.avalon.framework.service.ServiceSelector |
m_factorySelector
The special Source factories
|
protected org.apache.avalon.framework.service.ServiceManager |
m_manager
The component m_manager
|
METHOD, ROLE, URI_ENCODING, URI_PARAMETERS| Constructor and Description |
|---|
SourceResolverImpl() |
| Modifier and Type | Method and Description |
|---|---|
private java.lang.String |
absolutize(SourceFactory factory,
java.lang.String baseURI,
java.lang.String systemID)
Makes an absolute URI based on a baseURI and a relative URI.
|
void |
contextualize(org.apache.avalon.framework.context.Context context)
Get the context
|
void |
dispose() |
void |
release(Source source)
Releases a resolved resource
|
Source |
resolveURI(java.lang.String location)
Get a
Source object. |
Source |
resolveURI(java.lang.String location,
java.lang.String baseURI,
java.util.Map parameters)
Get a
Source object. |
void |
service(org.apache.avalon.framework.service.ServiceManager manager)
Set the current
ComponentLocator instance used by this
Composable. |
protected org.apache.avalon.framework.service.ServiceManager m_manager
protected org.apache.avalon.framework.service.ServiceSelector m_factorySelector
protected java.net.URL m_baseURL
public void contextualize(org.apache.avalon.framework.context.Context context)
throws org.apache.avalon.framework.context.ContextException
contextualize in interface org.apache.avalon.framework.context.Contextualizableorg.apache.avalon.framework.context.ContextExceptionpublic void service(org.apache.avalon.framework.service.ServiceManager manager)
throws org.apache.avalon.framework.service.ServiceException
ComponentLocator instance used by this
Composable.service in interface org.apache.avalon.framework.service.Serviceableorg.apache.avalon.framework.service.ServiceExceptionpublic void dispose()
dispose in interface org.apache.avalon.framework.activity.Disposablepublic Source resolveURI(java.lang.String location) throws java.net.MalformedURLException, java.io.IOException, SourceException
Source object.resolveURI in interface SourceResolverSourceNotFoundException - if the source cannot be foundjava.net.MalformedURLException - if location is malformed.java.io.IOException - if the source couldn't be created for some other reason.SourceExceptionpublic Source resolveURI(java.lang.String location, java.lang.String baseURI, java.util.Map parameters) throws java.net.MalformedURLException, java.io.IOException, SourceException
Source object.resolveURI in interface SourceResolverlocation - - the URI to resolve. If this is relative it is either
resolved relative to the base parameter (if not null)
or relative to a base setting of the source resolver
itself.baseURI - - a base URI for resolving relative locations. This
is optional and can be null.parameters - - Additional parameters for the URI. The parameters
are specific to the used scheme.SourceNotFoundException - if the source cannot be foundjava.net.MalformedURLException - if location is malformed.java.io.IOException - if the source couldn't be created for some other reason.SourceExceptionprivate java.lang.String absolutize(SourceFactory factory, java.lang.String baseURI, java.lang.String systemID)
public void release(Source source)
release in interface SourceResolversource - the source to release