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 2016/05/26 10:55:37 UTC

[1/3] isis git commit: ISIS-1411: removing DomainObjectContainerResolve helper class (inlining its functionality); removing inner interfaces only implemented by PersistenceSession.

Repository: isis
Updated Branches:
  refs/heads/master 874e8bad1 -> 5b5c1fc5b


ISIS-1411: removing DomainObjectContainerResolve helper class (inlining its functionality); removing inner interfaces only implemented by PersistenceSession.


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

Branch: refs/heads/master
Commit: 086632efa61a025cf07cd2eef68ee65c9b9bd551
Parents: 874e8ba
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue May 24 22:54:12 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue May 24 22:54:12 2016 +0100

----------------------------------------------------------------------
 .../PersistenceSessionServiceInternal.java      |   3 +
 .../container/DomainObjectContainerResolve.java | 124 -------------------
 ...ersistenceSessionServiceInternalDefault.java |  40 ++++--
 .../PublishingServiceInternalDefault.java       |   3 +-
 .../system/persistence/PersistenceSession.java  |  59 ++++-----
 .../transaction/IsisTransactionManager.java     |  23 +---
 ...rsistenceQueryFindAllInstancesProcessor.java |   3 +-
 ...tenceQueryFindUsingApplibQueryProcessor.java |   4 +-
 .../PersistenceQueryProcessorAbstract.java      |  18 +--
 .../AbstractCollectionInvocationHandler.java    |   3 +-
 .../DelegatingInvocationHandlerDefault.java     |  14 +--
 11 files changed, 75 insertions(+), 219 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/086632ef/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/persistsession/PersistenceSessionServiceInternal.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/persistsession/PersistenceSessionServiceInternal.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/persistsession/PersistenceSessionServiceInternal.java
index 763e7b1..cbef9c3 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/persistsession/PersistenceSessionServiceInternal.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/persistsession/PersistenceSessionServiceInternal.java
@@ -60,7 +60,10 @@ public interface PersistenceSessionServiceInternal extends AdapterManager {
      *
      * <p>
      * Called by <tt>DomainObjectContainerDefault</tt>.
+     *
+     * @deprecated - left over from manual object resolving.
      */
+    @Deprecated
     @Programmatic
     void resolve(Object parent, Object field);
 

http://git-wip-us.apache.org/repos/asf/isis/blob/086632ef/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/container/DomainObjectContainerResolve.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/container/DomainObjectContainerResolve.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/container/DomainObjectContainerResolve.java
deleted file mode 100644
index 7e51973..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/container/DomainObjectContainerResolve.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.persistence.container;
-
-import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.applib.services.bookmark.BookmarkService2;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.services.ServicesInjector;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-
-/**
- * Helper class that encapsulates the processing performed by domain object
- * containers that are performing a resolve.
- * 
- * <p>
- * Implementation note: rather than inject in its dependencies, we instead look
- * up dependencies from the {@link IsisContext}. This is necessary, for the
- * {@link PersistenceSession} at least, because class enhancers may hold a
- * reference to the factory as part of the generated bytecode. Since the
- * {@link PersistenceSession} could change over the lifetime of the instance,
- * we must always look the {@link PersistenceSession} from the {@link IsisContext}.
- * The same applies to the {@link ServicesInjector}.
- */
-public class DomainObjectContainerResolve {
-
-    public DomainObjectContainerResolve() {
-    }
-
-    public Object lookup(final Bookmark bookmark, final BookmarkService2.FieldResetPolicy fieldResetPolicy) {
-        RootOid oid = RootOid.create(bookmark);
-        final ObjectAdapter adapter = adapterFor(oid);
-        if(adapter == null) {
-            return null;
-        }
-        if(fieldResetPolicy == BookmarkService2.FieldResetPolicy.RESET) {
-            getPersistenceSession().refreshRootInTransaction(adapter);
-        } else {
-            getPersistenceSession().loadObjectInTransaction(oid);
-        }
-        return adapter.getObject();
-    }
-
-    public Bookmark bookmarkFor(Object domainObject) {
-        final ObjectAdapter adapter = adapterFor(domainObject);
-        final Oid oid = adapter.getOid();
-        if(oid == null) {
-            // values cannot be bookmarked
-            return null;
-        }
-        if(!(oid instanceof RootOid)) {
-            // must be root
-            return null;
-        }
-        final RootOid rootOid = (RootOid) oid;
-        return rootOid.asBookmark();
-    }
-
-    public Bookmark bookmarkFor(final Class<?> cls, final String identifier) {
-        final ObjectSpecification objectSpec = getSpecificationLoader().loadSpecification(cls);
-        String objectType = objectSpec.getSpecId().asString();
-        return new Bookmark(objectType, identifier);
-    }
-
-    public void resolve(final Object parent) {
-        final ObjectAdapter adapter = adapterFor(parent);
-        getPersistenceSession().refreshRootInTransaction(adapter);
-    }
-
-    public void resolve(final Object parent, final Object field) {
-        if (field == null) {
-            resolve(parent);
-        }
-    }
-
-    private ObjectAdapter adapterFor(final Object object) {
-        return getAdapterManager().adapterFor(object);
-    }
-
-    private ObjectAdapter adapterFor(final RootOid oid) {
-        return getPersistenceSession().adapterFor(oid);
-    }
-
-    // /////////////////////////////////////////////////////////////////
-    // Dependencies (looked up from context)
-    // /////////////////////////////////////////////////////////////////
-
-    protected PersistenceSession getPersistenceSession() {
-        return IsisContext.getPersistenceSession();
-    }
-
-    protected AdapterManager getAdapterManager() {
-        return getPersistenceSession();
-    }
-
-    protected SpecificationLoader getSpecificationLoader() {
-        return IsisContext.getSpecificationLoader();
-    }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/086632ef/core/runtime/src/main/java/org/apache/isis/core/runtime/services/persistsession/PersistenceSessionServiceInternalDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/persistsession/PersistenceSessionServiceInternalDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/persistsession/PersistenceSessionServiceInternalDefault.java
index ebe975d..b37cef7 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/persistsession/PersistenceSessionServiceInternalDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/persistsession/PersistenceSessionServiceInternalDefault.java
@@ -27,10 +27,11 @@ import org.apache.isis.applib.services.bookmark.Bookmark;
 import org.apache.isis.applib.services.bookmark.BookmarkService2;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.core.metamodel.services.persistsession.PersistenceSessionServiceInternal;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.core.runtime.persistence.container.DomainObjectContainerResolve;
+import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
@@ -98,27 +99,46 @@ public class PersistenceSessionServiceInternalDefault implements PersistenceSess
     public Object lookup(
             final Bookmark bookmark,
             final BookmarkService2.FieldResetPolicy fieldResetPolicy) {
-        return new DomainObjectContainerResolve().lookup(bookmark, fieldResetPolicy);
+        return getPersistenceSession().lookup(bookmark, fieldResetPolicy);
     }
 
     @Override
     public Bookmark bookmarkFor(Object domainObject) {
-        return new DomainObjectContainerResolve().bookmarkFor(domainObject);
+        final ObjectAdapter adapter = getPersistenceSession().adapterFor(domainObject);
+        final Oid oid = adapter.getOid();
+        if(oid == null) {
+            // values cannot be bookmarked
+            return null;
+        }
+        if(!(oid instanceof RootOid)) {
+            // must be root
+            return null;
+        }
+        final RootOid rootOid = (RootOid) oid;
+        return rootOid.asBookmark();
     }
 
     @Override
     public Bookmark bookmarkFor(Class<?> cls, String identifier) {
-        return new DomainObjectContainerResolve().bookmarkFor(cls, identifier);
+        final ObjectSpecification objectSpec = getSpecificationLoader().loadSpecification(cls);
+        String objectType = objectSpec.getSpecId().asString();
+        return new Bookmark(objectType, identifier);
     }
 
     @Override
     public void resolve(final Object parent) {
-        new DomainObjectContainerResolve().resolve(parent);
+        getPersistenceSession().resolve(parent);
     }
 
+    /**
+     * @deprecated - left over from manual object resolving.
+     */
+    @Deprecated
     @Override
     public void resolve(final Object parent, final Object field) {
-        new DomainObjectContainerResolve().resolve(parent, field);
+        if (field == null) {
+            resolve(parent);
+        }
     }
 
     @Override
@@ -146,12 +166,16 @@ public class PersistenceSessionServiceInternalDefault implements PersistenceSess
         return getPersistenceSession().firstMatchingQuery(query);
     }
 
-    public static PersistenceSession getPersistenceSession() {
+    protected PersistenceSession getPersistenceSession() {
         return IsisContext.getPersistenceSession();
     }
 
-    static IsisTransactionManager getTransactionManager() {
+    protected IsisTransactionManager getTransactionManager() {
         return getPersistenceSession().getTransactionManager();
     }
 
+    protected SpecificationLoader getSpecificationLoader() {
+        return IsisContext.getSpecificationLoader();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/086632ef/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publish/PublishingServiceInternalDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publish/PublishingServiceInternalDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publish/PublishingServiceInternalDefault.java
index dea1dc3..3d570b8 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publish/PublishingServiceInternalDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publish/PublishingServiceInternalDefault.java
@@ -72,7 +72,6 @@ import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.runtime.services.changes.ChangedObjectsServiceInternal;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
 
 /**
  * Wrapper around {@link PublishingService}.  Is a no-op if there is no injected service.
@@ -447,7 +446,7 @@ public class PublishingServiceInternalDefault implements PublishingServiceIntern
         return IsisContext.getOidMarshaller();
     }
 
-    private IsisTransactionManager.PersistenceSessionTransactionManagement getPersistenceSession() {
+    private PersistenceSession getPersistenceSession() {
         return IsisContext.getPersistenceSession();
     }
     //endregion

http://git-wip-us.apache.org/repos/asf/isis/blob/086632ef/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
index d772b2c..f2eecbd 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
@@ -105,7 +105,6 @@ import org.apache.isis.core.runtime.persistence.PojoRecreationException;
 import org.apache.isis.core.runtime.persistence.PojoRefreshException;
 import org.apache.isis.core.runtime.persistence.UnsupportedFindException;
 import org.apache.isis.core.runtime.persistence.adapter.PojoAdapter;
-import org.apache.isis.core.runtime.persistence.container.DomainObjectContainerResolve;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.CreateObjectCommand;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.DestroyObjectCommand;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.PersistenceCommand;
@@ -128,7 +127,6 @@ import org.apache.isis.objectstore.jdo.datanucleus.persistence.commands.DataNucl
 import org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindAllInstancesProcessor;
 import org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindUsingApplibQueryProcessor;
 import org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryProcessor;
-import org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryProcessorAbstract;
 import org.apache.isis.objectstore.jdo.datanucleus.persistence.spi.JdoObjectIdSerializer;
 
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
@@ -149,9 +147,7 @@ public class PersistenceSession implements
         SessionScopedComponent,
         AdapterManager,
         MessageBrokerServiceInternal,
-        IsisLifecycleListener2.PersistenceSessionLifecycleManagement,
-        IsisTransactionManager.PersistenceSessionTransactionManagement,
-        PersistenceQueryProcessorAbstract.PersistenceSessionQueryProcessorManagement {
+        IsisLifecycleListener2.PersistenceSessionLifecycleManagement {
 
     //region > constants
     private static final Logger LOG = LoggerFactory.getLogger(PersistenceSession.class);
@@ -233,8 +229,7 @@ public class PersistenceSession implements
         // sub-components
         final AdapterManager adapterManager = this;
         this.persistenceQueryFactory = new PersistenceQueryFactory(adapterManager, specificationLoader);
-        final IsisTransactionManager.PersistenceSessionTransactionManagement psTranManagement = this;
-        this.transactionManager = new IsisTransactionManager(psTranManagement, servicesInjector);
+        this.transactionManager = new IsisTransactionManager(this, servicesInjector);
 
         setState(State.NOT_INITIALIZED);
 
@@ -282,13 +277,12 @@ public class PersistenceSession implements
         final IsisLifecycleListener2 isisLifecycleListener = new IsisLifecycleListener2(psLifecycleMgmt);
         persistenceManager.addInstanceLifecycleListener(isisLifecycleListener, (Class[]) null);
 
-        final PersistenceQueryProcessorAbstract.PersistenceSessionQueryProcessorManagement psQueryProcessorMgmt = this;
         persistenceQueryProcessorByClass.put(
                 PersistenceQueryFindAllInstances.class,
-                new PersistenceQueryFindAllInstancesProcessor(psQueryProcessorMgmt));
+                new PersistenceQueryFindAllInstancesProcessor(this));
         persistenceQueryProcessorByClass.put(
                 PersistenceQueryFindUsingApplibQueryDefault.class,
-                new PersistenceQueryFindUsingApplibQueryProcessor(psQueryProcessorMgmt));
+                new PersistenceQueryFindUsingApplibQueryProcessor(this));
 
         initServices();
 
@@ -901,7 +895,7 @@ public class PersistenceSession implements
 
     //endregion
 
-    //region > refreshRootInTransaction, refreshRoot
+    //region > refreshRootInTransaction, refreshRoot, resolve
 
     /**
      * Re-initialises the fields of an object. If the object is unresolved then
@@ -954,6 +948,12 @@ public class PersistenceSession implements
         // get an eager left-outer-join as the result of a refresh (sounds possible).
         initializeMapAndCheckConcurrency((Persistable) domainObject);
     }
+
+    public void resolve(final Object parent) {
+        final ObjectAdapter adapter = adapterFor(parent);
+        refreshRootInTransaction(adapter);
+    }
+
     //endregion
 
     //region > makePersistent
@@ -2240,38 +2240,23 @@ public class PersistenceSession implements
     public Object lookup(
             final Bookmark bookmark,
             final BookmarkService2.FieldResetPolicy fieldResetPolicy) {
-        return new DomainObjectContainerResolve().lookup(bookmark, fieldResetPolicy);
-    }
-
-    public Bookmark bookmarkFor(Object domainObject) {
-        return new DomainObjectContainerResolve().bookmarkFor(domainObject);
-    }
-
-    public Bookmark bookmarkFor(Class<?> cls, String identifier) {
-        return new DomainObjectContainerResolve().bookmarkFor(cls, identifier);
-    }
-
-
-    public void resolve(final Object parent) {
-        new DomainObjectContainerResolve().resolve(parent);
-    }
-
-    public void resolve(final Object parent, final Object field) {
-        new DomainObjectContainerResolve().resolve(parent, field);
-    }
-
-    public void beginTran() {
-        getTransactionManager().startTransaction();
+        RootOid oid = RootOid.create(bookmark);
+        final ObjectAdapter adapter = adapterFor(oid);
+        if(adapter == null) {
+            return null;
+        }
+        if(fieldResetPolicy == BookmarkService2.FieldResetPolicy.RESET) {
+            refreshRootInTransaction(adapter);
+        } else {
+            loadObjectInTransaction(oid);
+        }
+        return adapter.getObject();
     }
 
     public boolean flush() {
         return getTransactionManager().flushTransaction();
     }
 
-    public void commit() {
-        getTransactionManager().endTransaction();
-    }
-
     @Override
     public void informUser(final String message) {
         getCurrentTransaction().getMessageBroker().addMessage(message);

http://git-wip-us.apache.org/repos/asf/isis/blob/086632ef/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
index 5182e33..deb0072 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
@@ -39,13 +39,12 @@ import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.commons.components.SessionScopedComponent;
 import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerBase;
 import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
 import org.apache.isis.core.metamodel.services.ServicesInjector;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.PersistenceCommand;
 import org.apache.isis.core.runtime.services.RequestScopedService;
 import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.session.IsisSession;
 
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
@@ -56,7 +55,7 @@ public class IsisTransactionManager implements SessionScopedComponent {
 
     private static final Logger LOG = LoggerFactory.getLogger(IsisTransactionManager.class);
 
-    private final PersistenceSessionTransactionManagement persistenceSession;
+    private final PersistenceSession persistenceSession;
 
     private int transactionLevel;
     
@@ -83,22 +82,8 @@ public class IsisTransactionManager implements SessionScopedComponent {
     // constructor
     // ////////////////////////////////////////////////////////////////
 
-    /**
-     * The internal contract between PersistenceSession and this class.
-     */
-    public interface PersistenceSessionTransactionManagement extends AdapterManagerBase {
-
-        void startTransaction();
-        void endTransaction();
-        void abortTransaction();
-
-        void execute(List<PersistenceCommand> persistenceCommandList);
-
-        ObjectAdapter adapterFor(Object object);
-    }
-
     public IsisTransactionManager(
-            final PersistenceSessionTransactionManagement persistenceSession,
+            final PersistenceSession persistenceSession,
             final ServicesInjector servicesInjector) {
 
         this.persistenceSession = persistenceSession;
@@ -114,7 +99,7 @@ public class IsisTransactionManager implements SessionScopedComponent {
         this.userService = lookupService(UserService.class);
     }
 
-    public PersistenceSessionTransactionManagement getPersistenceSession() {
+    public PersistenceSession getPersistenceSession() {
         return persistenceSession;
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/086632ef/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryFindAllInstancesProcessor.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryFindAllInstancesProcessor.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryFindAllInstancesProcessor.java
index 122d59d..c9830e6 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryFindAllInstancesProcessor.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryFindAllInstancesProcessor.java
@@ -28,12 +28,13 @@ import org.slf4j.LoggerFactory;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindAllInstances;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 
 public class PersistenceQueryFindAllInstancesProcessor extends PersistenceQueryProcessorAbstract<PersistenceQueryFindAllInstances> {
 
     private static final Logger LOG = LoggerFactory.getLogger(PersistenceQueryFindAllInstancesProcessor.class);
 
-    public PersistenceQueryFindAllInstancesProcessor(final PersistenceSessionQueryProcessorManagement persistenceSession) {
+    public PersistenceQueryFindAllInstancesProcessor(final PersistenceSession persistenceSession) {
         super(persistenceSession);
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/086632ef/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryFindUsingApplibQueryProcessor.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryFindUsingApplibQueryProcessor.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryFindUsingApplibQueryProcessor.java
index 0181331..d5a65b7 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryFindUsingApplibQueryProcessor.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryFindUsingApplibQueryProcessor.java
@@ -35,14 +35,14 @@ import org.apache.isis.core.metamodel.services.container.query.QueryCardinality;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
 import org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindUsingApplibQueryDefault;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.objectstore.jdo.datanucleus.metamodel.JdoPropertyUtils;
 
 public class PersistenceQueryFindUsingApplibQueryProcessor extends PersistenceQueryProcessorAbstract<PersistenceQueryFindUsingApplibQueryDefault> {
     
     private static final Logger LOG = LoggerFactory.getLogger(PersistenceQueryFindUsingApplibQueryProcessor.class);
 
-    public PersistenceQueryFindUsingApplibQueryProcessor(
-            final PersistenceSessionQueryProcessorManagement persistenceSession) {
+    public PersistenceQueryFindUsingApplibQueryProcessor(final PersistenceSession persistenceSession) {
         super(persistenceSession);
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/086632ef/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
index 80a85fc..1c93252 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
@@ -20,7 +20,6 @@ package org.apache.isis.objectstore.jdo.datanucleus.persistence.queries;
 
 import java.util.List;
 
-import javax.jdo.Query;
 import javax.jdo.listener.InstanceLifecycleEvent;
 
 import com.google.common.collect.Lists;
@@ -29,28 +28,17 @@ import org.datanucleus.enhancement.Persistable;
 
 import org.apache.isis.core.commons.ensure.Assert;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerBase;
 import org.apache.isis.core.runtime.system.persistence.PersistenceQuery;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.objectstore.jdo.datanucleus.persistence.IsisLifecycleListener;
 
 public abstract class PersistenceQueryProcessorAbstract<T extends PersistenceQuery>
         implements PersistenceQueryProcessor<T> {
 
-    /**
-     * The internal contract between PersistenceSession and this class.
-     */
-    public interface PersistenceSessionQueryProcessorManagement extends AdapterManagerBase {
-        void initializeMapAndCheckConcurrency(Persistable pojo);
-
-        Query newJdoQuery(Class<?> cls);
-        Query newJdoQuery(Class<?> cls, String filter);
-        Query newJdoNamedQuery(Class<?> cls, String queryName);
-    }
-
 
-    final PersistenceSessionQueryProcessorManagement persistenceSession;
+    final PersistenceSession persistenceSession;
 
-    protected PersistenceQueryProcessorAbstract(final PersistenceSessionQueryProcessorManagement persistenceSession) {
+    protected PersistenceQueryProcessorAbstract(final PersistenceSession persistenceSession) {
         this.persistenceSession = persistenceSession;
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/086632ef/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/AbstractCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/AbstractCollectionInvocationHandler.java b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/AbstractCollectionInvocationHandler.java
index b8a4464..9cac79e 100644
--- a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/AbstractCollectionInvocationHandler.java
+++ b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/AbstractCollectionInvocationHandler.java
@@ -20,7 +20,6 @@
 package org.apache.isis.core.wrapper.handlers;
 
 import java.lang.reflect.Method;
-import java.util.ArrayList;
 import java.util.List;
 
 import com.google.common.collect.Lists;
@@ -39,7 +38,7 @@ abstract class AbstractCollectionInvocationHandler<T, C> extends DelegatingInvoc
     private final T domainObject;
 
     public AbstractCollectionInvocationHandler(final C collectionOrMapToProxy, final String collectionName, final DomainObjectInvocationHandler<T> handler, final OneToManyAssociation otma) {
-        super(collectionOrMapToProxy, handler.getHeadlessViewer(), handler.getExecutionMode());
+        super(collectionOrMapToProxy, handler.getWrapperFactory(), handler.getExecutionMode());
         this.collectionName = collectionName;
         this.oneToManyAssociation = otma;
         this.domainObject = handler.getDelegate();

http://git-wip-us.apache.org/repos/asf/isis/blob/086632ef/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/DelegatingInvocationHandlerDefault.java
----------------------------------------------------------------------
diff --git a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/DelegatingInvocationHandlerDefault.java b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/DelegatingInvocationHandlerDefault.java
index 5ea1026..fa014be 100644
--- a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/DelegatingInvocationHandlerDefault.java
+++ b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/DelegatingInvocationHandlerDefault.java
@@ -26,7 +26,7 @@ import org.apache.isis.applib.events.InteractionEvent;
 import org.apache.isis.applib.services.wrapper.WrapperFactory;
 import org.apache.isis.applib.services.wrapper.WrapperFactory.ExecutionMode;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.runtime.persistence.container.DomainObjectContainerResolve;
+import org.apache.isis.core.runtime.system.context.IsisContext;
 
 public class DelegatingInvocationHandlerDefault<T> implements DelegatingInvocationHandler<T> {
 
@@ -38,20 +38,16 @@ public class DelegatingInvocationHandlerDefault<T> implements DelegatingInvocati
     protected final Method hashCodeMethod;
     protected final Method toStringMethod;
 
-    private final DomainObjectContainerResolve domainObjectContainerResolve;
-
     private boolean resolveObjectChangedEnabled;
 
-    public DelegatingInvocationHandlerDefault(final T delegate, final WrapperFactory headlessViewer, final ExecutionMode executionMode) {
+    public DelegatingInvocationHandlerDefault(final T delegate, final WrapperFactory wrapperFactory, final ExecutionMode executionMode) {
         if (delegate == null) {
             throw new IllegalArgumentException("delegate must not be null");
         }
         this.delegate = delegate;
-        this.wrapperFactory = headlessViewer;
+        this.wrapperFactory = wrapperFactory;
         this.executionMode = executionMode;
 
-        this.domainObjectContainerResolve = new DomainObjectContainerResolve();
-
         try {
             equalsMethod = delegate.getClass().getMethod("equals", new Class[] { Object.class });
             hashCodeMethod = delegate.getClass().getMethod("hashCode", new Class[] {});
@@ -79,12 +75,12 @@ public class DelegatingInvocationHandlerDefault<T> implements DelegatingInvocati
 
     protected void resolveIfRequired(final Object domainObject) {
         if (resolveObjectChangedEnabled) {
-            domainObjectContainerResolve.resolve(domainObject);
+            IsisContext.getPersistenceSession().resolve(domainObject);
         }
     }
 
 
-    public WrapperFactory getHeadlessViewer() {
+    public WrapperFactory getWrapperFactory() {
         return wrapperFactory;
     }
 


[2/3] isis git commit: ISIS-1413: adding gradle scripts for dynamic compilation and copying over layout files.

Posted by da...@apache.org.
ISIS-1413: adding gradle scripts for dynamic compilation and copying over layout files.


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

Branch: refs/heads/master
Commit: bbc81a1a8187dea749b80513132b9094b92fd2c5
Parents: 086632e
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed May 25 18:50:21 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu May 26 10:11:23 2016 +0100

----------------------------------------------------------------------
 .../main/asciidoc/guides/_dg_ide_eclipse.adoc   |   2 +-
 .../main/asciidoc/guides/_dg_ide_intellij.adoc  | 139 +++++++++++++++-
 .../070-advanced/002-compiler-exclude.png       | Bin 0 -> 31775 bytes
 .../070-advanced/004-gradle-output.png          | Bin 0 -> 23091 bytes
 .../070-advanced/005-gradle-output.png          | Bin 0 -> 16157 bytes
 example/application/simpleapp/dom/.gitignore    |   3 +
 example/application/simpleapp/dom/build.gradle  |  53 ++++++
 .../dom/gradle/wrapper/gradle-wrapper.jar       | Bin 0 -> 53556 bytes
 .../gradle/wrapper/gradle-wrapper.properties    |   6 +
 example/application/simpleapp/dom/gradlew       | 164 +++++++++++++++++++
 example/application/simpleapp/dom/gradlew.bat   |  90 ++++++++++
 .../application/simpleapp/dom/layouts.gradle    |  29 ++++
 .../domainapp/dom/DomainAppDomManifest.java     |   2 +-
 scripts/updateGeneratedArchetypeSources.groovy  |   2 +
 14 files changed, 479 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/adocs/documentation/src/main/asciidoc/guides/_dg_ide_eclipse.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_dg_ide_eclipse.adoc b/adocs/documentation/src/main/asciidoc/guides/_dg_ide_eclipse.adoc
index 92d5436..e638308 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_dg_ide_eclipse.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_dg_ide_eclipse.adoc
@@ -159,7 +159,7 @@ And, remember also to configure Eclipse's DataNucleus plugin for these other dom
 In this section are a couple of options that will reduce the length of the change code/build/deploy/review feedback loop.
 
 
-=== Setting up Dynamic Reloading
+=== Setting up DCEVM
 
 link:github.com/dcevm/dcevm[DCEVM] enhances the JVM with true hot-swap adding/removing of methods as well as more
 reliable hot swapping of the implementation of existing methods.

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc b/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc
index d1afd84..a356cb2 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc
@@ -15,12 +15,13 @@ This material does not constitute an endorsement; JetBrains is not affiliated to
 This section describes how to install and setup JetBrains' IntelliJ IDEA, then how to import an application into IntelliJ and run it.
 
 
-
+[[_dg_ide_intellij_installing]]
 == Installing and Setting up
 
 This section covers installation and setup. These notes/screenshots were prepared using IntelliJ Community Edition 14.1.x, but are believed to be compatible with more recent versions/other editions of the IDE.
 
 
+[[_dg_ide_intellij_installing_download]]
 === Download and Install
 
 https://www.jetbrains.com/idea/download/[Download] latest version of IntelliJ Community Edition, and install:
@@ -63,6 +64,7 @@ image::{_imagesdir}appendices/dev-env/intellij-idea/010-installing/070-set-ui-th
 
 
 
+[[_dg_ide_intellij_installing_new-project]]
 === New Project
 
 In IntelliJ a project can contain multiple modules; these need not be physically located together.  (If you are previously an Eclipse user, you can think of it as similar to an Eclipse workspace).
@@ -218,6 +220,7 @@ image::{_imagesdir}appendices/dev-env/intellij-idea/044-other-settings-misc/010-
 
 
 
+[[_dg_ide_intellij_importing-maven-modules]]
 == Importing Maven Modules
 
 Let's load in some actual code!  We do this by importing the Maven modules.
@@ -259,10 +262,12 @@ image::{_imagesdir}appendices/dev-env/intellij-idea/100-maven-module-mgmt/060-ig
 
 
 
+[[_dg_ide_intellij_running]]
 == Running
 
 Let's see how to run both the app and the tests.
 
+[[_dg_ide_intellij_running_the-app]]
 === Running the App
 
 Once you've imported your Isis application, we should run it.  We do this by creating a Run configuration, using `Run > Edit Configurations`.
@@ -288,6 +293,7 @@ WARNING: if you forget to set up the enhancer goal, or don't run it on the corre
 You should now be able to run the app using `Run > Run Configuration`.  The same configuration can also be used to debug the app if you so need.
 
 
+[[_dg_ide_intellij_running_unit-tests]]
 === Running the Unit Tests
 
 The easiest way to run the unit tests is just to right click on the `dom` module in the _Project Window_, and choose run unit tests.  Hopefully your tests will pass (!).
@@ -302,6 +308,8 @@ image::{_imagesdir}appendices/dev-env/intellij-idea/110-running-the-app/040-runn
 
 Thereafter, you should run units by selecting this configuration (if you use the right click approach you'll end up with lots of run configurations, all similar).
 
+
+[[_dg_ide_intellij_running_integ-tests]]
 === Running the Integration Tests
 
 Integration tests can be run in the same way as unit tests, however the `dom` module must also have been enhanced.
@@ -313,9 +321,19 @@ image::{_imagesdir}appendices/dev-env/intellij-idea/110-running-the-app/050-runn
 
 
 
+Also make sure that the `search for tests` radio button is set to `In single module`:
+
+image::{_imagesdir}appendices/dev-env/intellij-idea/400-running-integtests/run-debug-configuration-single-module.png[width="600px",link="{_imagesdir}appendices/dev-env/intellij-idea/400-running-integtests/run-debug-configuration-single-module.png"]
+
+If this radio button is set to one of the other options then you may obtain class loading issues; these result from IntelliJ attempting to run unit tests of the `dom` project that depend on test classes in that module, but using the classpath of the `integtests` module whereby the `dom` test-classes (`test-jar` artifact) are not exposed on the Maven classpath.
+
+
+
 
+[[_dg_ide_intellij_hints-and-tips]]
 == Hints and Tips
 
+[[_dg_ide_intellij_hints-and-tips_keyboard-cheat-sheets]]
 === Keyboard Cheat Sheets
 
 You can download 1-page PDFs cheat sheets for IntelliJ's keyboard shortcuts:
@@ -341,6 +359,7 @@ The Tool Windows are the views around the editor (to left, bottom and right).  I
 
 Using these shortcuts you can easily toggle between the tool windows and the editor, without using the mouse.  Peachy!
 
+[[_dg_ide_intellij_hints-and-tips_navigating-around]]
 === Navigating Around
 
 For all of the following, you don't need to type every letter, typing "ab" will actually search for ".*a.*b.*".
@@ -362,6 +381,7 @@ Viewing the structure (ie outline) of a class
 ** hit `ctrl-F12` again to also see inherited members
 
 
+[[_dg_ide_intellij_hints-and-tips_editing]]
 === Editing
 
 * Extend selection using `ctrl-W`
@@ -385,6 +405,7 @@ In certain circumstances (eg in methods0) you can also type `ctrl-shift-space` t
 Last, when invoking a method, use `ctrl-P` to see the parameter types.
 
 
+[[_dg_ide_intellij_hints-and-tips_refactoring]]
 === Refactoring
 
 Loads of good stuff on the `Refactor` menu; most used are:
@@ -399,6 +420,7 @@ Loads of good stuff on the `Refactor` menu; most used are:
 If you can't remember all those shortcuts, just use `ctrl-shift-alt-T` (might want to rebind that to something else!) and get a context-sensitive list of refactorings available for the currently selected object
 
 
+[[_dg_ide_intellij_hints-and-tips_plugins]]
 === Plugins
 
 You might want to set up some additional plugins.  You can do this using `File > Settings > Plugins` (or equivalently `File > Other Settings > Configure Plugins`).
@@ -418,6 +440,8 @@ Some others you might like to explore are:
 .IntelliJ Plugins
 image::{_imagesdir}appendices/dev-env/intellij-idea/050-some-plugins/020-some-plugins-confirmation.png[width="600px"]
 
+
+[[_dg_ide_intellij_hints-and-tips_plugins_maven-helper-plugin]]
 ==== Maven Helper Plugin
 
 This plugin provides a couple of great features.  One is better visualization of dependency trees (similar to Eclipse).
@@ -439,6 +463,7 @@ This menu can also be bound to a keystroke so that it is available as a pop-up:
 image::{_imagesdir}appendices/dev-env/intellij-idea/050-some-plugins/maven-helper/040-maven-quick-run.png[width="600px",link="{_imagesdir}appendices/dev-env/intellij-idea/050-some-plugins/maven-helper/040-maven-quick-run.png"]
 
 
+[[_dg_ide_intellij_troubleshooting]]
 === Troubleshooting
 
 When a Maven module is imported, IntelliJ generates its own project files (suffix `.ipr`), and the application is actually built from that.
@@ -464,24 +489,120 @@ are set up correctly.
 
 
 
-== Running Integration Tests
 
+[[_dg_ide_intellij_advanced]]
+== Faster turnaround times
 
-When running integration tests from within IntelliJ, make sure that the `search for tests` radio button is set to `In single module`:
+In this section are several options that will reduce the time it takes between making a source code edit and seeing the results in the running app. code/build/deploy/review feedback loop.
 
-image::{_imagesdir}appendices/dev-env/intellij-idea/400-running-integtests/run-debug-configuration-single-module.png[width="600px",link="{_imagesdir}appendices/dev-env/intellij-idea/400-running-integtests/run-debug-configuration-single-module.png"]
 
-If this radio button is set to one of the other options then you may obtain class loading issues; these result from IntelliJ attempting to run unit tests of the `dom` project that depend on test classes in that module, but using the classpath of the `integtests` module whereby the `dom` test-classes (`test-jar` artifact) are not exposed on the Maven classpath.
+[[_dg_ide_intellij_advanced_gradle-compile-enhance]]
+=== Using Grade to compile/enhance
 
+Running an Apache Isis application requires that the DataNucleus enhancer runs on the compiled bytecode.  As described xref:dg.adoc#_dg_ide_intellij_running_the-app[above], the recommended way to do this with IntelliJ is to use a Run configuration that runs the enhancer goal prior to launch.
+
+Alternative, you can use the following `build.gradle` script in your `dom` module:
+
+[source,groovy]
+.`build.gradle`
+----
+apply plugin: 'java'
+apply plugin: 'tangram.tools'
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
+version = (new XmlParser()).parse('pom.xml').parent.version.text()
+buildscript {
+  repositories {
+    maven { url "http://oss.jfrog.org/artifactory/oss-snapshot-local" }
+    jcenter()
+  }
+  dependencies {
+    classpath 'tangram:gradle-plugin:1.1.2'
+  }
+}
+repositories {
+    mavenLocal()
+    maven { url "http://oss.jfrog.org/artifactory/oss-snapshot-local" }
+    jcenter()
+}
+dependencies {
+    compile group: 'org.apache.isis.core', name: 'isis-core-applib', version: version
+}
+task copyClasses << {
+    copy {
+        from 'build/classes/main'
+        into 'target/classes'
+    }
+}
+----
+
+The script is intended to be in the background as a daemon while editing/developing; whenever a change is made to any
+source code, gradle will automatically compile _and_ enhance the code.  In this way it eliminates the need to start up
+Maven and run the enhancer goal.
+
+To use, you must disable the IntelliJ's automatic building of the 'dom' project.  This is done using:
+`File > Settings > Build, Execution, Deployment > Compiler > Excludes`, and then exclude the `.../dom/src/main/java`
+directory:
+
+image::{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/002-compiler-exclude.png[width="800px",link="{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/002-compiler-exclude.png"]
+
+
+The script is run using:
+
+[source,bash]
+----
+gradle -t --offline
+----
+
+from the command line (in the `dom` module).
+
+image::{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/004-gradle-output.png[width="600px",link="{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/004-gradle-output.png"]
+
+Use `ctrl-C` to cancel, as any other process.
+
+
+[[_dg_ide_intellij_advanced_gradle-layout]]
+=== Using Grade for ``layout.xml``s
+
+Similarly, gradle can be run to reduce the turn-around time when tweaking the UI (defined by the
+ xref:ugfun.adoc#_ugfun_object-layout_dynamic_xml[`*.layout.xml`] file for each domain class), when the app is running.
+
+The framework does already automatically notice any changes to `.layout.xml` files, but these do need to be on
+the classpath (in the `target/classes` directory).  With IntelliJ this can be done by manually by invoking
+`Run > Reload Changed Classes`, and then refreshing the browser.
+
+Using this script though this manual step can be removed; whenever a change is made to any `.layout.xml` file, gradle
+will automatically copy over the file to the `target/classes` directory:
+
+[source,groovy]
+.`layouts.gradle`
+----
+defaultTasks 'copyLayouts'
+task copyLayouts(type:Copy) {
+    from 'src/main/java'
+    into 'target/classes'
+    include '**/*.layout.xml'
+}
+----
+
+The script is run using:
+
+[source,bash]
+----
+gradle -t --offline -b layouts.gradle
+----
+
+from the command line (in the `dom` module).
+
+image::{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png[width="600px",link="{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png"]
+
+Use `ctrl-C` to cancel, as any other process.
 
-[[_dg_ide_intellij_advanced]]
-== Advanced
 
-In this section are a couple of options that will reduce the length of the change code/build/deploy/review feedback loop.
 
 
 [[_dg_ide_intellij_advanced_dcevm]]
-=== Setting up Dynamic Reloading
+=== Setting up DCEVM
 
 link:github.com/dcevm/dcevm[DCEVM] enhances the JVM with true hot-swap adding/removing of methods as well as more
 reliable hot swapping of the implementation of existing methods.

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/002-compiler-exclude.png
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/002-compiler-exclude.png b/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/002-compiler-exclude.png
new file mode 100644
index 0000000..ba9cb59
Binary files /dev/null and b/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/002-compiler-exclude.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/004-gradle-output.png
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/004-gradle-output.png b/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/004-gradle-output.png
new file mode 100644
index 0000000..023538d
Binary files /dev/null and b/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/004-gradle-output.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png b/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png
new file mode 100644
index 0000000..224c85e
Binary files /dev/null and b/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/example/application/simpleapp/dom/.gitignore
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/.gitignore b/example/application/simpleapp/dom/.gitignore
new file mode 100644
index 0000000..cc3e383
--- /dev/null
+++ b/example/application/simpleapp/dom/.gitignore
@@ -0,0 +1,3 @@
+.gradle
+build/
+!gradle/wrapper/gradle-wrapper.jar
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/example/application/simpleapp/dom/build.gradle
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/build.gradle b/example/application/simpleapp/dom/build.gradle
new file mode 100644
index 0000000..94d1b28
--- /dev/null
+++ b/example/application/simpleapp/dom/build.gradle
@@ -0,0 +1,53 @@
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// this gradle script compiles and enhances the dom classes.
+//
+// The script is intended to be used in conjunction with IntelliJ IDEA, to remove the necessity to run the DataNucleus
+// enhancer immediately before running the app, and therefore reduce the turn-around time.  The script is run as
+// in the background as a daemon while editing/developing; whenever a change is made to any source code, gradle will
+// automatically compile *and* enhance the code.
+//
+// To use, just type:
+//
+//      gradle -t
+//
+// It is also necessary to disable the IntelliJ's automatic building of the 'dom' project.  This is done using:
+//
+//      File > Settings > Build, Execution, Deployment > Compiler > Excludes
+//
+// and then exclude the .../dom/src/main/java directory
+//
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+defaultTasks 'compileJava', 'copyClasses'
+
+apply plugin: 'java'
+apply plugin: 'tangram.tools'
+
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
+version = (new XmlParser()).parse('pom.xml').parent.version.text()
+
+buildscript {
+  repositories {
+    maven { url "http://oss.jfrog.org/artifactory/oss-snapshot-local" }
+    jcenter()
+  }
+  dependencies {
+    classpath 'tangram:gradle-plugin:1.1.2'
+  }
+}
+repositories {
+    mavenLocal()
+    maven { url "http://oss.jfrog.org/artifactory/oss-snapshot-local" }
+    jcenter()
+}
+dependencies {
+    compile group: 'org.apache.isis.core', name: 'isis-core-applib', version: '1.13.0-SNAPSHOT'
+}
+task copyClasses << {
+    copy {
+        from 'build/classes/main'
+        into 'target/classes'
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/example/application/simpleapp/dom/gradle/wrapper/gradle-wrapper.jar
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/gradle/wrapper/gradle-wrapper.jar b/example/application/simpleapp/dom/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..ca78035
Binary files /dev/null and b/example/application/simpleapp/dom/gradle/wrapper/gradle-wrapper.jar differ

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/example/application/simpleapp/dom/gradle/wrapper/gradle-wrapper.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/gradle/wrapper/gradle-wrapper.properties b/example/application/simpleapp/dom/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..e8c47aa
--- /dev/null
+++ b/example/application/simpleapp/dom/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Tue May 24 23:14:46 BST 2016
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/example/application/simpleapp/dom/gradlew
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/gradlew b/example/application/simpleapp/dom/gradlew
new file mode 100644
index 0000000..27309d9
--- /dev/null
+++ b/example/application/simpleapp/dom/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+    echo "$*"
+}
+
+die ( ) {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+    JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/example/application/simpleapp/dom/gradlew.bat
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/gradlew.bat b/example/application/simpleapp/dom/gradlew.bat
new file mode 100644
index 0000000..832fdb6
--- /dev/null
+++ b/example/application/simpleapp/dom/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/example/application/simpleapp/dom/layouts.gradle
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/layouts.gradle b/example/application/simpleapp/dom/layouts.gradle
new file mode 100644
index 0000000..645b5e0
--- /dev/null
+++ b/example/application/simpleapp/dom/layouts.gradle
@@ -0,0 +1,29 @@
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// this gradle script copies over .layout.xml files from src to target directory.
+//
+// This script is intended to be used while the app is running (in prototype mode), reducing the turn-around time
+// when updating the layout.
+//
+// The framework does already automatically notice any changes to .layout.xml files, but these do need to be in the
+// target directory.  Using IntelliJ (say) this would be done by manually by invoking
+// Run > Reload Changed Classes, and then refreshing the browser.
+//
+// This script instead is intended to be run in the background as a daemon; whenever a change
+// is made to any .layout.xml file, gradle will automatically copy over the file to the target directory.
+//
+// The script is run using:
+//
+//      gradle -t -b layouts.gradle
+//
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+defaultTasks 'copyLayouts'
+
+task copyLayouts(type:Copy) {
+    from 'src/main/java'
+    into 'target/classes'
+    include '**/*.layout.xml'
+}
+

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/example/application/simpleapp/dom/src/main/java/domainapp/dom/DomainAppDomManifest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/DomainAppDomManifest.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/DomainAppDomManifest.java
index 101cf27..63266f3 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/DomainAppDomManifest.java
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/DomainAppDomManifest.java
@@ -33,7 +33,7 @@ public class DomainAppDomManifest implements AppManifest {
 
     @Override
     public List<Class<?>> getModules() {
-        return Arrays.asList(
+        return Arrays.<Class<?>>asList(
                 DomainAppDomainModule.class  // domain (entities and repositories)
         );
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/bbc81a1a/scripts/updateGeneratedArchetypeSources.groovy
----------------------------------------------------------------------
diff --git a/scripts/updateGeneratedArchetypeSources.groovy b/scripts/updateGeneratedArchetypeSources.groovy
index 9e3a8c0..5d56cc8 100644
--- a/scripts/updateGeneratedArchetypeSources.groovy
+++ b/scripts/updateGeneratedArchetypeSources.groovy
@@ -254,6 +254,8 @@ appendedResourcesDir.mkdir()
 def supplementalModelsFile=new File(appendedResourcesDir, "supplemental-models.xml")
 supplementalModelsFile.text = supplemental_models_text
 
+
+
 ///////////////////////////////////////////////////
 //
 // helper methods


[3/3] isis git commit: ISIS-1413: implemented liveReload (docs, gradle script, new config property for Wicket viewer).

Posted by da...@apache.org.
ISIS-1413: implemented liveReload (docs, gradle script, new config property for Wicket viewer).


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

Branch: refs/heads/master
Commit: 5b5c1fc5b1cf6d3e758861d58b4f21629faf7398
Parents: bbc81a1
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu May 26 11:48:28 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu May 26 11:48:28 2016 +0100

----------------------------------------------------------------------
 .../main/asciidoc/guides/_dg_ide_intellij.adoc  |  65 +++++++++++++++----
 .../guides/_ugvw_configuration-properties.adoc  |   8 +++
 .../070-advanced/005-gradle-output.png          | Bin 16157 -> 30890 bytes
 .../070-advanced/006-livereload-js.png          | Bin 0 -> 80581 bytes
 .../wicket/viewer/IsisWicketApplication.java    |   1 +
 .../viewer/wicket/ui/pages/PageAbstract.html    |   1 -
 .../viewer/wicket/ui/pages/PageAbstract.java    |   8 ++-
 example/application/simpleapp/dom/build.gradle  |   2 +-
 .../application/simpleapp/dom/layouts.gradle    |  11 ++--
 .../application/simpleapp/dom/liveReload.gradle |  37 +++++++++++
 .../webapp/WEB-INF/viewer_wicket.properties     |   8 ++-
 11 files changed, 119 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/5b5c1fc5/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc b/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc
index a356cb2..6fd163d 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc
@@ -547,31 +547,36 @@ directory:
 image::{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/002-compiler-exclude.png[width="800px",link="{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/002-compiler-exclude.png"]
 
 
-The script is run using:
+The script can be run in the background using:
 
 [source,bash]
 ----
-gradle -t --offline
+gradle -t --offline &
 ----
 
 from the command line (in the `dom` module).
 
 image::{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/004-gradle-output.png[width="600px",link="{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/004-gradle-output.png"]
 
-Use `ctrl-C` to cancel, as any other process.
 
 
-[[_dg_ide_intellij_advanced_gradle-layout]]
-=== Using Grade for ``layout.xml``s
+
+[[_dg_ide_intellij_advanced_gradle-liveReload]]
+=== Using Grade for liveReload
 
 Similarly, gradle can be run to reduce the turn-around time when tweaking the UI (defined by the
  xref:ugfun.adoc#_ugfun_object-layout_dynamic_xml[`*.layout.xml`] file for each domain class), when the app is running.
 
-The framework does already automatically notice any changes to `.layout.xml` files, but these do need to be on
-the classpath (in the `target/classes` directory).  With IntelliJ this can be done by manually by invoking
-`Run > Reload Changed Classes`, and then refreshing the browser.
+The framework will automatically notice any changes to `.layout.xml` files, but these are read from the
+the classpath (the `target/classes` directory), not the source path.  With IntelliJ these can be copied over manually
+by invoking `Run > Reload Changed Classes`.  Once the browser is refreshed, the new layout will be rendered.
+
+To reduce the turn-around time there are therefore two steps to be automated:
+
+* the copying of the `.layout.xml` files over to the `target/classes` directory
+* the triggering of a page refresh by the browser.
 
-Using this script though this manual step can be removed; whenever a change is made to any `.layout.xml` file, gradle
+The `layouts.gradle` script takes care of the first of these; whenever a change is made to any `.layout.xml` file, gradle
 will automatically copy over the file to the `target/classes` directory:
 
 [source,groovy]
@@ -585,18 +590,52 @@ task copyLayouts(type:Copy) {
 }
 ----
 
-The script is run using:
+Similarly, the `liveReload.gradle` script takes care of the browser refresh:
+
+[source,groovy]
+.`liveReload.gradle`
+----
+defaultTasks 'liveReload'
+buildscript {
+    repositories {
+        jcenter()
+    }
+    dependencies {
+        classpath 'org.kordamp.gradle:livereload-gradle-plugin:0.2.1'
+    }
+}
+apply plugin: 'org.kordamp.gradle.livereload'
+liveReload {
+    docRoot new File('target/classes').canonicalPath
+}
+----
+
+These scripts can be run together using:
 
 [source,bash]
 ----
-gradle -t --offline -b layouts.gradle
+gradle -t --offline -b layouts.gradle &
+gradle -t --offline -b liveReload.gradle &
 ----
+from the command line (in the `dom` module):
 
-from the command line (in the `dom` module).
 
 image::{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png[width="600px",link="{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png"]
 
-Use `ctrl-C` to cancel, as any other process.
+
+Live reload also requires that the `isis.viewer.wicket.liveReloadUrl` configuration property (`1.13.0-SNAPSHOT`) is set
+appropriately:
+
+[source,ini]
+.`viewer_wicket.properties`
+----
+isis.viewer.wicket.liveReloadUrl=http://localhost:35729/livereload.js?snipver=1
+----
+
+You can confirm the script is loaded correctly using the web browser's development tools, eg:
+
+
+image::{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/006-livereload-js.png[width="800px",link="{_imagesdir}appendices/dev-env/intellij-idea/070-advanced/006-livereload-js.png"]
 
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5b5c1fc5/adocs/documentation/src/main/asciidoc/guides/_ugvw_configuration-properties.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_ugvw_configuration-properties.adoc b/adocs/documentation/src/main/asciidoc/guides/_ugvw_configuration-properties.adoc
index 9a1bc5c..23b18f3 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_ugvw_configuration-properties.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_ugvw_configuration-properties.adoc
@@ -53,6 +53,14 @@ If you prefer you can place all configuration properties into `WEB-INF/isis.prop
 |No longer supported.
 
 |`isis.viewer.wicket.` +
+`liveReloadUrl`
+| URL
+|(`1.13.0-SNAPSHOT`), specifies the URL if xref:dg.adoc#_dg_ide_intellij_advanced_gradle-liveReload[live reload] is set up, eg: +
+
+`http://localhost:35729/livereload.js?snipver=1`
+
+
+|`isis.viewer.wicket.` +
 `maxTitleLengthInParentedTables`
 | +ve integer, (`_12_`)
 | See discussion xref:ugvw.adoc#_ugvw_configuration-properties_abbreviating-titles[below].

http://git-wip-us.apache.org/repos/asf/isis/blob/5b5c1fc5/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png b/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png
index 224c85e..edaa8e5 100644
Binary files a/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png and b/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/005-gradle-output.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/5b5c1fc5/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/006-livereload-js.png
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/006-livereload-js.png b/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/006-livereload-js.png
new file mode 100644
index 0000000..f5d6a2b
Binary files /dev/null and b/adocs/documentation/src/main/asciidoc/guides/images/appendices/dev-env/intellij-idea/070-advanced/006-livereload-js.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/5b5c1fc5/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
index aa86820..50f045c 100644
--- a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
+++ b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
@@ -141,6 +141,7 @@ public class IsisWicketApplication
     private static final String WICKET_SOURCE_PLUGIN_KEY = "isis.viewer.wicket.wicketSourcePlugin";
     private static final boolean WICKET_SOURCE_PLUGIN_DEFAULT = false;
 
+
     private final IsisLoggingConfigurer loggingConfigurer = new IsisLoggingConfigurer();
 
     /**

http://git-wip-us.apache.org/repos/asf/isis/blob/5b5c1fc5/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html
index cf8a91f..15acbaa 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html
@@ -48,7 +48,6 @@
                 <div wicket:id="actionPromptModalWindow"></div>
 
                 <wicket:container wicket:id="footer"></wicket:container>
-
             </div>
 
         </div>

http://git-wip-us.apache.org/repos/asf/isis/blob/5b5c1fc5/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java
index b7435ad..a2d6bfa 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.java
@@ -104,7 +104,9 @@ public abstract class PageAbstract extends WebPage implements ActionPromptProvid
      */
     private static final JavaScriptResourceReference JQUERY_LIVEQUERY_JS = new JavaScriptResourceReference(PageAbstract.class, "jquery.livequery.js");
     private static final JavaScriptResourceReference JQUERY_ISIS_WICKET_VIEWER_JS = new JavaScriptResourceReference(PageAbstract.class, "jquery.isis.wicket.viewer.js");
-    
+
+    private static final String LIVE_RELOAD_URL_KEY = "isis.viewer.wicket.liveReloadUrl";
+
     // not to be confused with the bootstrap theme...
     // is simply a CSS class derived from the application's name
     private static final String ID_THEME = "theme";
@@ -271,6 +273,10 @@ public abstract class PageAbstract extends WebPage implements ActionPromptProvid
             response.render(JavaScriptReferenceHeaderItem.forUrl(applicationJs));
         }
 
+        String liveReloadUrl = getConfiguration().getString(LIVE_RELOAD_URL_KEY);
+        if(liveReloadUrl != null) {
+            response.render(JavaScriptReferenceHeaderItem.forUrl(liveReloadUrl));
+        }
         if(isModernBrowser()) {
             addBootLint(response);
         }

http://git-wip-us.apache.org/repos/asf/isis/blob/5b5c1fc5/example/application/simpleapp/dom/build.gradle
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/build.gradle b/example/application/simpleapp/dom/build.gradle
index 94d1b28..97b290d 100644
--- a/example/application/simpleapp/dom/build.gradle
+++ b/example/application/simpleapp/dom/build.gradle
@@ -9,7 +9,7 @@
 //
 // To use, just type:
 //
-//      gradle -t
+//      gradle -t --offline &
 //
 // It is also necessary to disable the IntelliJ's automatic building of the 'dom' project.  This is done using:
 //

http://git-wip-us.apache.org/repos/asf/isis/blob/5b5c1fc5/example/application/simpleapp/dom/layouts.gradle
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/layouts.gradle b/example/application/simpleapp/dom/layouts.gradle
index 645b5e0..7fa9267 100644
--- a/example/application/simpleapp/dom/layouts.gradle
+++ b/example/application/simpleapp/dom/layouts.gradle
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //
-// this gradle script copies over .layout.xml files from src to target directory.
+// This gradle script copies over .layout.xml files from src to target directory.
 //
 // This script is intended to be used while the app is running (in prototype mode), reducing the turn-around time
 // when updating the layout.
 //
-// The framework does already automatically notice any changes to .layout.xml files, but these do need to be in the
-// target directory.  Using IntelliJ (say) this would be done by manually by invoking
+// The framework will automatically notice any changes to .layout.xml files, but these are read from the classpath
+// (under target/classes), not the source path.  Using IntelliJ (say) these can be copied over manually by invoking
 // Run > Reload Changed Classes, and then refreshing the browser.
 //
 // This script instead is intended to be run in the background as a daemon; whenever a change
@@ -14,11 +14,12 @@
 //
 // The script is run using:
 //
-//      gradle -t -b layouts.gradle
+//      gradle -t -b layouts.gradle --offline &
+//
+// To reduce turn-around time further, also use the liveReload.gradle script (to automatically refresh the browser).
 //
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-
 defaultTasks 'copyLayouts'
 
 task copyLayouts(type:Copy) {

http://git-wip-us.apache.org/repos/asf/isis/blob/5b5c1fc5/example/application/simpleapp/dom/liveReload.gradle
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/liveReload.gradle b/example/application/simpleapp/dom/liveReload.gradle
new file mode 100644
index 0000000..579c417
--- /dev/null
+++ b/example/application/simpleapp/dom/liveReload.gradle
@@ -0,0 +1,37 @@
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// This gradle script sets up livereload, configured so that any updates to the dom module's classpath will
+// trigger the browser to reload the page.  In particular, this relates to the .layout.xml files which define the
+// grid layout of domain objects.
+//
+// As a prerequisite, the app needs to configured to load the livereload.js script.  This can be done by adding the
+// following configuration property (to viewer_wicket.properties, isis.properties or the AppManifest, as you prefer):
+//
+//    isis.viewer.wicket.liveReloadUrl=http://localhost:35729/livereload.js?snipver=1
+//
+// This gradle script is run using:
+//
+//      gradle -t -b livereload.gradle --offline &
+//
+// To reduce turn-around time further, also use the layouts.gradle script (to automatically copy over the layout.xml
+// files to the classpath).
+//
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+defaultTasks 'liveReload'
+
+buildscript {
+    repositories {
+        jcenter()
+    }
+    dependencies {
+        classpath 'org.kordamp.gradle:livereload-gradle-plugin:0.2.1'
+    }
+}
+
+apply plugin: 'org.kordamp.gradle.livereload'
+
+liveReload {
+    docRoot new File('target/classes').canonicalPath
+}
+

http://git-wip-us.apache.org/repos/asf/isis/blob/5b5c1fc5/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
index 6cbb981..b3ccc20 100644
--- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
+++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
@@ -82,4 +82,10 @@ isis.viewer.wicket.themes.showChooser=true
 #
 # whether to automatically select dependent choice when the choice it depends upon changes.
 #
-#isis.viewer.wicket.disableDependentChoiceAutoSelection=false
\ No newline at end of file
+#isis.viewer.wicket.disableDependentChoiceAutoSelection=false
+
+
+#
+# enable liveReload.  For example, use with gradle -t -b liveReload.gradle --offline &
+#
+isis.viewer.wicket.liveReloadUrl=http://localhost:35729/livereload.js?snipver=1