incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1376441 - in /incubator/isis/trunk: examples/quickstart/webapp/src/main/webapp/WEB-INF/ examples/quickstart/wicket/src/main/webapp/WEB-INF/ framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/installerregist...
Date Thu, 23 Aug 2012 11:21:13 GMT
Author: danhaywood
Date: Thu Aug 23 11:21:13 2012
New Revision: 1376441

URL: http://svn.apache.org/viewvc?rev=1376441&view=rev
Log:
ISIS-248: disabling persistor concurrency checking by default

- added config flag "isis.persistor.concurrencyChecking" to enable/disable checks
- disabled by default (which maintains backward compability with earlier design)

Modified:
    incubator/isis/trunk/examples/quickstart/webapp/src/main/webapp/WEB-INF/isis.properties
    incubator/isis/trunk/examples/quickstart/wicket/src/main/webapp/WEB-INF/isis.properties
    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/adaptermanager/AdapterManagerDefault.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/objectstore/PersistenceSessionObjectStoreTest.java

Modified: incubator/isis/trunk/examples/quickstart/webapp/src/main/webapp/WEB-INF/isis.properties
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/quickstart/webapp/src/main/webapp/WEB-INF/isis.properties?rev=1376441&r1=1376440&r2=1376441&view=diff
==============================================================================
--- incubator/isis/trunk/examples/quickstart/webapp/src/main/webapp/WEB-INF/isis.properties
(original)
+++ incubator/isis/trunk/examples/quickstart/webapp/src/main/webapp/WEB-INF/isis.properties
Thu Aug 23 11:21:13 2012
@@ -155,6 +155,12 @@ isis.reflector.class-substitutor=org.apa
 
 
 
+#
+# enable concurrency checking within the persistor
+#
+#isis.persistor.concurrencyChecking=true
+
+
 #################################################################################
 #
 # Application Services and fixtures

Modified: incubator/isis/trunk/examples/quickstart/wicket/src/main/webapp/WEB-INF/isis.properties
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/quickstart/wicket/src/main/webapp/WEB-INF/isis.properties?rev=1376441&r1=1376440&r2=1376441&view=diff
==============================================================================
--- incubator/isis/trunk/examples/quickstart/wicket/src/main/webapp/WEB-INF/isis.properties
(original)
+++ incubator/isis/trunk/examples/quickstart/wicket/src/main/webapp/WEB-INF/isis.properties
Thu Aug 23 11:21:13 2012
@@ -70,6 +70,8 @@ isis.persistor=datanucleus
 #isis.persistor=xml
 
 
+
+
 #
 # configure authentication mechanis to use (to logon to the system)
 # note that the Scimpi view allows access to anonymous users
@@ -155,6 +157,12 @@ isis.reflector.class-substitutor=org.apa
 
 
 
+#
+# enable concurrency checking within the persistor
+#
+#isis.persistor.concurrencyChecking=true
+
+
 #################################################################################
 #
 # Application Services and fixtures

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=1376441&r1=1376440&r2=1376441&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
Thu Aug 23 11:21:13 2012
@@ -111,7 +111,7 @@ public abstract class PersistenceMechani
             final ServicesInjectorSpi servicesInjector) {
 
         final PersistAlgorithm persistAlgorithm = createPersistAlgorithm(getConfiguration());
-        final AdapterManagerDefault adapterManager = new AdapterManagerDefault(pojoRecreator);
+        final AdapterManagerDefault adapterManager = new AdapterManagerDefault(getConfiguration(),
pojoRecreator);
         
         ObjectStoreSpi objectStore = createObjectStore(getConfiguration(), objectAdapterFactory,
adapterManager);
 
@@ -299,15 +299,6 @@ public abstract class PersistenceMechani
         return InstanceUtil.createInstance(identifierGeneratorClassName, IdentifierGenerator.class);
     }
 
-    /**
-     * Hook method to return {@link AdapterManagerSpi}.
-     * 
-     * <p>
-     * By default returns an {@link AdapterManagerDefault}.
-     */
-    private AdapterManagerSpi createAdapterManager(final IsisConfiguration configuration)
{
-        return new AdapterManagerDefault(createPojoRecreator(configuration));
-    }
 
     /**
      * Hook method to return {@link PojoRecreator}.

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java?rev=1376441&r1=1376440&r2=1376441&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java
Thu Aug 23 11:21:13 2012
@@ -30,6 +30,7 @@ import java.util.Iterator;
 import org.apache.log4j.Logger;
 
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.ensure.Assert;
 import org.apache.isis.core.commons.ensure.Ensure;
@@ -63,12 +64,16 @@ import org.apache.isis.runtimes.dflt.run
 
 public class AdapterManagerDefault implements AdapterManagerSpi {
 
+    private static final String ISIS_PERSISTOR_CONCURRENCY_CHECKING = "isis.persistor.concurrencyChecking";
+
     private static final Logger LOG = Logger.getLogger(AdapterManagerDefault.class);
 
     protected final PojoAdapterHashMap pojoAdapterMap = new PojoAdapterHashMap();
     protected final OidAdapterHashMap oidAdapterMap = new OidAdapterHashMap();
 
     private final PojoRecreator pojoRecreator;
+
+    private final boolean concurrencyChecking;
     
 
     // //////////////////////////////////////////////////////////////////
@@ -79,10 +84,12 @@ public class AdapterManagerDefault imple
      * For object store implementations (eg JDO) that do not provide any mechanism
      * to allow transient objects to be reattached; can instead provide a
      * {@link PojoRecreator} implementation that is injected into the Adapter Manager.
+     * @param isisConfiguration TODO
      * 
      * @see http://www.datanucleus.org/servlet/forum/viewthread_thread,7238_lastpage,yes#35976
      */
-    public AdapterManagerDefault(PojoRecreator pojoRecreator) {
+    public AdapterManagerDefault(IsisConfiguration isisConfiguration, PojoRecreator pojoRecreator)
{
+        concurrencyChecking = isisConfiguration.getBoolean(ISIS_PERSISTOR_CONCURRENCY_CHECKING,
false);
         this.pojoRecreator = pojoRecreator;
     }
 
@@ -286,11 +293,13 @@ public class AdapterManagerDefault imple
         final Object pojo = pojoRecreator.recreatePojo(typedOid);
         ObjectAdapter adapter = mapRecreatedPojo(typedOid, pojo);
         
-        Oid adapterOid = adapter.getOid();
-        if(adapterOid instanceof RootOid) {
-            final RootOid recreatedOid = (RootOid) adapterOid;
-            final RootOid originalOid = (RootOid) typedOid;
-            recreatedOid.checkLock(getAuthenticationSession().getUserName(), originalOid);
+        if(concurrencyChecking) {
+            final Oid adapterOid = adapter.getOid();
+            if(adapterOid instanceof RootOid) {
+                final RootOid recreatedOid = (RootOid) adapterOid;
+                final RootOid originalOid = (RootOid) typedOid;
+                recreatedOid.checkLock(getAuthenticationSession().getUserName(), originalOid);
+            }
         }
         return adapter;
     }

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java?rev=1376441&r1=1376440&r2=1376441&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java
Thu Aug 23 11:21:13 2012
@@ -35,6 +35,7 @@ import org.apache.isis.applib.annotation
 import org.apache.isis.applib.annotation.MemberOrder;
 import org.apache.isis.applib.profiles.Localization;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
 import org.apache.isis.core.metamodel.adapter.ResolveState;
@@ -98,6 +99,9 @@ public class AdapterManagerDefault_aggre
     @Mock
     private AuthenticationSession mockAuthenticationSession;
     
+    @Mock
+    private IsisConfiguration mockConfiguration;
+    
     private IsisMetaModel isisMetaModel;
     
     private ObjectAdapterFactory adapterFactory;
@@ -110,6 +114,7 @@ public class AdapterManagerDefault_aggre
     private ObjectAdapter persistentParentAdapter;
     private ObjectAdapter aggregatedAdapter;
 
+
     
     
     @Before
@@ -118,6 +123,7 @@ public class AdapterManagerDefault_aggre
 
         context.ignoring(mockRuntimeContext);
         context.ignoring(mockAuthenticationSession);
+        context.ignoring(mockConfiguration);
         
         isisMetaModel = IsisMetaModel.builder(mockRuntimeContext, new ProgrammingModelFacetsJava5()).withServices(new
CustomerRepository()).build();
         isisMetaModel.init();
@@ -138,7 +144,7 @@ public class AdapterManagerDefault_aggre
             }
         };
 
-        adapterManager = new AdapterManagerDefault(new PojoRecreatorDefault()) {
+        adapterManager = new AdapterManagerDefault(mockConfiguration, new PojoRecreatorDefault())
{
             @Override
             protected SpecificationLoaderSpi getSpecificationLoader() {
                 return isisMetaModel.getSpecificationLoader();

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/objectstore/PersistenceSessionObjectStoreTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/objectstore/PersistenceSessionObjectStoreTest.java?rev=1376441&r1=1376440&r2=1376441&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/objectstore/PersistenceSessionObjectStoreTest.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/objectstore/PersistenceSessionObjectStoreTest.java
Thu Aug 23 11:21:13 2012
@@ -30,6 +30,7 @@ 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.commons.matchers.IsisMatchers;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
@@ -101,11 +102,14 @@ public class PersistenceSessionObjectSto
     @Mock
     private RuntimeContext mockRuntimeContext;
 
+    @Mock
+    private IsisConfiguration mockConfiguration;
     
     
     private IsisMetaModel isisMetaModel;
 
 
+
     public static class Customer {
     }
 
@@ -118,6 +122,7 @@ public class PersistenceSessionObjectSto
         Logger.getRootLogger().setLevel(Level.OFF);
 
         context.ignoring(mockRuntimeContext);
+        context.ignoring(mockConfiguration);
 
         isisMetaModel = new IsisMetaModel(mockRuntimeContext, new ProgrammingModelFacetsJava5(),
new CustomerRepository());
         isisMetaModel.init();
@@ -145,7 +150,7 @@ public class PersistenceSessionObjectSto
         servicesInjector = new ServicesInjectorDefault();
         servicesInjector.setContainer(container);
 
-        adapterManager = new AdapterManagerDefault(new PojoRecreatorDefault());
+        adapterManager = new AdapterManagerDefault(mockConfiguration, new PojoRecreatorDefault());
         adapterFactory = new PojoAdapterFactory();
         persistenceSession = new PersistenceSession(mockPersistenceSessionFactory, adapterFactory,
objectFactory, servicesInjector, new OidGenerator(new IdentifierGeneratorDefault()), adapterManager,
mockPersistAlgorithm, mockObjectStore) {
             @Override



Mime
View raw message