You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/09/10 15:32:14 UTC

[1/3] isis git commit: ISIS-1194: reinstating deleted classes, for backward compatibility. Also removing stale javadoc references to deleted ObjectStore class.

Repository: isis
Updated Branches:
  refs/heads/ISIS-1194 550b88d6e -> 7da8aa53e


ISIS-1194: reinstating deleted classes, for backward compatibility.  Also removing stale javadoc references to deleted ObjectStore class.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/6af91784
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/6af91784
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/6af91784

Branch: refs/heads/ISIS-1194
Commit: 6af91784cf242419e74e428f393ae5728e5223c4
Parents: 550b88d
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 13:27:16 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 13:27:16 2015 +0100

----------------------------------------------------------------------
 .../transaction/TransactionalResource.java      |  9 +++---
 .../TransactionalClosureAbstract.java           | 30 ++++++++++++++++++++
 .../TransactionalClosureWithReturnAbstract.java | 30 ++++++++++++++++++++
 3 files changed, 64 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/6af91784/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/TransactionalResource.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/TransactionalResource.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/TransactionalResource.java
index 94781e4..a04517d 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/TransactionalResource.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/TransactionalResource.java
@@ -19,30 +19,29 @@
 
 package org.apache.isis.core.runtime.persistence.objectstore.transaction;
 
-import org.apache.isis.core.runtime.system.persistence.ObjectStore;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
 
 /**
  * Interface for the {@link IsisTransactionManager} to interact with some
- * transactional resource (ie a {@link ObjectStore}).
+ * transactional resource.
  */
 public interface TransactionalResource {
 
     /**
      * Used by the {@link IsisTransactionManager} to tell the underlying
-     * {@link ObjectStore} to start a transaction.
+     * object store to start a transaction.
      */
     void startTransaction();
 
     /**
      * Used by the {@link IsisTransactionManager} to tell the underlying
-     * {@link ObjectStore} to commit a transaction.
+     * object store to commit a transaction.
      */
     void endTransaction();
 
     /**
      * Used by the {@link IsisTransactionManager} to tell the underlying
-     * {@link ObjectStore} to abort a transaction.
+     * object store to abort a transaction.
      */
     void abortTransaction();
 

http://git-wip-us.apache.org/repos/asf/isis/blob/6af91784/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/TransactionalClosureAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/TransactionalClosureAbstract.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/TransactionalClosureAbstract.java
new file mode 100644
index 0000000..cace0c3
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/TransactionalClosureAbstract.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.system.transaction;
+
+/**
+ * Not used by the framework, but provided for backward compatibility.
+ *
+ * @deprecated - implement {@link TransactionalClosure} instead
+ */
+@Deprecated
+public abstract class TransactionalClosureAbstract implements TransactionalClosure {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6af91784/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/TransactionalClosureWithReturnAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/TransactionalClosureWithReturnAbstract.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/TransactionalClosureWithReturnAbstract.java
new file mode 100644
index 0000000..78849b8
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/TransactionalClosureWithReturnAbstract.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.system.transaction;
+
+/**
+ * Not used by the framework, but provided for backward compatibility.
+ *
+ * @deprecated - implement {@link TransactionalClosureWithReturn} instead
+ */
+@Deprecated
+public abstract class TransactionalClosureWithReturnAbstract<T> implements TransactionalClosureWithReturn<T> {
+
+}


[3/3] isis git commit: ISIS-1194: simplifying ObjectSpecificationDefault#createObject

Posted by da...@apache.org.
ISIS-1194: simplifying ObjectSpecificationDefault#createObject


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/7da8aa53
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/7da8aa53
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/7da8aa53

Branch: refs/heads/ISIS-1194
Commit: 7da8aa53e4604b81c42137454fd4984a3245023e
Parents: 694e3b0
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 14:22:33 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 14:22:33 2015 +0100

----------------------------------------------------------------------
 .../dflt/ObjectSpecificationDefault.java        | 38 +++++++++-----------
 1 file changed, 17 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/7da8aa53/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java
index a9d5f43..5ff3e3b 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java
@@ -418,32 +418,28 @@ public class ObjectSpecificationDefault extends ObjectSpecificationAbstract impl
         }
         
         try {
-            return instantiate(getCorrespondingClass());
-        } catch (final ObjectInstantiationException e) {
-            throw new IsisException("Failed to create instance of type " + getFullIdentifier(), e);
-        }
-    }
+            final Class<?> cls = getCorrespondingClass();
 
-    private <T> T instantiate(final Class<T> cls) throws ObjectInstantiationException {
+            if (Modifier.isAbstract(cls.getModifiers())) {
+                throw new ObjectInstantiationException("Cannot create an instance of an abstract class: " + cls);
+            }
+            final Object newInstance;
+            if (Modifier.isAbstract(cls.getModifiers())) {
+                throw new ObjectInstantiationException("Cannot create an instance of an abstract class: " + cls);
+            }
+            try {
+                newInstance = cls.newInstance();
+            } catch (final IllegalAccessException | InstantiationException e) {
+                throw new ObjectInstantiationException(e);
+            }
 
-        if (Modifier.isAbstract(cls.getModifiers())) {
-            throw new ObjectInstantiationException("Cannot create an instance of an abstract class: " + cls);
-        }
-        final T newInstance;
-        if (Modifier.isAbstract(cls.getModifiers())) {
-            throw new ObjectInstantiationException("Cannot create an instance of an abstract class: " + cls);
-        }
-        try {
-            newInstance = cls.newInstance();
-        } catch (final IllegalAccessException | InstantiationException e) {
-            throw new ObjectInstantiationException(e);
+            getDependencyInjector().injectServicesInto(newInstance);
+            return newInstance;
+        } catch (final ObjectInstantiationException e) {
+            throw new IsisException("Failed to create instance of type " + getFullIdentifier(), e);
         }
-
-        getDependencyInjector().injectServicesInto(newInstance);
-        return newInstance;
     }
 
-
     /**
      * REVIEW: does this behaviour live best here?  Not that sure that it does...
      */


[2/3] isis git commit: ISIS-1194: inlining ObjectFactory's createObject into ObjectSpecificationDefault (its only caller).

Posted by da...@apache.org.
ISIS-1194: inlining ObjectFactory's createObject into ObjectSpecificationDefault (its only caller).


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/694e3b00
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/694e3b00
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/694e3b00

Branch: refs/heads/ISIS-1194
Commit: 694e3b005ab6c1ae1a5cb96ea0f35df14306a456
Parents: 6af9178
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 14:21:08 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 14:21:08 2015 +0100

----------------------------------------------------------------------
 .../specimpl/ObjectSpecificationAbstract.java   |  5 ---
 .../dflt/ObjectSpecificationDefault.java        | 23 ++++++++++++-
 .../ObjectSpecificationOnStandaloneList.java    |  7 ++++
 .../system/persistence/ObjectFactory.java       | 34 +++-----------------
 4 files changed, 34 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/694e3b00/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectSpecificationAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectSpecificationAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectSpecificationAbstract.java
index a5ce07b..24f4c68 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectSpecificationAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectSpecificationAbstract.java
@@ -1151,11 +1151,6 @@ public abstract class ObjectSpecificationAbstract extends FacetHolderImpl implem
     // //////////////////////////////////////////////////////////////////////
 
     @Override
-    public Object createObject() {
-        throw new UnsupportedOperationException(getFullIdentifier());
-    }
-
-    @Override
     public ObjectAdapter initialize(ObjectAdapter objectAdapter) {
         return objectAdapter;
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/694e3b00/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java
index 395497a..a9d5f43 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/dflt/ObjectSpecificationDefault.java
@@ -21,6 +21,7 @@ package org.apache.isis.core.metamodel.specloader.specimpl.dflt;
 
 import java.lang.reflect.Array;
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -417,12 +418,32 @@ public class ObjectSpecificationDefault extends ObjectSpecificationAbstract impl
         }
         
         try {
-            return getObjectInstantiator().instantiate(getCorrespondingClass());
+            return instantiate(getCorrespondingClass());
         } catch (final ObjectInstantiationException e) {
             throw new IsisException("Failed to create instance of type " + getFullIdentifier(), e);
         }
     }
 
+    private <T> T instantiate(final Class<T> cls) throws ObjectInstantiationException {
+
+        if (Modifier.isAbstract(cls.getModifiers())) {
+            throw new ObjectInstantiationException("Cannot create an instance of an abstract class: " + cls);
+        }
+        final T newInstance;
+        if (Modifier.isAbstract(cls.getModifiers())) {
+            throw new ObjectInstantiationException("Cannot create an instance of an abstract class: " + cls);
+        }
+        try {
+            newInstance = cls.newInstance();
+        } catch (final IllegalAccessException | InstantiationException e) {
+            throw new ObjectInstantiationException(e);
+        }
+
+        getDependencyInjector().injectServicesInto(newInstance);
+        return newInstance;
+    }
+
+
     /**
      * REVIEW: does this behaviour live best here?  Not that sure that it does...
      */

http://git-wip-us.apache.org/repos/asf/isis/blob/694e3b00/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/standalonelist/ObjectSpecificationOnStandaloneList.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/standalonelist/ObjectSpecificationOnStandaloneList.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/standalonelist/ObjectSpecificationOnStandaloneList.java
index c2ba620..18ce582 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/standalonelist/ObjectSpecificationOnStandaloneList.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/standalonelist/ObjectSpecificationOnStandaloneList.java
@@ -182,4 +182,11 @@ public class ObjectSpecificationOnStandaloneList extends ObjectSpecificationAbst
     }
 
 
+    @Override
+    public Object createObject() {
+        throw new UnsupportedOperationException(getFullIdentifier());
+    }
+
+
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/694e3b00/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectFactory.java
index ba12543..34b9848 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectFactory.java
@@ -38,48 +38,24 @@ public class ObjectFactory {
 
     public <T> T instantiate(final Class<T> cls) throws ObjectInstantiationException {
 
-        if (getServicesInjector() == null) {
+        if (servicesInjector == null) {
             throw new IllegalStateException("ServicesInjector is not available (no open session)");
         }
         if (Modifier.isAbstract(cls.getModifiers())) {
             throw new ObjectInstantiationException("Cannot create an instance of an abstract class: " + cls);
         }
-        final T newInstance = doInstantiate(cls);
-
-        if (getServicesInjector() != null) {
-            getServicesInjector().injectServicesInto(newInstance);
-        }
-        return newInstance;
-    }
-
-
-    //region > doInstantiate
-
-    /**
-     * Simply instantiates reflectively.
-     */
-    protected <T> T doInstantiate(final Class<T> cls) throws ObjectInstantiationException {
+        final T newInstance;
         if (Modifier.isAbstract(cls.getModifiers())) {
             throw new ObjectInstantiationException("Cannot create an instance of an abstract class: " + cls);
         }
         try {
-            return cls.newInstance();
+            newInstance = cls.newInstance();
         } catch (final IllegalAccessException | InstantiationException e) {
             throw new ObjectInstantiationException(e);
         }
-    }
-    //endregion
-
-    //region > dependencies (from constructor)
-
-    private PersistenceSession getPersistenceSession() {
-        return persistenceSession;
-    }
 
-    protected ServicesInjectorSpi getServicesInjector() {
-        return servicesInjector;
+        servicesInjector.injectServicesInto(newInstance);
+        return newInstance;
     }
 
-    //endregion
-
 }