Bastion is a Java framework for implementing Domain-Driven Designed (DDD) applications.


Bastion's goal is to provide an environment in which both domain classes and technical services are completely decoupled and independant. Any technical service a domain class needs, will be triggered indirectly by throwing an event from the domain class. The framework will dispatch the event to a listening adapter. The adapter is configured with a corresponding technical service, which it will call to take the required action. Any results can be placed back into the event object, which the domain class can examine upon return.

In an environment like this, the domain classes should be able to focus completely on implementing business logic. They have neither knowledge of nor dependency on anything outside the business domain, like for example persistancy services. These technical services on the other hand, are independant of the domain. They could be replaced by another service offering the same functionality, without changing anything other than the adapter configuration.


Building from source

1. Download the code

You can either:

2. Create the database schema

For the JPA example project, you will need to create the database schema. A MySQL script is included in the example project, under src/main/sql. This will create a bastion database and the example tables. You will need to create a user and grant access rights to this database. Fill in the connection details in persistence.xml, in the test project under src/main/resources/META-INF.

Note: you may skip this step, but then you will only be able to use the in-memory persistence adapter.

3. Compile with Maven 2

Build the entire project using Maven 2. E.g. go to the bastionframework directory and type 'maven install'.

Eclipse Projects

The checked in code consists of several Eclipse projects:

Using Bastion

You can either: