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 2019/09/30 17:20:31 UTC

[isis] branch ISIS-2086 updated (ec620a5 -> b817f98)

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

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


    from ec620a5  ISIS-2086: converting web-modules to use new config-beans
     new c091454  ISIS-2086: refactors 'isis.authentication.shiro.autoLogoutIfAlreadyAuthenticated' to type-safe config
     new 37e390c  ISIS-2086: deletes Slf4jLogger
     new b5e437b  ISIS-2086: refactors 'isis.viewer.restfulobjects.honorUiHints' to type-safe config
     new b817f98  ISIS-2086: refactors 'isis.viewer.restfulobjects.XXX' (7 more of them) to type-safe config

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/config/IsisConfiguration.java  | 31 ++++----
 .../DomainServiceFacetAnnotationFactory.java       |  4 +-
 ...jectSpecIdFacetDerivedFromClassNameFactory.java |  2 +-
 .../isis/jdo/persistence/PersistenceSession5.java  |  2 +-
 .../persistence/objectstore/Slf4jLogger.java       | 90 ----------------------
 .../shiro/authentication/ShiroAuthenticator.java   | 13 ++--
 .../restfulobjects/server/ResourceContext.java     | 27 ++-----
 7 files changed, 36 insertions(+), 133 deletions(-)
 delete mode 100644 core/runtime/src/main/java/org/apache/isis/runtime/persistence/objectstore/Slf4jLogger.java


[isis] 03/04: ISIS-2086: refactors 'isis.viewer.restfulobjects.honorUiHints' to type-safe config

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

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

commit b5e437b0eeb2f8681721f10e46186a197409b0d9
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Sep 30 18:15:29 2019 +0100

    ISIS-2086: refactors 'isis.viewer.restfulobjects.honorUiHints' to type-safe config
---
 .../src/main/java/org/apache/isis/config/IsisConfiguration.java       | 1 +
 .../org/apache/isis/viewer/restfulobjects/server/ResourceContext.java | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/core/config/src/main/java/org/apache/isis/config/IsisConfiguration.java b/core/config/src/main/java/org/apache/isis/config/IsisConfiguration.java
index e507d13..aed92a7 100644
--- a/core/config/src/main/java/org/apache/isis/config/IsisConfiguration.java
+++ b/core/config/src/main/java/org/apache/isis/config/IsisConfiguration.java
@@ -424,6 +424,7 @@ public class IsisConfiguration {
         @Data
         public static class Restfulobjects {
             private String basePath = "/restful";
+            private boolean honorUiHints = false;
             private boolean strictAcceptChecking = false;
             private final Gsoc2013 gsoc2013 = new Gsoc2013();
             @Data
diff --git a/core/viewer-restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java b/core/viewer-restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
index a6bc036..05a00b2 100644
--- a/core/viewer-restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
+++ b/core/viewer-restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
@@ -218,8 +218,6 @@ public class ResourceContext extends RuntimeContextBase implements RendererConte
 
     // -- configuration settings
 
-    private static final boolean HONOR_UI_HINTS_DEFAULT = false;
-
     private static final boolean OBJECT_PROPERTY_VALUES_ONLY_DEFAULT = false;
 
     private static final boolean SUPPRESS_DESCRIBED_BY_LINKS_DEFAULT = false;
@@ -231,7 +229,7 @@ public class ResourceContext extends RuntimeContextBase implements RendererConte
 
     @Override
     public boolean honorUiHints() {
-        return getConfigurationLegacy().getBoolean("isis.viewer.restfulobjects.honorUiHints", HONOR_UI_HINTS_DEFAULT);
+        return getConfiguration().getViewer().getRestfulobjects().isHonorUiHints();
     }
 
     @Override


[isis] 04/04: ISIS-2086: refactors 'isis.viewer.restfulobjects.XXX' (7 more of them) to type-safe config

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

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

commit b817f98b7c501f06e0f43c629d20c632c2b51779
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Sep 30 18:20:12 2019 +0100

    ISIS-2086: refactors 'isis.viewer.restfulobjects.XXX' (7 more of them) to type-safe config
---
 .../org/apache/isis/config/IsisConfiguration.java  |  7 +++++++
 .../restfulobjects/server/ResourceContext.java     | 23 +++++++---------------
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/core/config/src/main/java/org/apache/isis/config/IsisConfiguration.java b/core/config/src/main/java/org/apache/isis/config/IsisConfiguration.java
index aed92a7..79d3517 100644
--- a/core/config/src/main/java/org/apache/isis/config/IsisConfiguration.java
+++ b/core/config/src/main/java/org/apache/isis/config/IsisConfiguration.java
@@ -425,7 +425,14 @@ public class IsisConfiguration {
         public static class Restfulobjects {
             private String basePath = "/restful";
             private boolean honorUiHints = false;
+            private boolean objectPropertyValuesOnly = false;
             private boolean strictAcceptChecking = false;
+            private boolean suppressDescribedByLinks = false;
+            private boolean suppressMemberDisabledReason = false;
+            private boolean suppressMemberExtensions = false;
+            private boolean suppressMemberId = false;
+            private boolean suppressMemberLinks = false;
+            private boolean suppressUpdateLink = false;
             private final Gsoc2013 gsoc2013 = new Gsoc2013();
             @Data
             public static class Gsoc2013 {
diff --git a/core/viewer-restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java b/core/viewer-restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
index 05a00b2..7f3c7b9 100644
--- a/core/viewer-restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
+++ b/core/viewer-restfulobjects/server/src/main/java/org/apache/isis/viewer/restfulobjects/server/ResourceContext.java
@@ -218,15 +218,6 @@ public class ResourceContext extends RuntimeContextBase implements RendererConte
 
     // -- configuration settings
 
-    private static final boolean OBJECT_PROPERTY_VALUES_ONLY_DEFAULT = false;
-
-    private static final boolean SUPPRESS_DESCRIBED_BY_LINKS_DEFAULT = false;
-    private static final boolean SUPPRESS_UPDATE_LINK_DEFAULT = false;
-    private static final boolean SUPPRESS_MEMBER_ID_DEFAULT = false;
-    private static final boolean SUPPRESS_MEMBER_LINKS_DEFAULT = false;
-    private static final boolean SUPPRESS_MEMBER_EXTENSIONS_DEFAULT = false;
-    private static final boolean SUPPRESS_MEMBER_DISABLED_REASON_DEFAULT = false;
-
     @Override
     public boolean honorUiHints() {
         return getConfiguration().getViewer().getRestfulobjects().isHonorUiHints();
@@ -234,37 +225,37 @@ public class ResourceContext extends RuntimeContextBase implements RendererConte
 
     @Override
     public boolean objectPropertyValuesOnly() {
-        return getConfigurationLegacy().getBoolean("isis.viewer.restfulobjects.objectPropertyValuesOnly", OBJECT_PROPERTY_VALUES_ONLY_DEFAULT);
+        return getConfiguration().getViewer().getRestfulobjects().isObjectPropertyValuesOnly();
     }
 
     @Override
     public boolean suppressDescribedByLinks() {
-        return getConfigurationLegacy().getBoolean("isis.viewer.restfulobjects.suppressDescribedByLinks", SUPPRESS_DESCRIBED_BY_LINKS_DEFAULT);
+        return getConfiguration().getViewer().getRestfulobjects().isSuppressDescribedByLinks();
     }
 
     @Override
     public boolean suppressUpdateLink() {
-        return getConfigurationLegacy().getBoolean("isis.viewer.restfulobjects.suppressUpdateLink", SUPPRESS_UPDATE_LINK_DEFAULT);
+        return getConfiguration().getViewer().getRestfulobjects().isSuppressUpdateLink();
     }
 
     @Override
     public boolean suppressMemberId() {
-        return getConfigurationLegacy().getBoolean("isis.viewer.restfulobjects.suppressMemberId", SUPPRESS_MEMBER_ID_DEFAULT);
+        return getConfiguration().getViewer().getRestfulobjects().isSuppressMemberId();
     }
 
     @Override
     public boolean suppressMemberLinks() {
-        return getConfigurationLegacy().getBoolean("isis.viewer.restfulobjects.suppressMemberLinks", SUPPRESS_MEMBER_LINKS_DEFAULT);
+        return getConfiguration().getViewer().getRestfulobjects().isSuppressMemberLinks();
     }
 
     @Override
     public boolean suppressMemberExtensions() {
-        return getConfigurationLegacy().getBoolean("isis.viewer.restfulobjects.suppressMemberExtensions", SUPPRESS_MEMBER_EXTENSIONS_DEFAULT);
+        return getConfiguration().getViewer().getRestfulobjects().isSuppressMemberExtensions();
     }
 
     @Override
     public boolean suppressMemberDisabledReason() {
-        return getConfigurationLegacy().getBoolean("isis.viewer.restfulobjects.suppressMemberDisabledReason", SUPPRESS_MEMBER_DISABLED_REASON_DEFAULT);
+        return getConfiguration().getViewer().getRestfulobjects().isSuppressMemberDisabledReason();
     }
 
     @Override


[isis] 02/04: ISIS-2086: deletes Slf4jLogger

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

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

commit 37e390cefba7ed6014e2cb930aedd683ca86c733
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Sep 30 18:13:33 2019 +0100

    ISIS-2086: deletes Slf4jLogger
    
    since unused; we have now moved over to log4j2.
---
 .../persistence/objectstore/Slf4jLogger.java       | 90 ----------------------
 1 file changed, 90 deletions(-)

diff --git a/core/runtime/src/main/java/org/apache/isis/runtime/persistence/objectstore/Slf4jLogger.java b/core/runtime/src/main/java/org/apache/isis/runtime/persistence/objectstore/Slf4jLogger.java
deleted file mode 100644
index f3914ec..0000000
--- a/core/runtime/src/main/java/org/apache/isis/runtime/persistence/objectstore/Slf4jLogger.java
+++ /dev/null
@@ -1,90 +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.runtime.persistence.objectstore;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public abstract class Slf4jLogger {
-
-    public static final String PROPERTY_ROOT = "isis.logging.";
-
-    enum LogLevel {
-        TRACE,
-        DEBUG,
-        INFO,
-        WARN,
-        ERROR,
-    }
-
-    private Logger logger;
-    private final LogLevel level;
-
-    public Slf4jLogger() {
-        this(LogLevel.DEBUG);
-    }
-
-    public Slf4jLogger(final String level) {
-        this(LogLevel.valueOf(level));
-    }
-
-    public Slf4jLogger(final LogLevel level) {
-        this.level = level;
-    }
-
-    protected abstract Class<?> getDecoratedClass();
-
-
-    protected void log(final String message) {
-        doLog(logger(), level, message);
-    }
-
-    protected void log(final String request, final Object result) {
-        log(request + "  -> " + result);
-    }
-
-    protected void doLog(Logger logger, LogLevel level, String format, Object... argArray) {
-        switch (level) {
-        case TRACE:
-            logger.trace(format, argArray);
-            break;
-        case DEBUG:
-            logger.debug(format, argArray);
-            break;
-        case INFO:
-            logger.info(format, argArray);
-            break;
-        case WARN:
-            logger.warn(format, argArray);
-            break;
-        case ERROR:
-            logger.error(format, argArray);
-            break;
-        }
-    }
-
-    private Logger logger() {
-        if (logger == null) {
-            logger = LoggerFactory.getLogger(getDecoratedClass());
-        }
-        return logger;
-    }
-}


[isis] 01/04: ISIS-2086: refactors 'isis.authentication.shiro.autoLogoutIfAlreadyAuthenticated' to type-safe config

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

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

commit c0914541b2e3d509bbec5508f4ed0fe0056f0df2
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Sep 30 18:12:34 2019 +0100

    ISIS-2086: refactors 'isis.authentication.shiro.autoLogoutIfAlreadyAuthenticated' to type-safe config
---
 .../org/apache/isis/config/IsisConfiguration.java  | 23 +++++++++-------------
 .../DomainServiceFacetAnnotationFactory.java       |  4 ++--
 ...jectSpecIdFacetDerivedFromClassNameFactory.java |  2 +-
 .../isis/jdo/persistence/PersistenceSession5.java  |  2 +-
 .../shiro/authentication/ShiroAuthenticator.java   | 13 ++++++------
 5 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/core/config/src/main/java/org/apache/isis/config/IsisConfiguration.java b/core/config/src/main/java/org/apache/isis/config/IsisConfiguration.java
index 0e2a720..e507d13 100644
--- a/core/config/src/main/java/org/apache/isis/config/IsisConfiguration.java
+++ b/core/config/src/main/java/org/apache/isis/config/IsisConfiguration.java
@@ -61,14 +61,21 @@ import org.springframework.stereotype.Component;
 @Data
 public class IsisConfiguration {
 
-
+    private final Authentication authentication = new Authentication();
+    @Data
+    public static class Authentication {
+        private final Shiro shiro = new Shiro();
+        @Data
+        public static class Shiro {
+            private boolean autoLogoutIfAlreadyAuthenticated = false;
+        }
+    }
     private final Objects objects = new Objects();
     @Data
     public static class Objects {
         private EditingObjectsConfiguration editing = EditingObjectsConfiguration.TRUE;
     }
 
-    // // isis.persistor.datanucleus
     private final Persistor persistor = new Persistor();
     @Data
     public static class Persistor {
@@ -298,18 +305,6 @@ public class IsisConfiguration {
     private final Service service = new Service();
     @Data
     public static class Service {
-        // isis.service.email.sender.username
-        // isis.service.email.sender.address
-        // isis.service.email.sender.password
-        // isis.service.email.sender.hostname
-        // isis.service.email.port
-        // isis.service.email.socketTimeout
-        // isis.service.email.socketConnectionTimeout
-        // isis.service.email.tls.enabled
-        // isis.service.email.throwExceptionOnFail
-        // isis.service.email.override.to
-        // isis.service.email.override.cc
-        // isis.service.email.override.bcc
         private final Email email = new Email();
         @Data
         public static class Email {
diff --git a/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotationFactory.java b/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotationFactory.java
index 6a8307a..8e96a67 100644
--- a/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotationFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/object/domainservice/annotation/DomainServiceFacetAnnotationFactory.java
@@ -82,7 +82,7 @@ implements MetaModelValidatorRefiner {
                     + " convert into a mixin (@Mixin annotation) instead",
                     cls.getName(),
                     natureOfService,
-                    "isis.reflector.validator.mixinsOnly");
+                    "'isis.reflector.validator.mixinsOnly'");
             
             mixinOnlyValidator.addFailure(Identifier.classIdentifier(cls), msg);
             break;
@@ -129,7 +129,7 @@ implements MetaModelValidatorRefiner {
                             thisSpec.getIdentifier(),
                             "%s: services can only have actions ('%s' config property), not properties or collections; annotate with @Programmatic if required.  Found: %s",
                             thisSpec.getFullIdentifier(),
-                            "isis.reflector.validator.serviceActionsOnly",
+                            "'isis.reflector.validator.serviceActionsOnly'",
                             associationNames);
                 }
             }));
diff --git a/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/object/objectspecid/classname/ObjectSpecIdFacetDerivedFromClassNameFactory.java b/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/object/objectspecid/classname/ObjectSpecIdFacetDerivedFromClassNameFactory.java
index f444091..0756f84 100644
--- a/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/object/objectspecid/classname/ObjectSpecIdFacetDerivedFromClassNameFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/metamodel/facets/object/objectspecid/classname/ObjectSpecIdFacetDerivedFromClassNameFactory.java
@@ -131,7 +131,7 @@ implements MetaModelValidatorRefiner, ObjectSpecIdFacetFactory {
                                             + "Use @Discriminator, @DomainObject(objectType=...) or "
                                             + "@PersistenceCapable(schema=...) to specify explicitly.",
                                     objectSpec.getFullIdentifier(),
-                                    "isis.reflector.validator.explicitObjectType");
+                                    "'isis.reflector.validator.explicitObjectType'");
                         }
                     }
 
diff --git a/core/plugins/jdo/datanucleus-5/src/main/java/org/apache/isis/jdo/persistence/PersistenceSession5.java b/core/plugins/jdo/datanucleus-5/src/main/java/org/apache/isis/jdo/persistence/PersistenceSession5.java
index 74fc8c1..58814e1 100644
--- a/core/plugins/jdo/datanucleus-5/src/main/java/org/apache/isis/jdo/persistence/PersistenceSession5.java
+++ b/core/plugins/jdo/datanucleus-5/src/main/java/org/apache/isis/jdo/persistence/PersistenceSession5.java
@@ -432,7 +432,7 @@ implements IsisLifecycleListener.PersistenceSessionLifecycleManagement {
      */
     private FixturesInstalledState initialStateFromConfig() {
         val installFixtures = configuration.getPersistor().getDatanucleus().isInstallFixtures();
-        log.info("isFixturesInstalled: {} = {}", "isis.persistor.datanucleus.install-fixtures", installFixtures);
+        log.info("isFixturesInstalled: {} = {}", "'isis.persistor.datanucleus.install-fixtures'", installFixtures);
 
         val objectStoreIsFixturesInstalled = !installFixtures;
         val initialStateFromConfig = objectStoreIsFixturesInstalled
diff --git a/core/security/shiro/src/main/java/org/apache/isis/security/shiro/authentication/ShiroAuthenticator.java b/core/security/shiro/src/main/java/org/apache/isis/security/shiro/authentication/ShiroAuthenticator.java
index 420609a..b5e92b4 100644
--- a/core/security/shiro/src/main/java/org/apache/isis/security/shiro/authentication/ShiroAuthenticator.java
+++ b/core/security/shiro/src/main/java/org/apache/isis/security/shiro/authentication/ShiroAuthenticator.java
@@ -23,6 +23,7 @@ import java.util.Collections;
 import java.util.Set;
 import java.util.stream.Stream;
 
+import org.apache.isis.config.IsisConfiguration;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authc.AuthenticationException;
 import org.apache.shiro.authc.AuthenticationInfo;
@@ -53,6 +54,8 @@ import static org.apache.isis.config.internal._Config.getConfiguration;
 
 import lombok.extern.log4j.Log4j2;
 
+import javax.inject.Inject;
+
 /**
  * If Shiro is configured for both {@link AuthenticationManagerInstaller authentication} and
  * {@link AuthorizationManagerInstaller authorization} (as recommended), then this class is
@@ -66,16 +69,14 @@ import lombok.extern.log4j.Log4j2;
 @Log4j2
 public class ShiroAuthenticator implements Authenticator {
 
-    private static final String ISIS_AUTHENTICATION_SHIRO_AUTO_LOGOUT_KEY = "isis.authentication.shiro.autoLogoutIfAlreadyAuthenticated";
-    private static final boolean ISIS_AUTHENTICATION_SHIRO_AUTO_LOGOUT_DEFAULT = false;
-
     // -- constructor and fields
     private final boolean autoLogout;
 
+    @Inject
+    IsisConfiguration configuration;
+
     public ShiroAuthenticator() {
-        autoLogout = getConfiguration().getBoolean(
-                ISIS_AUTHENTICATION_SHIRO_AUTO_LOGOUT_KEY,
-                ISIS_AUTHENTICATION_SHIRO_AUTO_LOGOUT_DEFAULT);
+        autoLogout = configuration.getAuthentication().getShiro().isAutoLogoutIfAlreadyAuthenticated();
     }
 
     // -- init, shutdown