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/10/25 11:55:35 UTC
[2/2] isis git commit: ISIS-1009: support @PostConstruct for view
models.
ISIS-1009: support @PostConstruct for view models.
Using a PostConstructMethodCache implemented by each facet factory, with ViewModelFacet#initialize(..) being responsible for invoking the @PostConstruct method if present.
Using template pattern in RecreatableObjectFacetAbstract to ensure any future implementations will obey same contract.
Also updated docs.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/8f98cf47
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/8f98cf47
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/8f98cf47
Branch: refs/heads/master
Commit: 8f98cf47fa66ffdf43105e66dfadb9c2d815ccbd
Parents: e37a51f
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Oct 25 10:54:24 2015 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Sun Oct 25 10:54:24 2015 +0000
----------------------------------------------------------------------
.../_rg_annotations_manpage-PostConstruct.adoc | 22 +++---
.../_rg_annotations_manpage-PreDestroy.adoc | 16 +++--
.../isis/core/commons/lang/ClassExtensions.java | 5 --
.../apache/isis/core/commons/lang/Nullable.java | 42 ++++++++++++
.../metamodel/facets/MethodFinderUtils.java | 35 ++++++++++
.../facets/PostConstructMethodCache.java | 30 +++++++++
.../DomainObjectAnnotationFacetFactory.java | 26 ++++++-
...bleObjectFacetForDomainObjectAnnotation.java | 14 ++--
.../RecreatableObjectFacetAbstract.java | 32 ++++++++-
...creatableObjectFacetDeclarativeAbstract.java | 8 ++-
.../RecreatableObjectFacetFactory.java | 33 +++++++--
...acetForRecreatableDomainObjectInterface.java | 9 ++-
...jectFacetForRecreatableObjectAnnotation.java | 7 +-
...bjectFacetForRecreatableObjectInterface.java | 9 ++-
.../methodutils/MethodFinderUtils.java | 31 ---------
.../metamodel/facets/MethodFinderUtilsTest.java | 71 ++++++++++++++++++++
.../system/persistence/PersistenceSession.java | 18 ++---
.../persistence/PersistenceSessionFactory.java | 15 +++--
18 files changed, 333 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/adocs/documentation/src/main/asciidoc/guides/_rg_annotations_manpage-PostConstruct.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_rg_annotations_manpage-PostConstruct.adoc b/adocs/documentation/src/main/asciidoc/guides/_rg_annotations_manpage-PostConstruct.adoc
index 7f87464..3047d66 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_rg_annotations_manpage-PostConstruct.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_rg_annotations_manpage-PostConstruct.adoc
@@ -7,31 +7,33 @@
The `@javax.annotation.PostConstruct` annotation, as defined in link:https://jcp.org/en/jsr/detail?id=250[JSR-250], is recognized by Apache Isis as a callback method on domain services to be called just after they have been constructed, in order that they initialize themselves.
+It is also recognized (`1.10.0-SNAPSHOT`) for xref:ug.adoc#http://localhost:4000/guides/ug.html#_ug_more-advanced_view-models[view models] (eg annotated with xref:rg.adoc#_rg_annotations_manpage-ViewModel[`@ViewModel`]).
+
For the default application-scoped (singleton) domain services, this means that the method, if present, is called during the bootstrapping of the application. For xref:rg.adoc#_rg_annotations_manpage-RequestScoped[`@RequestScoped`] domain services, the method is called at the beginning of the request.
The signature of the method is:
[source,java]
----
-@PostConstruct <1>
-public void postConstruct() { ... } <2>
+@PostConstruct <1>
+public void init() { ... } <2>
----
-<1> (As of 1.9.0) it is not necessary to annotate the method with xref:rg.adoc#_rg_annotations_manpage-Programmatic[`@Programmatic`]; it will be automatically excluded from the Apache Isis metamodel.
+<1> It is not necessary to annotate the method with xref:rg.adoc#_rg_annotations_manpage-Programmatic[`@Programmatic`]; it will be automatically excluded from the Apache Isis metamodel.
<2> the method can have any name, but must have `public` visibility.
-In the form shown above the method can either accept no arguments. Alternatively, the method can accept a parameter of type `Map<String,String>`:
+In the form shown above the method accepts no arguments. Alternatively - for domain services only, not view models - the method can accept a parameter of type `Map<String,String>`:
[source,java]
----
@PostConstruct
@Programmatic
-public void postConstruct(Map<String,String> properties) { ... }
+public void init(Map<String,String> properties) { ... }
----
Isis uses argument to pass in the configuration properties read from all xref:rg.adoc#_rg_runtime_configuration-files[configuration files]:
[TIP]
====
-Alternatively, you could inject xref:rg.adoc#_rg_services-api_manpage-DomainObjectContainer[`DomainObjectContainer`] into the service and read configuration properties using `DomainObjectContainer#getProperty(...)` and related methods.
+Alternatively, you could inject xref:rg.adoc#_rg_services-api_manpage-DomainObjectContainer[`DomainObjectContainer`] into the service and read configuration properties using `DomainObjectContainer#getProperty(...)` and related methods. Note that when using this latter API only those configuration properties prefixes `application.` key are provided.
====
A common use case is for domain services that interact with the xref:rg.adoc#_rg_services-api_manpage-EventBusService[`EventBusService`]. For example:
@@ -40,12 +42,10 @@ A common use case is for domain services that interact with the xref:rg.adoc#_rg
----
@DomainService(nature=NatureOfService.DOMAIN)
public class MySubscribingService {
- @Programmatic
@PostConstruct
public void postConstruct() {
eventBusService.register(this);
}
- @Programmatic
@PreDestroy
public void preDestroy() {
eventBusService.unregister(this);
@@ -56,6 +56,12 @@ public class MySubscribingService {
}
----
+[TIP]
+====
+In this particular use case, it is generally simpler to just subclass from xref:rg.adoc#_rg_classes_super_manpage-AbstractSubscriber[`AbstractSubscriber`].
+====
+
+
Other use cases include obtaining connections to external datasources, eg subscribing to an ActiveMQ router, say, or initializing/cleaning up a background scheduler such as Quartz.
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/adocs/documentation/src/main/asciidoc/guides/_rg_annotations_manpage-PreDestroy.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_rg_annotations_manpage-PreDestroy.adoc b/adocs/documentation/src/main/asciidoc/guides/_rg_annotations_manpage-PreDestroy.adoc
index 47f8464..553b68e 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_rg_annotations_manpage-PreDestroy.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_rg_annotations_manpage-PreDestroy.adoc
@@ -8,6 +8,7 @@
The `@javax.annotation.PreDestroy` annotation, as defined in link:https://jcp.org/en/jsr/detail?id=250[JSR-250], recognized by Apache Isis as a callback method on domain services to be called just as they go out of scope.
+
For the default application-scoped (singleton) domain services, this means that the method, if present, is called just prior to the termination of the application. For xref:rg.adoc#_rg_annotations_manpage-RequestScoped[`@RequestScoped`] domain services, the method is called at the end of the request.
The signature of the method is:
@@ -15,9 +16,9 @@ The signature of the method is:
[source,java]
----
@PreDestroy <1>
-public void preDestroy() { ... } <2>
+public void deinit() { ... } <2>
----
-<1> (As of 1.9.0) it is not necessary to annotate the method with xref:rg.adoc#_rg_annotations_manpage-Programmatic[`@Programmatic`]; it will be automatically excluded from the Apache Isis metamodel.
+<1> It is not necessary to annotate the method with xref:rg.adoc#_rg_annotations_manpage-Programmatic[`@Programmatic`]; it will be automatically excluded from the Apache Isis metamodel.
<2> the method can have any name, but must have `public` visibility, and accept no arguments.
A common use case is for domain services that interact with the xref:rg.adoc#_rg_services-api_manpage-EventBusService[`EventBusService`]. For example:
@@ -26,14 +27,12 @@ A common use case is for domain services that interact with the xref:rg.adoc#_rg
----
@DomainService(nature=NatureOfService.DOMAIN)
public class MySubscribingService {
- @Programmatic
@PostConstruct
- public void postConstruct() {
+ public void init() {
eventBusService.register(this);
}
- @Programmatic
@PreDestroy
- public void preDestroy() {
+ public void deinit() {
eventBusService.unregister(this);
}
...
@@ -42,6 +41,11 @@ public class MySubscribingService {
}
----
+[TIP]
+====
+In this particular use case, it is generally simpler to just subclass from xref:rg.adoc#_rg_classes_super_manpage-AbstractSubscriber[`AbstractSubscriber`].
+====
+
Other use cases include obtaining connections to external datasources, eg subscribing to an ActiveMQ router, say, or initializing/cleaning up a background scheduler such as Quartz.
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/ClassExtensions.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/ClassExtensions.java b/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/ClassExtensions.java
index 58eceae..1d05155 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/ClassExtensions.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/ClassExtensions.java
@@ -27,21 +27,16 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.nio.charset.Charset;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Properties;
import com.google.common.io.InputSupplier;
import com.google.common.io.Resources;
import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.metamodel.methodutils.MethodFinderUtils;
public final class ClassExtensions {
-
-
// //////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/Nullable.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/Nullable.java b/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/Nullable.java
new file mode 100644
index 0000000..deac021
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/Nullable.java
@@ -0,0 +1,42 @@
+/*
+ * 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.commons.lang;
+
+public class Nullable<T> {
+
+ public static <T> Nullable<T> some(T t) {
+ return new Nullable<>(t);
+ }
+
+ public static <T> Nullable<T> none() {
+ return new Nullable<T>(null);
+ }
+
+ private final T t;
+
+ private Nullable(final T t) {
+ this.t = t;
+ }
+
+ public boolean isPresent() { return t != null; }
+ public T value() {
+ return t;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java
index 96621c8..144ffc2 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodFinderUtils.java
@@ -21,7 +21,9 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import org.apache.isis.core.commons.lang.Nullable;
import org.apache.isis.core.metamodel.facetapi.MethodRemover;
import org.apache.isis.core.metamodel.methodutils.MethodScope;
@@ -196,4 +198,37 @@ public final class MethodFinderUtils {
return true;
}
+
+ public static Method findAnnotatedMethod(
+ final Object pojo,
+ final Class<? extends Annotation> annotationClass,
+ final Map<Class, Nullable<Method>> methods) {
+
+ final Class<?> clz = pojo.getClass();
+ Nullable<Method> nullableMethod = methods.get(clz);
+ if(nullableMethod == null) {
+ nullableMethod = search(clz, annotationClass, methods);
+ }
+ return nullableMethod.value();
+ }
+
+ private static Nullable<Method> search(
+ final Class<?> clz,
+ final Class<? extends Annotation> annotationClass,
+ final Map<Class, Nullable<Method>> postConstructMethods) {
+
+ final Method[] methods = clz.getMethods();
+
+ Nullable<Method> nullableMethod = Nullable.none();
+ for (final Method method : methods) {
+ final Annotation annotation = method.getAnnotation(annotationClass);
+ if(annotation != null) {
+ nullableMethod = Nullable.some(method);
+ break;
+ }
+ }
+ postConstructMethods.put(clz, nullableMethod);
+ return nullableMethod;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/PostConstructMethodCache.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/PostConstructMethodCache.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/PostConstructMethodCache.java
new file mode 100644
index 0000000..11de9b2
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/PostConstructMethodCache.java
@@ -0,0 +1,30 @@
+/*
+ * 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.facets;
+
+import java.lang.reflect.Method;
+
+/**
+ * Contract between implementations of RecreatableObjectFacet and their creating facet factories.
+ */
+public interface PostConstructMethodCache {
+ Method postConstructMethodFor(final Object pojo);
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
index 0d092b2..2ef468e 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
@@ -18,9 +18,12 @@
*/
package org.apache.isis.core.metamodel.facets.object.domainobject;
+import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Map;
+import javax.annotation.PostConstruct;
+
import com.google.common.collect.Maps;
import org.apache.isis.applib.annotation.Audited;
@@ -33,6 +36,7 @@ import org.apache.isis.applib.annotation.PublishedObject;
import org.apache.isis.applib.services.HasTransactionId;
import org.apache.isis.core.commons.config.IsisConfiguration;
import org.apache.isis.core.commons.config.IsisConfigurationAware;
+import org.apache.isis.core.commons.lang.Nullable;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
import org.apache.isis.core.metamodel.facetapi.Facet;
@@ -42,6 +46,8 @@ import org.apache.isis.core.metamodel.facetapi.FeatureType;
import org.apache.isis.core.metamodel.facetapi.MetaModelValidatorRefiner;
import org.apache.isis.core.metamodel.facets.Annotations;
import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.MethodFinderUtils;
+import org.apache.isis.core.metamodel.facets.PostConstructMethodCache;
import org.apache.isis.core.metamodel.facets.object.audit.AuditableFacet;
import org.apache.isis.core.metamodel.facets.object.domainobject.auditing.AuditableFacetForAuditedAnnotation;
import org.apache.isis.core.metamodel.facets.object.domainobject.auditing.AuditableFacetForDomainObjectAnnotation;
@@ -76,8 +82,10 @@ import org.apache.isis.core.metamodel.specloader.validator.ValidationFailures;
import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacet;
-public class DomainObjectAnnotationFacetFactory extends FacetFactoryAbstract implements IsisConfigurationAware, AdapterManagerAware, ServicesInjectorAware, SpecificationLoaderAware, MetaModelValidatorRefiner,
- PersistenceSessionServiceAware {
+public class DomainObjectAnnotationFacetFactory extends FacetFactoryAbstract
+ implements IsisConfigurationAware, AdapterManagerAware, ServicesInjectorAware,
+ SpecificationLoaderAware, MetaModelValidatorRefiner, PersistenceSessionServiceAware,
+ PostConstructMethodCache {
private final MetaModelValidatorForDeprecatedAnnotation auditedValidator = new MetaModelValidatorForDeprecatedAnnotation(Audited.class);
private final MetaModelValidatorForDeprecatedAnnotation publishedObjectValidator = new MetaModelValidatorForDeprecatedAnnotation(PublishedObject.class);
@@ -274,8 +282,10 @@ public class DomainObjectAnnotationFacetFactory extends FacetFactoryAbstract imp
final DomainObject domainObject = Annotations.getAnnotation(cls, DomainObject.class);
final FacetHolder facetHolder = processClassContext.getFacetHolder();
+ final PostConstructMethodCache postConstructMethodCache = this;
final ViewModelFacet recreatableObjectFacet = RecreatableObjectFacetForDomainObjectAnnotation.create(
- domainObject, getSpecificationLoader(), adapterManager, servicesInjector, facetHolder);
+ domainObject, getSpecificationLoader(), adapterManager, servicesInjector,
+ facetHolder, postConstructMethodCache);
FacetUtil.addFacet(recreatableObjectFacet);
final MixinFacet mixinFacet = MixinFacetForDomainObjectAnnotation.create(cls, facetHolder, servicesInjector);
@@ -355,4 +365,14 @@ public class DomainObjectAnnotationFacetFactory extends FacetFactoryAbstract imp
public void setPersistenceSessionService(final PersistenceSessionService persistenceSessionService) {
this.persistenceSessionService = persistenceSessionService;
}
+
+
+ // //////////////////////////////////////
+
+ private final Map<Class, Nullable<Method>> postConstructMethods = Maps.newHashMap();
+
+ public Method postConstructMethodFor(final Object pojo) {
+ return MethodFinderUtils.findAnnotatedMethod(pojo, PostConstruct.class, postConstructMethods);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/recreatable/RecreatableObjectFacetForDomainObjectAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/recreatable/RecreatableObjectFacetForDomainObjectAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/recreatable/RecreatableObjectFacetForDomainObjectAnnotation.java
index 4667611..5c5eb13 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/recreatable/RecreatableObjectFacetForDomainObjectAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/recreatable/RecreatableObjectFacetForDomainObjectAnnotation.java
@@ -23,6 +23,7 @@ import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.Nature;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.PostConstructMethodCache;
import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
import org.apache.isis.core.metamodel.facets.object.recreatable.RecreatableObjectFacetDeclarativeAbstract;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
@@ -35,7 +36,8 @@ public class RecreatableObjectFacetForDomainObjectAnnotation extends Recreatable
final SpecificationLoader specificationLoader,
final AdapterManager adapterManager,
final ServicesInjector servicesInjector,
- final FacetHolder holder) {
+ final FacetHolder holder,
+ final PostConstructMethodCache postConstructMethodCache) {
if(domainObject == null) {
return null;
@@ -70,14 +72,14 @@ public class RecreatableObjectFacetForDomainObjectAnnotation extends Recreatable
return new RecreatableObjectFacetForDomainObjectAnnotation(
holder,
ArchitecturalLayer.APPLICATION,
- specificationLoader, adapterManager, servicesInjector);
+ specificationLoader, adapterManager, servicesInjector, postConstructMethodCache);
case EXTERNAL_ENTITY:
case INMEMORY_ENTITY:
return new RecreatableObjectFacetForDomainObjectAnnotation(
holder,
ArchitecturalLayer.DOMAIN,
- specificationLoader, adapterManager, servicesInjector);
+ specificationLoader, adapterManager, servicesInjector, postConstructMethodCache);
}
// shouldn't happen, the above switch should match all cases.
throw new IllegalArgumentException("nature of '" + nature + "' not recognized");
@@ -88,8 +90,10 @@ public class RecreatableObjectFacetForDomainObjectAnnotation extends Recreatable
final ArchitecturalLayer architecturalLayer,
final SpecificationLoader specificationLoader,
final AdapterManager adapterManager,
- final ServicesInjector servicesInjector) {
- super(holder, architecturalLayer, specificationLoader, adapterManager, servicesInjector);
+ final ServicesInjector servicesInjector,
+ final PostConstructMethodCache postConstructMethodCache) {
+ super(holder, architecturalLayer, specificationLoader, adapterManager, servicesInjector,
+ postConstructMethodCache);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetAbstract.java
index 0b20717..a117e37 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetAbstract.java
@@ -19,15 +19,20 @@
package org.apache.isis.core.metamodel.facets.object.recreatable;
+import java.lang.reflect.Method;
+
import org.apache.isis.applib.ViewModel;
+import org.apache.isis.core.commons.lang.MethodExtensions;
import org.apache.isis.core.metamodel.facetapi.Facet;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
import org.apache.isis.core.metamodel.facets.MarkerFacetAbstract;
+import org.apache.isis.core.metamodel.facets.PostConstructMethodCache;
import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
public abstract class RecreatableObjectFacetAbstract extends MarkerFacetAbstract implements ViewModelFacet {
private final ArchitecturalLayer architecturalLayer;
+ private final PostConstructMethodCache postConstructMethodCache;
public static Class<? extends Facet> type() {
return ViewModelFacet.class;
@@ -35,9 +40,11 @@ public abstract class RecreatableObjectFacetAbstract extends MarkerFacetAbstract
public RecreatableObjectFacetAbstract(
final FacetHolder holder,
- final ArchitecturalLayer architecturalLayer) {
+ final ArchitecturalLayer architecturalLayer,
+ final PostConstructMethodCache postConstructMethodCache) {
super(type(), holder);
this.architecturalLayer = architecturalLayer;
+ this.postConstructMethodCache = postConstructMethodCache;
}
@Override
@@ -55,4 +62,27 @@ public abstract class RecreatableObjectFacetAbstract extends MarkerFacetAbstract
public ArchitecturalLayer getArchitecturalLayer() {
return architecturalLayer;
}
+
+ @Override
+ public final void initialize(
+ final Object viewModelPojo,
+ final String mementoStr) {
+ doInitialize(viewModelPojo, mementoStr);
+ invokePostConstructMethod(viewModelPojo);
+ }
+
+ /**
+ * Mandatory hook for subclasses.
+ */
+ protected abstract void doInitialize(
+ final Object viewModelPojo,
+ final String mementoStr);
+
+ private void invokePostConstructMethod(final Object viewModel) {
+ final Method postConstructMethod = postConstructMethodCache.postConstructMethodFor(viewModel);
+ if(postConstructMethod != null) {
+ MethodExtensions.invoke(postConstructMethod, viewModel);
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetDeclarativeAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetDeclarativeAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetDeclarativeAbstract.java
index 76d0b60..0c8cf64 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetDeclarativeAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetDeclarativeAbstract.java
@@ -32,6 +32,7 @@ import org.apache.isis.core.metamodel.adapter.oid.Oid;
import org.apache.isis.core.metamodel.adapter.oid.RootOid;
import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.PostConstructMethodCache;
import org.apache.isis.core.metamodel.facets.properties.update.modify.PropertySetterFacet;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
import org.apache.isis.core.metamodel.spec.ObjectSpecId;
@@ -51,15 +52,16 @@ public abstract class RecreatableObjectFacetDeclarativeAbstract extends Recreata
final ArchitecturalLayer architecturalLayer,
final SpecificationLoader specificationLoader,
final AdapterManager adapterManager,
- final ServicesInjector servicesInjector) {
- super(holder, architecturalLayer);
+ final ServicesInjector servicesInjector,
+ final PostConstructMethodCache postConstructMethodCache) {
+ super(holder, architecturalLayer, postConstructMethodCache);
this.specificationLoader = specificationLoader;
this.servicesInjector = servicesInjector;
this.adapterManager = adapterManager;
}
@Override
- public void initialize(
+ protected void doInitialize(
final Object viewModelPojo,
final String mementoStr) {
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetFactory.java
index 52bea48..b2f3120 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetFactory.java
@@ -19,9 +19,17 @@
package org.apache.isis.core.metamodel.facets.object.recreatable;
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+
+import com.google.common.collect.Maps;
+
import org.apache.isis.applib.RecreatableDomainObject;
import org.apache.isis.applib.ViewModel;
import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.lang.Nullable;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
import org.apache.isis.core.metamodel.facetapi.Facet;
@@ -31,6 +39,8 @@ import org.apache.isis.core.metamodel.facetapi.FeatureType;
import org.apache.isis.core.metamodel.facetapi.MetaModelValidatorRefiner;
import org.apache.isis.core.metamodel.facets.Annotations;
import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.MethodFinderUtils;
+import org.apache.isis.core.metamodel.facets.PostConstructMethodCache;
import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjectorAware;
@@ -39,7 +49,8 @@ import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorCom
import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorVisiting;
import org.apache.isis.core.metamodel.specloader.validator.ValidationFailures;
-public class RecreatableObjectFacetFactory extends FacetFactoryAbstract implements ServicesInjectorAware, AdapterManagerAware, MetaModelValidatorRefiner {
+public class RecreatableObjectFacetFactory extends FacetFactoryAbstract
+ implements ServicesInjectorAware, AdapterManagerAware, MetaModelValidatorRefiner, PostConstructMethodCache {
private ServicesInjector servicesInjector;
private AdapterManager adapterManager;
@@ -57,7 +68,9 @@ public class RecreatableObjectFacetFactory extends FacetFactoryAbstract implemen
// ViewModel interface
if (ViewModel.class.isAssignableFrom(processClassContext.getCls())) {
- FacetUtil.addFacet(new RecreatableObjectFacetForRecreatableObjectInterface(processClassContext.getFacetHolder()));
+ final PostConstructMethodCache postConstructMethodCache = this;
+ FacetUtil.addFacet(new RecreatableObjectFacetForRecreatableObjectInterface(
+ processClassContext.getFacetHolder(), postConstructMethodCache));
}
// ViewModel annotation
@@ -66,14 +79,17 @@ public class RecreatableObjectFacetFactory extends FacetFactoryAbstract implemen
// RecreatableDomainObject interface
if (RecreatableDomainObject.class.isAssignableFrom(processClassContext.getCls())) {
- FacetUtil.addFacet(new RecreatableObjectFacetForRecreatableDomainObjectInterface(processClassContext.getFacetHolder()));
+ final PostConstructMethodCache postConstructMethodCache = this;
+ FacetUtil.addFacet(new RecreatableObjectFacetForRecreatableDomainObjectInterface(
+ processClassContext.getFacetHolder(), postConstructMethodCache));
}
// DomainObject(nature=VIEW_MODEL) is managed by the DomainObjectFacetFactory
}
private ViewModelFacet create(final org.apache.isis.applib.annotation.ViewModel annotation, final FacetHolder holder) {
- return annotation != null ? new RecreatableObjectFacetForRecreatableObjectAnnotation(holder, getSpecificationLoader(), adapterManager, servicesInjector) : null;
+ final PostConstructMethodCache postConstructMethodCache = this;
+ return annotation != null ? new RecreatableObjectFacetForRecreatableObjectAnnotation(holder, getSpecificationLoader(), adapterManager, servicesInjector, postConstructMethodCache) : null;
}
// //////////////////////////////////////
@@ -114,4 +130,13 @@ public class RecreatableObjectFacetFactory extends FacetFactoryAbstract implemen
this.adapterManager = adapterManager;
}
+
+
+ // //////////////////////////////////////
+
+ private final Map<Class, Nullable<Method>> postConstructMethods = Maps.newHashMap();
+
+ public Method postConstructMethodFor(final Object pojo) {
+ return MethodFinderUtils.findAnnotatedMethod(pojo, PostConstruct.class, postConstructMethods);
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableDomainObjectInterface.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableDomainObjectInterface.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableDomainObjectInterface.java
index 3ad3280..c59ef86 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableDomainObjectInterface.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableDomainObjectInterface.java
@@ -21,15 +21,18 @@ package org.apache.isis.core.metamodel.facets.object.recreatable;
import org.apache.isis.applib.RecreatableDomainObject;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.PostConstructMethodCache;
public class RecreatableObjectFacetForRecreatableDomainObjectInterface extends RecreatableObjectFacetAbstract {
- public RecreatableObjectFacetForRecreatableDomainObjectInterface(final FacetHolder holder) {
- super(holder, ArchitecturalLayer.DOMAIN);
+ public RecreatableObjectFacetForRecreatableDomainObjectInterface(
+ final FacetHolder holder,
+ final PostConstructMethodCache postConstructMethodCache) {
+ super(holder, ArchitecturalLayer.DOMAIN, postConstructMethodCache);
}
@Override
- public void initialize(final Object pojo, final String memento) {
+ protected void doInitialize(final Object pojo, final String memento) {
final RecreatableDomainObject viewModel = (RecreatableDomainObject)pojo;
viewModel.__isis_recreate(memento);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableObjectAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableObjectAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableObjectAnnotation.java
index d1b3406..30af377 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableObjectAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableObjectAnnotation.java
@@ -21,6 +21,7 @@ package org.apache.isis.core.metamodel.facets.object.recreatable;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.PostConstructMethodCache;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
import org.apache.isis.core.metamodel.spec.SpecificationLoader;
@@ -30,8 +31,10 @@ public class RecreatableObjectFacetForRecreatableObjectAnnotation extends Recrea
final FacetHolder holder,
final SpecificationLoader specificationLoader,
final AdapterManager adapterManager,
- final ServicesInjector servicesInjector) {
- super(holder, ArchitecturalLayer.APPLICATION, specificationLoader, adapterManager, servicesInjector);
+ final ServicesInjector servicesInjector,
+ final PostConstructMethodCache postConstructMethodCache) {
+ super(holder, ArchitecturalLayer.APPLICATION,
+ specificationLoader, adapterManager, servicesInjector, postConstructMethodCache);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableObjectInterface.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableObjectInterface.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableObjectInterface.java
index e3c23b5..67cd85d 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableObjectInterface.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableObjectInterface.java
@@ -21,15 +21,18 @@ package org.apache.isis.core.metamodel.facets.object.recreatable;
import org.apache.isis.applib.ViewModel;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.PostConstructMethodCache;
public class RecreatableObjectFacetForRecreatableObjectInterface extends RecreatableObjectFacetAbstract {
- public RecreatableObjectFacetForRecreatableObjectInterface(final FacetHolder holder) {
- super(holder, ArchitecturalLayer.APPLICATION);
+ public RecreatableObjectFacetForRecreatableObjectInterface(
+ final FacetHolder holder,
+ final PostConstructMethodCache postConstructMethodCache) {
+ super(holder, ArchitecturalLayer.APPLICATION, postConstructMethodCache);
}
@Override
- public void initialize(Object pojo, String memento) {
+ protected void doInitialize(Object pojo, String memento) {
final ViewModel viewModel = (ViewModel) pojo;
viewModel.viewModelInit(memento);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/main/java/org/apache/isis/core/metamodel/methodutils/MethodFinderUtils.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/methodutils/MethodFinderUtils.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/methodutils/MethodFinderUtils.java
deleted file mode 100644
index d62638a..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/methodutils/MethodFinderUtils.java
+++ /dev/null
@@ -1,31 +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.methodutils;
-
-import java.util.Map;
-
-import com.google.common.collect.Maps;
-
-public final class MethodFinderUtils {
-
-
- private MethodFinderUtils() {
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/MethodFinderUtilsTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/MethodFinderUtilsTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/MethodFinderUtilsTest.java
new file mode 100644
index 0000000..b2a8ed6
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/MethodFinderUtilsTest.java
@@ -0,0 +1,71 @@
+/**
+ * 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.facets;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+
+import com.google.common.collect.Maps;
+
+import org.junit.Test;
+
+import org.apache.isis.core.commons.lang.Nullable;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+public class MethodFinderUtilsTest {
+
+ public static class NoPostConstruct {
+ public void thisDoesNotHaveAnyAnnotation(){}
+ }
+ public static class WithPostConstruct {
+ @PostConstruct
+ public void thisDoesHaveAnnotation(){}
+ }
+
+ @Test
+ public void whenExists() throws Exception {
+
+ final Map<Class, Nullable<Method>> cache = Maps.newHashMap();
+ final Method method = MethodFinderUtils.findAnnotatedMethod(new WithPostConstruct(), PostConstruct.class, cache);
+
+ assertThat(method, is(not(nullValue())));
+ final Nullable<Method> actual = cache.get(WithPostConstruct.class);
+ assertThat(actual, is(not(nullValue())));
+ assertThat(actual.isPresent(), is(true));
+ assertThat(actual.value(), is(method));
+ }
+
+ @Test
+ public void whenDoesNotExist() throws Exception {
+
+ final Map<Class, Nullable<Method>> cache = Maps.newHashMap();
+ final Method method = MethodFinderUtils.findAnnotatedMethod(new NoPostConstruct(), PostConstruct.class, cache);
+
+ assertThat(method, is(nullValue()));
+ final Nullable<Method> actual = cache.get(NoPostConstruct.class);
+ assertThat(actual, is(not(nullValue())));
+ assertThat(actual.isPresent(), is(false));
+ assertThat(actual.value(), is(nullValue()));
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/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 44aa5e8..81a62f1 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
@@ -210,6 +210,7 @@ public class PersistenceSession implements
private final boolean concurrencyCheckingGloballyEnabled;
+
/**
* Initialize the object store so that calls to this object store access
* persisted objects and persist changes to the object that are saved.
@@ -588,13 +589,14 @@ public class PersistenceSession implements
if(variant == Variant.VIEW_MODEL) {
final ViewModelFacet facet = objectSpec.getFacet(ViewModelFacet.class);
- facet.initialize(pojo, memento);
+ initialize(facet, pojo, memento);
}
final ObjectAdapter adapter = adapterFor(pojo);
return initializePropertiesAndDoCallback(adapter);
}
+
public Object instantiateAndInjectServices(final ObjectSpecification objectSpec) {
final Class<?> correspondingClass = objectSpec.getCorrespondingClass();
@@ -1582,17 +1584,14 @@ public class PersistenceSession implements
}
final String memento = rootOid.getIdentifier();
-
- facet.initialize(pojo, memento);
+ initialize(facet, pojo, memento);
}
return pojo;
}
-
-
-
-
-
+ private void initialize(final ViewModelFacet facet, final Object pojo, final String memento) {
+ facet.initialize(pojo, memento);
+ }
/**
* {@inheritDoc}
@@ -1670,7 +1669,6 @@ public class PersistenceSession implements
}
-
/**
* {@inheritDoc}
*
@@ -1864,8 +1862,6 @@ public class PersistenceSession implements
}
-
-
public void remapRecreatedPojo(ObjectAdapter adapter, final Object pojo) {
removeAdapter(adapter);
adapter.replacePojo(pojo);
http://git-wip-us.apache.org/repos/asf/isis/blob/8f98cf47/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
index 713dff1..5416e41 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
@@ -19,11 +19,16 @@
package org.apache.isis.core.runtime.system.persistence;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
import java.util.Map;
import java.util.Set;
+import javax.annotation.PostConstruct;
import javax.jdo.PersistenceManagerFactory;
+import com.google.common.collect.Maps;
+
import org.datanucleus.PropertyNames;
import org.datanucleus.api.jdo.JDOPersistenceManagerFactory;
import org.slf4j.Logger;
@@ -41,7 +46,8 @@ import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechani
import org.apache.isis.objectstore.jdo.datanucleus.JDOStateManagerForIsis;
import org.apache.isis.objectstore.jdo.service.RegisterEntities;
-public class PersistenceSessionFactory implements ApplicationScopedComponent, FixturesInstalledFlag {
+public class PersistenceSessionFactory
+ implements ApplicationScopedComponent, FixturesInstalledFlag {
private static final Logger LOG = LoggerFactory.getLogger(PersistenceSessionFactory.class);
@@ -169,12 +175,11 @@ public class PersistenceSessionFactory implements ApplicationScopedComponent, Fi
return new PersistenceSession(
configuration, servicesInjector, specificationLoader,
- authenticationSession, persistenceManagerFactory, fixturesInstalledFlag);
+ authenticationSession, persistenceManagerFactory,
+ fixturesInstalledFlag);
}
- DataNucleusApplicationComponents getApplicationComponents() {
- return applicationComponents;
- }
+
//endregion