CMS |
 |
|
How DBPrism CMS is integrated with Cocoon Cache System for accelerating dynamic content generation |

- A client browser sent a request to DBPrism CMS like this
http://localhost/dbprism/doc/Home.html, this request is routed to an Apache
WebServer, for example, which is listening into the default port (80).
- The Apache WebServer is configured with mod_proxy to route every url starting at
/dbprism/ to a Servlet container listening on the port 8888. mod_proxy rewrites
the previous one url to a new url like this http://localhost:8888/dbprism/doc/Home.html.
- In this example an OC4J is configured with the dbprism.ear application
file which defines the mount point /dbprism/ with an instance of Cocoon.
-
OC4J pass the url to zone interpreted by Cocoon, Cocoon receives an
url without the mount point (/dbprism/), that is /doc/Home.html. At this
point Cocoon check for this page in his own cache and if the page is valid
return the cached version, if not executes the steps 5 and 6.
- Based on the sitemap.xmap definition Cocoon resolves the url /doc/Home.html
as a content generated by DBPrism, then DBPrism receives a request for an
stored CMS page named /Home.html, note that doc was extracted
because is used as DAD information (information for connecting to the
database such as username, password, connect string and so on).
- A CMS stored procedure is executed to retrieve the specific page (/Home.html)
and the page is returned to DBPrism engine, then the page returns in
the inverted path passing to Cocoon (which formats the page and stores it in
his Cache System), OC4J and Apache, finishing in the client browser.
- At this point a Content Writer (like me) writes a new version of the document
/Home.xml (CMS version of /Home.html), and upload it with the CMS Upload
Utility or with JDeveloper using CMS Addin utility.
- The table CONTENT which stores the XML document has
a trigger after update which sends an http message to the Cocoon engine
invalidating the cached content.
The invalidation message is sent to the Container directly (not through Apache)
and Cocoon routes the url /dbprism/x-dbprism-cache-invalidate to
an XSP page which parses this message and contacts the DBPrism External
Invalidator Server to mark the page /doc/Home.html as no longer valid.
Note that the post message includes an username and password encode in
a Base64 form. An example of invalidation message is showed below. After
this step a new request comming from the client browser will be routed following
the steps 4,5 and 6.
|
These triggers are implemented on webcache.sql file, the purpose of
these triggers is to control the cache coherence betwen
Cocoon External Cache Invalidator Server
and the content of the CMS tables.
This trigger is fired when a Content Writer updates information on the table PAGES
which affects information on the page header, such as the author name, modification date
and so on.
 |  |  |
 |
CREATE OR REPLACE TRIGGER CMS_PAGES_HEADER_TRIG
AFTER UPDATE
of longname,comments,meta,language,deleted,printable_version,
name,parent,path
on pages
for each row
DECLARE
par cache.cache_parameters;
BEGIN
/* This triggers invalidate Cocoon's cms/sitemap.xmap entry:
<map:match pattern="header/**.xml">
<map:generate type="db" src="/header/{1}.xml">
<map:parameter name="Cache-Control" value="External"/>
<map:parameter name="printable" value="no"/>
<map:parameter name="top" value="10"/>
</map:generate>
<map:serialize/>
</map:match>
*/
par.num_vals := 2;
par.names(1) := 'printable';
par.names(2) := 'top';
par.vals(1) := 'no';
par.vals(2) := '10';
-- invalidates new neighbors
cache.invalidate('cachehost',8888,'/header'||:new.path,'.*\.xml$',par);
-- invalidates old neighbors including old location of this page
if :new.path <> :old.path then
cache.invalidate('cachehost',8888,'/header'||:old.path,'.*\.xml$',par);
end if;
-- register id_page,parent for post chech trigger
pagesPak.g_id_page := :new.id_page;
pagesPak.g_parent := :new.parent;
pagesPak.g_old_id_page := :old.id_page;
pagesPak.g_old_parent := :old.parent;
END;
/
CREATE OR REPLACE TRIGGER CMS_PAGES_HEADER_POST_TRIG
AFTER UPDATE ON PAGES
DECLARE
par cache.cache_parameters;
v_name pages.name%TYPE;
v_path pages.path%TYPE;
begin
par.num_vals := 2;
par.names(1) := 'printable';
par.names(2) := 'top';
par.vals(1) := 'no';
par.vals(2) := '10';
if pagesPak.g_parent is not null then
-- invalidate new parent
select name,path into v_name,v_path from pages where id_page=pagesPak.g_parent;
cache.invalidate('cachehost',8888,'/header'||v_path,v_name||'\.xml$',par);
end if;
if pagesPak.g_old_parent is not null then
-- invalidate old parent
select name,path into v_name,v_path from pages where id_page=pagesPak.g_old_parent;
cache.invalidate('cachehost',8888,'/header'||v_path,v_name||'\.xml$',par);
end if;
end;
|  |
 |  |  |
|
RELATED_I_INVALID_TRIG and RELATED_D_INVALID_TRIG |
These two triggers checks the cache coherence betwen the tables which stores
Related Pages and the header information affected by the change (insert/delete).
 |  |  |
 |
CREATE OR REPLACE TRIGGER RELATED_I_INVALID_TRIG
AFTER INSERT on RELATED
for each row
DECLARE
par cache.cache_parameters;
v_path PAGES.PATH%TYPE;
v_name PAGES.NAME%TYPE;
BEGIN
/* This triggers invalidate Cocoon's cms/sitemap.xmap entry:
<map:match pattern="header/**.xml">
<map:generate type="db" src="/header/{1}.xml">
<map:parameter name="Cache-Control" value="External"/>
<map:parameter name="printable" value="no"/>
<map:parameter name="top" value="10"/>
</map:generate>
<map:serialize/>
</map:match>
when a new related information is stored.
*/
par.num_vals := 2;
par.names(1) := 'printable';
par.names(2) := 'top';
par.vals(1) := 'no';
par.vals(2) := '10';
select path,name into v_path,v_name from pages where id_page=:new.rl_id_page_from;
cache.invalidate('cachehost',8888,'/header'||v_path,v_name||'\.xml$',par);
END;
/
CREATE OR REPLACE TRIGGER RELATED_D_INVALID_TRIG
AFTER DELETE on RELATED
for each row
DECLARE
par cache.cache_parameters;
v_path PAGES.PATH%TYPE;
v_name PAGES.NAME%TYPE;
BEGIN
/* This triggers invalidate Cocoon's cms/sitemap.xmap entry:
<map:match pattern="header/**.xml">
<map:generate type="db" src="/header/{1}.xml">
<map:parameter name="Cache-Control" value="External"/>
<map:parameter name="printable" value="no"/>
<map:parameter name="top" value="10"/>
</map:generate>
<map:serialize/>
</map:match>
when a new related information is stored.
*/
par.num_vals := 2;
par.names(1) := 'printable';
par.names(2) := 'top';
par.vals(1) := 'no';
par.vals(2) := '10';
select path,name into v_path,v_name from pages where id_page=:old.rl_id_page_from;
cache.invalidate('cachehost',8888,'/header'||v_path,v_name||'\.xml$',par);
END;
|  |
 |  |  |
|
|
|
|
|
|