Home > EBX.Platform Module
EBX.Platform Module
An EBX.Platform module allows the packaging of an adaptation model with its resources: included XML Schema documents, Java classes, etc.
On a J2EE application server, an EBX.Platform module is equivalent to a standard J2EE Web application. This provides features such as class-loading isolation, WAR or EAR packaging, Web resources exposition, hot-redeployment. In addition, if your user application is a Web application, it is possible to merge the EBX.Platform module with your application, in order to simplify the deployment.
Structure
An EBX.Platform module contains the following files:
-
/WEB-INF/web.xml:This is the standard J2EE deployment descriptor. It must ensure that the EBX.Platform module is registered when the application server is launched (see Registration section ).
-
/WEB-INF/ebx/module.xml:This mandatory document defines the main properties and services of the module.
-
/www/:This optional directory contains all external resources (accessible by a public URL). This directory is optional, localized and structured by resource type (html, images, jscripts, stylesheet). External resources in this directory can be referenced in adaptation models (type
osd:resource).
Overview of an EBX.Platform module integrated into a Web application:

Declaration
A module is declared by means of the document
/WEB-INF/ebx/module.xml . For example:
<module xmlns="urn:ebx-schemas:module_2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ebx-schemas:module_2.2 http://schema.orchestranetworks.com/module_2.2.xsd">
<name>moduleTest</name>
<locales>
<locale isDefault="true">it</locale>
<locale>en-US</locale>
</locales>
</module>
The associated schema provides a documentation on each property. Here is a summary of the main ones:
|
Element |
Description |
Required |
|
|
Defines the unique identifier of the module on the server instance. The module name usually corresponds to the Web application's name (the name of the directory). |
Yes. |
|
|
If a specific path (different from the above module's name) identifies the web application in the public URLs, defines this path. This path is added to the URL of an external resource of the module, in the case of absolute URL computing. If this field is not present, the public path is the module's
|
No. |
|
|
Defines the locales supported by the schema(s) of the module. This list must contain all the locales that can be found in the schemas within the module, and that we want to expose to the end user (EBX.Manager will not be able to display labels and messages in a language that is not declared in this list). If the element is not present, the module's default localization is considered to be "en-US". |
No. |
|
|
Declares the UI Services. For more information, see UI Services section . |
No. |
|
|
Declares the reusable Java beans components. For more information, see workflow package . |
No. |
Registration
In order to be identified by EBX.Platform, a module must be registered at runtime, when the application server is launched. For a Web Application, every EBX.Platform module must:
-
contain a Servlet whose standard method
initinvokesModulesRegister.registerWebApp(…), see Java code example at the end of this section; -
declare this servlet in the deployment descriptor
/WEB-INF/web.xml, in the standard way; -
ensure that this servlet will be launched at server startup by adding the following standard element to the deployment descriptor:
<load-on-startup>1</load-on-startup>.
Example of a J2EE deployment descriptor (
/WEB-INF/web.xml file):
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<servlet>
<servlet-name>InitEbxServlet</servlet-name>
<servlet-class>com.foo.RegisterServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
</web-app>
Notes:
-
If Java classes are located in the Web application (in
/WEB-INF/classesor/WEB-INF/lib) and these classes are used as resources of the schemas in the module, it is mandatory that the specific servlet class also be located in the Web application (the reason is that the servlet class is internally used as a hook to the application's class-loader). -
It is recommended that the servlet also implements the method
destroy(), otherwise the "stop" of the web application will not work.Once the method
ModulesRegister.unregisterWebApp()has been executed, the schemas and the adaptations that depend on it become unavailable.Hence EBX.Platform supports hot-deployment and hot-redeployment operations that are implemented by J2EE application servers: deployment-start, stop-restart, stop-redeployment-restart, stop of a Web Application. However, these operations remain sensitive, more particularly concerning class-loading and potential complex dependencies, consequently these operations must be followed carefully.
-
All modules' registrations and unregistrations are logged to 'log.kernel' category.
-
If an exception occurs while loading a module, the cause of the error is written in the application server log.
Java code example of a servlet that registers/ unregisters the module to/from EBX.Platform:
import javax.servlet.*;
import javax.servlet.http.*;
import com.onwbp.base.repository.*;
/**
*/
public class RegisterServlet extends HttpServlet
{
public void init(ServletConfig config) throws ServletException
{
super.init(config);
ModulesRegister.registerWebApp(this, config);
}
public void destroy()
{
ModulesRegister.unregisterWebApp(this, this.getServletConfig());
}
}
Home > EBX.Platform Module