You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2017/04/17 01:56:11 UTC

[17/36] polygene-website git commit: Working on new website.

http://git-wip-us.apache.org/repos/asf/polygene-website/blob/bb9c9971/content/java/2017/howto-configure-service.html
----------------------------------------------------------------------
diff --git a/content/java/2017/howto-configure-service.html b/content/java/2017/howto-configure-service.html
new file mode 100644
index 0000000..89f60b3
--- /dev/null
+++ b/content/java/2017/howto-configure-service.html
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Configure a Service</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-create-entity.html" title="Create an Entity" /><link rel="next" href="howto-invocation-annotation.html" title="Use @Invocation" />
+
+
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
+    <meta name="description" content="">
+    <meta name="author" content="">
+    <link rel="icon" href="../../favicon.ico">
+
+    <title>Starter Template for Bootstrap</title>
+
+    <!-- Bootstrap core CSS -->
+    <link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
+
+    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
+    <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
+
+    <!-- Custom styles for this template -->
+    <link href="css/polygene-ng.css" rel="stylesheet">
+
+    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
+    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
+    <script src="js/ie-emulation-modes-warning.js"></script>
+
+    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
+    <!--[if lt IE 9]>
+      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
+      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
+    <![endif]-->
+
+<!-- favicon -->
+
+<link rel="shortcut icon" href="http://polygene.apache.org/favicon.ico" type="image/vnd.microsoft.icon" />
+<link rel="icon" href="http://polygene.apache.org/favicon.ico" type="image/x-icon" />
+
+<!-- style -->
+
+<link href="css/shCore.css" rel="stylesheet" type="text/css" />
+<link href="css/shCoreEclipse.css" rel="stylesheet" type="text/css" />
+<link href="css/shThemeEclipse.css" rel="stylesheet" type="text/css" />
+<!--<link href="css/polygene.css" rel="stylesheet" type="text/css" />-->
+
+<!-- Syntax Highlighter -->
+
+<script type="text/javascript" src="js/shCore.js"></script>
+<script type="text/javascript" src="js/shBrushJava.js"></script>
+<script type="text/javascript" src="js/shBrushScala.js"></script>
+<script type="text/javascript" src="js/shBrushJScript.js"></script>
+<script type="text/javascript" src="js/shBrushBash.js"></script>
+<script type="text/javascript" src="js/shBrushPlain.js"></script>
+<script type="text/javascript" src="js/shBrushXml.js"></script>
+<script type="text/javascript" src="js/shBrushGroovy.js"></script>
+<script type="text/javascript" src="js/shBrushPython.js"></script>
+<script type="text/javascript" src="js/shBrushRuby.js"></script>
+<script type="text/javascript" src="js/shBrushCSharp.js"></script>
+
+<script type="text/javascript">
+  SyntaxHighlighter.defaults['tab-size'] = 4;
+  SyntaxHighlighter.defaults['gutter'] = false;
+  SyntaxHighlighter.defaults['toolbar'] = false;
+  SyntaxHighlighter.all()
+</script>
+
+<!-- JQuery -->
+
+<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
+
+<!-- Image Scaler -->
+
+<script type="text/javascript" src="js/imagescaler.js"></script>
+
+<!-- Table Styler -->
+
+<script type="text/javascript" src="js/tablestyler.js"></script>
+
+<!-- Apache Polygene WebSite Progressive Enhancement -->
+
+<link href="css/progressive-enhancement.css" rel="stylesheet" type="text/css" />
+<script type="text/javascript" src="js/jquery.scrollTo-1.4.2.js"></script>
+<script type="text/javascript" src="js/progressive-enhancement.js"></script>
+
+<!-- Analytics -->
+ <script type="text/javascript">
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-62007352-1']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+ </script>
+
+  </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><nav xmlns="" xmlns:exsl="http://exslt.org/common" class="navbar navbar-inverse navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="#">Apache<br />Polygene
+          </a></div><div id="navbar" class="collapse navbar-collapse"><span class="nav navbar-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygene\u2122</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.html">Glossary�</a></span></dt></dl></div></span></div></div></nav><div xmlns="" xmlns:exsl="http://exslt
 .org/common" class="sidenav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene\u2122 in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene\u2122 in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene\u2122 in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygene\u2122</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">Services Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span
 ></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><span xmlns="" href="howto-configure-service.html">Configure a Service</span></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene\u2122 Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene\u2122 Documentation</a></span></dt><dt><span class="section"><a href="releasing-apache.html">Releasing Polygene\u2122</a></span></dt><
 /dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="howto-configure-service"></a>Configure a Service</h3></div></div></div><p>Polygene\u2122 supports a Configuration system for services. The configuration instance itself is an Entity and is therefor
+readable, writeable and queryable, just like other Entities. This should make Configuration management much simpler,
+since you can easily build GUI tools to allow editing of these in runtime. However, to simplify the initial values of
+the Configuration instance, Polygene\u2122 also does the initial bootstrapping of the Configuration entity for you. This HowTo is
+going to show how.</p><p>If you want to reproduce what\u2019s explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm1856"></a><p class="title"><strong>Table�13.�Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.core</p></td><td align="left" valign="top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></div><br class="table-break" /><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygene\u2122">Depend on Polygene\u2122</a> tutorial for details.</p
 ><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_we_need_a_service"></a>We need a Service</h4></div></div></div><p>To illustrate these features we create an TravelPlan service, which allows clients to find and make Reservations to
+Destinations. For the sake of simplicity, we are leaving out the domain details\u2026</p><pre class="programlisting brush: java">public interface TravelPlan
+{
+    // Domain methods, which are beyond the discussion at hand.
+}
+</pre><p>So, then there is the ServiceComposite\u2026</p><pre class="programlisting brush: java">// The package is relevant to the Initial Values discussed later.
+package org.apache.polygene.manual.travel;
+  [...snip...]
+
+@Mixins( { TravelPlanMixin.class } )
+public interface TravelPlanService extends TravelPlan, ServiceComposite
+{}
+</pre><p>And then in the Mixin we actually need to connect to a foreign system to obtain the various details that the service
+can provide to the clients. For instance, it needs a host name and port and a protocol to use. We put these into a
+configuration interface.</p><pre class="programlisting brush: java">public interface TravelPlanConfiguration
+{
+    Property&lt;String&gt; hostName();
+
+    @Range( min=0, max=65535 )
+    Property&lt;Integer&gt; portNumber();
+
+    @Matches( "(ssh|rlogin|telnet)" )
+    Property&lt;String&gt; protocol();
+}
+</pre><p>We used the recommended type-safe Property subtype pattern, and for each PortNumber and Protocol we have defined a
+Constraint required.</p><p>Now we can access this configuration in the TravelPlanMixin like this;</p><pre class="programlisting brush: java">import org.apache.polygene.api.configuration.Configuration;
+
+public class TravelPlanMixin implements TravelPlan
+{
+    @This
+    Configuration&lt;TravelPlanConfiguration&gt; config;
+
+    private void foo()
+    {
+        TravelPlanConfiguration tpConf = config.get();
+        String hostName = tpConf.hostName().get();
+        // ...
+    }
+      [...snip...]
+
+}
+</pre><p>And from the Service point of view, it doesn\u2019t need to worry about where the configuration really comes from. But it may
+want to control when the Configuration should be refreshed, to ensure that atomic changes are happening. This is done
+with the refresh() method in the Configuration interface;</p><pre class="programlisting brush: java">public void doSomething()
+{
+    // Refresh Configuration before reading it.
+    config.refresh();
+
+    TravelPlanConfiguration tpConf = config.get();
+    // ...
+}
+</pre><p>This ensures that any updates to the Configuration that has occurred will be retrieved and available to the Service.
+Since Configuration instance is an Entity, the UnitOfWork system will ensure that the Configuration is consistent and
+not in the middle of value changes.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="_initial_values"></a>Initial Values</h5></div></div></div><p>The initial Configuration instance will be created automatically behind the scenes, by reading a properties file and
+create an Entity with the same identity as the identity of the service. That was a handful. Services are, as we know,
+singletons and have an identity specified at assembly. Even if it is not provided, one will automatically be assigned.
+The service\u2019s "identifiedBy" will be used as the identifier for the Configuration entity and stored in the visible
+EntityStore. This identity is also used to locate a properties file in the same package as the ServiceComposite belongs
+to.</p><p>So, we create a properties file, where the keys are the names of the properties in TravelPlanConfiguration.</p><pre class="programlisting brush: bash"># Hostname to the TravelPlan service
+hostName=niclas.hedhman.org
+
+# Port number to use for the connection
+portNumber=5439
+
+# Protocol to use; Valid options "ssh", "rlogin", "telnet"
+protocol=ssh
+
+</pre><p>File: org/hedhman/niclas/travel/TravelPlanService.properties</p><p>Note that the file resides in the directory equivalent to the package name of the TravelPlanService.</p><p>And this would work with the standard assembly.</p><pre class="programlisting brush: java">public void assemble(ModuleAssembly module) throws AssemblyException
+{
+    module.addServices(TravelPlanService.class).instantiateOnStartup();
+}
+</pre></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_non_default_identity"></a>Non-default Identity</h4></div></div></div><p>If you need to use multiple instances of the same service, or that the service has a non-default Identity, then you need
+to name the properties file according to the Identity of the service declaration, but the file will still need to be in
+the same package as the ServiceComposite sub type, the TravelPlanService in the above example. For instance;</p><pre class="programlisting brush: java">public void assemble(ModuleAssembly module) throws AssemblyException
+{
+    module.addServices(TravelPlanService.class)
+            .instantiateOnStartup()
+            .identifiedBy("ExpediaService");
+
+    module.addServices(TravelPlanService.class)
+            .instantiateOnStartup()
+            .identifiedBy("OrbitzService");
+}
+</pre><p>And the two files for configuration,</p><pre class="programlisting brush: bash"># Hostname to the TravelPlan service
+hostName=expedia.hedhman.org
+
+# Port number to use for the connection
+portNumber=9251
+
+# Protocol to use; Valid options "ssh", "rlogin", "telnet"
+protocol=ssh
+</pre><p>File: org/apache/polygene/manual/travel/ExpediaService.properties</p><pre class="programlisting brush: bash"># Hostname to the TravelPlan service
+hostName=orbitz.hedhman.org
+
+# Port number to use for the connection
+portNumber=7412
+
+# Protocol to use; Valid options "ssh", "rlogin", "telnet"
+protocol=rlogin
+</pre><p>File: org/apache/polygene/manual/travel/OrbitzService.properties</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_changing_configuration_in_runtime"></a>Changing Configuration in runtime</h4></div></div></div><p>Unlike most frameworks, the Configuration in Polygene\u2122 is an active Entity, and once the properties file has been read once
+at the first(!) startup, it no longer serves any purpose. The Configuration will always be retrieved from the
+EntityStore. Changes to the properties file are not taken into consideration if the Configuration entity is found in the
+entity store.</p><p>But that also means that applications should not cache the configuration values, and instead read them from the
+Configuration instance every time needed, and do a refresh() method call when it is safe to update the Configuration
+Entity with new values.</p></div></div><footer xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><div class="container"><p class="text-muted">Copyright � 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>.
+          Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are
+          trademarks of The Apache Software Foundation.
+          All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+        </p></div></footer><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common">window.jQuery || document.write('&lt;script src="js/jquery-1.6.4.min.js"&gt;&lt;/script&gt;')</script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="bootstrap-3.3.7/js/bootstrap.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="js/ie10-viewport-bug-workaround.js"></script></body></html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-website/blob/bb9c9971/content/java/2017/howto-contextual-fragments.html
----------------------------------------------------------------------
diff --git a/content/java/2017/howto-contextual-fragments.html b/content/java/2017/howto-contextual-fragments.html
new file mode 100644
index 0000000..6aadb9b
--- /dev/null
+++ b/content/java/2017/howto-contextual-fragments.html
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Use contextual fragments</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="tut-services.html" title="Services Composites Tutorial" /><link rel="next" href="howto-leverage-properties.html" title="Leverage Properties" />
+
+
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
+    <meta name="description" content="">
+    <meta name="author" content="">
+    <link rel="icon" href="../../favicon.ico">
+
+    <title>Starter Template for Bootstrap</title>
+
+    <!-- Bootstrap core CSS -->
+    <link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
+
+    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
+    <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
+
+    <!-- Custom styles for this template -->
+    <link href="css/polygene-ng.css" rel="stylesheet">
+
+    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
+    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
+    <script src="js/ie-emulation-modes-warning.js"></script>
+
+    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
+    <!--[if lt IE 9]>
+      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
+      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
+    <![endif]-->
+
+<!-- favicon -->
+
+<link rel="shortcut icon" href="http://polygene.apache.org/favicon.ico" type="image/vnd.microsoft.icon" />
+<link rel="icon" href="http://polygene.apache.org/favicon.ico" type="image/x-icon" />
+
+<!-- style -->
+
+<link href="css/shCore.css" rel="stylesheet" type="text/css" />
+<link href="css/shCoreEclipse.css" rel="stylesheet" type="text/css" />
+<link href="css/shThemeEclipse.css" rel="stylesheet" type="text/css" />
+<!--<link href="css/polygene.css" rel="stylesheet" type="text/css" />-->
+
+<!-- Syntax Highlighter -->
+
+<script type="text/javascript" src="js/shCore.js"></script>
+<script type="text/javascript" src="js/shBrushJava.js"></script>
+<script type="text/javascript" src="js/shBrushScala.js"></script>
+<script type="text/javascript" src="js/shBrushJScript.js"></script>
+<script type="text/javascript" src="js/shBrushBash.js"></script>
+<script type="text/javascript" src="js/shBrushPlain.js"></script>
+<script type="text/javascript" src="js/shBrushXml.js"></script>
+<script type="text/javascript" src="js/shBrushGroovy.js"></script>
+<script type="text/javascript" src="js/shBrushPython.js"></script>
+<script type="text/javascript" src="js/shBrushRuby.js"></script>
+<script type="text/javascript" src="js/shBrushCSharp.js"></script>
+
+<script type="text/javascript">
+  SyntaxHighlighter.defaults['tab-size'] = 4;
+  SyntaxHighlighter.defaults['gutter'] = false;
+  SyntaxHighlighter.defaults['toolbar'] = false;
+  SyntaxHighlighter.all()
+</script>
+
+<!-- JQuery -->
+
+<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
+
+<!-- Image Scaler -->
+
+<script type="text/javascript" src="js/imagescaler.js"></script>
+
+<!-- Table Styler -->
+
+<script type="text/javascript" src="js/tablestyler.js"></script>
+
+<!-- Apache Polygene WebSite Progressive Enhancement -->
+
+<link href="css/progressive-enhancement.css" rel="stylesheet" type="text/css" />
+<script type="text/javascript" src="js/jquery.scrollTo-1.4.2.js"></script>
+<script type="text/javascript" src="js/progressive-enhancement.js"></script>
+
+<!-- Analytics -->
+ <script type="text/javascript">
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-62007352-1']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+ </script>
+
+  </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><nav xmlns="" xmlns:exsl="http://exslt.org/common" class="navbar navbar-inverse navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="#">Apache<br />Polygene
+          </a></div><div id="navbar" class="collapse navbar-collapse"><span class="nav navbar-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygene\u2122</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.html">Glossary�</a></span></dt></dl></div></span></div></div></nav><div xmlns="" xmlns:exsl="http://exslt
 .org/common" class="sidenav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene\u2122 in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene\u2122 in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene\u2122 in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygene\u2122</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">Services Composites Tutorial</a></span></dt><dt><span class="section"><span xmlns="" href="howto-contextual-fragments.html">Use contextual fragmen
 ts</span></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene\u2122 Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene\u2122 Documentation</a></span></dt><dt><span class="section"><a href="releasing-apache.html">Releasing Polygene\u2122</a></span></dt><
 /dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="howto-contextual-fragments"></a>Use contextual fragments</h3></div></div></div><p>Contextual fragments are fragments that are added to the composites during assembly time. That means that they are not
+present in the composite declarations, but a start-up decision what should be added. Once the application instance is
+created, it is no longer possible to modify which fragments are attached.</p><p>Typical use-case is tracing and debugging. Other potential uses are additional security or context interfaces needing
+access to internal mixins not originally intended for, such as GUI frameworks doing reflection on certain composites.
+We strongly recommend against using this feature, as it is not needed as commonly as you may think.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Constraints are not supported to be contextual at the moment.</p></div><p>If you want to reproduce what\u2019s explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm1537"></a><p class="title"><strong>Table�7.�Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.core</p></td><td align="left" valign="top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>0</p></td></tr></tbod
 y></table></div></div><br class="table-break" /><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygene\u2122">Depend on Polygene\u2122</a> tutorial for details.</p><p>The mixins, sideeffects and concerns are added during the bootstrap phase. It is very straight-forward;</p><pre class="programlisting brush: java">public class TraceAll
+{
+    public void assemble( ModuleAssembly module )
+            throws AssemblyException
+    {
+        ServiceDeclaration decl = module.addServices( PinSearchService.class );
+        if( Boolean.getBoolean( "trace.all"  ) )
+        {
+            decl.withConcerns( TraceAllConcern.class );
+        }
+    }
+}
+
+</pre><p>In the example above, we add the TraceAllConcern from the Logging Library if the system property "trace.all" is true.
+If the system property is not set to true, there will be no TraceAllConcern on the PinSearchService.</p><p>Concerns that are added in this way will be at the top of the method invocation stack, i.e. will be the first one to be
+called and last one to be completed.</p><p>SideEffects that are added in this way will be the last one\u2019s to be executed.</p></div><footer xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><div class="container"><p class="text-muted">Copyright � 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>.
+          Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are
+          trademarks of The Apache Software Foundation.
+          All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+        </p></div></footer><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common">window.jQuery || document.write('&lt;script src="js/jquery-1.6.4.min.js"&gt;&lt;/script&gt;')</script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="bootstrap-3.3.7/js/bootstrap.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="js/ie10-viewport-bug-workaround.js"></script></body></html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-website/blob/bb9c9971/content/java/2017/howto-create-concern.html
----------------------------------------------------------------------
diff --git a/content/java/2017/howto-create-concern.html b/content/java/2017/howto-create-concern.html
new file mode 100644
index 0000000..f77f901
--- /dev/null
+++ b/content/java/2017/howto-create-concern.html
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Create a Concern</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-create-constraint.html" title="Create a Constraint" /><link rel="next" href="howto-create-sideeffect.html" title="Create a SideEffect" />
+
+
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
+    <meta name="description" content="">
+    <meta name="author" content="">
+    <link rel="icon" href="../../favicon.ico">
+
+    <title>Starter Template for Bootstrap</title>
+
+    <!-- Bootstrap core CSS -->
+    <link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
+
+    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
+    <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
+
+    <!-- Custom styles for this template -->
+    <link href="css/polygene-ng.css" rel="stylesheet">
+
+    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
+    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
+    <script src="js/ie-emulation-modes-warning.js"></script>
+
+    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
+    <!--[if lt IE 9]>
+      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
+      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
+    <![endif]-->
+
+<!-- favicon -->
+
+<link rel="shortcut icon" href="http://polygene.apache.org/favicon.ico" type="image/vnd.microsoft.icon" />
+<link rel="icon" href="http://polygene.apache.org/favicon.ico" type="image/x-icon" />
+
+<!-- style -->
+
+<link href="css/shCore.css" rel="stylesheet" type="text/css" />
+<link href="css/shCoreEclipse.css" rel="stylesheet" type="text/css" />
+<link href="css/shThemeEclipse.css" rel="stylesheet" type="text/css" />
+<!--<link href="css/polygene.css" rel="stylesheet" type="text/css" />-->
+
+<!-- Syntax Highlighter -->
+
+<script type="text/javascript" src="js/shCore.js"></script>
+<script type="text/javascript" src="js/shBrushJava.js"></script>
+<script type="text/javascript" src="js/shBrushScala.js"></script>
+<script type="text/javascript" src="js/shBrushJScript.js"></script>
+<script type="text/javascript" src="js/shBrushBash.js"></script>
+<script type="text/javascript" src="js/shBrushPlain.js"></script>
+<script type="text/javascript" src="js/shBrushXml.js"></script>
+<script type="text/javascript" src="js/shBrushGroovy.js"></script>
+<script type="text/javascript" src="js/shBrushPython.js"></script>
+<script type="text/javascript" src="js/shBrushRuby.js"></script>
+<script type="text/javascript" src="js/shBrushCSharp.js"></script>
+
+<script type="text/javascript">
+  SyntaxHighlighter.defaults['tab-size'] = 4;
+  SyntaxHighlighter.defaults['gutter'] = false;
+  SyntaxHighlighter.defaults['toolbar'] = false;
+  SyntaxHighlighter.all()
+</script>
+
+<!-- JQuery -->
+
+<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
+
+<!-- Image Scaler -->
+
+<script type="text/javascript" src="js/imagescaler.js"></script>
+
+<!-- Table Styler -->
+
+<script type="text/javascript" src="js/tablestyler.js"></script>
+
+<!-- Apache Polygene WebSite Progressive Enhancement -->
+
+<link href="css/progressive-enhancement.css" rel="stylesheet" type="text/css" />
+<script type="text/javascript" src="js/jquery.scrollTo-1.4.2.js"></script>
+<script type="text/javascript" src="js/progressive-enhancement.js"></script>
+
+<!-- Analytics -->
+ <script type="text/javascript">
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-62007352-1']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+ </script>
+
+  </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><nav xmlns="" xmlns:exsl="http://exslt.org/common" class="navbar navbar-inverse navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="#">Apache<br />Polygene
+          </a></div><div id="navbar" class="collapse navbar-collapse"><span class="nav navbar-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygene\u2122</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.html">Glossary�</a></span></dt></dl></div></span></div></div></nav><div xmlns="" xmlns:exsl="http://exslt
 .org/common" class="sidenav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene\u2122 in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene\u2122 in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene\u2122 in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygene\u2122</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">Services Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span
 ></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><span xmlns="" href="howto-create-concern.html">Create a Concern</span></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene\u2122 Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene\u2122 Documentation</a></span></dt><dt><span class="section"><a href="releasing-apache.html">Releasing Polygene\u2122</a></span></dt><
 /dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="howto-create-concern"></a>Create a Concern</h3></div></div></div><p>Concerns are defined in <a class="xref" href="glossary.html#def-concern">Concern</a>.</p><p>If you want to reproduce what\u2019s explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm1664"></a><p class="title"><strong>Table�10.�Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.core</p></td><td align="left" valign="top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></
 div><br class="table-break" /><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygene\u2122">Depend on Polygene\u2122</a> tutorial for details.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_typed_concern"></a>Typed Concern</h4></div></div></div><p>A typed Concern is a Java class that implements the MixinType it can be used on:</p><pre class="programlisting brush: java">public class InventoryConcern extends ConcernOf&lt;Order&gt;
+    implements Order
+{
+    @Service
+    private InventoryService inventory;
+
+    @Override
+    public void addLineItem( LineItem item )
+    {
+        String productCode = item.productCode().get();
+        int quantity = item.quantity().get();
+        inventory.remove( productCode, quantity );
+        next.addLineItem( item );
+    }
+
+    @Override
+    public void removeLineItem( LineItem item )
+    {
+        String productCode = item.productCode().get();
+        int quantity = item.quantity().get();
+        inventory.add( productCode, quantity );
+        next.removeLineItem( item );
+    }
+}
+</pre><p>Note that we could have implemented the InventoryConcern as an abstract class if we were not interested in <span class="emphasis"><em>all</em></span> the methods in the Order interface.
+Extending the ConcernOf is a convenience mechanism, instead of an explicit @ConcernFor annotation on
+a private field, which can be used in rare occasions when you are not able to extend. This base class defines the next
+field, which is set up by the Polygene\u2122 runtime and points to the next fragment in the call stack. We can also see that the
+InventoryService is provided to the concern, which is done with dependency injection. Polygene\u2122 also supports dependency
+injection via constructors and methods.</p><p>It can be used as follows;</p><pre class="programlisting brush: java">@Concerns( InventoryConcern.class )
+public interface Order
+{
+    void addLineItem( LineItem item );
+    void removeLineItem( LineItem item );
+
+      [...snip...]
+
+</pre><p>Methods of the Concern Fragment will be called before the Mixin invocation.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_generic_concern"></a>Generic Concern</h4></div></div></div><p>A generic Concern is a Java class that implements java.lang.reflect.InvocationHandler which allows it to be used on any
+arbitrary MixinType.</p><pre class="programlisting brush: java">public class MyGenericConcern extends GenericConcern
+{
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        // Do whatever you want
+
+          [...snip...]
+
+</pre><p>It can be used as follows;</p><pre class="programlisting brush: java">@Concerns( MyGenericConcern.class )
+public interface AnyMixinType
+{
+
+  [...snip...]
+
+    @MyAnnotation
+    void doSomething();
+
+    void doSomethingElse();
+
+</pre><p>Methods of the Concern Fragment will be called before the Mixin invocation.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="_appliesto"></a>AppliesTo</h5></div></div></div><p>For generic Concerns that should only trigger on methods with specific annotations or fulfilling some expression, add
+@AppliesTo annotation to the Concern class which points to either triggering annotation(s), or to AppliesToFilter
+implementation(s).</p><p>The Concern is invoked if one of the triggering annotations is found or one of the AppliesToFilter accepts the
+invocation. In other words the AppliesTo arguments are OR\u2019ed.</p><p>Here is how the declaration goes ;</p><pre class="programlisting brush: java">@AppliesTo( { MyAnnotation.class, MyAppliesToFilter.class } )
+public class MyGenericConcern extends GenericConcern
+{
+</pre><p>And how to use the annotation ;</p><pre class="programlisting brush: java">@Concerns( MyGenericConcern.class )
+public interface AnyMixinType
+{
+
+    @MyAnnotation
+    void doSomething();
+
+    void doSomethingElse();
+
+}
+</pre><p>Here only the doSomething() method will see the Concern applied whereas the doSomethingElse() method won\u2019t.</p><p>Finally here is how to implement an AppliesToFilter:</p><pre class="programlisting brush: java">public class MyAppliesToFilter implements AppliesToFilter
+{
+    public boolean appliesTo( Method method, Class&lt;?&gt; mixin, Class&lt;?&gt; compositeType, Class&lt;?&gt; modifierClass )
+    {
+        boolean appliesTo = evaluate(method); // Do whatever you want
+        return appliesTo;
+    }
+
+      [...snip...]
+
+    private boolean evaluate( Method method )
+    {
+        return true;
+    }
+</pre></div></div></div><footer xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><div class="container"><p class="text-muted">Copyright � 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>.
+          Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are
+          trademarks of The Apache Software Foundation.
+          All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+        </p></div></footer><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common">window.jQuery || document.write('&lt;script src="js/jquery-1.6.4.min.js"&gt;&lt;/script&gt;')</script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="bootstrap-3.3.7/js/bootstrap.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="js/ie10-viewport-bug-workaround.js"></script></body></html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-website/blob/bb9c9971/content/java/2017/howto-create-constraint.html
----------------------------------------------------------------------
diff --git a/content/java/2017/howto-create-constraint.html b/content/java/2017/howto-create-constraint.html
new file mode 100644
index 0000000..30849ba
--- /dev/null
+++ b/content/java/2017/howto-create-constraint.html
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Create a Constraint</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-leverage-properties.html" title="Leverage Properties" /><link rel="next" href="howto-create-concern.html" title="Create a Concern" />
+
+
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
+    <meta name="description" content="">
+    <meta name="author" content="">
+    <link rel="icon" href="../../favicon.ico">
+
+    <title>Starter Template for Bootstrap</title>
+
+    <!-- Bootstrap core CSS -->
+    <link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
+
+    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
+    <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
+
+    <!-- Custom styles for this template -->
+    <link href="css/polygene-ng.css" rel="stylesheet">
+
+    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
+    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
+    <script src="js/ie-emulation-modes-warning.js"></script>
+
+    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
+    <!--[if lt IE 9]>
+      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
+      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
+    <![endif]-->
+
+<!-- favicon -->
+
+<link rel="shortcut icon" href="http://polygene.apache.org/favicon.ico" type="image/vnd.microsoft.icon" />
+<link rel="icon" href="http://polygene.apache.org/favicon.ico" type="image/x-icon" />
+
+<!-- style -->
+
+<link href="css/shCore.css" rel="stylesheet" type="text/css" />
+<link href="css/shCoreEclipse.css" rel="stylesheet" type="text/css" />
+<link href="css/shThemeEclipse.css" rel="stylesheet" type="text/css" />
+<!--<link href="css/polygene.css" rel="stylesheet" type="text/css" />-->
+
+<!-- Syntax Highlighter -->
+
+<script type="text/javascript" src="js/shCore.js"></script>
+<script type="text/javascript" src="js/shBrushJava.js"></script>
+<script type="text/javascript" src="js/shBrushScala.js"></script>
+<script type="text/javascript" src="js/shBrushJScript.js"></script>
+<script type="text/javascript" src="js/shBrushBash.js"></script>
+<script type="text/javascript" src="js/shBrushPlain.js"></script>
+<script type="text/javascript" src="js/shBrushXml.js"></script>
+<script type="text/javascript" src="js/shBrushGroovy.js"></script>
+<script type="text/javascript" src="js/shBrushPython.js"></script>
+<script type="text/javascript" src="js/shBrushRuby.js"></script>
+<script type="text/javascript" src="js/shBrushCSharp.js"></script>
+
+<script type="text/javascript">
+  SyntaxHighlighter.defaults['tab-size'] = 4;
+  SyntaxHighlighter.defaults['gutter'] = false;
+  SyntaxHighlighter.defaults['toolbar'] = false;
+  SyntaxHighlighter.all()
+</script>
+
+<!-- JQuery -->
+
+<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
+
+<!-- Image Scaler -->
+
+<script type="text/javascript" src="js/imagescaler.js"></script>
+
+<!-- Table Styler -->
+
+<script type="text/javascript" src="js/tablestyler.js"></script>
+
+<!-- Apache Polygene WebSite Progressive Enhancement -->
+
+<link href="css/progressive-enhancement.css" rel="stylesheet" type="text/css" />
+<script type="text/javascript" src="js/jquery.scrollTo-1.4.2.js"></script>
+<script type="text/javascript" src="js/progressive-enhancement.js"></script>
+
+<!-- Analytics -->
+ <script type="text/javascript">
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-62007352-1']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+ </script>
+
+  </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><nav xmlns="" xmlns:exsl="http://exslt.org/common" class="navbar navbar-inverse navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="#">Apache<br />Polygene
+          </a></div><div id="navbar" class="collapse navbar-collapse"><span class="nav navbar-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygene\u2122</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.html">Glossary�</a></span></dt></dl></div></span></div></div></nav><div xmlns="" xmlns:exsl="http://exslt
 .org/common" class="sidenav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene\u2122 in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene\u2122 in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene\u2122 in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygene\u2122</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">Services Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span
 ></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><span xmlns="" href="howto-create-constraint.html">Create a Constraint</span></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene\u2122 Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene\u2122 Documentation</a></span></dt><dt><span class="section"><a href="releasing-apache.html">Releasing Polygene\u2122</a></span></dt><
 /dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="howto-create-constraint"></a>Create a Constraint</h3></div></div></div><p>Constraints are defined in <a class="xref" href="glossary.html#def-constraint">Constraint</a>.</p><p>If you want to reproduce what\u2019s explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm1620"></a><p class="title"><strong>Table�9.�Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.core</p></td><td align="left" valign="top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></
 table></div></div><br class="table-break" /><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygene\u2122">Depend on Polygene\u2122</a> tutorial for details.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_method_constraint"></a>Method Constraint</h4></div></div></div><p>Method Constraints are declared with annotations on the method argument. The annotation itself is custom, and it is possible to make your own.</p><pre class="programlisting brush: java">public interface Dialer
+{
+    void callPhoneNumber(@PhoneNumber String phoneNo);
+
+}
+</pre><p>In the code above we say that we want the argument to the callPhoneNumber() method to be a valid phone number. This annotation is not built-in, so we need to declare it.</p><pre class="programlisting brush: java">@ConstraintDeclaration
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.PARAMETER, ElementType.ANNOTATION_TYPE, ElementType.METHOD } )
+public @interface PhoneNumber
+{
+}
+</pre><p>We then need to provide the Constraint implementation.</p><pre class="programlisting brush: java">public class PhoneNumberConstraint
+        implements Constraint&lt;PhoneNumber, String&gt;
+{
+    public boolean isValid( PhoneNumber annotation, String number )
+    {
+        boolean validPhoneNumber = true; // check phone number format...
+        return validPhoneNumber;  // return true if valid phone number.
+    }
+}
+</pre><p>We also need to include the Constraint on the Composites we want to have them present.</p><pre class="programlisting brush: java">@Constraints( PhoneNumberConstraint.class )
+public interface DialerComposite extends ServiceComposite, Dialer
+{
+}
+</pre><p>If a Constraint is violated, then a ConstraintViolationException is thrown. The Exception contains ALL violations found
+in the method invocation. Concerns can be used to catch and report these violations.</p><pre class="programlisting brush: java">public class ParameterViolationConcern extends ConcernOf&lt;InvocationHandler&gt;
+    implements InvocationHandler
+{
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        try
+        {
+            return next.invoke( proxy, method, args );
+        }
+        catch( ConstraintViolationException e )
+        {
+            for( ConstraintViolation violation : e.constraintViolations() )
+            {
+                String name = violation.name();
+                Object value = violation.value();
+                Annotation constraint = violation.constraint();
+                report( name, value, constraint );
+            }
+            throw new IllegalArgumentException("Invalid argument(s)", e);
+        }
+    }
+
+      [...snip...]
+
+    private void report( String name, Object value, Annotation constraint )
+    {
+    }
+}
+</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_property_constraint"></a>Property Constraint</h4></div></div></div><p>Property Constraints are declared on the Property method.</p><pre class="programlisting brush: java">public interface HasPhoneNumber
+{
+    @PhoneNumber
+    Property&lt;String&gt; phoneNumber();
+}
+</pre><p>In this case, the Constraint associated with the phoneNumber() method, will be called before the set() method on that
+Property is called. If there is a constraint violation, the Exception thrown will be part of the caller, and not the
+composite containing the Property, so a reporting constraint on the containing Composite will not see it. If you want
+the containing Composite to handle the Constraint Violation, then you need to add a Concern on the Property itself,
+which can be done like this;</p><pre class="programlisting brush: java">public abstract class PhoneNumberParameterViolationConcern extends ConcernOf&lt;HasPhoneNumber&gt;
+    implements HasPhoneNumber
+{
+    @Concerns( CheckViolation.class )
+    public abstract Property&lt;String&gt; phoneNumber();
+
+    private abstract class CheckViolation extends ConcernOf&lt;Property&lt;String&gt;&gt;
+        implements Property&lt;String&gt;
+    {
+        public void set( String number )
+        {
+            try
+            {
+                next.set( number );
+            }
+            catch( ConstraintViolationException e )
+            {
+                Collection&lt;ConstraintViolation&gt; violations = e.constraintViolations();
+                report( violations );
+            }
+        }
+
+          [...snip...]
+
+        private void report( Collection&lt;ConstraintViolation&gt; violations )
+        {
+        }
+    }
+}
+</pre></div></div><footer xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><div class="container"><p class="text-muted">Copyright � 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>.
+          Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are
+          trademarks of The Apache Software Foundation.
+          All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+        </p></div></footer><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common">window.jQuery || document.write('&lt;script src="js/jquery-1.6.4.min.js"&gt;&lt;/script&gt;')</script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="bootstrap-3.3.7/js/bootstrap.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="js/ie10-viewport-bug-workaround.js"></script></body></html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-website/blob/bb9c9971/content/java/2017/howto-create-entity.html
----------------------------------------------------------------------
diff --git a/content/java/2017/howto-create-entity.html b/content/java/2017/howto-create-entity.html
new file mode 100644
index 0000000..932c796
--- /dev/null
+++ b/content/java/2017/howto-create-entity.html
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Create an Entity</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-create-sideeffect.html" title="Create a SideEffect" /><link rel="next" href="howto-configure-service.html" title="Configure a Service" />
+
+
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
+    <meta name="description" content="">
+    <meta name="author" content="">
+    <link rel="icon" href="../../favicon.ico">
+
+    <title>Starter Template for Bootstrap</title>
+
+    <!-- Bootstrap core CSS -->
+    <link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet">
+
+    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
+    <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">
+
+    <!-- Custom styles for this template -->
+    <link href="css/polygene-ng.css" rel="stylesheet">
+
+    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
+    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
+    <script src="js/ie-emulation-modes-warning.js"></script>
+
+    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
+    <!--[if lt IE 9]>
+      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
+      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
+    <![endif]-->
+
+<!-- favicon -->
+
+<link rel="shortcut icon" href="http://polygene.apache.org/favicon.ico" type="image/vnd.microsoft.icon" />
+<link rel="icon" href="http://polygene.apache.org/favicon.ico" type="image/x-icon" />
+
+<!-- style -->
+
+<link href="css/shCore.css" rel="stylesheet" type="text/css" />
+<link href="css/shCoreEclipse.css" rel="stylesheet" type="text/css" />
+<link href="css/shThemeEclipse.css" rel="stylesheet" type="text/css" />
+<!--<link href="css/polygene.css" rel="stylesheet" type="text/css" />-->
+
+<!-- Syntax Highlighter -->
+
+<script type="text/javascript" src="js/shCore.js"></script>
+<script type="text/javascript" src="js/shBrushJava.js"></script>
+<script type="text/javascript" src="js/shBrushScala.js"></script>
+<script type="text/javascript" src="js/shBrushJScript.js"></script>
+<script type="text/javascript" src="js/shBrushBash.js"></script>
+<script type="text/javascript" src="js/shBrushPlain.js"></script>
+<script type="text/javascript" src="js/shBrushXml.js"></script>
+<script type="text/javascript" src="js/shBrushGroovy.js"></script>
+<script type="text/javascript" src="js/shBrushPython.js"></script>
+<script type="text/javascript" src="js/shBrushRuby.js"></script>
+<script type="text/javascript" src="js/shBrushCSharp.js"></script>
+
+<script type="text/javascript">
+  SyntaxHighlighter.defaults['tab-size'] = 4;
+  SyntaxHighlighter.defaults['gutter'] = false;
+  SyntaxHighlighter.defaults['toolbar'] = false;
+  SyntaxHighlighter.all()
+</script>
+
+<!-- JQuery -->
+
+<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
+
+<!-- Image Scaler -->
+
+<script type="text/javascript" src="js/imagescaler.js"></script>
+
+<!-- Table Styler -->
+
+<script type="text/javascript" src="js/tablestyler.js"></script>
+
+<!-- Apache Polygene WebSite Progressive Enhancement -->
+
+<link href="css/progressive-enhancement.css" rel="stylesheet" type="text/css" />
+<script type="text/javascript" src="js/jquery.scrollTo-1.4.2.js"></script>
+<script type="text/javascript" src="js/progressive-enhancement.js"></script>
+
+<!-- Analytics -->
+ <script type="text/javascript">
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-62007352-1']);
+  _gaq.push(['_trackPageview']);
+
+  (function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+ </script>
+
+  </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><nav xmlns="" xmlns:exsl="http://exslt.org/common" class="navbar navbar-inverse navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="#">Apache<br />Polygene
+          </a></div><div id="navbar" class="collapse navbar-collapse"><span class="nav navbar-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygene\u2122</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.html">Glossary�</a></span></dt></dl></div></span></div></div></nav><div xmlns="" xmlns:exsl="http://exslt
 .org/common" class="sidenav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene\u2122 in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene\u2122 in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene\u2122 in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygene\u2122</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">Services Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span
 ></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><span xmlns="" href="howto-create-entity.html">Create an Entity</span></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene\u2122 Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene\u2122 Documentation</a></span></dt><dt><span class="section"><a href="releasing-apache.html">Releasing Polygene\u2122</a></span></dt><
 /dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="howto-create-entity"></a>Create an Entity</h3></div></div></div><p>One of the most common tasks in Polygene\u2122 is the management of the life cycle of Entities. Since Polygene\u2122 is capable of
+delivering much higher performance than traditional Object-Relational Mapping technologies, we also expect that people
+use Entities more frequently in Polygene\u2122 applications, so it is a very important topic to cover.</p><p>If you want to reproduce what\u2019s explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm1768"></a><p class="title"><strong>Table�12.�Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.core</p></td><td align="left" valign="top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></div><br class="table-break" /><p>Moreover, you\u2019ll need an EntityStore for persistence and an Indexing engine for querying. Choose among the availab
 le
+implementations listed in the <a class="xref" href="extensions.html" title="Extensions">Extensions</a> section.</p><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygene\u2122">Depend on Polygene\u2122</a> tutorial for details.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_basics_first"></a>Basics First</h4></div></div></div><p>All Entity operations MUST be done within a UnitOfWork. UnitOfWorks can be nested and if underlying UnitOfWorks are not
+completed (method complete()), then none of the operations will be persisted permanently.</p><p>Entity composites are subtypes of the EntityComposite interface.</p><p>Domain code typically don\u2019t need to know of the EntityComposite types directly, and is instead using the domain specific
+interface. The Visibility rules will be applied to associate the right EntityComposite when a domain type is requested.
+Ambiguities are not accepted and will result in runtime exceptions.</p><p>Polygene\u2122 supports that each entity instance can have more than one entity type, and it is managed per instance. This feature
+is beyond the scope of this HowTO and will be covered subsequently.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_good_practice"></a>Good Practice</h4></div></div></div><p>We have made the observation that it is good practice to separate the internal state from the observable behavior. By
+this we mean that it is not a good practice to allow client code to manipulate or even view the internal states of
+objects, which is such a common (bad) practice in the so called POJO world.</p><p>Instead, we recommend that the programmer defines the client requirement of what each participant within the client
+context needs to conform to, and then create composites accordingly and hide all the state internal to the composite in
+private mixins. By doing so, the same entity can participate in multiple contexts with different behavioral requirements
+but using the same internal state.</p><p>We recommend limited use of primitive types for Properties and instead subtype the Property.</p><p>And try to use ValueComposites instead of Entities.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_the_entity"></a>The Entity</h4></div></div></div><p>We need an entity to illustrate how we recommend to separate internal state from public behavior and observable state.
+We will for the sake of simplicity use a trivial example. Please refer to other (possibly future) HowTos on patterns on
+Entity management.</p><pre class="programlisting brush: java">public interface Car
+{
+    @Immutable
+    Association&lt;Manufacturer&gt; manufacturer();
+
+    @Immutable
+    Property&lt;String&gt; model();
+
+    ManyAssociation&lt;Accident&gt; accidents();
+}
+
+</pre><pre class="programlisting brush: java">public interface Manufacturer
+{
+    Property&lt;String&gt; name();
+    Property&lt;String&gt; country();
+
+    @UseDefaults
+    Property&lt;Long&gt; carsProduced();
+}
+
+</pre><pre class="programlisting brush: java">public interface Accident
+{
+    Property&lt;String&gt; description();
+    Property&lt;LocalDate&gt; occured();
+    Property&lt;LocalDate&gt; repaired();
+}
+
+</pre><p>Above we define a Car domain object, which is of a particular Manufacturer (also an Entity), a model and a record of
+Accidents.</p><p>We will also need to define the composites for the above domain structure;</p><pre class="programlisting brush: java">public interface CarEntity extends Car, EntityComposite
+{}
+
+</pre><pre class="programlisting brush: java">public interface ManufacturerEntity extends Manufacturer, EntityComposite
+{}
+
+</pre><pre class="programlisting brush: java">public interface AccidentValue extends Accident, ValueComposite
+{}
+
+</pre><p>For this case, we define both the Car and the Manufacturer as Entities, whereas the Accident is a Value, since it is an
+immutable event that can not be modified.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_assembly"></a>Assembly</h4></div></div></div><p>All of the above must also be declared in the assembly. We MUST associate the EntityComposites with a relevant Module.
+We must also assemble an EntityStore for the entire application, but that is outside the scope of this HowTo.</p><pre class="programlisting brush: java">public class MyAssembler
+        implements Assembler
+{
+    public void assemble( ModuleAssembly module )
+    {
+        module.entities( CarEntity.class,
+                ManufacturerEntity.class );
+
+        module.values( AccidentValue.class );
+          [...snip...]
+
+    }
+}
+</pre><p>We have no other Composites involved yet, so we can proceed to look at the usage code.</p><p>We recommend that the life cycle management of entities is placed inside domain factories, one for each type and made
+available as services.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_the_entity_factory"></a>The Entity Factory</h4></div></div></div><p>The entity factory is something you need to write yourself, but as with most things in Polygene\u2122 it will end up being a
+fairly small implementation. So how is that done?</p><pre class="programlisting brush: java">public interface CarEntityFactory
+{
+    Car create(Manufacturer manufacturer, String model);
+}
+
+</pre><p>That is just the domain interface. We now need to make the service interface, which Polygene\u2122 needs to identify services and
+make it possible for the service injection later.</p><pre class="programlisting brush: java">@Mixins( { CarEntityFactoryMixin.class } )
+public interface CarEntityFactoryService
+        extends CarEntityFactory, ServiceComposite
+{}
+</pre><p>Then we need an implementation of the mixin.</p><pre class="programlisting brush: java">public class CarEntityFactoryMixin
+    implements CarEntityFactory
+{
+
+</pre><p>And doing that, first of all we need to request Polygene\u2122 runtime to give us the Module
+that our code belongs to, and the UnitOfWork current context the execution is happening in.</p><p>Injections that are related to the Visibility rules are handled by the @Structure annotation. And the easiest way for us
+to obtain a Module is simply to;</p><pre class="programlisting brush: java">public class CarEntityFactoryMixin
+    implements CarEntityFactory
+{
+
+    @Structure
+    UnitOfWorkFactory unitOfWorkFactory;
+
+</pre><p>Here Polygene\u2122 will inject the member module with the correct Module. In case we only need the Module
+during the construction, we can also request it in the same manner as constructor argument.</p><pre class="programlisting brush: java">public CarEntityFactoryMixin( @Structure UnitOfWorkFactory unitOfWorkFactory )
+{
+}
+
+</pre><p>This is important to know, since the injected member will not be available until AFTER the constructor has been
+completed.</p><p>We then need to provide the implementation for the create() method.</p><pre class="programlisting brush: java">public Car create( Manufacturer manufacturer, String model )
+{
+    UnitOfWork uow = unitOfWorkFactory.currentUnitOfWork();
+    EntityBuilder&lt;Car&gt; builder = uow.newEntityBuilder( Car.class );
+
+    Car prototype = builder.instance();
+    prototype.manufacturer().set( manufacturer );
+    prototype.model().set( model );
+
+    return builder.newInstance();
+}
+</pre><p>So far so good. But how about the Manufacturer input into the create() method?</p><p>DDD promotes the use of Repositories. They are the type-safe domain interfaces into locating entities without getting
+bogged down with querying infrastructure details. And one Repository per Entity type, so we keep it nice, tidy and
+re-usable. So let\u2019s create one for the Manufacturer type.</p><pre class="programlisting brush: java">public interface ManufacturerRepository
+{
+    Manufacturer findByIdentity(Identity identity);
+
+    Manufacturer findByName(String name);
+}
+</pre><p>And then we repeat the process for creating a Service\u2026</p><pre class="programlisting brush: java">@Mixins( ManufacturerRepositoryMixin.class  )
+public interface ManufacturerRepositoryService
+        extends ManufacturerRepository, ServiceComposite
+{}
+</pre><p>and a Mixin that implements it\u2026</p><pre class="programlisting brush: java">public class ManufacturerRepositoryMixin
+        implements ManufacturerRepository
+{
+    @Structure
+    private UnitOfWorkFactory uowf;
+
+    @Structure
+    private Module module;
+
+    public Manufacturer findByIdentity( Identity identity )
+    {
+        UnitOfWork uow = uowf.currentUnitOfWork();
+        return uow.get(Manufacturer.class, identity );
+    }
+
+    public Manufacturer findByName( String name )
+    {
+        UnitOfWork uow = uowf.currentUnitOfWork();
+        QueryBuilder&lt;Manufacturer&gt; builder =
+                module.newQueryBuilder( Manufacturer.class );
+
+        Manufacturer template = templateFor( Manufacturer.class );
+        builder.where( eq( template.name(), name ) );
+
+        Query&lt;Manufacturer&gt; query = uow.newQuery( builder);
+        return query.find();
+    }
+}
+
+</pre><p>But now we have introduced 2 services that also are required to be declared in the assembly. In this case, we want the
+Services to be available to the application layer above, and not restricted to within this domain model.</p><pre class="programlisting brush: java">public class MyAssembler
+        implements Assembler
+{
+    public void assemble( ModuleAssembly module )
+    {
+        module.entities( CarEntity.class,
+                ManufacturerEntity.class );
+
+        module.values( AccidentValue.class );
+        module.addServices(
+                ManufacturerRepositoryService.class,
+                CarEntityFactoryService.class
+        ).visibleIn( Visibility.application );
+    }
+}
+</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_the_unitofwork"></a>The UnitOfWork</h4></div></div></div><p>If you notice, there is a couple of calls to Module.currentUnitOfWork(), but what is current UnitOfWork, and
+who is setting that up?</p><p>Well, the domain layer should not worry about UoW, it is probably the responsibility of the application/service layer
+sitting on top. That could be a web application creating and completing a UoW per request, or some other co-ordinator
+doing long-running UnitOfWorks.</p><p>There are of course a lot more details to get all this completed, but that is beyond the scope of this HowTo.
+See <a class="xref" href="core-api.html#core-api-unitofwork" title="Unit Of Work">UnitOfWork</a> in Core API.</p></div></div><footer xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><div class="container"><p class="text-muted">Copyright � 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>.
+          Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are
+          trademarks of The Apache Software Foundation.
+          All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+        </p></div></footer><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common">window.jQuery || document.write('&lt;script src="js/jquery-1.6.4.min.js"&gt;&lt;/script&gt;')</script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="bootstrap-3.3.7/js/bootstrap.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="js/ie10-viewport-bug-workaround.js"></script></body></html>
\ No newline at end of file