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 2015/09/15 08:03:08 UTC
[03/50] [abbrv] isis git commit: ISIS-1194: removing logging in
PersistenceSession - removing the CalledFrom enum
ISIS-1194: removing logging in PersistenceSession - removing the CalledFrom enum
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/5f1b5707
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/5f1b5707
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/5f1b5707
Branch: refs/heads/master
Commit: 5f1b5707c3a5000d421115c1ffa17a860b5c64e2
Parents: 7076c38
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri Sep 11 18:26:34 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Sep 14 07:35:45 2015 +0100
----------------------------------------------------------------------
.../persistence/IsisLifecycleListener2.java | 12 ++---
.../system/persistence/PersistenceSession.java | 48 ++++++++++----------
.../PersistenceQueryProcessorAbstract.java | 2 +-
3 files changed, 31 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/5f1b5707/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/IsisLifecycleListener2.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/IsisLifecycleListener2.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/IsisLifecycleListener2.java
index 2cdde35..09cb735 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/IsisLifecycleListener2.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/IsisLifecycleListener2.java
@@ -75,7 +75,7 @@ public class IsisLifecycleListener2
@Override
protected void doRun() {
final Persistable pojo = Utils.persistenceCapableFor(event);
- persistenceSession.postLoadProcessingFor(pojo, PersistenceSession.CalledFrom.EVENT_LOAD);
+ persistenceSession.postLoadProcessingFor(pojo);
}});
}
@@ -85,7 +85,7 @@ public class IsisLifecycleListener2
@Override
protected void doRun() {
final Persistable pojo = Utils.persistenceCapableFor(event);
- persistenceSession.preStoreProcessingFor(pojo, PersistenceSession.CalledFrom.EVENT_PRESTORE);
+ persistenceSession.preStoreProcessingFor(pojo);
}});
}
@@ -96,7 +96,7 @@ public class IsisLifecycleListener2
@Override
protected void doRun() {
final Persistable pojo = Utils.persistenceCapableFor(event);
- persistenceSession.postStoreProcessingFor(pojo, PersistenceSession.CalledFrom.EVENT_POSTSTORE);
+ persistenceSession.postStoreProcessingFor(pojo);
}});
}
@@ -106,7 +106,7 @@ public class IsisLifecycleListener2
@Override
protected void doRun() {
final Persistable pojo = Utils.persistenceCapableFor(event);
- persistenceSession.preDirtyProcessingFor(pojo, PersistenceSession.CalledFrom.EVENT_PREDIRTY);
+ persistenceSession.preDirtyProcessingFor(pojo);
}});
}
@@ -128,7 +128,7 @@ public class IsisLifecycleListener2
@Override
protected void doRun() {
final Persistable pojo = Utils.persistenceCapableFor(event);
- persistenceSession.preDeleteProcessingFor(pojo, PersistenceSession.CalledFrom.EVENT_PREDELETE);
+ persistenceSession.preDeleteProcessingFor(pojo);
}
});
}
@@ -139,7 +139,7 @@ public class IsisLifecycleListener2
@Override
protected void doRun() {
final Persistable pojo = Utils.persistenceCapableFor(event);
- persistenceSession.postDeleteProcessingFor(pojo, PersistenceSession.CalledFrom.EVENT_POSTDELETE);
+ persistenceSession.postDeleteProcessingFor(pojo);
}
});
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5f1b5707/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 4d2e9bf..f3ff12d 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
@@ -759,10 +759,10 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
return null;
}
final Persistable persistenceCapable = (Persistable) pojo;
- return lazilyLoaded(persistenceCapable, CalledFrom.OS_LAZILYLOADED);
+ return lazilyLoaded(persistenceCapable);
}
- private ObjectAdapter lazilyLoaded(final Persistable pojo, CalledFrom calledFrom) {
+ private ObjectAdapter lazilyLoaded(final Persistable pojo) {
return withLogging(pojo, new Callable<ObjectAdapter>() {
@Override
public ObjectAdapter call() {
@@ -773,7 +773,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
final ObjectAdapter adapter = mapRecreatedPojo(oid, pojo);
return adapter;
}
- }, calledFrom);
+ });
}
@@ -830,7 +830,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
// possibly redundant because also called in the post-load event
// listener, but (with JPA impl) found it was required if we were ever to
// get an eager left-outer-join as the result of a refresh (sounds possible).
- postLoadProcessingFor((Persistable) domainObject, CalledFrom.OS_RESOLVE);
+ postLoadProcessingFor((Persistable) domainObject);
}
//endregion
@@ -1243,7 +1243,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
//region > FrameworkSynchronizer delegate methods
- public void postDeleteProcessingFor(final Persistable pojo, final CalledFrom calledFrom) {
+ public void postDeleteProcessingFor(final Persistable pojo) {
withLogging(pojo, new Runnable() {
@Override
public void run() {
@@ -1259,12 +1259,12 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
// CallbackFacet.Util.callCallback(adapter, RemovedCallbackFacet.class);
}
- }, calledFrom);
+ });
}
- public void preDeleteProcessingFor(final Persistable pojo, final CalledFrom calledFrom) {
+ public void preDeleteProcessingFor(final Persistable pojo) {
withLogging(pojo, new Runnable() {
@Override
public void run() {
@@ -1275,12 +1275,12 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
CallbackFacet.Util.callCallback(adapter, RemovingCallbackFacet.class);
}
- }, calledFrom);
+ });
}
- public void postLoadProcessingFor(final Persistable pojo, CalledFrom calledFrom) {
+ public void postLoadProcessingFor(final Persistable pojo) {
withLogging(pojo, new Runnable() {
@Override
@@ -1342,7 +1342,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
adapter.setVersion(datastoreVersion);
}
- }, calledFrom);
+ });
}
/**
@@ -1353,7 +1353,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
* The implementation therefore uses Isis' {@link org.apache.isis.core.metamodel.adapter.oid.Oid#isTransient() oid}
* to determine which callback to fire.
*/
- public void preStoreProcessingFor(final Persistable pojo, final CalledFrom calledFrom) {
+ public void preStoreProcessingFor(final Persistable pojo) {
withLogging(pojo, new Runnable() {
@Override
public void run() {
@@ -1377,7 +1377,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
}
}
- }, calledFrom);
+ });
}
/**
@@ -1388,7 +1388,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
* The implementation therefore uses Isis' {@link org.apache.isis.core.metamodel.adapter.oid.Oid#isTransient() oid}
* to determine which callback to fire.
*/
- public void postStoreProcessingFor(final Persistable pojo, CalledFrom calledFrom) {
+ public void postStoreProcessingFor(final Persistable pojo) {
withLogging(pojo, new Runnable() {
@Override
public void run() {
@@ -1423,7 +1423,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
Version versionIfAny = getVersionIfAny(pojo);
adapter.setVersion(versionIfAny);
}
- }, calledFrom);
+ });
}
private Version getVersionIfAny(final Persistable pojo) {
@@ -1431,7 +1431,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
}
- public void preDirtyProcessingFor(final Persistable pojo, CalledFrom calledFrom) {
+ public void preDirtyProcessingFor(final Persistable pojo) {
withLogging(pojo, new Runnable() {
@Override
public void run() {
@@ -1444,7 +1444,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
// it seems reasonable in this case to simply map into Isis here ("just-in-time"); presumably
// DN would not be calling this callback if the pojo was not persistent.
- adapter = lazilyLoaded(pojo, CalledFrom.EVENT_PREDIRTY);
+ adapter = lazilyLoaded(pojo);
if (adapter == null) {
throw new RuntimeException(
"DN could not find objectId for pojo (unexpected) and so could not map into Isis; pojo=["
@@ -1468,12 +1468,12 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
ensureRootObject(pojo);
}
- }, calledFrom);
+ });
}
- private <T> T withLogging(Persistable pojo, Callable<T> runnable, CalledFrom calledFrom) {
+ private <T> T withLogging(Persistable pojo, Callable<T> runnable) {
if (LOG.isDebugEnabled()) {
- LOG.debug(logString(calledFrom, LoggingLocation.ENTRY, pojo));
+ LOG.debug(logString(LoggingLocation.ENTRY, pojo));
}
try {
return runnable.call();
@@ -1481,12 +1481,12 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
throw new RuntimeException(e);
} finally {
if (LOG.isDebugEnabled()) {
- LOG.debug(logString(calledFrom, LoggingLocation.EXIT, pojo));
+ LOG.debug(logString(LoggingLocation.EXIT, pojo));
}
}
}
- private void withLogging(Persistable pojo, final Runnable runnable, CalledFrom calledFrom) {
+ private void withLogging(Persistable pojo, final Runnable runnable) {
withLogging(pojo, new Callable<Void>() {
@Override
@@ -1495,13 +1495,13 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
return null;
}
- }, calledFrom);
+ });
}
- private String logString(CalledFrom calledFrom, LoggingLocation location, Persistable pojo) {
+ private String logString(LoggingLocation location, Persistable pojo) {
final ObjectAdapter adapter = getAdapterFor(pojo);
// initial spaces just to look better in log when wrapped by IsisLifecycleListener...
- return calledFrom.name() + " " + location.prefix + " oid=" + (adapter !=null? adapter.getOid(): "(null)") + " ,pojo " + pojo;
+ return location.prefix + " oid=" + (adapter !=null? adapter.getOid(): "(null)") + " ,pojo " + pojo;
}
/**
http://git-wip-us.apache.org/repos/asf/isis/blob/5f1b5707/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
index 9e6c01c..16b0c60 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
@@ -59,7 +59,7 @@ public abstract class PersistenceQueryProcessorAbstract<T extends PersistenceQue
ObjectAdapter adapter;
if(pojo instanceof Persistable) {
// an entity
- persistenceSession.postLoadProcessingFor((Persistable) pojo, PersistenceSession.CalledFrom.OS_QUERY);
+ persistenceSession.postLoadProcessingFor((Persistable) pojo);
adapter = persistenceSession.getAdapterFor(pojo);
} else {
// a value type