You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by rm...@apache.org on 2011/03/24 14:55:46 UTC

svn commit: r1084960 - /incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/

Author: rmatthews
Date: Thu Mar 24 13:55:45 2011
New Revision: 1084960

URL: http://svn.apache.org/viewvc?rev=1084960&view=rev
Log:
Split out persistence commands (create and save where the same) as the type is used by the transaction manager to prevent unnecessary writes being made.  Was removing a delete when a save was made, when in fact it should remove the delete only when preceded by a create.

Added:
    incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/CreateObjectCommandImplementation.java   (with props)
    incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/SaveObjectCommandImplementation.java   (with props)
Modified:
    incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/NoSqlObjectStore.java
    incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/WriteObjectCommand.java

Added: incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/CreateObjectCommandImplementation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/CreateObjectCommandImplementation.java?rev=1084960&view=auto
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/CreateObjectCommandImplementation.java (added)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/CreateObjectCommandImplementation.java Thu Mar 24 13:55:45 2011
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.nosql;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.CreateObjectCommand;
+
+
+final class CreateObjectCommandImplementation extends WriteObjectCommand implements CreateObjectCommand {
+
+    public CreateObjectCommandImplementation(KeyCreator keyCreator, VersionCreator versionCreator, ObjectAdapter object) {
+        super(false, keyCreator, versionCreator, object);
+    }
+
+}

Propchange: incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/CreateObjectCommandImplementation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/isis/trunk/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/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/NoSqlObjectStore.java?rev=1084960&r1=1084959&r2=1084960&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/NoSqlObjectStore.java (original)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/NoSqlObjectStore.java Thu Mar 24 13:55:45 2011
@@ -75,7 +75,7 @@ public class NoSqlObjectStore implements
             //throw new UnexpectedCallException("Aggregated objects should not be created outside of their owner");
             return null;
         } else {
-            return new WriteObjectCommand(false, keyCreator, versionCreator, object);
+            return new CreateObjectCommandImplementation(keyCreator, versionCreator, object);
         }
     }
 
@@ -92,7 +92,7 @@ public class NoSqlObjectStore implements
     public SaveObjectCommand createSaveObjectCommand(final ObjectAdapter adapter) {
         // TODO should this be done at a higher level so it is applicable for all OSes
         final ObjectAdapter rootAdapter = aggregateRootAdapterFor(adapter);
-        return new WriteObjectCommand(true, keyCreator, versionCreator, rootAdapter);
+        return new SaveObjectCommandImplementation(keyCreator, versionCreator, rootAdapter);
     }
 
     /**

Added: incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/SaveObjectCommandImplementation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/SaveObjectCommandImplementation.java?rev=1084960&view=auto
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/SaveObjectCommandImplementation.java (added)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/SaveObjectCommandImplementation.java Thu Mar 24 13:55:45 2011
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.nosql;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.SaveObjectCommand;
+
+
+final class SaveObjectCommandImplementation extends WriteObjectCommand implements SaveObjectCommand {
+
+    public SaveObjectCommandImplementation(KeyCreator keyCreator, VersionCreator versionCreator, ObjectAdapter object) {
+        super(true, keyCreator, versionCreator, object);
+    }
+
+}

Propchange: incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/SaveObjectCommandImplementation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/WriteObjectCommand.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/WriteObjectCommand.java?rev=1084960&r1=1084959&r2=1084960&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/WriteObjectCommand.java (original)
+++ incubator/isis/trunk/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/WriteObjectCommand.java Thu Mar 24 13:55:45 2011
@@ -31,12 +31,11 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.runtimes.dflt.runtime.context.IsisContext;
-import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.CreateObjectCommand;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.PersistenceCommand;
 import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.PersistenceCommandContext;
-import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.SaveObjectCommand;
 
 
-final class WriteObjectCommand implements CreateObjectCommand, SaveObjectCommand {
+class WriteObjectCommand implements PersistenceCommand {
     private final KeyCreator keyCreator;
     private final ObjectAdapter object;
     private final VersionCreator versionCreator;