isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject isis git commit: ISIS-1393: removes MessageServiceInternal as an internal API, and instead has two implementations of MessageService (a noop one, and a default one)
Date Thu, 11 May 2017 13:04:41 GMT
Repository: isis
Updated Branches:
  refs/heads/ISIS-1391 [created] 786e882a8


ISIS-1393: removes MessageServiceInternal as an internal API, and instead has two implementations
of MessageService (a noop one, and a default one)


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

Branch: refs/heads/ISIS-1391
Commit: 786e882a8da1009c2a6279220dbfab58ee44dfaa
Parents: 873c0cd
Author: Dan Haywood <dan@haywood-associates.co.uk>
Authored: Thu May 11 14:04:20 2017 +0100
Committer: Dan Haywood <dan@haywood-associates.co.uk>
Committed: Thu May 11 14:04:20 2017 +0100

----------------------------------------------------------------------
 .../guides/rgsvc/_rgsvc_spi_HintStore.adoc      | 46 ++++++++++
 .../message/MessageServiceInternalDefault.java  | 83 -----------------
 .../services/message/MessageServiceNoop.java    | 69 ++++++++++++++
 .../msgbroker/MessageBrokerServiceInternal.java | 54 -----------
 .../MessageBrokerServiceInternalNoop.java       | 45 ----------
 .../SpecificationLoaderTestAbstract.java        |  8 +-
 .../MessageBrokerServiceInternalDefault.java    | 57 ------------
 .../msgbroker/MessageServiceDefault.java        | 94 ++++++++++++++++++++
 .../system/persistence/PersistenceSession.java  | 21 -----
 .../ObjectActionLayoutXmlDefaultTest.java       |  6 +-
 .../system/OneToManyAssociationDefaultTest.java |  6 +-
 ...WrapperFactoryDefaultTest_wrappedObject.java |  4 +-
 12 files changed, 221 insertions(+), 272 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/786e882a/adocs/documentation/src/main/asciidoc/guides/rgsvc/_rgsvc_spi_HintStore.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/rgsvc/_rgsvc_spi_HintStore.adoc
b/adocs/documentation/src/main/asciidoc/guides/rgsvc/_rgsvc_spi_HintStore.adoc
index 33f3e70..950ae40 100644
--- a/adocs/documentation/src/main/asciidoc/guides/rgsvc/_rgsvc_spi_HintStore.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/rgsvc/_rgsvc_spi_HintStore.adoc
@@ -44,6 +44,52 @@ The core framework provides a default implementation of this service (`org.apach
 
 
 
+== View models (`1.15.0-SNAPSHOT`)
+
+Hints are stored against the `Bookmark` of a domain object, essentially the identifier of
the domain object.
+For a domain entity this identifier is fixed and unchanging but for a view models the identifier
changes each time the view model's state changes (the identifier is basically a digest of
the object's state).
+This means that any hints stored against the view model's bookmark are in effect lost as
soon as the view model is modified.
+
+To address this issue the `HintStore` (as of `1.15.0-SNAPSHOT`) provides an optional interface
that the view model can implement, the intent of which is to expose the "logical" identity
of the view model.
+This interface is:
+
+
+[source,java]
+----
+public interface HintStore {
+    interface HintIdProvider {
+        String hintId();
+    }
+}
+----
+
+For example, suppose that there's a view model that wraps a `Customer` and its ``Order``s
+For this the `Customer` represents the logical identity.
+This view model might therefore be implemented as follows:
+
+[source,java]
+----
+@XmlRootElement("customerAndOrders")
+@XmlAccessType(FIELD)
+public class CustomerAndOrders implements HintStore.HintIdProvider {
+
+    @Getter @Setter
+    private Customer customer;
+
+    ...
+
+    @Programmatic
+    public String hintId() {
+        bookmarkService.bookmarkFor(getCustomer()).toString();
+    }
+
+    @XmlTransient
+    @Inject BookmarkService bookmarkService;
+}
+----
+
+
+
 
 == Registering the Service
 

http://git-wip-us.apache.org/repos/asf/isis/blob/786e882a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/message/MessageServiceInternalDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/message/MessageServiceInternalDefault.java
b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/message/MessageServiceInternalDefault.java
deleted file mode 100644
index 26ef2ff..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/message/MessageServiceInternalDefault.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *  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.metamodel.services.message;
-
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.i18n.TranslatableString;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.applib.services.message.MessageService;
-import org.apache.isis.core.metamodel.services.msgbroker.MessageBrokerServiceInternal;
-
-@DomainService(
-        nature = NatureOfService.DOMAIN,
-        menuOrder = "" + Integer.MAX_VALUE
-)
-public class MessageServiceInternalDefault implements MessageService {
-
-    @Programmatic
-    @Override
-    public void informUser(final String message) {
-        messageBrokerServiceInternal.informUser(message);
-    }
-
-    @Override
-    public String informUser(final TranslatableString message, final Class<?> contextClass,
final String contextMethod) {
-        return message.translate(translationService, context(contextClass, contextMethod));
-    }
-
-    @Programmatic
-    @Override
-    public void warnUser(final String message) {
-        messageBrokerServiceInternal.warnUser(message);
-    }
-
-    @Override
-    public String warnUser(final TranslatableString message, final Class<?> contextClass,
final String contextMethod) {
-        return message.translate(translationService, context(contextClass, contextMethod));
-    }
-
-    @Programmatic
-    @Override
-    public void raiseError(final String message) {
-        messageBrokerServiceInternal.raiseError(message);
-    }
-
-    @Override
-    public String raiseError(final TranslatableString message, final Class<?> contextClass,
final String contextMethod) {
-        final String translatedMessage = message.translate(translationService, context(contextClass,
contextMethod));
-        messageBrokerServiceInternal.raiseError(translatedMessage);
-        return translatedMessage;
-    }
-
-    private static String context(final Class<?> contextClass, final String contextMethod)
{
-        return contextClass.getName()+"#"+contextMethod;
-    }
-
-
-
-    @javax.inject.Inject
-    MessageBrokerServiceInternal messageBrokerServiceInternal;
-
-    @javax.inject.Inject
-    TranslationService translationService;
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/786e882a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/message/MessageServiceNoop.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/message/MessageServiceNoop.java
b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/message/MessageServiceNoop.java
new file mode 100644
index 0000000..2b2037c
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/message/MessageServiceNoop.java
@@ -0,0 +1,69 @@
+/*
+ *  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.metamodel.services.message;
+
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.services.i18n.TranslatableString;
+import org.apache.isis.applib.services.message.MessageService;
+
+@DomainService(
+        nature = NatureOfService.DOMAIN,
+        menuOrder = "" + Integer.MAX_VALUE
+)
+public class MessageServiceNoop implements MessageService {
+
+    @Override
+    public void informUser(final String message) {
+        throw new UnsupportedOperationException("Not supported by this implementation of
RuntimeContext");
+    }
+
+    @Override
+    public String informUser(
+            final TranslatableString message,
+            final Class<?> contextClass,
+            final String contextMethod) {
+        throw new UnsupportedOperationException("Not supported by this implementation of
RuntimeContext");
+    }
+
+    @Override
+    public void warnUser(final String message) {
+        throw new UnsupportedOperationException("Not supported by this implementation of
RuntimeContext");
+    }
+
+    @Override public String warnUser(
+            final TranslatableString message,
+            final Class<?> contextClass,
+            final String contextMethod) {
+        throw new UnsupportedOperationException("Not supported by this implementation of
RuntimeContext");
+    }
+
+    @Override
+    public void raiseError(final String message) {
+        throw new UnsupportedOperationException("Not supported by this implementation of
RuntimeContext");
+    }
+
+    @Override public String raiseError(
+            final TranslatableString message,
+            final Class<?> contextClass,
+            final String contextMethod) {
+        throw new UnsupportedOperationException("Not supported by this implementation of
RuntimeContext");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/786e882a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/msgbroker/MessageBrokerServiceInternal.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/msgbroker/MessageBrokerServiceInternal.java
b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/msgbroker/MessageBrokerServiceInternal.java
deleted file mode 100644
index 6d96010..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/msgbroker/MessageBrokerServiceInternal.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- *  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.metamodel.services.msgbroker;
-
-import org.apache.isis.applib.annotation.Programmatic;
-
-/**
- * TODO: combine with MessageService
- */
-public interface MessageBrokerServiceInternal {
-
-    /**
-     * Provided by <tt>MessageBroker</tt> when used by framework.
-     *
-     * <p>
-     * Called by <tt>DomainObjectContainerDefault</tt>.
-     */
-    @Programmatic
-    void informUser(String message);
-
-    /**
-     * Provided by <tt>MessageBroker</tt> when used by framework.
-     *
-     * <p>
-     * Called by <tt>DomainObjectContainerDefault</tt>.
-     */
-    @Programmatic
-    void warnUser(String message);
-
-    /**
-     * Provided by <tt>MessageBroker</tt> when used by framework.
-     *
-     * <p>
-     * Called by <tt>DomainObjectContainerDefault</tt>.
-     */
-    @Programmatic
-    void raiseError(String message);
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/786e882a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/msgbroker/MessageBrokerServiceInternalNoop.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/msgbroker/MessageBrokerServiceInternalNoop.java
b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/msgbroker/MessageBrokerServiceInternalNoop.java
deleted file mode 100644
index 3ef1602..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/msgbroker/MessageBrokerServiceInternalNoop.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  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.metamodel.services.msgbroker;
-
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.NatureOfService;
-
-@DomainService(
-        nature = NatureOfService.DOMAIN,
-        menuOrder = "" + Integer.MAX_VALUE
-)
-public class MessageBrokerServiceInternalNoop implements MessageBrokerServiceInternal {
-
-    @Override
-    public void informUser(final String message) {
-        throw new UnsupportedOperationException("Not supported by this implementation of
RuntimeContext");
-    }
-
-    @Override
-    public void warnUser(final String message) {
-        throw new UnsupportedOperationException("Not supported by this implementation of
RuntimeContext");
-    }
-
-    @Override
-    public void raiseError(final String message) {
-        throw new UnsupportedOperationException("Not supported by this implementation of
RuntimeContext");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/786e882a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/specloader/SpecificationLoaderTestAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/specloader/SpecificationLoaderTestAbstract.java
b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/specloader/SpecificationLoaderTestAbstract.java
index c9b986e..3d6e4b6 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/specloader/SpecificationLoaderTestAbstract.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/specloader/SpecificationLoaderTestAbstract.java
@@ -30,6 +30,7 @@ import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
 import org.apache.isis.applib.services.grid.GridService;
+import org.apache.isis.applib.services.message.MessageService;
 import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
 import org.apache.isis.core.commons.config.IsisConfigurationDefault;
 import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
@@ -44,7 +45,6 @@ import org.apache.isis.core.metamodel.layoutmetadata.LayoutMetadataReader;
 import org.apache.isis.core.metamodel.layoutmetadata.json.LayoutMetadataReaderFromJson;
 import org.apache.isis.core.metamodel.metamodelvalidator.dflt.MetaModelValidatorDefault;
 import org.apache.isis.core.metamodel.services.ServicesInjector;
-import org.apache.isis.core.metamodel.services.msgbroker.MessageBrokerServiceInternal;
 import org.apache.isis.core.metamodel.services.persistsession.PersistenceSessionServiceInternal;
 import org.apache.isis.core.metamodel.services.transtate.TransactionStateProviderInternal;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -71,7 +71,7 @@ public abstract class SpecificationLoaderTestAbstract {
     @Mock
     private TransactionStateProviderInternal mockTransactionStateProviderInternal;
     @Mock
-    private MessageBrokerServiceInternal mockMessageBrokerServiceInternal;
+    private MessageService mockMessageService;
 
     ServicesInjector stubServicesInjector;
     IsisConfigurationDefault stubConfiguration;
@@ -92,7 +92,7 @@ public abstract class SpecificationLoaderTestAbstract {
 
             ignoring(mockPersistenceSessionServiceInternal);
             ignoring(mockTransactionStateProviderInternal);
-            ignoring(mockMessageBrokerServiceInternal);
+            ignoring(mockMessageService);
 
         }});
 
@@ -105,7 +105,7 @@ public abstract class SpecificationLoaderTestAbstract {
                         stubConfiguration,
                         mockDeploymentCategoryProvider,
                         mockPersistenceSessionServiceInternal,
-                        mockMessageBrokerServiceInternal,
+                            mockMessageService,
                         mockTransactionStateProviderInternal,
                         mockGridService,
                         mockDeploymentCategoryProvider),

http://git-wip-us.apache.org/repos/asf/isis/blob/786e882a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/msgbroker/MessageBrokerServiceInternalDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/msgbroker/MessageBrokerServiceInternalDefault.java
b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/msgbroker/MessageBrokerServiceInternalDefault.java
deleted file mode 100644
index 3a62663..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/msgbroker/MessageBrokerServiceInternalDefault.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  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.msgbroker;
-
-import org.apache.isis.applib.RecoverableException;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.core.commons.authentication.MessageBroker;
-import org.apache.isis.core.metamodel.services.msgbroker.MessageBrokerServiceInternal;
-import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
-
-@DomainService(
-        nature = NatureOfService.DOMAIN,
-        menuOrder = "" + (Integer.MAX_VALUE - 1)  // ie before the Noop impl in metamodel
-)
-public class MessageBrokerServiceInternalDefault implements MessageBrokerServiceInternal
{
-
-    @Override
-    public void informUser(final String message) {
-        getMessageBroker().addMessage(message);
-    }
-
-    @Override
-    public void warnUser(final String message) {
-        getMessageBroker().addWarning(message);
-    }
-
-    @Override
-    public void raiseError(final String message) {
-        throw new RecoverableException(message);
-    }
-
-
-    private MessageBroker getMessageBroker() {
-        return isisSessionFactory.getCurrentSession().getAuthenticationSession().getMessageBroker();
-    }
-
-    @javax.inject.Inject
-    IsisSessionFactory isisSessionFactory;
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/786e882a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/msgbroker/MessageServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/msgbroker/MessageServiceDefault.java
b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/msgbroker/MessageServiceDefault.java
new file mode 100644
index 0000000..60ff03e
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/msgbroker/MessageServiceDefault.java
@@ -0,0 +1,94 @@
+/*
+ *  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.msgbroker;
+
+import org.apache.isis.applib.RecoverableException;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.services.i18n.TranslatableString;
+import org.apache.isis.applib.services.i18n.TranslationService;
+import org.apache.isis.applib.services.message.MessageService;
+import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
+
+@DomainService(
+        nature = NatureOfService.DOMAIN,
+        menuOrder = "" + (Integer.MAX_VALUE - 1)  // ie before the Noop impl in metamodel
+)
+public class MessageServiceDefault implements MessageService {
+
+    @Override
+    public void informUser(final String message) {
+        getMessageBroker().addMessage(message);
+    }
+
+    @Override
+    public String informUser(
+            final TranslatableString message,
+            final Class<?> contextClass,
+            final String contextMethod) {
+        String translatedMessage = message.translate(translationService, context(contextClass,
contextMethod));
+        informUser(translatedMessage);
+        return translatedMessage;
+    }
+
+    @Override
+    public void warnUser(final String message) {
+        getMessageBroker().addWarning(message);
+    }
+
+    @Override
+    public String warnUser(
+            final TranslatableString message,
+            final Class<?> contextClass,
+            final String contextMethod) {
+        String translatedMessage = message.translate(translationService, context(contextClass,
contextMethod));
+        warnUser(translatedMessage);
+        return translatedMessage;
+    }
+
+    @Override
+    public void raiseError(final String message) {
+        throw new RecoverableException(message);
+    }
+
+    @Override public String raiseError(
+            final TranslatableString message,
+            final Class<?> contextClass,
+            final String contextMethod) {
+        final String translatedMessage = message.translate(translationService, context(contextClass,
contextMethod));
+        raiseError(translatedMessage);
+        return translatedMessage;
+    }
+
+    private static String context(final Class<?> contextClass, final String contextMethod)
{
+        return contextClass.getName()+"#"+contextMethod;
+    }
+
+    private MessageBroker getMessageBroker() {
+        return isisSessionFactory.getCurrentSession().getAuthenticationSession().getMessageBroker();
+    }
+
+    @javax.inject.Inject
+    IsisSessionFactory isisSessionFactory;
+
+    @javax.inject.Inject
+    TranslationService translationService;
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/786e882a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
index a4e6981..6ff9184 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
@@ -39,7 +39,6 @@ import org.datanucleus.enhancement.Persistable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.isis.applib.RecoverableException;
 import org.apache.isis.applib.annotation.Bulk;
 import org.apache.isis.applib.query.Query;
 import org.apache.isis.applib.services.bookmark.Bookmark;
@@ -70,7 +69,6 @@ import org.apache.isis.core.commons.util.ToString;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
 import org.apache.isis.core.metamodel.adapter.oid.ParentedCollectionOid;
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
@@ -100,7 +98,6 @@ import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
 import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
 import org.apache.isis.core.metamodel.services.ServicesInjector;
 import org.apache.isis.core.metamodel.services.container.query.QueryCardinality;
-import org.apache.isis.core.metamodel.services.msgbroker.MessageBrokerServiceInternal;
 import org.apache.isis.core.metamodel.spec.FreeStandingList;
 import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -151,14 +148,11 @@ public class PersistenceSession implements
         TransactionalResource,
         SessionScopedComponent,
         AdapterManager,
-        MessageBrokerServiceInternal,
         IsisLifecycleListener2.PersistenceSessionLifecycleManagement {
 
     //region > constants
     private static final Logger LOG = LoggerFactory.getLogger(PersistenceSession.class);
 
-    private final static OidMarshaller OID_MARSHALLER = OidMarshaller.INSTANCE;
-
     /**
      * @see #isFixturesInstalled()
      */
@@ -2334,21 +2328,6 @@ public class PersistenceSession implements
         return getTransactionManager().flushTransaction();
     }
 
-    @Override
-    public void informUser(final String message) {
-        getCurrentTransaction().getMessageBroker().addMessage(message);
-    }
-
-    @Override
-    public void warnUser(final String message) {
-        getCurrentTransaction().getMessageBroker().addWarning(message);
-    }
-
-    @Override
-    public void raiseError(final String message) {
-        throw new RecoverableException(message);
-    }
-
 
     //endregion
 

http://git-wip-us.apache.org/repos/asf/isis/blob/786e882a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/ObjectActionLayoutXmlDefaultTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/ObjectActionLayoutXmlDefaultTest.java
b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/ObjectActionLayoutXmlDefaultTest.java
index 29161b0..a84496d 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/ObjectActionLayoutXmlDefaultTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/ObjectActionLayoutXmlDefaultTest.java
@@ -28,6 +28,7 @@ import org.junit.Rule;
 import org.junit.Test;
 
 import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.services.message.MessageService;
 import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
 import org.apache.isis.core.commons.config.IsisConfigurationDefault;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
@@ -35,7 +36,6 @@ import org.apache.isis.core.metamodel.facets.FacetedMethod;
 import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
 import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract;
 import org.apache.isis.core.metamodel.services.ServicesInjector;
-import org.apache.isis.core.metamodel.services.msgbroker.MessageBrokerServiceInternal;
 import org.apache.isis.core.metamodel.services.persistsession.PersistenceSessionServiceInternal;
 import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
 import org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionDefault;
@@ -65,7 +65,7 @@ public class ObjectActionLayoutXmlDefaultTest {
     @Mock
     private AdapterManager mockAdapterManager;
     @Mock
-    private MessageBrokerServiceInternal mockMessageBrokerServiceInternal;
+    private MessageService mockMessageService;
     @Mock
     private PersistenceSessionServiceInternal mockPersistenceSessionServiceInternal;
 
@@ -82,7 +82,7 @@ public class ObjectActionLayoutXmlDefaultTest {
                         mockAuthenticationSessionProvider,
                         mockSpecificationLoader,
                         mockPersistenceSessionServiceInternal,
-                        mockMessageBrokerServiceInternal), stubConfiguration);
+                        mockMessageService), stubConfiguration);
 
         context.checking(new Expectations() {
             {

http://git-wip-us.apache.org/repos/asf/isis/blob/786e882a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/OneToManyAssociationDefaultTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/OneToManyAssociationDefaultTest.java
b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/OneToManyAssociationDefaultTest.java
index 70d1904..2dc326f 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/OneToManyAssociationDefaultTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/OneToManyAssociationDefaultTest.java
@@ -28,6 +28,7 @@ import org.junit.Rule;
 import org.junit.Test;
 
 import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.services.message.MessageService;
 import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
 import org.apache.isis.core.commons.config.IsisConfigurationDefault;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -37,7 +38,6 @@ import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
 import org.apache.isis.core.metamodel.facets.collections.modify.CollectionAddToFacet;
 import org.apache.isis.core.metamodel.facets.propcoll.notpersisted.NotPersistedFacet;
 import org.apache.isis.core.metamodel.services.ServicesInjector;
-import org.apache.isis.core.metamodel.services.msgbroker.MessageBrokerServiceInternal;
 import org.apache.isis.core.metamodel.services.persistsession.PersistenceSessionServiceInternal;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
@@ -74,7 +74,7 @@ public class OneToManyAssociationDefaultTest {
     @Mock
     private SpecificationLoader mockSpecificationLoader;
     @Mock
-    private MessageBrokerServiceInternal mockMessageBrokerServiceInternal;
+    private MessageService mockMessageService;
     @Mock
     private PersistenceSessionServiceInternal mockPersistenceSessionServiceInternal;
     @Mock
@@ -96,7 +96,7 @@ public class OneToManyAssociationDefaultTest {
         stubServicesInjector = new ServicesInjector(Lists.newArrayList(
                 mockAuthenticationSessionProvider,
                 mockSpecificationLoader,
-                mockMessageBrokerServiceInternal,
+                mockMessageService,
                 mockPersistenceSessionServiceInternal), stubConfiguration);
 
         allowingPeerToReturnCollectionType();

http://git-wip-us.apache.org/repos/asf/isis/blob/786e882a/core/wrapper/src/test/java/org/apache/isis/core/wrapper/WrapperFactoryDefaultTest_wrappedObject.java
----------------------------------------------------------------------
diff --git a/core/wrapper/src/test/java/org/apache/isis/core/wrapper/WrapperFactoryDefaultTest_wrappedObject.java
b/core/wrapper/src/test/java/org/apache/isis/core/wrapper/WrapperFactoryDefaultTest_wrappedObject.java
index acb93f8..45f226a 100644
--- a/core/wrapper/src/test/java/org/apache/isis/core/wrapper/WrapperFactoryDefaultTest_wrappedObject.java
+++ b/core/wrapper/src/test/java/org/apache/isis/core/wrapper/WrapperFactoryDefaultTest_wrappedObject.java
@@ -31,6 +31,7 @@ import org.junit.rules.ExpectedException;
 
 import org.apache.isis.applib.services.command.Command;
 import org.apache.isis.applib.services.command.CommandContext;
+import org.apache.isis.applib.services.message.MessageService;
 import org.apache.isis.applib.services.wrapper.DisabledException;
 import org.apache.isis.applib.services.wrapper.HiddenException;
 import org.apache.isis.applib.services.wrapper.InvalidException;
@@ -53,7 +54,6 @@ import org.apache.isis.core.metamodel.facets.properties.update.modify.PropertySe
 import org.apache.isis.core.metamodel.facets.properties.validating.method.PropertyValidateFacetViaMethod;
 import org.apache.isis.core.metamodel.services.ServicesInjector;
 import org.apache.isis.core.metamodel.services.command.CommandDtoServiceInternal;
-import org.apache.isis.core.metamodel.services.msgbroker.MessageBrokerServiceInternal;
 import org.apache.isis.core.metamodel.services.persistsession.PersistenceSessionServiceInternal;
 import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
@@ -88,7 +88,7 @@ public class WrapperFactoryDefaultTest_wrappedObject {
     @Mock
     private PersistenceSessionServiceInternal mockPersistenceSessionServiceInternal;
     @Mock
-    private MessageBrokerServiceInternal mockMessageBrokerServiceInternal;
+    private MessageService mockMessageService;
     @Mock
     private ServicesInjector mockServicesInjector;
     @Mock


Mime
View raw message