CMS General Plugins (version 1.1)

CMS General Plugins is a library (.jar library) that contains a set of common plugins to customize the CMS deployment.

The following plugins are part of this library:

To run a Webpagebytes CMS application on a single server (for example a local test environment), the plugins from this library are all that is needed.

Installation

To install this library, a dependency needs to be added to the web application. The plugin is published in Maven Central repository.

<dependency>
    <groupId>com.webpagebytes.plugins</groupId>
    <artifactId>wpb-general-plugins</artifactId>
    <version>1.1</version>
</dependency>

Details about how each plugin from the library is installed and configured are provided below.

Local in memory cache plugin

Webpagebytes CMS engine uses a cache (instance of WPBCacheFactory interface) to store the content data and metadata in order to optimize the content delivery. The local in memory cache plugin stores the content data and metadata in the local JVM process memory.

In case the web application integrated with Webpagebytes CMS needs to run on a single computer then this plugin is the best choice.

To install the plugin the following configuration needs to be added to the Webpagebytes CMS configuration xml.

<wpbconfiguration>
...
    <wpbcache>    
        <factoryclass>com.webpagebytes.plugins.WPBLocalCacheFactory</factoryclass>
        <params>
        </params>
    </wpbcache>
...
</wpbconfiguration>

Distributed cache plugin based on Memcached

Webpagebytes CMS engine uses a cache (instance of WPBCacheFactory interface) to store the content data and metadata in order to optimize the content delivery. The distributed cache plugin uses Memcached to store the cache fingerprints, when a content record will change the cache fingerprint will change too thus triggering a cache refresh.

In case the web application integrated with Webpagebytes CMS needs to be deployed on a cluster then this plugin can be used.

To install the plugin the following configuration needs to be added to the Webpagebytes CMS configuration xml.

<wpbconfiguration>
...
    <wpbcache>
        <factoryclass>com.webpagebytes.plugins.WPBMemCacheFactory</factoryclass>
        <params>
            <param name="memcache_servers" value="192.168.0.100:11211  192.168.0.101:11211" />
        </params>
    </wpbcache>
...
</wpbconfiguration>

Local files storage plugin

Webpagebytes CMS engine uses a files storage (instance of WPBFileStorage interface) to store and retrieve files used in the content delivery. The local files storage plugin stores the files content on the local disk.

In case the web application integrated with Webpagebytes CMS needs to run on a single computer then this plugin is a good choice.

To install the plugin the following configuration needs to be added to the Webpagebytes CMS configuration xml.

<wpbconfiguration>
...
    <wpbfilestorage>	    
        <factoryclass>com.webpagebytes.plugins.WPBLocalFileStorage</factoryclass>
        <params>
             <param name="dataDirectory" value="/etc/myapp/storage"/>
        </params>         
    </wpbfilestorage>
...
</wpbconfiguration>

The plugin requires a local exsting directory with read/write permissions that is specified in the dataDirectory parameter.

Data storage plugin for SQL like databases

Webpagebytes CMS engine uses a data storage (instance of WPBAdminDataStorage interface) to store/retrieve content and metadata used to produce the content to be delivered. The data storage plugin for SQL like databases uses relational databases like (MySQL, Oracle, SQL Server) for content store and retrieval.

To install the plugin the following configuration needs to be added to the Webpagebytes CMS configuration xml.

<wpbconfiguration>
...
    <wpbadmindatastorage>
        <factoryclass>com.webpagebytes.plugins.WPBSQLAdminDataStorage</factoryclass>
        <params>
                <param name="driverClass" value="com.mysql.jdbc.Driver" />
                <param name="connectionUrl" value="jdbc:mysql://mysql_server_ip:3306/dbname" />
                <param name="userName" value="user" />
                <param name="password" value="" />
                <param name="testOnBorrow" value="true" />
                <param name="validationQuery" value="SELECT 1" />
        </params>
    </wpbadmindatastorage>
...
</wpbconfiguration>

The plugin uses Apache Commons DBCP framework to connect to the relational database. The plugin configuration parameters have the same meaning as the ones from DBCP framework configuration.

Local authentication plugin

The local authentication plugin implements WPBAuthentication interface with the scope to offer an example of how authentication can be integrated in Webpagebytes CMS framework. This authentication plugin should not be used in production.

To install the plugin the following steps are needed:

Step 1. Configure the plugin in the CMS configuration xml file
The Webpagebytes CMS configuration xml file needs to contain an wpbauthentication element.

<wpbauthentication>
    <factoryclass>com.webpagebytes.plugins.WPBAuthentication</factoryclass>
</wpbauthentication> 

Step 2. Configure the login, logout and profile urls
The web application will need to have dedicated urls and web pages for login, logout and profile. The plugin contains servlets implementations for login, logout and profile functionalities.
The web application web.xml needs to contain the following servlets.

<servlet>
    <servlet-name>login</servlet-name>
    <servlet-class>com.webpagebytes.plugins.WPBLocalAuthLoginPage</servlet-class>
</servlet>  
<servlet-mapping>
<servlet-name>login</servlet-name>
    <url-pattern>/myadmin/login</url-pattern>
</servlet-mapping>
<servlet>
    <servlet-name>logout</servlet-name>
    <servlet-class>com.webpagebytes.plugins.WPBLocalAuthLogout</servlet-class>
</servlet>  
<servlet-mapping>
    <servlet-name>logout</servlet-name>
    <url-pattern>/myadmin/logout</url-pattern>
</servlet-mapping>
<servlet>
    <servlet-name>profile</servlet-name>
    <servlet-class>com.webpagebytes.plugins.WPBLocalAuthProfilePage</servlet-class>
</servlet>  
<servlet-mapping>
<servlet-name>profile</servlet-name>
    <url-pattern>/myadmin/profile</url-pattern>
</servlet-mapping>

Step 3. Configure the login, logout and profile servlets
In the servlet container add a context parameter to configure the login, logout and profile servlets.

<Context>
    ...
    <Parameter name="wpbAuthLocalConfigFile" value="path_to_auth_context_config" />
    ...
</Context>
The configuration file path_to_auth_context_config needs to contain the following entries
tokenCookie=wpbToken
loginPageUrl=./login
profilePageUrl=./profile
logoutPageUrl=./logout
loginPostUrl=./login
loginRedirectSuccess=./
These urls needs to be the same as the ones defined in the application web.xml file.