Author: buildbot
Date: Wed Nov 19 08:51:20 2014
New Revision: 929746
Log:
Staging update by buildbot for isis
Modified:
websites/staging/isis/trunk/cgi-bin/ (props changed)
websites/staging/isis/trunk/content/ (props changed)
websites/staging/isis/trunk/content/intro/tutorials/apacheconeu-2014.html
websites/staging/isis/trunk/content/reference/services/event-bus-service.html
Propchange: websites/staging/isis/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Nov 19 08:51:20 2014
@@ -1 +1 @@
-1640493
+1640504
Propchange: websites/staging/isis/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Nov 19 08:51:20 2014
@@ -1 +1 @@
-1640493
+1640504
Modified:
websites/staging/isis/trunk/content/intro/tutorials/apacheconeu-2014.html
==============================================================================
--- websites/staging/isis/trunk/content/intro/tutorials/apacheconeu-2014.html
(original)
+++ websites/staging/isis/trunk/content/intro/tutorials/apacheconeu-2014.html
Wed Nov 19 08:51:20 2014
@@ -950,6 +950,18 @@ mvn clean install
<h2>Decoupling using the Event Bus</h2>
+<p>Another way in which Apache Isis helps you keep your application nicely
modularized is through its event bus. Each action invocation, or property
modification, can be used to generate a succession of events that allows
subscribers to veto the interaction (the see it/use it/do it rules) or, if the
action is allowed, to perform work prior to the execution of the action or
after the execution of the action.</p>
+
+<p>Under the covers Isis uses the <a
href="https://code.google.com/p/guava-libraries/wiki/EventBusExplained">Guava
event bus</a> and subscribers (always domain services) subscribe by writing
methods annotated with <code>@com.google.common.eventbus.Subscribe</code>
annotation.</p>
+
+<p>By default the events generated are
<code>ActionInteractionEvent.Default</code> (for actions) and
<code>PropertyInteractionEvent.Default</code> (for properties). Subclasses of
these can be specified using the <a
href="http://isis.apache.org/reference/recognized-annotations/ActionInteraction.html">@ActionInteraction</a>
or <a
href="http://isis.apache.org/reference/recognized-annotations/PropertyInteraction.html">@PropertyInteraction</a>.</p>
+
+<p>Using the guidance in <a href="">these docs</a>: </p>
+
+<ul>
+<li>write a domain service subscriber to </li>
+</ul>
+
<p>TODO</p>
<ul>
Modified:
websites/staging/isis/trunk/content/reference/services/event-bus-service.html
==============================================================================
---
websites/staging/isis/trunk/content/reference/services/event-bus-service.html
(original)
+++
websites/staging/isis/trunk/content/reference/services/event-bus-service.html
Wed Nov 19 08:51:20 2014
@@ -482,14 +482,50 @@
<p>This design allows the <code>libraryMember</code> module to be decoupled
from the <code>book</code> module.</p>
-<h3>Self Registration</h3>
+<h2>Registering for Events</h2>
-<p>A good practice for domain services is to self-register when the
<code>EventBusService</code> is injected into it:</p>
+<h4>1.8.0-SNAPSHOT</h4>
+
+<p>Register for events in the <code>@PostConstruct</code> lifecycle method
(and unregister in <code>@PreDestroy</code>):</p>
+
+<pre><code>@DomainService
+public class MySubscribingDomainService {
+
+ ...
+
+ @Programmatic
+ @PostConstruct
+ public void postConstruct() {
+ eventBusService.register(this);
+ }
+ @Programmatic
+ @PreDestroy
+ public void preDestroy() {
+ eventBusService.unregister(this);
+ }
+
+ @javax.inject.Inject
+ private EventBusService eventBusService;
+}
+</code></pre>
+
+<p>This works for both application-scoped and request-scoped
(<code>@RequestScoped</code>) domain services.</p>
+
+<h4>1.7.0 and before</h4>
+
+<p>Register for events when the <code>EventBusService</code> is injected into
it:</p>
+
+<pre><code>@DomainService
+public class MySubscribingDomainService {
+
+ ...
+
+ private EventBusService eventBusService;
+ public void injectEventBusService(final EventBusService eventBusService) {
+ this.eventBusService = eventBusService;
+ eventBusService.register(this);
+ }
-<pre><code>private EventBusService eventBusService;
-public void injectEventBusService(final EventBusService eventBusService) {
- this.eventBusService = eventBusService;
- eventBusService.register(this);
}
</code></pre>