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/10 14:07:07 UTC
[08/50] [abbrv] isis git commit: ISIS-1194: working towards combining
ObjectStore and PersistenceSession...
ISIS-1194: working towards combining ObjectStore and PersistenceSession...
... moved resolveImmediately from ObjectStore to PersistenceSession (renamed to avoid method name collision)
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/53f5275c
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/53f5275c
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/53f5275c
Branch: refs/heads/ISIS-1194
Commit: 53f5275ceb59152a59c22c0eafc048d35f144bb4
Parents: 9964907
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 08:26:35 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 08:26:35 2015 +0100
----------------------------------------------------------------------
.../runtime/system/persistence/ObjectStore.java | 39 +++-----------------
.../system/persistence/PersistenceSession.java | 33 +++++++++++++++--
2 files changed, 35 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/53f5275c/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
index 97518ea..aabba35 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
@@ -36,7 +36,6 @@ import org.apache.isis.core.commons.debug.DebugBuilder;
import org.apache.isis.core.commons.debug.DebuggableWithTitle;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
import org.apache.isis.core.metamodel.adapter.oid.RootOid;
import org.apache.isis.core.metamodel.spec.ObjectSpecId;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -69,7 +68,6 @@ public class ObjectStore implements TransactionalResource, DebuggableWithTitle,
private final PersistenceSession persistenceSession;
private final SpecificationLoaderSpi specificationLoader;
private final IsisConfiguration configuration;
- private final OidMarshaller oidMarshaller;
private static final String ROOT_KEY = OptionHandlerFixtureAbstract.DATANUCLEUS_ROOT_KEY;
@@ -106,7 +104,6 @@ public class ObjectStore implements TransactionalResource, DebuggableWithTitle,
this.applicationComponents = applicationComponents;
this.frameworkSynchronizer = applicationComponents.getFrameworkSynchronizer();
- this.oidMarshaller = new OidMarshaller();
}
//endregion
@@ -219,36 +216,16 @@ public class ObjectStore implements TransactionalResource, DebuggableWithTitle,
- //region > resolveImmediately
-
-
- public void resolveImmediately(final ObjectAdapter adapter) {
- ensureOpened();
- ensureInTransaction();
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("resolveImmediately; oid=" + adapter.getOid().enString(getOidMarshaller()));
- }
-
- if (!adapter.representsPersistent()) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("; not persistent - ignoring");
- }
- return;
- }
-
- refreshRoot(adapter);
- }
-
+ //region > refreshRoot
/**
* Not API; provides the ability to force a reload (refresh in JDO terms)
* of the domain object wrapped in the {@link ObjectAdapter}.
*/
public void refreshRoot(final ObjectAdapter adapter) {
-
+
final Object domainObject = adapter.getObject();
- if (domainObject == null) {
- // REVIEW: is this possible?
+ if (domainObject == null) {
+ // REVIEW: is this possible?
throw new PojoRefreshException(adapter.getOid());
}
@@ -259,12 +236,11 @@ public class ObjectStore implements TransactionalResource, DebuggableWithTitle,
}
// possibly redundant because also called in the post-load event
- // listener, but (with JPA impl) found it was required if we were ever to
+ // 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).
-
+
frameworkSynchronizer.postLoadProcessingFor((Persistable) domainObject, CalledFrom.OS_RESOLVE);
}
-
//endregion
//region > loadInstancesAndAdapt
@@ -360,9 +336,6 @@ public class ObjectStore implements TransactionalResource, DebuggableWithTitle,
return persistenceSession.getTransactionManager();
}
- protected OidMarshaller getOidMarshaller() {
- return oidMarshaller;
- }
//endregion
http://git-wip-us.apache.org/repos/asf/isis/blob/53f5275c/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 bf28ceb..cf9dee0 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
@@ -46,6 +46,7 @@ import org.apache.isis.core.commons.util.ToString;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
import org.apache.isis.core.metamodel.adapter.oid.ParentedCollectionOid;
import org.apache.isis.core.metamodel.adapter.oid.RootOid;
import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
@@ -108,6 +109,7 @@ public class PersistenceSession implements SessionScopedComponent, DebuggableWit
// not final only for testing purposes
private IsisTransactionManager transactionManager;
private final FrameworkSynchronizer frameworkSynchronizer;
+ private final OidMarshaller oidMarshaller;
/**
* Initialize the object store so that calls to this object store access
@@ -131,7 +133,9 @@ public class PersistenceSession implements SessionScopedComponent, DebuggableWit
// sub-components
final DataNucleusApplicationComponents applicationComponents = persistenceSessionFactory.getApplicationComponents();
- this.objectStore = new ObjectStore(this, specificationLoader, configuration, applicationComponents);
+ oidMarshaller = new OidMarshaller();
+ this.objectStore = new ObjectStore(this, specificationLoader, configuration, applicationComponents
+ );
frameworkSynchronizer = applicationComponents.getFrameworkSynchronizer();
this.objectFactory = new ObjectFactory(this, servicesInjector);
@@ -658,8 +662,6 @@ public class PersistenceSession implements SessionScopedComponent, DebuggableWit
//endregion
-
-
//region > resolveImmediately, resolveField
/**
@@ -691,7 +693,7 @@ public class PersistenceSession implements SessionScopedComponent, DebuggableWit
@Override
public void execute() {
- objectStore.resolveImmediately(adapter);
+ objectStoreResolveImmediately(adapter);
}
@Override
@@ -712,6 +714,29 @@ public class PersistenceSession implements SessionScopedComponent, DebuggableWit
//endregion
+ //region > objectStoreResolveImmediately
+
+ public void objectStoreResolveImmediately(final ObjectAdapter adapter) {
+ ensureOpened();
+ ensureInTransaction();
+
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("resolveImmediately; oid=" + adapter.getOid().enString(oidMarshaller));
+ }
+
+ if (!adapter.representsPersistent()) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("; not persistent - ignoring");
+ }
+ return;
+ }
+
+ objectStore.refreshRoot(adapter);
+ }
+
+
+ //endregion
+
//region > makePersistent
/**