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 2015/03/25 02:04:13 UTC

[2/9] isis git commit: ISIS-1028: Create Event Bus Service based on Axon

ISIS-1028: Create Event Bus Service based on Axon

Comments added.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/c5b06bbe
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/c5b06bbe
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/c5b06bbe

Branch: refs/heads/master
Commit: c5b06bbe580bf2db895d84eeae0a9acb3d15b26e
Parents: 852da24
Author: Oscar Bou <os...@apache.org>
Authored: Sun Feb 8 20:50:25 2015 +0100
Committer: Oscar Bou <os...@apache.org>
Committed: Sun Feb 8 20:50:25 2015 +0100

----------------------------------------------------------------------
 .../services/eventbus/EventBusService.java      |  2 +-
 .../eventbus/AxonEventListenerAdapter.java      | 16 ++++++
 .../eventbus/AxonSimpleEventBusAdapter.java     | 20 ++++++++
 .../eventbus/AxonSimpleEventBusService.java     | 19 ++++++++
 .../eventbus/AxonSimpleEventBusServiceJdo.java  | 38 ---------------
 .../DefaultSubscriberExceptionHandler.java      | 40 +++++++++++----
 .../services/eventbus/EventBusAdapter.java      | 16 ++++++
 .../eventbus/EventBusServiceDefault.java        |  2 +
 .../services/eventbus/GuavaEventBusAdapter.java | 28 +++++++++--
 .../eventbus/RuntimeEventBusService.java        | 16 ++++++
 .../eventbus/AxonSimpleEventBusServiceJdo.java  | 51 ++++++++++++++++++++
 11 files changed, 196 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/c5b06bbe/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/EventBusService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/EventBusService.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/EventBusService.java
index 77c8a38..db450d3 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/EventBusService.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/EventBusService.java
@@ -31,7 +31,7 @@ import org.apache.isis.applib.annotation.Hidden;
 import org.apache.isis.applib.annotation.Programmatic;
 
 /**
- * A wrapper for a Guava {@link EventBus}, allowing arbitrary events to be posted and
+ * A service implementing an Event Bus, allowing arbitrary events to be posted and
  * subscribed to.
  *  
  * <p>

http://git-wip-us.apache.org/repos/asf/isis/blob/c5b06bbe/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonEventListenerAdapter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonEventListenerAdapter.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonEventListenerAdapter.java
index 90c22c2..e7cedc0 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonEventListenerAdapter.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonEventListenerAdapter.java
@@ -1,3 +1,19 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.isis.core.runtime.services.eventbus;
 
 import org.axonframework.domain.EventMessage;

http://git-wip-us.apache.org/repos/asf/isis/blob/c5b06bbe/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusAdapter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusAdapter.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusAdapter.java
index 0b8d904..68c7044 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusAdapter.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusAdapter.java
@@ -1,3 +1,19 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.isis.core.runtime.services.eventbus;
 
 import java.util.Map;
@@ -7,6 +23,10 @@ import com.google.common.collect.Maps;
 import org.axonframework.domain.GenericEventMessage;
 import org.axonframework.eventhandling.SimpleEventBus;
 
+/**
+ * A wrapper for an Axon {@link org.axonframework.eventhandling.SimpleEventBus},
+ * allowing arbitrary events to be posted and subscribed to.
+ */
 public class AxonSimpleEventBusAdapter extends EventBusAdapter {
 
     private static SimpleEventBus simpleEventBus = new SimpleEventBus();

http://git-wip-us.apache.org/repos/asf/isis/blob/c5b06bbe/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusService.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusService.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusService.java
index af41e4a..6fb8a2b 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusService.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusService.java
@@ -1,7 +1,26 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.isis.core.runtime.services.eventbus;
 
 import org.apache.isis.applib.services.eventbus.EventBus;
 
+/**
+ * An Event Bus Service based on Axon.
+ */
 public class AxonSimpleEventBusService extends RuntimeEventBusService {
 
     @Override

http://git-wip-us.apache.org/repos/asf/isis/blob/c5b06bbe/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusServiceJdo.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusServiceJdo.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusServiceJdo.java
deleted file mode 100644
index 53e7811..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/AxonSimpleEventBusServiceJdo.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.apache.isis.core.runtime.services.eventbus;
-
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.objectstore.jdo.datanucleus.JDOStateManagerForIsis;
-import org.apache.isis.objectstore.jdo.datanucleus.JDOStateManagerForIsis.Hint;
-
-
-/**
- * This domain service that enables both the framework and application code to
- * publish events through an Axon
- * {@link org.axonframework.eventhandling.SimpleEventBus} instance.
- * 
- * <p>
- * In addition, this implementation is &quot;JDO-aware&quot; meaning that it
- * allows events to be {@link #post(Object) posted} from the setters of
- * entities, automatically ignoring any calls to those setters that occur as a
- * side-effect of the JDO load/detach lifecycle.
- * 
- * <p>
- * This implementation has no UI.
- */
-@DomainService(nature=NatureOfService.DOMAIN)
-public class AxonSimpleEventBusServiceJdo extends AxonSimpleEventBusService {
-
-    /**
-     * skip if called in any way by way of the {@link JDOStateManagerForIsis}.
-     * 
-     * <p>
-     * The {@link JDOStateManagerForIsis} sets a
-     * {@link JDOStateManagerForIsis#hint threadlocal} if it has been called.
-     */
-    @Override
-    public boolean skip(final Object event) {
-        return JDOStateManagerForIsis.hint.get() != Hint.NONE;
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/c5b06bbe/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/DefaultSubscriberExceptionHandler.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/DefaultSubscriberExceptionHandler.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/DefaultSubscriberExceptionHandler.java
index c8299c2..ca4d4f2 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/DefaultSubscriberExceptionHandler.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/DefaultSubscriberExceptionHandler.java
@@ -1,3 +1,19 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.isis.core.runtime.services.eventbus;
 
 import org.slf4j.Logger;
@@ -8,20 +24,24 @@ import org.apache.isis.core.commons.exceptions.IsisApplicationException;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
 
+/**
+ * Default logic for handling Exceptions thrown while processing Events on an
+ * {@link org.apache.isis.applib.services.eventbus.EventBusService}.
+ */
 public class DefaultSubscriberExceptionHandler {
-    
+
     private static final Logger LOG = LoggerFactory.getLogger(DefaultSubscriberExceptionHandler.class);
 
-    //region > exception handling
-    
+    // region > exception handling
+
     public static void processException(Throwable exception,
             Object event) {
-        if(!(event instanceof AbstractDomainEvent)) {
-            if(LOG.isDebugEnabled()) {
+        if (!(event instanceof AbstractDomainEvent)) {
+            if (LOG.isDebugEnabled()) {
                 LOG.debug("Ignoring exception '%s' (%s), not a subclass of AbstractDomainEvent", exception.getMessage(), exception.getClass().getName());
             }
             return;
-        } 
+        }
         final AbstractDomainEvent<?> interactionEvent = (AbstractDomainEvent<?>) event;
         final AbstractDomainEvent.Phase phase = interactionEvent.getEventPhase();
         switch (phase) {
@@ -31,11 +51,11 @@ public class DefaultSubscriberExceptionHandler {
             break;
         case DISABLE:
             LOG.warn("Exception thrown during DISABLE phase, to be safe will veto (disable) the interaction event, msg='{}', class='{}'", exception.getMessage(), exception.getClass().getName());
-            interactionEvent.disable(exception.getMessage()!=null?exception.getMessage(): exception.getClass().getName() + " thrown.");
+            interactionEvent.disable(exception.getMessage() != null ? exception.getMessage() : exception.getClass().getName() + " thrown.");
             break;
         case VALIDATE:
             LOG.warn("Exception thrown during VALIDATE phase, to be safe will veto (invalidate) the interaction event, msg='{}', class='{}'", exception.getMessage(), exception.getClass().getName());
-            interactionEvent.invalidate(exception.getMessage()!=null?exception.getMessage(): exception.getClass().getName() + " thrown.");
+            interactionEvent.invalidate(exception.getMessage() != null ? exception.getMessage() : exception.getClass().getName() + " thrown.");
             break;
         case EXECUTING:
             LOG.warn("Exception thrown during EXECUTING phase, to be safe will abort the transaction, msg='{}', class='{}'", exception.getMessage(), exception.getClass().getName());
@@ -47,7 +67,7 @@ public class DefaultSubscriberExceptionHandler {
             break;
         }
     }
-    
+
     private static void abortTransaction(Throwable exception) {
         getTransactionManager().getTransaction().setAbortCause(new IsisApplicationException(exception));
         return;
@@ -57,6 +77,6 @@ public class DefaultSubscriberExceptionHandler {
         return IsisContext.getTransactionManager();
     }
 
-    //endregion
+    // endregion
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/c5b06bbe/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/EventBusAdapter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/EventBusAdapter.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/EventBusAdapter.java
index e573beb..5d45588 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/EventBusAdapter.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/EventBusAdapter.java
@@ -1,3 +1,19 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.isis.core.runtime.services.eventbus;
 
 import org.apache.isis.applib.services.eventbus.EventBus;

http://git-wip-us.apache.org/repos/asf/isis/blob/c5b06bbe/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/EventBusServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/EventBusServiceDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/EventBusServiceDefault.java
index ac5c23e..a3a19c3 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/EventBusServiceDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/EventBusServiceDefault.java
@@ -19,6 +19,8 @@ package org.apache.isis.core.runtime.services.eventbus;
 import org.apache.isis.applib.services.eventbus.EventBus;
 
 /**
+ * An Event Bus Service based on Guava.
+ * <p>
  * @deprecated - but only because {@link org.apache.isis.objectstore.jdo.datanucleus.service.eventbus.EventBusServiceJdo}
  * is annotated (with <code>@DomainService</code>) as the default implementation.  The functionality in this implementation
  * is still required.

http://git-wip-us.apache.org/repos/asf/isis/blob/c5b06bbe/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/GuavaEventBusAdapter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/GuavaEventBusAdapter.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/GuavaEventBusAdapter.java
index a84e3bc..8baf576 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/GuavaEventBusAdapter.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/GuavaEventBusAdapter.java
@@ -1,16 +1,37 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.isis.core.runtime.services.eventbus;
 
 import com.google.common.eventbus.SubscriberExceptionContext;
 import com.google.common.eventbus.SubscriberExceptionHandler;
 
+/**
+ * A wrapper for a Guava {@link com.google.common.eventbus.EventBus},
+ * allowing arbitrary events to be posted and subscribed to.
+ */
 public class GuavaEventBusAdapter extends EventBusAdapter {
 
     private static final com.google.common.eventbus.EventBus eventBus = new com.google.common.eventbus.EventBus(newEventBusSubscriberExceptionHandler());
 
     protected static SubscriberExceptionHandler newEventBusSubscriberExceptionHandler() {
-        return new SubscriberExceptionHandler(){
+        return new SubscriberExceptionHandler() {
             @Override
-            public void handleException(Throwable exception, SubscriberExceptionContext context) {
+            public void handleException(Throwable exception,
+                    SubscriberExceptionContext context) {
                 Object event = context.getEvent();
                 DefaultSubscriberExceptionHandler.processException(exception, event);
             }
@@ -20,7 +41,8 @@ public class GuavaEventBusAdapter extends EventBusAdapter {
 
     @Override
     public void register(final Object domainService) {
-        // NO-OP. On current implementation subscribers list is the one managed by the EventBusService, and used by EventBusServiceDefault.
+        // NO-OP. On current implementation subscribers list is the one managed
+        // by the EventBusService, and used by EventBusServiceDefault.
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/isis/blob/c5b06bbe/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/RuntimeEventBusService.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/RuntimeEventBusService.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/RuntimeEventBusService.java
index 887d792..fd47781 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/RuntimeEventBusService.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/eventbus/RuntimeEventBusService.java
@@ -1,3 +1,19 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.isis.core.runtime.services.eventbus;
 
 import javax.enterprise.context.RequestScoped;

http://git-wip-us.apache.org/repos/asf/isis/blob/c5b06bbe/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/service/eventbus/AxonSimpleEventBusServiceJdo.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/service/eventbus/AxonSimpleEventBusServiceJdo.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/service/eventbus/AxonSimpleEventBusServiceJdo.java
new file mode 100644
index 0000000..dbfb744
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/service/eventbus/AxonSimpleEventBusServiceJdo.java
@@ -0,0 +1,51 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.isis.objectstore.jdo.datanucleus.service.eventbus;
+
+import org.apache.isis.core.runtime.services.eventbus.AxonSimpleEventBusService;
+import org.apache.isis.objectstore.jdo.datanucleus.JDOStateManagerForIsis;
+import org.apache.isis.objectstore.jdo.datanucleus.JDOStateManagerForIsis.Hint;
+
+/**
+ * This domain service that enables both the framework and application code to
+ * publish events through an Axon
+ * {@link org.axonframework.eventhandling.SimpleEventBus} instance.
+ * 
+ * <p>
+ * In addition, this implementation is &quot;JDO-aware&quot; meaning that it
+ * allows events to be {@link #post(Object) posted} from the setters of
+ * entities, automatically ignoring any calls to those setters that occur as a
+ * side-effect of the JDO load/detach lifecycle.
+ * 
+ * <p>
+ * This implementation has no UI.
+ */
+public class AxonSimpleEventBusServiceJdo extends AxonSimpleEventBusService {
+
+    /**
+     * skip if called in any way by way of the {@link JDOStateManagerForIsis}.
+     * 
+     * <p>
+     * The {@link JDOStateManagerForIsis} sets a
+     * {@link JDOStateManagerForIsis#hint threadlocal} if it has been called.
+     */
+    @Override
+    public boolean skip(final Object event) {
+        return JDOStateManagerForIsis.hint.get() != Hint.NONE;
+    }
+
+}
\ No newline at end of file