org.apache.lenya.cms.cocoon.components.modules.input
Class FallbackModule

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.modules.input.AbstractInputModule
          extended by org.apache.lenya.cms.cocoon.components.modules.input.AbstractPageEnvelopeModule
              extended by org.apache.lenya.cms.cocoon.components.modules.input.FallbackModule
All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.cocoon.components.modules.input.InputModule
Direct Known Subclasses:
PublicationFallbackModule

public class FallbackModule
extends AbstractPageEnvelopeModule
implements org.apache.avalon.framework.service.Serviceable

This module checks if a file exists in a publiation, and if not, it chooses the core file. The attribute name must a path relatively to the webapps/lenya/lenya directory.

Example: {fallback:xslt/style.xsl} looks if lenya/pubs/(publication-id)/lenya/xslt/style.xsl exists, and if not, it uses lenya/xslt/style.xsl.


Field Summary
protected static java.lang.String ATTRIBUTE_SRC
           
protected static java.lang.String ELEMENT_PATH
           
static java.lang.String PATH_PREFIX
           
 
Fields inherited from class org.apache.cocoon.components.modules.input.AbstractInputModule
settings
 
Fields inherited from interface org.apache.cocoon.components.modules.input.InputModule
ROLE
 
Constructor Summary
FallbackModule()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
           
 java.lang.Object getAttribute(java.lang.String name, org.apache.avalon.framework.configuration.Configuration modeConf, java.util.Map objectModel)
           
 java.util.Iterator getAttributeNames(org.apache.avalon.framework.configuration.Configuration modeConf, java.util.Map objectModel)
           
 java.lang.Object[] getAttributeValues(java.lang.String name, org.apache.avalon.framework.configuration.Configuration modeConf, java.util.Map objectModel)
           
protected  java.lang.String[] getBaseURIs(java.util.Map objectModel)
          Returns the base directory URIs in the order they should be traversed.
protected  java.lang.String resolveURI(java.lang.String path, java.util.Map objectModel)
          Resolves the URI for a certain path.
 void service(org.apache.avalon.framework.service.ServiceManager manager)
           
 
Methods inherited from class org.apache.lenya.cms.cocoon.components.modules.input.AbstractPageEnvelopeModule
getEnvelope
 
Methods inherited from class org.apache.cocoon.components.modules.input.AbstractInputModule
dispose
 
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

PATH_PREFIX

public static final java.lang.String PATH_PREFIX
See Also:
Constant Field Values

ELEMENT_PATH

protected static final java.lang.String ELEMENT_PATH
See Also:
Constant Field Values

ATTRIBUTE_SRC

protected static final java.lang.String ATTRIBUTE_SRC
See Also:
Constant Field Values
Constructor Detail

FallbackModule

public FallbackModule()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Overrides:
configure in class org.apache.cocoon.components.modules.input.AbstractInputModule
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

getAttribute

public java.lang.Object getAttribute(java.lang.String name,
                                     org.apache.avalon.framework.configuration.Configuration modeConf,
                                     java.util.Map objectModel)
                              throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
getAttribute in interface org.apache.cocoon.components.modules.input.InputModule
Overrides:
getAttribute in class org.apache.cocoon.components.modules.input.AbstractInputModule
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
InputModule.getAttribute(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)

resolveURI

protected java.lang.String resolveURI(java.lang.String path,
                                      java.util.Map objectModel)
                               throws org.apache.avalon.framework.configuration.ConfigurationException
Resolves the URI for a certain path.

Parameters:
path - The path.
objectModel - The object model.
Returns:
A string.
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - if an error occurs.

getBaseURIs

protected java.lang.String[] getBaseURIs(java.util.Map objectModel)
                                  throws org.apache.avalon.framework.configuration.ConfigurationException
Returns the base directory URIs in the order they should be traversed.

Parameters:
objectModel - The object model.
Returns:
An array of strings.
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - if an error occurs.

getAttributeNames

public java.util.Iterator getAttributeNames(org.apache.avalon.framework.configuration.Configuration modeConf,
                                            java.util.Map objectModel)
                                     throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
getAttributeNames in interface org.apache.cocoon.components.modules.input.InputModule
Overrides:
getAttributeNames in class org.apache.cocoon.components.modules.input.AbstractInputModule
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
InputModule.getAttributeNames(org.apache.avalon.framework.configuration.Configuration, java.util.Map)

getAttributeValues

public java.lang.Object[] getAttributeValues(java.lang.String name,
                                             org.apache.avalon.framework.configuration.Configuration modeConf,
                                             java.util.Map objectModel)
                                      throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
getAttributeValues in interface org.apache.cocoon.components.modules.input.InputModule
Overrides:
getAttributeValues in class org.apache.cocoon.components.modules.input.AbstractInputModule
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
InputModule.getAttributeValues(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)

service

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


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.