You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2016/05/14 13:44:13 UTC
[4/7] isis-site git commit: ISIS-1291: commands,
publishing and interaction context
http://git-wip-us.apache.org/repos/asf/isis-site/blob/3eb5a1da/content/guides/rgsvc.html
----------------------------------------------------------------------
diff --git a/content/guides/rgsvc.html b/content/guides/rgsvc.html
index 755fc3a..af35fdb 100644
--- a/content/guides/rgsvc.html
+++ b/content/guides/rgsvc.html
@@ -587,7 +587,8 @@ for Apache Isis and contribute back to the project)</p>
<div class="paragraph">
<p>The domain services also group into various broad categories. Many support functionality of the various layers of the
system (presentation layer, application layer, core domain, persistence layer); others exist to allow the domain objects
-to integrate with other bounded contexts, or provide various metadata (eg for development-time tooling). The diagram below shows these categories:</p>
+to integrate with other bounded contexts, or provide various metadata (eg for development-time tooling). The diagram
+below shows these categories:</p>
</div>
<div class="imageblock">
<div class="content">
@@ -596,27 +597,38 @@ to integrate with other bounded contexts, or provide various metadata (eg for de
</div>
<div class="paragraph">
<p>A small number of domain services can be considered both API and SPI; a good example is the <a href="#_rgsvc_api_EmailService"><code>EmailService</code></a> that is of direct use for domain objects wishing to send out emails,
-but is also used by the framework to support the <a href="ugvw.html#_ugvw_features_user-registration">user registration</a> functionality supported by the <a href="ugvw.html">Wicket viewer</a>. The same is true of the <a href="#_rgsvc_api_EventBusService"><code>EventBusService</code></a>; this can be used by domain objects to broadcast arbitrary events, but is also used by the framework to automatically emit events for <a href="rgant.html#_rgant-Action_domainEvent"><code>@Action#domainEvent()</code></a> etc.</p>
+but is also used by the framework to support the <a href="ugvw.html#_ugvw_features_user-registration">user registration</a>
+functionality supported by the <a href="ugvw.html">Wicket viewer</a>. The same is true of the <a href="#_rgsvc_api_EventBusService"><code>EventBusService</code></a>; this can be used by domain objects to broadcast arbitrary events,
+but is also used by the framework to automatically emit events for
+<a href="rgant.html#_rgant-Action_domainEvent"><code>@Action#domainEvent()</code></a> etc.</p>
</div>
<div class="paragraph">
-<p>For these hybrid services we have categorized the service as an "API" service. This chapter therefore contains only the strictly SPI services.</p>
+<p>For these hybrid services we have categorized the service as an "API" service. This chapter therefore contains only
+the strictly SPI services.</p>
</div>
<div class="paragraph">
-<p>This rest of this guide is broken out into several chapters, one for each of the various types/categories of domain service.</p>
+<p>This rest of this guide is broken out into several chapters, one for each of the various types/categories of domain
+service.</p>
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_intro_public-api">2.2. Public API</h3>
+<h3 id="_rgsvc_intro_public-api">2.2. Public API vs Internal Services</h3>
<div class="paragraph">
<p>The vast majority of Apache Isis' domain services are defined in Apache Isis' applib (<code>o.a.i.core:isis-core-applib</code>
module) as stable, public classes. Importantly, this also minimizes the coupling between your code and Apache Isis,
allowing you to easily mock out these services in your unit tests.</p>
</div>
+<div class="paragraph">
+<p>The framework also defines a number of "internal" services. These are not part of the framework’s formal API, in that
+they use classes that are outside of the applib. These are documented here, but should be thought of as part of the
+internal design of the framework, and are liable to change from release to release.</p>
+</div>
</div>
<div class="sect2">
<h3 id="_rgsvc_intro_using-the-services">2.3. Using the services</h3>
<div class="paragraph">
-<p>Apache Isis includes an extensive number of domain services for your domain objects to use; simply define the service as an annotated field and Apache Isis will inject the service into your object.</p>
+<p>Apache Isis includes an extensive number of domain services for your domain objects to use; simply define the service
+as an annotated field and Apache Isis will inject the service into your object.</p>
</div>
<div class="paragraph">
<p>For example:</p>
@@ -665,10 +677,12 @@ JDO/DataNucleus.</p>
<div class="sect2">
<h3 id="_rgsvc_intro_overriding-the-services">2.4. Overriding the services</h3>
<div class="paragraph">
-<p>The framework provides default implementations for many of the domain services. This is convenient, but sometimes you will want to replace the default implementation with your own service implementation.</p>
+<p>The framework provides default implementations for many of the domain services. This is convenient, but sometimes you
+will want to replace the default implementation with your own service implementation.</p>
</div>
<div class="paragraph">
-<p>The trick is to use the <a href="rgant.html#_rgant-DomainServiceLayout_menuOrder"><code>@DomainServiceLayout#menuOrder()</code></a> attribute, specifying a low number (typically <code>"1"</code>).</p>
+<p>The trick is to use the <a href="rgant.html#_rgant-DomainServiceLayout_menuOrder"><code>@DomainServiceLayout#menuOrder()</code></a>
+attribute, specifying a low number (typically <code>"1"</code>).</p>
</div>
<div class="admonitionblock note">
<table>
@@ -678,7 +692,10 @@ JDO/DataNucleus.</p>
</td>
<td class="content">
<div class="paragraph">
-<p>For a small number of domain services, all implementations are used (following the chain-of-responsibility pattern), not just the first one. The services in question are: <a href="#_rgsvc_spi_ContentMappingService"><code>ContentMappingService</code></a>, <a href="#_rgsvc_spi_GridSystemService"><code>GridSystemService</code></a>, and
+<p>For a small number of domain services, all implementations are used (following the chain-of-responsibility pattern),
+not just the first one. The services in question are:
+<a href="#_rgsvc_spi_ContentMappingService"><code>ContentMappingService</code></a>,
+<a href="#_rgsvc_spi_GridSystemService"><code>GridSystemService</code></a>, and
<a href="#_rgsvc_spi_RoutingService"><code>RoutingService</code></a>.</p>
</div>
</td>
@@ -686,7 +703,8 @@ JDO/DataNucleus.</p>
</table>
</div>
<div class="paragraph">
-<p>For example, suppose you wanted to provide your own implementation of <a href="#_rgsvc_api_LocaleProvider"><code>LocaleProvider</code></a>. Here’s how:</p>
+<p>For example, suppose you wanted to provide your own implementation of
+<a href="#_rgsvc_api_LocaleProvider"><code>LocaleProvider</code></a>. Here’s how:</p>
</div>
<div class="listingblock">
<div class="content">
@@ -713,7 +731,9 @@ JDO/DataNucleus.</p>
</table>
</div>
<div class="paragraph">
-<p>It’s also quite common to want to decorate the existing implementation (ie have your own implementation delegate to the default); this is also possible and quite easy (if using <code>1.10.0</code> or later). The idea is to have the framework inject all implementations of the service, and then to delegate to the first one that isn’t "this" one:</p>
+<p>It’s also quite common to want to decorate the existing implementation (ie have your own implementation delegate to the
+default); this is also possible and quite easy (if using <code>1.10.0</code> or later). The idea is to have the framework
+inject all implementations of the service, and then to delegate to the first one that isn’t "this" one:</p>
</div>
<div class="listingblock">
<div class="content">
@@ -758,6 +778,114 @@ JDO/DataNucleus.</p>
<p>The above code could be improved by caching the delegateLocaleProvider once located (rather than searching each time).</p>
</div>
</div>
+<div class="sect2">
+<h3 id="_rgsvc_intro_commands-and-events">2.5. Command and Events (<code>1.13.0-SNAPSHOT</code>)</h3>
+<div class="paragraph">
+<p>A good number of the domain services manage the execution of action invocations/property edits, along with the state
+of domain objects that are modified as a result of these. These services capture information which can then be used
+for various purposes, most notably for auditing or for publishing events, or for deferring execution such that the
+execution be performed in the background at some later date.</p>
+</div>
+<div class="paragraph">
+<p>The diagram below shows how these services fit together. The outline boxes are services while the coloured boxes
+represent data structures - defined in the applib and therefore accessible to domain applications - which hold various
+information about the executions.</p>
+</div>
+<div class="imageblock">
+<div class="content">
+<a class="image" href="images/reference-services/commands-and-events.png"><img src="images/reference-services/commands-and-events.png" alt="commands and events" width="960px"></a>
+</div>
+</div>
+<div class="paragraph">
+<p>To explain:</p>
+</div>
+<div class="ulist">
+<ul>
+<li>
+<p>the (request-scoped) <a href="#_rgsvc_api_CommandContext"><code>CommandContext</code></a> captures the user’s intention to
+invoke an action or edit a property; this is held by the <code>Command</code> object.</p>
+</li>
+<li>
+<p>if a <a href="#_rgsvc_spi_CommandService"><code>CommandService</code></a> has been configured, then this will be used to
+create the <code>Command</code> object implementation, generally so that it can then also be persisted.<br></p>
+<div class="paragraph">
+<p>If the action or property is annotated to be invoked in the background (using
+<a href="rgant.html#_rgant-Action_command"><code>@Action#command…​()</code></a> or
+<a href="rgant.html#_rgant-Property_command"><code>@Property#command…​()</code></a>) then no further work is done. But,
+if the action/property is to be executed in the foreground, then the interaction continues.</p>
+</div>
+</li>
+<li>
+<p>the (request-scoped) <a href="#_rgsvc_api_InteractionContext"><code>InteractionContext</code></a> domain service acts as a
+factory for the <code>Interaction</code> object, which keeps track of the call-graph of executions (<code>Interaction.Execution</code>)
+of either action invocations or property edits. In the majority of cases there is likely to be just a single top-level
+node of this graph, but for applications that use the <a href="#_rgsvc_api_WrapperFactory"><code>WrapperFactory</code></a>
+extensively each successive call results in a new child execution.</p>
+</li>
+<li>
+<p>before and after each action invocation/property edit, a <a href="rgcms.html#_rgcms_classes_domainevent">domain event</a> is
+may be broadcast to all subscribers. Whether this occurs depends on whether the action/property has been annotated
+(using <a href="rgant.html#_rgant-Action_domainEvent"><code>@Action#domainEvent()</code></a> or
+<a href="rgant.html#_rgant-Property_domainEvent"><code>@Property#domainEvent()</code></a>).<br></p>
+<div class="paragraph">
+<p>(Note that susbcribers will also receive events for vetoing the action/property; this is not shown on the diagram).</p>
+</div>
+</li>
+<li>
+<p>As each execution progresses, and objects that are modified are "enlisted" into the (internal)
+<a href="#_rgsvc_spi_ChangedObjectsServiceInternal"><code>ChangedObjectsServiceInternal</code></a> domain service. Metrics as
+to which objects are merely loaded into memory are also captured using the
+<a href="#_rgsvc_api_MetricsService"><code>MetricsService</code></a> (not shown on the diagram).</p>
+</li>
+<li>
+<p>At the end of each execution, details of that execution are published through the (internal)
+<a href="#_rgsvc_spi_PublisherServiceInternal"><code>PublisherServiceInternal</code></a> domain service. This is only done for
+actions/properties annotated appropriate (with <a href="rgant.html#_rgant-Action_publishing"><code>@Action#publishing()</code></a> or
+<a href="rgant.html#_rgant-Property_publishing"><code>@Property#publishing()</code></a>). <br></p>
+<div class="paragraph">
+<p>The internal service delegates in turn to any registered
+<a href="#_rgsvc_spi_PublishingService"><code>PublishingService</code></a> (deprecated) and also to any
+registered <a href="#_rgsvc_spi_PublisherService"><code>PublisherService</code></a>s (there may be more than one).</p>
+</div>
+</li>
+<li>
+<p>At the end of all executions, details of all changed objects are published, again through the (internal)
+<a href="#_rgsvc_spi_PublisherServiceInternal"><code>PublisherServiceInternal</code></a> to any registered <code>PublishingService</code>
+or <code>PublisherService</code> implementations. Only domain objects specified to be published with
+<a href="rgant.html#_rgant-DomainObject_publishing"><code>@DomainObject#publishing()</code></a> are published.</p>
+</li>
+<li>
+<p>Also at the end of all executions, details of all changed properties are passed to any registered
+<a href="#_rgsvc_spi_AuditingService"><code>AuditingService</code></a> by way of the (internal)
+<a href="#_rgsvc_spi_AuditingServiceInternal"><code>AuditingServiceInternal</code></a> domain service.</p>
+</li>
+</ul>
+</div>
+<div class="paragraph">
+<p>Implementations of <a href="#_rgsvc_spi_CommandService"><code>CommandService</code></a> can use the <code>Command#getMemento()</code>
+method to obtain a XML equivalent of that <code>Command</code>, reified using the <a href="rgcms.html#_rgcms_schema-cmd"><code>cmd.xsd</code></a>
+schema. This can be converted back into a <code>CommandDto</code> using the <code>CommandDtoUtils</code> utility class (part of the applib).</p>
+</div>
+<div class="paragraph">
+<p>Similarly, implementations of <a href="#_rgsvc_spi_PublisherService"><code>PublisherService</code></a> can use the
+<code>InteractionDtoUtils</code> utility class to obtain a <code>InteractionDto</code> representing the interaction, either just for a single
+execution or for the entire call-graph. This can be converted into XML in a similar fashion.</p>
+</div>
+<div class="paragraph">
+<p>Likewise, the <code>PublishedObjects</code> class passed to the <code>PublisherService</code> at the end of the interaction provides the
+<code>PublishedObjects#getDto()</code> method which returns a <code>ChangesDto</code> instance. This can be converted into XML using the
+<code>ChangesDtoUtils</code> utility class.</p>
+</div>
+<div class="paragraph">
+<p>One final point: multiple <a href="#_rgsvc_spi_PublisherService"><code>PublisherService</code></a> implementations are supported
+because different implementations may have different responsibilities. For example, the (non-ASF)
+<a href="http://github.com/isisaddons/isis-module-publishmq">Isis addons' publishmq</a> module is responsible for publishing
+messages onto an ActiveMQ event bus, for inter-system communication. However, the SPI can also be used for profiling;
+each execution within the call-graph contains metrics of the number of objects loaded or modified as a result of that
+execution, and thus could be used for application profiling. The framework provides a default
+<code>PublisherServiceLogging</code> implementation that logs this using SLF4J.</p>
+</div>
+</div>
</div>
</div>
<div class="sect1">
@@ -1002,7 +1130,7 @@ by the HTTP <code>Accept</code> header.</p>
<p>Unlike most other domain services, the framework (that is, <code>ContentNegotiationService</code>) will check <em>all</em> available
implementations of <code>ContentMappingService</code> to convert the domain object to the requested media type, rather than merely
the first implementation found; in other words it uses the chain-of-responsibility pattern. Services are checked
-in the ordering defined by <a href="rgant.html#_rgant_DomainServiceLayout_menuOrder"><code>@DomainServiceLayout#menuOrder()</code></a>).
+in the ordering defined by <a href="rgant.html#_rgant-DomainServiceLayout_menuOrder"><code>@DomainServiceLayout#menuOrder()</code></a>).
The mapped object used will be the first non-<code>null</code> result returned by an implementation.</p>
</div>
</td>
@@ -1549,7 +1677,7 @@ metadata available.</p>
<p>Unlike most other domain services, the framework will check <em>all</em> available implementations of <code>GridSystemService</code> to
obtain available grid systems, rather than merely the first implementation found; in other words it uses the
chain-of-responsibility pattern. Services are called in the order defined by
-<a href="rgant.html#_rgant_DomainServiceLayout_menuOrder"><code>@DomainServiceLayout#menuOrder()</code></a>).</p>
+<a href="rgant.html#_rgant-DomainServiceLayout_menuOrder"><code>@DomainServiceLayout#menuOrder()</code></a>).</p>
</div>
<div class="paragraph">
<p>Note though that each concrete implementation must also provide corresponding Wicket viewer components capable of
@@ -1582,7 +1710,7 @@ interpreting the grid layout.</p>
<tr>
<td><i class="conum" data-value="1"></i><b>1</b></td>
<td>The concrete subclass of <code>Grid</code> supported by this implementation. As noted in the introduction, there can be multiple implementations of this service, but there can only be one implementation per concrete subclass. As is normal practice,
-the service with the lowest <a href="rgant.html#_rgant_DomainServiceLayout_menuOrder"><code>@DomainServiceLayout#menuOrder()</code></a> takes precedence.</td>
+the service with the lowest <a href="rgant.html#_rgant-DomainServiceLayout_menuOrder"><code>@DomainServiceLayout#menuOrder()</code></a> takes precedence.</td>
</tr>
<tr>
<td><i class="conum" data-value="2"></i><b>2</b></td>
@@ -1598,16 +1726,16 @@ the service with the lowest <a href="rgant.html#_rgant_DomainServiceLayout_menuO
</tr>
<tr>
<td><i class="conum" data-value="5"></i><b>5</b></td>
-<td>Validates and normalizes a grid, modifying the grid so that all of the domain object’s members (properties, collections, actions) are bound to regions of the grid. This is done using existing metadata, most notably that of the <a href="rgant.html#_rgant_MemberOrder"><code>@MemberOrder</code></a> annotation. Such a grid, if persisted as the layout XML file for the domain class, allows the
+<td>Validates and normalizes a grid, modifying the grid so that all of the domain object’s members (properties, collections, actions) are bound to regions of the grid. This is done using existing metadata, most notably that of the <a href="rgant.html#_rgant-MemberOrder"><code>@MemberOrder</code></a> annotation. Such a grid, if persisted as the layout XML file for the domain class, allows the
<code>@MemberOrder</code> annotation to be removed from the source code of the domain class (but other annotations must be retained).</td>
</tr>
<tr>
<td><i class="conum" data-value="6"></i><b>6</b></td>
-<td>Takes a normalized grid and enriches it with additional metadata (taken from Apache Isis' internal metadata) that can be represented in the layout XML. Such a grid, if persisted as the layout XML file for the domain class, allows all layout annotations (<a href="rgant.html#_rgant_ActionLayout"><code>@ActionLayout</code></a>, <a href="rgant.html#_rgant_PropertyLayout"><code>@PropertyLayout</code></a> and <a href="rgant.html#_rgant_CollectionLayout"><code>@CollectionLayout</code></a>) to be removed from the source code of the domain class.</td>
+<td>Takes a normalized grid and enriches it with additional metadata (taken from Apache Isis' internal metadata) that can be represented in the layout XML. Such a grid, if persisted as the layout XML file for the domain class, allows all layout annotations (<a href="rgant.html#_rgant-ActionLayout"><code>@ActionLayout</code></a>, <a href="rgant.html#_rgant-PropertyLayout"><code>@PropertyLayout</code></a> and <a href="rgant.html#_rgant-CollectionLayout"><code>@CollectionLayout</code></a>) to be removed from the source code of the domain class.</td>
</tr>
<tr>
<td><i class="conum" data-value="7"></i><b>7</b></td>
-<td>Takes a normalized grid and strips out removes all members, leaving only the grid structure. Such a grid, if persisted as the layout XML file for the domain class, requires that the <a href="rgant.html#_rgant_MemberOrder"><code>@MemberOrder</code></a> annotation is retained in the source code of said class in order to bind members to the regions of the grid.</td>
+<td>Takes a normalized grid and strips out removes all members, leaving only the grid structure. Such a grid, if persisted as the layout XML file for the domain class, requires that the <a href="rgant.html#_rgant-MemberOrder"><code>@MemberOrder</code></a> annotation is retained in the source code of said class in order to bind members to the regions of the grid.</td>
</tr>
</table>
</div>
@@ -1775,15 +1903,15 @@ Isis' internal metamodel, in other words to ensure that all of the domain object
</tr>
<tr>
<td><i class="conum" data-value="6"></i><b>6</b></td>
-<td>validates and normalizes a grid, modifying the grid so that all of the domain object’s members (properties, collections, actions) are bound to regions of the grid. This is done using existing metadata, most notably that of the <a href="rgant.html#_rgant_MemberOrder"><code>@MemberOrder</code></a> annotation. Such a grid, if persisted as the layout XML file for the domain class, allows the <code>@MemberOrder</code> annotation to be removed from the source code of the domain class (but other annotations must be retained).</td>
+<td>validates and normalizes a grid, modifying the grid so that all of the domain object’s members (properties, collections, actions) are bound to regions of the grid. This is done using existing metadata, most notably that of the <a href="rgant.html#_rgant-MemberOrder"><code>@MemberOrder</code></a> annotation. Such a grid, if persisted as the layout XML file for the domain class, allows the <code>@MemberOrder</code> annotation to be removed from the source code of the domain class (but other annotations must be retained).</td>
</tr>
<tr>
<td><i class="conum" data-value="7"></i><b>7</b></td>
-<td>Takes a normalized grid and enriches it with additional metadata (taken from Apache Isis' internal metadata) that can be represented in the layout XML. Such a grid, if persisted as the layout XML file for the domain class, allows all layout annotations (<a href="rgant.html#_rgant_ActionLayout"><code>@ActionLayout</code></a>, <a href="rgant.html#_rgant_PropertyLayout"><code>@PropertyLayout</code></a> and <a href="rgant.html#_rgant_CollectionLayout"><code>@CollectionLayout</code></a>) to be removed from the source code of the domain class.</td>
+<td>Takes a normalized grid and enriches it with additional metadata (taken from Apache Isis' internal metadata) that can be represented in the layout XML. Such a grid, if persisted as the layout XML file for the domain class, allows all layout annotations (<a href="rgant.html#_rgant-ActionLayout"><code>@ActionLayout</code></a>, <a href="rgant.html#_rgant-PropertyLayout"><code>@PropertyLayout</code></a> and <a href="rgant.html#_rgant-CollectionLayout"><code>@CollectionLayout</code></a>) to be removed from the source code of the domain class.</td>
</tr>
<tr>
<td><i class="conum" data-value="8"></i><b>8</b></td>
-<td>Takes a normalized grid and strips out removes all members, leaving only the grid structure. Such a grid, if persisted as the layout XML file for the domain class, requires that the <a href="rgant.html#_rgant_MemberOrder"><code>@MemberOrder</code></a> annotation is retained in the source code of said class in order to bind members to the regions of the grid.</td>
+<td>Takes a normalized grid and strips out removes all members, leaving only the grid structure. Such a grid, if persisted as the layout XML file for the domain class, requires that the <a href="rgant.html#_rgant-MemberOrder"><code>@MemberOrder</code></a> annotation is retained in the source code of said class in order to bind members to the regions of the grid.</td>
</tr>
</table>
</div>
@@ -2008,7 +2136,7 @@ of the implementation to figure out what the "owning" object might be.</p>
<li>
<p>if an action returns <code>null</code> or is <code>void</code>, then return some other "useful" object.<br></p>
<div class="paragraph">
-<p>For example, return the home page (eg as defined by the <a href="rgant.html#_rgant_HomePage"><code>@HomePage</code></a> annotation).</p>
+<p>For example, return the home page (eg as defined by the <a href="rgant.html#_rgant-HomePage"><code>@HomePage</code></a> annotation).</p>
</div>
</li>
</ul>
@@ -2027,7 +2155,7 @@ of the implementation to figure out what the "owning" object might be.</p>
<p>Unlike most other domain services, the framework will check <em>all</em> available implementations of
<code>RoutingService</code> to return a route, rather than the first implementation found; in other words it uses the
chain-of-responsibility pattern. Services are called in the order defined by
-<a href="rgant.html#_rgant_DomainServiceLayout_menuOrder"><code>@DomainServiceLayout#menuOrder()</code></a>). The route used will be the
+<a href="rgant.html#_rgant-DomainServiceLayout_menuOrder"><code>@DomainServiceLayout#menuOrder()</code></a>). The route used will be the
result of the first implementation checked that declares that it can provide a route.</p>
</div>
</td>
@@ -2070,7 +2198,7 @@ if a <code>null</code> or <code>void</code> was provided. It uses the <a href="
</div>
<div class="paragraph">
<p>There can be multiple implementations of <code>RoutingService</code> registered. These are checked in turn (chain of responsibility
-pattern), ordered according to <a href="rgant.html#_rgant_DomainServiceLayout_menuOrder"><code>@DomainServiceLayout#menuOrder()</code></a>
+pattern), ordered according to <a href="rgant.html#_rgant-DomainServiceLayout_menuOrder"><code>@DomainServiceLayout#menuOrder()</code></a>
(as explained in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this guide).
The route from the first service that returns <code>true</code> from its <code>canRoute(…​)</code> method will be used.</p>
</div>
@@ -2421,7 +2549,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
<h2 id="_rgsvc_presentation-layer-internal-spi">4. Presentation Layer internal SPI</h2>
<div class="sectionbody">
<div class="paragraph">
-<p>Domain service SPIs for the presentation layer influence how the Apache Isis viewers behave. In addition to those defined in the applib, the framework also defines a small number of services that use classes that are internal to the framework.</p>
+<p>These domain services are internal to the framework, controlling various aspects of the presentation layer.</p>
</div>
<div class="admonitionblock warning">
<table>
@@ -2431,14 +2559,16 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</td>
<td class="content">
<div class="paragraph">
-<p>We do not guarantee that <a href="http://semver.org">semantic versioning</a> will be honoured for these ASPIs.</p>
+<p>We do not guarantee that <a href="http://semver.org">semantic versioning</a> will be honoured for these SPIs.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
-<p>The table below summarizes the presentation layer non-public SPIs defined by Apache Isis. It also lists their corresponding implementation, either a default implementation provided by Apache Isis itself, or provided by one of the in (non-ASF) <a href="http://www.isisaddons.org">Isis Addons</a> modules.</p>
+<p>The table below summarizes the presentation layer internal SPIs defined by Apache Isis. It also lists their
+corresponding implementation, either a default implementation provided by Apache Isis itself, or provided by one of the
+(non-ASF) <a href="http://www.isisaddons.org">Isis Addons</a> modules.</p>
</div>
<table class="tableblock frame-all grid-all spread">
<caption class="title">Table 2. "Internal" SPI Services</caption>
@@ -2997,14 +3127,28 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
<code>services.command</code><br>
<code>CommandContext</code></a></p></td>
<td class="tableblock halign-left valign-top"><div><div class="paragraph">
-<p>Request-scoped access the current action that is being invoked, represented as a command object</p>
+<p>Request-scoped access to capture the users’s <em>intention</em> to invoke an action or to edit a property.</p>
</div></div></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CommandContext</code><br>
<code>o.a.i.core</code><br>
<code>isis-core-applib</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">API is also a concrete class.<br>
depends on:<br>
-<a href="#_rgsvc_spi_CommandService"><code>CommandService</code></a> for persistent <code>Command</code>, else in-memory impl. used</p></td>
+<a href="#_rgsvc_spi_CommandService"><code>CommandService</code></a> for persistent <code>Command</code>, else in-memory impl. used.
+</p><p class="tableblock">The <a href="#_rgsvc_api_InteractionContext"><code>InteractionContext</code></a> manages the actual execution of the command.</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rgsvc_api_InteractionContext"><code>o.a.i.applib.</code><br>
+<code>services.iactn</code><br>
+<code>InteractionContext</code></a></p></td>
+<td class="tableblock halign-left valign-top"><div><div class="paragraph">
+<p>(<code>1.13.0-SNAPSHOT</code>) Request-scoped access to the current member execution (action invocation or property edit),
+represented as the <code>Interaction</code> context.</p>
+</div></div></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><code>InteractionContext</code><br>
+<code>o.a.i.core</code><br>
+<code>isis-core-applib</code></p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">API is also a concrete class.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rgsvc_api_MessageService"><code>o.a.i.applib.</code><br>
@@ -3167,7 +3311,7 @@ compatibility of existing clients. The <code>AcceptHeaderService</code> allows
</div>
</div>
<div class="paragraph">
-<p>The REST request is submitted to a domain service with a <a href="rgant.html#_rgant_DomainService_nature">nature</a> of <code>VIEW_REST_ONLY</code> (<code>MyRestApi</code> in the diagram). This uses the <code>AcceptHeaderService</code> to obtain the values of the
+<p>The REST request is submitted to a domain service with a <a href="rgant.html#_rgant-DomainService_nature">nature</a> of <code>VIEW_REST_ONLY</code> (<code>MyRestApi</code> in the diagram). This uses the <code>AcceptHeaderService</code> to obtain the values of the
HTTP <code>Accept</code> header. Based on this it delegates to the appropriate underlying domain service (with a nature of
<code>DOMAIN</code> so that they are not exposed in the REST API at all).</p>
</div>
@@ -3336,33 +3480,58 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_BackgroundService">5.3. <code>BackgroundService</code></h3>
+<h3 id="_rgsvc_api_BackgroundService">5.3. <code>BackgroundService2</code></h3>
+<div class="paragraph">
+<p>The <code>BackgroundService2</code> domain service, and also the companion
+<a href="#_rgsvc_spi_BackgroundCommandService"><code>BackgroundCommandService2</code></a> SPI service, enable commands
+to be persisted such that they may be invoked in the background. (The <code>BackgroundService2</code> and
+<code>BackgroundCommandService2</code> extensions to these services introduced in <code>1.13.0-SNAPSHOT</code>).</p>
+</div>
<div class="paragraph">
-<p>The <code>BackgroundService</code>, and the companion <a href="#_rgsvc_spi_BackgroundCommandService"><code>BackgroundCommandService</code></a> SPI service (used by Apache Isis itself), enable action invocations to be persisted such that they may be invoked in the background.</p>
+<p>The <code>BackgroundService2</code> is responsible for capturing a memento representing the command in a typesafe way,
+and persisting it rather than executing it directly.</p>
</div>
<div class="paragraph">
-<p>The <code>BackgroundService</code> is responsible for capturing a memento representing the action invocation in a typesafe way, and persisting it rather than executing it directly.</p>
+<p>The default <code>BackgroundServiceDefault</code> implementation works by using a proxy wrapper around the target so that it can
+capture the action to invoke and its arguments. (As of <code>1.13.0-SNAPSHOT</code>), this is done using <a href="#_rgsvc_spi_CommandDtoServiceInternal"><code>CommandDtoServiceInternal</code></a> (in previous releases it used (a private copy of) <a href="#_rgsvc_api_MementoService"><code>MementoService</code></a>).</p>
</div>
<div class="paragraph">
-<p>The default <code>BackgroundServiceDefault</code> implementation (provided by isis-core) works by using a proxy wrapper around the target so that it can capture the action to invoke and its arguments using (a private copy of) <a href="#_rgsvc_api_MementoService"><code>MementoService</code></a>. The persistence delegates the persistence of the memento to an appropriate implementation of the companion <code>BackgroundCommandService</code>. One such implementation of <code>BackgroundCommandService</code> is provided by (non-ASF) <a href="http://github.com/isisaddons/isis-module-command">Isis addons' command</a> module.</p>
+<p>The persistence delegates the persistence of the memento to an appropriate implementation of the companion
+<code>BackgroundCommandService2</code>. One such implementation of <code>BackgroundCommandService</code> is provided by (non-ASF)
+<a href="http://github.com/isisaddons/isis-module-command">Isis addons' command</a> module.</p>
</div>
<div class="paragraph">
-<p>The persisting of commands is only half the story; there needs to be a separate process to read the commands and execute them. The <code>BackgroundCommandExecution</code> abstract class (discussed <a href="#_rgsvc_api_BackgroundService_BackgroundCommandExecution">below</a>) provides infrastructure to do this; the concrete
-implementation of this class depends on the configured <code>BackgroundCommandService</code> (in order to query for the persisted (background) <code>Command</code>s.</p>
+<p>The persisting of commands is only half the story; there needs to be a separate process to read the commands and
+execute them. The <code>BackgroundCommandExecution</code> abstract class (discussed
+<a href="#_rgsvc_api_BackgroundService_BackgroundCommandExecution">below</a>) provides infrastructure to do this;
+the concrete implementation of this class depends on the configured <code>BackgroundCommandService</code> (in order to query for
+the persisted (background) <code>Command</code>s.</p>
</div>
<div class="sect3">
<h4 id="_api_implementation_3">5.3.1. API & Implementation</h4>
<div class="paragraph">
-<p>Returns a proxy around the object which is then used to obtain the signature of the action to be invoked in the background.</p>
+<p>The API is:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">interface</span> <span class="class">BackgroundService</span> {
- <span class="annotation">@Programmatic</span>
- <T> T execute(<span class="directive">final</span> T object);
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">interface</span> <span class="class">BackgroundService2</span> {
+ <T> T execute(<span class="directive">final</span> T object); <i class="conum" data-value="1"></i><b>(1)</b>
+ <T> T executeMixin(<span class="predefined-type">Class</span><T> mixinClass, <span class="predefined-type">Object</span> mixedIn); <i class="conum" data-value="2"></i><b>(2)</b>
}</code></pre>
</div>
</div>
+<div class="colist arabic">
+<table>
+<tr>
+<td><i class="conum" data-value="1"></i><b>1</b></td>
+<td>returns a proxy around the domain object; any methods executed against this proxy will result in a command (to invoke the corresponding action) being persisted by <a href="#_rgsvc_spi_BackgroundCommandService2"><code>BackgroundCommandService2</code></a></td>
+</tr>
+<tr>
+<td><i class="conum" data-value="2"></i><b>2</b></td>
+<td>(<code>1.13.0-SNAPSHOT</code>) returns a proxy around the mixin; any methods executed against this proxy will result in a command (to invoke the corresponding mixin action) being persisted by <a href="#_rgsvc_spi_BackgroundCommandService2"><code>BackgroundCommandService2</code></a>.</td>
+</tr>
+</table>
+</div>
<div class="paragraph">
<p>The default implementation is provided by core (<code>o.a.i.core.runtime.services.background.BackgroundServiceDefault</code>).</p>
</div>
@@ -3381,7 +3550,7 @@ implementation of this class depends on the configured <code>BackgroundCommandSe
<span class="keyword">for</span>(Customer customer: customerRepository.findCustomersToInvoice()) {
backgroundService.execute(customer).submitInvoice();
}
- container.informUser(<span class="string"><span class="delimiter">"</span><span class="content">Calculating...</span><span class="delimiter">"</span></span>);
+ messageService.informUser(<span class="string"><span class="delimiter">"</span><span class="content">Calculating...</span><span class="delimiter">"</span></span>);
}</code></pre>
</div>
</div>
@@ -3475,6 +3644,10 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
<div class="paragraph">
<p>The implementations of <code>CommandService</code> and <code>BackgroundCommandService</code> go together; typically both parent <code>Command`s and child background `Command`s will be persisted in the same way. The (non-ASF) <a href="http://github.com/isisaddons/isis-module-command">Isis addons' command</a> module provides implementations of both (see <a href="#_rgsvc_spi_CommandService">`CommandService</code></a> and <a href="#_rgsvc_spi_BackgroundCommandService"><code>BackgroundCommandService</code></a>).</p>
</div>
+<div class="paragraph">
+<p>The <a href="#_rgsvc_spi_CommandDtoServiceInternal"><code>CommandDtoServiceInternal</code></a> (<code>1.13.0-SNAPSHOT</code>) is used to obtain
+a memento of the command such that it can be persisted. (In earlier versions, <a href="#_rgsvc_api_MementoService"><code>MementoService</code></a> was used for this purpose).</p>
+</div>
</div>
<div class="sect3">
<h4 id="_rgsvc_api_BackgroundService_BackgroundCommandExecution">5.3.6. <code>BackgroundCommandExecution</code> abstract class</h4>
@@ -3754,6 +3927,9 @@ org.quartz.plugin.jobInitializer.failOnFileNotFound = true</code></pre>
<span class="directive">public</span> Bookmark getResult(); <i class="conum" data-value="16"></i><b>(16)</b>
<span class="directive">public</span> <span class="predefined-type">String</span> getException(); <i class="conum" data-value="17"></i><b>(17)</b>
+
+ <span class="annotation">@Deprecated</span>
+ <span class="type">int</span> next(<span class="directive">final</span> <span class="predefined-type">String</span> sequenceAbbr); <i class="conum" data-value="18"></i><b>(18)</b>
}</code></pre>
</div>
</div>
@@ -3827,6 +4003,11 @@ org.quartz.plugin.jobInitializer.failOnFileNotFound = true</code></pre>
<td><i class="conum" data-value="17"></i><b>17</b></td>
<td><code>getException()</code> - exception stack trace if action threw exception</td>
</tr>
+<tr>
+<td><i class="conum" data-value="18"></i><b>18</b></td>
+<td>(as of <code>1.13.0-SNAPSHOT</code>) no longer used by the framework; see instead
+<a href="#_rgsvc_api_InteractionContext"><code>InteractionContext</code></a> and <code>Interaction#next()</code>.</td>
+</tr>
</table>
</div>
</div>
@@ -3960,7 +4141,22 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_MessageService">5.5. <code>MessageService</code></h3>
+<h3 id="_rgsvc_api_InteractionContext">5.5. <code>InteractionContext</code> (<code>1.13.0-SNAPSHOT</code>)</h3>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+TODO
+</td>
+</tr>
+</table>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_rgsvc_api_MessageService">5.6. <code>MessageService</code></h3>
<div class="paragraph">
<p>The <code>MessageService</code> allows domain objects to raise information, warning or error messages. These messages can either be simple strings, or can be translated.</p>
</div>
@@ -3979,7 +4175,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</table>
</div>
<div class="sect3">
-<h4 id="_api_and_usage">5.5.1. API and Usage</h4>
+<h4 id="_api_and_usage">5.6.1. API and Usage</h4>
<div class="paragraph">
<p>The API of <code>MessageService</code> is:</p>
</div>
@@ -4043,13 +4239,13 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect3">
-<h4 id="_implementation_16">5.5.2. Implementation</h4>
+<h4 id="_implementation_16">5.6.2. Implementation</h4>
<div class="paragraph">
<p>The core framework provides a default implementation of this service (<code>o.a.i.core.runtime.services.message.MessageServiceDefault</code>).</p>
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_service_6">5.5.3. Registering the Service</h4>
+<h4 id="_registering_the_service_6">5.6.3. Registering the Service</h4>
<div class="paragraph">
<p>Assuming that the <code>configuration-and-annotation</code> services installer is configured (implicit if using the
<code>AppManifest</code> to <a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">bootstrap the app</a>) then Apache Isis' core
@@ -4064,14 +4260,14 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_SessionManagementService">5.6. <code>SessionManagementService</code></h3>
+<h3 id="_rgsvc_api_SessionManagementService">5.7. <code>SessionManagementService</code></h3>
<div class="paragraph">
<p>The <code>SessionManagementService</code> provides the ability to programmatically manage sessions. The primary use case is
for fixture scripts or other routines that are invoked from the UI and which create or modify large amounts of data.
A classic example is migrating data from one system to another.</p>
</div>
<div class="sect3">
-<h4 id="_api">5.6.1. API</h4>
+<h4 id="_api">5.7.1. API</h4>
<div class="paragraph">
<p>The API of <code>SessionManagementService</code> is:</p>
</div>
@@ -4107,13 +4303,13 @@ session and start a new transaction.</p>
</div>
</div>
<div class="sect3">
-<h4 id="_implementation_17">5.6.2. Implementation</h4>
+<h4 id="_implementation_17">5.7.2. Implementation</h4>
<div class="paragraph">
<p>The core framework provides a default implementation of this service (<code>o.a.i.core.runtime.services.xactn.SessionManagementServiceDefault</code>).</p>
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_service_7">5.6.3. Registering the Service</h4>
+<h4 id="_registering_the_service_7">5.7.3. Registering the Service</h4>
<div class="paragraph">
<p>Assuming that the <code>configuration-and-annotation</code> services installer is configured (implicit if using the
<code>AppManifest</code> to <a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">bootstrap the app</a>) then Apache Isis' core
@@ -4128,7 +4324,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_TitleService">5.7. <code>TitleService</code></h3>
+<h3 id="_rgsvc_api_TitleService">5.8. <code>TitleService</code></h3>
<div class="paragraph">
<p>The <code>TitleService</code> provides methods to programmatically obtain the title and icon of a domain object.</p>
</div>
@@ -4147,7 +4343,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</table>
</div>
<div class="sect3">
-<h4 id="_api_2">5.7.1. API</h4>
+<h4 id="_api_2">5.8.1. API</h4>
<div class="paragraph">
<p>The API of <code>TitleService</code> is:</p>
</div>
@@ -4173,7 +4369,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect3">
-<h4 id="_usage_6">5.7.2. Usage</h4>
+<h4 id="_usage_6">5.8.2. Usage</h4>
<div class="paragraph">
<p>By way of example, here’s some code based on a system for managing government benefits:</p>
</div>
@@ -4198,13 +4394,13 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect3">
-<h4 id="_implementation_18">5.7.3. Implementation</h4>
+<h4 id="_implementation_18">5.8.3. Implementation</h4>
<div class="paragraph">
<p>The core framework provides a default implementation of this service (<code>o.a.i.core.metamodel.services.title.TitleServiceDefault</code>).</p>
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_service_8">5.7.4. Registering the Service</h4>
+<h4 id="_registering_the_service_8">5.8.4. Registering the Service</h4>
<div class="paragraph">
<p>Assuming that the <code>configuration-and-annotation</code> services installer is configured (implicit if using the
<code>AppManifest</code> to <a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">bootstrap the app</a>) then Apache Isis' core
@@ -4219,7 +4415,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_TransactionService">5.8. <code>TransactionService</code></h3>
+<h3 id="_rgsvc_api_TransactionService">5.9. <code>TransactionService</code></h3>
<div class="paragraph">
<p>The <code>TransactionService</code> provides a small number of methods to allow domain objects to influence user transactions.</p>
</div>
@@ -4238,7 +4434,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</table>
</div>
<div class="sect3">
-<h4 id="_api_3">5.8.1. API</h4>
+<h4 id="_api_3">5.9.1. API</h4>
<div class="paragraph">
<p>The API of <code>TransactionService</code> is:</p>
</div>
@@ -4277,13 +4473,13 @@ end of the transaction, or immediately prior to the next query.</p>
</div>
</div>
<div class="sect3">
-<h4 id="_implementation_19">5.8.2. Implementation</h4>
+<h4 id="_implementation_19">5.9.2. Implementation</h4>
<div class="paragraph">
<p>The core framework provides a default implementation of this service (<code>o.a.i.core.metamodel.services.xactn.TransactionServiceDefault</code>).</p>
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_service_9">5.8.3. Registering the Service</h4>
+<h4 id="_registering_the_service_9">5.9.3. Registering the Service</h4>
<div class="paragraph">
<p>Assuming that the <code>configuration-and-annotation</code> services installer is configured (implicit if using the
<code>AppManifest</code> to <a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">bootstrap the app</a>) then Apache Isis' core
@@ -4298,7 +4494,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_WrapperFactory">5.9. <code>WrapperFactory</code></h3>
+<h3 id="_rgsvc_api_WrapperFactory">5.10. <code>WrapperFactory</code></h3>
<div class="paragraph">
<p>The <code>WrapperFactory</code> provides the ability to enforce business rules for programmatic interactions between domain objects. If there is a (lack-of-) trust boundary between the caller and callee — eg if they reside in different modules — then the wrapper factory is a useful mechanism to ensure that any business constraints defined by te callee are honoured.</p>
</div>
@@ -4326,7 +4522,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
<p>This capability is frequently used within <a href="ugtst.html#_ugtst_integ-test-support">integration tests</a>, but can also be used in production code. (There are analogies that can be drawn here with the way that JEE beans can interact through an EJB local interface).</p>
</div>
<div class="sect3">
-<h4 id="_api_4">5.9.1. API</h4>
+<h4 id="_api_4">5.10.1. API</h4>
<div class="paragraph">
<p>The API provided by the service is:</p>
</div>
@@ -4435,7 +4631,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect3">
-<h4 id="_usage_7">5.9.2. Usage</h4>
+<h4 id="_usage_7">5.10.2. Usage</h4>
<div class="paragraph">
<p>The caller will typically obtain the target object (eg from some repository) and then use the injected <code>WrapperFactory</code> to wrap it before interacting with it.</p>
</div>
@@ -4494,7 +4690,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect3">
-<h4 id="_listener_api">5.9.3. Listener API</h4>
+<h4 id="_listener_api">5.10.3. Listener API</h4>
<div class="paragraph">
<p>The <code>WrapperFactory</code> also provides a listener API to allow other services to listen in on interactions.</p>
</div>
@@ -4538,7 +4734,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_service_10">5.9.4. Registering the Service</h4>
+<h4 id="_registering_the_service_10">5.10.4. Registering the Service</h4>
<div class="paragraph">
<p>Assuming that the <code>configuration-and-annotation</code> services installer is configured (implicit if using the
<code>AppManifest</code> to <a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">bootstrap the app</a>) then Apache Isis' core
@@ -4806,15 +5002,22 @@ then this can be activated by updating the <code>pom.xml</code> and updating the
<div class="sect2">
<h3 id="_rgsvc_spi_CommandService">6.2. <code>CommandService</code></h3>
<div class="paragraph">
-<p>The <code>CommandService</code> service supports the <a href="#_rgsvc_api_CommandContext"><code>CommandContext</code></a> service such that <code>Command</code> objects (that reify the invocation of an action on a domain object into an object) can be persisted.</p>
+<p>The <code>CommandService</code> service supports the <a href="#_rgsvc_api_CommandContext"><code>CommandContext</code></a> service such
+that <code>Command</code> objects (that reify the invocation of an action/edit of a property on a domain object) can be persisted.</p>
</div>
<div class="paragraph">
-<p>Persistent `Command`s support several use cases:</p>
+<p>Persistent <code>Command</code>s support several use cases:</p>
</div>
<div class="ulist">
<ul>
<li>
-<p>they enable profiling of the running application (which actions are invoked then most often, what is their response time)</p>
+<p>they enable profiling of the running application (which actions are invoked then most often, what is their response
+time) ++</p>
+<div class="paragraph">
+<p>However, note that (as of <code>1.13.0-SNAPSHOT</code>) much more powerful profiling capabilities are provided by
+<a href="#_rgsvc_api_InteractionContext"><code>InteractionContext</code></a>; these can be logged using the
+<a href="#_rgsvc_spi_PublisherService"><code>PublisherService</code></a>.</p>
+</div>
</li>
<li>
<p>they act as a parent to any background commands that might be invoked through the <a href="#_rgsvc_api_BackgroundService"><code>BackgroundService</code></a></p>
@@ -4830,8 +5033,10 @@ then this can be activated by updating the <code>pom.xml</code> and updating the
</li>
</ul>
</div>
+<div class="sect3">
+<h4 id="_screencast">6.2.1. Screencast</h4>
<div class="paragraph">
-<p>This <a href="https://www.youtube.com/watch?v=tqXUZkPB3EI">screencast</a> below provides a run-through of the command (profiling) service, auditing service, publishing service. It also shows how commands can be run in the background either explicitly by scheduling through the background service or implicitly by way of a framework annotation.</p>
+<p>The <a href="https://www.youtube.com/watch?v=tqXUZkPB3EI">screencast</a> below provides a run-through of the command (profiling) service, auditing service, publishing service. It also shows how commands can be run in the background either explicitly by scheduling through the background service or implicitly by way of a framework annotation.</p>
</div>
<div class="admonitionblock note">
<table>
@@ -4847,31 +5052,51 @@ then this can be activated by updating the <code>pom.xml</code> and updating the
</tr>
</table>
</div>
+</div>
<div class="sect3">
-<h4 id="_spi_18">6.2.1. SPI</h4>
+<h4 id="_spi_18">6.2.2. SPI</h4>
<div class="paragraph">
<p>The <code>CommandService</code> service defines the following very simple API:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">interface</span> <span class="class">CommandService</span> {
- <span class="annotation">@Programmatic</span>
- Command create();
- <span class="annotation">@Programmatic</span>
- <span class="type">void</span> startTransaction(Command command, <span class="directive">final</span> <span class="predefined-type">UUID</span> transactionId);
- <span class="annotation">@Programmatic</span>
- <span class="type">void</span> complete(Command command);
- <span class="annotation">@Programmatic</span>
- <span class="type">boolean</span> persistIfPossible(Command command);
+ Command create(); <i class="conum" data-value="1"></i><b>(1)</b>
+ <span class="annotation">@Deprecated</span>
+ <span class="type">void</span> startTransaction(Command command, <span class="predefined-type">UUID</span> transactionId); <i class="conum" data-value="2"></i><b>(2)</b>
+ <span class="type">boolean</span> persistIfPossible(Command command); <i class="conum" data-value="3"></i><b>(3)</b>
+ <span class="type">void</span> complete(Command command); <i class="conum" data-value="4"></i><b>(4)</b>
}</code></pre>
</div>
</div>
-<div class="paragraph">
-<p>where <code>Command</code> is defined as defined by the <a href="#_rgsvc_api_CommandContext"><code>CommandContext</code></a> service.</p>
+<div class="colist arabic">
+<table>
+<tr>
+<td><i class="conum" data-value="1"></i><b>1</b></td>
+<td>Instantiate the appropriate instance of the <code>Command</code> (as defined by the
+<a href="#_rgsvc_api_CommandContext"><code>CommandContext</code></a> service). Its members will be populated automatically by
+the framework.</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="2"></i><b>2</b></td>
+<td>(as of <code>1.13.0-SNAPSHOT</code>) is deprecated: the framework automatically populates the <code>Command</code>'s <code>timestamp</code>,
+<code>user</code> and <code>transactionId</code> fields, so there is no need for the service implementation to initialize any of these. In
+particular, the <code>Command</code> will already have been initialized with the provided <code>transactionId</code> argument.</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="3"></i><b>3</b></td>
+<td>Set the hint that the <code>Command</code> should be persisted if possible (when completed, see below).</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="4"></i><b>4</b></td>
+<td>"Complete" the command, typically meaning that the command should be persisted it if its <code>Command#getPersistence()</code>
+flag and persistence hint (<code>Command#isPersistHint()</code>) indicate that it should be. <br></td>
+</tr>
+</table>
</div>
</div>
<div class="sect3">
-<h4 id="_implementation_21">6.2.2. Implementation</h4>
+<h4 id="_implementation_21">6.2.3. Implementation</h4>
<div class="paragraph">
<p>The (non-ASF) <a href="http://github.com/isisaddons/isis-module-command">Isis addons' command</a> module provides an implementation (<code>org.isisaddons.module.command.dom.CommandServiceJdo</code>) that persists <code>Command</code>s using the JDO/DataNucleus object store. It further provides a number of supporting services:</p>
</div>
@@ -4887,13 +5112,13 @@ then this can be activated by updating the <code>pom.xml</code> and updating the
</div>
</div>
<div class="sect3">
-<h4 id="_usage_9">6.2.3. Usage</h4>
+<h4 id="_usage_9">6.2.4. Usage</h4>
<div class="paragraph">
<p>The typical way to indicate that an action should be reified into a <code>Command</code> is by annotating the action using <a href="rgant.html#_rgant-Action_command"><code>@Action#command()</code></a>.</p>
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_services_14">6.2.4. Registering the Services</h4>
+<h4 id="_registering_the_services_14">6.2.5. Registering the Services</h4>
<div class="paragraph">
<p>The (non-ASF) <a href="http://github.com/isisaddons/isis-module-command">Isis addons' command</a> module provides an implementation
of this service (<code>CommandService</code>), and also provides a number of related domain services
@@ -4911,7 +5136,7 @@ then this can be activated by updating the <code>pom.xml</code> and updating the
</div>
</div>
<div class="sect3">
-<h4 id="_related_services_16">6.2.5. Related Services</h4>
+<h4 id="_related_services_16">6.2.6. Related Services</h4>
<div class="paragraph">
<p>As discussed above, this service supports the <a href="#_rgsvc_api_CommandContext"><code>CommandContext</code></a>, providing the ability for <code>Command</code> objects to be
persisted. This is closely related to the <a href="#_rgsvc_spi_BackgroundCommandService"><code>BackgroundCommandService</code></a>that allows the <a href="#_rgsvc_api_BackgroundService"><code>BackgroundService</code></a> to schedule commands for background/asynchronous execution.</p>
@@ -4934,7 +5159,7 @@ persisted. This is closely related to the <a href="#_rgsvc_spi_BackgroundCommand
<h3 id="_rgsvc_api_HomePageProviderService">6.3. <code>HomePageProviderService</code></h3>
<div class="paragraph">
<p>This service simply provides access to the home page object (if any) that is returned from the domain service
-action annotated with <a href="rgant.html#_rgant_HomePage"><code>@HomePage</code></a>.</p>
+action annotated with <a href="rgant.html#_rgant-HomePage"><code>@HomePage</code></a>.</p>
</div>
<div class="paragraph">
<p>It is originally introduced to support the default implementation of
@@ -4972,7 +5197,165 @@ configuration is required.</p>
</div>
</div>
<div class="sect1">
-<h2 id="_rgsvc_core-domain-api">7. Core/Domain API</h2>
+<h2 id="_rgsvc_application-layer-internal-spi">7. Application Layer internal SPI</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>These domain services are internal to the framework, controlling various aspects of the application layer.</p>
+</div>
+<div class="admonitionblock warning">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-warning" title="Warning"></i>
+</td>
+<td class="content">
+<div class="paragraph">
+<p>We do not guarantee that <a href="http://semver.org">semantic versioning</a> will be honoured for these SPIs.</p>
+</div>
+</td>
+</tr>
+</table>
+</div>
+<div class="paragraph">
+<p>The table below summarizes the application layer internal SPIs defined by Apache Isis. It also lists their
+corresponding implementation, either a default implementation provided by Apache Isis itself, or provided by one of the
+(non-ASF) <a href="http://www.isisaddons.org">Isis Addons</a> modules.</p>
+</div>
+<table class="tableblock frame-all grid-all spread">
+<caption class="title">Table 5. "Internal" SPI Services</caption>
+<colgroup>
+<col style="width: 30%;">
+<col style="width: 30%;">
+<col style="width: 20%;">
+<col style="width: 20%;">
+</colgroup>
+<thead>
+<tr>
+<th class="tableblock halign-left valign-top">SPI</th>
+<th class="tableblock halign-left valign-top">Maven Module<br>
+Impl’n (g: a:)</th>
+<th class="tableblock halign-left valign-top">Implementation</th>
+<th class="tableblock halign-left valign-top">Notes</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_rgsvc_api_CommandDtoServiceInternal"><code>o.a.i.c.</code><br>
+<code>m.s.command</code><br>
+<code>CommandDtoServiceInternal</code></a></p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">(<code>1.13.0-SNAPSHOT</code>) Creates memento of current action invocation, for use either as a reified command or for implementations of the <a href="#_rgsvc_spi_PublishingService"><code>PublishingService</code></a>.</p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CommandDtoService-</code><br>
+<code>InternalServiceDefault</code><br>
+<code>o.a.i.c.r.s.command</code><br>
+<code>isis-core-runtime</code></p></td>
+<td class="tableblock halign-left valign-top"><div></div></td>
+</tr>
+</tbody>
+</table>
+<div class="paragraph">
+<p>Key:</p>
+</div>
+<div class="ulist">
+<ul>
+<li>
+<p><code>o.a.i.c.m.s</code> is an abbreviation for <code>org.apache.isis.core.metamodel.services</code></p>
+</li>
+<li>
+<p><code>o.a.i.c.r.s</code> is an abbreviation for <code>org.apache.isis.core.runtime.services</code></p>
+</li>
+</ul>
+</div>
+<div class="sect2">
+<h3 id="_rgsvc_spi_CommandDtoServiceInternal">7.1. <code>CommandDtoServiceInternal</code> (<code>1.13.0-SNAPSHOT</code>)</h3>
+<div class="paragraph">
+<p>The <code>CommandDtoServiceInternal</code> (<code>1.13.0-SNAPSHOT</code>) is responsible for creating an memento of the current action
+invocation or property edit, to store in the <code>Command</code> object (from
+<a href="#_rgsvc_api_CommandContext"><code>CommandContext</code></a>). This memento is a JAXB DTO being an instance of the
+<a href="rgcms.html#_rgcms_schema-cmd">"cmd" schema</a>, so can be reified so that its execution can be deferred until later,
+as a <a href="#_rgsvc_spi_BackgroundCommandService">background command</a>.</p>
+</div>
+<div class="sect3">
+<h4 id="_spi_implementation">7.1.1. SPI & Implementation</h4>
+<div class="paragraph">
+<p>The SPI of the service is:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">interface</span> <span class="class">CommandMementoService</span> {
+ <span class="annotation">@Deprecated</span>
+ ActionInvocationMemento asActionInvocationMemento( <i class="conum" data-value="1"></i><b>(1)</b>
+ <span class="predefined-type">Method</span> m,
+ <span class="predefined-type">Object</span> domainObject, <span class="predefined-type">Object</span><span class="type">[]</span> args);
+ CommandDto asCommandDto( <i class="conum" data-value="2"></i><b>(2)</b>
+ <span class="predefined-type">List</span><ObjectAdapter> targetAdapters,
+ ObjectAction objectAction,
+ ObjectAdapter<span class="type">[]</span> argAdapters);
+ CommandDto asCommandDto( <i class="conum" data-value="3"></i><b>(3)</b>
+ <span class="directive">final</span> <span class="predefined-type">List</span><ObjectAdapter> targetAdapters,
+ <span class="directive">final</span> OneToOneAssociation association,
+ <span class="directive">final</span> ObjectAdapter valueAdapterOrNull);
+ <span class="type">void</span> addActionArgs( <i class="conum" data-value="4"></i><b>(4)</b>
+ <span class="directive">final</span> ObjectAction objectAction,
+ <span class="directive">final</span> ActionDto actionDto,
+ <span class="directive">final</span> ObjectAdapter<span class="type">[]</span> argAdapters);
+ <span class="type">void</span> addPropertyValue( <i class="conum" data-value="5"></i><b>(5)</b>
+ <span class="directive">final</span> OneToOneAssociation property,
+ <span class="directive">final</span> PropertyDto propertyDto,
+ <span class="directive">final</span> ObjectAdapter valueAdapter);
+}</code></pre>
+</div>
+</div>
+<div class="colist arabic">
+<table>
+<tr>
+<td><i class="conum" data-value="1"></i><b>1</b></td>
+<td>Note that this method (more precisely, <code>ActionInvocationMemento</code>) does <em>not</em> support mixins.</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="2"></i><b>2</b></td>
+<td>Returns a JAXB DTO being an instance of the <a href="rgcms.html#_rgcms_schema-cmd">"cmd" schema</a> (hence convertible to
+XML) that represents the <em>intention</em> to invoke an action on a target object (or possibly many targets, for
+bulk actions). If an action, it can also be either mixin action or a contributed action.</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="3"></i><b>3</b></td>
+<td>Returns a JAXB DTO that represents the intention to edit (set or clear) a property on a target (or possibly many
+targets, for symmetry with actions).</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="4"></i><b>4</b></td>
+<td>add the arguments of an action to an <code>ActionDto</code>.</td>
+</tr>
+<tr>
+<td><i class="conum" data-value="5"></i><b>5</b></td>
+<td>add the new value argument of a property to a <code>PropertyDto</code>.</td>
+</tr>
+</table>
+</div>
+<div class="paragraph">
+<p>The SPI is implemented by <code>o.a.i.c.r.s.command.CommandDtoServiceInternalServiceDefault</code>.</p>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_rgsvc_spi_InteractionDtoServiceInternal">7.2. <code>InteractionDtoServiceInternal</code> (<code>1.13.0-SNAPSHOT</code>)</h3>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+TODO
+</td>
+</tr>
+</table>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_rgsvc_core-domain-api">8. Core/Domain API</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The core/domain APIs provide general-purpose services to the domain objects, for example obtaining the current time or user, or instantiating domain objects.</p>
@@ -4981,7 +5364,7 @@ configuration is required.</p>
<p>The table below summarizes the core/domain APIs defined by Apache Isis. It also lists their corresponding implementation, either a default implementation provided by Apache Isis itself, or provided by one of the in (non-ASF) <a href="http://www.isisaddons.org">Isis Addons</a> modules.</p>
</div>
<table class="tableblock frame-all grid-all spread">
-<caption class="title">Table 5. Core/Domain Layer API</caption>
+<caption class="title">Table 6. Core/Domain Layer API</caption>
<colgroup>
<col style="width: 25%;">
<col style="width: 50%;">
@@ -5058,7 +5441,7 @@ Supercedes methods in <a href="#_rgsvc_api_DomainObjectContainer"><code>DomainOb
</div></div></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>EventBusServiceJdo</code><br>
<code>o.a.i.core</code><br>
-<code>isis-core-objectstore-jdo-datanucleus</code></p></td>
+<code>isis-core-runtime</code></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
@@ -5118,7 +5501,7 @@ Supercedes methods in <a href="#_rgsvc_api_DomainObjectContainer"><code>DomainOb
<p>There is also a number of deprecated domain services.</p>
</div>
<table class="tableblock frame-all grid-all spread">
-<caption class="title">Table 6. Deprecated Domain Services</caption>
+<caption class="title">Table 7. Deprecated Domain Services</caption>
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
@@ -5163,7 +5546,7 @@ Supercedes methods in <a href="#_rgsvc_api_DomainObjectContainer"><code>DomainOb
</ul>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_ClockService">7.1. <code>ClockService</code></h3>
+<h3 id="_rgsvc_api_ClockService">8.1. <code>ClockService</code></h3>
<div class="paragraph">
<p>Most applications deal with dates and times in one way or another. For example, if an <code>Order</code> is placed, then the <code>Customer</code> may have 30 days to pay the <code>Invoice</code>, otherwise a penalty may be levied.</p>
</div>
@@ -5177,7 +5560,7 @@ Supercedes methods in <a href="#_rgsvc_api_DomainObjectContainer"><code>DomainOb
<p>Therefore it’s common to provide a domain service whose responsibility is to provide the current time. This service can be injected into any domain object (and can be mocked out for unit testing). Apache Isis provides such a facade through the <code>ClockService</code>.</p>
</div>
<div class="sect3">
-<h4 id="_api_implementation_6">7.1.1. API & Implementation</h4>
+<h4 id="_api_implementation_6">8.1.1. API & Implementation</h4>
<div class="paragraph">
<p>The API defined by <code>ClockService</code> is:</p>
</div>
@@ -5203,7 +5586,7 @@ Supercedes methods in <a href="#_rgsvc_api_DomainObjectContainer"><code>DomainOb
</div>
</div>
<div class="sect3">
-<h4 id="_testing_support">7.1.2. Testing Support</h4>
+<h4 id="_testing_support">8.1.2. Testing Support</h4>
<div class="paragraph">
<p>The default <code>ClockService</code> implementation in fact simply delegates to another class defined in the API, namely the <code>o.a.i.applib.clock.Clock</code>, an abstract singleton class. It is not recommended that your code use the <code>Clock</code> directly, but you should understand how this all works:</p>
</div>
@@ -5277,7 +5660,7 @@ Supercedes methods in <a href="#_rgsvc_api_DomainObjectContainer"><code>DomainOb
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_service_12">7.1.3. Registering the Service</h4>
+<h4 id="_registering_the_service_12">8.1.3. Registering the Service</h4>
<div class="paragraph">
<p>Assuming that the <code>configuration-and-annotation</code> services installer is configured (implicit if using the
<code>AppManifest</code> to <a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">bootstrap the app</a>) then Apache Isis' core
@@ -5291,7 +5674,7 @@ instead subclass from <code>o.a.i.applib.clock.Clock</code> singleton (as descri
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_ConfigurationService">7.2. <code>ConfigurationService</code></h3>
+<h3 id="_rgsvc_api_ConfigurationService">8.2. <code>ConfigurationService</code></h3>
<div class="paragraph">
<p>The <code>ConfigurationService</code> allows domain objects to read the configuration properties aggregated from the various <a href="rgcfg.html#_rgcfg_configuration-files">configuration files</a>.</p>
</div>
@@ -5310,7 +5693,7 @@ instead subclass from <code>o.a.i.applib.clock.Clock</code> singleton (as descri
</table>
</div>
<div class="sect3">
-<h4 id="_api_and_usage_2">7.2.1. API and Usage</h4>
+<h4 id="_api_and_usage_2">8.2.1. API and Usage</h4>
<div class="paragraph">
<p>The API of <code>ConfigurationService</code> is:</p>
</div>
@@ -5383,13 +5766,13 @@ instead subclass from <code>o.a.i.applib.clock.Clock</code> singleton (as descri
</div>
</div>
<div class="sect3">
-<h4 id="_implementation_22">7.2.2. Implementation</h4>
+<h4 id="_implementation_22">8.2.2. Implementation</h4>
<div class="paragraph">
<p>The core framework provides a default implementation of this service (<code>o.a.i.core.runtime.services.config.ConfigurationServiceDefault</code>).</p>
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_service_13">7.2.3. Registering the Service</h4>
+<h4 id="_registering_the_service_13">8.2.3. Registering the Service</h4>
<div class="paragraph">
<p>Assuming that the <code>configuration-and-annotation</code> services installer is configured (implicit if using the
<code>AppManifest</code> to <a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">bootstrap the app</a>) then Apache Isis' core
@@ -5403,14 +5786,14 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect3">
-<h4 id="_related_services_17">7.2.4. Related services</h4>
+<h4 id="_related_services_17">8.2.4. Related services</h4>
<div class="paragraph">
<p>The <code>ConfigurationServiceMenu</code> exposes the <code>allConfigurationProperties</code> action in the user interface.</p>
</div>
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_DomainObjectContainer">7.3. <code>DomainObjectContainer</code></h3>
+<h3 id="_rgsvc_api_DomainObjectContainer">8.3. <code>DomainObjectContainer</code></h3>
<div class="paragraph">
<p>The <code>DomainObjectContainer</code> service provides a set of general purpose functionality for domain objects to call. Principal amongst these are a generic APIs for querying objects and creating and persisting objects. In addition, the service provides access to security context (the "current user"), allows information and warning messages to be raised, and various other miscellaneous functions.</p>
</div>
@@ -5429,7 +5812,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</table>
</div>
<div class="sect3">
-<h4 id="_apis">7.3.1. APIs</h4>
+<h4 id="_apis">8.3.1. APIs</h4>
<div class="paragraph">
<p>The sections below discuss the functions provided by the service, broken out into categories.</p>
</div>
@@ -6044,13 +6427,13 @@ validation defined by <a href="rgcms.html#_rgcms_methods_reserved_validate"><cod
</div>
</div>
<div class="sect3">
-<h4 id="_implementation_23">7.3.2. Implementation</h4>
+<h4 id="_implementation_23">8.3.2. Implementation</h4>
<div class="paragraph">
<p>The core framework provides a default implementation of this service (<code>o.a.i.core.metamodel.services.container.DomainObjectContainerDefault</code>).</p>
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_service_14">7.3.3. Registering the Service</h4>
+<h4 id="_registering_the_service_14">8.3.3. Registering the Service</h4>
<div class="paragraph">
<p>Assuming that the <code>configuration-and-annotation</code> services installer is configured (implicit if using the
<code>AppManifest</code> to <a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">bootstrap the app</a>) then Apache Isis' core
@@ -6060,7 +6443,7 @@ implementation of <code>DomainObjectContainer</code> service is automatically re
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_EventBusService">7.4. <code>EventBusService</code></h3>
+<h3 id="_rgsvc_api_EventBusService">8.4. <code>EventBusService</code></h3>
<div class="paragraph">
<p>The <code>EventBusService</code> allows domain objects to emit events to subscribing domain services using an in-memory event bus.</p>
</div>
@@ -6096,7 +6479,7 @@ implementation of <code>DomainObjectContainer</code> service is automatically re
<p>Two implementations are available, using either <a href="https://code.google.com/p/guava-libraries/">Guava</a>'s <a href="https://code.google.com/p/guava-libraries/wiki/EventBusExplained"><code>EventBus</code></a>, or alternatively using the <a href="http://www.axonframework.org/">AxonFramework</a>'s <a href="http://www.axonframework.org/docs/2.4/single.html#d5e1489">SimpleEventBus</a>. It is also possible to plug in a custom implementation.</p>
</div>
<div class="sect3">
-<h4 id="_rgsvc_api_EventBusService_api-and-implementation">7.4.1. API & Implementation</h4>
+<h4 id="_rgsvc_api_EventBusService_api-and-implementation">8.4.1. API & Implementation</h4>
<div class="paragraph">
<p>The API defined by <code>EventBusService</code> is:</p>
</div>
@@ -6133,7 +6516,7 @@ implementation of <code>DomainObjectContainer</code> service is automatically re
</div>
</div>
<div class="sect3">
-<h4 id="_registering_subscribers">7.4.2. Registering Subscribers</h4>
+<h4 id="_registering_subscribers">8.4.2. Registering Subscribers</h4>
<div class="paragraph">
<p>The <code>register()</code> method should be called in the <a href="rgant.html#_rgant-PostConstruct"><code>@PostConstruct</code></a> lifecycle method. It is valid and probably the least confusing to readers to also "unregister" in the <a href="rgant.html#_rgant-PreDestroy"><code>@PreDestroy</code></a> lifecycle method (though as noted <a href="#_rgsvc_api_EventBusService_api-and-implementation">above</a>, unregistering is actually a no-op).</p>
</div>
@@ -6205,7 +6588,7 @@ registration. As a convenience, it is also annotated with the
</div>
</div>
<div class="sect3">
-<h4 id="_annotating_members">7.4.3. Annotating Members</h4>
+<h4 id="_annotating_members">8.4.3. Annotating Members</h4>
<div class="paragraph">
<p>As discussed in the introduction, the framework will automatically emit domain events for all of the object members (actions, properties or collections) of an object whenever that object is rendered or (more generally) interacted with.</p>
</div>
@@ -6296,7 +6679,7 @@ registration. As a convenience, it is also annotated with the
</div>
</div>
<div class="sect3">
-<h4 id="_rgsvc_api_EventBusService_event-hierarchy">7.4.4. Event hierarchy</h4>
+<h4 id="_rgsvc_api_EventBusService_event-hierarchy">8.4.4. Event hierarchy</h4>
<div class="paragraph">
<p>By creating domain event subtypes we can be more semantically precise and in turn providesmore flexibility for subscribers: they can choose whether to be broadly applicable (by subscribing to a superclass) or to be tightly focussed (by subscribing to a subclass).</p>
</div>
@@ -6417,7 +6800,7 @@ public <span class="directive">static</span> <span class="type">class</span> <sp
</div>
</div>
<div class="sect3">
-<h4 id="_programmatic_posting">7.4.5. Programmatic posting</h4>
+<h4 id="_programmatic_posting">8.4.5. Programmatic posting</h4>
<div class="paragraph">
<p>To programmatically post an event, simply call <code>#post()</code>.</p>
</div>
@@ -6449,7 +6832,7 @@ public <span class="directive">static</span> <span class="type">class</span> <sp
</div>
</div>
<div class="sect3">
-<h4 id="_using_code_wrapperfactory_code">7.4.6. Using <code>WrapperFactory</code></h4>
+<h4 id="_using_code_wrapperfactory_code">8.4.6. Using <code>WrapperFactory</code></h4>
<div class="paragraph">
<p>An alternative way to cause events to be posted is through the <a href="#_rgsvc_api_WrapperFactory"><code>WrapperFactory</code></a>. This is useful when you wish to enforce a (lack-of-) trust boundary between the caller and the callee.</p>
</div>
@@ -6479,7 +6862,7 @@ public <span class="directive">static</span> <span class="type">class</span> <sp
</div>
</div>
<div class="sect3">
-<h4 id="_implementation_spi">7.4.7. Implementation SPI</h4>
+<h4 id="_implementation_spi">8.4.7. Implementation SPI</h4>
<div class="paragraph">
<p>The implementation of <code>EventBusService</code> provided by Apache Isis will by default use <a href="https://code.google.com/p/guava-libraries/">Guava</a>'s <a href="https://code.google.com/p/guava-libraries/wiki/EventBusExplained"><code>EventBus</code></a> as the underlying in-memory event bus. Alternatively the <a href="http://www.axonframework.org/">AxonFramework</a>'s <a href="http://www.axonframework.org/docs/2.4/single.html#d5e1489">SimpleEventBus</a> can be used. Which is used is specified through configuration property (described <a href="#_rgsvc_api_EventBusService_Configuration">below</a>).</p>
</div>
@@ -6521,7 +6904,7 @@ public <span class="directive">static</span> <span class="type">class</span> <sp
</div>
</div>
<div class="sect3">
-<h4 id="_rgsvc_api_EventBusService_Configuration">7.4.8. Configuration</h4>
+<h4 id="_rgsvc_api_EventBusService_Configuration">8.4.8. Configuration</h4>
<div class="paragraph">
<p>The implementation of <code>EventBusService</code> provided by Apache Isis will by default use <a href="https://code.google.com/p/guava-libraries/">Guava</a>'s <a href="https://code.google.com/p/guava-libraries/wiki/EventBusExplained"><code>EventBus</code></a> as the underlying in-memory event bus. Alternatively the <a href="http://www.axonframework.org/">AxonFramework</a>'s <a href="http://www.axonframework.org/docs/2.4/single.html#d5e1489">SimpleEventBus</a> can be used.</p>
</div>
@@ -6562,7 +6945,7 @@ public <span class="directive">static</span> <span class="type">class</span> <sp
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_services_15">7.4.9. Registering the Services</h4>
+<h4 id="_registering_the_services_15">8.4.9. Registering the Services</h4>
<div class="paragraph">
<p>Assuming that the <code>configuration-and-annotation</code> services installer is configured (implicit if using the
<code>AppManifest</code> to <a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">bootstrap the app</a>) then Apache Isis' core
@@ -6576,7 +6959,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect3">
-<h4 id="_related_services_18">7.4.10. Related Services</h4>
+<h4 id="_related_services_18">8.4.10. Related Services</h4>
<div class="paragraph">
<p>The <code>EventBusService</code> is intended for fine-grained publish/subscribe for object-to-object interactions within an Apache Isis domain object model. The event propagation is strictly in-memory, and there are no restrictions on the object acting as the event (it need not be serializable, for example).</p>
</div>
@@ -6586,7 +6969,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_FactoryService">7.5. <code>FactoryService</code></h3>
+<h3 id="_rgsvc_api_FactoryService">8.5. <code>FactoryService</code></h3>
<div class="paragraph">
<p>The <code>FactoryService</code> collects together methods for instantiating domain objects.</p>
</div>
@@ -6605,7 +6988,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</table>
</div>
<div class="sect3">
-<h4 id="_api_5">7.5.1. API</h4>
+<h4 id="_api_5">8.5.1. API</h4>
<div class="paragraph">
<p>The API of <code>FactoryService</code> is:</p>
</div>
@@ -6647,7 +7030,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect3">
-<h4 id="_usage_10">7.5.2. Usage</h4>
+<h4 id="_usage_10">8.5.2. Usage</h4>
<div class="paragraph">
<p>For example:</p>
</div>
@@ -6661,13 +7044,13 @@ repositoryService.persist(cust);</code></pre>
</div>
</div>
<div class="sect3">
-<h4 id="_implementation_24">7.5.3. Implementation</h4>
+<h4 id="_implementation_24">8.5.3. Implementation</h4>
<div class="paragraph">
<p>The core framework provides a default implementation of this service (<code>o.a.i.core.metamodel.services.factory.FactoryServiceDefault</code>).</p>
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_service_15">7.5.4. Registering the Service</h4>
+<h4 id="_registering_the_service_15">8.5.4. Registering the Service</h4>
<div class="paragraph">
<p>Assuming that the <code>configuration-and-annotation</code> services installer is configured (implicit if using the
<code>AppManifest</code> to <a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">bootstrap the app</a>) then Apache Isis' core
@@ -6681,7 +7064,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect3">
-<h4 id="_related_services_19">7.5.5. Related Services</h4>
+<h4 id="_related_services_19">8.5.5. Related Services</h4>
<div class="paragraph">
<p>The <a href="#_rgsvc_api_RepositoryService"><code>RepositoryService</code></a> is often used in conjunction with the <code>FactoryService</code>, to persist domain objects after they have been instantiated and populated.</p>
</div>
@@ -6693,12 +7076,12 @@ instantiated object.</p>
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_Scratchpad">7.6. <code>Scratchpad</code></h3>
+<h3 id="_rgsvc_api_Scratchpad">8.6. <code>Scratchpad</code></h3>
<div class="paragraph">
<p>The <code>Scratchpad</code> service is a <a href="../../more-advanced-topics/how-to-09-020-How-to-write-a-typical-domain-service.html">request-scoped</a> service to allow objects to exchange information even if they do not directly call each other.</p>
</div>
<div class="sect3">
-<h4 id="_api_implementation_7">7.6.1. API & Implementation</h4>
+<h4 id="_api_implementation_7">8.6.1. API & Implementation</h4>
<div class="paragraph">
<p>The API of <code>Scratchpad</code> service is:</p>
</div>
@@ -6720,7 +7103,7 @@ instantiated object.</p>
</div>
</div>
<div class="sect3">
-<h4 id="_usage_11">7.6.2. Usage</h4>
+<h4 id="_usage_11">8.6.2. Usage</h4>
<div class="paragraph">
<p>The most common use-case is for <a href="rgant.html#_rgant-Action_invokeOn">bulk</a> actions that act upon multiple objects in a list. The (same) <code>Scratchpad</code> service is injected into each of these objects, and so they can use pass information.</p>
</div>
@@ -6810,7 +7193,7 @@ Scratchpad scratchpad;</code></pre>
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_service_16">7.6.3. Registering the Service</h4>
+<h4 id="_registering_the_service_16">8.6.3. Registering the Service</h4>
<div class="paragraph">
<p>Assuming that the <code>configuration-and-annotation</code> services installer is configured (implicit if using the
<code>AppManifest</code> to <a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">bootstrap the app</a>) then Apache Isis' core
@@ -6824,7 +7207,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect3">
-<h4 id="_related_services_20">7.6.4. Related Services</h4>
+<h4 id="_related_services_20">8.6.4. Related Services</h4>
<div class="paragraph">
<p>The <a href="#_rgsvc_api_ActionInteractionContext"><code>ActionInteractionContext</code></a> service allows <a href="rgant.html#_rgant-Action_invokeOn">bulk actions</a> to co-ordinate with each other.</p>
</div>
@@ -6834,7 +7217,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect2">
-<h3 id="_rgsvc_api_UserService">7.7. <code>UserService</code></h3>
+<h3 id="_rgsvc_api_UserService">8.7. <code>UserService</code></h3>
<div class="paragraph">
<p>The <code>UserService</code> allows the domain object to obtain the identity of the user interacting with said object.</p>
</div>
@@ -6853,7 +7236,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</table>
</div>
<div class="sect3">
-<h4 id="_api_and_usage_3">7.7.1. API and Usage</h4>
+<h4 id="_api_and_usage_3">8.7.1. API and Usage</h4>
<div class="paragraph">
<p>The API of <code>UserService</code> is:</p>
</div>
@@ -6900,13 +7283,13 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect3">
-<h4 id="_implementation_25">7.7.2. Implementation</h4>
+<h4 id="_implementation_25">8.7.2. Implementation</h4>
<div class="paragraph">
<p>The core framework provides a default implementation of this service (<code>o.a.i.core.runtime.services.user.UserServiceDefault</code>).</p>
</div>
</div>
<div class="sect3">
-<h4 id="_registering_the_service_17">7.7.3. Registering the Service</h4>
+<h4 id="_registering_the_service_17">8.7.3. Registering the Service</h4>
<div class="paragraph">
<p>Assuming that the <code>configuration-and-annotation</code> services installer is configured (implicit if using the
<code>AppManifest</code> to <a href="rgcms.html#_rgcms_classes_AppManifest-bootstrapping">bootstrap the app</a>) then Apache Isis' core
@@ -6923,7 +7306,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
</div>
</div>
<div class="sect1">
-<h2 id="_rgsvc_integration-api">8. Integration API</h2>
+<h2 id="_rgsvc_integration-api">9. Integration API</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The integration APIs provide functionality to the domain objects to integrate with other bounded contexts, for example sending an email or serializing an object out to XML.</p>
@@ -6932,7 +7315,7 @@ in the <a href="#_rgsvc_intro_overriding-the-services">introduction</a> to this
<p>The table below summarizes the integration APIs defined by Apache Isis. It also lists their corresponding implementation, either a default implementation provided by Apache Isis itself, or provided by one of the in (non-ASF) <a href="http://www.isisaddons.org">Isis Addons</a> modules.</p>
</div>
<table class="tableblock frame-all grid-all spread">
-<caption class="title">Table 7. Integration API</caption>
+<
<TRUNCATED>