Search:

Apache » Lenya
project logo
  • Project
  • Developer
  • Community
  • Version 2.0
  • Version 1.2
  • Version 1.2
    • Installation
      • Download
      • Subversion Access
      • Install Instructions
    • Tutorial
      • Introduction
      • 1. Understanding Lenya
      • 2. Installing Lenya
      • 3. Anatomy of the Pipeline
      • 4. Editing in Lenya
      • 5. Custom Navigation in Lenya
      • 6a. Mod Proxy and Lenya
      • 6b. Mod Proxy and Lenya
    • How-To
      • FAQ
      • New Publication
      • Deploy Publication
      • Look and Feel
      • Custom Resource Type
      • Adding Mime Types
      • Site Navigation
      • LDAP Authentication
      • CMS Menus
      • CMS Screens
      • Search Publications
      • External Data
      • Unit Tests
    • Components
      • Access Control
        • Basic Terms
        • Access Controllers
        • Access Controller Resolvers
        • Authenticators
        • Authorizers
        • Policies and Policy Managers
        • Accreditable Managers
        • SSL Encryption
      • Authoring
        • Adding a new document creator
        • Image Upload
        • OpenOffice
      • Deployment
        • Proxying
      • Editors
        • HTML Form Editor
        • HTML One Form Editor
        • Bitflux Editor
        • Kupu
        • Xopus
      • Layout
        • Navigation
        • XHTML templating
        • Serving static resources
        • Lenya Menubar
      • Publication
        • PageEnvelopeModule
        • Site tree
      • Resource Types
        • Resource Types
      • Revision Control
        • Revision Controller
        • RCML
        • Check In
        • Check Out
        • Revisions
        • Rollback
      • Repository
        • WebDAV Servers
      • Search
        • Searching with Lucene
      • URI Handling
        • URI Parametrizer
        • URI Scheme
        • Usecases
      • Asset Management
        • Asset Management
      • Link Management
        • Link Management
      • Meta Data
        • Meta Data Handling
      • Multilingual Documents
        • Multilingual Document Handling
      • Tasks
        • The Task Concept
        • Defining Tasks
        • The TaskAction
        • Scheduling a Task
        • Included tasks
          • AntTask
          • DefaultFilePublisher
          • StaticHTMLExporter
          • MailTask
        • Developing Tasks
      • Workflow
        • Terms
        • The State Machine
        • Configuration
        • Implementation
      • Site Management
        • Archive
        • Copy
        • Deactivate
        • Delete
        • Delete the trash
        • Move
        • Move Up/Down
        • Rename
        • Restore
    • Miscellaneous
      • Namespaces
      • Reserved Names
      • XInclude Processor
    • 1.2 API (Javadoc)

Current Event

Built with Apache Lenya

Asset Management

Table of Contents
  • Introduction
  • Asset upload
  • Asset insertion (via "enable asset upload" screen)
  • Asset insertion (via Bitflux editor)
  • Asset removal
  • Involved classes, XSPs and XSLTs

Introduction

Asset management is the process by which assets, such as pdf files or images are uploaded to the server and inserted into a document.

Assets can be either inserted directly into a document or can be uploaded for later insertion. Direct insertion happens when editing the document, upload and removal can be done in the asset tab in the site area.

Asset upload

The upload of assets is done quite simply with a multipart request. The Upload screen is generated by an xsp (asset.xsp) which handles asset upload, image upload, asset insertion and image insertion. This screen then generates the multipart request which is eventually handled by the AssetUploadAction. This action stores the asset in the resources directory and generates a meta file with the dublin core meta data that was passed in as request parameter or with data that was extracted from the request (mime type, size). Where the asset is stored is determined by the ResourcesManager.

Asset insertion (via "enable asset upload" screen)

Once the asset is uploaded, a reference to it has to be inserted in the original document. Images and "plain" assets are handled slighly different but the basic mechanism is the same.

The insertion is done via an ant task (insert-asset). This task generates a temporary XSLT stylesheet using generate-insertAsset-xsl.xsl as a meta stylesheet and an XML template which defines the XML snippet that will be inserted in the refering document. The path to the XML template is passed as a parameter to the ant task. Usually these templates are located in config/asset. The generated temporary stylesheet is then applied to the document where the reference to the asset is to be inserted. It will insert the appropriate XML snippet.

Asset insertion (via Bitflux editor)

Images and assets can also be inserted from within the Bitflux editor.

The insertion is done via a XSLT stylesheet (image.xsl or asset.xsl in xslt/bxe). These stylesheets create a popup window that let the user select an asset or image and insert it into the currently opened document via javascript.

Asset removal

Assets can be removed in the asset tab in the site area. This removes the asset from the resources directory. It does not however remove any references to it.

Removal is done with an ant task (remove-asset) which simply deletes the asset from the resources directory.

Involved classes, XSPs and XSLTs

The following classes, XSPs and XSLTs are involved in the asset upload:

src/webapp/lenya/content/authoring/asset.xsp, src/webapp/lenya/xslt/authoring/asset.xsl
Take care of displaying the proper asset upload screen. There are different screens for image and asset upload and for upload with or without subsequent insertion.
org.apache.lenya.cms.cocoon.acting.UploadAction
Handles the upload request, stores the asset in resources/authoring/$document-id/$resource-name, and creates a file containing the dublin core meta data for the asset.
$publication-id/config/assets/*
Define the XML snippets that is to be inserted in lieu of a refernce to an asset.
src/webapp/lenya/xslt/util/generate-insertAsset-xsl.xsl
The meta stylesheet which generates the XSLT the will insert the proper XML snippet to link to the asset in the refering document.
$publication-id/config/tasks/targets.xml
Defines the insert-asset target which handles asset insertion. Also defines the remove-asset target.
org.apache.lenya.cms.publication.ResourcesManager
Manages resources and hides away some of the iplementaion details where resources and their meta data is stored.

Copyright © 1999-2011 The Apache Software Foundation. All rights reserved.

Apache Lenya, Apache, and the Apache feather logo are trademarks of The Apache Software Foundation.