[Minor] cleaned up formatting
This commit is contained in:
parent
39aada61e1
commit
c3a6f7c25f
|
@ -31,10 +31,14 @@ stored in the respective ElementMaps in their Strolch realm. Thus
|
||||||
accessing a certain parameter from a Resource would look like this:
|
accessing a certain parameter from a Resource would look like this:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
try (StrolchTransaction tx = openTx(realmName)) {
|
public class Test {
|
||||||
Resource resource = tx.getResourceBy("TestType", "MyTestResource");
|
public static void main(String[] args) {
|
||||||
Date date = resource.getDate("@bag01", "@param6");
|
try (StrolchTransaction tx = openTx(realmName)) {
|
||||||
logger.info("@param6 date is " + date);
|
Resource resource = tx.getResourceBy("MyType", "myResource");
|
||||||
|
Date date = resource.getDate("myBag", "myParam1");
|
||||||
|
logger.info("myParam date has value " + date);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -42,19 +46,19 @@ XML Presentation of Strolch's top level elements of Resources:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<!-- Resource instance -->
|
<!-- Resource instance -->
|
||||||
<Resource Id="MyTestResource" Name="Test Name" Type="TestType">
|
<Resource Id="myResource" Name="Test Name" Type="MyType">
|
||||||
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
|
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||||
<Parameter Id="@param7" Name="StringList Param" Type="StringList" Value="Hello;World" />
|
<Parameter Id="myParam2" Name="StringList Param" Type="StringList" Value="Hello, World" />
|
||||||
<Parameter Id="@param6" Name="Date Param" Type="Date" Value="2012-11-30T18:12:05.628+01:00" />
|
<Parameter Id="myParam1" Name="Date Param" Type="Date" Value="2012-11-30T18:12:05.628+01:00" />
|
||||||
<Parameter Id="@param5" Name="String Param" Type="String" Value="Strolch" />
|
<Parameter Id="myParam3" Name="String Param" Type="String" Value="Strolch" />
|
||||||
</ParameterBag>
|
</ParameterBag>
|
||||||
<ParameterBag Id="@bag02" Name="Test Bag" Type="TestBag">
|
<ParameterBag Id="additionalParameters" Name="Parameters" Type="Parameters">
|
||||||
<Parameter Id="@param4" Name="Long Param" Type="Long" Value="4453234566" />
|
<Parameter Id="myParam1" Name="Long Param" Type="Long" Value="4453234566" />
|
||||||
<Parameter Id="@param3" Name="Integer Param" Type="Integer" Value="77" />
|
<Parameter Id="myParam2" Name="Integer Param" Type="Integer" Value="77" />
|
||||||
<Parameter Id="@param2" Name="Float Param" Type="Float" Value="44.3" />
|
<Parameter Id="myParam3" Name="Float Param" Type="Float" Value="44.3" />
|
||||||
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />
|
<Parameter Id="myParam4" Name="Boolean Param" Type="Boolean" Value="true" />
|
||||||
</ParameterBag>
|
</ParameterBag>
|
||||||
<TimedState Id="@integerState" Name="Integer State" Type="IntegerState">
|
<TimedState Id="myState" Name="Integer State" Type="IntegerState">
|
||||||
<Value Time="0" Value="1" />
|
<Value Time="0" Value="1" />
|
||||||
<Value Time="1" Value="2" />
|
<Value Time="1" Value="2" />
|
||||||
<Value Time="2" Value="3" />
|
<Value Time="2" Value="3" />
|
||||||
|
@ -66,17 +70,17 @@ XML Presentation of Strolch's top level elements of Orders:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<!-- Order instance -->
|
<!-- Order instance -->
|
||||||
<Order Id="MyTestOrder" Name="Test Name" Type="TestType" Date="2013-11-20T07:42:57.699Z" State="CREATED">
|
<Order Id="myOrder" Name="Test Name" Type="MyOrderType" Date="2013-11-20T07:42:57.699Z" State="CREATED">
|
||||||
<ParameterBag Id="@bag01" Name="Test Bag" Type="TestBag">
|
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||||
<Parameter Id="@param7" Name="StringList Param" Type="StringList" Value="Hello;World" />
|
<Parameter Id="myParam2" Name="StringList Param" Type="StringList" Value="Hello, World" />
|
||||||
<Parameter Id="@param6" Name="Date Param" Type="Date" Value="2012-11-30T18:12:05.628+01:00" />
|
<Parameter Id="myParam1" Name="Date Param" Type="Date" Value="2012-11-30T18:12:05.628+01:00" />
|
||||||
<Parameter Id="@param5" Name="String Param" Type="String" Value="Strolch" />
|
<Parameter Id="myParam3" Name="String Param" Type="String" Value="Strolch" />
|
||||||
</ParameterBag>
|
</ParameterBag>
|
||||||
<ParameterBag Id="@bag02" Name="Test Bag" Type="TestBag">
|
<ParameterBag Id="additionalParameters" Name="Parameters" Type="Parameters">
|
||||||
<Parameter Id="@param4" Name="Long Param" Type="Long" Value="4453234566" />
|
<Parameter Id="myParam1" Name="Long Param" Type="Long" Value="4453234566" />
|
||||||
<Parameter Id="@param3" Name="Integer Param" Type="Integer" Value="77" />
|
<Parameter Id="myParam2" Name="Integer Param" Type="Integer" Value="77" />
|
||||||
<Parameter Id="@param2" Name="Float Param" Type="Float" Value="44.3" />
|
<Parameter Id="myParam3" Name="Float Param" Type="Float" Value="44.3" />
|
||||||
<Parameter Id="@param1" Name="Boolean Param" Type="Boolean" Value="true" />
|
<Parameter Id="myParam4" Name="Boolean Param" Type="Boolean" Value="true" />
|
||||||
</ParameterBag>
|
</ParameterBag>
|
||||||
</Order>
|
</Order>
|
||||||
```
|
```
|
||||||
|
@ -86,68 +90,54 @@ XML Presentation of Strolch's top level elements of Activities:
|
||||||
```xml
|
```xml
|
||||||
<!-- Activity instance -->
|
<!-- Activity instance -->
|
||||||
<Activity Id="bicycleProduction" Name="Bicycle Production" Type="Series">
|
<Activity Id="bicycleProduction" Name="Bicycle Production" Type="Series">
|
||||||
|
<Activity Id="componentProduction" Name="Production of components" Type="Series">
|
||||||
<Activity Id="componentProduction" Name="Production of components" Type="Series">
|
<Action Id="consumeGears" Name="Gears" ResourceId="gears" ResourceType="Article" Type="Consume">
|
||||||
|
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
||||||
<Action Id="consumeGears" Name="Gears"
|
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1"/>
|
||||||
ResourceId="gears" ResourceType="Article" Type="Consume">
|
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT0S"/>
|
||||||
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
</ParameterBag>
|
||||||
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1" />
|
</Action>
|
||||||
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT0S" />
|
<Activity Id="frameProduction" Name="Production frame" Type="Series">
|
||||||
</ParameterBag>
|
<Action Id="produce" Name="Production frame" ResourceId="frameProduction" ResourceType="Machine" Type="Use">
|
||||||
</Action>
|
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
||||||
|
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1"/>
|
||||||
<Activity Id="frameProduction" Name="Production frame" Type="Series">
|
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT5M"/>
|
||||||
<Action Id="produce" Name="Production frame"
|
</ParameterBag>
|
||||||
ResourceId="frameProduction" ResourceType="Machine" Type="Use">
|
</Action>
|
||||||
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
<Action Id="toStock" Name="Frame ToStock" ResourceId="frame" ResourceType="Article" Type="Produce">
|
||||||
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1" />
|
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
||||||
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT5M" />
|
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1"/>
|
||||||
</ParameterBag>
|
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT1M"/>
|
||||||
</Action>
|
</ParameterBag>
|
||||||
<Action Id="toStock" Name="Frame ToStock"
|
</Action>
|
||||||
ResourceId="frame" ResourceType="Article" Type="Produce">
|
|
||||||
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
|
||||||
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1" />
|
|
||||||
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT1M" />
|
|
||||||
</ParameterBag>
|
|
||||||
</Action>
|
|
||||||
</Activity>
|
|
||||||
|
|
||||||
<Activity Id="brakeProduction" Type="Series" Name="Herstellen Bremsen" TimeOrdering="Series">
|
|
||||||
<Action Id="produce" Name="Production saddle"
|
|
||||||
ResourceId="saddleProduction" ResourceType="Machine" Type="Use">
|
|
||||||
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
|
||||||
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1" />
|
|
||||||
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT5M" />
|
|
||||||
</ParameterBag>
|
|
||||||
</Action>
|
|
||||||
<Action Id="toStock" Name="Saddle ToStock"
|
|
||||||
ResourceId="frame" ResourceType="Article" Type="Produce">
|
|
||||||
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
|
||||||
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1" />
|
|
||||||
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT1M" />
|
|
||||||
</ParameterBag>
|
|
||||||
</Action>
|
|
||||||
</Activity>
|
|
||||||
|
|
||||||
</Activity>
|
</Activity>
|
||||||
|
<Activity Id="brakeProduction" Name="Herstellen Bremsen" TimeOrdering="Series" Type="Series">
|
||||||
<Action Id="assembly" Name="Bicycle assemble"
|
<Action Id="produce" Name="Production saddle" ResourceId="saddleProduction" ResourceType="Machine" Type="Use">
|
||||||
ResourceId="bicycleAssembly" ResourceType="Assembly" Type="Use">
|
|
||||||
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
||||||
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1" />
|
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1"/>
|
||||||
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT5M" />
|
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT5M"/>
|
||||||
</ParameterBag>
|
</ParameterBag>
|
||||||
</Action>
|
</Action>
|
||||||
|
<Action Id="toStock" Name="Saddle ToStock" ResourceId="frame" ResourceType="Article" Type="Produce">
|
||||||
<Action Id="toStock" Name="Bicycle to stock"
|
|
||||||
ResourceId="bicycle" ResourceType="Product" Type="Produce">
|
|
||||||
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
||||||
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1" />
|
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1"/>
|
||||||
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT1M" />
|
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT1M"/>
|
||||||
</ParameterBag>
|
</ParameterBag>
|
||||||
</Action>
|
</Action>
|
||||||
|
</Activity>
|
||||||
|
</Activity>
|
||||||
|
<Action Id="assembly" Name="Bicycle assemble" ResourceId="bicycleAssembly" ResourceType="Assembly" Type="Use">
|
||||||
|
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
||||||
|
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1"/>
|
||||||
|
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT5M"/>
|
||||||
|
</ParameterBag>
|
||||||
|
</Action>
|
||||||
|
<Action Id="toStock" Name="Bicycle to stock" ResourceId="bicycle" ResourceType="Product" Type="Produce">
|
||||||
|
<ParameterBag Id="objectives" Name="Production goals" Type="Objectives">
|
||||||
|
<Parameter Id="quantity" Name="Quantity" Type="Float" Value="1"/>
|
||||||
|
<Parameter Id="duration" Name="Duration" Type="Duration" Value="PT1M"/>
|
||||||
|
</ParameterBag>
|
||||||
|
</Action>
|
||||||
</Activity>
|
</Activity>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -171,14 +161,18 @@ Strolch agent implements:
|
||||||
back to the persistence layer. This allows for fast in-memory quries, but
|
back to the persistence layer. This allows for fast in-memory quries, but
|
||||||
makes sure no data is lost when the agent is restarted.
|
makes sure no data is lost when the agent is restarted.
|
||||||
|
|
||||||
Strolch Realms are also responsible for opening Transactions, as these are
|
Strolch Realms are also responsible for opening Transactions, as these are bound
|
||||||
bound to the persistence layer configured for this realm. At runtime, a realm
|
to the persistence layer configured for this realm. At runtime, a realm is then
|
||||||
is then accessed from the ComponentContainer:
|
accessed from the ComponentContainer:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
ComponentContainer container = getAgent().getContainer();
|
public class Example {
|
||||||
StrolchRealm realm = container.getRealm(StrolchConstants.DEFAULT_REALM);
|
public static void main(String[] args) {
|
||||||
try(StrolchTransaction tx = realm.openTx()) {
|
ComponentContainer container = getAgent().getContainer();
|
||||||
Resource resource = tx.getResourceBy("TestType", "MyTestResource");
|
StrolchRealm realm = container.getRealm(StrolchConstants.DEFAULT_REALM);
|
||||||
...
|
try (StrolchTransaction tx = realm.openTx()) {
|
||||||
|
Resource resource = tx.getResourceBy("TestType", "MyTestResource");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue