diff --git a/li.strolch.website/www.strolch.li/api.html b/li.strolch.website/www.strolch.li/api.html index 467588489..be2573abb 100644 --- a/li.strolch.website/www.strolch.li/api.html +++ b/li.strolch.website/www.strolch.li/api.html @@ -3,7 +3,7 @@
- + @@ -55,19 +55,19 @@The Strolch API revolves around the StrolchTransaction object. The main concept is to implement your - use cases in Service implementations. You open a transaction using the openTx(String)-method - and then perform the use case by adding your Command instances to the transaction.
+ use cases in Service implementations. You open a transaction using the openTx(String)-method + and then perform the use case by adding your Command instances to the transaction.Transactions are opened on a StrolchRealm. The realms are used to separate mandates in a single - runtime instance of Strolch. Each realm has its own ResourceMap, OrderMap, ActivityMap - instances from which you gain access to the Strolch objects.
+ runtime instance of Strolch. Each realm has its own ResourceMap, OrderMap, ActivityMap + instances from which the TX retrieves the elements.The Strolch model is implemented in the project li.strolch.model.
The Strolch model consists of three root level elements: Resource, Order and Activity. - Each element has at least the following attributes:
+ Each element has at least the following attributes:Each root element can have any number of ParameterBag instances on it, which in turn can have any - number of Parameters on it. Accessing these objects is always done by their IDs. Strolch root - elements are always stored in the respective ElementMaps in their Strolch realm. Thus accessing a - certain parameter from a Resource would look like this:
+ number of Parameters on it. Accessing these objects is always done by their IDs. Strolch root elements + are always stored in the respective ElementMaps in their Strolch realm. Thus accessing a certain + parameter from a Resource would look like this:try (StrolchTransaction tx = openTx(realmName)) { Resource resource = tx.getResourceBy("TestType", "MyTestResource"); @@ -201,19 +201,19 @@ try (StrolchTransaction tx = openTx(realmName)) {
This is a transient data store mode, where no model changes are persisted, but they are only kept in - memory. When the Strolch agent is started, this realm stays empty as no data is loaded.
This is the same as EMPTY, but with the difference that when the Strolch agent is started, an XML - file is parsed and the in memory realm is populated with the elements parsed from that XML file.
+ file is parsed and the in memory realm is populated with the elements parsed from that XML file.In this mode, all data is stored in memory, and any changes made are written back to the persistence - layer. This allows for fast in-memory quries, but makes sure no data is lost when the agent is - restarted.
Strolch Realms are also responsible for opening Transactions, as these are bound to the persistence layer - configured for this realm. At runtime, a realm is then accessed from the ComponentContainer:
+ configured for this realm. At runtime, a realm is then accessed from the ComponentContainer:ComponentContainer container = getAgent().getContainer(); StrolchRealm realm = container.getRealm(StrolchConstants.DEFAULT_REALM); @@ -226,19 +226,19 @@ try(StrolchTransaction tx = realm.openTx()) {Services and Commands
In the motivation section, it was discusses that writing business logic is what developing is about and a - reason why Strolch is a different approach to the Java EE ecosystem. So this is where Services and Commands - come into play, and tries to make writing business logic a first class citizen.
+ reason why Strolch is a different approach to the Java EE ecosystem. So this is where Services and Commands + come into play, and tries to make writing business logic a first class citizen.Services are to be used once for each use case. Services are not re-used or called by other services. - Services open transactions are implement the calling of the re-usable commands. Thus when writing projects - using Strolch, the first thing to do after configuring the runtime environmet for your situation, Services - will be implemented.
+ Services open transactions are implement the calling of the re-usable commands. Thus when writing projects + using Strolch, the first thing to do after configuring the runtime environment for your situation, Services + will be implemented. -Commands on the other hand are re-usable and should be implemented in such a way, that the encapsulate the - use case's different actions. Commands are then passed to a transaction for execution and, when the - transaction is comitted, will be executed. Commands also implement undoing its operation in the case of - exceptions. Strolch transactions handle the life-cycle of a command. A further function of Commands is to - lock the relevant Strolch elements before execution.
+Commands on the other hand are re-usable and should be implemented in such a way, that they encapsulate the + use case's different actions. Commands are then passed to a transaction for execution and, when the + transaction is committed, will be executed. Commands also implement undoing its operation in the case of + exceptions. Strolch transactions handle the life-cycle of a command. A further function of Commands is to + lock the relevant Strolch elements before execution.
A typical Service and Command implementation would look as follows:
@@ -376,23 +376,24 @@ public class SetParameterCommand extends Command {Code
The Strolch code can be retrieved from GitHub, where the code is hosted. Each commit triggers a continuous - integration build, so that SNAPSHOT builds can be quickly integrated in projects if needed.
+ integration build, so that we are sure no tests are broken. The CI is viewable at + 4trees CI Server.Strolch is divided up into different projects on GitHub so that these projects can be developed, or bugfixed - independently and not all parts are required in every context.
+ independently and not all parts are required in every context. - +Main Strolch components
This project implements the Strolch model. This is where you will find the different elements that - can store data at runtime e.g. Resources, Orders and Activities
The agent is the Strolch runtime and is the component which implements the core Agent functionality. - That is:
+ That is:Implements a PostgreSQL persistence layer so that the Strolch model can be persisted to a PostgreSQL - RDBMS when the realm is configured to have a data store mode of CACHED.
+ RDBMS when the realm is configured to have a data store mode of CACHED.Implements an XML persistence layer so that the Strolch model can be persisted to XML files when the - realm is configured to have a data store mode of CACHED.
+ realm is configured to have a data store mode of CACHED.Implements a Restful API to communicate with the Strolch runtime from clients and external - systems.
+ systems.This bill of material is a Maven project which, when imported in one's own Strolch project, pulls in - all required dependencies needed to set up a minimal working Strolch environment.
+ all required dependencies needed to set up a minimal working Strolch environment.Implements a test base so that writing tests for Strolch is easy. It provides a RuntimeMock, which - handles setting up and tearing down Strolch runtimes during tests.
+ handles setting up and tearing down Strolch runtimes during tests.A show case application for us in planning and scheduling use-cases.
-A tutorial application which showcases how to setup Strolch as a standalone Java SE project and - starts the Strolch runtime by means of a main-class.
-A tutorial application which showcases how to setup Strolch as a standalone Java Webapp which can be - deployed to a servlet container e.g. Apache Tomcat 8.
-A minimal project to get started with strolch.
-A minimal project to get started using REST with Strolch.
An example implentation of services etc. where we show how to use Strolch by implementing a simple + book shop.
+To start getting involved with Strolch Development, or create your own applications using Strolch, then see - the development page
+ the development page @@ -516,7 +503,7 @@ public class SetParameterCommand extends Command { s.parentNode.insertBefore(g, s); })(); - + diff --git a/li.strolch.website/www.strolch.li/development.html b/li.strolch.website/www.strolch.li/development.html index 39ce725c3..3371ba89f 100644 --- a/li.strolch.website/www.strolch.li/development.html +++ b/li.strolch.website/www.strolch.li/development.html @@ -3,7 +3,7 @@ - + @@ -64,24 +64,20 @@ cd strolch mvn clean install -DskipTestsNote: To run the tests you will need to configure the PostgreSQL Databases. See the README in the - module.
+ module.After running the Maven build, you will have a full build of all Strolch projects. Now you can start - modifying the projects, and add your own features, or, far more interesting, start developing your projects - using the Strolch agent.
+ modifying the projects, and add your own features, or, far more interesting, start developing your projects + using the Strolch agent.To use Strolch in your own projects, look at the two tutorial apps on how they are configured. You can also - simply copy the projects, modify the Maven POMs and remove what ever you do not need.
+ simply copy the projects, modify the Maven POMs and remove what ever you do not need.The following sections describe the Strolch configuration files and folder structure.
-You can also use the minimal project structures:
-You can also use the minimal project structure: + strolch_minimal_rest
Strolch requires two main directories under the Strolch root:
@@ -91,8 +87,11 @@ mvn clean install -DskipTestsStrolch is built using Maven, so here we show the minimum Maven POM.
+Strolch is built using Maven, so here we show the minimum Maven POM for a web application:
-This POM creates a compressed file which contains a runnable Strolch instance. Just unpack and run the startup.sh - script.
--<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <properties> - <strolch.version>1.0.0-SNAPSHOT</strolch.version> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <finalName>strolch_app</finalName> - <m2eclipse.wtp.contextRoot>${finalName}</m2eclipse.wtp.contextRoot> - <buildTimestamp>${maven.build.timestamp}</buildTimestamp> - </properties> - - <groupId>org.example</groupId> - <artifactId>org.example.strolch.app</artifactId> - <version>1.2.3</version> - <name>org.example.strolch.app</name> - - <scm> - <developerConnection>scm:git:https://git.example.org/strolch_app.git</developerConnection> - </scm> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>li.strolch</groupId> - <artifactId>li.strolch.bom</artifactId> - <type>pom</type> - <version>${strolch.version}</version> - </dependency> - </dependencies> - </dependencyManagement> - - <dependencies> - <!-- main --> - <dependency> - <groupId>li.strolch</groupId> - <artifactId>li.strolch.model</artifactId> - <version>${strolch.version}</version> - </dependency> - <dependency> - <groupId>li.strolch</groupId> - <artifactId>li.strolch.agent</artifactId> - <version>${strolch.version}</version> - </dependency> - <dependency> - <groupId>li.strolch</groupId> - <artifactId>li.strolch.service</artifactId> - <version>${strolch.version}</version> - </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <scope>runtime</scope> - <version>1.7.2</version> - </dependency> - - <!-- test dependencies --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - <version>4.11</version> - </dependency> - </dependencies> - - <build> - <finalName>${finalName}</finalName> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - <includes> - <include>**/componentVersion.properties</include> - </includes> - </resource> - <resource> - <directory>src/main/resources</directory> - <filtering>false</filtering> - <excludes> - <exclude>**/componentVersion.properties</exclude> - </excludes> - </resource> - </resources> - <plugins> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.0</version> - <configuration> - <source>1.7</source> - <target>1.7</target> - <showDeprecation>true</showDeprecation> - <showWarnings>true</showWarnings> - <compilerArgument>-Xlint:all</compilerArgument> - </configuration> - </plugin> - - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>buildnumber-maven-plugin</artifactId> - <version>1.2</version> - <executions> - <execution> - <phase>validate</phase> - <goals> - <goal>create</goal> - </goals> - </execution> - </executions> - <configuration> - <doCheck>false</doCheck> - <doUpdate>false</doUpdate> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <addDefaultImplementationEntries>true</addDefaultImplementationEntries> - <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> - - <!-- When creating an executable jar, use copy-dependencies plugin with libs in lib/ dir: --> - <mainClass>li.strolch.tutorialapp.main.Main</mainClass> - <addClasspath>true</addClasspath> - <classpathPrefix>lib/</classpathPrefix> - </manifest> - </archive> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <descriptor>src/assembly/bin.xml</descriptor> - <finalName>tutorial-app-${project.version}</finalName> - </configuration> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project>- -
This creates a simple WAR which starts Strolch after deployed to a servlet container.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <properties> - <strolch.version>1.2.3</strolch.version> + <strolch.version>1.6.47</strolch.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <warFinalName>strolch_webapp</warFinalName> <m2eclipse.wtp.contextRoot>${warFinalName}</m2eclipse.wtp.contextRoot> @@ -445,15 +284,23 @@ mvn clean install -DskipTests