...| Home | Cocoon...
DBPrism - Apache Cocoon > External Cache Invalidator Server interface >

+ 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
 
External Cache Invalidator Server interface
Definition:

The External Cache Invalidator Class implements a new modality for Cocoon2's cache System. It provides a new way to invalidate cached pages stored into Cocoon cache system with a simple external message interpreted by an XSP page. It mean that you could generate a dynamic page with DBPrism or with an XSP page and stored it into the Cocoon Cache system, this page will remaind valid into the cache until an XML message says to this server implementation that the stored page is no longer valid, a this point Cocoon will generate a new one. This kind of synchronization is commonly implemented through triggers into the database that provides the information for the dynamic page. For a practical example of these triggers look at the CMS Trigger Sections.


This interface defines a role for every possible implementation of an External Cache Invalidator Server functionality. It defines a role for the Avalon roles, and it also needs to modify cocoon.roles file included into cocoon.jar or user.roles file, here the sample entry.

<role name="org.apache.cocoon.components.cache.Server"
                       shorthand="cache-server"
                       default-class="org.apache.cocoon.components.cache.DatabaseServerImpl"/>

Note DatabaseServerImpl class is a concrete class which implements the defined contract using HSQL database for storing the cached pages metadata, other implementation could be added in a short future providing faster implementation for accessing and invalidating higher amount of cached pages.

Methods:
  • public boolean isRegistered(ESIKey key), Returns true or false if the key argument is register as a Cached Page.
  • public long getCacheablePageKey(ESIKey key), Returns a long value used by Cocoon's cache system to locate a Cached Page.
  • public void registerCacheablePage(ESIKey key), Registers a Cached Page, this page is identified by an ESIKey object which holds the URL for this page, his encoded argument and the long value used by Cocoon's cache system to identified the cached page.
  • public int removeCacheablePage(String username, String password, String URI, String URIRegExp, ESIKey key, int ttl), Removes a previous cached page identified by the URI path, the URIRegExp regular expresion and the encoded arguments, it requires a valid username and password to access to the cache server. This method do not remove automatically the page, it stores the ESIKey into a queue of pages to invalidate, this queue is cheked every 1 second by default. See DatabaseServerImpl section for more details. ttl (or time-to-live) value is reserved for future use. URI is a base path for the page(s) to be remove. URIRegExp is a regular expresion used for matching with the page(s) to remove
Note about URI and URIRegExp:

URI       = /p1/p2/p3/ and
URIRegExp = ^/p1/p2/p3/file.htm$ or
URI       = / and
URIRegExp = ^/p1/p2/p3/file.htm$
match with the same page    /p1/p2/p3/file.htm.
Since the regular expression is done against the set of page objects containing
the common URIPREFIX path prefix, it is obvious that the smaller the set,
the more efficient the invalidation.
        

Constants
  • ROLE, Defines Avalon Role for this server.
  • NONE, EXTERNAL, NOP, Used by DBPrismGenerator to identified three kind of cacheability rules. None means that the page is no cacheable, External means that the page is controled by the External Cache Invalidator Server and the method generateValidity() will return an instance of ExternalCacheValidity object, NOP means that the page is cacheable and will remains in the Cocoon cache during the life of Cocoon instance (generateValidity() will return an object of type NOPCacheValidity).
  • COPY_ARG_NAME, Used by the CocoonRequestWrapper to merge the standard servlet http request arguments with the sitemap arguments.
  • COPY_NO and COPY_YES, Special values used into Copy-Request-Arguments, false mean that only pass DBPrismGenerator sitemap parameters, true mean that all the http arguments and cookies are passed to the DBPrismGenerator.
  • CACHE_CONTROL_ARG_NAME, Its the name on the sitemap argument that defines the cacheability behaviour on DBPrismGenerator.
  • CACHE_CONTROL_EXTERNAL, CACHE_CONTROL_NOP, CACHE_CONTROL_NONE, Values defined for the previous one argument on the sitemap syntax.


ESI Ivalidation Messages

These examples shows invalidation request for doing ESI invalidation of cached page documents. An invalidation request is an XML document sent over HTTP using HTTP/1.1 POST method. The syntax for an invalidation request is dictated by WCSinvalidation.dtd DTD (Document Type Definition).

This XSP Page listens for incomming request of invalidation pages, and contacts the Invalidator Server instance invalidating the given page.

NoteDBPrism External Cache Invalidator XSP page uses ESI Advanced Selector for invalidating Cocoon pages, to define parameters either sitemap parameter or http parameter uses tags of type OTHER, selecting sitemap or http values for the attribute type.

Basic Selector Example

This selector shows how to invalidate an XSP page which includes the necesary code to register this page as External Invalidated.

POST /dbprism/x-dbprism-cache-invalidate HTTP/1.0
Authorization: BASIC aW52YWxpZGF0b3I6aW52YWxpZGF0b3I=
Content-Length: 213

<?xml version="1.0"?>
<INVALIDATION VERSION="WCS-1.0">
  <OBJECT>
    <BASICSELECTOR URI="/ext/xsp/simple_ext"/>
    <INFO VALUE="simple_ext.xsp"/>
    <ACTION REMOVALTTL="0"/>
  </OBJECT>
</INVALIDATION>

NoteIf you press reload button on the browser bar, the botton part of the page will never change until you sent the above invalidation message,

Noteid_user is used as customization argument, it means that Cocoon will stored differents pages for every different argument value of id_user. The above invalidation message will invalidate all the pages independent of the customization argument.

Here a sequence of unix commands using the simple telnet program to contact Cocoon's External Invalidator Server and invalidating the previous one XSP page.

[oracle8i@p1 dbprism]$ telnet localhost 8888                      
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
POST /dbprism/x-dbprism-cache-invalidate HTTP/1.0
Authorization: BASIC aW52YWxpZGF0b3I6aW52YWxpZGF0b3I=
Content-Length: 213

<?xml version="1.0"?>
<INVALIDATION VERSION="WCS-1.0">
  <OBJECT>
    <BASICSELECTOR URI="/ext/xsp/simple_ext"/>
    <INFO VALUE="simple_ext.xsp"/>
    <ACTION REMOVALTTL="0"/>
  </OBJECT>
</INVALIDATION>
HTTP/1.1 200 OK
Date: Fri, 04 Jul 2003 12:33:31 GMT
Server: Oracle9iAS (9.0.3.0.0) Containers for J2EE
Connection: Close
Content-Type: text/html
X-Cocoon-Version: 2.0.4

<INVALIDATIONRESULT VERSION="WCS-1.0" xmlns:xsp="http://apache.org/xsp">





<OBJECTRESULT>
<BASICSELECTOR URI="/ext/xsp/simple_ext"></BASICSELECTOR>
<RESULT ID="0" STATUS="SUCCESS" NUMINV="2"></RESULT>
</OBJECTRESULT>

</INVALIDATIONRESULT>
Connection closed by foreign host.
[oracle8i@p1 dbprism]$
Advanced Selector Example
POST /dbprism/x-dbprism-cache-invalidate HTTP/1.0
Authorization: BASIC aW52YWxpZGF0b3I6aW52YWxpZGF0b3I=
Content-Length: 450

<?xml version="1.0"?>
<INVALIDATION VERSION="WCS-1.0">
  <OBJECT>
    <ADVANCEDSELECTOR URIPREFIX="/ext/xsp/" URIEXP="simple_ext">
      <OTHER TYPE="sitemap" NAME="test_param1" VALUE="test1"/>
      <OTHER TYPE="sitemap" NAME="test_param2" VALUE="test2"/>
      <OTHER TYPE="http" NAME="id_user" VALUE="user1"/>
    </ADVANCEDSELECTOR>
    <INFO VALUE="simple_ext.xsp?id_user=1"/>
    <ACTION REMOVALTTL="0"/>
  </OBJECT>
</INVALIDATION>

The above example will invalidate the XSP page /ext/xsp/simple_ext located under the path /ext/xsp/, only if the sitemap and http parameters match with the values provided, in this example, if the personalized attribute was id_user, pages with id_user not equal to user1 will remains valid into the cache system.


Advanced Selector Example, using regular expresions
POST /dbprism/x-dbprism-cache-invalidate HTTP/1.0
Authorization: BASIC aW52YWxpZGF0b3I6aW52YWxpZGF0b3I=
Content-Length: 392

<?xml version="1.0"?>
<INVALIDATION VERSION="WCS-1.0">
  <OBJECT>
    <ADVANCEDSELECTOR URIPREFIX="/ext/xsp/" URIEXP="simple.*">
      <OTHER TYPE="sitemap" NAME="test_param1" VALUE="test1"/>
      <OTHER TYPE="sitemap" NAME="test_param2" VALUE="test2"/>
    </ADVANCEDSELECTOR>
    <INFO VALUE="all_simple_under_ext_xsp"/>
    <ACTION REMOVALTTL="0"/>
  </OBJECT>
</INVALIDATION>

The above example will invalidate the content of the XSP pages that match with the regular expresion simple.* and located under the path /ext/xsp/, it means that, indepent of the personalized attribute (id_user) the pages that match with the sitemap parameters (test_param1 and test_param2) and regular expresion will be removed from the cache..




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