org.apache.avalon.excalibur.source
Class SourceResolverImpl

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLogEnabled
        |
        +--org.apache.avalon.excalibur.source.SourceResolverImpl
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.logger.LogEnabled, SourceResolver, org.apache.avalon.framework.thread.ThreadSafe

public class SourceResolverImpl
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.activity.Disposable, SourceResolver, org.apache.avalon.framework.thread.ThreadSafe

Base interface for resolving a source by system identifiers. Instead of using the java.net.URL classes which prevent you to add your own custom protocols in a server environment, you should use this resolver for all URLs. The resolver creates for each source a Source object, which could then be asked for an InputStream etc. When the Source object is no longer needed it must be released using the resolver. This is very similar like looking up components from a ComponentManager and releasing them. It looks for the base URL in the Context object with the "container.rootDir" entry. If the entry does not exist, it is populated with the system property "user.dir".

Version:
$Id: SourceResolverImpl.java,v 1.13 2002/01/25 21:12:56 bloritsch Exp $
Author:
Carsten Ziegeler, Berin Loritsch

Field Summary
protected  java.net.URL m_baseURL
          The base URL
protected  org.apache.avalon.framework.context.Context m_context
          The context
protected  org.apache.avalon.framework.component.ComponentSelector m_factorySelector
          The special Source factories
protected  org.apache.avalon.framework.component.ComponentManager m_manager
          The component manager
 
Fields inherited from interface org.apache.avalon.excalibur.source.SourceResolver
ROLE
 
Constructor Summary
SourceResolverImpl()
           
 
Method Summary
 void compose(org.apache.avalon.framework.component.ComponentManager manager)
          Set the current ComponentManager instance used by this Composable.
 void contextualize(org.apache.avalon.framework.context.Context context)
          Get the context
 void dispose()
          Dispose
 void release(Source source)
          Releases a resolved resource
 Source resolve(java.lang.String location)
          Get a Source object.
 Source resolve(java.lang.String location, SourceParameters parameters)
          Get a Source object.
 Source resolve(java.net.URL base, java.lang.String location)
          Get a Source object.
 Source resolve(java.net.URL base, java.lang.String location, SourceParameters parameters)
          Get a Source object.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_manager

protected org.apache.avalon.framework.component.ComponentManager m_manager
The component manager

m_factorySelector

protected org.apache.avalon.framework.component.ComponentSelector m_factorySelector
The special Source factories

m_context

protected org.apache.avalon.framework.context.Context m_context
The context

m_baseURL

protected java.net.URL m_baseURL
The base URL
Constructor Detail

SourceResolverImpl

public SourceResolverImpl()
Method Detail

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Get the context
Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable

compose

public void compose(org.apache.avalon.framework.component.ComponentManager manager)
             throws org.apache.avalon.framework.component.ComponentException
Set the current ComponentManager instance used by this Composable.
Specified by:
compose in interface org.apache.avalon.framework.component.Composable

dispose

public void dispose()
Dispose
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable

resolve

public Source resolve(java.lang.String location)
               throws java.net.MalformedURLException,
                      java.io.IOException,
                      org.apache.avalon.framework.component.ComponentException
Get a Source object.
Specified by:
resolve in interface SourceResolver

resolve

public Source resolve(java.lang.String location,
                      SourceParameters parameters)
               throws java.net.MalformedURLException,
                      java.io.IOException,
                      org.apache.avalon.framework.component.ComponentException
Get a Source object.
Specified by:
resolve in interface SourceResolver

resolve

public Source resolve(java.net.URL base,
                      java.lang.String location)
               throws java.net.MalformedURLException,
                      java.io.IOException,
                      org.apache.avalon.framework.component.ComponentException
Get a Source object.
Specified by:
resolve in interface SourceResolver

resolve

public Source resolve(java.net.URL base,
                      java.lang.String location,
                      SourceParameters parameters)
               throws java.net.MalformedURLException,
                      java.io.IOException,
                      org.apache.avalon.framework.component.ComponentException
Get a Source object.
Specified by:
resolve in interface SourceResolver

release

public void release(Source source)
Releases a resolved resource
Specified by:
release in interface SourceResolver


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.