diff --git a/ccm-core/src/main/java/org/libreccm/modules/package-info.java b/ccm-core/src/main/java/org/libreccm/modules/package-info.java new file mode 100644 index 000000000..aef93a0a8 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/modules/package-info.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2015 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +/** + * This package contains the basic classes for the module system of LibreCCM + */ +package org.libreccm.modules; diff --git a/src/site/apt/module-system.apt b/src/site/apt/module-system.apt index 33a904fb2..3d0af26fd 100644 --- a/src/site/apt/module-system.apt +++ b/src/site/apt/module-system.apt @@ -10,7 +10,47 @@ The module system of LibreCCM The functionality of LibreCCM is organised in modules which can bundled to serve specific needs. The bundling is done by special modules which packaged - as WAR files. A module itself is packaged as JAR file. + as WAR files. A module itself is packaged as JAR file. The module system + provides several features like automatic database migrations. - The module system provides several features like automatic database - migrations. \ No newline at end of file + We are not using OSGi here because OSGi would add another layer of + complexity. Also OSGi does to integrate well with some of the Java EE + technologies. + + The module system is build around the classes in the + {{{file:///home/jensp/pwi/libreccm/ccm/ccm_ng/target/staging/ccm-core/apidocs/index.html?org/libreccm/modules/package-summary.html}org.libreccm.modules}} package. + + When the LibreCCM application is started by the Application Server two + things will happen. First the + {{{file:///home/jensp/pwi/libreccm/ccm/ccm_ng/target/staging/ccm-core/apidocs/index.html?org/libreccm/modules/CcmIntegrator.html}CcmIntegrator}} + is executed. The integrator checks for new or updated modules and executes + DB migrations if necessary. We are using the + {{{http://www.flyway.org}Flyway}} framework for this. We have + to execute these migrations before the Application Server starts the JPA + Persistence Unit and the JPA provider validates the database structure. + Unfortunately the JPA specification does not provide a hook for doing + such things. Therefore we have to use a Hibernate specific API for that. + + Secondly the + {{{file:///home/jensp/pwi/libreccm/ccm/ccm_ng/target/staging/ccm-core/apidocs/index.html?org/libreccm/modules/CcmModuleContextListener.html}CcmModuleContextListener}} + is called when the <<>> is initialised. The + <<>> is an ordinary <<>>. + We use the new annotations (<<<@WebListener>>>) to register the listener. + The <<>> checks for new modules and executes + the <<>> method of these modules. After that for each module + the <<>> method of the module is called. When the application is + shutdown the <<>> method of each module is called. If the module + is marked for uninstall the <<>> method of the module is called + also. + + The <<>> is also called on shutdown and checks for modules + marked to be deinstalled. If there are such modules the database for the + module is cleaned by Flyway. + + The database tables for each module live in their own schema (namespace) in + the the database. This makes it easier to manage them using Flyway. Each + schema contains a <<>> table which is used by Flyway to + keep track of the migrations applied to the schema. Because MySQL and its + descendents like MariaDB implement schemas wrong (as databases) we can't + support MySQL as database for now. This kind of implementation causes + all sort of silly problems. \ No newline at end of file diff --git a/src/site/apt/testing.apt b/src/site/apt/testing.apt index 768b3e038..461cef837 100644 --- a/src/site/apt/testing.apt +++ b/src/site/apt/testing.apt @@ -40,15 +40,9 @@ Testing LibreCCM At the moment the following profiles are provided: - [wildfly8-embedded] Uses an embedded Wildfly 8 server and the integrated H2 - database- - [wildfly8-remote-h2-mem] Uses a remote Wildfly 8 application server and a in memory H2 database - [wildfly8-remote-mysql] Uses a remote Wildfly 8 application server and - a MySQL or MariaDB database. - [wildfly8-remote-pgsql] Uses a remote Wildfly 8 application server and a PostgreSQL database. @@ -61,11 +55,6 @@ Testing LibreCCM [wildfly8-remote-oracle] Will use a remote Wildfly 8 server and a Oracle database. - - [tomee17-embedded] Will use a embedded TomEE application server, version 1.7 - - [tomee17-remote-mysql] Will use a remote TomEE application server and a - MySQL/MariaDB database. [tomee17-remote-pgsql] Will use a remote TomEE application server and a PostgreSQL database. @@ -97,8 +86,6 @@ Testing LibreCCM [java:/comp/env/jdbc/org/libreccm/ccm-core/h2-mem] A in memory database using the H2 database which is part of Wildfly. - [java:/comp/env/jdbc/org/libreccm/ccm-core/mysql] MySQL database - [java:/comp/env/jdbc/org/libreccm/ccm-core/pgsql] PostgresSQL database Please note that the database is recreated after each test. Therefore