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 2022/08/25 17:16:02 UTC

[isis-app-simpleapp] 03/06: hacking...

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch jpa-SNAPSHOT
in repository https://gitbox.apache.org/repos/asf/isis-app-simpleapp.git

commit fb0c16870771d6148fcc0e2b6c90a8256f79d92b
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Aug 25 13:47:46 2022 +0100

    hacking...
---
 .run/SimpleApp.run.xml                             |  1 +
 lib/README.txt                                     |  4 ++-
 pom.xml                                            |  2 +-
 .../main/java/domainapp/webapp/AppManifest.java    | 24 ++++++++++++++++
 .../services/homepage/HomePageViewModel.java       |  7 ++---
 .../main/resources/META-INF/persistence.xml-moved  | 32 ++++++++++++++++++++++
 .../main/resources/config/application.properties   |  8 +++++-
 7 files changed, 71 insertions(+), 7 deletions(-)

diff --git a/.run/SimpleApp.run.xml b/.run/SimpleApp.run.xml
index 35be0c0..9530eb6 100644
--- a/.run/SimpleApp.run.xml
+++ b/.run/SimpleApp.run.xml
@@ -3,6 +3,7 @@
     <option name="ACTIVE_PROFILES" />
     <module name="simpleapp-jpa-webapp" />
     <option name="SPRING_BOOT_MAIN_CLASS" value="domainapp.webapp.SimpleApp" />
+    <option name="VM_PARAMETERS" value="-javaagent:lib/spring-instrument-5.3.8.jar" />
     <method v="2">
       <option name="Make" enabled="true" />
     </method>
diff --git a/lib/README.txt b/lib/README.txt
index db3c441..17de356 100644
--- a/lib/README.txt
+++ b/lib/README.txt
@@ -1,3 +1,5 @@
 If eclipselink.weaving=true, then run using JVM argument:
 
- -javaagent:lib/spring-instrument-5.3.8.jar
+-javaagent:lib/spring-instrument-5.3.8.jar
+
+Can be downloaded from: https://search.maven.org/artifact/org.springframework/spring-instrument
diff --git a/pom.xml b/pom.xml
index 5ba02bd..1e28a6f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.apache.isis.app</groupId>
         <artifactId>isis-app-starter-parent</artifactId>
-        <version>2.0.0-M8</version>
+        <version>2.0.0-SNAPSHOT</version>
         <relativePath/>
     </parent>
 
diff --git a/webapp/src/main/java/domainapp/webapp/AppManifest.java b/webapp/src/main/java/domainapp/webapp/AppManifest.java
index 60e0a00..bdc0202 100644
--- a/webapp/src/main/java/domainapp/webapp/AppManifest.java
+++ b/webapp/src/main/java/domainapp/webapp/AppManifest.java
@@ -1,9 +1,13 @@
 package domainapp.webapp;
 
+import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
 import org.springframework.context.annotation.PropertySource;
 import org.springframework.context.annotation.PropertySources;
+import org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver;
+import org.springframework.orm.jpa.LocalEntityManagerFactoryBean;
+import org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager;
 
 import org.apache.isis.applib.IsisModuleApplibChangeAndExecutionLoggers;
 import org.apache.isis.applib.IsisModuleApplibMixins;
@@ -24,6 +28,7 @@ import org.apache.isis.valuetypes.asciidoc.ui.wkt.IsisModuleValAsciidocUiWkt;
 import org.apache.isis.viewer.restfulobjects.jaxrsresteasy4.IsisModuleViewerRestfulObjectsJaxrsResteasy4;
 import org.apache.isis.viewer.wicket.viewer.IsisModuleViewerWicketViewer;
 
+import domainapp.modules.simple.dom.so.SimpleObject;
 import domainapp.webapp.application.ApplicationModule;
 import domainapp.webapp.application.fixture.scenarios.DomainAppDemo;
 import domainapp.webapp.custom.CustomModule;
@@ -66,4 +71,23 @@ import domainapp.webapp.quartz.QuartzModule;
         @PropertySource(IsisPresets.DebugDiscovery),
 })
 public class AppManifest {
+
+//    @Bean
+//    public LocalEntityManagerFactoryBean localEntityManagerFactoryBean() {
+//        return new LocalEntityManagerFactoryBean();
+//    }
+
+//    @Bean
+//    public DefaultPersistenceUnitManager defaultPersistenceUnitManager() {
+//        return new DefaultPersistenceUnitManager() {
+//            @Override
+//            public void afterPropertiesSet() {
+//                if (getLoadTimeWeaver() == null && InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) {
+//                    setLoadTimeWeaver(new InstrumentationLoadTimeWeaver(SimpleObject.class.getClassLoader()));
+//                }
+//                preparePersistenceUnitInfos();
+////                super.afterPropertiesSet();
+//            }
+//        };
+//    }
 }
diff --git a/webapp/src/main/java/domainapp/webapp/application/services/homepage/HomePageViewModel.java b/webapp/src/main/java/domainapp/webapp/application/services/homepage/HomePageViewModel.java
index bfb4dca..325b6d5 100644
--- a/webapp/src/main/java/domainapp/webapp/application/services/homepage/HomePageViewModel.java
+++ b/webapp/src/main/java/domainapp/webapp/application/services/homepage/HomePageViewModel.java
@@ -3,6 +3,7 @@ package domainapp.webapp.application.services.homepage;
 import java.util.List;
 
 import javax.inject.Inject;
+import javax.inject.Named;
 
 import org.apache.isis.applib.annotation.DomainObject;
 import org.apache.isis.applib.annotation.DomainObjectLayout;
@@ -12,10 +13,8 @@ import org.apache.isis.applib.annotation.Nature;
 import domainapp.modules.simple.dom.so.SimpleObject;
 import domainapp.modules.simple.dom.so.SimpleObjects;
 
-@DomainObject(
-        nature = Nature.VIEW_MODEL,
-        logicalTypeName = "simple.HomePageViewModel"
-        )
+@Named("simple.HomePageViewModel")
+@DomainObject(nature = Nature.VIEW_MODEL)
 @HomePage
 @DomainObjectLayout()
 public class HomePageViewModel {
diff --git a/webapp/src/main/resources/META-INF/persistence.xml-moved b/webapp/src/main/resources/META-INF/persistence.xml-moved
new file mode 100644
index 0000000..4fc508d
--- /dev/null
+++ b/webapp/src/main/resources/META-INF/persistence.xml-moved
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<persistence version="2.1"
+             xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
+
+    <persistence-unit name="default">
+<!--        <class>org.apache.isis.extensions.sessionlog.applib.dom.SessionLogEntry</class>
+        <class>org.apache.isis.extensions.sessionlog.jpa.dom.SessionLogEntry</class>
+        <class>org.apache.isis.extensions.sessionlog.jpa.dom.SessionLogEntryPK</class>
+        <class>org.apache.isis.extensions.commandlog.applib.dom.CommandLogEntry</class>
+        <class>org.apache.isis.extensions.commandlog.jpa.dom.CommandLogEntry</class>
+        <class>org.apache.isis.extensions.commandlog.jpa.dom.CommandLogEntryPK</class>
+        <class>org.apache.isis.extensions.executionoutbox.applib.dom.ExecutionOutboxEntry</class>
+        <class>org.apache.isis.extensions.executionoutbox.jpa.dom.ExecutionOutboxEntry</class>
+        <class>org.apache.isis.extensions.executionoutbox.jpa.dom.ExecutionOutboxEntryPK</class>
+        <class>org.apache.isis.extensions.executionlog.applib.dom.ExecutionLogEntry</class>
+        <class>org.apache.isis.extensions.executionlog.jpa.dom.ExecutionLogEntry</class>
+        <class>org.apache.isis.extensions.executionlog.jpa.dom.ExecutionLogEntryPK</class>
+        <class>org.apache.isis.extensions.audittrail.applib.dom.AuditTrailEntry</class>
+        <class>org.apache.isis.extensions.audittrail.jpa.dom.AuditTrailEntry</class>
+        <class>domainapp.modules.simple.dom.so.SimpleObject</class>
+        <class>org.apache.isis.persistence.jpa.integration.typeconverters.java.util.JavaUtilUuidConverter</class>
+        <class>org.apache.isis.persistence.jpa.integration.typeconverters.schema.v2.IsisInteractionDtoConverter</class>
+        <class>org.apache.isis.persistence.jpa.integration.typeconverters.schema.v2.IsisCommandDtoConverter</class>
+        <class>org.apache.isis.persistence.jpa.integration.typeconverters.applib.IsisBookmarkConverter</class>
+        <exclude-unlisted-classes>false</exclude-unlisted-classes>-->
+        <properties>
+            <property name="eclipselink.weaving" value="true"/>
+        </properties>
+    </persistence-unit>
+
+</persistence>
diff --git a/webapp/src/main/resources/config/application.properties b/webapp/src/main/resources/config/application.properties
index 7ea0a15..93148bb 100644
--- a/webapp/src/main/resources/config/application.properties
+++ b/webapp/src/main/resources/config/application.properties
@@ -17,7 +17,13 @@ spring.datasource.driver-class-name=org.h2.Driver
 isis.persistence.schema.create-schema-sql-template=CREATE SCHEMA IF NOT EXISTS %s
 isis.persistence.schema.auto-create-schemas=simple,isisExtAuditTrail,isisExtCommandLog,isisExtExecutionLog,isisExtExecutionOutbox,isisExtSessionLog
 
-#eclipselink.weaving=true
+isis.core.meta-model.introspector.policy=encapsulation_enabled
+
+eclipselink.weaving=true
+eclipselink.weaving.changetracking=true
+eclipselink.weaving.internal=true
+eclipselink.weaving.lazy=true
+
 eclipselink.deploy-on-startup=true
 eclipselink.ddl-generation.output-mode=both
 eclipselink.ddl-generation=create-tables