You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2019/01/24 12:02:35 UTC

[isis] branch 2033-IoC updated: ISIS-2033: throws away request scoped ScratchPad service

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

ahuber pushed a commit to branch 2033-IoC
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/2033-IoC by this push:
     new f34f0b0  ISIS-2033: throws away request scoped ScratchPad service
f34f0b0 is described below

commit f34f0b0b5a729bfdd70a1c5590598a83ab04591a
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu Jan 24 13:02:28 2019 +0100

    ISIS-2033: throws away request scoped ScratchPad service
    
    Task-Url: https://issues.apache.org/jira/browse/ISIS-2033
---
 .../applib/services/scratchpad/Scratchpad.java     | 76 ----------------------
 .../applib/services/scratchpad/package-info.java   | 26 --------
 .../org/apache/isis/config/AppConfigLocator.java   |  7 +-
 3 files changed, 5 insertions(+), 104 deletions(-)

diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/scratchpad/Scratchpad.java b/core/applib/src/main/java/org/apache/isis/applib/services/scratchpad/Scratchpad.java
deleted file mode 100644
index 4a66430..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/services/scratchpad/Scratchpad.java
+++ /dev/null
@@ -1,76 +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.applib.services.scratchpad;
-
-import java.util.Map;
-
-import javax.enterprise.context.RequestScoped;
-
-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.commons.internal.collections._Maps;
-
-/**
- * This service (API and implementation) provides a mechanism to interchange information between multiple objects invoked in the same
- * interaction.  Most commonly this will be as the result of invoking a {@link org.apache.isis.applib.annotation.Bulk}
- * action.
- *
- * <p>
- * This implementation has only one implementation (this class) in applib, so it is annotated with
- * {@link org.apache.isis.applib.annotation.DomainService}.  This means that it is automatically registered and
- * available for use; no further configuration is required.
- */
-@DomainService(
-        nature = NatureOfService.DOMAIN,
-        menuOrder = "" + Integer.MAX_VALUE
-        )
-@RequestScoped
-public class Scratchpad {
-
-    /**
-     * Provides a mechanism for each object being acted upon to pass
-     * data to the next object.
-     */
-    private final Map<Object, Object> userData = _Maps.newHashMap();
-
-    /**
-     * Obtain user-data, as set by a previous object being acted upon.
-     */
-    @Programmatic
-    public Object get(Object key) {
-        return userData.get(key);
-    }
-    /**
-     * Set user-data, for the use of a subsequent object being acted upon.
-     */
-    @Programmatic
-    public void put(Object key, Object value) {
-        userData.put(key, value);
-    }
-
-    /**
-     * Clear any user data.
-     */
-    @Programmatic
-    public void clear() {
-        userData.clear();
-    }
-
-}
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/scratchpad/package-info.java b/core/applib/src/main/java/org/apache/isis/applib/services/scratchpad/package-info.java
deleted file mode 100644
index b121297..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/services/scratchpad/package-info.java
+++ /dev/null
@@ -1,26 +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.
- */
-
-/**
- * The {@link org.apache.isis.applib.services.scratchpad.Scratchpad} (request-scoped) domain service allows objects to
- * exchange information even if they do not directly call each other.
- *
- * @see <a href="http://isis.apache.org/guides/rgsvc/rgsvc.html#_rgsvc_core-domain-api_Scratchpad">Reference guide</a>
- */
-package org.apache.isis.applib.services.scratchpad;
\ No newline at end of file
diff --git a/core/config/src/main/java/org/apache/isis/config/AppConfigLocator.java b/core/config/src/main/java/org/apache/isis/config/AppConfigLocator.java
index 9788ece..980f852 100644
--- a/core/config/src/main/java/org/apache/isis/config/AppConfigLocator.java
+++ b/core/config/src/main/java/org/apache/isis/config/AppConfigLocator.java
@@ -19,6 +19,7 @@
 package org.apache.isis.config;
 
 import java.util.HashSet;
+import java.util.NoSuchElementException;
 import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -101,13 +102,15 @@ public final class AppConfigLocator {
 			try {
 				val type = _Context.loadClassAndInitialize(serviceClassName);
 				
-				_CDI.getSingleton(type);
+				if(!_CDI.getManagedBean(type).isPresent()) {
+					throw new NoSuchElementException(serviceClassName);
+				};
 				
 				probeSanity.println("%s ... managed by CDI", type.getSimpleName());
 				managedTypes.add(serviceClassName);
 				
 			} catch (Exception e) {
-				probeSanity.println("*%s ... failed to resolve bean '%s' cause: %s",
+				probeSanity.println("!!%s ... failed to resolve bean '%s' cause: %s",
 						serviceClassName.substring(1+serviceClassName.lastIndexOf(".")),
 						serviceClassName, 
 						e.getMessage());