[New] Adding a bookshop tutorial to website

This commit is contained in:
Robert von Burg 2017-05-21 14:06:31 +02:00
parent 1354a89f72
commit da1afe7d69
21 changed files with 1094 additions and 1 deletions

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li class="active"><a href="api.html">API</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>
@ -77,7 +78,7 @@
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">
<pre class="pre-scrollable">
try (StrolchTransaction tx = openTx(realmName)) {
Resource resource = tx.getResourceBy("TestType", "MyTestResource");
DateParameter dateP = resource.getParameter("@bag01", "@param6");

View File

@ -33,6 +33,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li class="active"><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li class="active"><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li class="active"><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -33,6 +33,7 @@
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li class="active"><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -32,6 +32,7 @@
<li class="active"><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>

View File

@ -0,0 +1,762 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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="">
<link rel="shortcut icon" href="ico/favicon.ico">
<title>Strolch: Tutorial</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/custom.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script><![endif]-->
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">Strolch</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li class="active"><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<div class="container">
<div class="page-header">
<h1 class="page-title">Tutorial: Configuration</h1>
<p class="lead page-description">Configure the runtime</p>
</div>
<div class="content">
<a href="tutorial.html" class="pull-left">Previous: Start</a><a href="tutorial-model.html" class="pull-right">Next:
Model</a>
<br><br>
<p>Let's start by creating a new Apache Maven project. We'll need a POM with the proper dependencies. We expect
you to be familiar with Apache Maven, so we'll just show you a working POM file:</p>
<b>pom.xml</b>
<pre class="pre-scrollable">
&lt;?xml version="1.0"?&gt;
&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;groupId&gt;li.strolch&lt;/groupId&gt;
&lt;artifactId&gt;strolch-bookshop&lt;/artifactId&gt;
&lt;version&gt;0.1.0-SNAPSHOT&lt;/version&gt;
&lt;packaging&gt;war&lt;/packaging&gt;
&lt;name&gt;strolch-bookshop&lt;/name&gt;
&lt;description&gt;Bookshop built on Strolch&lt;/description&gt;
&lt;inceptionYear&gt;2017&lt;/inceptionYear&gt;
&lt;properties&gt;
&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
&lt;maven.build.timestamp.format&gt;yyyy-MM-dd HH:mm:ss&lt;/maven.build.timestamp.format&gt;
&lt;buildTimestamp&gt;${maven.build.timestamp}&lt;/buildTimestamp&gt;
&lt;java-version&gt;1.8&lt;/java-version&gt;
&lt;strolch.version&gt;1.5.0-SNAPSHOT&lt;/strolch.version&gt;
&lt;jersey.version&gt;2.11&lt;/jersey.version&gt;
&lt;jaxrs.api.version&gt;2.0&lt;/jaxrs.api.version&gt;
&lt;warFinalName&gt;bookshop&lt;/warFinalName&gt;
&lt;m2eclipse.wtp.contextRoot&gt;${warFinalName}&lt;/m2eclipse.wtp.contextRoot&gt;
&lt;/properties&gt;
&lt;dependencies&gt;
&lt;!-- base --&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.slf4j&lt;/groupId&gt;
&lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
&lt;version&gt;1.7.2&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
&lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
&lt;version&gt;1.0.13&lt;/version&gt;
&lt;/dependency&gt;
&lt;!-- strolch --&gt;
&lt;dependency&gt;
&lt;groupId&gt;li.strolch&lt;/groupId&gt;
&lt;artifactId&gt;li.strolch.utils&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.privilege&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.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.rest&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;li.strolch&lt;/groupId&gt;
&lt;artifactId&gt;li.strolch.testbase&lt;/artifactId&gt;
&lt;version&gt;${strolch.version}&lt;/version&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;!-- utils --&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.github.petitparser.java-petitparser&lt;/groupId&gt;
&lt;artifactId&gt;petitparser-core&lt;/artifactId&gt;
&lt;version&gt;2.0.3&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
&lt;artifactId&gt;gson&lt;/artifactId&gt;
&lt;version&gt;2.3.1&lt;/version&gt;
&lt;/dependency&gt;
&lt;!-- web --&gt;
&lt;dependency&gt;
&lt;groupId&gt;javax.servlet&lt;/groupId&gt;
&lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
&lt;version&gt;3.0.1&lt;/version&gt;
&lt;scope&gt;provided&lt;/scope&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
&lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt;
&lt;version&gt;${jaxrs.api.version}&lt;/version&gt;
&lt;/dependency&gt;
&lt;!-- testing --&gt;
&lt;dependency&gt;
&lt;groupId&gt;junit&lt;/groupId&gt;
&lt;artifactId&gt;junit&lt;/artifactId&gt;
&lt;version&gt;4.11&lt;/version&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.hamcrest&lt;/groupId&gt;
&lt;artifactId&gt;hamcrest-core&lt;/artifactId&gt;
&lt;version&gt;1.3&lt;/version&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.hamcrest&lt;/groupId&gt;
&lt;artifactId&gt;hamcrest-library&lt;/artifactId&gt;
&lt;version&gt;1.3&lt;/version&gt;
&lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;build&gt;
&lt;resources&gt;
&lt;!-- filter properties files, and copy the rest --&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;**/*.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;**/*.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;${java-version}&lt;/source&gt;
&lt;target&gt;${java-version}&lt;/target&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
&lt;version&gt;2.4&lt;/version&gt;
&lt;configuration&gt;
&lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
&lt;warName&gt;${warFinalName}&lt;/warName&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;
&lt;repositories&gt;
&lt;!-- used by petit-parser --&gt;
&lt;repository&gt;
&lt;id&gt;jitpack.io&lt;/id&gt;
&lt;name&gt;snapshots&lt;/name&gt;
&lt;url&gt;https://jitpack.io&lt;/url&gt;
&lt;releases&gt;
&lt;enabled&gt;true&lt;/enabled&gt;
&lt;/releases&gt;
&lt;snapshots&gt;
&lt;enabled&gt;true&lt;/enabled&gt;
&lt;/snapshots&gt;
&lt;/repository&gt;
&lt;/repositories&gt;
&lt;profiles&gt;
&lt;!-- active when building on eitch's machines --&gt;
&lt;profile&gt;
&lt;id&gt;m2e.eitchpc&lt;/id&gt;
&lt;activation&gt;
&lt;property&gt;
&lt;name&gt;user.name&lt;/name&gt;
&lt;value&gt;eitch&lt;/value&gt;
&lt;/property&gt;
&lt;os&gt;
&lt;family&gt;unix&lt;/family&gt;
&lt;/os&gt;
&lt;/activation&gt;
&lt;properties&gt;
&lt;strolch.env&gt;dev.eitchpc&lt;/strolch.env&gt;
&lt;/properties&gt;
&lt;/profile&gt;
&lt;profile&gt;
&lt;id&gt;m2e.eitchmac&lt;/id&gt;
&lt;activation&gt;
&lt;property&gt;
&lt;name&gt;user.name&lt;/name&gt;
&lt;value&gt;eitch&lt;/value&gt;
&lt;/property&gt;
&lt;os&gt;
&lt;family&gt;mac&lt;/family&gt;
&lt;/os&gt;
&lt;/activation&gt;
&lt;properties&gt;
&lt;strolch.env&gt;dev.eitchmac&lt;/strolch.env&gt;
&lt;/properties&gt;
&lt;/profile&gt;
&lt;/profiles&gt;
&lt;/project&gt;
</pre>
<p>Now we need the rest of the directory structure:</p>
<pre class="pre-scrollable">
../strolch-bookshop/
- src/main/java/
- li/strolch/bookshop/
- &lt;!-- java classes --&gt;
- src/main/resources/
- ENV.properties
- appVersion.properties
- logback.xml
- src/main/webapp/WEB-INF/
- StrolchBootstrap.xml
- runtime
- config/
- PrivilegeConfig.xml
- PrivilegeRoles.xml
- PrivilegeUsers.xml
- StrolchConfiguration.xml
- StrolchPolicies.xml
- data/
- StrolchModel.xsd
- defaultModel.xml
- templates.xml
- temp/
</pre>
<p>A few notes to the resource files:</p>
<ul>
<li>The <code>ENV.properties</code> file is filtered by maven and the environment to load is written in it
using the environment variable strolch.env.
</li>
<li>The <code>appVersion.properties</code> file is also filtered by maven and allows to reflect on the
version of this app at runtime.
</li>
<li>The <code>logback.xml</code> file configures logging using SLF4j and Logback.</li>
</ul>
<p>The <code>StrolchBootstrap.xml</code> file is used to configure Strolch's environment and root directory. For
a webapp it can be annoying to store Strolch's configuration inside the webapp, which is why we can define an
absolute path where the configuration is kept. In the following example we keep it in the root of the
sources:</p>
<pre class="pre-scrollable">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;StrolchBootstrap&gt;
&lt;env id="dev.eitchpc" default="true"&gt;
&lt;root&gt;/home/eitch/src/git/strolch-bookshop/runtime&lt;/root&gt;
&lt;environment&gt;dev&lt;/environment&gt;
&lt;/env&gt;
&lt;env id="dev.eitchmac" default="true"&gt;
&lt;root&gt;/Users/eitch/src/git/strolch-bookshop/runtime&lt;/root&gt;
&lt;environment&gt;dev&lt;/environment&gt;
&lt;/env>
&lt;/StrolchBootstrap>
</pre>
<p>Here we define two environments, but the both redefine the environment to dev. This is because we want this
app to start on two different machines with different user home directories. See the profiles in the POM as
to how these environments are activated using a environment property strolch.env.</p>
<p>In this next step we'll create Strolch's configuration at the location we defined in the StrolchBootstrap.xml
file. Strolch's configuration contains of three directories: config, data and temp. config contains static
files which usually aren't changed, data contains model files in XML format and temp is used at runtime for
any temporary files, e.g. storing active sessions.</p>
<p>The configuration as well as the model has been described on Strolch's documentation web page, we'll just
provide you with the files for the bookshop:</p>
<b>PrivilegeConfig.xml</b>
<pre class="pre-scrollable">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;Privilege&gt;
&lt;Container&gt;
&lt;Parameters&gt;
&lt;!-- parameters for the container itself --&gt;
&lt;Parameter name="secretKey" value="45f251ce-d51f-4624-990a-8dcd5b181f0e"/&gt;
&lt;Parameter name="secretSalt" value="4770a32d-1512-4891-9a63-362504932500"/&gt;
&lt;Parameter name="persistSessions" value="true"/&gt;
&lt;Parameter name="autoPersistOnUserChangesData" value="false"/&gt;
&lt;Parameter name="privilegeConflictResolution" value="MERGE"/&gt;
&lt;/Parameters&gt;
&lt;EncryptionHandler class="li.strolch.privilege.handler.DefaultEncryptionHandler"&gt;
&lt;Parameters&gt;
&lt;Parameter name="hashAlgorithm" value="SHA-256"/&gt;
&lt;/Parameters&gt;
&lt;/EncryptionHandler&gt;
&lt;PersistenceHandler class="li.strolch.privilege.handler.XmlPersistenceHandler"&gt;
&lt;Parameters&gt;
&lt;Parameter name="usersXmlFile" value="PrivilegeUsers.xml"/&gt;
&lt;Parameter name="rolesXmlFile" value="PrivilegeRoles.xml"/&gt;
&lt;/Parameters&gt;
&lt;/PersistenceHandler&gt;
&lt;UserChallengeHandler class="li.strolch.privilege.handler.MailUserChallengeHandler"&gt;
&lt;/UserChallengeHandler&gt;
&lt;/Container&gt;
&lt;Policies&gt;
&lt;Policy name="DefaultPrivilege" class="li.strolch.privilege.policy.DefaultPrivilege"/&gt;
&lt;Policy name="RoleAccessPrivilege" class="li.strolch.privilege.policy.RoleAccessPrivilege"/&gt;
&lt;Policy name="UserAccessPrivilege" class="li.strolch.privilege.policy.UserAccessPrivilege"/&gt;
&lt;Policy name="UserSessionAccessPrivilege" class="li.strolch.privilege.policy.UsernameFromCertificatePrivilege"/&gt;
&lt;/Policies&gt;
&lt;/Privilege&gt;
</pre>
<b>PrivilegeRoles.xml</b>
<pre class="pre-scrollable">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;Roles&gt;
&lt;Role name="User"&gt;
&lt;Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege"&gt;
&lt;/Privilege&gt;
&lt;Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege"&gt;
&lt;Allow&gt;internal&lt;/Allow&gt;
&lt;/Privilege&gt;
&lt;/Role&gt;
&lt;Role name="UserPrivileges"&gt;
&lt;Privilege name="PrivilegeSetUserLocale" policy="UserAccessPrivilege" /&gt;
&lt;Privilege name="PrivilegeSetUserPassword" policy="UserAccessPrivilege" /&gt;
&lt;/Role&gt;
&lt;!--
Internal
--&gt;
&lt;Role name="StrolchAdmin"&gt;
&lt;Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege"&gt;
&lt;AllAllowed&gt;true&lt;/AllAllowed&gt;
&lt;/Privilege&gt;
&lt;Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege"&gt;
&lt;AllAllowed&gt;true&lt;/AllAllowed&gt;
&lt;/Privilege&gt;
&lt;Privilege name="PrivilegeAddUser" policy="UserAccessPrivilege"&gt;
&lt;AllAllowed&gt;true&lt;/AllAllowed&gt;
&lt;/Privilege&gt;
&lt;Privilege name="PrivilegeSetUserPassword" policy="UserAccessPrivilege"&gt;
&lt;AllAllowed&gt;true&lt;/AllAllowed&gt;
&lt;/Privilege&gt;
&lt;/Role&gt;
&lt;Role name="agent"&gt;
&lt;Privilege name="li.strolch.privilege.handler.SystemAction" policy="DefaultPrivilege"&gt;
&lt;Allow&gt;li.strolch.runtime.privilege.StrolchSystemAction&lt;/Allow&gt;
&lt;Allow&gt;li.strolch.runtime.privilege.StrolchSystemActionWithResult&lt;/Allow&gt;
&lt;Allow&gt;li.strolch.persistence.postgresql.PostgreSqlSchemaInitializer&lt;/Allow&gt;
&lt;/Privilege&gt;
&lt;Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege"&gt;
&lt;AllAllowed&gt;true&lt;/AllAllowed&gt;
&lt;/Privilege&gt;
&lt;Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege"&gt;
&lt;AllAllowed&gt;true&lt;/AllAllowed&gt;
&lt;/Privilege&gt;
&lt;Privilege name="PrivilegeAction" policy="DefaultPrivilege"&gt;
&lt;Allow&gt;Persist&lt;/Allow&gt;
&lt;Allow&gt;PersistSessions&lt;/Allow&gt;
&lt;Allow&gt;GetCertificates&lt;/Allow&gt;
&lt;/Privilege&gt;
&lt;Privilege name="PrivilegeAddUser" policy="UserAccessPrivilege"&gt;
&lt;AllAllowed&gt;true&lt;/AllAllowed&gt;
&lt;/Privilege&gt;
&lt;Privilege name="PrivilegeModifyUser" policy="UserAccessPrivilege"&gt;
&lt;AllAllowed&gt;true&lt;/AllAllowed&gt;
&lt;/Privilege&gt;
&lt;Privilege name="PrivilegeGetUser" policy="UserAccessPrivilege"&gt;
&lt;AllAllowed&gt;true&lt;/AllAllowed&gt;
&lt;/Privilege&gt;
&lt;/Role&gt;
&lt;/Roles&gt;
</pre>
<b>PrivilegeUsers.xml</b>
<pre class="pre-scrollable">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;Users&gt;
&lt;User userId="U10" username="jill" password="8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918"&gt;
&lt;Firstname&gt;Jill&lt;/Firstname&gt;
&lt;Lastname&gt;Someone&lt;/Lastname&gt;
&lt;State&gt;ENABLED&lt;/State&gt;
&lt;Locale&gt;en_GB&lt;/Locale&gt;
&lt;Roles&gt;
&lt;Role&gt;User&lt;/Role&gt;
&lt;Role&gt;UserPrivileges&lt;/Role&gt;
&lt;/Roles&gt;
&lt;Properties&gt;
&lt;Property name="email" value="eitch+jill@eitchnet.ch" /&gt;
&lt;/Properties&gt;
&lt;/User&gt;
&lt;User userId="U01" username="admin" password="8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918"&gt;
&lt;Firstname&gt;Jill&lt;/Firstname&gt;
&lt;Lastname&gt;Someone&lt;/Lastname&gt;
&lt;State&gt;ENABLED&lt;/State&gt;
&lt;Locale&gt;en_GB&lt;/Locale&gt;
&lt;Roles&gt;
&lt;Role&gt;StrolchAdmin&lt;/Role&gt;
&lt;Role&gt;UserPrivileges&lt;/Role&gt;
&lt;/Roles&gt;
&lt;Properties&gt;
&lt;Property name="email" value="eitch+admin@eitchnet.ch" /&gt;
&lt;/Properties&gt;
&lt;/User&gt;
&lt;!--
Internal
--&gt;
&lt;User userId="S01" username="agent"&gt;
&lt;State&gt;SYSTEM&lt;/State&gt;
&lt;Roles&gt;
&lt;Role&gt;agent&lt;/Role&gt;
&lt;/Roles&gt;
&lt;/User&gt;
&lt;/Users&gt;
</pre>
<b>StrolchConfiguration.xml</b>
<pre class="pre-scrollable">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;StrolchConfiguration&gt;
&lt;env id="global"&gt;
&lt;Runtime&gt;
&lt;applicationName&gt;Bookshop&lt;/applicationName&gt;
&lt;Properties&gt;
&lt;locale&gt;en&lt;/locale&gt;
&lt;verbose&gt;true&lt;/verbose&gt;
&lt;/Properties&gt;
&lt;/Runtime&gt;
&lt;Component&gt;
&lt;name&gt;PrivilegeHandler&lt;/name&gt;
&lt;api&gt;li.strolch.runtime.privilege.PrivilegeHandler&lt;/api&gt;
&lt;impl&gt;li.strolch.runtime.privilege.DefaultStrolchPrivilegeHandler&lt;/impl&gt;
&lt;Properties&gt;
&lt;privilegeConfigFile&gt;PrivilegeConfig.xml&lt;/privilegeConfigFile&gt;
&lt;/Properties&gt;
&lt;/Component&gt;
&lt;Component&gt;
&lt;name&gt;RealmHandler&lt;/name&gt;
&lt;api&gt;li.strolch.agent.api.RealmHandler&lt;/api&gt;
&lt;impl&gt;li.strolch.agent.impl.DefaultRealmHandler&lt;/impl&gt;
&lt;depends&gt;PrivilegeHandler&lt;/depends&gt;
&lt;Properties&gt;
&lt;realms&gt;defaultRealm&lt;/realms&gt;
&lt;dataStoreMode&gt;TRANSIENT&lt;/dataStoreMode&gt;
&lt;dataStoreFile&gt;defaultModel.xml&lt;/dataStoreFile&gt;
&lt;enableObserverUpdates&gt;true&lt;/enableObserverUpdates&gt;
&lt;/Properties&gt;
&lt;/Component&gt;
&lt;Component&gt;
&lt;name&gt;ServiceHandler&lt;/name&gt;
&lt;api&gt;li.strolch.service.api.ServiceHandler&lt;/api&gt;
&lt;impl&gt;li.strolch.service.api.DefaultServiceHandler&lt;/impl&gt;
&lt;depends&gt;RealmHandler&lt;/depends&gt;
&lt;depends&gt;PrivilegeHandler&lt;/depends&gt;
&lt;Properties&gt;
&lt;verbose&gt;true&lt;/verbose&gt;
&lt;/Properties&gt;
&lt;/Component&gt;
&lt;Component&gt;
&lt;name&gt;PolicyHandler&lt;/name&gt;
&lt;api&gt;li.strolch.policy.PolicyHandler&lt;/api&gt;
&lt;impl&gt;li.strolch.policy.DefaultPolicyHandler&lt;/impl&gt;
&lt;Properties&gt;
&lt;readPolicyFile&gt;true&lt;/readPolicyFile&gt;
&lt;/Properties&gt;
&lt;/Component&gt;
&lt;Component&gt;
&lt;name&gt;ExecutionHandler&lt;/name&gt;
&lt;api&gt;li.strolch.execution.ExecutionHandler&lt;/api&gt;
&lt;impl&gt;li.strolch.execution.EventBasedExecutionHandler&lt;/impl&gt;
&lt;depends&gt;RealmHandler&lt;/depends&gt;
&lt;depends&gt;PrivilegeHandler&lt;/depends&gt;
&lt;/Component&gt;
&lt;Component&gt;
&lt;name&gt;RestfulHandler&lt;/name&gt;
&lt;api&gt;li.strolch.rest.RestfulStrolchComponent&lt;/api&gt;
&lt;impl&gt;li.strolch.rest.RestfulStrolchComponent&lt;/impl&gt;
&lt;depends&gt;SessionHandler&lt;/depends&gt;
&lt;Properties&gt;
&lt;secureCookie&gt;false&lt;/secureCookie&gt;
&lt;restLogging&gt;false&lt;/restLogging&gt;
&lt;restLoggingEntity&gt;false&lt;/restLoggingEntity&gt;
&lt;restTracing&gt;ALL&lt;/restTracing&gt;
&lt;/Properties&gt;
&lt;/Component&gt;
&lt;Component&gt;
&lt;name&gt;SessionHandler&lt;/name&gt;
&lt;api&gt;li.strolch.rest.StrolchSessionHandler&lt;/api&gt;
&lt;impl&gt;li.strolch.rest.DefaultStrolchSessionHandler&lt;/impl&gt;
&lt;depends&gt;PrivilegeHandler&lt;/depends&gt;
&lt;Properties&gt;
&lt;session.ttl.minutes&gt;30&lt;/session.ttl.minutes&gt;
&lt;session.reload&gt;true&lt;/session.reload&gt;
&lt;/Properties&gt;
&lt;/Component&gt;
&lt;Component&gt;
&lt;name&gt;MailHandler&lt;/name&gt;
&lt;api&gt;li.strolch.handler.mail.MailHandler&lt;/api&gt;
&lt;impl&gt;li.strolch.handler.mail.SmtpMailHandler&lt;/impl&gt;
&lt;Properties&gt;
&lt;fromAddr&gt;relayer@eitchnet.ch&lt;/fromAddr&gt;
&lt;fromName&gt;Susi&lt;/fromName&gt;
&lt;overrideRecipients&gt;IPSC Test &lt;eitch@eitchnet.ch&gt;&lt;/overrideRecipients&gt;
&lt;recipientWhitelist&gt;eitch@eitchnet.ch&lt;/recipientWhitelist&gt;
&lt;username&gt;test&lt;/username&gt;
&lt;password&gt;test&lt;/password&gt;
&lt;auth&gt;true&lt;/auth&gt;
&lt;startTls&gt;true&lt;/startTls&gt;
&lt;host&gt;smtp.gmail.com&lt;/host&gt;
&lt;port&gt;587&lt;/port&gt;
&lt;/Properties&gt;
&lt;/Component&gt;
&lt;/env&gt;
&lt;env id="dev"&gt;
&lt;!-- overrides go here --&gt;
&lt;/env&gt;
&lt;/StrolchConfiguration&gt;
</pre>
<b>StrolchPolicies.xml</b>
<pre class="pre-scrollable">
&lt;StrolchPolicies&gt;
&lt;PolicyType Type="ExecutionPolicy" Api="li.strolch.execution.policy.ExecutionPolicy"&gt;
&lt;Policy Key="DurationExecution" Class="li.strolch.execution.policy.DurationExecution" /&gt;
&lt;Policy Key="ReservationExection" Class="li.strolch.execution.policy.ReservationExection" /&gt;
&lt;/PolicyType&gt;
&lt;PolicyType Type="ConfirmationPolicy" Api="li.strolch.execution.policy.ConfirmationPolicy"&gt;
&lt;Policy Key="DefaultConfirmation" Class="li.strolch.execution.policy.ConfirmationPolicy" /&gt;
&lt;/PolicyType&gt;
&lt;PolicyType Type="ActivityArchivalPolicy" Api="li.strolch.execution.policy.ActivityArchivalPolicy"&gt;
&lt;Policy Key="DefaultActivityArchival" Class="li.strolch.execution.policy.ActivityArchivalPolicy" /&gt;
&lt;/PolicyType&gt;
&lt;/StrolchPolicies&gt;
</pre>
<p>A few notes on the configuration:</p>
<ul>
<li>Note how there are three users. Jill is a user with currently no privileges as it's role definition is
empty. Admin can do everything, and the agent user is a system user which can also do everything.
</li>
<li>There is one realm defined in the <code>RealmHandler</code> component which references the <code>defaultModel.xml</code>
file in the data directory. This file then includes the currently still empty <code>templates.xml</code>
file.
</li>
<li>We have defined a global environment, but are using the dev environment. The dev environment includes
the definitions in the global environment.
</li>
<li>In <code>PrivilegeConfig.xml</code> we have enabled persistence of sessions, so you will be needing the
unlimited JCE libraries for your JVM and when you restart the server, you don't need to log back in, if
your session is still alive.
</li>
</ul>
<p>Your project is now ready to be imported into your favourite IDE. We have used both IntelliJ and Eclipse so
this is up to you.</p>
Now that we have a configuration, it is time to have Strolch started when the WAR is deployed and started. In
your IDE create a new class as follows:</p>
<b>StartupListener.java</b>
<pre class="pre-scrollable">
package li.strolch.bookshop.web;
import java.io.InputStream;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import li.strolch.agent.api.StrolchAgent;
import li.strolch.agent.api.StrolchBootstrapper;
@WebListener
public class StartupListener implements ServletContextListener {
private static final Logger logger = LoggerFactory.getLogger(StartupListener.class);
private StrolchAgent agent;
@Override
public void contextInitialized(ServletContextEvent sce) {
logger.info("Starting Bookshop...");
try {
// we load the configuration by reading the boot strap file:
String boostrapFileName = "/WEB-INF/" + StrolchBootstrapper.FILE_BOOTSTRAP;
InputStream bootstrapFile = sce.getServletContext().getResourceAsStream(boostrapFileName);
StrolchBootstrapper bootstrapper = new StrolchBootstrapper(StartupListener.class);
// now setup, initialize and start Strolch:
this.agent = bootstrapper.setupByBoostrapFile(StartupListener.class, bootstrapFile);
this.agent.initialize();
this.agent.start();
} catch (Exception e) {
logger.error("Failed to start Bookshop due to: " + e.getMessage(), e);
throw e;
}
logger.info("Started Bookshop.");
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
if (this.agent != null) {
this.agent.stop();
this.agent.destroy();
}
logger.info("Destroyed Bookshop.");
}
}
</pre>
<p>Now configure your IDE to start the web project, and then once it has started, you should see the following
in the logs:</p>
<pre class="pre-scrollable">
Bookshop:dev All 8 Strolch Components started. Strolch is now ready to be used. Have fun =))
</pre>
<p>This log tells us the name of the app as defined in the StrolchConfiguration.xml file as well as which
environment was loaded. Further we can see that 8 components were configured and started.</p>
<p>This concludes the initial setup of a new Strolch project. We can now go ahead and start building the
business logic.</p>
<!-- content here -->
<a href="tutorial.html" class="pull-left">Previous: Start</a><a href="tutorial-model.html" class="pull-right">Next:
Model</a>
</div>
<!-- /.content -->
<div id="footer">
<div class="container">
<p class="text-muted">&copy; Strolch / <a href="mailto:eitch@eitchnet.ch">Robert von Burg</a> / Hosting by
<a href="http://www.eitchnet.ch">eitchnet.ch</a></p>
</div>
</div>
</div>
<!-- /.container -->
<!-- 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 -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = (("https:" == document.location.protocol) ? "https" : "http") + "://piwik.eitchnet.ch/";
_paq.push(['setTrackerUrl', u + 'piwik.php']);
_paq.push(['setSiteId', 2]);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.defer = true;
g.async = true;
g.src = u + 'piwik.js';
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 -->
</body>
</html>

View File

@ -0,0 +1,195 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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="">
<link rel="shortcut icon" href="ico/favicon.ico">
<title>Strolch: Tutorial Model</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/custom.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script><![endif]-->
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">Strolch</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li class="active"><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<div class="container">
<div class="page-header">
<h1 class="page-title">Tutorial: Model</h1>
<p class="lead page-description">Defining the model for the bookshop</p>
</div>
<div class="content">
<a href="tutorial-configuration.html" class="pull-left">Previous: Configuration</a><a href="tutorial-.html"
class="pull-right">Next: </a>
<br><br>
<p>Looking back at our functionality, we can list the following entities that need to be modelled:</p>
<ul>
<li>Book &rightarrow; books can be orderd</li>
<li>UserCart &rightarrow; we want to store the cart of the user</li>
<li>Account &rightarrow; we need to know where to send the orders</li>
<li>Order &rightarrow; we need to know what was ordered and keep track of its state</li>
<li>FromStock &rightarrow; we want to use activities to implement the process of an order</li>
</ul>
<p>In Strolch we model entities by defining the element as a template. Thus in the <code>templates.xml</code>
file we can add the templates with the following content:</p>
<b>Book</b>
<pre class="pre-scrollable">
&lt;Resource Id="Book" Name="Book Template" Type="Template"&gt;
&lt;ParameterBag Id="parameters" Name="Parameters" Type="Parameters"&gt;
&lt;Parameter Id="description" Name="Description" Type="String" Value="" /&gt;
&lt;Parameter Id="quantity" Name="Quantity in Stock" Type="Integer" Value="0" /&gt;
&lt;/ParameterBag&gt;
&lt;/Resource&gt;
</pre>
<b>UserCart</b>
<pre class="pre-scrollable">
&lt;Resource Id="UserCart" Name="UserCart Template" Type="Template"&gt;
&lt;ParameterBag Id="books" Name="Books" Type="Book"&gt;
&lt;!-- Parameter Id="bookId" Name="Book reference" Type="Float" Value="0" / --&gt;
&lt;/ParameterBag&gt;
&lt;ParameterBag Id="relations" Name="Relations" Type="Parameters"&gt;
&lt;Parameter Id="account" Name="Account" Type="String" Interpretation="Resource-Ref" Uom="Account" Value="" /&gt;
&lt;/ParameterBag&gt;
&lt;/Resource&gt;
</pre>
<b>Account</b>
<pre class="pre-scrollable">
&lt;Resource Id="Account" Name="Account Template" Type="Template"&gt;
&lt;ParameterBag Id="parameters" Name="Parameters" Type="Parameters"&gt;
&lt;Parameter Id="user" Name="User" Type="String" Value="" /&gt;
&lt;Parameter Id="firstName" Name="First Name" Type="String" Value="" /&gt;
&lt;Parameter Id="lastName" Name="Last Name" Type="String" Value="" /&gt;
&lt;Parameter Id="email" Name="E-Mail" Type="String" Value="" /&gt;
&lt;/ParameterBag&gt;
&lt;ParameterBag Name="Address" Id="address" Type="Address"&gt;
&lt;Parameter Id="phone" Name="Telephone Number" Type="String" Value="" /&gt;
&lt;Parameter Id="street" Name="Street" Type="String" Value="" /&gt;
&lt;Parameter Id="city" Name="City" Type="String" Value="" /&gt;
&lt;Parameter Id="zip" Name="Postal Code" Type="String" Value="" /&gt;
&lt;Parameter Id="country" Name="Country" Type="String" Value="" /&gt;
&lt;/ParameterBag&gt;
&lt;/Resource&gt;
</pre>
<b>Order</b>
<pre class="pre-scrollable">
&lt;Order Id="Order" Name="Order Template" Type="Template" State="Created"&gt;
&lt;ParameterBag Id="books" Name="Books" Type="Book"&gt;
&lt;!-- Parameter Id="bookId" Name="Book reference" Type="Float" Value="0" / --&gt;
&lt;/ParameterBag&gt;
&lt;ParameterBag Id="relations" Name="Relations" Type="Parameters"&gt;
&lt;Parameter Id="account" Name="Account" Type="String" Interpretation="Resource-Ref" Uom="Account" Value="" /&gt;
&lt;/ParameterBag&gt;
&lt;/Order&gt;
</pre>
<b>FromStock</b>
<pre class="pre-scrollable">
&lt;Activity Id="FromStock" Name="From Stock Template" Type="FromStock" TimeOrdering="Series"&gt;
&lt;ParameterBag Name="objectives" Id="Objectives" Type="Objectives"&gt;
&lt;Parameter Name="Duration" Id="duration" Value="PT1MS" Type="Duration" /&gt;
&lt;/ParameterBag&gt;
&lt;Action Id="Validate" Name="Validation of order" Type="Use" ResourceType="Validation" ResourceId="validation" /&gt;
&lt;!-- for each book we do a consume, i.e. reduce the stock quantity --&gt;
&lt;Action Id="Consume" Name="Consume Template for book" Type="Template"&gt;
&lt;ParameterBag Id="parameters" Name="Parameters" Type="Parameters"&gt;
&lt;Parameter Id="quantity" Name="Quantity" Type="Float" Value="0" /&gt;
&lt;/ParameterBag&gt;
&lt;/Action&gt;
&lt;Action Id="Package" Name="Packaging of Order" Type="Use" ResourceType="Packaging" ResourceId="packaging" /&gt;
&lt;Action Id="Send" Name="Sending of package" Type="Use" ResourceType="Sending" ResourceId="sending" /&gt;
&lt;/Activity&gt;
</pre>
<p>Let's explain a few things:</p>
<ul>
<li></li>
</ul>
<a href="tutorial-configuration.html" class="pull-left">Previous: Configuration</a><a href="tutorial-.html"
class="pull-right">Next: </a>
<!-- content here -->
<a href="tutorial-model.html"></a>
</div>
<!-- /.content -->
<div id="footer">
<div class="container">
<p class="text-muted">&copy; Strolch / <a href="mailto:eitch@eitchnet.ch">Robert von Burg</a> / Hosting by
<a href="http://www.eitchnet.ch">eitchnet.ch</a></p>
</div>
</div>
</div>
<!-- /.container -->
<!-- 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 -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = (("https:" == document.location.protocol) ? "https" : "http") + "://piwik.eitchnet.ch/";
_paq.push(['setTrackerUrl', u + 'piwik.php']);
_paq.push(['setSiteId', 2]);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.defer = true;
g.async = true;
g.src = u + 'piwik.js';
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 -->
</body>
</html>

View File

@ -0,0 +1,118 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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="">
<link rel="shortcut icon" href="ico/favicon.ico">
<title>Strolch: Tutorial</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/custom.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script><![endif]-->
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">Strolch</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Overview</a></li>
<li><a href="api.html">API</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li class="active"><a href="tutorial.html">Tutorial</a></li>
<li><a href="downloads.html">Downloads</a></li>
<li><a href="development.html">Development</a></li>
<li><a href="blog.html">Blog</a></li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<div class="container">
<div class="page-header">
<h1 class="page-title">Tutorial</h1>
<p class="lead page-description">Let's build a bookshop!</p>
</div>
<div class="content">
<p>In this tutorial we will build a book store using Strolch. This book store will be without a UI, but we will
do everything using REST APIs, which should make it easy to add a UI later using whatever framework suits one
most.</p>
<p>The book store will have the following features:</p>
<ul>
<li>The store owner can add, update and remove books</li>
<li>The store owner can edit the stock quantity</li>
<li>Users can view a list of books</li>
<li>Users can add books to a virtual cart</li>
<li>Users can create and verify an account using an e-mail address</li>
<li>Users can submit an order for the books in their cart</li>
<li>The store owner can see the orders by state (pending, preparing, sent)</li>
<li>The store owner can update the state of an order (preparing, sent)</li>
<li>Notify the user when the order is sent</li>
</ul>
<p>Navigation:</p>
<ul>
<li><a href="tutorial-configuration.html">Configuration</a></li>
<li><a href="tutorial-model.html">Model</a></li>
</ul>
<a href="tutorial-configuration.html" class="pull-right">Next: Configuration</a>
</div>
<!-- /.content -->
<div id="footer">
<div class="container">
<p class="text-muted">&copy; Strolch / <a href="mailto:eitch@eitchnet.ch">Robert von Burg</a> / Hosting by
<a href="http://www.eitchnet.ch">eitchnet.ch</a></p>
</div>
</div>
</div>
<!-- /.container -->
<!-- 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 -->
<script src="js/bootstrap.min.js"></script>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = (("https:" == document.location.protocol) ? "https" : "http") + "://piwik.eitchnet.ch/";
_paq.push(['setTrackerUrl', u + 'piwik.php']);
_paq.push(['setSiteId', 2]);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.defer = true;
g.async = true;
g.src = u + 'piwik.js';
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 -->
</body>
</html>