How Healdan Extends LogicalDOC
How Healdan Extends LogicalDOC
Healdan is a fork of LogicalDOC Community Edition 9.3.1. It goes its own way, but still merges upstream’s fixes, so its own work stays out of upstream’s files wherever it can.
LogicalDOC’s Modules
logicaldoc-utilis at the bottom, andlogicaldoc-corebuilds on it.- The feature modules build on core:
logicaldoc-webservice(SOAP through CXF, and REST),logicaldoc-webdav,logicaldoc-cmis,logicaldoc-dropbox,logicaldoc-androidandlogicaldoc-ios. logicaldoc-webappis the WAR that bundles everything.logicaldoc-guiis the GWT client, and depends only on util.logicaldoc-i18nholds the message bundles.
Plugins
Almost every module is a JPF plugin, and a plugin takes four pieces:
src/main/resources/plugin.xmldeclares its id, what it needs, and the extensions it adds.- A class extending
com.logicaldoc.util.plugin.LogicalDOCPlugincan register servlets, scheduled tasks and loggers when the plugin installs. src/main/assembly/assemblyplugin.xmlpackages a*-plugin.zip.- An
artifactIteminlogicaldoc-webapp/pom.xmlcopies the zip into the WAR. Without it, the plugin isn’t shipped.
Core’s plugin.xml defines the extension points other plugins hook into, such as DbInit, DocumentListener,
FolderListener, Task, Feature and SystemInfo. logicaldoc-dropbox is the smallest complete plugin to
learn from.
Spring and Hibernate
web.xmlstartscom.logicaldoc.util.spring.MainContext. It scanscom.logicaldocfor@PluginContextclasses and imports the webapp’scontext.xml, which defines the datasource, the session factory and transactions.- Entities are JPA-annotated
@Entityclasses. DAOs follow one pattern: an interfaceXxxDAOand an implementationHibernateXxxDAO. - Both Spring and Hibernate scan only
com.logicaldoc, so code in any other package isn’t found.
Healdan’s Code
healdan-coreis Healdan’s plugin. It holds Healdan’s server rules and all its data, undercom.logicaldoc.healdan, where the scans find it with no edits.- Its GUI code is in
logicaldoc-gui, undercom.logicaldoc.gui.frontend.client.healdan, reached from one-line hooks in upstream’s GUI classes. - Its servlets register with
@WebServlet. Its RPC paths are/frontend/healdan*and its data paths/data/healdan*. - Its listeners enforce Healdan’s rules on every route into the server: the web UI, the API, WebDAV and CMIS.
- Its GUI code is in
- Its own tables. Flyway owns the tables whose names start
hd_, and only those. A change ships as a new script underhealdan-core/src/main/resources/healdan/db/migration/, never as an edit to one that has shipped. Healdan never changes the structure of LogicalDOC’sld_tables. - One-time setup steps in
com.logicaldoc.healdan.seedcreate what Healdan needs inside LogicalDOC, such as the Everyone group and the Healdan profile. Each records that it ran inhd_setting, and never runs again, so a new default ships as a new step. HealdanHooksinlogicaldoc-corelets the few places in LogicalDOC that write without telling its listeners ask Healdan first. Every refusal throwsHealdanVetoException, which the document and folder DAOs roll back on.- Upstream edits are kept small, and each milestone’s design spec lists every upstream file it edits, with the reason.