{"id":18596833,"url":"https://github.com/mbizhani/demeter","last_synced_at":"2026-05-14T12:32:35.159Z","repository":{"id":57739259,"uuid":"48447563","full_name":"mbizhani/Demeter","owner":"mbizhani","description":"A full-stack application base and container for DModule (modular application)","archived":false,"fork":false,"pushed_at":"2019-03-27T21:26:17.000Z","size":1411,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T23:41:34.262Z","etag":null,"topics":["architecture","code-generation","container","deployment","hibernate","lifecycle-management","maven-archetype","modularization","spring","wicket"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbizhani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-22T18:27:57.000Z","updated_at":"2019-12-17T10:30:35.000Z","dependencies_parsed_at":"2022-08-25T21:10:43.525Z","dependency_job_id":null,"html_url":"https://github.com/mbizhani/Demeter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbizhani%2FDemeter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbizhani%2FDemeter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbizhani%2FDemeter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbizhani%2FDemeter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbizhani","download_url":"https://codeload.github.com/mbizhani/Demeter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254538585,"owners_count":22087892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["architecture","code-generation","container","deployment","hibernate","lifecycle-management","maven-archetype","modularization","spring","wicket"],"created_at":"2024-11-07T01:25:55.649Z","updated_at":"2025-10-10T06:11:28.841Z","avatar_url":"https://github.com/mbizhani.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Demeter\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.devocative/demeter-module/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.devocative/demeter-module)\n\nThe `Demeter` project is founded based on the following requirements:\n- Modular architecture with well-defined integration\n- Each module has its own entities, services, and web parts\n- A base container with all **common** and **important** services for all modules\n- For deployment, a combination of modules can be deployed\n- Common test cases can be executed for the container and the modules\n\nSo the Demeter project is:\n- A container that finds its modules, called `DModule`, in deployment and initializes them based on the lifecycle, even the deployment, itself, is a separate module\n- Provides base services for all modules, which are\n\t- `Person` and `User` Management\n\t- `Role`, `Privileges`, and`Security` Management, and the integration with web\n\t- Background and Scheduled `Tasks`, and pushing data back to web via `WebSocket`\n\t- `File Store` Management\n\t- Layout, Menu and Page Management for web\n\t- Object `Cache` Management and UI for clearing them\n\t- Show the list of defined `config` keys, and modify them at runtime\n- Define conventions and standards for modules.\n- Define a convenient platform and ecosystem for faster `development`, `test`, and `deployment`\n- For generality, the Demeter, itself, has its own `DModule`\n\n## Architecture\nThe architecture of Demeter and a DModule is presented in the following logical component diagram:\n![Demeter Architecture](/doc/img/Demeter_Logical_Components_Relations.png)\nIn the architecture, the Demeter project is composed of four maven jar artifacts:\n- `Common`: It has all the common and necessary classes and files which are shared between modules. They are\n  - **Entities**: List of entities in DModule\n  - **Value Objects**: Based on value object pattern, they are classes that are used for data transfer\n  - **Service Interfaces**: The Spring beans' interfaces\n  - **Privileges**: A privilege is defined by `IPrivilegeKey`. For the list of privileges, an enum is defined which implements the `IPrivilegeKey` interface. So the enum has all the privilege keys.\n  - **Config Keys**: There is only one `config.properties` file for the development or deployment. So each module can have its own config keys in the file. Each config entry is `IConfigKey`, so an enum implements the `IConfigKey` interface, and the enum has all the config keys for DModule.\n  - **SQL Files**: Since each module has its own entities, it must have its own SQL change scripts that handle schema modification carefully.\n- `Service`: It implements all the service interfaces defined in `Common` artifact and whatever is necessary for the service tier.\n- `Core`: Its main class `DemeterCore` is responsible for all the lifecycle of Demeter and the deployed DModules.\n- `Web`:\n\t- As Demeter, it has Wicket's `WebApplication` class and all the necessary classes for handling web-side UI, and calling `DemeterCore.init()`\n\t- As a DModule, it has all the `DPages` and panels for its pages, forms, and lists.\n- `Module`:\n\t- Each DModule has an XML config file with all necessary information. This config file will be described later.\n\t- This artifact has direct dependencies to `Service` and `Web` with indirect one to `Common`. So it can represent the DModule.\n\n## Startup Process\nThe `DemeterCore` class goes through the following steps for startup:\n![DemeterCore Steps](/doc/img/Demeter_StartUp_Steps.png)\n\n## XML Config Files\nEach DModule has two XML config files. The first one is for Spring bean definition, which is located in the `main/resoureces` of `Service` maven artifact,\nand it is a standard Spring XML config file. Another one is DModule XML definition file, which is located in the `main/resources/dmodule` maven artifact.\nFor simplicity, a summary of Demeter's DModule XML file is presented:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\n\u003c!DOCTYPE module PUBLIC\n\t\t\"Devocative/Demeter Module\"\n\t\t\"http://www.devocative.org/dtd/demeter-module.dtd\"\u003e\n\n\u003cmodule\n\t\tshortName=\"DMT\"\n\t\tmainResource=\"org.devocative.demeter.web.DemeterDModule\"\n\t\tprivilegeKeyClass=\"org.devocative.demeter.DemeterPrivilegeKey\"\n\t\tconfigKeyClass=\"org.devocative.demeter.DemeterConfigKey\"\u003e\n\n\t\u003centities\u003e\n\t\t\u003centity type=\"org.devocative.demeter.entity.DPageInfo\"/\u003e\n\t\t\u003centity type=\"org.devocative.demeter.entity.DPageInstance\"/\u003e\n\t\t... \n\t\u003c/entities\u003e\n\n\t\u003ctasks\u003e\n\t\t\u003ctask type=\"org.devocative.demeter.service.task.SimpleDTask\"/\u003e\n\n\t\t\u003c!-- Fire at 2:00 every day --\u003e\n\t\t\u003ctask type=\"org.devocative.demeter.service.task.FileStoreDTask\" cronExpression=\"0 0 2 * * ?\"/\u003e\n\t\u003c/tasks\u003e\n\n\t\u003cdPages\u003e\n\t\t\u003cdPage type=\"org.devocative.demeter.web.dpage.PersonListDPage\"\n\t\t\ttitle=\"KEY:dPage.dmt.Person\"\n\t\t\turi=\"/persons\"\n\t\t\tinMenu=\"true\"\n\t\t\troles=\"Admin\" /\u003e\n\n\t\t\u003cdPage type=\"org.devocative.demeter.web.dpage.LoginDPage\"\n\t\t\ttitle=\"KEY:dPage.dmt.Login\"\n\t\t\turi=\"/login\"\n\t\t\tinMenu=\"false\" /\u003e\n\t\t...\n\t\u003c/dPages\u003e\n\u003c/module\u003e\n```\n\n## Environment\nA convenient environment for development is very important. To reach the goal, one maven plugin and two archetypes are developed.\nThe following picture tries to show all the components that are involved in this project.\n![Demeter Environment](/doc/img/Class_Diagram__demeter__DemeterComponent.png)\n\nAnd finally, a simple screen from the Demeter\n![Simple Demeter Screen](/doc/img/A_Simple_Demeter_Screen.png)\n\n## How to Run\nRunning Demeter project is so simple. You can execute following commands:\n```shell\ngit clone https://github.com/mbizhani/Demeter.git\ncd Demeter\nmvn clean install\ncd module\nmvn jetty:run\n```\nNow open your browser and go to this address: http://localhost:8080/ctx. The default `config.properties` uses the HSQLDB as the default database.\n\n## How to Create a DModule\nAs mentioned before, for convenience, a maven archetype is created to setup an initial DModule project. Besides, a maven plugin is used for generating simple CRUD for entities.\n\n**Note**: the generated project from archetype has a simple `Book` entity as an example.\n\nTo create an initial DModule project:\n```shell\nmvn -B archetype:generate \\\n\t-DarchetypeGroupId=org.devocative \\\n\t-DarchetypeArtifactId=dmodule-archetype \\\n\t-DarchetypeVersion=1.0 \\\n\t-DgroupId=my.pkg \\\n\t-DartifactId=store \\\n\t-Dpackage=my.pkg.store \\\n\t-DModuleName=Store \\\n\t-DModuleShortName=STR \\\n\t-Dversion=1.0-SNAPSHOT\n```\n\nNow, by executing following steps, the CRUD classes and files are generated:\n```shell\ncd store\nmvn clean install\ncd module\nmvn demeter:codegen\n```\n(Here, the codegen plugin finds data model added-changes and alerts on the screen. So the following will continue the procedure):\n```shell\nmvn demeter:codegen\ncd ..\nmvn clean install\ncd module\nmvn jetty:run\n```\n\nCalling `mvn demeter:codegen` the second time generates all the necessary classes and files. After installing the artifacts,\nin the `module` artifact calling `mvn jetty:run` will commence the Jetty web server and `Demteter` startup lifecycle.\nNow goto http://localhost:8080/ctx/books, which shows the generated list for `Book` entity. But before that, the login page is presented. The default username and password is:\n\nUsername | Password\n-------- | --------\nroot | root\n\n## How to Deploy\nSo far, a new DModule is created. It is time to deploy it as a `WAR`. Again, an archetype will come to help. The `Deploy` is a special\nDModule to package other DModules besides itself as a deployable WAR. Another advantage of this approach helps us to alter and define code for target deployment.\n\n**Note**: As said before, the common DModule has four artifacts, however the Deploy DModule just has one artifact, which is the single WAR.\n\nSo, lets create a Deploy DModule:\n```shell\nmvn -B archetype:generate \\\n\t-DarchetypeGroupId=org.devocative \\\n\t-DarchetypeArtifactId=deploy-archetype \\\n\t-DarchetypeVersion=1.0 \\\n\t-DgroupId=my.pkg \\\n\t-DartifactId=store-dpl \\\n\t-Dpackage=my.pkg.store \\\n\t-DDeploymentTarget=Store\\\n\t-Dversion=1.0\n```\n\nThe basis of deployment project is created. Its main `pom.xml` just has the dependency to demeter. Add the following dependency to `dependencies` section:\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003emy.pkg\u003cgroupId\u003e\n\t\u003cartifactId\u003estore-module\u003cartifactId\u003e\n\t\u003cversion\u003e1.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nTo verify the result before deployment, execute `mvn jetty:run` and goto http://localhost:8080/ctx. To create the WAR, execute `mvn package`. If you have a running Tomcat,\n you can upload and deploy the WAR directly to it via maven tomcat7 plugin. Just execute `mvn tomcat7:redeploy`. The configs for tomcat can be altered in the `\u003cproperties\u003e` of the pom.xml.\n\n## Projects\nProject | Homepage\n------- | --------\nDevolcano | https://github.com/mbizhani/Devolcano\nDModuleArchetype | https://github.com/mbizhani/DModuleArchetype\nDeployArchetype | https://github.com/mbizhani/DeployArchetype\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbizhani%2Fdemeter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbizhani%2Fdemeter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbizhani%2Fdemeter/lists"}