Cocoon And Manakin

From Dryad wiki
Jump to: navigation, search

The DSpace user interface layer is called Manakin. It is based on Apache Cocoon.

Philosophy

  • An "aspect" is a bit of java code that creates XML to be inserted into a page. Aspects usually represent things that are repeated on multiple pages (e.g., the user's login status and associated menu items)
  • A "theme" applies XSL to create HTML, which dictates the content's basic layout. We use separate themes for the Dryad look-and-feel, and the DryadLab look-and-feel.
  • CSS dictates how the layout is rendered.
  • JavaScript dictates how the rendering behaves.

Samples

To see basic Cocoon features in action, navigate to:

  • (server-base-url)/xmltest/form/basic
  • (server-base-url)/xmltest/form/inline
  • (server-base-url)/xmltest/form/advanced
  • (server-base-url)/xmltest/form/structural
  • (server-base-url)/xmltest/form/HTML

The code for these are in:

  • dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/xmltest
  • dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/XMLTest/sitemap.xmap

Flow of control

  • the theme directs a call to the sitemap.xmap for each abstract that is active
  • sitemap.xmap determines what Java classes to call
  • A pipeline in the sitemap
    • may include a selector (decides which section of a pipeline to follow)
    • must have a generator and serializer.
      • there are generators (see xmlui sitemap) for ORE, directory listing, reading a file, etc. -- e.g., org.dspace.app.xmlui.cocoon.?????OREGenerator
    • may have an optional number of transformers in between
    • may have "actions" -- like transformers, but don't output xml (they are intended to produce a side effect)
    • may have matchers that turn pieces of the sitemap on and off for certain URLs.
  • pipeline transformer classes modify the DRI
  • the serializer runs the DRI through XSL in i18n
  • the resultant page is sent to the browser, which may apply a CSS

Random notes

  • adding ?XSL to the URL is similar to adding /DRI, but it doesn't do the internationalization step -- so strings aren't replaced....
  • sitemaps (or just one?) define the ordering of the compile-time overlays -- right now, the items in the "current directory" for the sitemap have precedence, then items explicitly defined in the sitemap, and finally other things from the mvn dependency analysis
  • when you get an exception, you see all of the cocoon pieces that have run (not quite the same as a regular stack trace)