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 2018/01/19 16:01:51 UTC

[isis] branch ISIS-1569-replay-commands updated (b7392e7 -> 0e87db4)

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a change to branch ISIS-1569-replay-commands
in repository https://gitbox.apache.org/repos/asf/isis.git.


    from b7392e7  ISIS-1569: adds guard to ensure that BackgroundCommand#startedAt is always populated.
     new 7ea6f2b  ISIS-1835: catches any type of exception in order to report a problem (an NPE was being thrown if the file wasn't present, rather than an IOException)
     new 448fd54  ISIS-1569: adds in 'REPLAYABLE' as a new Command#ExecuteIn
     new 552094e  ISIS-1836: removes chance of an NPE in the RO mapper for an exception (which was in turn resulting in a 500 rather than 422 when invoked an action with an incorrect parameter argument).
     new 0e87db4  ISIS-1569: undeprecates Command#getStartedAt and Command#getCompletedAt

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/isis/applib/PropertyResource.java   |  5 ++-
 .../org/apache/isis/applib/annotation/Command.java | 11 ++++--
 .../isis/applib/annotation/CommandExecuteIn.java   | 13 ++++++-
 .../isis/applib/services/command/Command.java      | 41 +++++++++++++++++-----
 .../server/mappers/entity/ExceptionDetail.java     |  2 +-
 5 files changed, 56 insertions(+), 16 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@isis.apache.org" <co...@isis.apache.org>'].

[isis] 01/04: ISIS-1835: catches any type of exception in order to report a problem (an NPE was being thrown if the file wasn't present, rather than an IOException)

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch ISIS-1569-replay-commands
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 7ea6f2b5911751dc23f33b3325e78d219fa89695
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Jan 19 14:18:31 2018 +0000

    ISIS-1835: catches any type of exception in order to report a problem (an NPE was being thrown if the file wasn't present, rather than an IOException)
---
 .../src/main/java/org/apache/isis/applib/PropertyResource.java       | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/core/applib/src/main/java/org/apache/isis/applib/PropertyResource.java b/core/applib/src/main/java/org/apache/isis/applib/PropertyResource.java
index 4f1c687..f701c03 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/PropertyResource.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/PropertyResource.java
@@ -18,7 +18,6 @@
  */
 package org.apache.isis.applib;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.util.Map;
 import java.util.Properties;
@@ -53,9 +52,9 @@ public class PropertyResource {
                     }
                 }
             }
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new RuntimeException(
-                    String.format("Failed to load '%s' file ", this), e);
+                    String.format("Failed to load '%s' file relative to %s", getPropertiesFile(), getPropertiesFileContext().getName()), e);
         }
     }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.

[isis] 04/04: ISIS-1569: undeprecates Command#getStartedAt and Command#getCompletedAt

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch ISIS-1569-replay-commands
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 0e87db49804a121f4353bee8337daef44ae29afa
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Jan 19 14:52:02 2018 +0000

    ISIS-1569: undeprecates Command#getStartedAt and Command#getCompletedAt
---
 .../isis/applib/services/command/Command.java      | 41 +++++++++++++++++-----
 1 file changed, 33 insertions(+), 8 deletions(-)

diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java b/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
index a6f458f..ec91580 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
@@ -284,17 +284,30 @@ public interface Command extends HasTransactionId {
      * For an command that has actually been executed, holds the date/time at which the {@link Interaction} that
      * executed the command started.
      *
-     * @deprecated - see {@link Interaction#getStartedAt()}.
+     * <p>
+     *     Previously this field was deprecated (on the basis that the startedAt is also held in
+     *     {@link Interaction.Execution#getStartedAt()}). However, to support replay/replication feature means that
+     *     we need to query for persisted {@link Command}s and use this field to ensure the correct ordering.
+     * </p>
+     *
+     * See also {@link Interaction#getCurrentExecution()} and
+     * {@link Interaction.Execution#getStartedAt()}.
      */
-    @Deprecated
     Timestamp getStartedAt();
     
     /**
      * <b>NOT API</b>: intended to be called only by the framework.
      *
-     * @deprecated - see {@link Interaction#getCurrentExecution()} and {@link org.apache.isis.applib.services.iactn.Interaction.Execution#setStartedAt(Timestamp)}.
+     *
+     * <p>
+     *     Previously this field was deprecated (on the basis that the completedAt is also held in
+     *     {@link Interaction.Execution#getCompletedAt()}). However, to support replay/replication feature means that
+     *     we need to query for persisted {@link Command}s and use this field to ensure the correct ordering.
+     * </p>
+     *
+     * See also {@link Interaction#getCurrentExecution()} and
+     * {@link Interaction.Execution#setStartedAt(Timestamp)}.
      */
-    @Deprecated
     void setStartedAt(Timestamp startedAt);
 
     //endregion
@@ -305,17 +318,29 @@ public interface Command extends HasTransactionId {
      * For an command that has actually been executed, holds the date/time at which the {@link Interaction} that
      * executed the command completed.
      *
-     * @deprecated - see {@link Interaction#getCurrentExecution()} and  {@link org.apache.isis.applib.services.iactn.Interaction.Execution#getCompletedAt()}.
+     * <p>
+     *     Previously this field was deprecated (on the basis that the completedAt is also held in
+     *     {@link Interaction.Execution#getCompletedAt()}). However, to support replay/replication feature means that
+     *     we need to query for persisted {@link Command}s and use this field to ensure the correct ordering.
+     * </p>
+     *
+     * See also {@link Interaction#getCurrentExecution()} and
+     * {@link Interaction.Execution#getCompletedAt()}.
      */
-    @Deprecated
     Timestamp getCompletedAt();
     
     /**
      * <b>NOT API</b>: intended to be called only by the framework.
      *
-     * @deprecated - see {@link org.apache.isis.applib.services.iactn.Interaction.Execution#setCompletedAt(Timestamp)}.
+     * <p>
+     *     Previously this field was deprecated (on the basis that the completedAt is also held in
+     *     {@link Interaction.Execution#getCompletedAt()}). However, to support replay/replication feature means that
+     *     we need to query for persisted {@link Command}s and use this field to ensure the correct ordering.
+     * </p>
+     *
+     * See also {@link Interaction#getCurrentExecution()} and
+     * {@link Interaction.Execution#setCompletedAt(Timestamp)}.
      */
-    @Deprecated
     void setCompletedAt(Timestamp completedAt);
 
     //endregion

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.

[isis] 02/04: ISIS-1569: adds in 'REPLAYABLE' as a new Command#ExecuteIn

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch ISIS-1569-replay-commands
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 448fd546cd7a617acdaa88524f86c2c20ea7dac3
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Jan 19 14:20:33 2018 +0000

    ISIS-1569: adds in 'REPLAYABLE' as a new Command#ExecuteIn
---
 .../java/org/apache/isis/applib/annotation/Command.java     | 11 ++++++++---
 .../org/apache/isis/applib/annotation/CommandExecuteIn.java | 13 ++++++++++++-
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Command.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Command.java
index a8e208c..58bafbb 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Command.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Command.java
@@ -80,9 +80,14 @@ public @interface Command {
          * @deprecated - use {@link CommandExecuteIn#BACKGROUND}
          */
         @Deprecated
-        BACKGROUND;
-
-
+        BACKGROUND,
+        /**
+         * For framework use, not intended to be used in application code.
+         *
+         * @deprecated - use {@link CommandExecuteIn#REPLAYABLE}
+         */
+        @Deprecated
+        REPLAYABLE
 
     }
 
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandExecuteIn.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandExecuteIn.java
index ddd557d..4be71af 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandExecuteIn.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/CommandExecuteIn.java
@@ -38,13 +38,23 @@ public enum CommandExecuteIn {
      * persisted {@link org.apache.isis.applib.services.command.Command command} object as a placeholder to the
      * result.
      */
-    BACKGROUND;
+    BACKGROUND,
+    /**
+     * For commands that are replicated from a master onto a slave and are to be replayed (typically using the same
+     * mechanism as "regular" background commands, eg a background job).
+     *
+     * <p>
+     *     For framework use, not intended to be used in application code.
+     * </p>
+     */
+    REPLAYABLE;
 
     @Deprecated
     public static CommandExecuteIn from(final Command.ExecuteIn executeIn) {
         if(executeIn == null) return null;
         if(executeIn == Command.ExecuteIn.FOREGROUND) return FOREGROUND;
         if(executeIn == Command.ExecuteIn.BACKGROUND) return BACKGROUND;
+        if(executeIn == Command.ExecuteIn.REPLAYABLE) return REPLAYABLE;
         // shouldn't happen
         throw new IllegalArgumentException("Unrecognized : executeIn" + executeIn);
     }
@@ -54,6 +64,7 @@ public enum CommandExecuteIn {
         if(commandExecuteIn == null) return null;
         if(commandExecuteIn == FOREGROUND) return Command.ExecuteIn.FOREGROUND;
         if(commandExecuteIn == BACKGROUND) return Command.ExecuteIn.BACKGROUND;
+        if(commandExecuteIn == REPLAYABLE) return Command.ExecuteIn.REPLAYABLE;
         // shouldn't happen
         throw new IllegalArgumentException("Unrecognized : executeIn" + commandExecuteIn);
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.

[isis] 03/04: ISIS-1836: removes chance of an NPE in the RO mapper for an exception (which was in turn resulting in a 500 rather than 422 when invoked an action with an incorrect parameter argument).

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch ISIS-1569-replay-commands
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 552094e8df97a7600037ddd18a2eb7f8e13bff35
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Jan 19 14:22:43 2018 +0000

    ISIS-1836: removes chance of an NPE in the RO mapper for an exception (which was in turn resulting in a 500 rather than 422 when invoked an action with an incorrect parameter argument).
---
 .../viewer/restfulobjects/server/mappers/entity/ExceptionDetail.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/mappers/entity/ExceptionDetail.java b/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/mappers/entity/ExceptionDetail.java
index d47e2a3..862c2d8 100644
--- a/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/mappers/entity/ExceptionDetail.java
+++ b/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/mappers/entity/ExceptionDetail.java
@@ -77,7 +77,7 @@ public class ExceptionDetail {
         if (ex instanceof JDOException) {
             final JDOException jdoException = (JDOException) ex;
             final Throwable[] nestedExceptions = jdoException.getNestedExceptions();
-            return nestedExceptions.length > 0? nestedExceptions[0]: null;
+            return nestedExceptions != null && nestedExceptions.length > 0? nestedExceptions[0]: null;
         }
         else {
             return ex.getCause();

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.