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 2020/01/13 21:40:01 UTC

[isis] 05/05: ISIS-2062: sync adoc, 'Incubator Catalog' -> 'Incubator'

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

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

commit 65cde223eeb0d72e01b6ef269eaa51e9edbf8d5c
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Jan 13 20:49:04 2020 +0000

    ISIS-2062: sync adoc, 'Incubator Catalog' -> 'Incubator'
---
 .../components/toc/modules/ROOT/pages/about.adoc   |   4 +-
 .../ROOT/pages/landing-page/components.adoc        |   2 +-
 .../modules/ROOT/pages/landing-page/guides.adoc    |   2 +-
 antora/playbooks/site-core.yml                     |   2 +-
 antora/playbooks/site.yml                          |   4 +-
 .../exceprecog/ExceptionRecognizerComposite.java   | 178 ---------------------
 .../exceprecog/ExceptionRecognizerService.java     |  60 +++++++
 preview.sh                                         |   1 +
 scripts/ci/build-site.sh                           |   5 +
 9 files changed, 73 insertions(+), 185 deletions(-)

diff --git a/antora/components/toc/modules/ROOT/pages/about.adoc b/antora/components/toc/modules/ROOT/pages/about.adoc
index 343d339..3956a05 100644
--- a/antora/components/toc/modules/ROOT/pages/about.adoc
+++ b/antora/components/toc/modules/ROOT/pages/about.adoc
@@ -129,8 +129,8 @@ _Academia_
 
 _More Libraries_
 
-*  xref:incubator:ROOT:about.adoc[Incubator Catalog]
-*  xref:legacy:ROOT:about.adoc[Legacy Catalog]
+*  xref:incubator:ROOT:about.adoc[Incubator]
+*  xref:legacy:ROOT:about.adoc[Legacy]
 
 
 _Analysis_
diff --git a/antora/components/toc/modules/ROOT/pages/landing-page/components.adoc b/antora/components/toc/modules/ROOT/pages/landing-page/components.adoc
index 34bccbc..b7a09ab 100644
--- a/antora/components/toc/modules/ROOT/pages/landing-page/components.adoc
+++ b/antora/components/toc/modules/ROOT/pages/landing-page/components.adoc
@@ -36,6 +36,6 @@ The xref:extensions:ROOT:about.adoc[Extensions Catalog] describes a number of ex
 
 For example, the "Excel Download" extension allows collections to be downloaded as an Excel `.xlsx` spreadsheet in the Wicket viewer.
 
-As well as the current extensions,  the xref:incubator:ROOT:about.adoc[Incubator Catalog] has additional extensions that may end up graduating to the extensions catalog, while the xref:legacy:ROOT:about.adoc[Legacy Catalog] may contain extensions that have been deprecated and are on the way out.
+As well as the current extensions,  the xref:incubator:ROOT:about.adoc[Incubator] has additional extensions that may end up graduating to the extensions catalog, while the xref:legacy:ROOT:about.adoc[Legacy Catalog] may contain extensions that have been deprecated and are on the way out.
 
 
diff --git a/antora/components/toc/modules/ROOT/pages/landing-page/guides.adoc b/antora/components/toc/modules/ROOT/pages/landing-page/guides.adoc
index 4e087f0..4a5f6da 100644
--- a/antora/components/toc/modules/ROOT/pages/landing-page/guides.adoc
+++ b/antora/components/toc/modules/ROOT/pages/landing-page/guides.adoc
@@ -42,7 +42,7 @@ Some/many of these libraries are for code hosted outside of the Apache Isis appl
 Others are SPIs that are called by the framework implicitly rather than by your domain logic directly.
 
 
-As well as the current libraries, the xref:incubator:ROOT:about.adoc[Incubator Catalog] may have additional libraries that may end up graduating to the extensions catalog, while the xref:legacy:ROOT:about.adoc[Legacy Catalog] may contain libraries that have been deprecated and are on the way out.
+As well as the current libraries, the xref:incubator:ROOT:about.adoc[Incubator] may have additional libraries that may end up graduating to the extensions catalog, while the xref:legacy:ROOT:about.adoc[Legacy Catalog] may contain libraries that have been deprecated and are on the way out.
 
 == Resources
 
diff --git a/antora/playbooks/site-core.yml b/antora/playbooks/site-core.yml
index 5884839..0ce89f2 100644
--- a/antora/playbooks/site-core.yml
+++ b/antora/playbooks/site-core.yml
@@ -32,7 +32,7 @@ content:
       start_path: core/runtime/src/main/adoc # core
       branches: HEAD
     - url: .
-      start_path: core/runtimeservices/src/main/doc # core
+      start_path: core/runtimeservices/src/main/adoc # core
       branches: HEAD
     - url: .
       start_path: core/webapp/src/main/adoc # core
diff --git a/antora/playbooks/site.yml b/antora/playbooks/site.yml
index 59d248a..dffc82a 100644
--- a/antora/playbooks/site.yml
+++ b/antora/playbooks/site.yml
@@ -76,7 +76,7 @@ content:
       start_path: core/runtime/src/main/adoc # core
       branches: HEAD
     - url: .
-      start_path: core/runtimeservices/src/main/doc # core
+      start_path: core/runtimeservices/src/main/adoc # core
       branches: HEAD
     - url: .
       start_path: core/webapp/src/main/adoc # core
@@ -129,7 +129,7 @@ content:
       start_path: incubator/core/model/src/main/adoc # incubator
       branches: HEAD
     - url: .
-      start_path: incubator/mappings/microprofile/src/main/doc # incubator
+      start_path: incubator/mappings/microprofile/src/main/adoc # incubator
       branches: HEAD
 
 # legacy
diff --git a/api/applib/src/main/adoc/modules/applib-svc/examples/services/exceprecog/ExceptionRecognizerComposite.java b/api/applib/src/main/adoc/modules/applib-svc/examples/services/exceprecog/ExceptionRecognizerComposite.java
deleted file mode 100644
index d8ef200..0000000
--- a/api/applib/src/main/adoc/modules/applib-svc/examples/services/exceprecog/ExceptionRecognizerComposite.java
+++ /dev/null
@@ -1,178 +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.exceprecog;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Stream;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.applib.services.inject.ServiceInjector;
-import org.apache.isis.applib.services.registry.ServiceRegistry;
-import org.apache.isis.core.commons.internal.collections._Lists;
-
-/**
- * Convenience implementation of {@link ExceptionRecognizer} that loops through a list of
- * {@link #add(ExceptionRecognizer) registered} services.
- *
- * <p>
- * Note that the framework <i>does</i> allow multiple {@link ExceptionRecognizer service}s
- * to be registered in <tt>isis.properties</tt>, and each will be consulted in turn.  Therefore
- * it is not necessary to use this class to register more than one such service.  However,
- * it may be useful to use to treat a group of similar exceptions as a single unit.  For example,
- * the <i>JDO object store</i> (in its applib) provides a set of {@link ExceptionRecognizer} to
- * recognize various types of constraint violations.  These are grouped together as a single
- * set through the use of this class.
- */
-public class ExceptionRecognizerComposite implements ExceptionRecognizer {
-
-    private final List<ExceptionRecognizer> exceptionRecognizers = _Lists.newArrayList();
-
-    public ExceptionRecognizerComposite(final ExceptionRecognizer... exceptionRecognizers) {
-        this(Arrays.asList(exceptionRecognizers));
-    }
-
-    public ExceptionRecognizerComposite(final List<? extends ExceptionRecognizer> exceptionRecognizers) {
-        for (final ExceptionRecognizer er : exceptionRecognizers) {
-            add(er);
-        }
-    }
-
-    public ExceptionRecognizerComposite(final Stream<? extends ExceptionRecognizer> exceptionRecognizers) {
-        exceptionRecognizers.forEach(this::add);
-    }
-
-    /**
-     * Register an {@link ExceptionRecognizer} to be consulted when
-     * {@link #recognize(Throwable)} is called.
-     *
-     * <p>
-     * The most specific {@link ExceptionRecognizer recognizer}s should be registered
-     * before the more general ones.  See the <i>JDO object store</i> applib for
-     * an example.
-     */
-    @Programmatic
-    public final void add(final ExceptionRecognizer ers) {
-        exceptionRecognizers.add(ers);
-    }
-
-    /**
-     * Returns the non-<tt>null</tt> message of the first {@link #add(ExceptionRecognizer) add}ed
-     * {@link ExceptionRecognizer service} that recognizes the exception.
-     */
-    @Override
-    @Programmatic
-    public final String recognize(final Throwable ex) {
-        for (final ExceptionRecognizer ers : exceptionRecognizers) {
-            final String message = ers.recognize(ex);
-            if(message != null) {
-                return message;
-            }
-        }
-        return null;
-    }
-
-
-    /**
-     * Returns the non-<tt>null</tt> recognition of the first {@link #add(ExceptionRecognizer) add}ed
-     * {@link org.apache.isis.applib.services.exceprecog.ExceptionRecognizer}.
-     *
-     * <p>
-     *     If none recognize the exception, then falls back to using {@link #recognize(Throwable)}, returning a
-     *     {@link org.apache.isis.applib.services.exceprecog.ExceptionRecognizer.Recognition} with a
-     *     category of {@link org.apache.isis.applib.services.exceprecog.ExceptionRecognizer.Category#CLIENT_ERROR}.
-     * </p>
-     */
-    @Override
-    @Programmatic
-    public final Recognition recognize2(final Throwable ex) {
-        for (final ExceptionRecognizer ers : exceptionRecognizers) {
-            final Recognition recognition = ers.recognize2(ex);
-            if(recognition != null) {
-                return recognition;
-            }
-        }
-        // backward compatible so far as possible.
-        return Recognition.of(Category.OTHER, recognize(ex));
-    }
-
-    // //////////////////////////////////////
-
-    /**
-     * For recognizers already {@link #add(ExceptionRecognizer) add}ed, simply {@link #injectServices()} and {@link #initRecognizers(Map) initializes}.
-     *
-     * <p>
-     *     Typical usage:
-     * </p>
-     * <pre>
-     *    public void init() {
-     *        add(new ExceptionRecognizerForThisException());
-     *        add(new ExceptionRecognizerForThatException());
-     *        add(new ExceptionRecognizerForTheOtherException());
-     *        super.init();
-     *    }
-     * </pre>
-     *
-     */
-    @PostConstruct
-    @Override
-    @Programmatic
-    public void init() {
-        injectServices();
-        initRecognizers();
-    }
-
-    protected void injectServices() {
-        if(serviceRegistry != null) {
-            for (final ExceptionRecognizer ers : exceptionRecognizers) {
-                serviceInjector.injectServicesInto(ers);
-            }
-        }
-    }
-
-    protected void initRecognizers() {
-        for (final ExceptionRecognizer ers : exceptionRecognizers) {
-            ers.init();
-        }
-    }
-
-
-
-    @PreDestroy
-    @Override
-    @Programmatic
-    public void shutdown() {
-        for (final ExceptionRecognizer ers : exceptionRecognizers) {
-            ers.shutdown();
-        }
-    }
-
-    // //////////////////////////////////////
-
-    @Inject ServiceRegistry serviceRegistry;
-    @Inject ServiceInjector serviceInjector;
-    @Inject TranslationService translationService;
-
-}
diff --git a/api/applib/src/main/adoc/modules/applib-svc/examples/services/exceprecog/ExceptionRecognizerService.java b/api/applib/src/main/adoc/modules/applib-svc/examples/services/exceprecog/ExceptionRecognizerService.java
new file mode 100644
index 0000000..ed2ef57
--- /dev/null
+++ b/api/applib/src/main/adoc/modules/applib-svc/examples/services/exceprecog/ExceptionRecognizerService.java
@@ -0,0 +1,60 @@
+/*
+ *  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.exceprecog;
+
+import java.util.Optional;
+
+import org.apache.isis.applib.services.exceprecog.ExceptionRecognizer.Recognition;
+import org.apache.isis.core.commons.collections.Can;
+
+/**
+ * 
+ * @since 2.0
+ *
+ */
+public interface ExceptionRecognizerService {
+
+    /**
+     * 
+     * @return all ExceptionRecognizer implementations as discovered by the IoC container, 
+     * honoring order of precedence. 
+     */
+    Can<ExceptionRecognizer> getExceptionRecognizers();
+
+    /**
+     * Takes into consideration ExceptionRecognizers as given by {@link #getExceptionRecognizers()}.
+     * @param ex
+     * @return optionally a recognition object, that describes both the category and reason, 
+     * that will be included with the user-friendly message. 
+     */
+    default Optional<Recognition> recognize(Exception ex) {
+        return recognizeFromSelected(getExceptionRecognizers(), ex);
+    }
+
+    /**
+     * Takes into consideration ExceptionRecognizers as given by {@code recognizers}.
+     * @param recognizers
+     * @param ex
+     * @return optionally a recognition object, that describes both the category and reason, 
+     * that will be included with the user-friendly message. 
+     */
+    Optional<Recognition> recognizeFromSelected(Can<ExceptionRecognizer> recognizers, Exception ex);
+
+
+}
diff --git a/preview.sh b/preview.sh
index 725446e..ce91c72 100644
--- a/preview.sh
+++ b/preview.sh
@@ -40,6 +40,7 @@ sh build-site.sh $PLAYBOOK_FILE || exit 1
 
 if [[ "$SKIP_SERVE" == "true" ]]; then
   echo "skipping serving"
+  echo ""
 else
   echo ""
   echo "http://localhost:5000"
diff --git a/scripts/ci/build-site.sh b/scripts/ci/build-site.sh
index 936b04f..536a888df 100644
--- a/scripts/ci/build-site.sh
+++ b/scripts/ci/build-site.sh
@@ -11,6 +11,7 @@ bash $SCRIPT_DIR/_print-environment.sh "build-site"
 
 if [[ "$SKIP_EXAMPLES" == "true" ]]; then
   echo "skipping examples"
+  echo ""
 else
   bash $SCRIPT_DIR/_adoc-copy-examples.sh
 fi
@@ -18,6 +19,7 @@ fi
 
 if [[ "$SKIP_CONFIGS" == "true" ]]; then
   echo "skipping config generation"
+  echo ""
 else
   bash $SCRIPT_DIR/_adoc-gen-config.sh
 fi
@@ -25,6 +27,7 @@ fi
 
 if [ "$SKIP_STALE_EXAMPLE_CHECK" == "true" ]; then
   echo "skipping stale example check"
+  echo ""
 else
   WC=$(git status --porcelain | grep examples | wc -l)
   if [ "$WC" -ne "0" ]; then
@@ -36,10 +39,12 @@ fi
 
 if [ "$SKIP_GENERATION" == "true" ]; then
   echo "skipping building..."
+  echo ""
 else
   echo "building ..."
   bash $SCRIPT_DIR/_adoc-antora.sh $*
   echo "site built in ${SECONDS}s"
+  echo ""
 fi
 
 # add a marker, that tells github not to use jekyll on the github pages folder