web server - Borland Technical Publications

web server - Borland Technical Publications web server - Borland Technical Publications

techpubs.borland.com
from techpubs.borland.com More from this publisher
12.11.2014 Views

Chapter 25 25Implementing Partition Interceptors Chapter Important Implementing Partition Interceptors requires the following steps: 1 Defining your interceptor using the module-borland.xml descriptor file. 2 Creating the interceptor class. 3 JARing the class and the descriptor file. 4 Deploy the JAR to the Partition of interest. For documentation updates, go to www.borland.com/techpubs/bes. Defining the Interceptor You define the interceptor by creating a module-borland.xml file. This file uses the following DTD: The element must contain the full-path class name of the implementation contained within the JAR. The element is an optional field that controls the order in which a set of interceptors for a particular Partition are fired. This value must be between 0 and 9. Priority 0 ranks before priority 9. Interceptors are fired in order during load time and in reverse order during shutdown. If two or more interceptors share the same priority, there is no way to determine or enforce which of that set will be fired relative to the other. The is an optional element which contains a pair of elements, and . These are passed into your class implementation as a java.util.HashMap. Your code must extract the appropriate values from this type. The limit on arguments is imposed by the JVM implementation. Chapter 25: Implementing Partition Interceptors 241

Creating the Interceptor Class For example, the following XML defines an interceptor called InterceptorImpl: com.borland.enterprise.examples.InterceptorImpl key1 value1 key2 value2 key3 value3 1 Creating the Interceptor Class Your class must implement: com.borland.enterprise.server.Partition.service.PartitionInterceptor The following methods are available: public void initialize(java.util.HashMap args); This method is called before any Partition services like the Tomcat container are created and initialized. This method is not subject to the parameter, since it is invoked as each interceptor is loaded. public void startupPreLoad(); This method is called after Partition services are started and before the Partition services load modules. public void startupPostLoad(); This method is invoked after all Partition services have loaded their respective modules. public void shutdownPreUnload(); This method is called before the Partition services unload their respective modules. The parameter now reverses its meaning; priority 9 interceptors are called first, then priority 8, and so forth. public void shutdownPostUnload(); This method is called after the services have unloaded their modules. public void PartitionTerminating(); This method is called after the services have been shut down, just before the Partition shuts down. 242 BES Developer’s Guide

Creating the Interceptor Class<br />

For example, the following XML defines an interceptor called InterceptorImpl:<br />

<br />

<br />

com.borland.enterprise.examples.InterceptorImpl<br />

<br />

key1<br />

value1<br />

<br />

<br />

key2<br />

value2<br />

<br />

<br />

key3<br />

value3<br />

<br />

1<br />

<br />

<br />

Creating the Interceptor Class<br />

Your class must implement:<br />

com.borland.enterprise.<strong>server</strong>.Partition.service.PartitionInterceptor<br />

The following methods are available:<br />

public void initialize(java.util.HashMap args);<br />

This method is called before any Partition services like the Tomcat container are<br />

created and initialized. This method is not subject to the parameter, since it is<br />

invoked as each interceptor is loaded.<br />

public void startupPreLoad();<br />

This method is called after Partition services are started and before the Partition<br />

services load modules.<br />

public void startupPostLoad();<br />

This method is invoked after all Partition services have loaded their respective<br />

modules.<br />

public void shutdownPreUnload();<br />

This method is called before the Partition services unload their respective modules.<br />

The parameter now reverses its meaning; priority 9 interceptors are called<br />

first, then priority 8, and so forth.<br />

public void shutdownPostUnload();<br />

This method is called after the services have unloaded their modules.<br />

public void PartitionTerminating();<br />

This method is called after the services have been shut down, just before the Partition<br />

shuts down.<br />

242 BES Developer’s Guide

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!