incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1395713 [1/2] - in /incubator/isis/trunk/framework: core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/ core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/ core/metamodel/src/main/java/org/apache/i...
Date Mon, 08 Oct 2012 18:44:38 GMT
Author: danhaywood
Date: Mon Oct  8 18:44:36 2012
New Revision: 1395713

URL: http://svn.apache.org/viewvc?rev=1395713&view=rev
Log:
ISIS-274: reducing the number of configuration properties

see JIRA ticket for details.  This commit pretty much implements the changes documented there.

Added:
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MetaModelRefiner.java
      - copied, changed from r1395534, incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FacetProvider.java
Removed:
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FacetProvider.java
Modified:
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FacetHolder.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/RuntimeContextAbstract.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/ServicesInjector.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/ServicesInjectorDefault.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/ServicesInjectorSpi.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorInstaller.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectorConstants.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorComposite.java
    incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/dflt/src/main/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryPersistenceMechanismInstaller.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/dflt/src/main/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryPersistenceSessionFactory.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusSimplePersistAlgorithm.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/progmodelfacets/JdoProgrammingModelFacets.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidatorLeaf.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/NoSqlObjectStore.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/NoSqlPersistorMechanismInstaller.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/file/FileServerPersistorMechanismInstaller.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlPersistorInstaller.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstaller.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstallerTest.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceConstants.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceSessionFactoryDelegate.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceSessionFactoryDelegating.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/IsisSystemFixturesHookAbstract.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/persistence/PersistenceSession.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/persistence/PersistenceSessionFactory.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemAbstract.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/systemusinginstallers/IsisSystemUsingInstallers.java
    incubator/isis/trunk/framework/runtimes/dflt/testsupport/src/main/java/org/apache/isis/runtimes/dflt/testsupport/IsisSystemDefault.java
    incubator/isis/trunk/framework/runtimes/dflt/testsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistorSessionHydratorTest.java
    incubator/isis/trunk/framework/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/components/BddInMemoryPersistenceMechanismInstaller.java
    incubator/isis/trunk/framework/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/components/BddInMemoryPersistenceSessionFactory.java
    incubator/isis/trunk/framework/viewer/junit/src/main/java/org/apache/isis/viewer/junit/internal/InMemoryPersistenceMechanismInstallerWithinJunit.java
    incubator/isis/trunk/framework/viewer/wicket/wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/ScalarModel.java

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FacetHolder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FacetHolder.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FacetHolder.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FacetHolder.java Mon Oct  8 18:44:36 2012
@@ -27,7 +27,7 @@ import org.apache.isis.applib.filter.Fil
  * Anything in the metamodel (which also includes peers in the reflector) that
  * can be extended.
  */
-public interface FacetHolder extends FacetProvider {
+public interface FacetHolder {
 
     /**
      * Get the list of all facet <i>types</i> that are supported by objects of

Copied: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MetaModelRefiner.java (from r1395534, incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FacetProvider.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MetaModelRefiner.java?p2=incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MetaModelRefiner.java&p1=incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FacetProvider.java&r1=1395534&r2=1395713&rev=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/FacetProvider.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facetapi/MetaModelRefiner.java Mon Oct  8 18:44:36 2012
@@ -19,9 +19,22 @@
 
 package org.apache.isis.core.metamodel.facetapi;
 
-
-public interface FacetProvider {
-
-
-
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutor;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
+
+
+/**
+ * Provides the ability for components to inform/alter/adjust/refine the metamodel.
+ */
+public interface MetaModelRefiner {
+
+    ClassSubstitutor createClassSubstitutor(IsisConfiguration configuration);
+    
+    MetaModelValidator refineMetaModelValidator(MetaModelValidatorComposite baseMetaModelValidator, IsisConfiguration configuration);
+    
+    ProgrammingModel refineProgrammingModel(ProgrammingModel baseProgrammingModel, IsisConfiguration configuration);
+    
 }

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/RuntimeContextAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/RuntimeContextAbstract.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/RuntimeContextAbstract.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/RuntimeContextAbstract.java Mon Oct  8 18:44:36 2012
@@ -24,6 +24,8 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Properties;
 
+import com.google.common.collect.Lists;
+
 import org.apache.isis.applib.DomainObjectContainer;
 import org.apache.isis.core.metamodel.services.container.DomainObjectContainerAware;
 import org.apache.isis.core.metamodel.spec.ObjectSpecId;
@@ -160,7 +162,7 @@ public abstract class RuntimeContextAbst
     }
 
     public List<String> getPropertyNames() {
-        final List<String> list = new ArrayList<String>();
+        final List<String> list = Lists.newArrayList();
         for (final Object key : properties.keySet()) {
             list.add((String) key);
         }

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/ServicesInjector.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/ServicesInjector.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/ServicesInjector.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/ServicesInjector.java Mon Oct  8 18:44:36 2012
@@ -19,8 +19,6 @@ package org.apache.isis.core.metamodel.r
 import java.util.List;
 
 import org.apache.isis.core.commons.components.Injectable;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 
 public interface ServicesInjector extends Injectable {
 

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/ServicesInjectorDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/ServicesInjectorDefault.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/ServicesInjectorDefault.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/ServicesInjectorDefault.java Mon Oct  8 18:44:36 2012
@@ -37,12 +37,12 @@ import org.apache.isis.applib.DomainObje
 import org.apache.isis.core.commons.ensure.Assert;
 import org.apache.isis.core.commons.lang.CastUtils;
 import org.apache.isis.core.commons.lang.ToString;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.exceptions.MetaModelException;
 import org.apache.isis.core.metamodel.runtimecontext.ServicesInjectorAware;
-import org.apache.isis.core.metamodel.spec.ObjectAdapterUtils;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 
+/**
+ * Must be a thread-safe.
+ */
 public class ServicesInjectorDefault implements ServicesInjectorSpi {
 
     private static final Logger LOG = Logger.getLogger(ServicesInjectorDefault.class);
@@ -50,16 +50,20 @@ public class ServicesInjectorDefault imp
     private final List<Object> services = Lists.newArrayList();
     private DomainObjectContainer container;
 
-    /**
-     * Ensure that all services are wired into each other.
-     */
+
+    
+    // /////////////////////////////////////////////////////////
+    // Constructor, init, shutdown
+    // /////////////////////////////////////////////////////////
+
+
     @Override
-    public void open() {
+    public void init() {
         autowireServicesAndContainer();
     }
 
     @Override
-    public void close() {
+    public void shutdown() {
     }
 
     // /////////////////////////////////////////////////////////
@@ -75,6 +79,7 @@ public class ServicesInjectorDefault imp
     public void setContainer(final DomainObjectContainer container) {
         ensureThatArg(container, is(not(nullValue())));
         this.container = container;
+        autowireServicesAndContainer();
     }
 
     // /////////////////////////////////////////////////////////
@@ -212,4 +217,5 @@ public class ServicesInjectorDefault imp
         return null;
     }
 
+
 }

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/ServicesInjectorSpi.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/ServicesInjectorSpi.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/ServicesInjectorSpi.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/ServicesInjectorSpi.java Mon Oct  8 18:44:36 2012
@@ -22,6 +22,7 @@ package org.apache.isis.core.metamodel.s
 import java.util.List;
 
 import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.core.commons.components.ApplicationScopedComponent;
 import org.apache.isis.core.commons.components.Injectable;
 import org.apache.isis.core.commons.components.SessionScopedComponent;
 import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
@@ -36,7 +37,7 @@ import org.apache.isis.core.metamodel.ru
  * <p>
  * Can be considered a mutable SPI to the {@link ServicesInjector} immutable API.
  */
-public interface ServicesInjectorSpi extends SessionScopedComponent, Injectable, ServicesInjector {
+public interface ServicesInjectorSpi extends ApplicationScopedComponent, Injectable, ServicesInjector {
 
     // ///////////////////////////////////////////////////////////////////////////
     // Container

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorInstaller.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorInstaller.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ObjectReflectorInstaller.java Mon Oct  8 18:44:36 2012
@@ -20,6 +20,7 @@
 package org.apache.isis.core.metamodel.specloader;
 
 import org.apache.isis.core.commons.components.Installer;
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 
 /**
@@ -29,7 +30,7 @@ public interface ObjectReflectorInstalle
 
     static String TYPE = "reflector";
 
-    SpecificationLoaderSpi createReflector();
+    SpecificationLoaderSpi createReflector(MetaModelRefiner programmingModelAdjuster);
 
     void addFacetDecoratorInstaller(final FacetDecoratorInstaller decoratorInstaller);
 

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectorConstants.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectorConstants.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectorConstants.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ReflectorConstants.java Mon Oct  8 18:44:36 2012
@@ -24,7 +24,6 @@ import org.apache.isis.core.commons.conf
 import org.apache.isis.core.metamodel.facetdecorator.FacetDecorator;
 import org.apache.isis.core.metamodel.facets.FacetFactory;
 import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
-import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutor;
 import org.apache.isis.core.metamodel.specloader.traverser.SpecificationTraverser;
 import org.apache.isis.core.metamodel.specloader.traverser.SpecificationTraverserDefault;
 import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
@@ -55,12 +54,6 @@ public final class ReflectorConstants {
     public static final String MEMBER_LAYOUT_ARRANGER_CLASS_NAME = ConfigurationConstants.ROOT + "reflector.memberlayoutarranger";
     public static final String MEMBER_LAYOUT_ARRANGER_CLASS_NAME_DEFAULT = "org.apache.isis.core.progmodel.layout.dflt.MemberLayoutArrangerDefault";
 
-    /**
-     * Key used to lookup implementation of {@link ClassSubstitutor} in
-     * {@link IsisConfiguration}.
-     */
-    public static final String CLASS_SUBSTITUTOR_CLASS_NAME_LIST = ConfigurationConstants.ROOT + "reflector.class-substitutor";
-    public static final String CLASS_SUBSTITUTOR_CLASS_NAME_DEFAULT = "org.apache.isis.runtimes.dflt.bytecode.dflt.classsubstitutor.CglibClassSubstitutor";
 
     /**
      * Key used to lookup implementation of {@link SpecificationTraverser} in

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorComposite.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorComposite.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorComposite.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/validator/MetaModelValidatorComposite.java Mon Oct  8 18:44:36 2012
@@ -37,8 +37,9 @@ public class MetaModelValidatorComposite
         }
     }
 
-    public void addValidator(final MetaModelValidator validator) {
+    public MetaModelValidatorComposite add(final MetaModelValidator validator) {
         validators.add(validator);
+        return this;
     }
 
     public List<MetaModelValidator> getValidators() {

Modified: incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java (original)
+++ incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java Mon Oct  8 18:44:36 2012
@@ -33,6 +33,7 @@ import org.apache.isis.core.commons.conf
 import org.apache.isis.core.commons.config.InstallerAbstract;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.commons.factory.InstanceUtil;
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
 import org.apache.isis.core.metamodel.facetdecorator.FacetDecorator;
 import org.apache.isis.core.metamodel.facets.FacetFactory;
 import org.apache.isis.core.metamodel.layout.MemberLayoutArranger;
@@ -48,6 +49,7 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistryDefault;
 import org.apache.isis.core.metamodel.specloader.traverser.SpecificationTraverser;
 import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
 
 /**
  * An implementation of {@link ObjectReflectorInstaller} without support for {@link FacetDecoratorInstaller}
@@ -84,46 +86,24 @@ public class JavaReflectorInstallerNoDec
      * calling this.
      */
     @Override
-    public SpecificationLoaderSpi createReflector() {
-        final ClassSubstitutor classSubstitutor = createClassSubstitutor(getConfiguration());
+    public SpecificationLoaderSpi createReflector(final MetaModelRefiner metaModelRefiner) {
+
         final CollectionTypeRegistry collectionTypeRegistry = createCollectionTypeRegistry(getConfiguration());
         final SpecificationTraverser specificationTraverser = createSpecificationTraverser(getConfiguration());
         final MemberLayoutArranger memberLayoutArranger = createMemberLayoutArranger(getConfiguration());
-        final ProgrammingModel programmingModel = createProgrammingModelFacets(getConfiguration());
         final Set<FacetDecorator> facetDecorators = createFacetDecorators(getConfiguration());
-        final MetaModelValidator metaModelValidator = createMetaModelValidator(getConfiguration());
 
-        final ObjectReflectorDefault reflector = doCreateReflector(getConfiguration(), classSubstitutor, collectionTypeRegistry, specificationTraverser, memberLayoutArranger, programmingModel, facetDecorators, metaModelValidator);
+        final ClassSubstitutor classSubstitutor = metaModelRefiner.createClassSubstitutor(getConfiguration());
+        
+        final ProgrammingModel baseProgrammingModel = createProgrammingModel(getConfiguration());
+        final ProgrammingModel programmingModel = metaModelRefiner.refineProgrammingModel(baseProgrammingModel, getConfiguration());
+        final MetaModelValidatorComposite baseMetaModelValidator = wrapped(createMetaModelValidator(getConfiguration()));
+        final MetaModelValidator metaModelValidator = metaModelRefiner.refineMetaModelValidator(baseMetaModelValidator, getConfiguration());
 
+        final ObjectReflectorDefault reflector = doCreateReflector(getConfiguration(), classSubstitutor, collectionTypeRegistry, specificationTraverser, memberLayoutArranger, programmingModel, facetDecorators, metaModelValidator);
         return reflector;
     }
 
-    /**
-     * Hook method to allow subclasses to specify a different implementation of
-     * {@link ClassSubstitutor}.
-     * 
-     * <p>
-     * By default, looks up implementation from provided
-     * {@link IsisConfiguration} using
-     * {@link ReflectorConstants#CLASS_SUBSTITUTOR_CLASS_NAME_LIST}. If not
-     * specified, then defaults to
-     * {@value ReflectorConstants#CLASS_SUBSTITUTOR_CLASS_NAME_DEFAULT}.
-     * 
-     * <p>
-     * 
-     */
-    protected ClassSubstitutor createClassSubstitutor(final IsisConfiguration configuration) {
-        final String[] configuredClassNames = configuration.getList(ReflectorConstants.CLASS_SUBSTITUTOR_CLASS_NAME_LIST);
-        if (configuredClassNames == null || configuredClassNames.length == 0) {
-            return InstanceUtil.createInstance(ReflectorConstants.CLASS_SUBSTITUTOR_CLASS_NAME_DEFAULT, ClassSubstitutor.class);
-        }
-        final List<ClassSubstitutor> substitutors = Lists.newArrayList();
-        for (final String className : configuredClassNames) {
-            final ClassSubstitutor substitutor = InstanceUtil.createInstance(className, ClassSubstitutor.class);
-            substitutors.add(substitutor);
-        }
-        return substitutors.size() == 1 ? substitutors.get(0) : new ClassSubstitutorComposite(substitutors);
-    }
 
     /**
      * Hook method to allow subclasses to specify a different implementation of
@@ -177,7 +157,7 @@ public class JavaReflectorInstallerNoDec
      * {@link ReflectorConstants#FACET_FACTORY_EXCLUDE_CLASS_NAME_LIST} to
      * exclude.
      */
-    protected ProgrammingModel createProgrammingModelFacets(final IsisConfiguration configuration) {
+    protected ProgrammingModel createProgrammingModel(final IsisConfiguration configuration) {
         final ProgrammingModel programmingModel = lookupAndCreateProgrammingModelFacets(configuration);
         includeFacetFactories(configuration, programmingModel);
         excludeFacetFactories(configuration, programmingModel);
@@ -191,7 +171,7 @@ public class JavaReflectorInstallerNoDec
     }
 
     /**
-     * Factored out of {@link #createProgrammingModelFacets(IsisConfiguration)}
+     * Factored out of {@link #createProgrammingModel(IsisConfiguration)}
      * so that subclasses that choose to override can still support
      * customization of their {@link ProgrammingModel} in a similar way.
      */
@@ -206,7 +186,7 @@ public class JavaReflectorInstallerNoDec
     }
 
     /**
-     * Factored out of {@link #createProgrammingModelFacets(IsisConfiguration)}
+     * Factored out of {@link #createProgrammingModel(IsisConfiguration)}
      * so that subclasses that choose to override can still support
      * customization of their {@link ProgrammingModel} in a similar way.
      */
@@ -240,8 +220,13 @@ public class JavaReflectorInstallerNoDec
      */
     protected MetaModelValidator createMetaModelValidator(final IsisConfiguration configuration) {
         final String metaModelValidatorClassName = configuration.getString(ReflectorConstants.META_MODEL_VALIDATOR_CLASS_NAME, ReflectorConstants.META_MODEL_VALIDATOR_CLASS_NAME_DEFAULT);
-        final MetaModelValidator metaModelValidator = InstanceUtil.createInstance(metaModelValidatorClassName, MetaModelValidator.class);
-        return metaModelValidator;
+        return InstanceUtil.createInstance(metaModelValidatorClassName, MetaModelValidator.class);
+    }
+
+    private MetaModelValidatorComposite wrapped(MetaModelValidator baseMetaModelValidator) {
+        final MetaModelValidatorComposite metaModelValidatorComposite = new MetaModelValidatorComposite();
+        metaModelValidatorComposite.add(baseMetaModelValidator);
+        return metaModelValidatorComposite;
     }
 
     /**

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/dflt/src/main/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryPersistenceMechanismInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/dflt/src/main/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryPersistenceMechanismInstaller.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/dflt/src/main/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryPersistenceMechanismInstaller.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/dflt/src/main/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryPersistenceMechanismInstaller.java Mon Oct  8 18:44:36 2012
@@ -19,12 +19,18 @@
 
 package org.apache.isis.runtimes.dflt.objectstores.dflt;
 
+import java.lang.reflect.Modifier;
+
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
+import org.apache.isis.core.metamodel.spec.ObjectInstantiationException;
 import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.PersistenceMechanismInstallerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectFactoryAbstract;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectFactoryAbstract.Mode;
 import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManagerSpi;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.ObjectFactory;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionFactory;
 
 /**
@@ -44,7 +50,7 @@ public class InMemoryPersistenceMechanis
 
     @Override
     public PersistenceSessionFactory createPersistenceSessionFactory(final DeploymentType deploymentType) {
-        return new InMemoryPersistenceSessionFactory(deploymentType, this);
+        return new InMemoryPersistenceSessionFactory(deploymentType, getConfiguration(), this);
     }
 
     // ///////////////////////////////////////////////////////////////
@@ -59,4 +65,39 @@ public class InMemoryPersistenceMechanis
         return new InMemoryObjectStore();
     }
 
+    
+    @Override
+    public ObjectFactory createObjectFactory(IsisConfiguration configuration) {
+        return new ObjectFactoryBasic();
+    }
+}
+
+
+class ObjectFactoryBasic extends ObjectFactoryAbstract {
+
+    public ObjectFactoryBasic() {
+    }
+
+    public ObjectFactoryBasic(final Mode mode) {
+        super(mode);
+    }
+
+    /**
+     * Simply instantiates reflectively, does not enhance bytecode etc in any
+     * way.
+     */
+    @Override
+    protected <T> T doInstantiate(final Class<T> cls) throws ObjectInstantiationException {
+        if (Modifier.isAbstract(cls.getModifiers())) {
+            throw new ObjectInstantiationException("Cannot create an instance of an abstract class: " + cls);
+        }
+        try {
+            return cls.newInstance();
+        } catch (final IllegalAccessException e) {
+            throw new ObjectInstantiationException(e);
+        } catch (final InstantiationException e) {
+            throw new ObjectInstantiationException(e);
+        }
+    }
+
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/dflt/src/main/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryPersistenceSessionFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/dflt/src/main/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryPersistenceSessionFactory.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/dflt/src/main/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryPersistenceSessionFactory.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/dflt/src/main/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryPersistenceSessionFactory.java Mon Oct  8 18:44:36 2012
@@ -19,6 +19,7 @@
 
 package org.apache.isis.runtimes.dflt.objectstores.dflt;
 
+import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.runtimes.dflt.objectstores.dflt.internal.ObjectStoreInstances;
 import org.apache.isis.runtimes.dflt.objectstores.dflt.internal.ObjectStorePersistedObjects;
 import org.apache.isis.runtimes.dflt.objectstores.dflt.internal.ObjectStorePersistedObjectsDefault;
@@ -34,8 +35,8 @@ public class InMemoryPersistenceSessionF
 
     private ObjectStorePersistedObjects persistedObjects;
 
-    public InMemoryPersistenceSessionFactory(final DeploymentType deploymentType, final PersistenceSessionFactoryDelegate persistenceSessionFactoryDelegate) {
-        super(deploymentType, persistenceSessionFactoryDelegate);
+    public InMemoryPersistenceSessionFactory(final DeploymentType deploymentType, final IsisConfiguration configuration, final PersistenceSessionFactoryDelegate persistenceSessionFactoryDelegate) {
+        super(deploymentType, configuration, persistenceSessionFactoryDelegate);
     }
 
     protected ObjectStorePersistedObjects getPersistedObjects() {

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java Mon Oct  8 18:44:36 2012
@@ -9,13 +9,30 @@ import javax.annotation.Nullable;
 import org.apache.isis.core.commons.components.Installer;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutor;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
+import org.apache.isis.core.progmodel.facets.object.ignore.jdo.RemoveJdoEnhancementTypesFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.jdo.RemoveJdoPrefixedMethodsFacetFactory;
 import org.apache.isis.runtimes.dflt.bytecode.identity.objectfactory.ObjectFactoryBasic;
 import org.apache.isis.runtimes.dflt.objectstores.jdo.applib.AuditService;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.bytecode.DataNucleusTypesClassSubstitutor;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.metamodel.specloader.progmodelfacets.DataNucleusProgrammingModelFacets;
 import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.adaptermanager.DataNucleusPojoRecreator;
 import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.spi.DataNucleusIdentifierGenerator;
 import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.spi.DataNucleusSimplePersistAlgorithm;
 import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.spi.DataNucleusTransactionManager;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.auditable.AuditableAnnotationFacetFactory;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.auditable.AuditableMarkerInterfaceFacetFactory;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.datastoreidentity.JdoDatastoreIdentityAnnotationFacetFactory;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.discriminator.JdoDiscriminatorAnnotationFacetFactory;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.embeddedonly.JdoEmbeddedOnlyAnnotationFacetFactory;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableAnnotationFacetFactory;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.query.JdoQueryAnnotationFacetFactory;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.prop.primarykey.JdoPrimaryKeyAnnotationFacetFactory;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.specloader.validator.JdoMetaModelValidatorLeaf;
 import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.PersistenceMechanismInstallerAbstract;
 import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.algorithm.PersistAlgorithm;
@@ -74,6 +91,11 @@ public class DataNucleusPersistenceMecha
         super(NAME);
     }
 
+    
+    ////////////////////////////////////////////////////////////////////////
+    // createObjectStore
+    ////////////////////////////////////////////////////////////////////////
+    
     @Override
     protected ObjectStoreSpi createObjectStore(IsisConfiguration configuration, ObjectAdapterFactory adapterFactory, AdapterManagerSpi adapterManager) {
         createDataNucleusApplicationComponentsIfRequired(configuration);
@@ -91,6 +113,10 @@ public class DataNucleusPersistenceMecha
         applicationComponents = new DataNucleusApplicationComponents(props, getSpecificationLoader().allSpecifications());
     }
 
+    ////////////////////////////////////////////////////////////////////////
+    // createPersistenceSession
+    ////////////////////////////////////////////////////////////////////////
+
     @Override
     public PersistenceSession createPersistenceSession(PersistenceSessionFactory persistenceSessionFactory) {
         PersistenceSession persistenceSession = super.createPersistenceSession(persistenceSessionFactory);
@@ -109,34 +135,88 @@ public class DataNucleusPersistenceMecha
         }
         searchedForAuditService = true;
     }
+
+    ////////////////////////////////////////////////////////////////////////
+    // PersistenceSessionFactoryDelegate impl
+    ////////////////////////////////////////////////////////////////////////
+
+    @Override
+    protected PersistAlgorithm createPersistAlgorithm(IsisConfiguration configuration) {
+        return new DataNucleusSimplePersistAlgorithm();
+    }
     
     @Override
-    protected IdentifierGenerator createIdentifierGenerator(IsisConfiguration configuration) {
+    public IdentifierGenerator createIdentifierGenerator(IsisConfiguration configuration) {
         return new DataNucleusIdentifierGenerator();
     }
 
     @Override
-    protected IsisTransactionManager createTransactionManager(final EnlistedObjectDirtying persistor, final TransactionalResource objectStore) {
-        return new DataNucleusTransactionManager(persistor, objectStore, auditService);
+    public ClassSubstitutor createClassSubstitutor(IsisConfiguration configuration) {
+        return new DataNucleusTypesClassSubstitutor();
     }
 
     @Override
-    protected PersistAlgorithm createPersistAlgorithm(IsisConfiguration configuration) {
-        return new DataNucleusSimplePersistAlgorithm();
+    public ProgrammingModel refineProgrammingModel(ProgrammingModel baseProgrammingModel, IsisConfiguration configuration) {
+
+        addJdoFacetFactories(baseProgrammingModel);
+        addDataNucleusFacetFactories(baseProgrammingModel);
+
+        return baseProgrammingModel;
     }
-    
+
+    private void addJdoFacetFactories(ProgrammingModel baseProgrammingModel) {
+        baseProgrammingModel.addFactory(JdoPersistenceCapableAnnotationFacetFactory.class);
+        baseProgrammingModel.addFactory(JdoDatastoreIdentityAnnotationFacetFactory.class);
+        baseProgrammingModel.addFactory(JdoEmbeddedOnlyAnnotationFacetFactory.class);
+
+        baseProgrammingModel.addFactory(JdoPrimaryKeyAnnotationFacetFactory.class);
+        baseProgrammingModel.addFactory(JdoDiscriminatorAnnotationFacetFactory.class);
+
+        baseProgrammingModel.addFactory(JdoQueryAnnotationFacetFactory.class);
+        
+        baseProgrammingModel.addFactory(AuditableAnnotationFacetFactory.class);
+        baseProgrammingModel.addFactory(AuditableMarkerInterfaceFacetFactory.class);
+    }
+
+    private void addDataNucleusFacetFactories(ProgrammingModel baseProgrammingModel) {
+        baseProgrammingModel.addFactory(RemoveJdoEnhancementTypesFacetFactory.class);
+        baseProgrammingModel.addFactory(RemoveJdoPrefixedMethodsFacetFactory.class);
+    }
+
+    @Override
+    public MetaModelValidator refineMetaModelValidator(MetaModelValidatorComposite baseMetaModelValidator, IsisConfiguration configuration) {
+        return baseMetaModelValidator.add(new JdoMetaModelValidatorLeaf());
+    }
+
+
+    @Override
+    protected IsisTransactionManager createTransactionManager(final EnlistedObjectDirtying persistor, final TransactionalResource objectStore) {
+        return new DataNucleusTransactionManager(persistor, objectStore, auditService);
+    }
+
     @Override
-    protected ObjectFactory createObjectFactory(IsisConfiguration configuration) {
+    public ObjectFactory createObjectFactory(IsisConfiguration configuration) {
         return new ObjectFactoryBasic();
     }
 
     @Override
-    protected DataNucleusPojoRecreator createPojoRecreator(IsisConfiguration configuration) {
+    public DataNucleusPojoRecreator createPojoRecreator(IsisConfiguration configuration) {
         return new DataNucleusPojoRecreator();
     }
+
+
+
+
+    
+    ////////////////////////////////////////////////////////////////////////
+    // Dependencies
+    ////////////////////////////////////////////////////////////////////////
     
     protected SpecificationLoaderSpi getSpecificationLoader() {
         return IsisContext.getSpecificationLoader();
     }
 
+
+
+
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusSimplePersistAlgorithm.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusSimplePersistAlgorithm.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusSimplePersistAlgorithm.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusSimplePersistAlgorithm.java Mon Oct  8 18:44:36 2012
@@ -33,9 +33,6 @@ public class DataNucleusSimplePersistAlg
     // makePersistent
     // ////////////////////////////////////////////////////////////////
 
-    /**
-     * @see NakedInsertPostEventListener#onPostInsert(org.hibernate.event.PostInsertEvent)
-     */
     public void makePersistent(final ObjectAdapter adapter,
             final ToPersistObjectSet toPersistObjectSet) {
         if (alreadyPersistedOrNotPersistable(adapter)) {

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/progmodelfacets/JdoProgrammingModelFacets.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/progmodelfacets/JdoProgrammingModelFacets.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/progmodelfacets/JdoProgrammingModelFacets.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/progmodelfacets/JdoProgrammingModelFacets.java Mon Oct  8 18:44:36 2012
@@ -32,10 +32,10 @@ import org.apache.isis.runtimes.dflt.obj
 /**
  * As per the {@link ProgrammingModelFacetsJava5 Java 5 default programming
  * model}, but also
- * includes support for JPA.
+ * includes support for JDO.
  * <p>
  * Intended to be used by the {@link JpaJavaReflectorInstaller}, which
- * additionally sets up other required components needed for JPA support.
+ * additionally sets up other required components needed for JDO support.
  */
 public class JdoProgrammingModelFacets extends ProgrammingModelFacetsJava5 {
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java Mon Oct  8 18:44:36 2012
@@ -24,8 +24,8 @@ import org.apache.isis.core.progmodel.me
 public class JdoMetaModelValidator extends MetaModelValidatorComposite {
 
     public JdoMetaModelValidator() {
-        addValidator(new MetaModelValidatorDefault());
-        addValidator(new JdoMetaModelValidatorLeaf());
+        add(new MetaModelValidatorDefault());
+        add(new JdoMetaModelValidatorLeaf());
     }
 
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidatorLeaf.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidatorLeaf.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidatorLeaf.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/specloader/validator/JdoMetaModelValidatorLeaf.java Mon Oct  8 18:44:36 2012
@@ -56,8 +56,8 @@ public class JdoMetaModelValidatorLeaf e
                 continue;
             }
             final IdentityType identityType = jpcf.getIdentityType();
-            if(identityType != IdentityType.DATASTORE) {
-                validationFailures.add("DataNucleus object store: {0} must be annotated with @PersistenceCapable, with an identityType of either DATASTORE (has an identityType of {1})", objSpec.getFullIdentifier(), identityType);
+            if(identityType != IdentityType.DATASTORE && identityType != IdentityType.UNSPECIFIED) {
+                validationFailures.add("DataNucleus object store: {0} must be annotated with @PersistenceCapable, with an identityType of either DATASTORE or UNSPECIFIED (has an identityType of {1})", objSpec.getFullIdentifier(), identityType);
             }
             
             // TODO: ensure that DATASTORE has recognised @DatastoreIdentity attribute

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/NoSqlObjectStore.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/NoSqlObjectStore.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/NoSqlObjectStore.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/NoSqlObjectStore.java Mon Oct  8 18:44:36 2012
@@ -23,6 +23,9 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
@@ -46,15 +49,11 @@ import org.apache.isis.runtimes.dflt.run
 import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.SaveObjectCommand;
 import org.apache.isis.runtimes.dflt.runtime.persistence.query.PersistenceQueryBuiltIn;
 import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManagerSpi;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.OidGenerator;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceQuery;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
 public class NoSqlObjectStore implements ObjectStoreSpi {
     
     private final KeyCreatorDefault keyCreator = new KeyCreatorDefault();

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/NoSqlPersistorMechanismInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/NoSqlPersistorMechanismInstaller.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/NoSqlPersistorMechanismInstaller.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/NoSqlPersistorMechanismInstaller.java Mon Oct  8 18:44:36 2012
@@ -59,7 +59,7 @@ public abstract class NoSqlPersistorMech
     }
 
     @Override
-    protected IdentifierGenerator createIdentifierGenerator(final IsisConfiguration configuration) {
+    public IdentifierGenerator createIdentifierGenerator(final IsisConfiguration configuration) {
         return getObjectStore(configuration).getIdentifierGenerator();
     }
 
@@ -68,7 +68,7 @@ public abstract class NoSqlPersistorMech
             //final KeyCreatorDefault keyCreator = createKeyCreator();
             final VersionCreator versionCreator = createVersionCreator();
             final NoSqlDataDatabase db = createNoSqlDatabase(configuration);
-            final OidGenerator oidGenerator = createOidGenerator(db);
+            final OidGenerator oidGenerator = new OidGenerator(createIdentifierGenerator(db));
 
             final Map<String, DataEncryption> availableDataEncryption = new HashMap<String, DataEncryption>();
             try {
@@ -101,8 +101,8 @@ public abstract class NoSqlPersistorMech
         return objectStore;
     }
 
-    protected OidGenerator createOidGenerator(final NoSqlDataDatabase database) {
-        return new OidGenerator(new NoSqlIdentifierGenerator(database));
+    protected NoSqlIdentifierGenerator createIdentifierGenerator(final NoSqlDataDatabase database) {
+        return new NoSqlIdentifierGenerator(database);
     }
 
     protected abstract NoSqlDataDatabase createNoSqlDatabase(IsisConfiguration configuration);

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/file/FileServerPersistorMechanismInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/file/FileServerPersistorMechanismInstaller.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/file/FileServerPersistorMechanismInstaller.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/file/FileServerPersistorMechanismInstaller.java Mon Oct  8 18:44:36 2012
@@ -21,6 +21,9 @@ package org.apache.isis.runtimes.dflt.ob
 
 import org.apache.isis.core.commons.config.ConfigurationConstants;
 import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
 import org.apache.isis.runtimes.dflt.objectstores.nosql.db.NoSqlDataDatabase;
 import org.apache.isis.runtimes.dflt.objectstores.nosql.db.NoSqlPersistorMechanismInstaller;
 
@@ -45,4 +48,5 @@ public class FileServerPersistorMechanis
         return db;
     }
 
+
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlPersistorInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlPersistorInstaller.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlPersistorInstaller.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/SqlPersistorInstaller.java Mon Oct  8 18:44:36 2012
@@ -72,7 +72,7 @@ public class SqlPersistorInstaller exten
     }
 
     @Override
-    protected IdentifierGenerator createIdentifierGenerator(final IsisConfiguration configuration) {
+    public IdentifierGenerator createIdentifierGenerator(final IsisConfiguration configuration) {
         final DatabaseConnectorFactory connectorFactory = new JdbcConnectorFactory();
         connectionPool = new DatabaseConnectorPool(connectorFactory, 1);
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstaller.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstaller.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstaller.java Mon Oct  8 18:44:36 2012
@@ -50,7 +50,7 @@ public class XmlPersistenceMechanismInst
     }
 
     @Override
-    protected IdentifierGenerator createIdentifierGenerator(final IsisConfiguration configuration) {
+    public IdentifierGenerator createIdentifierGenerator(final IsisConfiguration configuration) {
         final long currentTime = new Date().getTime();
         return new IdentifierGeneratorDefault(currentTime);
     }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstallerTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstallerTest.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstallerTest.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/test/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlPersistenceMechanismInstallerTest.java Mon Oct  8 18:44:36 2012
@@ -21,20 +21,33 @@ package org.apache.isis.runtimes.dflt.ob
 
 import static org.junit.Assert.assertTrue;
 
+import org.jmock.auto.Mock;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
 import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionFactory;
 
 public class XmlPersistenceMechanismInstallerTest {
 
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+
     private DeploymentType deploymentType;
     XmlPersistenceMechanismInstaller installer;
+    
+    @Mock
+    private IsisConfiguration mockConfiguration;
 
     @Before
     public void setUpSystem() throws Exception {
         installer = new XmlPersistenceMechanismInstaller();
+        installer.setConfiguration(mockConfiguration);
     }
 
     @Test

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java Mon Oct  8 18:44:36 2012
@@ -34,9 +34,15 @@ import org.apache.isis.core.commons.conf
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.commons.factory.InstanceUtil;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
 import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.services.ServicesInjectorDefault;
 import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
+import org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutor;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
 import org.apache.isis.runtimes.dflt.runtime.installerregistry.InstallerLookup;
 import org.apache.isis.runtimes.dflt.runtime.installerregistry.InstallerLookupAware;
 import org.apache.isis.runtimes.dflt.runtime.persistence.PersistenceConstants;
@@ -55,6 +61,7 @@ import org.apache.isis.runtimes.dflt.run
 import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManagerSpi;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGeneratorDefault;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.ObjectFactory;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.OidGenerator;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
@@ -75,6 +82,7 @@ import org.apache.isis.runtimes.dflt.run
  */
 public abstract class PersistenceMechanismInstallerAbstract extends InstallerAbstract implements PersistenceMechanismInstaller, InstallerLookupAware {
 
+
     private static final String LOGGING_PROPERTY = org.apache.isis.core.runtime.logging.Logger.PROPERTY_ROOT + "persistenceSession";
     private static final Logger LOG = Logger.getLogger(PersistenceMechanismInstallerAbstract.class);
 
@@ -94,52 +102,68 @@ public abstract class PersistenceMechani
 
     @Override
     public PersistenceSessionFactory createPersistenceSessionFactory(final DeploymentType deploymentType) {
-        return new PersistenceSessionFactoryDelegating(deploymentType, this);
+        return new PersistenceSessionFactoryDelegating(deploymentType, getConfiguration(), this);
     }
 
 
     /**
-     * Will return a {@link PersistenceSessionObjectStore}; subclasses are free
-     * to downcast if required.
+     * Creates a {@link PersistenceSession} with internal (thread-safe) components obtained from the provided {@link PersistenceSessionFactory}.
+     * 
+     * <p>
+     * Typically should not be overridden.
      */
-    protected PersistenceSession createPersistenceSession(
-            final PersistenceSessionFactory persistenceSessionFactory, 
-            final ObjectAdapterFactory objectAdapterFactory, 
-            final ObjectFactory objectFactory, 
-            final PojoRecreator pojoRecreator, 
-            final IdentifierGenerator identifierGenerator,
-            final ServicesInjectorSpi servicesInjector) {
+    @Override
+    public PersistenceSession createPersistenceSession(final PersistenceSessionFactory persistenceSessionFactory) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("installing " + this.getClass().getName());
+        }
 
+        ObjectAdapterFactory adapterFactory = persistenceSessionFactory.getAdapterFactory();
+        ObjectFactory objectFactory = persistenceSessionFactory.getObjectFactory();
+        PojoRecreator pojoRecreator = persistenceSessionFactory.getPojoRecreator();
+        IdentifierGenerator identifierGenerator = persistenceSessionFactory.getIdentifierGenerator();
+        ServicesInjectorSpi servicesInjector = persistenceSessionFactory.getServicesInjector();
+        
         final PersistAlgorithm persistAlgorithm = createPersistAlgorithm(getConfiguration());
         final AdapterManagerDefault adapterManager = new AdapterManagerDefault(pojoRecreator);
         
-        ObjectStoreSpi objectStore = createObjectStore(getConfiguration(), objectAdapterFactory, adapterManager);
-
+        ObjectStoreSpi objectStore = createObjectStore(getConfiguration(), adapterFactory, adapterManager);
+        
         ensureThatArg(persistAlgorithm, is(not(nullValue())));
         ensureThatArg(objectStore, is(not(nullValue())));
-
+        
         if (getConfiguration().getBoolean(LOGGING_PROPERTY, false)) {
             final String level = getConfiguration().getString(LOGGING_PROPERTY + ".level", "debug");
             objectStore = new IsisObjectStoreLogger(objectStore, level);
         }
-
+        
         final PersistenceSession persistenceSession = 
-                new PersistenceSession(persistenceSessionFactory, objectAdapterFactory, objectFactory, servicesInjector, identifierGenerator, adapterManager, persistAlgorithm, objectStore);
-
+                new PersistenceSession(persistenceSessionFactory, adapterFactory, objectFactory, servicesInjector, identifierGenerator, adapterManager, persistAlgorithm, objectStore);
+        
         final IsisTransactionManager transactionManager = createTransactionManager(persistenceSession, objectStore);
-
+        
         ensureThatArg(persistenceSession, is(not(nullValue())));
         ensureThatArg(transactionManager, is(not(nullValue())));
-
+        
         persistenceSession.setDirtiableSupport(true);
         persistenceSession.setTransactionManager(transactionManager);
-
+        
         // ... and finally return
         return persistenceSession;
     }
 
     
     // ///////////////////////////////////////////
+    // Mandatory hook methods
+    // ///////////////////////////////////////////
+
+    /**
+     * Hook method to return {@link ObjectStoreSpi}.
+     */
+    protected abstract ObjectStoreSpi createObjectStore(IsisConfiguration configuration, ObjectAdapterFactory adapterFactory, AdapterManagerSpi adapterManager);
+    
+
+    // ///////////////////////////////////////////
     // Optional hook methods
     // ///////////////////////////////////////////
 
@@ -163,160 +187,123 @@ public abstract class PersistenceMechani
         return new IsisTransactionManager(persistor, objectStore);
     }
 
-    // ///////////////////////////////////////////
-    // Mandatory hook methods
-    // ///////////////////////////////////////////
+
+    @Override
+    public ClassSubstitutor createClassSubstitutor(IsisConfiguration configuration) {
+        return InstanceUtil.createInstance(PersistenceConstants.CLASS_SUBSTITUTOR_CLASS_NAME_DEFAULT, ClassSubstitutor.class);
+    }
 
     /**
-     * Hook method to return {@link ObjectStoreSpi}.
+     * Hook method to refine the {@link ProgrammingModel}.
+     * 
+     * <p>
+     * By default, just returns the provided {@link ProgrammingModel}.
      */
-    protected abstract ObjectStoreSpi createObjectStore(IsisConfiguration configuration, ObjectAdapterFactory adapterFactory, AdapterManagerSpi adapterManager);
-
+    @Override
+    public ProgrammingModel refineProgrammingModel(ProgrammingModel baseProgrammingModel, IsisConfiguration configuration) {
+        return baseProgrammingModel;
+    }
     
     /**
-     * Creates a {@link PersistenceSession} that is initialized with the various
-     * hook methods.
+     * Hook method to refine the {@link MetaModelValidator}.
      * 
-     * @see #createPersistenceSession(PersistenceSessionFactory,
-     *      ObjectAdapterFactory, ObjectFactory, AdapterManagerSpi,
-     *      IdentifierGenerator, ServicesInjectorSpi)
-     * @see #createAdapterFactory(IsisConfiguration)
-     * @see #createAdapterManager(IsisConfiguration)
-     * @see #createContainer(IsisConfiguration)
-     * @see #createIdentifierGenerator(IsisConfiguration)
-     * @see #createRuntimeContext(IsisConfiguration)
-     * @see #createServicesInjector(IsisConfiguration)
+     * <p>
+     * By default, just returns the provided {@link MetaModelValidator}.  Note that this is of type {@link MetaModelValidatorComposite} in order to
+     * allow new {@link MetaModelValidator}s to be easily {@link MetaModelValidatorComposite#add(MetaModelValidator) added}. 
      */
     @Override
-    public PersistenceSession createPersistenceSession(final PersistenceSessionFactory persistenceSessionFactory) {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("installing " + this.getClass().getName());
-        }
-
-        final PojoRecreator pojoRecreator = createPojoRecreator(getConfiguration());
-        final ObjectAdapterFactory adapterFactory = createAdapterFactory(getConfiguration());
-        final ObjectFactory objectFactory = createObjectFactory(getConfiguration());
-        final IdentifierGenerator identifierGenerator = createIdentifierGenerator(getConfiguration());
-
-        final RuntimeContext runtimeContext = createRuntimeContext(getConfiguration());
-        final DomainObjectContainer container = createContainer(getConfiguration());
-
-        final ServicesInjectorSpi servicesInjector = createServicesInjector(getConfiguration());
-        final List<Object> serviceList = persistenceSessionFactory.getServices();
-
-        ensureThatArg(pojoRecreator, is(not(nullValue())));
-        ensureThatArg(adapterFactory, is(not(nullValue())));
-        ensureThatArg(objectFactory, is(not(nullValue())));
-        ensureThatArg(identifierGenerator, is(not(nullValue())));
-
-        ensureThatArg(runtimeContext, is(not(nullValue())));
-        ensureThatArg(container, is(not(nullValue())));
-        ensureThatArg(serviceList, is(not(nullValue())));
-        ensureThatArg(servicesInjector, is(not(nullValue())));
-
-        // wire up components
-        runtimeContext.injectInto(container);
-        runtimeContext.setContainer(container);
-        for (Object service : serviceList) {
-            runtimeContext.injectInto(service);
-        }
-
-        servicesInjector.setContainer(container);
-        servicesInjector.setServices(serviceList);
-        getSpecificationLoader().injectInto(runtimeContext);
-
-        return createPersistenceSession(persistenceSessionFactory, adapterFactory, objectFactory, pojoRecreator, identifierGenerator, servicesInjector);
+    public MetaModelValidator refineMetaModelValidator(MetaModelValidatorComposite baseMetaModelValidator, IsisConfiguration configuration) {
+        return baseMetaModelValidator;
     }
 
-    
-
-    // ///////////////////////////////////////////
-    // Optional hook methods
-    // ///////////////////////////////////////////
-
-
     /**
      * Hook method to allow subclasses to specify a different implementation of
      * {@link ObjectAdapterFactory}.
      * 
      * <p>
-     * By default, looks up implementation from provided
-     * {@link IsisConfiguration} using
-     * {@link PersistenceConstants#ADAPTER_FACTORY_CLASS_NAME}. If no
-     * implementation is specified, then defaults to
-     * {@value PersistenceConstants#ADAPTER_FACTORY_CLASS_NAME_DEFAULT}.
-     */
-    protected ObjectAdapterFactory createAdapterFactory(final IsisConfiguration configuration) {
-        final String configuredClassName = configuration.getString(PersistenceConstants.ADAPTER_FACTORY_CLASS_NAME, PersistenceConstants.ADAPTER_FACTORY_CLASS_NAME_DEFAULT);
-        return InstanceUtil.createInstance(configuredClassName, ObjectAdapterFactory.class);
+     * By default, returns {@link PojoAdapterFactory};
+     */
+    public ObjectAdapterFactory createAdapterFactory(final IsisConfiguration configuration) {
+        return new PojoAdapterFactory();
     }
-
+    
     /**
      * Hook method to allow subclasses to specify a different implementation of
      * {@link ObjectFactory}.
      * 
      * <p>
-     * By default, looks up implementation from provided
-     * {@link IsisConfiguration} using
-     * {@link PersistenceConstants#OBJECT_FACTORY_CLASS_NAME}. If no
-     * implementation is specified, then defaults to
-     * {@value PersistenceConstants#OBJECT_FACTORY_CLASS_NAME_DEFAULT}.
-     */
-    protected ObjectFactory createObjectFactory(final IsisConfiguration configuration) {
-        final String configuredClassName = configuration.getString(PersistenceConstants.OBJECT_FACTORY_CLASS_NAME, PersistenceConstants.OBJECT_FACTORY_CLASS_NAME_DEFAULT);
-        return InstanceUtil.createInstance(configuredClassName, PersistenceConstants.OBJECT_FACTORY_CLASS_NAME_DEFAULT, ObjectFactory.class);
+     * By default, returns <tt>org.apache.isis.runtimes.dflt.bytecode.dflt.objectfactory.CglibObjectFactory</tt>.  Note that this requires that
+     * the <tt>org.apache.isis.runtimes.dflt.bytecode:dflt</tt> module is added to the classpath. 
+     */
+    public ObjectFactory createObjectFactory(final IsisConfiguration configuration) {
+        return InstanceUtil.createInstance(PersistenceConstants.OBJECT_FACTORY_CLASS_NAME_DEFAULT, ObjectFactory.class);
     }
-
+    
     /**
      * Hook method to allow subclasses to specify a different implementation of
      * {@link ServicesInjectorSpi}
      * 
      * <p>
-     * By default, looks up implementation from provided
-     * {@link IsisConfiguration} using
-     * {@link PersistenceConstants#SERVICES_INJECTOR_CLASS_NAME}. If no
-     * implementation is specified, then defaults to
-     * {@value PersistenceConstants#SERVICES_INJECTOR_CLASS_NAME_DEFAULT}.
-     */
-    protected ServicesInjectorSpi createServicesInjector(final IsisConfiguration configuration) {
-        final String configuredClassName = configuration.getString(PersistenceConstants.SERVICES_INJECTOR_CLASS_NAME, PersistenceConstants.SERVICES_INJECTOR_CLASS_NAME_DEFAULT);
-        return InstanceUtil.createInstance(configuredClassName, ServicesInjectorSpi.class);
+     * By default, returns {@link ServicesInjectorDefault};
+     */
+    public ServicesInjectorSpi createServicesInjector(final IsisConfiguration configuration) {
+        return new ServicesInjectorDefault();
     }
 
     /**
      * Hook method to allow subclasses to specify a different implementation of
-     * {@link OidGenerator}
+     * {@link IdentifierGenerator}
      * 
      * <p>
-     * By default, looks up implementation from provided
-     * {@link IsisConfiguration} using
-     * {@link PersistenceConstants#IDENTIFIER_GENERATOR_CLASS_NAME}. If no
-     * implementation is specified, then defaults to
-     * {@value PersistenceConstants#IDENTIFIER_GENERATOR_CLASS_NAME_DEFAULT}.
-     */
-    protected IdentifierGenerator createIdentifierGenerator(final IsisConfiguration configuration) {
-        final String identifierGeneratorClassName = configuration.getString(PersistenceConstants.IDENTIFIER_GENERATOR_CLASS_NAME, PersistenceConstants.IDENTIFIER_GENERATOR_CLASS_NAME_DEFAULT);
-        return InstanceUtil.createInstance(identifierGeneratorClassName, IdentifierGenerator.class);
+     * By default, returns {@link IdentifierGeneratorDefault}.
+     */
+    public IdentifierGenerator createIdentifierGenerator(final IsisConfiguration configuration) {
+        return new IdentifierGeneratorDefault();
     }
 
-
     /**
      * Hook method to return {@link PojoRecreator}.
      * 
      * <p>
-     * By default returns an {@link PojoRecreatorDefault}.
+     * By default, returns {@link PojoRecreatorDefault}.
      */
-    protected PojoRecreator createPojoRecreator(final IsisConfiguration configuration) {
+    public PojoRecreator createPojoRecreator(final IsisConfiguration configuration) {
         return new PojoRecreatorDefault();
     }
 
     /**
-     * Hook method to return a {@link RuntimeContext}.
+     * Hook method to return a {@link DomainObjectContainer}.
      * 
      * <p>
-     * By default, returns a {@link RuntimeContextFromSession}.
+    * By default, looks up implementation from provided
+    * {@link IsisConfiguration} using
+    * {@link PersistenceConstants#DOMAIN_OBJECT_CONTAINER_CLASS_NAME}. If no
+    * implementation is specified, then defaults to
+    * {@value PersistenceConstants#DOMAIN_OBJECT_CONTAINER_NAME_DEFAULT}.
      */
-    protected RuntimeContext createRuntimeContext(final IsisConfiguration configuration) {
+    public DomainObjectContainer createContainer(final IsisConfiguration configuration) {
+        final String configuredClassName = configuration.getString(PersistenceConstants.DOMAIN_OBJECT_CONTAINER_CLASS_NAME, PersistenceConstants.DOMAIN_OBJECT_CONTAINER_NAME_DEFAULT);
+        return InstanceUtil.createInstance(configuredClassName, PersistenceConstants.DOMAIN_OBJECT_CONTAINER_NAME_DEFAULT, DomainObjectContainer.class);
+    }
+    
+
+    
+    // ///////////////////////////////////////////
+    // Non overridable.
+    // ///////////////////////////////////////////
+
+    /**
+     * Returns a {@link RuntimeContext}, with all application-specific properties
+     * from the provided {@link IsisConfiguration} copied over.
+     */
+    public final RuntimeContext createRuntimeContext(final IsisConfiguration configuration) {
+        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
+        final Properties properties = applicationPropertiesFrom(configuration);
+        runtimeContext.setProperties(properties);
+        return runtimeContext;
+    }
+
+    private static Properties applicationPropertiesFrom(final IsisConfiguration configuration) {
         final Properties properties = new Properties();
         final IsisConfiguration applicationConfiguration = configuration.getProperties("application");
         for (final String key : applicationConfiguration) {
@@ -324,25 +311,9 @@ public abstract class PersistenceMechani
             final String newKey = key.substring("application.".length());
             properties.setProperty(newKey, value);
         }
-        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
-        runtimeContext.setProperties(properties);
-        return runtimeContext;
+        return properties;
     }
 
-    /**
-     * Hook method to return a {@link DomainObjectContainer}.
-     * 
-     * <p>
-     * By default, looks up implementation from provided
-     * {@link IsisConfiguration} using
-     * {@link PersistenceConstants#DOMAIN_OBJECT_CONTAINER_CLASS_NAME}. If no
-     * implementation is specified, then defaults to
-     * {@value PersistenceConstants#DOMAIN_OBJECT_CONTAINER_NAME_DEFAULT}.
-     */
-    protected DomainObjectContainer createContainer(final IsisConfiguration configuration) {
-        final String configuredClassName = configuration.getString(PersistenceConstants.DOMAIN_OBJECT_CONTAINER_CLASS_NAME, PersistenceConstants.DOMAIN_OBJECT_CONTAINER_NAME_DEFAULT);
-        return InstanceUtil.createInstance(configuredClassName, PersistenceConstants.DOMAIN_OBJECT_CONTAINER_NAME_DEFAULT, DomainObjectContainer.class);
-    }
 
     // /////////////////////////////////////////////////////
     // Dependencies (from setters)

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceConstants.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceConstants.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceConstants.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceConstants.java Mon Oct  8 18:44:36 2012
@@ -22,44 +22,22 @@ package org.apache.isis.runtimes.dflt.ru
 import org.apache.isis.applib.DomainObjectContainer;
 import org.apache.isis.core.commons.config.ConfigurationConstants;
 import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
-import org.apache.isis.core.metamodel.services.ServicesInjectorDefault;
-import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault;
-import org.apache.isis.runtimes.dflt.runtime.persistence.adapter.PojoAdapterFactory;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGeneratorDefault;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutor;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.ObjectFactory;
 
 public final class PersistenceConstants {
 
-    /**
-     * Key used to lookup implementation of {@link ObjectAdapterFactory} in
-     * {@link IsisConfiguration}.
-     */
-    public static final String ADAPTER_FACTORY_CLASS_NAME = ConfigurationConstants.ROOT + "persistor.adapter-factory";
-    public static final String ADAPTER_FACTORY_CLASS_NAME_DEFAULT = PojoAdapterFactory.class.getName();
-
-    /**
-     * Key used to lookup implementation of {@link IdentifierGenerator} in
-     * {@link IsisConfiguration}.
-     */
-    public static final String IDENTIFIER_GENERATOR_CLASS_NAME = ConfigurationConstants.ROOT + "persistor.identifier-generator";
-    public static final String IDENTIFIER_GENERATOR_CLASS_NAME_DEFAULT = IdentifierGeneratorDefault.class.getName();
 
     /**
-     * Key used to lookup implementation of {@link ObjectFactory} in
-     * {@link IsisConfiguration}.
+     * Default implementation to use as {@link ObjectFactory}.
      */
-    public static final String OBJECT_FACTORY_CLASS_NAME = ConfigurationConstants.ROOT + "persistor.object-factory";
     public static final String OBJECT_FACTORY_CLASS_NAME_DEFAULT = "org.apache.isis.runtimes.dflt.bytecode.dflt.objectfactory.CglibObjectFactory";
-
+    
     /**
-     * Key used to lookup implementation of {@link ServicesInjectorSpi} in
-     * {@link IsisConfiguration}.
+     * Default implementation to use as {@link ClassSubstitutor}.
      */
-    public static final String SERVICES_INJECTOR_CLASS_NAME = ConfigurationConstants.ROOT + "persistor.services-injector";
-    public static final String SERVICES_INJECTOR_CLASS_NAME_DEFAULT = ServicesInjectorDefault.class.getName();
+    public static final String CLASS_SUBSTITUTOR_CLASS_NAME_DEFAULT = "org.apache.isis.runtimes.dflt.bytecode.dflt.classsubstitutor.CglibClassSubstitutor";
 
     /**
      * Key used to lookup implementation of {@link DomainObjectContainer} in

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceSessionFactoryDelegate.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceSessionFactoryDelegate.java?rev=1395713&r1=1395712&r2=1395713&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceSessionFactoryDelegate.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistenceSessionFactoryDelegate.java Mon Oct  8 18:44:36 2012
@@ -19,7 +19,16 @@
 
 package org.apache.isis.runtimes.dflt.runtime.persistence;
 
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.commons.config.IsisConfigurationBuilderAware;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
+import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
+import org.apache.isis.runtimes.dflt.runtime.persistence.adaptermanager.PojoRecreator;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.ObjectFactory;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionFactory;
 
@@ -27,7 +36,31 @@ import org.apache.isis.runtimes.dflt.run
  * Creates a {@link PersistenceSession} on behalf of a
  * {@link PersistenceSessionFactory}.
  */
-public interface PersistenceSessionFactoryDelegate extends IsisConfigurationBuilderAware {
+public interface PersistenceSessionFactoryDelegate extends IsisConfigurationBuilderAware, MetaModelRefiner {
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    // singleton threadsafe components created during init
+    ///////////////////////////////////////////////////////////////////////////
+    
+    PojoRecreator createPojoRecreator(IsisConfiguration configuration);
+
+    ObjectAdapterFactory createAdapterFactory(IsisConfiguration configuration);
+
+    ObjectFactory createObjectFactory(IsisConfiguration configuration);
+
+    IdentifierGenerator createIdentifierGenerator(IsisConfiguration configuration);
+
+    ServicesInjectorSpi createServicesInjector(IsisConfiguration configuration);
+
+    DomainObjectContainer createContainer(IsisConfiguration configuration);
+
+    RuntimeContext createRuntimeContext(IsisConfiguration configuration);
+
+    
+    ///////////////////////////////////////////////////////////////////////////
+    // created for each session
+    ///////////////////////////////////////////////////////////////////////////
 
     /**
      * As per {@link PersistenceSessionFactory#createPersistenceSession()}, but
@@ -37,4 +70,6 @@ public interface PersistenceSessionFacto
      */
     PersistenceSession createPersistenceSession(PersistenceSessionFactory persistenceSessionFactory);
 
+    
+    
 }



Mime
View raw message