org.apache.cocoon.components.source
Class CocoonSourceResolver

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.components.source.CocoonSourceResolver
All Implemented Interfaces:
Contextualizable, Disposable, Serviceable, org.apache.cocoon.environment.SourceResolver, SourceResolver, ThreadSafe

public class CocoonSourceResolver
extends org.apache.cocoon.util.AbstractLogEnabled
implements org.apache.cocoon.environment.SourceResolver, Contextualizable, Serviceable, Disposable, ThreadSafe

This is the default implementation of the SourceResolver for Cocoon. The implementation is based on the original source resolver implementation from the Excalibur project.

Since:
2.2
Version:
$Id: CocoonSourceResolver.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
protected  URL baseURL
          The base URL
protected  SourceResolver customResolver
          A (optional) custom source resolver
protected  ServiceManager manager
          The service manager
 
Fields inherited from interface org.apache.excalibur.source.SourceResolver
METHOD, ROLE, URI_ENCODING, URI_PARAMETERS
 
Constructor Summary
CocoonSourceResolver()
           
 
Method Summary
protected  String absolutize(SourceFactory factory, String baseURI, String systemID)
          Makes an absolute URI based on a baseURI and a relative URI.
 void contextualize(Context context)
           
 void dispose()
           
protected  ServiceManager getComponentLocator()
          Get the component locator.
protected  SourceFactory getSourceFactory(ServiceManager m, String scheme)
          Get the SourceFactory
 void release(Source source)
           
 Source resolveURI(String location)
           
 Source resolveURI(String location, String baseURI, Map parameters)
           
 void service(ServiceManager manager)
          Obtain a reference to the SourceResolver with "/Cocoon" hint
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

customResolver

protected SourceResolver customResolver
A (optional) custom source resolver


manager

protected ServiceManager manager
The service manager


baseURL

protected URL baseURL
The base URL

Constructor Detail

CocoonSourceResolver

public CocoonSourceResolver()
Method Detail

contextualize

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

resolveURI

public Source resolveURI(String location,
                         String baseURI,
                         Map parameters)
                  throws IOException
Specified by:
resolveURI in interface SourceResolver
Throws:
MalformedURLException - if unable to parse location URI
IOException
See Also:
SourceResolver.resolveURI(java.lang.String, java.lang.String, java.util.Map)

resolveURI

public Source resolveURI(String location)
                  throws IOException
Specified by:
resolveURI in interface SourceResolver
Throws:
MalformedURLException - if unable to parse location URI
IOException
See Also:
SourceResolver.resolveURI(java.lang.String)

service

public void service(ServiceManager manager)
             throws ServiceException
Obtain a reference to the SourceResolver with "/Cocoon" hint

Specified by:
service in interface Serviceable
Throws:
ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

dispose

public void dispose()
Specified by:
dispose in interface Disposable
See Also:
Disposable.dispose()

getComponentLocator

protected ServiceManager getComponentLocator()
Get the component locator.


getSourceFactory

protected SourceFactory getSourceFactory(ServiceManager m,
                                         String scheme)
                                  throws org.apache.cocoon.ProcessingException
Get the SourceFactory

Throws:
org.apache.cocoon.ProcessingException

release

public void release(Source source)
Specified by:
release in interface SourceResolver
See Also:
SourceResolver.release(org.apache.excalibur.source.Source)

absolutize

protected String absolutize(SourceFactory factory,
                            String baseURI,
                            String systemID)
Makes an absolute URI based on a baseURI and a relative URI.



Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.