isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject [13/51] [partial] ISIS-188: moving components into correct directories.
Date Thu, 06 Dec 2012 11:09:55 GMT
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/WEB-INF/persistor_datanucleus.properties
----------------------------------------------------------------------
diff --git a/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/WEB-INF/persistor_datanucleus.properties b/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/WEB-INF/persistor_datanucleus.properties
new file mode 100644
index 0000000..14f8038
--- /dev/null
+++ b/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/WEB-INF/persistor_datanucleus.properties
@@ -0,0 +1,114 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+${symbol_pound}  Licensed to the Apache Software Foundation (ASF) under one
+${symbol_pound}  or more contributor license agreements.  See the NOTICE file
+${symbol_pound}  distributed with this work for additional information
+${symbol_pound}  regarding copyright ownership.  The ASF licenses this file
+${symbol_pound}  to you under the Apache License, Version 2.0 (the
+${symbol_pound}  "License"); you may not use this file except in compliance
+${symbol_pound}  with the License.  You may obtain a copy of the License at
+${symbol_pound}  
+${symbol_pound}         http://www.apache.org/licenses/LICENSE-2.0
+${symbol_pound}         
+${symbol_pound}  Unless required by applicable law or agreed to in writing,
+${symbol_pound}  software distributed under the License is distributed on an
+${symbol_pound}  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+${symbol_pound}  KIND, either express or implied.  See the License for the
+${symbol_pound}  specific language governing permissions and limitations
+${symbol_pound}  under the License.
+
+${symbol_pound}
+${symbol_pound} configuration file for the JDO objectstore
+${symbol_pound}
+
+isis.persistor.datanucleus.impl.javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.api.jdo.JDOPersistenceManagerFactory
+isis.persistor.datanucleus.impl.datanucleus.autoCreateSchema=true
+isis.persistor.datanucleus.impl.datanucleus.validateTables=true
+isis.persistor.datanucleus.impl.datanucleus.validateConstraints=true
+
+
+${symbol_pound} L2 cache (on by default)
+isis.persistor.datanucleus.impl.datanucleus.cache.level2.type=none
+
+${symbol_pound}see http://www.datanucleus.org/products/datanucleus/jdo/transaction_types.html${symbol_pound}optimistic
+isis.persistor.datanucleus.impl.datanucleus.persistenceByReachabilityAtCommit=false
+
+
+
+
+
+${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbo
 l_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}
+${symbol_pound} JDBC connection details
+${symbol_pound} (also update the pom.xml to reference the appropriate JDBC driver)
+${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbo
 l_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}${symbol_pound}
+
+${symbol_pound}
+${symbol_pound} HSQLDB in-memory
+${symbol_pound}
+isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver
+isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:hsqldb:mem:test
+isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
+isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
+
+${symbol_pound}
+${symbol_pound} HSQLDB in-memory (using log4jdbc-remix)
+${symbol_pound}
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=net.sf.log4jdbc.DriverSpy
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:log4jdbc:hsqldb:mem:test
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
+
+
+
+${symbol_pound}
+${symbol_pound} HSQLDB to file
+${symbol_pound}
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:hsqldb:file:/tmp/isis-todo-app/hsql-db;hsqldb.write_delay=false;shutdown=true
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
+
+${symbol_pound}
+${symbol_pound} HSQLDB to file (using log4jdbc-remix)
+${symbol_pound}
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=net.sf.log4jdbc.DriverSpy
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:log4jdbc:hsqldb:file:/tmp/isis-todo-app/hsql-db;hsqldb.write_delay=false;shutdown=true
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
+
+
+
+${symbol_pound}
+${symbol_pound} PostgreSQL Server 
+${symbol_pound}
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.postgresql.Driver
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:postgresql://localhost:5432/isis
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=isis
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=isis
+
+${symbol_pound}
+${symbol_pound} PostgreSQL Server (using log4jdbc-remix)
+${symbol_pound}
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=net.sf.log4jdbc.DriverSpy
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:log4jdbc:postgresql://localhost:5432/isis
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=isis
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=isis
+
+
+
+${symbol_pound}
+${symbol_pound} MS SQL Server
+${symbol_pound}
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=com.microsoft.sqlserver.jdbc.SQLServerDriver
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:sqlserver://127.0.0.1:1433;instance=SQLEXPRESS;databaseName=jdo
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=jdo
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=jdopass
+
+${symbol_pound}
+${symbol_pound} MS SQL Server (using log4jdbc-remix)
+${symbol_pound}
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=net.sf.log4jdbc.DriverSpy
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:log4jdbc:sqlserver://127.0.0.1:1433;instance=SQLEXPRESS;databaseName=jdo
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=jdo
+${symbol_pound}isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=jdopass

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/WEB-INF/web.xml b/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..7b6d253
--- /dev/null
+++ b/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,136 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<web-app id="WebApp_ID" version="2.4"
+    xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+    <display-name>Quickstart Wicket app</display-name>
+
+    <!-- which configuration directory to read overloaded property files from -->
+    <!-- 
+    Normally configuration like this should be done from outside your web 
+    application. Especially if your configuration is not know in advance or
+    if it can change depending on where the application gets deployed.
+    
+    For instance to configure this in Tomcat outside the application WAR add
+    the following line to your application context ( For more detail see:
+    http://tomcat.apache.org/tomcat-7.0-doc/config/context.html${symbol_pound}Context_Parameters )
+     
+    <Parameter name="isis.config.dir" value="/usr/local/tomcat/conf/"
+         override="true"/>
+         
+    If your configuration directory is fixed you can enable the following 
+    context parameter in here and forget about the outside part.
+         
+    <context-param>
+      <param-name>isis.config.dir</param-name>
+      <param-value>location of your config directory if fixed</param-value>
+    </context-param>
+    -->
+
+    <!-- cache static resources for 1 day -->
+    <filter>
+        <filter-name>ResourceCachingFilter</filter-name>
+        <filter-class>org.apache.isis.core.webapp.content.ResourceCachingFilter</filter-class>
+        <init-param>
+            <param-name>CacheTime</param-name>
+            <param-value>86400</param-value>
+        </init-param>
+    </filter>
+    <filter-mapping>
+        <filter-name>ResourceCachingFilter</filter-name>
+        <url-pattern>*.js</url-pattern>
+    </filter-mapping>
+    <filter-mapping>
+        <filter-name>ResourceCachingFilter</filter-name>
+        <url-pattern>*.css</url-pattern>
+    </filter-mapping>
+    <filter-mapping>
+        <filter-name>ResourceCachingFilter</filter-name>
+        <url-pattern>*.png</url-pattern>
+    </filter-mapping>
+    <filter-mapping>
+        <filter-name>ResourceCachingFilter</filter-name>
+        <url-pattern>*.jpg</url-pattern>
+    </filter-mapping>
+    <filter-mapping>
+        <filter-name>ResourceCachingFilter</filter-name>
+        <url-pattern>*.gif</url-pattern>
+    </filter-mapping>
+    <filter-mapping>
+        <filter-name>ResourceCachingFilter</filter-name>
+        <url-pattern>*.html</url-pattern>
+    </filter-mapping>
+    
+    <servlet>
+        <servlet-name>Resource</servlet-name>
+        <servlet-class>org.apache.isis.core.webapp.content.ResourceServlet</servlet-class>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>Resource</servlet-name>
+        <url-pattern>*.css</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>Resource</servlet-name>
+        <url-pattern>*.png</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>Resource</servlet-name>
+        <url-pattern>*.jpg</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>Resource</servlet-name>
+        <url-pattern>*.gif</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>Resource</servlet-name>
+        <url-pattern>*.js</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>Resource</servlet-name>
+        <url-pattern>*.html</url-pattern>
+    </servlet-mapping>
+    
+
+
+    <!--
+    -
+    - config specific to the wicket-viewer
+    -
+    -->
+	<filter>
+		<filter-name>wicket</filter-name>
+		<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+		<init-param>
+			<param-name>applicationClassName</param-name>
+			<param-value>app.QuickStartApplication</param-value>
+		</init-param>
+	</filter>
+
+	<filter-mapping>
+		<filter-name>wicket</filter-name>
+		<url-pattern>/*</url-pattern>
+	</filter-mapping>
+
+	
+</web-app>

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/css/application.css
----------------------------------------------------------------------
diff --git a/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/css/application.css b/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/css/application.css
new file mode 100644
index 0000000..bd4c5b0
--- /dev/null
+++ b/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/css/application.css
@@ -0,0 +1,41 @@
+/*
+ *  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.
+ */
+
+/*
+uncomment to add a logo (in an ../images directory relative to this file)
+
+#header {
+    height: 48px;
+    background-image: url("../images/logo.png");
+	background-repeat: no-repeat;
+}
+
+#header h1 {
+	display: none;
+}
+*/
+
+body {
+	background-color: #00477F;
+}
+
+.welcome .intro {
+	font-size: larger;
+	text-align: center;
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/images/app-banner.pdn
----------------------------------------------------------------------
diff --git a/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/images/app-banner.pdn b/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/images/app-banner.pdn
new file mode 100644
index 0000000..8fae9aa
Binary files /dev/null and b/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/images/app-banner.pdn differ

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/images/app-banner.png
----------------------------------------------------------------------
diff --git a/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/images/app-banner.png b/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/images/app-banner.png
new file mode 100644
index 0000000..01967f2
Binary files /dev/null and b/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/images/app-banner.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/scripts/application.js
----------------------------------------------------------------------
diff --git a/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/scripts/application.js b/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/scripts/application.js
new file mode 100644
index 0000000..d8cf6fe
--- /dev/null
+++ b/framework/archetype/quickstart/src/main/resources/archetype-resources/viewer-wicket/src/main/webapp/scripts/application.js
@@ -0,0 +1,3 @@
+$(document).ready(function() {
+	/// here...
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/archetype/quickstart/src/test/resources/projects/basic/archetype.properties
----------------------------------------------------------------------
diff --git a/framework/archetype/quickstart/src/test/resources/projects/basic/archetype.properties b/framework/archetype/quickstart/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..57ffe72
--- /dev/null
+++ b/framework/archetype/quickstart/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,5 @@
+#Fri Oct 12 17:51:43 BST 2012
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/archetype/quickstart/src/test/resources/projects/basic/goal.txt
----------------------------------------------------------------------
diff --git a/framework/archetype/quickstart/src/test/resources/projects/basic/goal.txt b/framework/archetype/quickstart/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-applib/NOTICE
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-applib/NOTICE b/framework/objectstore/jdo/jdo-applib/NOTICE
new file mode 100644
index 0000000..d391f54
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-applib/NOTICE
@@ -0,0 +1,7 @@
+Apache Isis
+Copyright 2010-2011 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-applib/pom.xml
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-applib/pom.xml b/framework/objectstore/jdo/jdo-applib/pom.xml
new file mode 100644
index 0000000..9236b46
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-applib/pom.xml
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>org.apache.isis.runtimes.dflt.objectstores</groupId>
+		<artifactId>jdo</artifactId>
+		<version>0.3.1-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>jdo-applib</artifactId>
+	<name>JDO ObjectStore AppLib</name>
+
+	<properties>
+		<siteBaseDir>../../../../..</siteBaseDir>
+		<relativeUrl>runtimes/dflt/objectstores/jdo/jdo-applib/</relativeUrl>
+	</properties>
+
+    <!-- used in Site generation for relative references. -->
+    <url>http://incubator.apache.org/isis/${relativeUrl}</url>
+
+
+	<build>
+		<plugins>
+            <plugin>
+                <groupId>org.datanucleus</groupId>
+                <artifactId>maven-datanucleus-plugin</artifactId>
+                <version>3.1.1</version>
+                <configuration>
+                	<fork>false</fork>
+                    <verbose>true</verbose>
+                    <!-- 
+                    <log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
+                    <props>${basedir}/datanucleus.properties</props>
+                    -->
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>enhance</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+		</plugins>
+		<pluginManagement>
+			<plugins>
+				<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+				<plugin>
+					<groupId>org.eclipse.m2e</groupId>
+					<artifactId>lifecycle-mapping</artifactId>
+					<version>1.0.0</version>
+					<configuration>
+						<lifecycleMappingMetadata>
+							<pluginExecutions>
+								<pluginExecution>
+									<pluginExecutionFilter>
+										<groupId>
+											org.datanucleus
+										</groupId>
+										<artifactId>
+											maven-datanucleus-plugin
+										</artifactId>
+										<versionRange>
+											[3.0.2,)
+										</versionRange>
+										<goals>
+											<goal>enhance</goal>
+										</goals>
+									</pluginExecutionFilter>
+									<action>
+										<ignore></ignore>
+									</action>
+								</pluginExecution>
+							</pluginExecutions>
+						</lifecycleMappingMetadata>
+					</configuration>
+				</plugin>
+			</plugins>
+		</pluginManagement>
+	</build>
+
+	<dependencyManagement>
+		<dependencies>
+			<!-- for DataNucleus, see below -->
+			<dependency>
+	            <groupId>org.apache.isis.runtimes.dflt.objectstores</groupId>
+				<artifactId>jdo</artifactId>
+				<version>0.3.1-SNAPSHOT</version>
+				<type>pom</type>
+				<scope>import</scope>						
+			</dependency>
+		</dependencies>
+	</dependencyManagement>	
+
+	<dependencies>
+
+        <dependency>
+            <groupId>org.apache.isis</groupId>
+            <artifactId>applib</artifactId>
+        </dependency>
+
+		<!-- DataNucleus (horrid, but needed to run the enhancer)-->
+        <dependency>
+            <groupId>javax.jdo</groupId>
+            <artifactId>jdo-api</artifactId>
+            <exclusions>
+              <exclusion>
+                <!-- use geronimo-jta_1.1_spec instead -->
+                <groupId>javax.transaction</groupId>
+                <artifactId>jta</artifactId>
+              </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-core</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-enhancer</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-jodatime</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-api-jdo</artifactId>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-jta_1.1_spec</artifactId>
+        </dependency>
+
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditService.java
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditService.java b/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditService.java
new file mode 100644
index 0000000..93cf643
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditService.java
@@ -0,0 +1,28 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.applib;
+
+import org.apache.isis.applib.annotation.Hidden;
+
+public interface AuditService {
+    
+    @Hidden
+    public void audit(String user, long currentTimestampEpoch, String objectType, String identifier, String preValue, String postValue);
+    
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditServiceLogging.java
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditServiceLogging.java b/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditServiceLogging.java
new file mode 100644
index 0000000..7dd8297
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditServiceLogging.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.applib;
+
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.log4j.Logger;
+
+public class AuditServiceLogging extends AbstractFactoryAndRepository  implements AuditService {
+    
+    private static Logger LOG = Logger.getLogger(AuditServiceLogging.class);
+    
+    @Hidden
+    public void audit(String user, long currentTimestampEpoch, String objectType, String identifier, String preValue, String postValue) {
+        String auditMessage = objectType + ":" + identifier + " by " + user + ": " + preValue + " -> " + postValue; 
+        LOG.info(auditMessage);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/Auditable.java
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/Auditable.java b/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/Auditable.java
new file mode 100644
index 0000000..96fe2ef
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/Auditable.java
@@ -0,0 +1,26 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.applib;
+
+/**
+ * Marker interface to indicate that an entity should be audited.
+ */
+public interface Auditable {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/annotations/Auditable.java
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/annotations/Auditable.java b/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/annotations/Auditable.java
new file mode 100644
index 0000000..24444a6
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/annotations/Auditable.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.runtimes.dflt.objectstores.jdo.applib.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates that the entity is auditable.
+ * 
+ * <p>
+ * Alternatively, the type can implement the 
+ * {@link org.apache.isis.runtimes.dflt.objectstores.jdo.applib.Auditable Auditable} marker interface.
+ */
+@Inherited
+@Target({ ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Auditable {
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-applib/src/main/resources/plugin.xml
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-applib/src/main/resources/plugin.xml b/framework/objectstore/jdo/jdo-applib/src/main/resources/plugin.xml
new file mode 100644
index 0000000..426a18b
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-applib/src/main/resources/plugin.xml
@@ -0,0 +1,66 @@
+<?xml version="1.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. 
+-->
+<plugin>
+
+    <extension point="org.datanucleus.java_type">
+        <java-type 
+        	name="org.apache.isis.applib.value.Date" 
+        	persistent="true" 
+        	dfg="true" 
+        	embedded="true"
+            long-converter="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisDateConverter"/>
+        <java-type 
+            name="org.apache.isis.applib.value.DateTime" 
+            persistent="true" 
+            dfg="true" 
+            embedded="true"
+            long-converter="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisDateTimeConverter"/>
+
+        <java-type 
+            name="org.apache.isis.applib.value.Blob" 
+            persistent="true" 
+            dfg="false" 
+            embedded="true"
+            string-converter="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisBlobConverter"/>
+        <java-type 
+            name="org.apache.isis.applib.value.Clob" 
+            persistent="true" 
+            dfg="false" 
+            embedded="true"
+            string-converter="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisClobConverter"/>
+    </extension>
+
+    <extension point="org.datanucleus.store_mapping">
+        <mapping 
+            java-type="org.apache.isis.applib.value.Date" 
+            mapping-class="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisDateMapping"/>
+        <mapping 
+            java-type="org.apache.isis.applib.value.DateTime" 
+            mapping-class="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisDateTimeMapping"/>
+
+        <mapping 
+            java-type="org.apache.isis.applib.value.Blob" 
+            mapping-class="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisBlobMapping"/>
+        <mapping 
+            java-type="org.apache.isis.applib.value.Clob" 
+            mapping-class="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisClobMapping"/>
+
+    </extension>
+</plugin>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-applib/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-applib/src/site/apt/index.apt b/framework/objectstore/jdo/jdo-applib/src/site/apt/index.apt
new file mode 100644
index 0000000..e6b8a19
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-applib/src/site/apt/index.apt
@@ -0,0 +1,24 @@
+~~  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.
+
+Application Library
+
+  The JPA objectstore applib ...
+
+Further Info
+  
+  See this module's {{{./apidocs/index.html}Javadoc}} and the {{{../docbkx/html/guide/isis-jpa-objectstore.html}user guide}} for more information.

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-applib/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-applib/src/site/apt/jottings.apt b/framework/objectstore/jdo/jdo-applib/src/site/apt/jottings.apt
new file mode 100644
index 0000000..c5d1200
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-applib/src/site/apt/jottings.apt
@@ -0,0 +1,24 @@
+~~  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.
+
+
+
+Jottings
+ 
+  This page is to capture any random jottings relating to this module prior 
+  to being moved into formal documentation. 
+ 

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-applib/src/site/site.xml
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-applib/src/site/site.xml b/framework/objectstore/jdo/jdo-applib/src/site/site.xml
new file mode 100644
index 0000000..461e451
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-applib/src/site/site.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project name="${project.name}">
+
+	<body>
+		<breadcrumbs>
+			<item name="Applib" href="index.html"/>
+		</breadcrumbs>
+
+		<menu name="JDO Applib">
+			<item name="About" href="index.html" />
+            <item name="Jottings" href="jottings.html" />
+		</menu>
+
+        <menu name="JDO Modules">
+            <item name="Applib" href="../jdo-applib/index.html" />
+            <item name="Metamodel" href="../jdo-metamodel/index.html" />
+            <item name="DataNucleus" href="../jdo-datanucleus/index.html" />
+        </menu>
+        
+		<menu name="Maven Reports" ref="reports" />
+	</body>
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-datanucleus/NOTICE
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-datanucleus/NOTICE b/framework/objectstore/jdo/jdo-datanucleus/NOTICE
new file mode 100644
index 0000000..d391f54
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-datanucleus/NOTICE
@@ -0,0 +1,7 @@
+Apache Isis
+Copyright 2010-2011 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-datanucleus/lib/.gitignore
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-datanucleus/lib/.gitignore b/framework/objectstore/jdo/jdo-datanucleus/lib/.gitignore
new file mode 100644
index 0000000..4c21459
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-datanucleus/lib/.gitignore
@@ -0,0 +1,24 @@
+#
+#   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. 
+#
+
+#
+# explicitly ignoring Microsoft JDBC4 jar
+# (cannot redistribute, licensing)
+#
+sqljdbc4.jar

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-datanucleus/pom.xml
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-datanucleus/pom.xml b/framework/objectstore/jdo/jdo-datanucleus/pom.xml
new file mode 100644
index 0000000..0c13cec
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-datanucleus/pom.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>org.apache.isis.runtimes.dflt.objectstores</groupId>
+		<artifactId>jdo</artifactId>
+		<version>0.3.1-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>jdo-datanucleus</artifactId>
+	<name>JDO DataNucleus ObjectStore</name>
+
+    <properties>
+	    <siteBaseDir>../../../../..</siteBaseDir>
+	    <relativeUrl>runtimes/dflt/objectstores/jdo/jdo-datanucleus/</relativeUrl>
+	</properties>
+
+    <!-- used in Site generation for relative references. -->
+    <url>http://incubator.apache.org/isis/${relativeUrl}</url>
+
+	<build>
+	    <plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<!-- 
+				 -->
+				<configuration>
+					<skipTests>true</skipTests>
+				</configuration>
+			</plugin>
+	    </plugins>
+	</build>
+  
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.isis.runtimes.dflt.objectstores</groupId>
+			<artifactId>jdo-metamodel</artifactId>
+		</dependency>
+		
+       <dependency>
+            <groupId>javax.jdo</groupId>
+            <artifactId>jdo-api</artifactId>
+            <exclusions>
+              <exclusion>
+                <!-- use geronimo-jta_1.1_spec instead -->
+                <groupId>javax.transaction</groupId>
+                <artifactId>jta</artifactId>
+              </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-enhancer</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-api-jdo</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.datanucleus</groupId>
+            <artifactId>datanucleus-rdbms</artifactId>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-jta_1.1_spec</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-unittestsupport</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.runtimes.dflt</groupId>
+            <artifactId>runtime</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.isis.runtimes.dflt</groupId>
+            <artifactId>isis-integtestsupport</artifactId>
+            <scope>test</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+             <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hsqldb</groupId>
+            <artifactId>hsqldb</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+		<!-- 
+		<dependency>
+			<groupId>com.microsoft.sqlserver</groupId>
+			<artifactId>jdbc</artifactId>
+			<version>4.0</version>
+			<scope>system</scope>
+			<optional>true</optional>
+			<systemPath>${basedir}/lib/sqljdbc4.jar</systemPath>
+		</dependency>
+		-->
+
+	</dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusApplicationComponents.java
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusApplicationComponents.java b/framework/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusApplicationComponents.java
new file mode 100644
index 0000000..b051e3f
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusApplicationComponents.java
@@ -0,0 +1,161 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+import org.datanucleus.NucleusContext;
+import org.datanucleus.api.jdo.JDOPersistenceManagerFactory;
+import org.datanucleus.store.schema.SchemaAwareStoreManager;
+
+import org.apache.isis.core.commons.components.ApplicationScopedComponent;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.FrameworkSynchronizer;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.IsisLifecycleListener;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.embeddedonly.JdoEmbeddedOnlyFacet;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacet;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.query.JdoNamedQuery;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.query.JdoQueryFacet;
+
+public class DataNucleusApplicationComponents implements ApplicationScopedComponent {
+
+    private final PersistenceManagerFactory persistenceManagerFactory;
+    private final Map<String, JdoNamedQuery> namedQueryByName;
+    
+    private final IsisLifecycleListener lifecycleListener;
+    private final FrameworkSynchronizer synchronizer;
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    ///////////////////////////////////////////////////////////////////////////
+
+    public DataNucleusApplicationComponents(final Map<String, String> props, final Collection<ObjectSpecification> objectSpecs) {
+        persistenceManagerFactory = JDOHelper.getPersistenceManagerFactory(props);
+        
+        final Set<String> classesToBePersisted = catalogClassesToBePersisted(objectSpecs);
+
+        createSchema(props, classesToBePersisted);
+
+        namedQueryByName = Collections.unmodifiableMap(catalogNamedQueries(objectSpecs));
+
+        synchronizer = new FrameworkSynchronizer();
+        lifecycleListener = new IsisLifecycleListener(synchronizer);
+    }
+    
+    private void createSchema(final Map<String, String> props, final Set<String> classesToBePersisted) {
+        final JDOPersistenceManagerFactory jdopmf = (JDOPersistenceManagerFactory)persistenceManagerFactory;
+        final NucleusContext nucleusContext = jdopmf.getNucleusContext();
+        final SchemaAwareStoreManager storeManager = (SchemaAwareStoreManager) nucleusContext.getStoreManager();
+        storeManager.createSchema(classesToBePersisted, asProperties(props));
+    }
+
+    private static Set<String> catalogClassesToBePersisted(Collection<ObjectSpecification> objectSpecs) {
+        Set<String> classNames = Sets.newTreeSet();
+        for (final ObjectSpecification spec : objectSpecs) {
+            if(spec.containsFacet(JdoPersistenceCapableFacet.class) || spec.containsFacet(JdoEmbeddedOnlyFacet.class)) {
+                classNames.add(spec.getFullIdentifier());
+            }
+        }
+        return Collections.unmodifiableSet(classNames);
+    }
+
+    private static Properties asProperties(Map<String, String> props) {
+        Properties properties = new Properties();
+        properties.putAll(props);
+        return properties;
+    }
+
+    private static Map<String, JdoNamedQuery> catalogNamedQueries(Collection<ObjectSpecification> objectSpecs) {
+        final Map<String, JdoNamedQuery> namedQueryByName = Maps.newHashMap();
+        for (final ObjectSpecification spec : objectSpecs) {
+            final JdoQueryFacet facet = spec.getFacet(JdoQueryFacet.class);
+            if (facet == null) {
+                continue;
+            }
+            for (final JdoNamedQuery namedQuery : facet.getNamedQueries()) {
+                namedQueryByName.put(namedQuery.getName(), namedQuery);
+            }
+        }
+        return namedQueryByName;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    ///////////////////////////////////////////////////////////////////////////
+
+    @Override
+    public void init() {
+    }
+
+    @Override
+    public void shutdown() {
+    }
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    // FrameworkSynchronizer
+    ///////////////////////////////////////////////////////////////////////////
+
+    public FrameworkSynchronizer getFrameworkSynchronizer() {
+        return synchronizer;
+    }
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    ///////////////////////////////////////////////////////////////////////////
+    
+    public PersistenceManager createPersistenceManager() {
+        PersistenceManager persistenceManager = persistenceManagerFactory.getPersistenceManager();
+        
+        persistenceManager.addInstanceLifecycleListener(lifecycleListener, (Class[])null);
+        return persistenceManager;
+    }
+
+    public JdoNamedQuery getNamedQuery(String queryName) {
+        return namedQueryByName.get(queryName);
+    }
+
+    
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    ///////////////////////////////////////////////////////////////////////////
+
+    public void suspendListener() {
+        lifecycleListener.setSuspended(true);
+    }
+
+    public void resumeListener() {
+        lifecycleListener.setSuspended(false);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusException.java
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusException.java b/framework/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusException.java
new file mode 100644
index 0000000..fa2d302
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusException.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus;
+
+import org.apache.isis.runtimes.dflt.runtime.persistence.ObjectPersistenceException;
+
+public class DataNucleusException extends ObjectPersistenceException {
+
+    private static final long serialVersionUID = 1L;
+
+    public DataNucleusException() {
+        super();
+    }
+
+    public DataNucleusException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public DataNucleusException(String message) {
+        super(message);
+    }
+
+    public DataNucleusException(Throwable cause) {
+        super(cause);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusObjectStore.java
----------------------------------------------------------------------
diff --git a/framework/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusObjectStore.java b/framework/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusObjectStore.java
new file mode 100644
index 0000000..2e3711a
--- /dev/null
+++ b/framework/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusObjectStore.java
@@ -0,0 +1,723 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus;
+
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatContext;
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+
+import java.sql.Connection;
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Map;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.spi.PersistenceCapable;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import org.apache.log4j.Logger;
+
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
+import org.apache.isis.core.metamodel.adapter.ResolveState;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.oid.AggregatedOid;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.FrameworkSynchronizer;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.FrameworkSynchronizer.CalledFrom;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.commands.DataNucleusCreateObjectCommand;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.commands.DataNucleusDeleteObjectCommand;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.commands.DataNucleusUpdateObjectCommand;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries.PersistenceQueryFindAllInstancesProcessor;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries.PersistenceQueryFindByPatternProcessor;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries.PersistenceQueryFindByTitleProcessor;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries.PersistenceQueryFindUsingApplibQueryProcessor;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries.PersistenceQueryProcessor;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries.QueryUtil;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.spi.JdoObjectIdSerializer;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.query.JdoNamedQuery;
+import org.apache.isis.runtimes.dflt.runtime.persistence.ObjectNotFoundException;
+import org.apache.isis.runtimes.dflt.runtime.persistence.UnsupportedFindException;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.ObjectStoreSpi;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.CreateObjectCommand;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.DestroyObjectCommand;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.PersistenceCommand;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.transaction.SaveObjectCommand;
+import org.apache.isis.runtimes.dflt.runtime.persistence.query.PersistenceQueryFindAllInstances;
+import org.apache.isis.runtimes.dflt.runtime.persistence.query.PersistenceQueryFindByPattern;
+import org.apache.isis.runtimes.dflt.runtime.persistence.query.PersistenceQueryFindByTitle;
+import org.apache.isis.runtimes.dflt.runtime.persistence.query.PersistenceQueryFindUsingApplibQueryDefault;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManagerSpi;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceQuery;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.runtimes.dflt.runtime.system.transaction.IsisTransaction;
+import org.apache.isis.runtimes.dflt.runtime.system.transaction.IsisTransactionManager;
+
+public class DataNucleusObjectStore implements ObjectStoreSpi {
+
+    private static final Logger LOG = Logger.getLogger(DataNucleusObjectStore.class);
+
+    static enum State {
+        NOT_YET_OPEN, OPEN, CLOSED;
+    }
+
+    /**
+     * @see #isFixturesInstalled()
+     */
+    public static final String INSTALL_FIXTURES_KEY = ConfigurationConstants.ROOT + "persistor.datanucleus.install-fixtures";
+    public static final boolean INSTALL_FIXTURES_DEFAULT = false;
+
+    static enum TransactionMode {
+        /**
+         * Requires transactions to be started explicitly.
+         */
+        UNCHAINED,
+        /**
+         * Transactions are started automatically if not already in progress.
+         */
+        CHAINED;
+    }
+
+    private final ObjectAdapterFactory adapterFactory;
+    private final DataNucleusApplicationComponents applicationComponents;
+    
+    private final Map<ObjectSpecId, RootOid> registeredServices = Maps.newHashMap();
+
+    private PersistenceManager persistenceManager;
+
+    private final Map<Class<?>, PersistenceQueryProcessor<?>> persistenceQueryProcessorByClass = Maps.newHashMap();
+    private final FrameworkSynchronizer frameworkSynchronizer;
+
+    private State state;
+    private TransactionMode transactionMode;
+    
+
+    public DataNucleusObjectStore(ObjectAdapterFactory adapterFactory, DataNucleusApplicationComponents applicationComponents) {
+        ensureThatArg(adapterFactory, is(notNullValue()));
+        ensureThatArg(applicationComponents, is(notNullValue()));
+
+        this.state = State.NOT_YET_OPEN;
+        this.transactionMode = TransactionMode.UNCHAINED;
+
+        this.adapterFactory = adapterFactory;
+        this.applicationComponents = applicationComponents;
+        this.frameworkSynchronizer = applicationComponents.getFrameworkSynchronizer();
+    }
+
+    @Override
+    public String name() {
+        return "datanucleus";
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // open, close
+    // ///////////////////////////////////////////////////////////////////////
+
+    public void open() {
+        ensureNotYetOpen();
+
+        openSession();
+        ensureThatState(persistenceManager, is(notNullValue()));
+
+        addPersistenceQueryProcessors(persistenceManager);
+
+        state = State.OPEN;
+    }
+
+    /**
+     * {@inheritDoc}
+     * <p>
+     * Automatically {@link IsisTransactionManager#endTransaction() ends
+     * (commits)} the current (Isis) {@link Transaction}. This in turn
+     * {@link DataNucleusObjectStore#commitJdoTransaction() commits the underlying
+     * JPA transaction}.
+     * <p>
+     * The corresponding DataNucleus {@link Entity} is then
+     * {@link EntityManager#close() close}d.
+     */
+    public void close() {
+        ensureOpened();
+        ensureThatState(persistenceManager, is(notNullValue()));
+
+        final IsisTransaction currentTransaction = getTransactionManager().getTransaction();
+        if (currentTransaction != null && currentTransaction.getState().canCommit()) {
+            getTransactionManager().endTransaction();
+        }
+
+        persistenceManager.close();
+        state = State.CLOSED;
+    }
+
+    private PersistenceManager openSession() {
+        this.persistenceManager = applicationComponents.createPersistenceManager();
+        return this.persistenceManager;
+    }
+
+    private void addPersistenceQueryProcessors(final PersistenceManager persistenceManager) {
+        persistenceQueryProcessorByClass.put(PersistenceQueryFindAllInstances.class, new PersistenceQueryFindAllInstancesProcessor(persistenceManager, frameworkSynchronizer));
+        persistenceQueryProcessorByClass.put(PersistenceQueryFindByTitle.class, new PersistenceQueryFindByTitleProcessor(persistenceManager, frameworkSynchronizer));
+        persistenceQueryProcessorByClass.put(PersistenceQueryFindByPattern.class, new PersistenceQueryFindByPatternProcessor(persistenceManager, frameworkSynchronizer));
+        persistenceQueryProcessorByClass.put(PersistenceQueryFindUsingApplibQueryDefault.class, new PersistenceQueryFindUsingApplibQueryProcessor(persistenceManager, frameworkSynchronizer));
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // isFixturesInstalled
+    // ///////////////////////////////////////////////////////////////////////
+
+    /**
+     * Implementation looks for the {@link #INSTALL_FIXTURES_KEY} in the
+     * {@link #getConfiguration() configuration}.
+     * <p>
+     * By default this is not expected to be there, but utilities can add in on
+     * the fly during bootstrapping if required.
+     */
+    public boolean isFixturesInstalled() {
+        return ! getConfiguration().getBoolean(INSTALL_FIXTURES_KEY, INSTALL_FIXTURES_DEFAULT);
+    }
+
+
+    // ///////////////////////////////////////////////////////////////////////
+    // reset
+    // ///////////////////////////////////////////////////////////////////////
+
+    public void reset() {
+        // does nothing.
+    }
+
+    /**
+     * Non-API.
+     */
+    public Connection getJavaSqlConnection() {
+        return (Connection) persistenceManager.getDataStoreConnection().getNativeConnection();
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // TransactionMode (not API)
+    // ///////////////////////////////////////////////////////////////////////
+
+    public TransactionMode getTransactionMode() {
+        return transactionMode;
+    }
+
+    public void setTransactionMode(final TransactionMode transactionMode) {
+        ensureNotInTransaction();
+        this.transactionMode = transactionMode;
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Transactions
+    // ///////////////////////////////////////////////////////////////////////
+
+    public void startTransaction() {
+        beginJdoTransaction();
+    }
+
+    public void endTransaction() {
+        commitJdoTransaction();
+    }
+
+    public void abortTransaction() {
+        rollbackJpaTransaction();
+    }
+
+    private void beginJdoTransaction() {
+        final javax.jdo.Transaction transaction = getPersistenceManager().currentTransaction();
+        if (transaction.isActive()) {
+            throw new IllegalStateException("Transaction already active");
+        }
+        transaction.begin();
+    }
+
+    private void commitJdoTransaction() {
+        final javax.jdo.Transaction transaction = getPersistenceManager().currentTransaction();
+        if (transaction.isActive()) {
+            transaction.commit();
+        }
+    }
+
+    private void rollbackJpaTransaction() {
+        final javax.jdo.Transaction transaction = getPersistenceManager().currentTransaction();
+        if (transaction.isActive()) {
+            transaction.rollback();
+        }
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Command Factory
+    // ///////////////////////////////////////////////////////////////////////
+
+    public CreateObjectCommand createCreateObjectCommand(final ObjectAdapter adapter) {
+        ensureOpened();
+        ensureInSession();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("create object - creating command for: " + adapter);
+        }
+        if (adapter.representsPersistent()) {
+            throw new IllegalArgumentException("Adapter is persistent; adapter: " + adapter);
+        }
+        return new DataNucleusCreateObjectCommand(adapter, getPersistenceManager());
+    }
+
+    public SaveObjectCommand createSaveObjectCommand(final ObjectAdapter adapter) {
+        ensureOpened();
+        ensureInSession();
+
+        if (!adapter.representsPersistent()) {
+            throw new IllegalArgumentException("Adapter is not persistent; adapter: " + adapter);
+        }
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("save object - creating command for: " + adapter);
+        }
+        return new DataNucleusUpdateObjectCommand(adapter, getPersistenceManager());
+    }
+
+    public DestroyObjectCommand createDestroyObjectCommand(final ObjectAdapter adapter) {
+        ensureOpened();
+        ensureInSession();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("destroy object - creating command for: " + adapter);
+        }
+        if (!adapter.representsPersistent()) {
+            throw new IllegalArgumentException("Adapter is not persistent; adapter: " + adapter);
+        }
+        return new DataNucleusDeleteObjectCommand(adapter, getPersistenceManager());
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Execute
+    // ///////////////////////////////////////////////////////////////////////
+
+    public void execute(final List<PersistenceCommand> commands) {
+        ensureOpened();
+        ensureInTransaction();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("execute " + commands.size() + " commands");
+        }
+
+        if (commands.size() <= 0) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("no commands");
+            }
+            return;
+        }
+
+        executeCommands(commands);
+    }
+
+    private void executeCommands(final List<PersistenceCommand> commands) {
+        try {
+            for (final PersistenceCommand command : commands) {
+                command.execute(null);
+            }
+            getPersistenceManager().flush();
+        } catch (final RuntimeException e) {
+            LOG.warn("Failure during execution", e);
+            throw e;
+        }
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // loadMappedObject, resolveImmediately, resolveField
+    // ///////////////////////////////////////////////////////////////////////
+
+    public ObjectAdapter loadInstanceAndAdapt(final TypedOid oid) {
+        ensureOpened();
+        ensureInTransaction();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("getObject; oid=" + oid);
+        }
+
+        final Object pojo = loadPojo(oid);
+        return getPersistenceSession().mapRecreatedPojo(oid, pojo);
+    }
+
+    
+    
+    /////////////////////////////////////////////////////////////
+    // delegated to by PojoRecreator
+    /////////////////////////////////////////////////////////////
+
+    public Object loadPojo(final TypedOid oid) {
+    	
+        // REVIEW: does it make sense to get these directly?  not sure, so for now have decided to fail fast. 
+        if(oid instanceof AggregatedOid) {
+            throw new UnsupportedOperationException("Cannot retrieve aggregated objects directly, oid: " + oid.enString(getOidMarshaller()));
+        }
+        
+        final RootOid rootOid = (RootOid) oid;
+        
+        Object result = null;
+        try {
+            final Class<?> cls = clsOf(rootOid);
+            final Object jdoObjectId = JdoObjectIdSerializer.toJdoObjectId(rootOid);
+            result = getPersistenceManager().getObjectById(cls, jdoObjectId);
+        } catch (final RuntimeException e) {
+            throw e;
+        }
+
+        if (result == null) {
+            throw new ObjectNotFoundException(oid);
+        }
+        return result;
+    }
+
+    
+    public ObjectAdapter lazilyLoaded(Object pojo) {
+        if(!(pojo instanceof PersistenceCapable)) {
+            return null;
+        } 
+        final PersistenceCapable persistenceCapable = (PersistenceCapable) pojo;
+        return frameworkSynchronizer.lazilyLoaded(persistenceCapable, CalledFrom.OS_LAZILYLOADED);
+    }
+
+
+
+    /**
+     * Will do nothing if object is already resolved or if object is transient.
+     * <p>
+     * TODO:
+     * The final {@link ResolveState} of the adapter is set using
+     * {@link NakedLoadPostEventListener#onPostLoad(org.hibernate.event.PostLoadEvent)}
+     * Note: this is the same behaviour as MemoryObjectStore, XmlObjectStore
+     * and HibernateObjectStore.
+     * <p>
+     * REVIEW: if the initial state is RESOLVING_PART, then the
+     * {@link ResolveState} is not changed. Is this right?
+     */
+    public void resolveImmediately(final ObjectAdapter adapter) {
+        ensureOpened();
+        ensureInTransaction();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("resolveImmediately; oid=" + adapter.getOid().enString(getOidMarshaller()));
+        }
+
+        if (adapter.isResolved()) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("; already resolved - ignoring");
+            }
+            return;
+        }
+        if (!adapter.representsPersistent()) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("; not persistent - ignoring");
+            }
+            return;
+        }
+
+        final Oid oid = adapter.getOid();
+        if (oid instanceof AggregatedOid) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("; aggregated - resolving parent");
+            }
+            final AggregatedOid aggregatedOid = (AggregatedOid) oid;
+            final TypedOid parentOid = aggregatedOid.getParentOid();
+            final ObjectAdapter parentAdapter = loadInstanceAndAdapt(parentOid);
+            resolveImmediately(parentAdapter);
+            return;
+        }
+
+        // REVIEW: is this possible?
+        final Object domainObject = adapter.getObject();
+		if (domainObject == null) {
+            throw new ObjectNotFoundException(adapter.getOid());
+        }
+
+        try {
+            getPersistenceManager().refresh(domainObject);
+        } catch (final RuntimeException e) {
+            throw new ObjectNotFoundException(adapter.getOid(), e);
+        }
+
+        // possibly redundant because also called in the post-load event
+        // listener, but (with JPA impl) found it was required if we were ever to 
+        // get an eager left-outer-join as the result of a refresh (sounds possible).
+        
+        frameworkSynchronizer.postLoadProcessingFor((PersistenceCapable) domainObject, CalledFrom.OS_RESOLVE);
+    }
+
+    /**
+     * Walking the graph.
+     */
+    public void resolveField(final ObjectAdapter object, final ObjectAssociation association) {
+        ensureOpened();
+        ensureInTransaction();
+
+        final ObjectAdapter referencedCollectionAdapter = association.get(object);
+
+        // this code originally brought in from the JPA impl, but seems reasonable.
+        if (association.isOneToManyAssociation()) {
+            ensureThatState(referencedCollectionAdapter, is(notNullValue()));
+
+            final Object referencedCollection = referencedCollectionAdapter.getObject();
+            ensureThatState(referencedCollection, is(notNullValue()));
+
+            // if a proxy collection, then force it to initialize.  just 'touching' the object is sufficient.
+            // REVIEW: I wonder if this is actually needed; does JDO use proxy collections?
+            referencedCollection.hashCode();
+        }
+
+        // the JPA impl used to also call its lifecycle listener on the referenced collection object, eg List,
+        // itself.  I don't think this makes sense to do for JDO (the collection is not a PersistenceCapable).
+    }
+
+    
+    // ///////////////////////////////////////////////////////////////////////
+    // getInstances, hasInstances
+    // ///////////////////////////////////////////////////////////////////////
+
+    public List<ObjectAdapter> loadInstancesAndAdapt(final PersistenceQuery persistenceQuery) {
+        ensureOpened();
+        ensureInTransaction();
+
+        final PersistenceQueryProcessor<? extends PersistenceQuery> processor = persistenceQueryProcessorByClass.get(persistenceQuery.getClass());
+        if (processor == null) {
+            throw new UnsupportedFindException(MessageFormat.format("Unsupported criteria type: {0}", persistenceQuery.getClass().getName()));
+        }
+        return processPersistenceQuery(processor, persistenceQuery);
+    }
+
+    @SuppressWarnings("unchecked")
+    private <Q extends PersistenceQuery> List<ObjectAdapter> processPersistenceQuery(final PersistenceQueryProcessor<Q> persistenceQueryProcessor, final PersistenceQuery persistenceQuery) {
+        return persistenceQueryProcessor.process((Q)persistenceQuery);
+    }
+
+    public boolean hasInstances(final ObjectSpecification specification) {
+        ensureOpened();
+        ensureInTransaction();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("hasInstances: class=" + specification.getFullIdentifier());
+        }
+
+        if (!specification.persistability().isPersistable()) {
+            LOG.warn("hasInstances: trying to run for non-persistent class " + specification);
+            return false;
+        }
+
+        final Query query = QueryUtil.createQuery(getPersistenceManager(), "o", "select o.id", specification, null);
+        throw new NotYetImplementedException();
+        //query.set.setMaxResults(1);
+        //return !query.getResultList().isEmpty();
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Helpers (loadObjects)
+    // ///////////////////////////////////////////////////////////////////////
+
+    @SuppressWarnings("unused")
+    private List<ObjectAdapter> loadObjects(final ObjectSpecification specification, final List<?> listOfPojs, final AdapterManagerSpi adapterManager) {
+        final List<ObjectAdapter> adapters = Lists.newArrayList();
+        int i = 0;
+        for (final Object pojo : listOfPojs) {
+            // REVIEW: cannot just load adapter for object - if Naked Objects
+            // has
+            // already loaded the object
+            // then object won't match it (e.g. if getInstances has been called
+            // and an instance has
+            // been loaded) - so need to use Hibernate session to get an Oid to
+            // do a lookup in that case
+            adapters.add(adapterManager.getAdapterFor(pojo));
+        }
+        return adapters;
+    }
+
+    
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Services
+    // ///////////////////////////////////////////////////////////////////////
+
+    @Override
+    public void registerService(RootOid rootOid) {
+        ensureOpened();
+        this.registeredServices.put(rootOid.getObjectSpecId(), rootOid);
+    }
+
+    @Override
+    public RootOid getOidForService(ObjectSpecification serviceSpec) {
+        ensureOpened();
+        return this.registeredServices.get(serviceSpec.getSpecId());
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Helpers: ensure*
+    // ///////////////////////////////////////////////////////////////////////
+
+    private void ensureNotYetOpen() {
+        ensureStateIs(State.NOT_YET_OPEN);
+    }
+
+    private void ensureOpened() {
+        ensureStateIs(State.OPEN);
+    }
+
+    private void ensureInSession() {
+        ensureThatContext(IsisContext.inSession(), is(true));
+    }
+
+    private void ensureNotInTransaction() {
+        ensureInSession();
+        ensureThatContext(IsisContext.inTransaction(), is(false));
+    }
+
+    private void ensureInTransaction() {
+        if (transactionMode == TransactionMode.UNCHAINED) {
+            ensureThatContext(IsisContext.inTransaction(), is(true));
+            ensureInHibernateTransaction();
+        } else {
+            ensureInSession();
+            if (IsisContext.inTransaction()) {
+                ensureInHibernateTransaction();
+            } else {
+                getTransactionManager().startTransaction();
+            }
+        }
+    }
+
+    private void ensureInHibernateTransaction() {
+        javax.jdo.Transaction currentTransaction = getPersistenceManager().currentTransaction();
+        ensureThatState(currentTransaction, is(notNullValue()));
+        ensureThatState(currentTransaction.isActive(), is(true));
+    }
+
+    private void ensureStateIs(final State stateRequired) {
+        if (state == stateRequired) {
+            return;
+        }
+        throw new IllegalStateException("State is: " + state + "; should be: " + stateRequired);
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Debugging
+    // ///////////////////////////////////////////////////////////////////////
+
+    public void debugData(final DebugBuilder debug) {
+        throw new NotYetImplementedException();
+    }
+
+    public String debugTitle() {
+        throw new NotYetImplementedException();
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // non-API
+    // ///////////////////////////////////////////////////////////////////////
+
+    public JdoNamedQuery getNamedQuery(String queryName) {
+        return applicationComponents.getNamedQuery(queryName);
+    }
+
+    /**
+     * For testing purposes, to allow fixtures to use JDO to initialize the
+     * database without triggering the objectstore.
+     * 
+     * @see #resumeListener()
+     */
+    public void suspendListener() {
+        applicationComponents.suspendListener();
+    }
+
+    /**
+     * For testing purposes, to allow fixtures to use JDO to initialize the
+     * database without triggering the objectstore.
+     * 
+     * @see #suspendListener()
+     */
+    public void resumeListener() {
+        applicationComponents.resumeListener();
+    }
+
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Helpers
+    // ///////////////////////////////////////////////////////////////////////
+
+    private Class<?> clsOf(final TypedOid oid) {
+        final ObjectSpecification objectSpec = getSpecificationLoader().lookupBySpecId(oid.getObjectSpecId());
+        return objectSpec.getCorrespondingClass();
+    }
+
+    /**
+     * Intended for internal and test use only.
+     */
+    public PersistenceManager getPersistenceManager() {
+        return persistenceManager;
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Dependencies (from constructor)
+    // ///////////////////////////////////////////////////////////////////////
+
+    public ObjectAdapterFactory getAdapterFactory() {
+        return adapterFactory;
+    }
+
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Dependencies (from context)
+    // ///////////////////////////////////////////////////////////////////////
+
+    public IsisConfiguration getConfiguration() {
+        return IsisContext.getConfiguration();
+    }
+
+    protected SpecificationLoaderSpi getSpecificationLoader() {
+        return IsisContext.getSpecificationLoader();
+    }
+
+    protected PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+    protected AdapterManager getAdapterManager() {
+        return getPersistenceSession().getAdapterManager();
+    }
+    
+    protected IsisTransactionManager getTransactionManager() {
+        return IsisContext.getTransactionManager();
+    }
+
+    protected OidMarshaller getOidMarshaller() {
+        return IsisContext.getOidMarshaller();
+    }
+
+
+}


Mime
View raw message