132 lines
42 KiB
HTML
132 lines
42 KiB
HTML
<!doctype html><html lang=en class="js csstransforms3d"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=generator content="Hugo 0.80.0"><meta name=description content="Strolch is a parameterized framework for use on servers and IoT"><meta name=author content="Strolch"><link rel=icon href=/favicon.ico type=image/ico><title>API - Strolch</title><link href=/css/nucleus.css?1650626698 rel=stylesheet><link href=/css/fontawesome-all.min.css?1650626698 rel=stylesheet><link href=/css/hybrid.css?1650626698 rel=stylesheet><link href=/css/featherlight.min.css?1650626698 rel=stylesheet><link href=/css/perfect-scrollbar.min.css?1650626698 rel=stylesheet><link href=/css/auto-complete.css?1650626698 rel=stylesheet><link href=/css/atom-one-dark-reasonable.css?1650626698 rel=stylesheet><link href=/css/theme.css?1650626698 rel=stylesheet><link href=/css/hugo-theme.css?1650626698 rel=stylesheet><link href=/css/theme-green.css?1650626698 rel=stylesheet><script src=/js/jquery-3.3.1.min.js?1650626698></script><style>:root #header+#content>#left>#rlblock_left{display:none!important}</style></head><body data-url=/api/><nav id=sidebar><div id=header-wrapper><div id=header><a id=logo href=/><img src=/logo.png></a></div><div class=searchbox><label for=search-by><i class="fas fa-search"></i></label><input data-search-input id=search-by type=search placeholder=Search...>
|
|
<span data-search-clear><i class="fas fa-times"></i></span></div><script type=text/javascript src=/js/lunr.min.js?1650626698></script><script type=text/javascript src=/js/auto-complete.js?1650626698></script><script type=text/javascript>var baseurl="https:\/\/strolch.li\/";</script><script type=text/javascript src=/js/search.js?1650626698></script></div><section id=homelinks><ul><li><a class=padding href=/><i class="fas fa-home"></i>Home</a></li></ul></section><div class=highlightable><ul class=topics><li data-nav-id=/api/ title=API class="dd-item
|
|
parent
|
|
active"><a href=/api/>API</a></li><li data-nav-id=/documentation/ title=Documentation class=dd-item><a href=/documentation/>Documentation</a><ul><li data-nav-id=/documentation/architecture/ title=Architecture class=dd-item><a href=/documentation/architecture/>Architecture</a></li><li data-nav-id=/documentation/model/ title=Model class=dd-item><a href=/documentation/model/>Model</a></li><li data-nav-id=/documentation/do-and-donts/ title="Do and Don't" class=dd-item><a href=/documentation/do-and-donts/>Do and Don't</a></li><li data-nav-id=/documentation/runtime-configuration/ title="Runtime Configuration" class=dd-item><a href=/documentation/runtime-configuration/>Runtime Configuration</a></li><li data-nav-id=/documentation/realms/ title=Realms class=dd-item><a href=/documentation/realms/>Realms</a></li><li data-nav-id=/documentation/components/ title=Components class=dd-item><a href=/documentation/components/>Components</a></li><li data-nav-id=/documentation/services-and-commands/ title="Services and Commands" class=dd-item><a href=/documentation/services-and-commands/>Services and Commands</a></li><li data-nav-id=/documentation/searches/ title=Searches class=dd-item><a href=/documentation/searches/>Searches</a></li><li data-nav-id=/documentation/queries/ title=Queries class=dd-item><a href=/documentation/queries/>Queries</a></li><li data-nav-id=/documentation/transactions/ title=Transactions class=dd-item><a href=/documentation/transactions/>Transactions</a></li><li data-nav-id=/documentation/policies/ title=Policies class=dd-item><a href=/documentation/policies/>Policies</a></li><li data-nav-id=/documentation/observers/ title=Observers class=dd-item><a href=/documentation/observers/>Observers</a></li><li data-nav-id=/documentation/versioning/ title=Versioning class=dd-item><a href=/documentation/versioning/>Versioning</a></li><li data-nav-id=/documentation/reports/ title=Reports class=dd-item><a href=/documentation/reports/>Reports</a></li><li data-nav-id=/documentation/priviles/ title=Privileges class=dd-item><a href=/documentation/priviles/>Privileges</a></li></ul></li><li data-nav-id=/plc/ title=PLC class=dd-item><a href=/plc/>PLC</a><ul><li data-nav-id=/plc/architecture/ title=Architecture class=dd-item><a href=/plc/architecture/>Architecture</a></li><li data-nav-id=/plc/example-set-up/ title="Example Set-Up" class=dd-item><a href=/plc/example-set-up/>Example Set-Up</a></li></ul></li><li data-nav-id=/tutorial/ title=Tutorial class=dd-item><a href=/tutorial/>Tutorial</a><ul><li data-nav-id=/tutorial/configuration/ title=Configuration class=dd-item><a href=/tutorial/configuration/>Configuration</a></li><li data-nav-id=/tutorial/model/ title=Model class=dd-item><a href=/tutorial/model/>Model</a></li><li data-nav-id=/tutorial/crud-book/ title="CRUD Book" class=dd-item><a href=/tutorial/crud-book/>CRUD Book</a></li></ul></li><li data-nav-id=/download/ title=Download class=dd-item><a href=/download/>Download</a></li><li data-nav-id=/development/ title=Development class=dd-item><a href=/development/>Development</a></li><li data-nav-id=/blog/ title=Blog class=dd-item><a href=/blog/>Blog</a><ul><li data-nav-id=/blog/post-00016/ title="Strolch PLC now also on Maven Central" class=dd-item><a href=/blog/post-00016/>Strolch PLC now also on Maven Central</a></li><li data-nav-id=/blog/post-00015/ title="Release of Strolch 1.6.100" class=dd-item><a href=/blog/post-00015/>Release of Strolch 1.6.100</a></li><li data-nav-id=/blog/post-00014/ title="Strolch Reports" class=dd-item><a href=/blog/post-00014/>Strolch Reports</a></li><li data-nav-id=/blog/post-00013/ title="Strolch Searches" class=dd-item><a href=/blog/post-00013/>Strolch Searches</a></li><li data-nav-id=/blog/post-00012/ title="Wow, the many changes!" class=dd-item><a href=/blog/post-00012/>Wow, the many changes!</a></li><li data-nav-id=/blog/post-00011/ title="Strolch now on Maven Central" class=dd-item><a href=/blog/post-00011/>Strolch now on Maven Central</a></li><li data-nav-id=/blog/post-00010/ title="Versioning of objects" class=dd-item><a href=/blog/post-00010/>Versioning of objects</a></li><li data-nav-id=/blog/post-00009/ title="Release 1.2.0" class=dd-item><a href=/blog/post-00009/>Release 1.2.0</a></li><li data-nav-id=/blog/post-00008/ title="Strolch Update" class=dd-item><a href=/blog/post-00008/>Strolch Update</a></li><li data-nav-id=/blog/post-00007/ title="Activities: Beginning of the planning engine" class=dd-item><a href=/blog/post-00007/>Activities: Beginning of the planning engine</a></li><li data-nav-id=/blog/post-00006/ title="Strolch Documentation" class=dd-item><a href=/blog/post-00006/>Strolch Documentation</a></li><li data-nav-id=/blog/post-00005/ title="Strolch Release 1.0.0" class=dd-item><a href=/blog/post-00005/>Strolch Release 1.0.0</a></li><li data-nav-id=/blog/post-00004/ title="DurationParameter and other minor changes: Release 1.0.0-RC4" class=dd-item><a href=/blog/post-00004/>DurationParameter and other minor changes: Release 1.0.0-RC4</a></li><li data-nav-id=/blog/post-00003/ title="DB Initialization: Release 1.0.0-RC3" class=dd-item><a href=/blog/post-00003/>DB Initialization: Release 1.0.0-RC3</a></li><li data-nav-id=/blog/post-00002/ title="Release 1.0.0-RC2" class=dd-item><a href=/blog/post-00002/>Release 1.0.0-RC2</a></li><li data-nav-id=/blog/post-00001/ title="Release 1.0.0-RC1" class=dd-item><a href=/blog/post-00001/>Release 1.0.0-RC1</a></li></ul></li></ul><section id=shortcuts><h3>More</h3><ul><li><a class=padding href=https://strolch.li/tags><i class="fas fa-tags"></i>Tags</a></li><li><a class=padding href=https://github.com/strolch-li target=_blank><i class="fab fa-github"></i>GitHub project</a></li></ul></section><section id=footer><p>Built with <a href=https://github.com/matcornic/hugo-theme-learn target=_blank><i class="fas fa-heart"></i></a>from <a href=https://getgrav.org target=_blank>Grav</a> and <a href=https://gohugo.io/ target=_blank>Hugo</a></p></section></div></nav><section id=body><div id=overlay></div><div class="padding highlightable"><div><div id=top-bar><div id=top-github-link><a class=github-link title="Edit this page" href=https://github.com/strolch-li/strolch-website/tree/develop/content/api/_index.md target=blank><i class="fas fa-code-branch"></i><span id=top-github-link-text>Edit this page</span></a></div><div id=breadcrumbs itemscope itemtype=http://data-vocabulary.org/Breadcrumb><span id=sidebar-toggle-span><a href=# id=sidebar-toggle data-sidebar-toggle><i class="fas fa-bars"></i></a></span><span id=toc-menu><i class="fas fa-list-alt"></i></span><span class=links><a href=/>Strolch Overview</a> > API</span></div><div class=progress><div class=wrapper><nav id=TableOfContents><ul><li><a href=#overview>Overview</a></li><li><a href=#model>Model</a></li><li><a href=#realms>Realms</a></li></ul></nav></div></div></div></div><div id=head-tags></div><div id=body-inner><h1>API</h1><h2 id=overview>Overview</h2><p>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.</p><p>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 the
|
|
TX retrieves the elements.</p><h2 id=model>Model</h2><p>The Strolch model is implemented in the project li.strolch.model.</p><p>The Strolch model consists of three root level elements: Resource,
|
|
Order and Activity. Each element has at least the following attributes:</p><ul><li>Id → the element’s id</li><li>Name → the element’s name</li><li>Type → the element’s type</li></ul><p>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:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>public</span> <span style=color:#66d9ef>class</span> <span style=color:#a6e22e>Test</span> <span style=color:#f92672>{</span>
|
|
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>static</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>main</span><span style=color:#f92672>(</span>String<span style=color:#f92672>[]</span> args<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
|
|
<span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> openTx<span style=color:#f92672>(</span>realmName<span style=color:#f92672>))</span> <span style=color:#f92672>{</span>
|
|
Resource resource <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceBy</span><span style=color:#f92672>(</span><span style=color:#e6db74>"MyType"</span><span style=color:#f92672>,</span> <span style=color:#e6db74>"myResource"</span><span style=color:#f92672>);</span>
|
|
Date date <span style=color:#f92672>=</span> resource<span style=color:#f92672>.</span><span style=color:#a6e22e>getDate</span><span style=color:#f92672>(</span><span style=color:#e6db74>"myBag"</span><span style=color:#f92672>,</span> <span style=color:#e6db74>"myParam1"</span><span style=color:#f92672>);</span>
|
|
logger<span style=color:#f92672>.</span><span style=color:#a6e22e>info</span><span style=color:#f92672>(</span><span style=color:#e6db74>"myParam date has value "</span> <span style=color:#f92672>+</span> date<span style=color:#f92672>);</span>
|
|
<span style=color:#f92672>}</span>
|
|
<span style=color:#f92672>}</span>
|
|
<span style=color:#f92672>}</span>
|
|
</code></pre></div><p>XML Presentation of Strolch’s top level elements of Resources:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#75715e><!-- Resource instance --></span>
|
|
<span style=color:#f92672><Resource</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myResource"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Test Name"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"MyType"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"parameters"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Parameters"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Parameters"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam2"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"StringList Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"StringList"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"Hello, World"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam1"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Date Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Date"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"2012-11-30T18:12:05.628+01:00"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam3"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"String Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"String"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"Strolch"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672></ParameterBag></span>
|
|
<span style=color:#f92672><ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"additionalParameters"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Parameters"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Parameters"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam1"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Long Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Long"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"4453234566"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam2"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Integer Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Integer"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"77"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam3"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Float Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Float"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"44.3"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam4"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Boolean Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Boolean"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"true"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672></ParameterBag></span>
|
|
<span style=color:#f92672><TimedState</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myState"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Integer State"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"IntegerState"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Value</span> <span style=color:#a6e22e>Time=</span><span style=color:#e6db74>"0"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"1"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Value</span> <span style=color:#a6e22e>Time=</span><span style=color:#e6db74>"1"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"2"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Value</span> <span style=color:#a6e22e>Time=</span><span style=color:#e6db74>"2"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"3"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672></TimedState></span>
|
|
<span style=color:#f92672></Resource></span>
|
|
</code></pre></div><p>XML Presentation of Strolch’s top level elements of Orders:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#75715e><!-- Order instance --></span>
|
|
<span style=color:#f92672><Order</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myOrder"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Test Name"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"MyOrderType"</span> <span style=color:#a6e22e>Date=</span><span style=color:#e6db74>"2013-11-20T07:42:57.699Z"</span> <span style=color:#a6e22e>State=</span><span style=color:#e6db74>"CREATED"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"parameters"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Parameters"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Parameters"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam2"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"StringList Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"StringList"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"Hello, World"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam1"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Date Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Date"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"2012-11-30T18:12:05.628+01:00"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam3"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"String Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"String"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"Strolch"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672></ParameterBag></span>
|
|
<span style=color:#f92672><ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"additionalParameters"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Parameters"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Parameters"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam1"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Long Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Long"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"4453234566"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam2"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Integer Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Integer"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"77"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam3"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Float Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Float"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"44.3"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"myParam4"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Boolean Param"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Boolean"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"true"</span> <span style=color:#f92672>/></span>
|
|
<span style=color:#f92672></ParameterBag></span>
|
|
<span style=color:#f92672></Order></span>
|
|
</code></pre></div><p>XML Presentation of Strolch’s top level elements of Activities:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=color:#75715e><!-- Activity instance --></span>
|
|
<span style=color:#f92672><Activity</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"bicycleProduction"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Bicycle Production"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Series"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Activity</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"componentProduction"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Production of components"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Series"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"consumeGears"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Gears"</span> <span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>"gears"</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>"Article"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Consume"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"objectives"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Production goals"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Objectives"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"quantity"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Quantity"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Float"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"1"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"duration"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"PT0S"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672></ParameterBag></span>
|
|
<span style=color:#f92672></Action></span>
|
|
<span style=color:#f92672><Activity</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"frameProduction"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Production frame"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Series"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"produce"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Production frame"</span> <span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>"frameProduction"</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>"Machine"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Use"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"objectives"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Production goals"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Objectives"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"quantity"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Quantity"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Float"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"1"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"duration"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"PT5M"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672></ParameterBag></span>
|
|
<span style=color:#f92672></Action></span>
|
|
<span style=color:#f92672><Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"toStock"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Frame ToStock"</span> <span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>"frame"</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>"Article"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Produce"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"objectives"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Production goals"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Objectives"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"quantity"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Quantity"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Float"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"1"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"duration"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"PT1M"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672></ParameterBag></span>
|
|
<span style=color:#f92672></Action></span>
|
|
<span style=color:#f92672></Activity></span>
|
|
<span style=color:#f92672><Activity</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"brakeProduction"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Herstellen Bremsen"</span> <span style=color:#a6e22e>TimeOrdering=</span><span style=color:#e6db74>"Series"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Series"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"produce"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Production saddle"</span> <span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>"saddleProduction"</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>"Machine"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Use"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"objectives"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Production goals"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Objectives"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"quantity"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Quantity"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Float"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"1"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"duration"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"PT5M"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672></ParameterBag></span>
|
|
<span style=color:#f92672></Action></span>
|
|
<span style=color:#f92672><Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"toStock"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Saddle ToStock"</span> <span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>"frame"</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>"Article"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Produce"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"objectives"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Production goals"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Objectives"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"quantity"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Quantity"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Float"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"1"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"duration"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"PT1M"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672></ParameterBag></span>
|
|
<span style=color:#f92672></Action></span>
|
|
<span style=color:#f92672></Activity></span>
|
|
<span style=color:#f92672></Activity></span>
|
|
<span style=color:#f92672><Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"assembly"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Bicycle assemble"</span> <span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>"bicycleAssembly"</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>"Assembly"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Use"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"objectives"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Production goals"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Objectives"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"quantity"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Quantity"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Float"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"1"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"duration"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"PT5M"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672></ParameterBag></span>
|
|
<span style=color:#f92672></Action></span>
|
|
<span style=color:#f92672><Action</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"toStock"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Bicycle to stock"</span> <span style=color:#a6e22e>ResourceId=</span><span style=color:#e6db74>"bicycle"</span> <span style=color:#a6e22e>ResourceType=</span><span style=color:#e6db74>"Product"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Produce"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><ParameterBag</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"objectives"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Production goals"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Objectives"</span><span style=color:#f92672>></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"quantity"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Quantity"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Float"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"1"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672><Parameter</span> <span style=color:#a6e22e>Id=</span><span style=color:#e6db74>"duration"</span> <span style=color:#a6e22e>Name=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Type=</span><span style=color:#e6db74>"Duration"</span> <span style=color:#a6e22e>Value=</span><span style=color:#e6db74>"PT1M"</span><span style=color:#f92672>/></span>
|
|
<span style=color:#f92672></ParameterBag></span>
|
|
<span style=color:#f92672></Action></span>
|
|
<span style=color:#f92672></Activity></span>
|
|
</code></pre></div><h2 id=realms>Realms</h2><p>Strolch realms implement the multi-client capability which is thus baked right
|
|
into the Strolch runtime. When configuring a Strolch runtime, realms are
|
|
configured and for each realm the data store mode is set. Each realm has its
|
|
own persistence configuration and can thus run in one of the 4 modes that the
|
|
Strolch agent implements:</p><ul><li>EMPTY
|
|
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.</li><li>TRANSIENT
|
|
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.</li><li>CACHED
|
|
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.</li></ul><p>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:</p><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=color:#66d9ef>public</span> <span style=color:#66d9ef>class</span> <span style=color:#a6e22e>Example</span> <span style=color:#f92672>{</span>
|
|
<span style=color:#66d9ef>public</span> <span style=color:#66d9ef>static</span> <span style=color:#66d9ef>void</span> <span style=color:#a6e22e>main</span><span style=color:#f92672>(</span>String<span style=color:#f92672>[]</span> args<span style=color:#f92672>)</span> <span style=color:#f92672>{</span>
|
|
ComponentContainer container <span style=color:#f92672>=</span> getAgent<span style=color:#f92672>().</span><span style=color:#a6e22e>getContainer</span><span style=color:#f92672>();</span>
|
|
StrolchRealm realm <span style=color:#f92672>=</span> container<span style=color:#f92672>.</span><span style=color:#a6e22e>getRealm</span><span style=color:#f92672>(</span>StrolchConstants<span style=color:#f92672>.</span><span style=color:#a6e22e>DEFAULT_REALM</span><span style=color:#f92672>);</span>
|
|
<span style=color:#66d9ef>try</span> <span style=color:#f92672>(</span>StrolchTransaction tx <span style=color:#f92672>=</span> realm<span style=color:#f92672>.</span><span style=color:#a6e22e>openTx</span><span style=color:#f92672>())</span> <span style=color:#f92672>{</span>
|
|
Resource resource <span style=color:#f92672>=</span> tx<span style=color:#f92672>.</span><span style=color:#a6e22e>getResourceBy</span><span style=color:#f92672>(</span><span style=color:#e6db74>"TestType"</span><span style=color:#f92672>,</span> <span style=color:#e6db74>"MyTestResource"</span><span style=color:#f92672>);</span>
|
|
<span style=color:#f92672>}</span>
|
|
<span style=color:#f92672>}</span>
|
|
<span style=color:#f92672>}</span>
|
|
</code></pre></div><footer class=footline></footer></div></div><div id=navigation><a class="nav nav-prev" href=/ title="Strolch Overview"><i class="fa fa-chevron-left"></i></a><a class="nav nav-next" href=/documentation/ title=Documentation style=margin-right:0><i class="fa fa-chevron-right"></i></a></div></section><div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px><div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div></div><script src=/js/clipboard.min.js?1650626698></script><script src=/js/perfect-scrollbar.min.js?1650626698></script><script src=/js/perfect-scrollbar.jquery.min.js?1650626698></script><script src=/js/jquery.sticky.js?1650626698></script><script src=/js/featherlight.min.js?1650626698></script><script src=/js/highlight.pack.js?1650626698></script><script>hljs.initHighlightingOnLoad();</script><script src=/js/modernizr.custom-3.6.0.js?1650626698></script><script src=/js/learn.js?1650626698></script><script src=/js/hugo-learn.js?1650626698></script><script src=/mermaid/mermaid.js?1650626698></script><script>mermaid.initialize({startOnLoad:true});</script><script type=text/javascript>var _paq=window._paq=window._paq||[];_paq.push(["setDocumentTitle",document.domain+"/"+document.title]);_paq.push(["setCookieDomain","*.strolch.li"]);_paq.push(['trackPageView']);_paq.push(['enableLinkTracking']);(function(){var u="https://piwik.eitchnet.ch/";_paq.push(['setTrackerUrl',u+'matomo.php']);_paq.push(['setSiteId','2']);var d=document,g=d.createElement('script'),s=d.getElementsByTagName('script')[0];g.type='text/javascript';g.async=true;g.src=u+'matomo.js';s.parentNode.insertBefore(g,s);})();</script></body></html> |