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 2013/02/08 18:26:08 UTC

svn commit: r1444159 - in /isis/site/trunk/content/core: images/action-invocation-published-to-stderr.png images/changed-object-published-to-stderr.png publishing-service.md

Author: danhaywood
Date: Fri Feb  8 17:26:07 2013
New Revision: 1444159

URL: http://svn.apache.org/r1444159
Log:
isis site - configure baseUrl for publishing service, added screenshots

Added:
    isis/site/trunk/content/core/images/action-invocation-published-to-stderr.png   (with props)
    isis/site/trunk/content/core/images/changed-object-published-to-stderr.png   (with props)
Modified:
    isis/site/trunk/content/core/publishing-service.md

Added: isis/site/trunk/content/core/images/action-invocation-published-to-stderr.png
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/core/images/action-invocation-published-to-stderr.png?rev=1444159&view=auto
==============================================================================
Binary file - no diff available.

Propchange: isis/site/trunk/content/core/images/action-invocation-published-to-stderr.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: isis/site/trunk/content/core/images/changed-object-published-to-stderr.png
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/core/images/changed-object-published-to-stderr.png?rev=1444159&view=auto
==============================================================================
Binary file - no diff available.

Propchange: isis/site/trunk/content/core/images/changed-object-published-to-stderr.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: isis/site/trunk/content/core/publishing-service.md
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/core/publishing-service.md?rev=1444159&r1=1444158&r2=1444159&view=diff
==============================================================================
--- isis/site/trunk/content/core/publishing-service.md (original)
+++ isis/site/trunk/content/core/publishing-service.md Fri Feb  8 17:26:07 2013
@@ -73,29 +73,17 @@ lowest common denominator, but in some c
 
 ### Default Implementations
 
-A default implementation of `EventSerializer` will be supplied to the `PublishingService` if none has been specified as a domain service.  This default implementation simply concatenates the metadata and payload together into a single string:
 
-<pre>
-  public interface EventSerializer {
-    ...
-    public static class Simple implements EventSerializer {
+A simple implementation of `PublishingService` (which must be configured as a domain service) is available; it simply writes to stderr.
 
-      @Programmatic
-      @Override
-      public Object serialize(EventMetadata metadata, EventPayload payload) {
-          return "PUBLISHED: \n    metadata: " + 
-                    metadata.getGuid() + ":" + 
-                    metadata.getUser() + ":" + 
-                    metadata.getTimestamp() + 
-                 ":    payload:s\n" + 
-                    payload.toString();
-      }
-    }
-    ...
-  }
+To configure a very simple form of publishing, add the following to `isis.properties`:
+
+<pre>
+isis.services=<i>...other services...</i>,\
+        org.apache.isis.applib.services.publish.PublishingService$StdErr
 </pre>
 
-A simple implementation of `PublishingService` (which must be configured as a domain service) is also available; this simply writes to stderr is also provided:
+The implementation is as follows:
 
 <pre>
   public interface PublishingService {
@@ -105,8 +93,7 @@ A simple implementation of `PublishingSe
       @Hidden
       @Override
       public void publish(EventMetadata metadata, EventPayload payload) {
-        Object serializedEvent = eventSerializer.serialize(
-          metadata, payload);
+        Object serializedEvent = eventSerializer.serialize(metadata, payload);
         System.err.println(serializedEvent);
       }
 
@@ -119,13 +106,31 @@ A simple implementation of `PublishingSe
   }
 </pre>
 
-Thus, to configure a very simple form of publishing, add the following to `isis.properties`:
+As can be seen, the above implementation in turn uses a default implementation of `EventSerializer`, which simply concatenates the metadata and payload together into a single string:
 
 <pre>
-isis.services=<i>...other services...</i>,\
-        org.apache.isis.applib.services.publish.PublishingService$StdErr
+  public interface EventSerializer {
+    ...
+    public static class Simple implements EventSerializer {
+
+      @Programmatic
+      @Override
+      public Object serialize(EventMetadata metadata, EventPayload payload) {
+          return "PUBLISHED: \n    metadata: " + 
+                    metadata.getGuid() + ":" + 
+                    metadata.getUser() + ":" + 
+                    metadata.getTimestamp() + 
+                 ":    payload:s\n" + 
+                    payload.toString();
+      }
+    }
+    ...
+  }
 </pre>
 
+The default `PublishingService` (or indeed any implementation) can be configured to run with a different `EventSerializer` by configuring the serializer implementation in the `isis.properties` file.  One alternative serializer is described next.
+
+
 ### Restful Objects (JSON) Serializer
 
 An alternative serializer is provided by the `isis-viewer-restfulobjects-rendering` module.  This converts the provided `EventPayload` into the form specified by the [Restful Objects spec](http://restfulobjects.org).
@@ -137,7 +142,25 @@ isis.services=<i>...other services...</i
        org.apache.isis.viewer.restfulobjects.rendering.eventserializer.RestfulObjectsSpecEventSerializer
 </pre>
 
-TODO: need to specify the base url via config.
+In addition, the `baseUrl` to use in hyperlinks must be specified, also in `isis.properties`; for example:
+
+<pre>
+org.apache.isis.viewer.restfulobjects.rendering.eventserializer.RestfulObjectsSpecEventSerializer.baseUrl=https://myapp.mycompany.com:8080/restful/.
+</pre>
+
+If no `baseUrl` is specified, then the default URL is `http://localhost:8080/restful/`.
+
+
+If - as described in the previous sections - you configure the default `PublishingService` with the `RestfulObjectsSpecEventSerializer`, then you should see JSON being written to your console.
+
+For example, this is the JSON generated on an action invocation:
+
+ ![](images/action-invocation-published-to-stderr.png)
+
+while this is the object change JSON:
+
+ ![](images/changed-object-published-to-stderr.png)
+
 
 ### Fine-tuning the payload