...| Home | Cocoon...
DBPrism - Apache Cocoon > DBPrismGenerator for Cocoon2 >

+ Home ...
+ Download
+ Documentation
+ DBPrism Content Management System
> DBPrism - Apache Cocoon
+ Credits
+ Legal
 
+ Cocoon
> DBPrismGenerator for Cocoon2
+ CocoonRequestWrapper for Cocoon2
+ External Cache Invalidator Server interface
+ In Memory Server Implementation for External Cache Server
+ HSQL Server Implementation for External Cache Server
+ ExternalCacheValidity for Cocoon2
+ Cocoon files includes into dbprism.ear
+ Trace Diagrams
 
+ links
+ Yahoo.groups
+ OTN
+ OSCOM.org
 
Moreover news
+ IBM speeds Java on mainframes (CNET Asia)
+ Middle-aged mainframe converts to Java (ZDNet UK)
+ IBM speeds Java on mainframes (ZDNet)
+ IBM speeds Java on mainframes (CNET)
+ All Buttons (JavaBoutique)
+ Drag-and-Drop Editor Out for Linux Devs (Internet News)
+ Using Program Parameters in Java (JavaBoutique)
+ Sun pledges to cooperate with Microsoft (AP via Seattle Post Intelligencer)
+ Sun pledges to cooperate with Microsoft (Boston Globe)
+ Bitter legal feud ends with payment, Sun cuts 3,300 more jobs (China Post)
+ Sun and Microsoft settle (Chicago Sun-Times)
+ Microsoft to pay $1.6 billion, settle with Sun Microsystems (Baltimore Sun)
+ Visualize Hoovers Data With Anacubis (ResearchBuzz via ResearchBuzz)
+ Sun and BEA advance Java app offerings (Computer Weekly)
+ Sun wants to lift its Java profile (ZDNet UK)
+ 'Smack the Pingu' on Your Mobile Phone! (PA News via The Scotsman Online)
+ Third Generation Mobile Phone Game from Nihon Enterprise (Japan Corp)
+ Comment: Free but shackled - the Java trap (Sydney Morning Herald)
+ Sun plots Java comeback (CNET Asia)
+ Veritas and BEA vow to love Java together (The Register)
+ Microsoft and Sun's settlement will yield web services benefits and support for Java (Computer Weekly)
+ Sun plots Java comeback (CNET)
+ Sun plots Java comeback (ZDNet)
+ Sun enables new wave of mobile Java services (Sunday Times South Africa)
+ Sun Releases Sun Java Studio 6 (Techfocus)
+ Sam Pitrodas Telecom Firm Sets Up India Centre (Financial Express)
+ Multi Player Mobile Gaming (BBC)
+ Combining SOAP and JavaMail (Java Pro)
+ Draw Applet (JavaBoutique)
+ IBM dedicates module to Java on mainframes (CNET)
 
+ OTN News
+ View Live Customer Webcast Demos of Enterprise Manager 10g Grid Control
+ Oracle Database 10g for Windows Now Available for Download
+ Download New Oracle 10g JDBC Drivers
+ JDeveloper 10g Reviewed in Internet.com's Java Boutique
+ Java Developer's Journal Readers Name Oracle Products "Best" in Two Categories
+ New OracleAS Portal Extension for Macromedia Dreamweaver
+ Learn from the Experts During Java Week
+ Download Oracle Database 10g
+ New OracleAS Web Cache How-To Documents
+ Learn About SQL 2003 Support in Oracle Database 10g
+ New: Quick Installation Guide for RAC on Oracle Database 10g SE (Windows)
+ Oracle Forms Diagnostic Techniques
+ Introduction to JavaServer Faces
+ Prepare for Oracle Database 10g
+ New Tutorial: Learn JSP 2.0
+ Learn Best Practices for Consolidating Oracle on Linux Deployments
+ What's New in PL/SQL in Oracle Database 10g?
+ New Oracle 10g JDBC Samples
+ New Tech Tip: Using HttpUnit in Oracle JDeveloper 10g
+ Oracle 10g Supports Microsoft Windows Media Streaming Services and Windows Media File Format (ASF)
+ New Books at Oracle 10g Book Center
+ Tech Tip: Using JSTL SQL in Oracle JDeveloper 10g Preview
+ New Technical Article Series: The Hitchhiker's Guide to PHP
+ New Enterprise Manager 10g Grid Control Hands-on Tutorial
+ OC4J 10g (10.0.3) Developer Preview 2 Now Available
+ Download the New Oracle JDeveloper Application Migration Assistant (AMA) Search Rules for WebLogic Migrations
+ Learn Oracle in 2 Days
+ Download the new Oracle XDK 10g Production Release
+ Explore New JDBC 10g How-To's
+ New Oracle 10g JDBC Sample: CachedRowSet
+ New RowSet Implementation Tutorial Series
+ Download 2003 ODTUG Conference Papers
+ New Tutorial: Understanding TLD Caching in JSPs
+ Deploy the New J2EE 1.4 Adventure Builder Reference Application to OC4J
+ Download New Servlet Advanced Sample Applications
+ New: Oracle XDK 10g Unicode Support and XSLT Extension Sample App
+ New Oracle Application Server ProcessConnect End-to-End Samples
DBPrism at SourceForge
Built with Cocoon2
Cocoon
 
DBPrism Generator for Apache Cocoon 2
Definition:

DBPrismGenerator is the key component which provides the connection between Apache Cocoon Framework and DBPrism.


DBPrismGenerator is an Apache Cocoon Generator, it implements the first step into the cocoon pipeline structure. DBPrismGenerator generates the XML content through the excecution of an stored procedure extracted from the caller url. It extend Apache Cocoon's ComposerGenerator class.

In a Cocoon architecture every Generator is an Avalon component and implements several interfaces that defines different aspect (contracts). DBPrismGenerator implements Composable, Configurable, Recyclable, Cacheable and Contextualizable. The most important interfaces here are described below.

Interfaces
  • Composable, defines compose() method implemented into the parent class ComposerGenerator.
  • Configurable, defines configure() method used by DBPrismGenerator to extract the configuration filename and to initialize the DBPrism engine.
  • Recyclable, defines recycle() method which is called by the Avalon framework to free components that are no longer valid.
  • Cacheable, defines genrateKey() and generateValidity() methods used by Cocoon's cache system.
  • Contextualizable, defines contextualize() method which provide the HttpServlet context object.

Instance variables
  • Request request, Cocoon Servlet Request object.
  • Response response, Cocoon Servlet Response object.
  • Context context, Cocoon Context object
  • HttpServletRequest httpRequest, Http Servlet Request object.
  • DBPrism engine, DBPrism engine instance, which connects this generator with a DBPrism engine.
  • CocoonRequestWrapper req, wrapper object which provides standard Http Servlet Request methods over a Cocoon's request instance.
  • Block blocker, simple synchronization object to serialize the parallel content aggregation at the generation stage.
  • Delayer delayer, private thread object which is responsable for making the excecution of the stored procedure without blocking the Cocoon generation stage.
  • Server cacheServer, External Cache Invalidator Server instance.
  • ESIKey key, key value that defines the page, unique in a DBPrismGenerator space.
  • int cacheControl, which cache control is defined into the sitemap for the current request.

Methods
  • public void configure(Configuration conf), called by the Avalon Component Manager when this Generator is created. At this point the DBPrismGenerator calls to the init method of DBPrism engine passing the generator argument "properties" which defines the path and the filename of the DBPrism's properties file.
  • public long generateKey(), Returns a long value returned by the execution of the method this.key.getKey(). This key is unique for every call of an stored procedure because there is no information about the content returned by stored procedure, to avoid key duplications into Cocoon MRU Store it includes a random component initialized at Cocoon startup.
  • public CacheValidity generateValidity(), returns an instance of CacheValidity class, according to sitemap parameter Cache-Control it returns a null value (no-cache), an ExternalCacheValidity (External) or a NOPCacheValidity (NOP).
  • public void recycle(), called by Avalon Component Manager when this generator is no longer valid, frees all the resources.
  • public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par), receives all the information needed to make an stored procedure call. At this point DBPrismGenerator creates a private thread (Delayer) which calls to DBPrism engine with the information of the corresponding stored procedure, then the time involved into the execution is parallelized with other calls, this optimization reduces the total execution time when you use Cocoon Content Aggregation.
  • public void generate(), with this method Cocoon engine will collect the generated XML, DBPrismGenerator first wait until the execution of the stored procedure finish and then execute the method engine.getPage(req) which gets the generated XML page in the database side and is transformed to SAX events by the parser (parser.parse(new InputSource(...));). Before parsing the generated page it calls the method showPage which analizes the header finding Cookies definitions, authorization response and so on.


Setup

DBPrismGenerator requires configuration into the Cocoon's configurations files. These files are sitemap.xmap, cocoon.xconf and user.roles, the last two files contains confguration for the External Cache Invalidator Server, but DBPrismGenerator is strongly depend on this component.

sitemap.xmap

In this file a new generator has been added on the generator's section, also is defined the pipelines entries for the DBPrism / Cocoon applications. Here an example of an sitemap.xmap file mounted as sub-sitemap using the mount point xmlj/**:

<?xml version="1.0"?>

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

<!-- =========================== Components ================================ -->

 <map:components>

  <map:generators default="dbprism">
   <!-- ======================= DBPrism 2.0.1-production Generator 
        ========================== -->
   <map:generator  name="dbprism" src="com.prism.DBPrismGenerator" 
                   logger="sitemap.generator.dbprism"    label="content,data"
                   properties="/WEB-INF/prism.properties"/>

   .... other components here ....
   
 </map:components>

<!-- =========================== Pipelines ================================= -->

 <map:pipelines>
  <map:pipeline>

   <!-- ================  DBPrism 2.0.1-production begin here  
        =========================== -->
   <map:match pattern="">
    <map:redirect-to uri="DEMOj.startup"/>
   </map:match>

   <map:match pattern="DEMOj.list*">
    <map:generate src="/xmlj/DEMOj.list{1}"/>
    <map:transform src="stylesheets/query.xsl"/>
    <map:serialize type="html"/>
   </map:match>

   <map:match pattern="DEMOj.excel">
    <map:generate src="/xmlj/DEMOj.excel"/>
    <map:transform src="stylesheets/excel.xsl"/>
    <map:serialize type="excel"/>
   </map:match>

   <map:match pattern="icons/*.gif">
    <map:read src="icons/{1}.gif" mime-type="image/gif"/>
   </map:match>

   <map:match pattern="**">
    <map:generate src="/xmlj/{1}"/>
    <map:transform src="stylesheets/simple-page2html.xsl"/>
    <map:serialize type="html"/>
   </map:match>

  <!-- ================  DB Prism 2.0.1-production end here  
       =========================== -->
  </map:pipeline>

 </map:pipelines>

</map:sitemap>

In this example, the generator entry defines the implementation class for the DBPrismGenerator (src="com.prism.DBPrismGenerator"), the short name for it (name="dbprism"), and the properties file location (properties="/WEB-INF/prism.properties") which is relative to the context root of the servlet engine.

NoteA relative location for the properties file is new since DBPrism 2.0.0-alpha1, it mean that this properties file is located relative to context root of the application resource. For example dbprism.ear is expanded by the oc4j container in a directory $OC4J_HOME/applications/dbprism/dbprism, this directory is the context root, then properties="/WEB-INF/prism.properties" means that the phisical location will be $OC4J_HOME/applications/dbprism/dbprism/WEB-INF/prism.properties .

<map:match> section defines an special mount point for the example. In this example every url starting at xmlj/** will be generated by the generator dbprism (DBPrismGenerator) passing as argument the url rewrited by the regular expresion /xmlj/{1}, that is, for an url http://localhost:8888/dbprism/xmlj/DEMOj.hello?arg=xx DBPrismGenerator will execute the stored procedure hello of the package DEMOj with the argument arg=xx, the DAD (which defines the database connection information) is defined in the prism.properties file and is located by the name xmlj (first path of the url following the context mount point /dbprism). The xml returned by the execution of the stored procedure is tranformed by the stylesheet simple-page2html.xsl and the output is serialized to html.




Last Update: 2003-08-07 09:43:19.0| webmaster@dbprism.com.ar
Search | Use AltaVista (TM) query syntax<<
Quick Links<<
(C) 2003 - DBPrism ~ DBPrism CMS | Marcelo F. Ochoa | TANDIL ~ Argentina