[Project] Updated strolch documentation

This commit is contained in:
Robert von Burg 2018-06-25 11:42:26 +02:00
parent 5062fc347f
commit e7de771fb8
7 changed files with 299 additions and 434 deletions

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="google-site-verification" content="CPhbjooaiTdROm7Vs4E7kuHZvBfkeLUtonGgcVUbTL8"/>
<meta name="google-site-verification" content="CPhbjooaiTdROm7Vs4E7kuHZvBfkeLUtonGgcVUbTL8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
@ -60,7 +60,7 @@
<p>Transactions are opened on a <i>StrolchRealm</i>. The realms are used to separate mandates in a single
runtime instance of Strolch. Each realm has its own <i>ResourceMap</i>, <i>OrderMap</i>, <i>ActivityMap</i>
instances from which you gain access to the Strolch objects.</p>
instances from which the TX retrieves the elements.</p>
<h2>Model</h2>
@ -75,9 +75,9 @@
</ul>
<p>Each root element can have any number of <i>ParameterBag</i> instances on it, which in turn can have any
number of <i>Parameters</i> on it. Accessing these objects is always done by their IDs. Strolch root
elements are always stored in the respective <i>ElementMaps</i> in their Strolch realm. Thus accessing a
certain parameter from a <i>Resource</i> would look like this:</p>
number of <i>Parameters</i> on it. Accessing these objects is always done by their IDs. Strolch root elements
are always stored in the respective <i>ElementMaps</i> in their Strolch realm. Thus accessing a certain
parameter from a <i>Resource</i> would look like this:</p>
<pre class="pre-scrollable">
try (StrolchTransaction tx = openTx(realmName)) {
Resource resource = tx.getResourceBy("TestType", "MyTestResource");
@ -231,12 +231,12 @@ try(StrolchTransaction tx = realm.openTx()) {
<p>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
using Strolch, the first thing to do after configuring the runtime environment for your situation, Services
will be implemented.</p>
<p>Commands on the other hand are re-usable and should be implemented in such a way, that the encapsulate the
<p>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 comitted, will be executed. Commands also implement undoing its operation in the case of
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.</p>
@ -376,12 +376,13 @@ public class SetParameterCommand extends Command {
<h2>Code</h2>
<p>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.</p>
integration build, so that we are sure no tests are broken. The CI is viewable at
<a href="https://ci.4trees.ch" target="_blank">4trees CI Server</a>.</p>
<p>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.</p>
<p><a href="https://github.com/4treesCH/strolch">Strolch on GitHub</a></p>
<p><a href="https://github.com/4treesCH/strolch" target="_blank">Strolch on GitHub</a></p>
<h3>Main Strolch components</h3>
<ul>
@ -400,7 +401,8 @@ public class SetParameterCommand extends Command {
</li>
<li>Configure and maintain the realms, which implement the multi-client capability</li>
<li>Provide a default ServiceHandler to perform Services at runtime</li>
<li>Implements the realms which each can operate in different modes data store modes: CACHED, TRANSIENT
<li>Implements the realms which each can operate in different modes data store modes: CACHED,
TRANSIENT
</li>
</ul>
</li>
@ -450,30 +452,15 @@ public class SetParameterCommand extends Command {
<h3>Example projects</h3>
<ul>
<li>
<a href="https://github.com/4treesCH/strolch/tree/develop/li.strolch.planningwebapp">li.strolch.planningwebapp</a>
<p>A show case application for us in planning and scheduling use-cases.</p>
</li>
<li>
<a href="https://github.com/4treesCH/strolch/tree/develop/li.strolch.tutorialapp">li.strolch.tutorialapp</a>
<p>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.</p>
</li>
<li><a href="https://github.com/4treesCH/strolch/tree/develop/li.strolch.tutorialwebapp">li.strolch.tutorialwebapp</a>
<p>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.</p>
</li>
<li><a href="https://github.com/4treesCH/strolch/tree/develop/strolch_minimal">strolch_minimal</a>
<p>A minimal project to get started with strolch.</p>
</li>
<li><a href="https://github.com/4treesCH/strolch/tree/develop/strolch_minimal_rest">strolch_minimal_rest</a>
<li><a href="https://github.com/4treesCH/strolch/tree/develop/strolch_minimal_rest" target="_blank">strolch_minimal_rest</a>
<p>A minimal project to get started using REST with Strolch.</p>
</li>
<li><a href="https://github.com/4treesCH/strolch-bookshop" target="_blank">Strolch Bookshop</a>
<p>An example implentation of services etc. where we show how to use Strolch by implementing a simple
book shop.</p>
</li>
</ul>
<h2>Development</h2>
@ -516,7 +503,7 @@ public class SetParameterCommand extends Command {
s.parentNode.insertBefore(g, s);
})();
</script>
<noscript><p><img src="http://piwik.eitchnet.ch/piwik.php?idsite=2" style="border:0;" alt=""/></p></noscript>
<noscript><p><img src="http://piwik.eitchnet.ch/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body>

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="google-site-verification" content="CPhbjooaiTdROm7Vs4E7kuHZvBfkeLUtonGgcVUbTL8"/>
<meta name="google-site-verification" content="CPhbjooaiTdROm7Vs4E7kuHZvBfkeLUtonGgcVUbTL8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
@ -76,12 +76,8 @@ mvn clean install -DskipTests</pre>
<p>The following sections describe the Strolch configuration files and folder structure.</p>
<p>You can also use the minimal project structures:</p>
<ul>
<li><a href="https://github.com/4treesCH/strolch/tree/develop/strolch_minimal">strolch_minimal</a></li>
<li><a href="https://github.com/4treesCH/strolch/tree/develop/strolch_minimal_rest">strolch_minimal_rest</a>
</li>
</ul>
<p>You can also use the minimal project structure:
<a href="https://github.com/4treesCH/strolch/tree/develop/strolch_minimal_rest">strolch_minimal_rest</a></p>
<h3>Project Structure</h3>
<p>Strolch requires two main directories under the Strolch root:</p>
@ -91,8 +87,11 @@ mvn clean install -DskipTests</pre>
<li>StrolchConfiguration.xml &rarr; Main Strolch configuration file. There you configure the
different realms, environments etc.
</li>
<li>PrivilegeConfig.xml &rarr; Configuration of the Privilege library</li>
<li>PrivilegeModel.xml &rarr; Configuration file with the differen users, roles and privileges</li>
<li>PrivilegeConfig.xml &rarr; Configuration of the privilege management.</li>
<li>PrivilegeUsers.xml &rarr; Configuration file with the different users and their role
associations.
</li>
<li>PrivilegeRoles.xml &rarr; Configuration file with the different roles and privileges.</li>
</ul>
</li>
<li>../data/ &rarr; contains the Strolch model and any other data which is modified at runtime.
@ -101,179 +100,19 @@ mvn clean install -DskipTests</pre>
</li>
</ul>
</li>
<li>../tmp/ &rarr; contains any temporary files, e.g. log files etc.</li>
</ul>
<h3>Maven POM</h3>
<p>Strolch is built using Maven, so here we show the minimum Maven POM.</p>
<p>Strolch is built using Maven, so here we show the minimum Maven POM for a web application:</p>
<h4>Simple Java App POM</h4>
<p>This POM creates a compressed file which contains a runnable Strolch instance. Just unpack and run the <i>startup.sh</i>
script.</p>
<pre class="pre-scrollable">
&lt;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"&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;properties&gt;
&lt;strolch.version&gt;1.0.0-SNAPSHOT&lt;/strolch.version&gt;
&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
&lt;finalName&gt;strolch_app&lt;/finalName&gt;
&lt;m2eclipse.wtp.contextRoot&gt;${finalName}&lt;/m2eclipse.wtp.contextRoot&gt;
&lt;buildTimestamp&gt;${maven.build.timestamp}&lt;/buildTimestamp&gt;
&lt;/properties&gt;
&lt;groupId&gt;org.example&lt;/groupId&gt;
&lt;artifactId&gt;org.example.strolch.app&lt;/artifactId&gt;
&lt;version&gt;1.2.3&lt;/version&gt;
&lt;name&gt;org.example.strolch.app&lt;/name&gt;
&lt;scm&gt;
&lt;developerConnection&gt;scm:git:https://git.example.org/strolch_app.git&lt;/developerConnection&gt;
&lt;/scm&gt;
&lt;dependencyManagement&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;li.strolch&lt;/groupId&gt;
&lt;artifactId&gt;li.strolch.bom&lt;/artifactId&gt;
&lt;type&gt;pom&lt;/type&gt;
&lt;version&gt;${strolch.version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/dependencyManagement&gt;
&lt;dependencies&gt;
&lt;!-- main --&gt;
&lt;dependency&gt;
&lt;groupId&gt;li.strolch&lt;/groupId&gt;
&lt;artifactId&gt;li.strolch.model&lt;/artifactId&gt;
&lt;version&gt;${strolch.version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;li.strolch&lt;/groupId&gt;
&lt;artifactId&gt;li.strolch.agent&lt;/artifactId&gt;
&lt;version&gt;${strolch.version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;li.strolch&lt;/groupId&gt;
&lt;artifactId&gt;li.strolch.service&lt;/artifactId&gt;
&lt;version&gt;${strolch.version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.slf4j&lt;/groupId&gt;
&lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
&lt;scope&gt;runtime&lt;/scope&gt;
&lt;version&gt;1.7.2&lt;/version&gt;
&lt;/dependency&gt;
&lt;!-- test dependencies --&gt;
&lt;dependency&gt;
&lt;groupId&gt;junit&lt;/groupId&gt;
&lt;artifactId&gt;junit&lt;/artifactId&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;version&gt;4.11&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;build&gt;
&lt;finalName&gt;${finalName}&lt;/finalName&gt;
&lt;resources&gt;
&lt;resource&gt;
&lt;directory&gt;src/main/resources&lt;/directory&gt;
&lt;filtering&gt;true&lt;/filtering&gt;
&lt;includes&gt;
&lt;include&gt;**/componentVersion.properties&lt;/include&gt;
&lt;/includes&gt;
&lt;/resource&gt;
&lt;resource&gt;
&lt;directory&gt;src/main/resources&lt;/directory&gt;
&lt;filtering&gt;false&lt;/filtering&gt;
&lt;excludes&gt;
&lt;exclude&gt;**/componentVersion.properties&lt;/exclude&gt;
&lt;/excludes&gt;
&lt;/resource&gt;
&lt;/resources&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
&lt;version&gt;3.0&lt;/version&gt;
&lt;configuration&gt;
&lt;source&gt;1.7&lt;/source&gt;
&lt;target&gt;1.7&lt;/target&gt;
&lt;showDeprecation&gt;true&lt;/showDeprecation&gt;
&lt;showWarnings&gt;true&lt;/showWarnings&gt;
&lt;compilerArgument&gt;-Xlint:all&lt;/compilerArgument&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
&lt;artifactId&gt;buildnumber-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;1.2&lt;/version&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;phase&gt;validate&lt;/phase&gt;
&lt;goals&gt;
&lt;goal&gt;create&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;configuration&gt;
&lt;doCheck&gt;false&lt;/doCheck&gt;
&lt;doUpdate&gt;false&lt;/doUpdate&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
&lt;configuration&gt;
&lt;archive&gt;
&lt;manifest&gt;
&lt;addDefaultImplementationEntries&gt;true&lt;/addDefaultImplementationEntries&gt;
&lt;addDefaultSpecificationEntries&gt;true&lt;/addDefaultSpecificationEntries&gt;
&lt;!-- When creating an executable jar, use copy-dependencies plugin with libs in lib/ dir: --&gt;
&lt;mainClass&gt;li.strolch.tutorialapp.main.Main&lt;/mainClass&gt;
&lt;addClasspath&gt;true&lt;/addClasspath&gt;
&lt;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt;
&lt;/manifest&gt;
&lt;/archive&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
&lt;configuration&gt;
&lt;descriptor&gt;src/assembly/bin.xml&lt;/descriptor&gt;
&lt;finalName&gt;tutorial-app-${project.version}&lt;/finalName&gt;
&lt;/configuration&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;phase&gt;package&lt;/phase&gt;
&lt;goals&gt;
&lt;goal&gt;single&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;
&lt;/project&gt;</pre>
<h4>Webapp POM</h4>
<p>This creates a simple WAR which starts Strolch after deployed to a servlet container.</p>
<pre class="pre-scrollable">
&lt;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"&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;properties&gt;
&lt;strolch.version&gt;1.2.3&lt;/strolch.version&gt;
&lt;strolch.version&gt;1.6.47&lt;/strolch.version&gt;
&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
&lt;warFinalName&gt;strolch_webapp&lt;/warFinalName&gt;
&lt;m2eclipse.wtp.contextRoot&gt;${warFinalName}&lt;/m2eclipse.wtp.contextRoot&gt;
@ -445,15 +284,23 @@ mvn clean install -DskipTests</pre>
<h3>Tools used</h3>
The following tools are used to develop Strolch and Strolch-based projects:
<ul class="list-unstyled">
<li><a href="https://www.eclipse.org/downloads/"><img style="height: 50px" class="img-thumbnail"
<li><a href="https://www.eclipse.org/downloads/"><img style="height: 50px"
class="img-thumbnail"
src="https://www.eclipse.org/downloads/packages/sites/all/themes/solstice/_themes/solstice_packages/logo.png"
alt="Eclipse Luna JEE version"/></a></li>
<li><a href="https://maven.apache.org/"><img width="250" style="height: 50px; margin-top: 10px"
alt="Eclipse Luna JEE version" /></a></li>
<li><a href="https://www.jetbrains.com/idea/download/#section=linux"><img style="height: 50px"
class="img-thumbnail"
src="https://upload.wikimedia.org/wikipedia/commons/d/d5/IntelliJ_IDEA_Logo.svg"
alt="IntelliJ IDEA" /></a></li>
<li><a href="https://maven.apache.org/"><img width="250"
style="height: 50px; margin-top: 10px"
class="img-thumbnail"
src="http://maven.apache.org/images/maventxt_logo_200.gif"
alt="Apache Maven 3.0"/></a></li>
<li><a href="http://git-scm.com/"><img style="height: 50px; margin-top: 10px" class="img-thumbnail"
src="http://git-scm.com/images/logo@2x.png" alt="git scm"/></a></li>
alt="Apache Maven 3.0" /></a></li>
<li><a href="http://git-scm.com/"><img style="height: 50px; margin-top: 10px"
class="img-thumbnail"
src="http://git-scm.com/images/logo@2x.png"
alt="git scm" /></a></li>
</ul>
</div><!-- /.content -->
@ -467,12 +314,12 @@ mvn clean install -DskipTests</pre>
</div><!-- /.container -->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<!-- Include all compiled plugins (below), or include individual xsd as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
@ -489,8 +336,8 @@ mvn clean install -DskipTests</pre>
s.parentNode.insertBefore(g, s);
})();
</script>
<noscript><p><img src="http://piwik.eitchnet.ch/piwik.php?idsite=2" style="border:0;" alt=""/></p></noscript>
<!-- End Piwik Code -->
<noscript><p><img src="http://piwik.eitchnet.ch/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body>
</html>

View File

@ -85,7 +85,7 @@
<ul>
<li>REST Endpoints &rarr; expose an API to access the Strolch agent outside of the Java VM</li>
<li>Services and Commands &rarr; implements business logic</li>
<li>Queries &rarr; implements specific queries against the Strolch model</li>
<li>Searches &rarr; implements specific queries against the Strolch model</li>
<li>Components &rarr; Implements additional logic, which is best implement as a component. E.g. active
components which have threads, etc.
</li>

View File

@ -55,19 +55,21 @@
<ul>
<li>1 <code>Service</code> per use-case, should mostly delegate to <code>Commands</code>.</li>
<li><code>Commands</code> implement use-cases or parts of it, and are thus reusable.</li>
<li>Subclass <code>ResourceQuery</code> and <code>OrderQuery</code> when implementing use-case specific
querying - this allows privilege checking.
<li>Subclass <code>ResourceSearch</code>, <code>OrderSearch</code> and <code>ActivitySearch</code> when
implementing use-case specific search - this allows privilege checking.
</li>
<li>One Transaction at a time - no TX inside of another TX.</li>
<li>Commands are added to TXs and performed on close: <code>tx.addCommand(Command)</code> and then <code>tx.commitOnClose()</code>
</li>
<li>Use <code>tx.flush() and as late as possible in your TX <code>tx.commitOnClose()</code></code>
<li>Use <code>tx.flush() if you need to perform first some work and then as late as possible call <code>tx.commitOnClose()</code></code>
</li>
<li>Only access <code>ElementMap</code>s if really no other way, mostly use <code>tx.get*By()</code>, <code>tx.findBy()</code>
and queries - if a specific get is missing, then add the method to <code>StrolchTransaction</code> and
send a pull request!
</li>
<li>Don't write logic in REST API beans. Delegate to other classes, making your code reusable!</li>
<li>Use <code>tx.stream*()</code> methods to iterate over all elements, if you don't want to use a search.
</li>
<li>Don't write logic in REST API beans. Delegate to other services, making your code reusable!</li>
<li>Transform to JSON using the <code>StrolchElementToJsonVisitor</code>.</li>
<li>References between objects is done by adding a <code>ParameterBag</code> with the id
<code>relations</code> to the object and then <code>StringParameters</code> with the value being the ID,

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="google-site-verification" content="CPhbjooaiTdROm7Vs4E7kuHZvBfkeLUtonGgcVUbTL8"/>
<meta name="google-site-verification" content="CPhbjooaiTdROm7Vs4E7kuHZvBfkeLUtonGgcVUbTL8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
@ -64,8 +64,10 @@
<dd>&rarr; configures the Strolch agent</dd>
<dt>PrivilegeConfig.xml</dt>
<dd>&rarr; configures user management</dd>
<dt>PrivilegeModel.xml</dt>
<dd>&rarr; contains the users and roles in an XML based user management</dd>
<dt>PrivilegeUsers.xml</dt>
<dd>&rarr; contains the users in an XML based user management file</dd>
<dt>PrivilegeRoles.xml</dt>
<dd>&rarr; contains the roles and privileges in an XML based user management</dd>
</dl>
</li>
</ul>
@ -100,29 +102,34 @@
by defining the following child elements:
<ul>
<li><code>&lt;name&gt;</code> the name of the component, use when defining dependencies between
components. The name is mostly set to the simple name of the interface of the component
components. The name is mostly set to the simple name of the interface
of the component
</li>
<li><code>&lt;api&gt;</code> the full class name to the interface of the component. During runtime
this interface will be used to access the component e.g.: <code>ServiceHandler svcHandler =
this interface will be used to access the component e.g.: <code>ServiceHandler
svcHandler
=
agent.getContainer().getComponent(ServiceHandler.class);</code>
</li>
<li><code>&lt;impl&gt;</code> the full class name of the concrete implementation of the component.
During initialization this class will be instantiated and registered under the component name
and interface. This class must extend the class
<code>li.strolch.agent.api.StrolchComponent</code>
During initialization this class will be instantiated and registered
under the component name and interface. This class must extend the
class <code>li.strolch.agent.api.StrolchComponent</code>
</li>
<li><code>&lt;depends&gt;</code> any number of these elements, where the content is the name of
another component, on which this component depends. Depending components are initialized and
started after the component they depend on and are stopped and destroyed before
another component, on which this component depends. Depending
components are initialized and started after the component they
depend on and are stopped and destroyed before
</li>
<li><code>&lt;Properties&gt;</code>
<ul>
<li><code>&lt;...&gt;</code> any number of properties which the component requires. The
element's name will be the key with which the value can be accessed at runtime.
element's name will be the key with which the value can be
accessed at runtime.
</li>
</ul>
</li>
@ -131,10 +138,11 @@
</ul>
<p><b>Note:</b> When a property is missing, and the component has a hard coded default value, then when the
component is initialized, the use of the default value and its key is logged. This makes it easy to see
which new properties can be configured. Should the component not define a default value, then the component
will thrown an exception on initialization. In this case it can be a good moment to read the JavaDoc (or
source code) for the component in question to see how it is configured.</p>
component is initialized, the use of the default value and its key is logged. This makes it easy
to see which new properties can be configured. Should the component not define a default value,
then the component will thrown an exception on initialization. In this case it can be a good
moment to read the JavaDoc (or source code) for the component in question to see how it is
configured.</p>
<h2>Privilege Configuration</h2>
@ -164,11 +172,9 @@
</li>
</ul>
<p>The <code>PrivilegeModel.xml</code> defines the following and is used when in <code>PrvilegeConfig.xml</code>
the <code>PersistenceHandler</code> is set to
<code>ch.eitchnet.privilege.handler.XmlPersistenceHandler</code>:</p>
<ul>
<li><code>&lt;UsersAndRoles&gt;</code> root element
<p>The <code>PrivilegeUsers.xml</code> and <code>PrivilegeRoles.xml</code> define the users and roles and is
used when in <code>PrvilegeConfig.xml</code> the <code>PersistenceHandler</code> is set to <code>ch.eitchnet.privilege.handler.XmlPersistenceHandler</code>:
</p>
<ul>
<li><code>&lt;Users&gt;</code> configures all users
<ul>
@ -184,8 +190,9 @@
<li><code>&lt;Role&gt;</code> adds a role to the user</li>
</ul>
</li>
<li><code>&lt;Properties&gt;</code> configures user specific properties. What
properties are used is not specified and is dependent on the concrete agent
<li><code>&lt;Properties&gt;</code> configures user specific properties. What properties are
used is not specified and is dependent on the concrete
agent
<ul>
<li><code>&lt;Property&gt;</code> defines a single property</li>
</ul>
@ -201,8 +208,8 @@
<ul>
<li><code>&lt;Privilege&gt;</code> configures a specific privilege for this role
<ul>
<li><code>&lt;AllAllowed&gt;</code> if set to true, then defines that all
values associated with this privilege are allowed
<li><code>&lt;AllAllowed&gt;</code> if set to true, then defines that all values
associated with this privilege are allowed
</li>
<li><code>&lt;Allow&gt;</code> defines one allowed value for this privilege
</li>
@ -215,16 +222,24 @@
</ul>
</li>
</ul>
</li>
</ul>
<h2>Implementing a StrolchComponent</h2>
<p>Implementing a strolch component requires an interface, which defines the component's API and a concrete
class which implements the interface and extends the class <code>StrolchComponent</code>.</p>
<p>The StrolchComponent class adds the state model to the class, which transitions as follows:<br/> <code>UNDEFINED
=&gt; SETUP =&gt; INITIALIZED => STARTED &lt;=&gt; STOPPED => DESTROYED</code></p>
<p>The StrolchComponent class adds the state model to the class, which transitions as follows:<br /> <code>UNDEFINED
=&gt;
SETUP
=&gt;
INITIALIZED
=>
STARTED
&lt;=&gt;
STOPPED
=>
DESTROYED</code>
</p>
<p>Components can switch between <code>STARTED</code> and <code>STOPPED</code>, but once <code>DESTROYED</code>
no further state change is possible. The component's state is changed by changes to the agent's lifecycle.
@ -312,13 +327,7 @@ agent.initialize();
agent.start();
</pre>
<p>For command line based applications there is also a main starter which takes command line arguments. The main
starter handles stopping the agent by pressing Ctrl+c.</p>
<pre>
MainStarter starter = new MainStarter(); mainStarter.start(args);
</pre>
<p>And in Servlet 3.0 applications one would implement the <code>javax.servlet.ServletContextListener</code>
<p>In Servlet 3.0 applications one would implement the <code>javax.servlet.ServletContextListener</code>
interface, add the <code>@WebListener</code> annotation to the class and in the
<code>contextInitialized()</code>-method start Strolch:</p>
<pre>
@ -367,7 +376,7 @@ this.agent.start();
s.parentNode.insertBefore(g, s);
})();
</script>
<noscript><p><img src="http://piwik.eitchnet.ch/piwik.php?idsite=2" style="border:0;" alt=""/></p></noscript>
<noscript><p><img src="http://piwik.eitchnet.ch/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="google-site-verification" content="CPhbjooaiTdROm7Vs4E7kuHZvBfkeLUtonGgcVUbTL8"/>
<meta name="google-site-verification" content="CPhbjooaiTdROm7Vs4E7kuHZvBfkeLUtonGgcVUbTL8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
@ -56,8 +56,8 @@
<h2>Overview</h2>
<p>Strolch is an open source component based software agent written in Java and can be compared, in a light
sense, with the Java EE stack: Strolch takes care of persistence, implements Services for use cases,
Commands as re-usable algorithms and has a parameterized data model.</p>
sense, with the Java EE stack: Strolch takes care of persistence, implements Services for use cases, Commands
as re-usable algorithms and has a parameterized data model.</p>
<p>Strolch has an intrinsic understanding for mandates, which are called realms so that a single agent can be
used to implement applications with multiple users/customers for instance in SaaS environments.</p>
@ -65,19 +65,19 @@
<p>The parameterized data model consists of three top level objects, Resources, Orders and Activities. These
objects can have any number of ParameterBags which in turn can have any number of Parameters on them. This
allows for a very dynamic modelling of data structures including modification at run time. Multiple ready to
use Parameter types are already implemented which handle the primitive types in Java including
ListParameters for collections of these primitive types.</p>
use Parameter types are already implemented which handle the primitive types in Java including ListParameters
for collections of these primitive types.</p>
<p>One of the main features of the Strolch agent, is that persistence is handled transparently and the user must
not be worried about databases and the likes. Currently there are two implementations for persisting the
Strolch model, a PostgreSQL and an XML file persistence. Currently both persistence layers persist the data
by converting to XML and storing it into the database. The XML file persistence stores each object in its
own file.</p>
by converting to XML and storing it into the database. The XML file persistence stores each object in its own
file.</p>
<p>The agent itself has a small memory footprint and requires very few components to start. For the agent to be
useful it needs additional functionality which is implemented in StrolchComponents. Each component is
registered via its Java interface on the agent and is bound to the life cycle of the agent. When the agent
is started, these components can be retrieved and used to perform any number of functionalities. This is the
registered via its Java interface on the agent and is bound to the life cycle of the agent. When the agent is
started, these components can be retrieved and used to perform any number of functionalities. This is the
preferred way to extend the Strolch agent. There are a number of components already implemented, e.g. the
ServiceHandler which executes Services in a controlled fashion and can validate authorized access to these
services.</p>
@ -95,12 +95,11 @@
existing in those stacks needed to be re-created in Strolch.</p>
<p>The first answer to this question is that those systems are often overly complicated and bloated. Java SE
with Hibernate certainly is a viable option when it comes to being light-weightier but Hibernate, even
though it is supposed to, often fails to truly help remove the need to really understand an RDBMS. Often
enough Hibernate will just get in the way of the most important part of development: writing the business
code. Being an OR-Mapper which is supposed to implement all the nitty-gritty details of an RDBMS system,
Hibernate, and JPA for that matter, still often has the developer go back to understanding these
details.</p>
with Hibernate certainly is a viable option when it comes to being light-weightier but Hibernate, even though
it is supposed to, often fails to truly help remove the need to really understand an RDBMS. Often enough
Hibernate will just get in the way of the most important part of development: writing the business code.
Being an OR-Mapper which is supposed to implement all the nitty-gritty details of an RDBMS system, Hibernate,
and JPA for that matter, still often has the developer go back to understanding these details.</p>
<p>Strolch tries a different approach to persistence. Instead of writing pojos/entities, Strolch's model has the
concept that each element's attributes are part of a composition pattern: each attribute is its own object
@ -138,66 +137,87 @@
<p>Strolch strives to use as few external dependencies as possible, so that the Strolch runtime is not bloated
unnecessarily. The following list of Strolch dependencies is a summary and was created using mvn
dependency:tree on the strolch_minimal project on the 2016-09-16.</p>
dependency:tree on the strolch_minimal project for release 1.6.47.</p>
<h4>Basic runtime dependencies</h4>
<p>Logging</p>
<ul>
<li>commons-cli:commons-cli:jar:1.2:compile
<p>Implements the command line parameter parsing when starting from a main class</p></li>
<li>org.postgresql:postgresql:jar:9.4.1208.jre7:compile
<p>Implements the PostgreSQL Persistence layer used by li.strolch.persistence.postgresql</p></li>
<li>com.zaxxer:HikariCP:jar:2.3.6:compile
<p>Implements connection pooling for JDBC access</p></li>
<li>com.google.code.gson:gson:jar:2.3.1:compile
<p>Used to transform to JSON</p></li>
<li>javax.activation:activation:jar:1.1:compile
<p>Used when sending e-mails</p></li>
<li>javax.mail:mail:jar:1.5.0-b01:compile
<p>Used when sending e-mails</p></li>
<li>log4j:log4j:jar:1.2.17:runtime
<p>Used for logging</p></li>
<li>org.slf4j:slf4j-api:jar:1.7.2:compile
<p>Used for logging</p></li>
<li>org.slf4j:slf4j-log4j12:jar:1.7.2:runtime
<p>Used for logging</p></li>
<li>org.slf4j:slf4j-api:jar:1.7.25</li>
<li>ch.qos.logback:logback-classic:jar:1.2.3</li>
<li>ch.qos.logback:logback-core:jar:1.2.3</li>
</ul>
<h4>Web Restful dependencies</h4>
<p>If you want to access Strolch using the RESTful API, then we got you covered - but sadly RESTful service
development requires quite a few extra dependencies:</p>
<p>Utils</p>
<ul>
<li>com.github.petitparser.java-petitparser:petitparser-core:jar:2.0.2:compile</li>
<li>javax.annotation:javax.annotation-api:jar:1.2:compile</li>
<li>javax.servlet:javax.servlet-api:jar:3.0.1:provided</li>
<li>javax.validation:validation-api:jar:1.1.0.Final:compile</li>
<li>javax.ws.rs:javax.ws.rs-api:jar:2.0:compile</li>
<li>org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.5.0:compile</li>
<li>org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.5.0:compile</li>
<li>org.eclipse.persistence:org.eclipse.persistence.core:jar:2.5.0:compile</li>
<li>org.eclipse.persistence:org.eclipse.persistence.moxy:jar:2.5.0:compile</li>
<li>org.glassfish.hk2.external:aopalliance-repackaged:jar:2.3.0-b05:compile</li>
<li>org.glassfish.hk2.external:javax.inject:jar:2.3.0-b05:compile</li>
<li>org.glassfish.hk2:hk2-api:jar:2.3.0-b05:compile</li>
<li>org.glassfish.hk2:hk2-locator:jar:2.3.0-b05:compile</li>
<li>org.glassfish.hk2:hk2-utils:jar:2.3.0-b05:compile</li>
<li>org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile</li>
<li>org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.11:compile</li>
<li>org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.11:compile</li>
<li>org.glassfish.jersey.containers:jersey-container-servlet:jar:2.11:compile</li>
<li>org.glassfish.jersey.core:jersey-client:jar:2.11:compile</li>
<li>org.glassfish.jersey.core:jersey-common:jar:2.11:compile</li>
<li>org.glassfish.jersey.core:jersey-server:jar:2.11:compile</li>
<li>org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.11:compile</li>
<li>org.glassfish.jersey.media:jersey-media-moxy:jar:2.11:compile</li>
<li>org.javassist:javassist:jar:3.18.1-GA:compile</li>
<li>javax.mail:javax.mail-api:jar:1.6.0</li>
<li>com.sun.mail:javax.mail:jar:1.6.0</li>
<li>javax.activation:activation:jar:1.1</li>
</ul>
<p>Testing</p>
<ul>
<li>junit:junit:jar:4.12</li>
<li>org.hamcrest:hamcrest-core:jar:1.3</li>
<li>org.hamcrest:hamcrest-library:jar:1.3</li>
<li>org.mockito:mockito-core:jar:2.0.8-beta</li>
<li>org.objenesis:objenesis:jar:2.1</li>
</ul>
<p>Model</p>
<ul>
<li>com.google.code.gson:gson:jar:2.8.2</li>
</ul>
<p>SOQL</p>
<ul>
<li>org.abego.treelayout:org.abego.treelayout.core:jar:1.0.3</li>
<li>org.antlr:antlr-runtime:jar:3.5.2</li>
<li>org.antlr:antlr4-runtime:jar:4.7</li>
<li>org.antlr:antlr4:jar:4.7</li>
<li>org.antlr:ST4:jar:4.0.8</li>
<li>org.glassfish:javax.json:jar:1.0.4</li>
<li>com.ibm.icu:icu4j:jar:58.2</li>
</ul>
<p>PostgreSQL</p>
<ul>
<li>com.zaxxer:HikariCP:jar:2.7.1</li>
<li>org.postgresql:postgresql:jar:42.1.4</li>
</ul>
<p>REST</p>
<ul>
<li>javax.annotation:javax.annotation-api:jar:1.3.1</li>
<li>javax.servlet:javax.servlet-api:jar:3.1.0</li>
<li>javax.ws.rs:javax.ws.rs-api:jar:2.1</li>
</ul>
<p>REST testing</p>
<ul>
<li>javax.validation:validation-api:jar:1.1.0.Final</li>
<li>org.glassfish.grizzly:grizzly-framework:jar:2.3.28</li>
<li>org.glassfish.grizzly:grizzly-http-server:jar:2.3.28</li>
<li>org.glassfish.grizzly:grizzly-http-servlet:jar:2.3.28</li>
<li>org.glassfish.grizzly:grizzly-http:jar:2.3.28</li>
<li>org.glassfish.hk2:hk2-api:jar:2.5.0-b32</li>
<li>org.glassfish.hk2:hk2-locator:jar:2.5.0-b32</li>
<li>org.glassfish.hk2:hk2-utils:jar:2.5.0-b32</li>
<li>org.glassfish.hk2:osgi-resource-locator:jar:1.0.1</li>
<li>org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b32</li>
<li>org.glassfish.hk2.external:javax.inject:jar:2.5.0-b32</li>
<li>org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.25.1</li>
<li>org.glassfish.jersey.containers:jersey-container-grizzly2-http:jar:2.25.1</li>
<li>org.glassfish.jersey.containers:jersey-container-grizzly2-servlet:jar:2.25.1</li>
<li>org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.25.1</li>
<li>org.glassfish.jersey.containers:jersey-container-servlet:jar:2.25.1</li>
<li>org.glassfish.jersey.core:jersey-client:jar:2.25.1</li>
<li>org.glassfish.jersey.core:jersey-common:jar:2.25.1</li>
<li>org.glassfish.jersey.core:jersey-server:jar:2.25.1</li>
<li>org.glassfish.jersey.media:jersey-media-jaxb:jar:2.25.1</li>
<li>org.glassfish.jersey.test-framework:jersey-test-framework-core:jar:2.25.1</li>
<li>org.javassist:javassist:jar:3.20.0-GA</li>
</ul>
<h4>API</h4>
<p>Check out the <a href="api.html">API page</a> to see how to use Strolch.</p>
@ -237,7 +257,7 @@
s.parentNode.insertBefore(g, s);
})();
</script>
<noscript><p><img src="http://piwik.eitchnet.ch/piwik.php?idsite=2" style="border:0;" alt=""/></p></noscript>
<noscript><p><img src="http://piwik.eitchnet.ch/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body>