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

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

public class SimpleJdbcSourceDescriptor
extends AbstractConfigurableSourceDescriptor
implements SourceDescriptor, Serviceable, Configurable, Initializable, ThreadSafe

Simple SourceDescriptor implementation that can stores properties over JDBC.

The descriptor is to be configured with the name of a datasource that contains a table with the following scheme:

CREATE TABLE SOURCEPROPS(
SOURCE VARCHAR NOT NULL,
NAMESPACE VARCHAR NOT NULL,
NAME VARCHAR NOT NULL,
VALUE VARCHAR NOT NULL,
CONSTRAINT SYS_CT_11 UNIQUE(SOURCE,NAMESPACE,NAME))

The implementation will attempt to connect to the EventAware cache in order to notify it during changes. If it can't find the EventAware cache sources that are described by this SourceDescriptor will NOT be cacheable.

Version:
$Id: SimpleJdbcSourceDescriptor.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Field Summary
 
Fields inherited from interface org.apache.cocoon.components.source.SourceDescriptor
ROLE
 
Constructor Summary
SimpleJdbcSourceDescriptor()
           
 
Method Summary
 void configure(Configuration configuration)
          Configuration options: element property (multiple,required) - define a property that this store should handle.
 SourceProperty doGetSourceProperty(Source source, String namespace, String name)
          Do the actual work of getting the requested SourceProperty for the given Source.
 void doRemoveSourceProperty(Source source, String namespace, String name)
          Do the actual work of removing the given property from the provided Source.
 void doSetSourceProperty(Source source, SourceProperty property)
          Do the actual work of setting the provided SourceProperty on the given Source.
 SourceProperty[] getSourceProperties(Source source)
          Iterates over the configured set of properties to handle, for each property calls doGetSourceProperty(), and returns the list of properties thus obtained.
 SourceValidity getValidity(Source source)
          Get the validity object that describes the validity state of the properties belonging to the given source.
 void initialize()
           
 void service(ServiceManager manager)
           
 
Methods inherited from class org.apache.cocoon.components.source.impl.AbstractConfigurableSourceDescriptor
removeSourceProperty, setSourceProperty
 
Methods inherited from class org.apache.cocoon.components.source.impl.AbstractConfigurableSourceInspector
getPropertyTypes, getSourceProperty, handlesProperty
 
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
 
Methods inherited from interface org.apache.cocoon.components.source.SourceDescriptor
removeSourceProperty, setSourceProperty
 
Methods inherited from interface org.apache.cocoon.components.source.SourceInspector
getSourceProperty, handlesProperty
 

Constructor Detail

SimpleJdbcSourceDescriptor

public SimpleJdbcSourceDescriptor()
Method Detail

service

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

configure

public void configure(Configuration configuration)
               throws ConfigurationException
Configuration options:

Specified by:
configure in interface Configurable
Overrides:
configure in class AbstractConfigurableSourceInspector
Throws:
ConfigurationException

initialize

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

getSourceProperties

public SourceProperty[] getSourceProperties(Source source)
                                     throws SourceException
Description copied from class: AbstractConfigurableSourceInspector
Iterates over the configured set of properties to handle, for each property calls doGetSourceProperty(), and returns the list of properties thus obtained. Subclasses may want to overide this behavior to improve performance.

Specified by:
getSourceProperties in interface SourceInspector
Overrides:
getSourceProperties in class AbstractConfigurableSourceInspector
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

doGetSourceProperty

public SourceProperty doGetSourceProperty(Source source,
                                          String namespace,
                                          String name)
                                   throws SourceException
Description copied from class: AbstractConfigurableSourceInspector
Do the actual work of getting the requested SourceProperty for the given Source.

Specified by:
doGetSourceProperty in class AbstractConfigurableSourceInspector
Throws:
SourceException

doSetSourceProperty

public void doSetSourceProperty(Source source,
                                SourceProperty property)
                         throws SourceException
Description copied from class: AbstractConfigurableSourceDescriptor
Do the actual work of setting the provided SourceProperty on the given Source.

Specified by:
doSetSourceProperty in class AbstractConfigurableSourceDescriptor
Throws:
SourceException

doRemoveSourceProperty

public void doRemoveSourceProperty(Source source,
                                   String namespace,
                                   String name)
                            throws SourceException
Description copied from class: AbstractConfigurableSourceDescriptor
Do the actual work of removing the given property from the provided Source.

Specified by:
doRemoveSourceProperty in class AbstractConfigurableSourceDescriptor
Throws:
SourceException

getValidity

public SourceValidity getValidity(Source source)
Description copied from interface: SourceInspector
Get the validity object that describes the validity state of the properties belonging to the given source.

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.