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/04/14 12:11:21 UTC
[12/31] isis git commit: ISIS-1368: added new PublishingService2 API.
Also updated documentation.
ISIS-1368: added new PublishingService2 API. Also updated documentation.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/2ffc7d93
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/2ffc7d93
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/2ffc7d93
Branch: refs/heads/ISIS-1291
Commit: 2ffc7d9388ca4e07d324dde8a0be4675c122ae9d
Parents: 5306e05
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Apr 11 19:15:48 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Apr 12 18:34:41 2016 +0100
----------------------------------------------------------------------
.../main/asciidoc/guides/_rgcms_schema-aim.adoc | 4 +-
.../guides/_rgsvc_spi_PublishingService.adoc | 12 +++---
.../services/publish/PublishingService.java | 9 +++--
.../services/publish/PublishingService2.java | 42 ++++++++++++++++++++
.../system/transaction/IsisTransaction.java | 8 ++--
5 files changed, 60 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/2ffc7d93/adocs/documentation/src/main/asciidoc/guides/_rgcms_schema-aim.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_rgcms_schema-aim.adoc b/adocs/documentation/src/main/asciidoc/guides/_rgcms_schema-aim.adoc
index 37fdfb6..29f9bb3 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_rgcms_schema-aim.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_rgcms_schema-aim.adoc
@@ -92,6 +92,6 @@ be serialized to/from using the same `ActionInvocationMementoDtoUtils` class.
[NOTE]
====
-As of `1.11.0` this schema is not used directly by the framework; in particular `Command#setMemento(...)` sets a similar
-but less formal XML structure. This may change in the future.
+As of `1.11.0` through `1.12.1` this schema is not used directly by the framework; in particular
+`Command#setMemento(...)` sets a similar but less formal XML structure. This may change in the future.
====
http://git-wip-us.apache.org/repos/asf/isis/blob/2ffc7d93/adocs/documentation/src/main/asciidoc/guides/_rgsvc_spi_PublishingService.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_spi_PublishingService.adoc b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_spi_PublishingService.adoc
index a67aad5..10ca7d8 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_spi_PublishingService.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_spi_PublishingService.adoc
@@ -6,7 +6,7 @@
-The `PublishingService` is intended for coarse-grained publish/subscribe for system-to-system interactions, from Apache Isis to some other system. Here the only events published are those that action invocations and of changed objects. A typical use case is to publish onto a pub/sub bus such as link:http://activemq.apache.org/[ActiveMQ] with link:http://camel.apache.org[Camel] to keep other systems up to date.
+The `PublishingService2` API (the `PublishingService2` subinterface has been added in `1.13.0-SNAPSHOT`) is intended for coarse-grained publish/subscribe for system-to-system interactions, from Apache Isis to some other system. Here the only events published are those that action invocations and of changed objects. A typical use case is to publish onto a pub/sub bus such as link:http://activemq.apache.org/[ActiveMQ] with link:http://camel.apache.org[Camel] to keep other systems up to date.
@@ -16,18 +16,20 @@ The SPI defined by the service is:
[source,java]
----
-public interface PublishingService {
+public interface PublishingService2 {
public void publish(
EventMetadata metadata, // <1>
EventPayload payload); // <2>
+ public void republish(Command); // <3>
@Deprecated
- @Programmatic
- void setEventSerializer(EventSerializer eventSerializer); // <3>
+ void setEventSerializer(EventSerializer eventSerializer); // <4>
}
----
<1> standard metadata about the event, such as the user, the xref:rgcms.adoc#_rgcms_classes_mixins_HasTransactionId[`transactionId`], date/time etc
<2> for published actions, an `EventPayloadForActionInvocation` (or subclass thereof); for published objects, an `EventPayloadForObjectChanged` (or subclass thereof)
-<3> injects in the xref:rgsvc.adoc#_rgsvc_spi_EventSerializer[`EventSerializer`] service. This is deprecated because not every implementation is required to use an `EventSerializer` so its inclusion within the SPI of `PublishingService` was in retrospect a mistake.
+<3> (`1.13.0-SNAPSHOT`) allow a `Command` representing an action to be republished by the application (eg if an error occurred). Note that this relies upon the `Command#getMemento()` to
+return serialized xref:rgcms.adoc#_rgcms_schema-aim[action invocation memento].
+<4> injects in the xref:rgsvc.adoc#_rgsvc_spi_EventSerializer[`EventSerializer`] service. This is deprecated because not every implementation is required to use an `EventSerializer` so its inclusion within the SPI of `PublishingService` was in retrospect a mistake.
Typically implementations will use the injected `EventSerializer` to convert the metadata and payload into a form to be published:
http://git-wip-us.apache.org/repos/asf/isis/blob/2ffc7d93/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService.java b/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService.java
index a064460..a5f4277 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService.java
@@ -20,7 +20,7 @@ package org.apache.isis.applib.services.publish;
import org.apache.isis.applib.annotation.Hidden;
-
+import org.apache.isis.applib.annotation.Programmatic;
/**
* Will be called whenever an publishable entity has changed its state, or an published action has been invoked.
@@ -40,10 +40,10 @@ import org.apache.isis.applib.annotation.Hidden;
*/
public interface PublishingService {
- @Hidden
- public void publish(EventMetadata metadata, EventPayload payload);
+ @Programmatic
+ void publish(EventMetadata metadata, EventPayload payload);
- public static class Stderr implements PublishingService {
+ class Stderr implements PublishingService {
private EventSerializer eventSerializer = new EventSerializer.Simple();
@@ -63,6 +63,7 @@ public interface PublishingService {
/**
* @deprecated - not every implementation will use an {@link EventSerializer}, so this ought not to have been defined in the interface.
*/
+ @Programmatic
@Deprecated
void setEventSerializer(EventSerializer eventSerializer);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/2ffc7d93/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService2.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService2.java b/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService2.java
new file mode 100644
index 0000000..5c56216
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService2.java
@@ -0,0 +1,42 @@
+/*
+ * 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.applib.services.publish;
+
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.services.command.Command;
+
+public interface PublishingService2 extends PublishingService {
+
+ /**
+ * To support implementations that allow the republishing of commands, eg onto an JMS message bus.
+ */
+ @Programmatic
+ void republish(final Command command);
+
+ class Stderr extends PublishingService.Stderr implements PublishingService2 {
+
+ @Override
+ public void republish(Command command) {
+ System.err.println(command.getMemento());
+ }
+
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/2ffc7d93/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
index dcd9ef6..f5e57d3 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
@@ -684,10 +684,10 @@ public class IsisTransaction implements TransactionScopedComponent {
final String currentUser,
final Timestamp timestampEpoch,
final String title,
- String targetClass,
- String targetAction,
- Bookmark target,
- String memberIdentifier,
+ final String targetClass,
+ final String targetAction,
+ final Bookmark target,
+ final String memberIdentifier,
final List<String> parameterNames,
final List<Class<?>> parameterTypes,
final Class<?> returnType) {