invesdwin / invesdwin-context

Module system for software product lines
GNU Lesser General Public License v3.0
6 stars 0 forks source link

invesdwin-context

This is the core of the lightweight module system for the invesdwin software product line platform. It allows to configure an application on a per module basis. On application startup the bootstrap process collects the configuration snippets and creates a full application context. It also handles the lifecycle of the application (providing hooks for modules) for running and testing it. Tests also benefit from the flexibility of replacing bean instances with stubs, choosing different spring-xmls to be loaded depending on the circumstances and enabling embedded servers (e.g. webserver=jetty, database=h2) on a per test basis via annotations. These embedded servers are themselves modules which are available in separate projects and can be even packaged into distributions for use in production environments where appropriate.

This platform shares some of the goals of spring-boot. In comparison this platform provides the following advantages:

For more information on the concept and ideas behind this platform you can have a look at this presentation that was made for an earlier version of this platform where Ant+Ivy+Groovy was used for configuration management. Today these concepts got adapted into a new and improved Maven implementation that provides many benefits over the older design while still keeping the same features as before. It was just the case that Maven was not where it is today when this platform first came to life, but a switch was finally made when Maven became more robust and faster.

Maven

Releases and snapshots are deployed to this maven repository:

https://invesdwin.de/repo/invesdwin-oss-remote/

Dependency declaration:

<dependency>
    <groupId>de.invesdwin</groupId>
    <artifactId>invesdwin-context</artifactId>
    <version>1.0.3</version><!---project.version.invesdwin-context-parent-->
</dependency>

Parent Pom

When setting up modules or distributions it is recommended to make invesdwin-context-parent the parent pom of your specific module/distribution pom.xml. This provides the following benefits respectively. This enables:

If you setup a product (being a collection of modules and distributions) it is recommended to create an intermediate parent pom so you can define your own additional dependency management and plugin overrides (see the granatasoft-remotelist-parent example web project here). Though you are free to roll your own parent pom where you just cherry-pick the parts that you like from the parent pom here, or do everything on your own. If you are just interested in the dependency management you can import this pom as a bill of materials. See the included test projects for some examples of the different ways of referencing invesdwin-context modules with maven.

In order to fully benefit from the module system, you should follow the best practice of modules always having the package type jar. Only distributions should repackage modules into other package types like war, ear, zip and so on. This allows the highest flexibility in module reuse between different products and various distributions for different customers and target environments.

Base Classes

Hooks

The following lifecycle hooks are available, which can either just be added to a spring bean to be automatically picked up during bootstrap or alternatively registered manually in their respective XyzHookManager class.

Tools

Integration Module

For applications that also rely on IO (Input/Output of files and streams) and IPC (Inter-Process-Communication), the invesdwin-context-integration module provides a few tools that make the life easier here. It integrates spring-integration which is an optional framework with which you can build a pipes and filters architecture for your integration workflow. Other invesdwin integration modules extend this to provide support for JMS, AMPQ, REST, WebServices, Spring-Batch, Hadoop and so on. This module though only provides the core functionality:

Webserver Module

This module packages an embedded jetty server to provide a servlet container for web services and web frameworks either during testing by annotating your test with @WebServerTest or to deploy your application with a distribution that contains an embedded webserver. You can also call WebserverContextLocation.activate()/.deactivate() before the application is bootstrapped to enable/disable the embedded webserver programmatically.

Also note that with this module generally resources are served from the classpath (as this is the only place where modules can store their resources since they are packaged as a jar). The classpath underlies a resource blacklist that prevents class and java files from being served by accident to ensure security (see BlacklistedWebAppContext). Also file browsing is disabled on the server for security reasons.

Report Modules

These modules bundle tools and utilities for creating reports of various types:

More Modules

There are a few more modules available in their respective github projects including their individual documentation:

Contributing

Tips for handling multiple projects and IDE configuration are here. Pull requests are welcome. Direct repo access can be granted upon request.

Support

If you need further assistance or have some ideas for improvements and don't want to create an issue here on github, feel free to start a discussion in our invesdwin-platform mailing list.