http://git-wip-us.apache.org/repos/asf/polygene-website/blob/2d44da7d/content/java/develop/howto-configure-service.html ---------------------------------------------------------------------- diff --git a/content/java/develop/howto-configure-service.html b/content/java/develop/howto-configure-service.html index a590989..92ab7d0 100644 --- a/content/java/develop/howto-configure-service.html +++ b/content/java/develop/howto-configure-service.html @@ -1,5 +1,5 @@ <?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><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.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" /> +<!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><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.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" /> <!-- favicon --> @@ -66,11 +66,11 @@ })(); </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><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygeneâ¢</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></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><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⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</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⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt ><dt><span class="section"><a href="releasing-apache.html">Releasing >Polygeneâ¢</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⢠supports a Configuration system >for services. The configuration instance itself is an Entity and is therefor + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</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.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</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⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt><dt><span class="sectio n"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section" title="Configure a Service"><div class="titlepage"><div><div><h3 class="title"><a id="howto-configure-service"></a>Configure a Service</h3></div></div></div><p>Polygene⢠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⢠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âs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm447727915328"></a><p class="title"><strong>Table 13. Artifact</strong></p><div class="table-contents"><table class="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>3.0.0-SNAPSHOT</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â¢">Depend on Polyg eneâ¢</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 +going to show how.</p><p>If you want to reproduce whatâs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm229756314768"></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>3.1.0-SNAPSHOT</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â¢">Depend on Polygeneâ¢</a> tut orial for details.</p><div class="section" title="We need a Service"><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â¦</p><pre class="programlisting brush: java">public interface TravelPlan { // Domain methods, which are beyond the discussion at hand. @@ -123,7 +123,7 @@ with the refresh() method in the Configuration interface;</p><pre class="program } </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 +not in the middle of value changes.</p><div class="section" title="Initial Values"><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âs "identifiedBy" will be used as the identifier for the Configuration entity and stored in the visible @@ -142,7 +142,7 @@ public void assemble(ModuleAssembly module) { 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 +</pre></div></div><div class="section" title="Non-default Identity"><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">@Override public void assemble(ModuleAssembly module) @@ -171,7 +171,7 @@ 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⢠is an active Entity, and once the properties file has been read once +</pre><p>File: org/apache/polygene/manual/travel/OrbitzService.properties</p></div><div class="section" title="Changing Configuration in runtime"><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⢠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
http://git-wip-us.apache.org/repos/asf/polygene-website/blob/2d44da7d/content/java/develop/howto-contextual-fragments.html ---------------------------------------------------------------------- diff --git a/content/java/develop/howto-contextual-fragments.html b/content/java/develop/howto-contextual-fragments.html index b8636fd..d803a5f 100644 --- a/content/java/develop/howto-contextual-fragments.html +++ b/content/java/develop/howto-contextual-fragments.html @@ -1,5 +1,5 @@ <?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><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.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" /> +<!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><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.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" /> <!-- favicon --> @@ -66,11 +66,11 @@ })(); </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><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygeneâ¢</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></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><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⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</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 fragments</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⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt ><dt><span class="section"><a href="releasing-apache.html">Releasing >Polygeneâ¢</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 + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</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.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</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"><sp an xmlns="" href="howto-contextual-fragments.html">Use contextual fragments</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⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt><dt><span class="sectio n"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section" title="Use contextual fragments"><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âs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm447728134832"></a><p class="title"><strong>Table 7. Artifact</strong></p><div class="table-contents"><table class="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 >3.0.0-SNAPSHOT</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â¢">Depend on Polygeneâ¢</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 +We strongly recommend against using this feature, as it is not needed as commonly as you may think.</p><div class="note" title="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âs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm229756534304"></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> 3.1.0-SNAPSHOT</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â¢">Depend on Polygeneâ¢</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 ) { http://git-wip-us.apache.org/repos/asf/polygene-website/blob/2d44da7d/content/java/develop/howto-create-concern.html ---------------------------------------------------------------------- diff --git a/content/java/develop/howto-create-concern.html b/content/java/develop/howto-create-concern.html index d153da0..5619de9 100644 --- a/content/java/develop/howto-create-concern.html +++ b/content/java/develop/howto-create-concern.html @@ -1,5 +1,5 @@ <?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><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.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" /> +<!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><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.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" /> <!-- favicon --> @@ -66,7 +66,7 @@ })(); </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><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygeneâ¢</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></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><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⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</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⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt ><dt><span class="section"><a href="releasing-apache.html">Releasing >Polygeneâ¢</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âs explained in this tutorial, remember to depend on the Core Bootstrap >artifact:</p><div class="table"><a id="idm447728050640"></a><p >class="title"><strong>Table 10. Artifact</strong></p><div >class="table-contents"><table class="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>3.0.0-SNAPSHOT</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â¢">Depend on Polygeneâ¢</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<Order> + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</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.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</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⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt><dt><span class="sectio n"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section" title="Create a Concern"><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âs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm229756450080"></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.apach e.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>3.1.0-SNAPSHOT</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â¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section" title="Typed Concern"><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<Order> implements Order { @Service @@ -103,7 +103,7 @@ public interface Order [...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 +</pre><p>Methods of the Concern Fragment will be called before the Mixin invocation.</p></div><div class="section" title="Generic Concern"><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 @@ -125,7 +125,7 @@ public interface AnyMixinType 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 +</pre><p>Methods of the Concern Fragment will be called before the Mixin invocation.</p><div class="section" title="AppliesTo"><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âed.</p><p>Here is how the declaration goes ;</p><pre class="programlisting brush: java">@AppliesTo( { MyAnnotation.class, MyAppliesToFilter.class } ) http://git-wip-us.apache.org/repos/asf/polygene-website/blob/2d44da7d/content/java/develop/howto-create-constraint.html ---------------------------------------------------------------------- diff --git a/content/java/develop/howto-create-constraint.html b/content/java/develop/howto-create-constraint.html index 63391f1..a94d56f 100644 --- a/content/java/develop/howto-create-constraint.html +++ b/content/java/develop/howto-create-constraint.html @@ -1,5 +1,5 @@ <?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><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.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" /> +<!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><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.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" /> <!-- favicon --> @@ -66,7 +66,7 @@ })(); </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><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygeneâ¢</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></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><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⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</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⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt ><dt><span class="section"><a href="releasing-apache.html">Releasing >Polygeneâ¢</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âs explained in this tutorial, remember to depend on >the Core Bootstrap artifact:</p><div class="table"><a >id="idm447728082192"></a><p class="title"><strong>Table 9. >Artifact</strong></p><div class="table-contents"><table class="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>3.0.0-SNAPSHOT</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â¢">Depend on Polygeneâ¢</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 + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</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.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</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⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt><dt><span class="sectio n"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section" title="Create a Constraint"><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âs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm229756481664"></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>3.1.0-SNAPSHOT</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â¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section" title="Method Constraint"><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); @@ -103,7 +103,7 @@ in the method invocation. Concerns can be used to catch and report these violati } catch( ConstraintViolationException e ) { - for( ConstraintViolation violation : e.constraintViolations() ) + for( ValueConstraintViolation violation : e.constraintViolations() ) { String name = violation.name(); Object value = violation.value(); @@ -120,7 +120,7 @@ in the method invocation. Concerns can be used to catch and report these violati { } } -</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 +</pre></div><div class="section" title="Property Constraint"><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<String> phoneNumber(); @@ -146,14 +146,14 @@ which can be done like this;</p><pre class="programlisting brush: java">public a } catch( ConstraintViolationException e ) { - Collection<ConstraintViolation> violations = e.constraintViolations(); + Collection<ValueConstraintViolation> violations = e.constraintViolations(); report( violations ); } } [...snip...] - private void report( Collection<ConstraintViolation> violations ) + private void report( Collection<ValueConstraintViolation> violations ) { } } http://git-wip-us.apache.org/repos/asf/polygene-website/blob/2d44da7d/content/java/develop/howto-create-entity.html ---------------------------------------------------------------------- diff --git a/content/java/develop/howto-create-entity.html b/content/java/develop/howto-create-entity.html index 8fc93bd..0eed607 100644 --- a/content/java/develop/howto-create-entity.html +++ b/content/java/develop/howto-create-entity.html @@ -1,5 +1,5 @@ <?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><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.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" /> +<!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><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.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" /> <!-- favicon --> @@ -66,19 +66,19 @@ })(); </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><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygeneâ¢</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></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><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⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</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⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt ><dt><span class="section"><a href="releasing-apache.html">Releasing >Polygeneâ¢</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⢠is the management of the life cycle of >Entities. Since Polygene⢠is capable of + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</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.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</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⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt><dt><span class="sectio n"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section" title="Create an Entity"><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⢠is the management of the life cycle of Entities. Since Polygene⢠is capable of delivering much higher performance than traditional Object-Relational Mapping technologies, we also expect that people -use Entities more frequently in Polygene⢠applications, so it is a very important topic to cover.</p><p>If you want to reproduce whatâs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm447727980432"></a><p class="title"><strong>Table 12. Artifact</strong></p><div class="table-contents"><table class="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>3.0.0-SNAPSHOT</p></td></tr></tbody></table></div></div><br class="table-break" /><p>Moreover, youâll need an EntityStore for persistence and an Indexing engine for querying. Choose among the available -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â¢">Depend on Polygeneâ¢</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 +use Entities more frequently in Polygene⢠applications, so it is a very important topic to cover.</p><p>If you want to reproduce whatâs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm229756379872"></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>3.1.0-SNAPSHOT</p></td></tr></tbody></table></div></div><br class="table-break" /><p>Moreover, youâll need an EntityStore for persistence and an Indexing engine for querying. Cho ose among the available +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â¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section" title="Basics First"><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ât 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⢠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 +is beyond the scope of this HowTO and will be covered subsequently.</p></div><div class="section" title="Good Practice"><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. +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" title="The Entity"><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 { @@ -118,7 +118,7 @@ Accidents.</p><p>We will also need to define the composites for the above domain {} </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. +immutable event that can not be modified.</p></div><div class="section" title="Assembly"><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 { @@ -133,7 +133,7 @@ We must also assemble an EntityStore for the entire application, but that is out } } </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⢠it will end up being a +available as services.</p></div><div class="section" title="The Entity Factory"><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⢠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); @@ -231,7 +231,7 @@ Services to be available to the application layer above, and not restricted to w ).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 +</pre></div><div class="section" title="The UnitOfWork"><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. http://git-wip-us.apache.org/repos/asf/polygene-website/blob/2d44da7d/content/java/develop/howto-create-sideeffect.html ---------------------------------------------------------------------- diff --git a/content/java/develop/howto-create-sideeffect.html b/content/java/develop/howto-create-sideeffect.html index 68b36f9..2ad1e90 100644 --- a/content/java/develop/howto-create-sideeffect.html +++ b/content/java/develop/howto-create-sideeffect.html @@ -1,5 +1,5 @@ <?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 SideEffect</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-create-concern.html" title="Create a Concern" /><link rel="next" href="howto-create-entity.html" title="Create an Entity" /> +<!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 SideEffect</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-create-concern.html" title="Create a Concern" /><link rel="next" href="howto-create-entity.html" title="Create an Entity" /> <!-- favicon --> @@ -66,7 +66,7 @@ })(); </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><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygeneâ¢</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></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><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⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</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"><span xmlns="" href="howto-create-sideeffect.html">Create a SideEffect</span></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⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt ><dt><span class="section"><a href="releasing-apache.html">Releasing >Polygeneâ¢</a></span></dt></dl></div></div><div class="section"><div >class="titlepage"><div><div><h3 class="title"><a >id="howto-create-sideeffect"></a>Create a >SideEffect</h3></div></div></div><p>SideEffects are defined in <a >class="xref" href="glossary.html#def-sideeffect">SideEffect</a>.</p><p>If you >want to reproduce whatâs explained in this tutorial, remember to depend on >the Core Bootstrap artifact:</p><div class="table"><a >id="idm447728015504"></a><p class="title"><strong>Table 11. >Artifact</strong></p><div class="table-contents"><table class="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="lef t" valign="top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>3.0.0-SNAPSHOT</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â¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_typed_sideeffect"></a>Typed SideEffect</h4></div></div></div><p>A typed SideEffect is a Java class that implements the MixinType it can be used on:</p><pre class="programlisting brush: java">public abstract class MailNotifySideEffect extends SideEffectOf<Confirmable> + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</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.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</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"><span xmlns="" href="howto-create-sideeffect.html">Create a SideEffect</span></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⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt><dt><span class="sectio n"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section" title="Create a SideEffect"><div class="titlepage"><div><div><h3 class="title"><a id="howto-create-sideeffect"></a>Create a SideEffect</h3></div></div></div><p>SideEffects are defined in <a class="xref" href="glossary.html#def-sideeffect">SideEffect</a>.</p><p>If you want to reproduce whatâs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm229756414944"></a><p class="title"><strong>Table 11. 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>3.1.0-SNAPSHOT</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â¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section" title="Typed SideEffect"><div class="titlepage"><div><div><h4 class="title"><a id="_typed_sideeffect"></a>Typed SideEffect</h4></div></div></div><p>A typed SideEffect is a Java class that implements the MixinType it can be used on:</p><pre class="programlisting brush: java">public abstract class MailNotifySideEffect extends SideEffectOf<Confirmable> implements Confirmable { @Service @@ -107,7 +107,7 @@ public interface OrderEntity HasLineItems, Confirmable, HasIdentity { } -</pre><p>Methods of the SideEffect Fragment will be called after the Mixin invocation.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_generic_sideeffect"></a>Generic SideEffect</h4></div></div></div><p>A generic SideEffect is a Java class that implements java.lang.reflect.InvocationHandler which allows it to be used on any +</pre><p>Methods of the SideEffect Fragment will be called after the Mixin invocation.</p></div><div class="section" title="Generic SideEffect"><div class="titlepage"><div><div><h4 class="title"><a id="_generic_sideeffect"></a>Generic SideEffect</h4></div></div></div><p>A generic SideEffect 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 MyGenericSideEffect extends GenericSideEffect { @Override @@ -134,7 +134,7 @@ public interface AnyMixinType [...snip...] } -</pre><p>Methods of the SideEffect Fragment will be called before the Mixin invocation.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="_appliesto_2"></a>AppliesTo</h5></div></div></div><p>For generic SideEffects that should only trigger on methods with specific annotations or fulfilling some expression, add +</pre><p>Methods of the SideEffect Fragment will be called before the Mixin invocation.</p><div class="section" title="AppliesTo"><div class="titlepage"><div><div><h5 class="title"><a id="_appliesto_2"></a>AppliesTo</h5></div></div></div><p>For generic SideEffects that should only trigger on methods with specific annotations or fulfilling some expression, add @AppliesTo annotation to the SideEffect class which points to either triggering annotation(s), or to AppliesToFilter implementation(s).</p><p>The SideEffect 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âed.</p><p>Here is how the declaration goes ;</p><pre class="programlisting brush: java">@AppliesTo( { MyAnnotation.class, MyAppliesToFilter.class } )
