DatabaseServerImpl implements the interface defined by
External Cache Invalidator Server. It implements
his functionality using HSQL
in memory database for storing cached pages metadata.
It mainly uses two tables for storing the metadata, these tables are defined by the
following SQL commands:
| | |
|
create table esi_pages (id identity,
path varchar(4000),
source varchar(4000),
key bigint,
args varchar(30));
create unique index esi_pages_idx on esi_pages(source,args);
create index esi_pages_path_idx on esi_pages(path);
create table esi_args (id_page integer,
name varchar(255),
val varchar(4000),
CONSTRAINT args_pg_fk FOREIGN KEY (id_page)
REFERENCES esi_pages(id) ON DELETE CASCADE);
create unique index esi_args_idx on esi_args(id_page,name,val);
grant all on class 'org.apache.cocoon.util.HSQLDBLibrary' to public;
create alias RegMatch FOR 'org.apache.cocoon.util.HSQLDBLibrary.REMatch';
| |
| | |
|
DBPrism adds to HSQL DB engine a new SQL function to process regular expresions
on the database columns. This function, RegMatch takes two
arguments, the first argument is an Apache RegExp string and the other the column
value. It returns 1 or 0 if match or not.
|
Argument provides by cocoon.xconf |
-
jdbcDriver,
By default org.hsqldb.jdbcDriver, defines the JDBC driver
used to connect to database engine.
-
connectString,
By default jdbc:hsqldb:., defines the JDBC URL used to
locate the database repository, it uses in memory location, see HSQL
documentation for more detail.
-
username,
By default sa, usuario used to connect to the database.
-
password,
By default an empty string, password used to connect to the database.
-
invalidator-user,
user name used for authorization purpose of the invalitation message.
-
invalidator-pass,
password used for authorization purpose of the invalitation message.
-
Cleanup-Thread-Interval,
seconds betwen every checking of invalitation queue.
|
user.roles example:
| | |
|
<?xml version="1.0"?>
<!DOCTYPE role-list [
<!ELEMENT role-list (role+)>
<!ELEMENT role (hint*)>
<!ELEMENT hint EMPTY>
<!ATTLIST role name CDATA #REQUIRED
shorthand CDATA #REQUIRED
default-class CDATA #IMPLIED
>
<!ATTLIST hint shorthand CDATA #REQUIRED
class CDATA #REQUIRED
>
]>
<role-list>
<role name="org.apache.cocoon.components.cache.Server"
shorthand="cache-server"
default-class="org.apache.cocoon.components.cache.DatabaseServerImpl"/>
</role-list>
| |
| | |
cocoon.xconf
| | |
|
<?xml version="1.0"?>
<cocoon version="2.0" user-roles="/user.roles">
.....
<!-- ESI Invalidation protocol support:
InMemoryServerImpl parameters:
initialCapacity : number Value for HashMap store
loadFactor : number Value for HashMap store
DatabaseServerImpl (HSQLDB) parameter:
jdbcDriver : JDBC Driver for the repository
connectString : JDBC connect string
username : database username
password : database password
Common parameters:
invalidator-user : user name used for invalidation purpose
invalidator-pass : password used for invalidation purpose
Cleanup-Thread-Interval: number of seconds betwen checking the inv. queue
-->
<cache-server class="org.apache.cocoon.components.cache.DatabaseServerImpl"
pool-max="1" pool-min="1"
logger="core.cache-server">
<parameter name="jdbcDriver" value="org.hsqldb.jdbcDriver"/>
<parameter name="connectString" value="jdbc:hsqldb:."/>
<parameter name="username" value="sa"/>
<parameter name="password" value=""/>
<parameter name="invalidator-user" value="invalidator"/>
<parameter name="invalidator-pass" value="invalidator"/>
<parameter name="Cleanup-Thread-Interval" value="1"/>
</cache-server>
.....
</cocoon>
| |
| | |
| Due to an internal bug
( 704637)
on HSQL source, DBPrism CMS includes a patched version of HSQL.
Do not use public released of HSQL until its fixed.
|
|