apache > lenya
 

Meta Data

Introduction

Meta data is kept directly inside the xml document. It is based on the Dublin Core standard.

There are basically three use cases:

  1. Create Meta Data
  2. Display Meta Data
  3. Modify Meta Data

Implementation

Create Meta Data

Upon creation of a document a sample is copied from the sample doctype directory. This sample already contains some sample meta data. The creator then applies an XSLT transformation to this sample which adapts the sample values to the values suplied in the creator request. This values are partially filled in by the user (subject, desciption, etc.) and partly by the system (creator, creation data). This is done in the create ant task which at the end invokes an xslt task which applies the addMetaData.xsl stylesheet which adapts the meta data according to the request values.

Display Meta Data

The display of meta data is handled by the meta.xsp xsp.

Modify Meta data

The modification of meta data is handled in the info.xmap sitemap. The matcher makes sure to check the document out before the modification and checking it back in after the modification. This is done using the ReservedCheckoutTestAction and ReservedCheckinAction. If there is an error the request is redirected to the meta data screen which displays a warning saying that the checkout or checkin failed and who was locking the document since what date and time.

Once the document is checked out the modifications are applied with the help of an ant task. There is a target named save-meta-data which simply invokes the ant task WriteDCParametersTask. This task saves the meta data using the DublinCore interface.

Involved classes, XSPs and XSLTs

The following classes, XSPs and XSLTs are involved in meta data handling:

org.apache.lenya.cms.ant.WriteDCParametersTask
A simple ant task which saves the meta data which is passed as arguments to file using the DublinCore class.
$publication-id/config/tasks/targets.xml
Defines the save-meta-data target which handles saving of meta data with the help of the WriteDCParametersTask ant task. Also defines the create target which is used create new documents and to change the meta data according to the request values from the creation request.
org.apache.lenya.cms.publication.DublinCore
A simple interface to save and retrieve dublin core meta data.
org.apache.lenya.cms.cocoon.acting.ReservedCheckoutTestAction
Action that tests if a document can be checked out and if yes does check it out (See Revision Controller).
org.apache.lenya.cms.cocoon.acting.ReservedCheckinAction
Action that checks a document in (See Revision Controller).
src/webapp/lenya/content/info/meta.xsp, src/webapp/lenya/xslt/info/info.xsl
Handle the display of the meta data in the info area. This is also a form which can be used to modify the meta data via a POST request.
src/webapp/lenya/xslt/authoring/addMetaData.xsl
Simple XSLT stylesheet that modifies the meta data according to the input parameters.