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 2012/12/06 11:10:35 UTC

[28/51] [partial] ISIS-188: moving modules into core

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-cglib/pom.xml
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-cglib/pom.xml b/framework/core/bytecode-cglib/pom.xml
new file mode 100644
index 0000000..e0df187
--- /dev/null
+++ b/framework/core/bytecode-cglib/pom.xml
@@ -0,0 +1,94 @@
+<?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</groupId>
+		<artifactId>core</artifactId>
+		<version>0.3.1-SNAPSHOT</version>
+	</parent>
+
+	<groupId>org.apache.isis.runtimes.dflt.bytecode</groupId>
+	<artifactId>dflt</artifactId>
+	<name>Default Runtime Default Bytecode (CgLib)</name>
+
+	<properties>
+        <siteBaseDir>..</siteBaseDir>
+		<relativeUrl>bytecode-cglib/</relativeUrl>
+	</properties>
+
+    <!-- used in Site generation for relative references. -->
+    <url>http://incubator.apache.org/isis/${relativeUrl}</url>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+				<version>${maven-project-info-reports-plugin}</version>
+                <inherited>false</inherited>
+                <configuration>
+                	<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+                </configuration>
+                <reportSets>
+                    <reportSet>
+                        <inherited>false</inherited>
+                        <reports>
+                            <report>dependencies</report>
+                            <report>dependency-convergence</report>
+                            <report>plugins</report>
+                            <report>summary</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+
+	<dependencies>
+		<dependency>
+		    <groupId>org.apache.isis.runtimes.dflt</groupId>
+		    <artifactId>runtime</artifactId>
+		</dependency>
+		<dependency>
+		    <groupId>org.apache.isis.runtimes.dflt</groupId>
+		    <artifactId>runtime</artifactId>
+		    <type>test-jar</type>
+		    <scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>asm</groupId>
+			<artifactId>asm</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.objenesis</groupId>
+			<artifactId>objenesis</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>cglib</groupId>
+			<artifactId>cglib-nodep</artifactId>
+		</dependency>
+	</dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-cglib/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/classsubstitutor/CglibClassSubstitutor.java
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-cglib/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/classsubstitutor/CglibClassSubstitutor.java b/framework/core/bytecode-cglib/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/classsubstitutor/CglibClassSubstitutor.java
new file mode 100644
index 0000000..71e2750
--- /dev/null
+++ b/framework/core/bytecode-cglib/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/classsubstitutor/CglibClassSubstitutor.java
@@ -0,0 +1,47 @@
+/*
+ *  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.bytecode.dflt.classsubstitutor;
+
+import org.apache.isis.core.commons.lang.JavaClassUtils;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.CglibEnhanced;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutorAbstract;
+
+public class CglibClassSubstitutor extends ClassSubstitutorAbstract {
+
+    public CglibClassSubstitutor() {
+        ignore(net.sf.cglib.proxy.Factory.class);
+        ignore(net.sf.cglib.proxy.MethodProxy.class);
+        ignore(net.sf.cglib.proxy.Callback.class);
+    }
+
+    /**
+     * If {@link CglibEnhanced} then return superclass, else as per
+     * {@link ClassSubstitutorAbstract#getClass(Class) superclass'}
+     * implementation.
+     */
+    @Override
+    public Class<?> getClass(final Class<?> cls) {
+        if (JavaClassUtils.directlyImplements(cls, CglibEnhanced.class)) {
+            return getClass(cls.getSuperclass());
+        }
+        return super.getClass(cls);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-cglib/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/CglibObjectFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-cglib/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/CglibObjectFactory.java b/framework/core/bytecode-cglib/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/CglibObjectFactory.java
new file mode 100644
index 0000000..59865eb
--- /dev/null
+++ b/framework/core/bytecode-cglib/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/CglibObjectFactory.java
@@ -0,0 +1,69 @@
+/*
+ *  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.bytecode.dflt.objectfactory;
+
+import org.apache.isis.core.metamodel.spec.ObjectInstantiationException;
+import org.apache.isis.runtimes.dflt.bytecode.dflt.objectfactory.internal.ObjectResolveAndObjectChangedEnhancer;
+import org.apache.isis.runtimes.dflt.runtime.persistence.container.DomainObjectContainerObjectChanged;
+import org.apache.isis.runtimes.dflt.runtime.persistence.container.DomainObjectContainerResolve;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectChanger;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectFactoryAbstract;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectResolver;
+
+public class CglibObjectFactory extends ObjectFactoryAbstract {
+
+    private ObjectResolveAndObjectChangedEnhancer classEnhancer;
+    private DomainObjectContainerResolve resolver;
+    private DomainObjectContainerObjectChanged changer;
+
+    public CglibObjectFactory() {
+    }
+
+    @Override
+    public void open() {
+        super.open();
+        changer = new DomainObjectContainerObjectChanged();
+        resolver = new DomainObjectContainerResolve();
+
+        final ObjectResolver objectResolver = new ObjectResolver() {
+            @Override
+            public void resolve(final Object domainObject, final String propertyName) {
+                // TODO: could do better than this by maintaining a map of
+                // resolved
+                // properties on the ObjectAdapter adapter.
+                resolver.resolve(domainObject);
+            }
+        };
+        final ObjectChanger objectChanger = new ObjectChanger() {
+            @Override
+            public void objectChanged(final Object domainObject) {
+                changer.objectChanged(domainObject);
+            }
+        };
+
+        classEnhancer = new ObjectResolveAndObjectChangedEnhancer(objectResolver, objectChanger, getSpecificationLoader());
+    }
+
+    @Override
+    public <T> T doInstantiate(final Class<T> cls) throws ObjectInstantiationException {
+        return classEnhancer.newInstance(cls);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-cglib/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/internal/ObjectResolveAndObjectChangedEnhancer.java
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-cglib/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/internal/ObjectResolveAndObjectChangedEnhancer.java b/framework/core/bytecode-cglib/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/internal/ObjectResolveAndObjectChangedEnhancer.java
new file mode 100644
index 0000000..e9c8f36
--- /dev/null
+++ b/framework/core/bytecode-cglib/src/main/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/internal/ObjectResolveAndObjectChangedEnhancer.java
@@ -0,0 +1,108 @@
+/*
+ *  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.bytecode.dflt.objectfactory.internal;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import net.sf.cglib.proxy.Callback;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+
+import org.apache.isis.core.commons.lang.ArrayUtils;
+import org.apache.isis.core.metamodel.facets.ImperativeFacetUtils;
+import org.apache.isis.core.metamodel.facets.ImperativeFacetUtils.ImperativeFacetFlags;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.CglibEnhanced;
+import org.apache.isis.core.metamodel.specloader.specimpl.dflt.ObjectSpecificationDefault;
+import org.apache.isis.runtimes.dflt.runtime.bytecode.ObjectResolveAndObjectChangedEnhancerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectChanger;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectResolver;
+
+public class ObjectResolveAndObjectChangedEnhancer extends ObjectResolveAndObjectChangedEnhancerAbstract {
+
+    private Callback callback;
+
+    /**
+     * Cache of Enhancers, lazy populated.
+     */
+    private final Map<Class<?>, Enhancer> enhancerByClass = new HashMap<Class<?>, Enhancer>();
+
+    public ObjectResolveAndObjectChangedEnhancer(final ObjectResolver objectResolver, final ObjectChanger objectChanger, final SpecificationLoaderSpi specificationLoader) {
+        super(objectResolver, objectChanger, specificationLoader);
+
+        createCallback();
+    }
+
+    @Override
+    protected void createCallback() {
+        this.callback = new MethodInterceptor() {
+
+            @Override
+            public Object intercept(final Object proxied, final Method proxiedMethod, final Object[] args, final MethodProxy proxyMethod) throws Throwable {
+
+                final boolean ignore = proxiedMethod.getDeclaringClass().equals(Object.class);
+                ImperativeFacetFlags flags = null;
+
+                if (!ignore) {
+                    final ObjectSpecificationDefault targetObjSpec = getJavaSpecificationOfOwningClass(proxiedMethod);
+                    final ObjectMember member = targetObjSpec.getMember(proxiedMethod);
+
+                    flags = ImperativeFacetUtils.getImperativeFacetFlags(member, proxiedMethod);
+
+                    if (flags.impliesResolve()) {
+                        objectResolver.resolve(proxied, member.getName());
+                    }
+                }
+
+                final Object proxiedReturn = proxyMethod.invokeSuper(proxied, args);
+
+                if (!ignore && flags.impliesObjectChanged()) {
+                    objectChanger.objectChanged(proxied);
+                }
+
+                return proxiedReturn;
+            }
+
+        };
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T> T newInstance(final Class<T> cls) {
+        final Enhancer enhancer = lookupOrCreateEnhancerFor(cls);
+        return (T) enhancer.create();
+    }
+
+    private Enhancer lookupOrCreateEnhancerFor(final Class<?> cls) {
+        Enhancer enhancer = enhancerByClass.get(cls);
+        if (enhancer == null) {
+            enhancer = new Enhancer();
+            enhancer.setSuperclass(cls);
+            enhancer.setInterfaces(ArrayUtils.combine(cls.getInterfaces(), new Class<?>[] { CglibEnhanced.class }));
+            enhancer.setCallback(callback);
+            enhancerByClass.put(cls, enhancer);
+        }
+        return enhancer;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-cglib/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-cglib/src/site/apt/index.apt b/framework/core/bytecode-cglib/src/site/apt/index.apt
new file mode 100644
index 0000000..4c8932f
--- /dev/null
+++ b/framework/core/bytecode-cglib/src/site/apt/index.apt
@@ -0,0 +1,38 @@
+~~  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.
+
+
+
+Default (CGLib) Bytecode Support
+ 
+ The <dflt> (default) bytecode support module enables transparent lazy 
+ loading and object dirtying support.
+ 
+Alternatives
+
+ * {{{../javassist/index.html}Javassist}}
+ 
+   The Javassist implementation provides the same capabilities as the CGLib implementation,
+   but using the {{{http://http://www.jboss.org/javassist}Javassist}} library.
+
+ * {{{../identity/index.html}Identity}}
+  
+   Some object stores do not need the use of this
+   bytecode module, because they hook into the lazy loading of the underlying ORM.  For these, you should
+   use the identity (no-op) implementation.
+
+ []

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-cglib/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-cglib/src/site/apt/jottings.apt b/framework/core/bytecode-cglib/src/site/apt/jottings.apt
new file mode 100644
index 0000000..c5d1200
--- /dev/null
+++ b/framework/core/bytecode-cglib/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/dbb64345/framework/core/bytecode-cglib/src/site/site.xml
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-cglib/src/site/site.xml b/framework/core/bytecode-cglib/src/site/site.xml
new file mode 100644
index 0000000..aeb0930
--- /dev/null
+++ b/framework/core/bytecode-cglib/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>
+
+	<body>
+		<breadcrumbs>
+			<item name="Default" href="index.html" />
+		</breadcrumbs>
+
+		<menu name="Default Bytecode">
+			<item name="About" href="index.html" />
+            <item name="Jottings" href="jottings.html" />
+		</menu>
+
+        <menu name="Bytecode Modules">
+            <item name="Default (cglib)" href="../dflt/index.html" />
+            <item name="Javassist" href="../javassist/index.html" />
+            <item name="Identity" href="../identity/index.html" />
+        </menu>
+
+		<menu name="Maven Reports" ref="reports"/>
+	</body>
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-cglib/src/test/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/internal/ClassEnhancerTest.java
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-cglib/src/test/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/internal/ClassEnhancerTest.java b/framework/core/bytecode-cglib/src/test/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/internal/ClassEnhancerTest.java
new file mode 100644
index 0000000..ad376a7
--- /dev/null
+++ b/framework/core/bytecode-cglib/src/test/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/internal/ClassEnhancerTest.java
@@ -0,0 +1,121 @@
+/*
+ *  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.bytecode.dflt.objectfactory.internal;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.Sequence;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectChanger;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectResolver;
+
+@RunWith(JMock.class)
+public class ClassEnhancerTest {
+
+    private final Mockery mockery = new JUnit4Mockery();
+
+    private ObjectResolveAndObjectChangedEnhancer classEnhancer;
+    private ObjectResolver mockObjectResolver;
+    private ObjectChanger mockObjectChanger;
+    private SpecificationLoaderSpi mockSpecificationLoader;
+
+    private SomeDomainObject sdo;
+
+    @Before
+    public void setUp() {
+        mockObjectResolver = mockery.mock(ObjectResolver.class);
+        mockObjectChanger = mockery.mock(ObjectChanger.class);
+        mockSpecificationLoader = mockery.mock(SpecificationLoaderSpi.class);
+
+        classEnhancer = new ObjectResolveAndObjectChangedEnhancer(mockObjectResolver, mockObjectChanger, mockSpecificationLoader);
+
+        sdo = classEnhancer.newInstance(SomeDomainObject.class);
+    }
+
+    @After
+    public void tearDown() {
+        classEnhancer = null;
+    }
+
+    @Test
+    public void canCreateNewInstance() throws Exception {
+        assertThat(sdo, is(not(nullValue())));
+    }
+
+    @Ignore("TO COMPLETE")
+    @Test
+    public void passesThrough() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                ignoring(mockObjectResolver);
+            }
+        });
+        sdo.setName("Fred");
+        assertThat(sdo.getName(), equalTo("Fred"));
+    }
+
+    @Ignore("TO COMPLETE")
+    @Test
+    public void callsResolveOnGetter() throws Exception {
+
+        mockery.checking(new Expectations() {
+            {
+                one(mockObjectResolver).resolve(sdo, "name");
+            }
+        });
+
+        sdo.getName();
+    }
+
+    @Ignore("TO COMPLETE")
+    @Test
+    public void callsResolveOnSetterAndThenObjectChanged() throws Exception {
+
+        mockery.checking(new Expectations() {
+            {
+                final Sequence sequence = mockery.sequence("set");
+
+                one(mockObjectResolver).resolve(sdo, "name");
+                inSequence(sequence);
+
+                one(mockObjectChanger).objectChanged(sdo);
+                inSequence(sequence);
+
+            }
+        });
+
+        sdo.setName("Joe");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-cglib/src/test/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/internal/SomeDomainObject.java
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-cglib/src/test/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/internal/SomeDomainObject.java b/framework/core/bytecode-cglib/src/test/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/internal/SomeDomainObject.java
new file mode 100644
index 0000000..0d48518
--- /dev/null
+++ b/framework/core/bytecode-cglib/src/test/java/org/apache/isis/runtimes/dflt/bytecode/dflt/objectfactory/internal/SomeDomainObject.java
@@ -0,0 +1,34 @@
+/*
+ *  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.bytecode.dflt.objectfactory.internal;
+
+public class SomeDomainObject {
+
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-javassist/NOTICE
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-javassist/NOTICE b/framework/core/bytecode-javassist/NOTICE
new file mode 100644
index 0000000..d391f54
--- /dev/null
+++ b/framework/core/bytecode-javassist/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/dbb64345/framework/core/bytecode-javassist/pom.xml
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-javassist/pom.xml b/framework/core/bytecode-javassist/pom.xml
new file mode 100644
index 0000000..9606b91
--- /dev/null
+++ b/framework/core/bytecode-javassist/pom.xml
@@ -0,0 +1,90 @@
+<?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</groupId>
+		<artifactId>core</artifactId>
+		<version>0.3.1-SNAPSHOT</version>
+	</parent>
+
+	<groupId>org.apache.isis.runtimes.dflt.bytecode</groupId>
+	<artifactId>javassist</artifactId>
+
+	<name>Default Runtime Javassist Bytecode Implementation</name>
+
+	<properties>
+        <siteBaseDir>..</siteBaseDir>
+		<relativeUrl>bytecode-javassist/</relativeUrl>
+	</properties>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/isis/trunk/runtimes/dflt/bytecode/javassist/</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/isis/trunk$/{relativeUrl}</developerConnection>
+        <url>http://svn.apache.org/repos/asf/incubator/isis/trunk/runtimes/dflt/bytecode/javassist/</url>
+    </scm>
+
+    <!-- used in Site generation for relative references. -->
+    <url>http://incubator.apache.org/isis/${relativeUrl}</url>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+				<version>${maven-project-info-reports-plugin}</version>
+                <inherited>false</inherited>
+                <configuration>
+                	<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+                </configuration>
+                <reportSets>
+                    <reportSet>
+                        <inherited>false</inherited>
+                        <reports>
+                            <report>dependencies</report>
+                            <report>dependency-convergence</report>
+                            <report>plugins</report>
+                            <report>summary</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+
+	<dependencies>
+		<dependency>
+		    <groupId>org.apache.isis.runtimes.dflt</groupId>
+		    <artifactId>runtime</artifactId>
+		</dependency>
+		<dependency>
+		    <groupId>org.apache.isis.runtimes.dflt</groupId>
+		    <artifactId>runtime</artifactId>
+		    <type>test-jar</type>
+		    <scope>test</scope>
+		</dependency>
+
+        <dependency>
+            <groupId>javassist</groupId>
+            <artifactId>javassist</artifactId>
+        </dependency>
+	</dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/classsubstitutor/JavassistClassSubstitutor.java
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/classsubstitutor/JavassistClassSubstitutor.java b/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/classsubstitutor/JavassistClassSubstitutor.java
new file mode 100644
index 0000000..583ef6d
--- /dev/null
+++ b/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/classsubstitutor/JavassistClassSubstitutor.java
@@ -0,0 +1,46 @@
+/*
+ *  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.bytecode.javassist.classsubstitutor;
+
+import org.apache.isis.core.commons.lang.JavaClassUtils;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutorAbstract;
+import org.apache.isis.runtimes.dflt.bytecode.javassist.objectfactory.internal.JavassistEnhanced;
+
+public class JavassistClassSubstitutor extends ClassSubstitutorAbstract {
+
+    public JavassistClassSubstitutor() {
+        ignore(javassist.util.proxy.ProxyObject.class);
+        ignore(javassist.util.proxy.MethodHandler.class);
+    }
+
+    /**
+     * If {@link JavassistEnhanced} then return superclass, else as per
+     * {@link ClassSubstitutorAbstract#getClass(Class) superclass'}
+     * implementation.
+     */
+    @Override
+    public Class<?> getClass(final Class<?> cls) {
+        if (JavaClassUtils.directlyImplements(cls, JavassistEnhanced.class)) {
+            return getClass(cls.getSuperclass());
+        }
+        return super.getClass(cls);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/objectfactory/JavassistObjectFactory.java
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/objectfactory/JavassistObjectFactory.java b/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/objectfactory/JavassistObjectFactory.java
new file mode 100644
index 0000000..6333282
--- /dev/null
+++ b/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/objectfactory/JavassistObjectFactory.java
@@ -0,0 +1,69 @@
+/*
+ *  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.bytecode.javassist.objectfactory;
+
+import org.apache.isis.core.metamodel.spec.ObjectInstantiationException;
+import org.apache.isis.runtimes.dflt.bytecode.javassist.objectfactory.internal.ObjectResolveAndObjectChangedEnhancer;
+import org.apache.isis.runtimes.dflt.runtime.persistence.container.DomainObjectContainerObjectChanged;
+import org.apache.isis.runtimes.dflt.runtime.persistence.container.DomainObjectContainerResolve;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectChanger;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectFactoryAbstract;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectResolver;
+
+public class JavassistObjectFactory extends ObjectFactoryAbstract {
+
+    private ObjectResolveAndObjectChangedEnhancer classEnhancer;
+    private DomainObjectContainerResolve resolver;
+    private DomainObjectContainerObjectChanged changer;
+
+    public JavassistObjectFactory() {
+    }
+
+    @Override
+    public void open() {
+        super.open();
+        changer = new DomainObjectContainerObjectChanged();
+        resolver = new DomainObjectContainerResolve();
+
+        final ObjectResolver objectResolver = new ObjectResolver() {
+            @Override
+            public void resolve(final Object domainObject, final String propertyName) {
+                // TODO: could do better than this by maintaining a map of
+                // resolved
+                // properties on the ObjectAdapter adapter.
+                resolver.resolve(domainObject);
+            }
+        };
+        final ObjectChanger objectChanger = new ObjectChanger() {
+            @Override
+            public void objectChanged(final Object domainObject) {
+                changer.objectChanged(domainObject);
+            }
+        };
+
+        classEnhancer = new ObjectResolveAndObjectChangedEnhancer(objectResolver, objectChanger, getSpecificationLoader());
+    }
+
+    @Override
+    public <T> T doInstantiate(final Class<T> cls) throws ObjectInstantiationException {
+        return classEnhancer.newInstance(cls);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/objectfactory/internal/JavassistEnhanced.java
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/objectfactory/internal/JavassistEnhanced.java b/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/objectfactory/internal/JavassistEnhanced.java
new file mode 100644
index 0000000..96a56ad
--- /dev/null
+++ b/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/objectfactory/internal/JavassistEnhanced.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.runtimes.dflt.bytecode.javassist.objectfactory.internal;
+
+import org.apache.isis.runtimes.dflt.bytecode.javassist.classsubstitutor.JavassistClassSubstitutor;
+
+/**
+ * Marker interface that we make entities implement so easy to spot in the
+ * {@link JavassistClassSubstitutor}.
+ */
+public interface JavassistEnhanced {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/objectfactory/internal/ObjectResolveAndObjectChangedEnhancer.java
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/objectfactory/internal/ObjectResolveAndObjectChangedEnhancer.java b/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/objectfactory/internal/ObjectResolveAndObjectChangedEnhancer.java
new file mode 100644
index 0000000..4994463
--- /dev/null
+++ b/framework/core/bytecode-javassist/src/main/java/org/apache/isis/runtimes/dflt/bytecode/javassist/objectfactory/internal/ObjectResolveAndObjectChangedEnhancer.java
@@ -0,0 +1,113 @@
+/*
+ *  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.bytecode.javassist.objectfactory.internal;
+
+import java.lang.reflect.Method;
+
+import javassist.util.proxy.MethodFilter;
+import javassist.util.proxy.MethodHandler;
+import javassist.util.proxy.ProxyFactory;
+import javassist.util.proxy.ProxyObject;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+import org.apache.isis.core.commons.lang.ArrayUtils;
+import org.apache.isis.core.metamodel.facets.ImperativeFacetUtils;
+import org.apache.isis.core.metamodel.facets.ImperativeFacetUtils.ImperativeFacetFlags;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
+import org.apache.isis.core.metamodel.specloader.specimpl.dflt.ObjectSpecificationDefault;
+import org.apache.isis.runtimes.dflt.runtime.bytecode.ObjectResolveAndObjectChangedEnhancerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectChanger;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectfactory.ObjectResolver;
+
+public class ObjectResolveAndObjectChangedEnhancer extends ObjectResolveAndObjectChangedEnhancerAbstract {
+
+    private MethodHandler methodHandler;
+
+    public ObjectResolveAndObjectChangedEnhancer(final ObjectResolver objectResolver, final ObjectChanger objectChanger, final SpecificationLoaderSpi specificationLoader) {
+        super(objectResolver, objectChanger, specificationLoader);
+
+        createCallback();
+    }
+
+    @Override
+    protected void createCallback() {
+        this.methodHandler = new MethodHandler() {
+            @Override
+            public Object invoke(final Object proxied, final Method proxyMethod, final Method proxiedMethod, final Object[] args) throws Throwable {
+
+                final boolean ignore = proxyMethod.getDeclaringClass().equals(Object.class);
+                ImperativeFacetFlags flags = null;
+
+                if (!ignore) {
+                    final ObjectSpecificationDefault targetObjSpec = getJavaSpecificationOfOwningClass(proxiedMethod);
+
+                    final ObjectMember member = targetObjSpec.getMember(proxiedMethod);
+                    flags = ImperativeFacetUtils.getImperativeFacetFlags(member, proxiedMethod);
+
+                    if (flags.impliesResolve()) {
+                        objectResolver.resolve(proxied, member.getName());
+                    }
+                }
+
+                final Object proxiedReturn = proxiedMethod.invoke(proxied, args); // execute
+                                                                                  // the
+                                                                                  // original
+                                                                                  // method.
+
+                if (!ignore && flags.impliesObjectChanged()) {
+                    objectChanger.objectChanged(proxied);
+                }
+
+                return proxiedReturn;
+            }
+        };
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T> T newInstance(final Class<T> cls) {
+
+        final ProxyFactory proxyFactory = new ProxyFactory();
+        proxyFactory.setSuperclass(cls);
+        proxyFactory.setInterfaces(ArrayUtils.combine(cls.getInterfaces(), new Class<?>[] { JavassistEnhanced.class }));
+
+        proxyFactory.setFilter(new MethodFilter() {
+            @Override
+            public boolean isHandled(final Method m) {
+                // ignore finalize()
+                return !m.getName().equals("finalize");
+            }
+        });
+
+        final Class<T> proxySubclass = proxyFactory.createClass();
+        try {
+            final T newInstance = proxySubclass.newInstance();
+            final ProxyObject proxyObject = (ProxyObject) newInstance;
+            proxyObject.setHandler(methodHandler);
+
+            return newInstance;
+        } catch (final InstantiationException e) {
+            throw new IsisException(e);
+        } catch (final IllegalAccessException e) {
+            throw new IsisException(e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-javassist/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-javassist/src/site/apt/index.apt b/framework/core/bytecode-javassist/src/site/apt/index.apt
new file mode 100644
index 0000000..d2b37e6
--- /dev/null
+++ b/framework/core/bytecode-javassist/src/site/apt/index.apt
@@ -0,0 +1,38 @@
+~~  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.
+
+
+
+Javassist Bytecode Support
+ 
+ The <javassist> bytecode module enables transparent lazy loading and object dirtying 
+ support, using the {{{http://www.jboss.org/javassist}Javassist}} library.
+ 
+
+Alternatives
+
+ * {{{../dflt/index.html}CGLib}}
+
+   The <dflt> implementation is similar to the javassist implementation, but uses the
+   {{{../../bytecode/dflt/index.html}CGLib}} library.
+
+ 
+ * {{{../identity/index.html}Identity}}
+  
+   Some object stores do not need the use of this
+   bytecode module, because they hook into the lazy loading of the underlying ORM.  For these, you should
+   use the <identity> (no-op) implementation.

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/bytecode-javassist/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-javassist/src/site/apt/jottings.apt b/framework/core/bytecode-javassist/src/site/apt/jottings.apt
new file mode 100644
index 0000000..c5d1200
--- /dev/null
+++ b/framework/core/bytecode-javassist/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/dbb64345/framework/core/bytecode-javassist/src/site/site.xml
----------------------------------------------------------------------
diff --git a/framework/core/bytecode-javassist/src/site/site.xml b/framework/core/bytecode-javassist/src/site/site.xml
new file mode 100644
index 0000000..58d58bd
--- /dev/null
+++ b/framework/core/bytecode-javassist/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>
+
+	<body>
+		<breadcrumbs>
+			<item name="Javassist Bytecode" href="index.html" />
+		</breadcrumbs>
+
+		<menu name="Javassist ByteCode Support">
+			<item name="About" href="index.html" />
+            <item name="Jottings" href="jottings.html" />
+		</menu>
+
+        <menu name="Bytecode Modules">
+            <item name="Default (cglib)" href="../dflt/index.html" />
+            <item name="Javassist" href="../javassist/index.html" />
+            <item name="Identity" href="../identity/index.html" />
+        </menu>
+
+        <menu name="Maven Reports" ref="reports" />
+	</body>
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/integtestsupport/NOTICE
----------------------------------------------------------------------
diff --git a/framework/core/integtestsupport/NOTICE b/framework/core/integtestsupport/NOTICE
new file mode 100644
index 0000000..d391f54
--- /dev/null
+++ b/framework/core/integtestsupport/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/dbb64345/framework/core/integtestsupport/pom.xml
----------------------------------------------------------------------
diff --git a/framework/core/integtestsupport/pom.xml b/framework/core/integtestsupport/pom.xml
new file mode 100644
index 0000000..9428929
--- /dev/null
+++ b/framework/core/integtestsupport/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</groupId>
+		<artifactId>core</artifactId>
+		<version>0.3.1-SNAPSHOT</version>
+	</parent>
+
+	<groupId>org.apache.isis.runtimes.dflt</groupId>
+	<artifactId>isis-integtestsupport</artifactId>
+	<name>Default Runtime Test Support</name>
+
+	<properties>
+        <siteBaseDir>..</siteBaseDir>
+		<relativeUrl>integtestsupport/</relativeUrl>
+    </properties>
+
+    <!-- used in Site generation for relative references. -->
+    <url>http://incubator.apache.org/isis/${relativeUrl}</url>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+				<version>${maven-project-info-reports-plugin}</version>
+                <inherited>false</inherited>
+                <configuration>
+                	<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+                </configuration>
+                <reportSets>
+                    <reportSet>
+                        <inherited>false</inherited>
+                        <reports>
+                            <report>dependencies</report>
+                            <report>dependency-convergence</report>
+                            <report>plugins</report>
+                            <report>summary</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+
+	<dependencies>
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-unittestsupport</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.runtimes.dflt.bytecode</groupId>
+            <artifactId>dflt</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jmock</groupId>
+            <artifactId>jmock</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jmock</groupId>
+            <artifactId>jmock-junit4</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jmock</groupId>
+            <artifactId>jmock-legacy</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.tck</groupId>
+            <artifactId>tck-dom</artifactId>
+            <version>0.3.1-SNAPSHOT</version>
+        </dependency>
+	
+        <dependency>
+            <groupId>org.apache.isis.security</groupId>
+            <artifactId>dflt</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.runtimes.dflt.objectstores</groupId>
+            <artifactId>dflt</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.runtimes.dflt.profilestores</groupId>
+            <artifactId>dflt</artifactId>
+        </dependency>
+
+<!-- 
+        <dependency>
+            <groupId>org.apache.isis.runtimes.dflt.bytecode</groupId>
+            <artifactId>dflt</artifactId>
+        </dependency>
+-->
+
+		<dependency>
+			<groupId>org.apache.isis.runtimes.dflt</groupId>
+			<artifactId>runtime</artifactId>
+		</dependency>
+
+
+	</dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/integtestsupport/src/main/java/org/apache/isis/runtimes/dflt/testsupport/IsisSystemDefault.java
----------------------------------------------------------------------
diff --git a/framework/core/integtestsupport/src/main/java/org/apache/isis/runtimes/dflt/testsupport/IsisSystemDefault.java b/framework/core/integtestsupport/src/main/java/org/apache/isis/runtimes/dflt/testsupport/IsisSystemDefault.java
new file mode 100644
index 0000000..f357377
--- /dev/null
+++ b/framework/core/integtestsupport/src/main/java/org/apache/isis/runtimes/dflt/testsupport/IsisSystemDefault.java
@@ -0,0 +1,227 @@
+/*
+ *  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.testsupport;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationDefault;
+import org.apache.isis.core.commons.resource.ResourceStreamSourceContextLoaderClassPath;
+import org.apache.isis.core.metamodel.facetapi.ClassSubstitutorFactory;
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
+import org.apache.isis.core.metamodel.facetdecorator.FacetDecorator;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistry;
+import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistryDefault;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
+import org.apache.isis.core.progmodel.metamodelvalidator.dflt.MetaModelValidatorDefault;
+import org.apache.isis.core.runtime.authentication.AuthenticationManager;
+import org.apache.isis.core.runtime.authentication.standard.AuthenticationManagerStandard;
+import org.apache.isis.core.runtime.authentication.standard.Authenticator;
+import org.apache.isis.core.runtime.authorization.AuthorizationManager;
+import org.apache.isis.core.runtime.authorization.standard.AuthorizationManagerStandard;
+import org.apache.isis.core.runtime.userprofile.UserProfileStore;
+import org.apache.isis.progmodels.dflt.JavaReflectorHelper;
+import org.apache.isis.progmodels.dflt.ProgrammingModelFacetsJava5;
+import org.apache.isis.runtimes.dflt.objectstores.dflt.InMemoryPersistenceMechanismInstaller;
+import org.apache.isis.runtimes.dflt.profilestores.dflt.InMemoryUserProfileStore;
+import org.apache.isis.runtimes.dflt.runtime.fixtures.FixturesInstaller;
+import org.apache.isis.runtimes.dflt.runtime.fixtures.FixturesInstallerFromConfiguration;
+import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
+import org.apache.isis.runtimes.dflt.runtime.services.ServicesInstallerFromConfiguration;
+import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
+import org.apache.isis.runtimes.dflt.runtime.system.IsisSystemException;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionFactory;
+import org.apache.isis.runtimes.dflt.runtime.systemusinginstallers.IsisSystemAbstract;
+import org.apache.isis.runtimes.dflt.runtime.transaction.facetdecorator.standard.StandardTransactionFacetDecorator;
+import org.apache.isis.security.dflt.authentication.AuthenticatorDefault;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+public class IsisSystemDefault extends IsisSystemAbstract {
+
+    private final IsisConfigurationDefault configuration;
+    private final List<Object> servicesIfAny;
+
+    public IsisSystemDefault(Object... servicesIfAny) {
+        this(DeploymentType.SERVER, servicesIfAny);
+    }
+
+    public IsisSystemDefault(List<Object> services) {
+        this(DeploymentType.SERVER, services);
+    }
+
+    public IsisSystemDefault(DeploymentType deploymentType, Object... servicesIfAny) {
+        this(deploymentType, asList(servicesIfAny));
+    }
+
+    public IsisSystemDefault(DeploymentType deploymentType, List<Object> services) {
+        super(deploymentType);
+        this.configuration = new IsisConfigurationDefault(ResourceStreamSourceContextLoaderClassPath.create("config"));
+        this.servicesIfAny = services;
+    }
+
+    private static List<Object> asList(Object... objects) {
+        return objects != null? Collections.unmodifiableList(Lists.newArrayList(objects)): null;
+    }
+
+    /**
+     * Reads <tt>isis.properties</tt> (and other optional property files) from the &quot;config&quot; package on the current classpath.
+     */
+    @Override
+    public IsisConfiguration getConfiguration() {
+        return configuration;
+    }
+
+
+    /**
+     * Either the services explicitly provided by a constructor, otherwise reads from the configuration.
+     */
+    @Override
+    protected List<Object> obtainServices() {
+        if(servicesIfAny != null) {
+            return servicesIfAny;
+        }
+        // else
+        final ServicesInstallerFromConfiguration servicesInstaller = new ServicesInstallerFromConfiguration();
+        return servicesInstaller.getServices(getDeploymentType());
+    }
+
+    /**
+     * Install fixtures from configuration.
+     */
+    @Override
+    protected FixturesInstaller obtainFixturesInstaller() throws IsisSystemException {
+        final FixturesInstallerFromConfiguration fixturesInstallerFromConfiguration = new FixturesInstallerFromConfiguration();
+        fixturesInstallerFromConfiguration.setConfiguration(getConfiguration());
+        return fixturesInstallerFromConfiguration;
+    }
+
+
+    /**
+     * Optional hook method, to create the reflector with defaults (Java5, with cglib, and only the transaction facet decorators)
+     * 
+     * <p>
+     * Each of the subcomponents can be overridden if required.
+     * 
+     * @see #obtainReflectorFacetDecoratorSet()
+     * @see #obtainReflectorMetaModelValidator()
+     * @see #obtainReflectorProgrammingModel()
+     */
+    @Override
+    protected SpecificationLoaderSpi obtainSpecificationLoaderSpi(DeploymentType deploymentType, ClassSubstitutorFactory classSubstitutorFactory, Collection<MetaModelRefiner> metaModelRefiners) throws IsisSystemException {
+        
+        final ProgrammingModel programmingModel = obtainReflectorProgrammingModel();
+        final Set<FacetDecorator> facetDecorators = obtainReflectorFacetDecoratorSet();
+        final MetaModelValidator mmv = obtainReflectorMetaModelValidator();
+        
+        return JavaReflectorHelper.createObjectReflector(programmingModel, classSubstitutorFactory, metaModelRefiners, facetDecorators, mmv, getConfiguration());
+    }
+
+ 
+    /**
+     * Optional hook method, called from {@link #obtainSpecificationLoaderSpi(DeploymentType, ClassSubstitutorFactory, MetaModelRefiner)}.
+     * @return
+     */
+    protected CollectionTypeRegistry obtainReflectorCollectionTypeRegistry() {
+        return new CollectionTypeRegistryDefault();
+    }
+
+
+    /**
+     * Optional hook method, called from {@link #obtainSpecificationLoaderSpi(DeploymentType, ClassSubstitutorFactory, MetaModelRefiner)}.
+     * @return
+     */
+    protected ProgrammingModel obtainReflectorProgrammingModel() {
+        return new ProgrammingModelFacetsJava5();
+    }
+
+    /**
+     * Optional hook method, called from {@link #obtainSpecificationLoaderSpi(DeploymentType, ClassSubstitutorFactory, MetaModelRefiner)}.
+     * @return
+     */
+    protected Set<FacetDecorator> obtainReflectorFacetDecoratorSet() {
+        return Sets.newHashSet((FacetDecorator)new StandardTransactionFacetDecorator(getConfiguration()));
+    }
+
+    /**
+     * Optional hook method, called from {@link #obtainSpecificationLoaderSpi(DeploymentType, ClassSubstitutorFactory, MetaModelRefiner)}.
+     * @return
+     */
+    protected MetaModelValidator obtainReflectorMetaModelValidator() {
+        return new MetaModelValidatorDefault();
+    }
+
+    /**
+     * The standard authentication manager, configured with the default authenticator (allows all requests through).
+     */
+    @Override
+    protected AuthenticationManager obtainAuthenticationManager(DeploymentType deploymentType) throws IsisSystemException {
+        final AuthenticationManagerStandard authenticationManager = new AuthenticationManagerStandard(getConfiguration());
+        Authenticator authenticator = new AuthenticatorDefault(configuration);
+        authenticationManager.addAuthenticator(authenticator);
+        return authenticationManager;
+    }
+
+    /**
+     * The standard authorization manager, allowing all access.
+     */
+    @Override
+    protected AuthorizationManager obtainAuthorizationManager(DeploymentType deploymentType) {
+        return new AuthorizationManagerStandard(getConfiguration());
+    }
+
+    /**
+     * The in-memory user profile store.
+     */
+    @Override
+    protected UserProfileStore obtainUserProfileStore() {
+        return new InMemoryUserProfileStore();
+    }
+
+    /**
+     * The in-memory object store (unless overridden by {@link #obtainPersistenceMechanismInstaller(IsisConfiguration)}).
+     */
+    @Override
+    protected PersistenceSessionFactory obtainPersistenceSessionFactory(DeploymentType deploymentType) throws IsisSystemException {
+        PersistenceMechanismInstaller installer = obtainPersistenceMechanismInstaller(getConfiguration());
+        if(installer == null) {
+            final InMemoryPersistenceMechanismInstaller inMemoryPersistenceMechanismInstaller = new InMemoryPersistenceMechanismInstaller();
+            inMemoryPersistenceMechanismInstaller.setConfiguration(getConfiguration());
+            installer = inMemoryPersistenceMechanismInstaller;
+        }
+        return installer.createPersistenceSessionFactory(deploymentType);
+    }
+
+
+    /**
+     * Optional hook; if returns <tt>null</tt> then the {@link #obtainPersistenceSessionFactory(DeploymentType)} is used.
+     */
+    protected PersistenceMechanismInstaller obtainPersistenceMechanismInstaller(IsisConfiguration configuration) throws IsisSystemException {
+        InMemoryPersistenceMechanismInstaller installer = new InMemoryPersistenceMechanismInstaller();
+        installer.setConfiguration(getConfiguration());
+        return installer;
+    }
+
+}