org.apache.cocoon.components.source.impl
Class SourceDescriptorManager

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.source.impl.SourceDescriptorManager
All Implemented Interfaces:
Disposable, Initializable, Component, Configurable, Contextualizable, LogEnabled, Serviceable, ThreadSafe, SourceDescriptor, SourceInspector

public final class SourceDescriptorManager
extends AbstractLogEnabled
implements SourceDescriptor, Contextualizable, Serviceable, Configurable, Initializable, Disposable, ThreadSafe

This source descriptor acts as container for a set of source inspectors/descriptors.

Version:
CVS $Id: SourceDescriptorManager.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Stephan Michels, Unico Hommes

Field Summary
 
Fields inherited from interface org.apache.cocoon.components.source.SourceDescriptor
ROLE
 
Constructor Summary
SourceDescriptorManager()
           
 
Method Summary
 void configure(Configuration configuration)
           
 void contextualize(Context context)
           
 void dispose()
           
 SourceProperty[] getSourceProperties(Source source)
          Aggregate all properties of all registered inspectors.
 SourceProperty getSourceProperty(Source source, String namespace, String name)
          Loops over the registered inspectors until it finds the property.
 SourceValidity getValidity(Source source)
          Returns an aggregate validity describing the validity of all the properties.
 boolean handlesProperty(String namespace, String name)
          Check if there is an inspector that handles properties of the given type.
 void initialize()
           
 void removeSourceProperty(Source source, String ns, String name)
          Loops over the registered descriptors and delegates the call.
 void service(ServiceManager manager)
           
 void setSourceProperty(Source source, SourceProperty property)
          Loops over the registered descriptors and calls delegates the call.
 
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
 

Constructor Detail

SourceDescriptorManager

public SourceDescriptorManager()
Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Specified by:
contextualize in interface Contextualizable
Throws:
ContextException

service

public void service(ServiceManager manager)
Specified by:
service in interface Serviceable

configure

public void configure(Configuration configuration)
               throws ConfigurationException
Specified by:
configure in interface Configurable
Throws:
ConfigurationException

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable
Throws:
Exception

dispose

public void dispose()
Specified by:
dispose in interface Disposable

getSourceProperty

public SourceProperty getSourceProperty(Source source,
                                        String namespace,
                                        String name)
                                 throws SourceException
Loops over the registered inspectors until it finds the property.

Specified by:
getSourceProperty in interface SourceInspector
Parameters:
source - the source for which to compute the property
namespace - the namespace of the property
name - the name of the property
Returns:
the SourceProperty associated with the Source, null if the inspector does not provide this property.
Throws:
SourceException

getSourceProperties

public SourceProperty[] getSourceProperties(Source source)
                                     throws SourceException
Aggregate all properties of all registered inspectors.

Specified by:
getSourceProperties in interface SourceInspector
Parameters:
source - the Source for wich to compute the property.
Returns:
the collection of all SourceProperties that could be computed by this SourceInspector.
Throws:
SourceException

handlesProperty

public boolean handlesProperty(String namespace,
                               String name)
Check if there is an inspector that handles properties of the given type.

Specified by:
handlesProperty in interface SourceInspector
Parameters:
namespace - the namespace of the property
name - the name of the property
Returns:
true if this inspector handles properties of the given type else false.

removeSourceProperty

public void removeSourceProperty(Source source,
                                 String ns,
                                 String name)
                          throws SourceException
Loops over the registered descriptors and delegates the call.

Specified by:
removeSourceProperty in interface SourceDescriptor
Parameters:
source - the Source to remove the property from
ns - namespace identifier of the property to remove
name - name of the property to remove
Throws:
SourceException

setSourceProperty

public void setSourceProperty(Source source,
                              SourceProperty property)
                       throws SourceException
Loops over the registered descriptors and calls delegates the call.

Specified by:
setSourceProperty in interface SourceDescriptor
Parameters:
source - the Source to set the SourceProperty on
property - the SourceProperty to set
Throws:
SourceException

getValidity

public SourceValidity getValidity(Source source)
Returns an aggregate validity describing the validity of all the properties.

Specified by:
getValidity in interface SourceInspector
Parameters:
source - the Source for which to calculate the validity its properties, null if the source properties are not cacheable.


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