A lightweight Java component model and runtime container.
Home | Next: Step 1: Your First Component
This tutorial introduces Covalent through a small, runnable example: the back office of a tiny coffee shop. Each step adds one idea, comes with a complete program you can run, and shows the output you should get.
You do not need any prior knowledge of Covalent. If you are new to component models in general, the foundations page gives the background, but you can also start here and read it later.
| Step | Topic | What it covers |
|---|---|---|
| 1 | Your first component | component type, implementation, container, start and stop |
| 2 | Services | request/response ports between components |
| 3 | Events | fire-and-forget notifications, automatic subscription |
| 4 | Parameters | configuring a component through its own interface |
| 5 | Lifecycle | callbacks, states, activating and passivating a component |
| 6 | Advanced events | manual subscription, filters, subscription delegation, cloning |
| 7 | Structuring components | items (segmentation) and composition |
| 8 | Existing objects | bringing a plain Java object into the runtime as a raw component |
| 9 | Next steps | the component viewer, troubleshooting, where to read more |
Covalent on the classpath. The core has no third-party dependency. From the repository root, build and install it in your local Maven repository:
mvn -pl covalent-core -am install
-am also builds and installs the parent POM that covalent-core inherits
from; without it, an external project fails to resolve covalent-parent
even though covalent-core itself installed successfully.
Then declare it in your project:
<dependency>
<groupId>org.opales</groupId>
<artifactId>covalent-core</artifactId>
<version>1.0.0</version>
</dependency>
Every step ends with a complete program in a single file, so you can copy it,
run it, and modify it. To keep each program in one file, the components are
written as nested public static classes of a launcher class. In a real
application, each component type and implementation would normally live in its own
file.
Covalent requires component implementations to be public classes with a
public no-argument constructor. The nested classes in the examples respect this
rule. See Instantiation Contract for Component
Implementations.
The output shown after each program is what the program prints on the standard
output. Covalent also logs a few INFO lines (container started, container
stopped) through java.util.logging, on the standard error; they are left out
here.
Ready? Let’s start with your first component.