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/02/15 10:25:34 UTC

[isis] branch 2033-IoC updated: ISIS-2033: minor debugging refinements

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 4d30a2c  ISIS-2033: minor debugging refinements
4d30a2c is described below

commit 4d30a2ce57d4ed28e1da14aca39b266ec6534805
Author: Andi Huber <ah...@apache.org>
AuthorDate: Fri Feb 15 11:25:28 2019 +0100

    ISIS-2033: minor debugging refinements
    
    Task-Url: https://issues.apache.org/jira/browse/ISIS-2033
---
 .../apache/isis/commons/internal/debug/_Probe.java |  19 +--
 .../PersistenceSessionServiceInternalNoop.java     | 151 ---------------------
 .../managers/builtin/ValueContextManager.java      |   5 +-
 .../wicket/model/models/EntityCollectionModel.java |   4 +-
 .../viewer/wicket/model/models/EntityModel.java    |   4 +-
 5 files changed, 20 insertions(+), 163 deletions(-)

diff --git a/core/commons/src/main/java/org/apache/isis/commons/internal/debug/_Probe.java b/core/commons/src/main/java/org/apache/isis/commons/internal/debug/_Probe.java
index fe04cb3..000ead5 100644
--- a/core/commons/src/main/java/org/apache/isis/commons/internal/debug/_Probe.java
+++ b/core/commons/src/main/java/org/apache/isis/commons/internal/debug/_Probe.java
@@ -160,6 +160,17 @@ public class _Probe {
     public void println(String format, Object...args) {
         println(currentIndent, format, args);
     }
+    
+    public void warnNotImplementedYet(String format, Object... args) {
+    	val warnMsg = String.format(format, args);
+    	val restore_out = out;
+    	out=System.err;
+    	println("WARN NotImplementedYet %s", warnMsg);
+    	errOut("-------------------------------------");
+    	_Exceptions.dumpStackTrace(System.err, 1, 12);
+    	errOut("-------------------------------------");
+    	out=restore_out;
+	}
 
     // -- CONVENIENT DEBUG TOOLS (STATIC)
 
@@ -170,14 +181,6 @@ public class _Probe {
     public static void errOut(String format, Object... args) {
         System.err.println(String.format(format, args));
     }
-    
-    public static void warnNotImplementedYet(String format, Object... args) {
-    	val warnMsg = String.format(format, args);
-    	errOut("WARN NotImplementedYet %s", warnMsg);
-    	errOut("-------------------------------------");
-    	_Exceptions.dumpStackTrace(System.err, 1, 12);
-    	errOut("-------------------------------------");
-	}
 
     // -- HELPER
     
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/persistsession/PersistenceSessionServiceInternalNoop.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/persistsession/PersistenceSessionServiceInternalNoop.java
deleted file mode 100644
index e04d836..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/persistsession/PersistenceSessionServiceInternalNoop.java
+++ /dev/null
@@ -1,151 +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.persistsession;
-
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.function.Supplier;
-
-import org.apache.isis.applib.query.Query;
-import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.applib.services.bookmark.BookmarkService;
-import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.applib.services.xactn.Transaction;
-import org.apache.isis.applib.services.xactn.TransactionState;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapterProvider;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-public abstract class PersistenceSessionServiceInternalNoop implements PersistenceSessionServiceInternal {
-
-    @Override
-    public ObjectAdapterProvider getObjectAdapterProvider() {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public ObjectAdapter createTransientInstance(final ObjectSpecification spec) {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public ObjectAdapter createViewModelInstance(ObjectSpecification spec, String memento) {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public Object lookup(
-            final Bookmark bookmark,
-            final BookmarkService.FieldResetPolicy fieldResetPolicy) {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public Bookmark bookmarkFor(Object domainObject) {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public Bookmark bookmarkFor(Class<?> cls, String identifier) {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public void resolve(final Object parent) {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public void beginTran() {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public void beginTran(final Command commandIfAny) {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public boolean flush() {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public void commit() {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public void abortTransaction() {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public void executeWithinTransaction(Runnable task) {
-        //[ahuber] was task.run();
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-    
-    @Override
-    public <T> T executeWithinTransaction(Supplier<T> task) {
-        //[ahuber] was return task.get();
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public Transaction currentTransaction() {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public CountDownLatch currentTransactionLatch() {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public void remove(final ObjectAdapter adapter) {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public void makePersistent(final ObjectAdapter adapter) {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public <T> ObjectAdapter firstMatchingQuery(final Query<T> query) {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public <T> List<ObjectAdapter> allMatchingQuery(final Query<T> query) {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-    @Override
-    public TransactionState getTransactionState() {
-        throw new UnsupportedOperationException("Not supported by this implementation of PersistenceSessionServiceInternal");
-    }
-
-
-
-
-
-
-}
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/managers/builtin/ValueContextManager.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/managers/builtin/ValueContextManager.java
index 7995529..ef14cdf 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/managers/builtin/ValueContextManager.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/managers/builtin/ValueContextManager.java
@@ -85,7 +85,7 @@ public class ValueContextManager implements ContextHandler {
 				objectUri);
 		
 		//FIXME [2033] we expect a base64 encoded memento container, but do get plaintext
-		_Probe.warnNotImplementedYet("we expect a base64 encoded memento container, "
+		probe.warnNotImplementedYet("we expect a base64 encoded memento container, "
 				+ "but do get plaintext here: '%s'", serialized);
 		
 //		if("String".equals(expectedType.getSimpleName())) {
@@ -150,7 +150,8 @@ public class ValueContextManager implements ContextHandler {
 			if(value instanceof Serializable) {
 				return (Serializable) value;
 			}
-			_Probe.warnNotImplementedYet("This SerializingAdapter can only handle values that are 'serializable'. Got '%s'.", ""+value);
+			probe.warnNotImplementedYet("This SerializingAdapter can only handle values that are 'serializable'. "
+					+ "Got '%s'.", ""+value);
 			
 			//throw _Exceptions.unrecoverable("This SerializingAdapter can only handle values that are 'serializable'.");
 			return null;
diff --git a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
index 420104b..227a353 100644
--- a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
+++ b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
@@ -75,6 +75,8 @@ UiHintContainer {
 
     private static final int PAGE_SIZE_DEFAULT_FOR_PARENTED = 12;
     private static final int PAGE_SIZE_DEFAULT_FOR_STANDALONE = 25;
+    
+    private final static _Probe probe = _Probe.unlimited().label("EntityCollectionModel");
 
     public enum Type {
         /**
@@ -108,7 +110,7 @@ UiHintContainer {
             }
             
             private Stream<ObjectAdapter> loadOneByOne(final EntityCollectionModel model) {
-            	_Probe.warnNotImplementedYet("We no longer access the PersistenceSession directly.");
+            	probe.warnNotImplementedYet("We no longer access the PersistenceSession directly.");
             	return loadInBulk(model);
             	
 //FIXME [2033] reinstate legacy behavior, or remove ?            	
diff --git a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
index ed0ad87..ba7d1fb 100644
--- a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
+++ b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
@@ -323,6 +323,8 @@ implements ObjectAdapterModel, UiHintContainer {
     // loadObject, load, setObject
     // //////////////////////////////////////////////////////////
 
+    private final static _Probe probe = _Probe.unlimited().label("EntityModel");
+    
     /**
      * Not Wicket API, but used by <tt>EntityPage</tt> to do eager loading
      * when rendering after post-and-redirect.
@@ -335,7 +337,7 @@ implements ObjectAdapterModel, UiHintContainer {
     		val spec = IsisContext.getSpecificationLoader().lookupBySpecId(adapterMemento.getObjectSpecId());
     		if(spec.isPersistenceCapable()) {
         		val info = "adapterMemento '"+adapterMemento+"'";
-        		_Probe.warnNotImplementedYet("[2033] ConcurrencyChecking no longer supported!? "+info);    			
+        		probe.warnNotImplementedYet("[2033] ConcurrencyChecking no longer supported!? "+info);    			
     		}
     	}