org.apache.lenya.cms.cocoon.generation
Class LenyaMetaDataGenerator

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.generation.AbstractGenerator
              extended by org.apache.cocoon.generation.ServiceableGenerator
                  extended by org.apache.lenya.cms.cocoon.generation.LenyaMetaDataGenerator
All Implemented Interfaces:
org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.cocoon.caching.CacheableProcessingComponent, org.apache.cocoon.generation.Generator, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.xml.XMLProducer

public class LenyaMetaDataGenerator
extends org.apache.cocoon.generation.ServiceableGenerator
implements org.apache.cocoon.caching.CacheableProcessingComponent

Generates the meta data of a document. The src attribute must be a RepositorySource URI (e.g., lenya-document:...).

Example output:

  <lenya:metadata xmlns:lenya="http://apache.org/cocoon/lenya/metadata/1.0">
  <elements xmlns="http://purl.org/dc/elements/1.1/">
  <title>Search</title>
  <date>2006-06-12 13:43:14</date>
  <language>en</language>
  <creator>lenya</creator>
  </elements>
  <elements xmlns="http://apache.org/lenya/metadata/document/1.0">
  <extension>xml</extension>
  <resourceType>usecase</resourceType>
  <contentType>xml</contentType>
  </elements>
  </lenya:metadata>
 


Field Summary
protected  org.xml.sax.helpers.AttributesImpl attributes
          Node and attribute names
protected  org.apache.excalibur.xml.dom.DOMParser parser
          The parser for the XML snippets to be included.
protected static java.lang.String PREFIX_META
          The namespace prefix for this namespace
protected static java.lang.String ROOT_META_NODE_NAME
          Metadata
protected static java.lang.String URI_META
          The URI of the namespace of the metadata
 
Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
manager
 
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.generation.Generator
ROLE
 
Constructor Summary
LenyaMetaDataGenerator()
           
 
Method Summary
 void generate()
          Generate XML data.
 java.io.Serializable getKey()
          Generate the unique key.
protected  MetaData getMetaData(java.lang.String namespaceUri)
           
 org.apache.excalibur.source.SourceValidity getValidity()
          Generate the validity object.
 void recycle()
          Recycle this component.
 void service(org.apache.avalon.framework.service.ServiceManager manager)
          Serviceable
 void setup(org.apache.cocoon.environment.SourceResolver resolver, java.util.Map objectModel, java.lang.String src, org.apache.avalon.framework.parameters.Parameters par)
          Setup the file generator.
 
Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
dispose
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
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.xml.XMLProducer
setConsumer
 

Field Detail

attributes

protected org.xml.sax.helpers.AttributesImpl attributes
Node and attribute names


ROOT_META_NODE_NAME

protected static final java.lang.String ROOT_META_NODE_NAME
Metadata

See Also:
Constant Field Values

URI_META

protected static final java.lang.String URI_META
The URI of the namespace of the metadata

See Also:
Constant Field Values

PREFIX_META

protected static final java.lang.String PREFIX_META
The namespace prefix for this namespace

See Also:
Constant Field Values

parser

protected org.apache.excalibur.xml.dom.DOMParser parser
The parser for the XML snippets to be included.

Constructor Detail

LenyaMetaDataGenerator

public LenyaMetaDataGenerator()
Method Detail

recycle

public void recycle()
Recycle this component. All instance variables are set to null.

Specified by:
recycle in interface org.apache.avalon.excalibur.pool.Recyclable
Overrides:
recycle in class org.apache.cocoon.generation.AbstractGenerator

service

public void service(org.apache.avalon.framework.service.ServiceManager manager)
             throws org.apache.avalon.framework.service.ServiceException
Serviceable

Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Overrides:
service in class org.apache.cocoon.generation.ServiceableGenerator
Parameters:
manager - the ComponentManager
Throws:
org.apache.avalon.framework.service.ServiceException - in case a component could not be found

setup

public void setup(org.apache.cocoon.environment.SourceResolver resolver,
                  java.util.Map objectModel,
                  java.lang.String src,
                  org.apache.avalon.framework.parameters.Parameters par)
           throws org.apache.cocoon.ProcessingException,
                  org.xml.sax.SAXException,
                  java.io.IOException
Setup the file generator. Try to get the last modification date of the source for caching.

Specified by:
setup in interface org.apache.cocoon.sitemap.SitemapModelComponent
Overrides:
setup in class org.apache.cocoon.generation.AbstractGenerator
Throws:
org.apache.cocoon.ProcessingException
org.xml.sax.SAXException
java.io.IOException

getKey

public java.io.Serializable getKey()
Generate the unique key. This key must be unique inside the space of this component.

Specified by:
getKey in interface org.apache.cocoon.caching.CacheableProcessingComponent
Returns:
The generated key hashes the src

getValidity

public org.apache.excalibur.source.SourceValidity getValidity()
Generate the validity object.

Specified by:
getValidity in interface org.apache.cocoon.caching.CacheableProcessingComponent
Returns:
The generated validity object or null if the component is currently not cacheable.

generate

public void generate()
              throws java.io.IOException,
                     org.xml.sax.SAXException,
                     org.apache.cocoon.ProcessingException
Generate XML data.

Specified by:
generate in interface org.apache.cocoon.generation.Generator
Throws:
java.io.IOException
org.xml.sax.SAXException
org.apache.cocoon.ProcessingException

getMetaData

protected MetaData getMetaData(java.lang.String namespaceUri)
                        throws org.apache.cocoon.ProcessingException
Throws:
org.apache.cocoon.ProcessingException


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