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 2014/07/28 15:28:50 UTC

[12/39] ISIS-833: reverting isis-module-wrapper -> isis-core-wrapper.

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/ProxyContextHandler.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/ProxyContextHandler.java b/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/ProxyContextHandler.java
deleted file mode 100644
index 5f942bc..0000000
--- a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/handlers/ProxyContextHandler.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.wrapper.handlers;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.apache.isis.applib.services.wrapper.WrapperFactory;
-import org.apache.isis.applib.services.wrapper.WrapperFactory.ExecutionMode;
-import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
-import org.apache.isis.core.commons.ensure.Ensure;
-import org.apache.isis.core.metamodel.adapter.ObjectPersistor;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.core.wrapper.proxy.ProxyInstantiator;
-
-public class ProxyContextHandler {
-
-    private final ProxyInstantiator proxyInstantiator;
-    
-    public ProxyContextHandler(final ProxyInstantiator proxyInstantiator) {
-        this.proxyInstantiator = proxyInstantiator;
-    }
-    
-    public <T> T proxy(final T domainObject, final WrapperFactory wrapperFactory, final ExecutionMode mode, final AuthenticationSessionProvider authenticationSessionProvider, final SpecificationLoader specificationLookup, final AdapterManager adapterManager, final ObjectPersistor objectPersistor) {
-
-        Ensure.ensureThatArg(wrapperFactory, is(not(nullValue())));
-        Ensure.ensureThatArg(authenticationSessionProvider, is(not(nullValue())));
-        Ensure.ensureThatArg(specificationLookup, is(not(nullValue())));
-        Ensure.ensureThatArg(adapterManager, is(not(nullValue())));
-        Ensure.ensureThatArg(objectPersistor, is(not(nullValue())));
-
-        final DomainObjectInvocationHandler<T> invocationHandler = new DomainObjectInvocationHandler<T>(domainObject, wrapperFactory, mode, authenticationSessionProvider, specificationLookup, adapterManager, objectPersistor, this);
-
-        return proxyInstantiator.instantiateProxy(invocationHandler);
-    }
-
-    /**
-     * Whether to execute or not will be picked up from the supplied parent
-     * handler.
-     */
-    public <T, E> Collection<E> proxy(final Collection<E> collectionToProxy, final String collectionName, final DomainObjectInvocationHandler<T> handler, final OneToManyAssociation otma) {
-
-        final CollectionInvocationHandler<T, Collection<E>> collectionInvocationHandler = new CollectionInvocationHandler<T, Collection<E>>(collectionToProxy, collectionName, handler, otma);
-        collectionInvocationHandler.setResolveObjectChangedEnabled(handler.isResolveObjectChangedEnabled());
-
-        return proxyInstantiator.instantiateProxy(collectionInvocationHandler);
-    }
-
-    /**
-     * Whether to execute or not will be picked up from the supplied parent
-     * handler.
-     */
-    public <T, P, Q> Map<P, Q> proxy(final Map<P, Q> collectionToProxy, final String collectionName, final DomainObjectInvocationHandler<T> handler, final OneToManyAssociation otma) {
-
-        final MapInvocationHandler<T, Map<P, Q>> mapInvocationHandler = new MapInvocationHandler<T, Map<P, Q>>(collectionToProxy, collectionName, handler, otma);
-        mapInvocationHandler.setResolveObjectChangedEnabled(handler.isResolveObjectChangedEnabled());
-
-        return proxyInstantiator.instantiateProxy(mapInvocationHandler);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/internal/util/Constants.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/internal/util/Constants.java b/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/internal/util/Constants.java
deleted file mode 100644
index 0021038..0000000
--- a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/internal/util/Constants.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.wrapper.internal.util;
-
-public final class Constants {
-    private Constants() {
-    }
-
-    public static final String PREFIX_CHOICES = "choices";
-    public static final String PREFIX_DEFAULT = "default";
-    public static final String PREFIX_HIDE = "hide";
-    public static final String PREFIX_DISABLE = "disable";
-    public static final String PREFIX_VALIDATE_REMOVE_FROM = "validateRemoveFrom";
-    public static final String PREFIX_VALIDATE_ADD_TO = "validateAddTo";
-    public static final String PREFIX_VALIDATE = "validate";
-    public static final String PREFIX_REMOVE_FROM = "removeFrom";
-    public static final String PREFIX_ADD_TO = "addTo";
-    public static final String PREFIX_MODIFY = "modify";
-    public static final String PREFIX_CLEAR = "clear";
-    public static final String PREFIX_SET = "set";
-    public static final String PREFIX_GET = "get";
-
-    public final static String TITLE_METHOD_NAME = "title";
-    public final static String TO_STRING_METHOD_NAME = "toString";
-
-    /**
-     * Cannot invoke methods with these prefixes.
-     */
-    public final static String[] INVALID_PREFIXES = { PREFIX_MODIFY, PREFIX_CLEAR, PREFIX_DISABLE, PREFIX_VALIDATE, PREFIX_VALIDATE_ADD_TO, PREFIX_VALIDATE_REMOVE_FROM, PREFIX_HIDE, };
-
-    public final static String[] PROPERTY_PREFIXES = { PREFIX_GET, PREFIX_SET, PREFIX_MODIFY, PREFIX_CLEAR, PREFIX_DISABLE, PREFIX_VALIDATE, PREFIX_HIDE, PREFIX_DEFAULT, PREFIX_CHOICES };
-    public final static String[] COLLECTION_PREFIXES = { PREFIX_GET, PREFIX_SET, PREFIX_ADD_TO, PREFIX_REMOVE_FROM, PREFIX_DISABLE, PREFIX_VALIDATE_ADD_TO, PREFIX_VALIDATE_REMOVE_FROM, PREFIX_HIDE, PREFIX_DEFAULT, PREFIX_CHOICES };
-    public final static String[] ACTION_PREFIXES = { PREFIX_VALIDATE, PREFIX_DISABLE, PREFIX_HIDE, PREFIX_DEFAULT, PREFIX_CHOICES, };
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/internal/util/MethodPrefixFinder.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/internal/util/MethodPrefixFinder.java b/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/internal/util/MethodPrefixFinder.java
deleted file mode 100644
index dd78056..0000000
--- a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/internal/util/MethodPrefixFinder.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.wrapper.internal.util;
-
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-
-public final class MethodPrefixFinder {
-
-    // a Linked Hash Set is used to ensure that the ordering is preserved.
-    public final static LinkedHashSet<String> ALL_PREFIXES = new LinkedHashSet<String>() {
-        private static final long serialVersionUID = 1L;
-        {
-            // collection prefixes are added first because we want to
-            // test validateAddTo and validateRemoveFrom before validate
-            addAll(Arrays.asList(Constants.COLLECTION_PREFIXES));
-            addAll(Arrays.asList(Constants.PROPERTY_PREFIXES));
-            addAll(Arrays.asList(Constants.ACTION_PREFIXES));
-        }
-    };
-
-    public String findPrefix(final String methodName) {
-        for (final String prefix : ALL_PREFIXES) {
-            if (methodName.startsWith(prefix)) {
-                return prefix;
-            }
-        }
-        return "";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/internal/util/Util.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/internal/util/Util.java b/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/internal/util/Util.java
deleted file mode 100644
index 7cfecbd..0000000
--- a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/internal/util/Util.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.wrapper.internal.util;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-
-import org.objenesis.ObjenesisHelper;
-
-public final class Util {
-
-    private Util(){}
-    
-    @SuppressWarnings("unchecked")
-    public static <T> T createInstance(final Class<T> toProxy, final InvocationHandler handler, final Class<?>... auxiliaryTypes) {
-        return (T) Proxy.newProxyInstance(toProxy.getClassLoader(), combine(toProxy, auxiliaryTypes) , handler);
-    }
- 
-    /**
-     * Return a new instance of the specified class. The recommended way is
-     * without calling any constructor. This is usually done by doing like
-     * <code>ObjectInputStream.readObject()</code> which is JVM specific.
-     */
-    @SuppressWarnings("unchecked")
-    public static <T> T createInstance(final Class<T> enhancedClass) {
-        return (T) ObjenesisHelper.newInstance(enhancedClass);
-    }
-    
-    private static Class<?>[] combine(Class<?> first, Class<?>... rest) {
-        Class<?>[] all = new Class<?>[rest.length+1];
-        all[0] = first;
-        System.arraycopy(rest, 0, all, 1, rest.length);
-        return all;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/proxy/ProxyInstantiator.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/proxy/ProxyInstantiator.java b/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/proxy/ProxyInstantiator.java
deleted file mode 100644
index 255cbfa..0000000
--- a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/proxy/ProxyInstantiator.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.wrapper.proxy;
-
-import org.apache.isis.core.wrapper.handlers.DelegatingInvocationHandler;
-
-public interface ProxyInstantiator {
-    public <T> T instantiateProxy(final DelegatingInvocationHandler<T> invocationHandler);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/proxy/ProxyInstantiatorForCglib.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/proxy/ProxyInstantiatorForCglib.java b/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/proxy/ProxyInstantiatorForCglib.java
deleted file mode 100644
index 65241e9..0000000
--- a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/proxy/ProxyInstantiatorForCglib.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.wrapper.proxy;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import net.sf.cglib.proxy.Callback;
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.Factory;
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.MethodProxy;
-
-import org.apache.isis.applib.services.wrapper.WrapperObject;
-import org.apache.isis.core.metamodel.specloader.classsubstitutor.CglibEnhanced;
-import org.apache.isis.core.wrapper.handlers.DelegatingInvocationHandler;
-import org.apache.isis.core.wrapper.internal.util.Util;
-
-public class ProxyInstantiatorForCglib implements ProxyInstantiator {
-
-    @SuppressWarnings("unchecked")
-    public <T> T instantiateProxy(final DelegatingInvocationHandler<T> handler) {
-
-        final T toProxy = handler.getDelegate();
-
-        // handle if already proxied using cglib
-        // (this is in case the CglibObjectFactory is configured, to handle lazy loading/object dirtying.  
-        // Have decided not to port this over to the Javassist version, in anticipation of the CglibObjectFactory being dropped from Isis in v2.0.0.
-        // (If that isn't the case, then this class is still available).
-        if (CglibEnhanced.class.isAssignableFrom(toProxy.getClass())) {
-
-            handler.setResolveObjectChangedEnabled(true);
-
-            final Class<? extends Object> enhancedClass = toProxy.getClass();
-            final Class<? extends Object> origSuperclass = toProxy.getClass().getSuperclass();
-
-            final List<Class<?>> interfaces = Lists.newArrayList();
-            interfaces.addAll(Arrays.asList(enhancedClass.getInterfaces()));
-            interfaces.remove(Factory.class); // if there.
-            interfaces.add(WrapperObject.class);
-
-            return (T) Enhancer.create(origSuperclass, interfaces.toArray(new Class[] {}), newMethodInterceptor(handler));
-        }
-
-        final Class<T> clazz = (Class<T>) toProxy.getClass();
-
-        if (clazz.isInterface()) {
-            return Util.createInstance(clazz, handler, WrapperObject.class);
-        } else {
-            final Class<T> enhancedClass = createEnhancedClass(clazz, handler, WrapperObject.class);
-            return Util.createInstance(enhancedClass);
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private static <T> Class<T> createEnhancedClass(final Class<T> toProxyClass, final InvocationHandler handler, final Class<?>... auxiliaryTypes) {
-
-        // Create the proxy
-        final Enhancer enhancer = new Enhancer();
-        enhancer.setSuperclass(toProxyClass);
-        enhancer.setInterfaces(auxiliaryTypes);
-        enhancer.setCallbackType(newMethodInterceptor(handler).getClass());
-
-        final Class<?> enhancedClass = enhancer.createClass();
-
-        Enhancer.registerCallbacks(enhancedClass, new Callback[] { newMethodInterceptor(handler) });
-        return (Class<T>) enhancedClass;
-    }
-
-    private static <T> MethodInterceptor newMethodInterceptor(final InvocationHandler handler) {
-        return new MethodInterceptor() {
-            @Override
-            public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
-                return handler.invoke(obj, method, args);
-            }
-        };
-    }
-    
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/proxy/ProxyInstantiatorForJavassist.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/proxy/ProxyInstantiatorForJavassist.java b/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/proxy/ProxyInstantiatorForJavassist.java
deleted file mode 100644
index 3d2b838..0000000
--- a/core/module-wrapper/src/main/java/org/apache/isis/core/wrapper/proxy/ProxyInstantiatorForJavassist.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.wrapper.proxy;
-
-import java.lang.reflect.InvocationHandler;
-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.applib.services.wrapper.WrapperObject;
-import org.apache.isis.core.commons.lang.ArrayExtensions;
-import org.apache.isis.core.wrapper.handlers.DelegatingInvocationHandler;
-import org.apache.isis.core.wrapper.internal.util.Util;
-
-public class ProxyInstantiatorForJavassist implements ProxyInstantiator {
-
-    @SuppressWarnings("unchecked")
-    public <T> T instantiateProxy(final DelegatingInvocationHandler<T> handler) {
-
-        final T toProxy = handler.getDelegate();
-
-        final Class<T> clazz = (Class<T>) toProxy.getClass();
-
-        if (clazz.isInterface()) {
-            return Util.createInstance(clazz, handler, WrapperObject.class);
-        } else {
-            final Class<T> enhancedClass = createEnhancedClass(clazz, handler, WrapperObject.class);
-            ProxyObject proxyObject = (ProxyObject) Util.createInstance(enhancedClass);
-            proxyObject.setHandler(new MethodHandler() {
-                @Override
-                public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable {
-                    return handler.invoke(self, thisMethod, args);
-                }
-            });
-            return (T) proxyObject;
-        }
-    }
-    
-    @SuppressWarnings("unchecked")
-    private static <T> Class<T> createEnhancedClass(final Class<T> toProxyClass, final InvocationHandler handler, final Class<?>... auxiliaryTypes) {
-        
-        final ProxyFactory proxyFactory = new ProxyFactory();
-        proxyFactory.setSuperclass(toProxyClass);
-        proxyFactory.setInterfaces(ArrayExtensions.combine(toProxyClass.getInterfaces(), new Class<?>[]{org.apache.isis.core.metamodel.specloader.classsubstitutor.JavassistEnhanced.class}, auxiliaryTypes));
-
-        proxyFactory.setFilter(new MethodFilter() {
-            @Override
-            public boolean isHandled(final Method m) {
-                // ignore finalize()
-                return !m.getName().equals("finalize") || m.isBridge();
-            }
-        });
-        
-        return proxyFactory.createClass();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/test/java/org/apache/isis/core/wrapper/WrapperFactoryAbstractTest.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/test/java/org/apache/isis/core/wrapper/WrapperFactoryAbstractTest.java b/core/module-wrapper/src/test/java/org/apache/isis/core/wrapper/WrapperFactoryAbstractTest.java
deleted file mode 100644
index 6bc2e8e..0000000
--- a/core/module-wrapper/src/test/java/org/apache/isis/core/wrapper/WrapperFactoryAbstractTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.isis.core.wrapper;
-
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.apache.isis.applib.services.wrapper.WrapperFactory;
-import org.apache.isis.applib.services.wrapper.WrappingObject;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.wrapper.proxy.ProxyInstantiator;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public class WrapperFactoryAbstractTest {
-
-    private static class DomainObject {
-    }
-
-    private static class WrappedDomainObject extends DomainObject implements WrappingObject {
-
-        private final DomainObject wrappedObject;
-        private final WrapperFactory.ExecutionMode mode;
-
-        WrappedDomainObject(final DomainObject wrappedObject, WrapperFactory.ExecutionMode mode) {
-            this.wrappedObject = wrappedObject;
-            this.mode = mode;
-        }
-
-        @Override
-        public void __isis_save() {
-        }
-
-        @Override
-        public Object __isis_wrapped() {
-            return wrappedObject;
-        }
-
-        @Override
-        public WrapperFactory.ExecutionMode __isis_executionMode() {
-            return mode;
-        }
-    }
-
-    @Rule
-    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(JUnitRuleMockery2.Mode.INTERFACES_AND_CLASSES);
-
-    @Mock
-    private ProxyInstantiator mockProxyInstantiator;
-    private WrapperFactoryAbstract wrapperFactory;
-
-    private DomainObject createProxyCalledWithDomainObject;
-    private WrapperFactory.ExecutionMode createProxyCalledWithMode;
-
-    @Before
-    public void setUp() throws Exception {
-        wrapperFactory = new WrapperFactoryAbstract(mockProxyInstantiator) {
-
-            @Override
-            protected <T> T createProxy(T domainObject, ExecutionMode mode) {
-                WrapperFactoryAbstractTest.this.createProxyCalledWithMode = mode;
-                WrapperFactoryAbstractTest.this.createProxyCalledWithDomainObject = (DomainObject) domainObject;
-                return domainObject;
-            }
-        };
-    }
-
-    @Test
-    public void wrap_ofUnwrapped_delegates_to_createProxy() throws Exception {
-        final DomainObject domainObject = new DomainObject();
-        wrapperFactory.wrap(domainObject);
-
-        assertThat(createProxyCalledWithDomainObject, is(domainObject));
-        assertThat(createProxyCalledWithMode, is(WrapperFactory.ExecutionMode.EXECUTE));
-    }
-
-
-    @Test
-    public void wrap_ofWrapped_sameMode_returnsUnchanged() throws Exception {
-        // given
-        final DomainObject wrappedObject = new DomainObject();
-        final DomainObject domainObject = new WrappedDomainObject(wrappedObject, WrapperFactory.ExecutionMode.EXECUTE);
-
-        // when
-        final DomainObject wrappingObject = wrapperFactory.wrap(domainObject, WrapperFactory.ExecutionMode.EXECUTE);
-
-        // then
-        assertThat(wrappingObject, is(domainObject));
-        assertThat(createProxyCalledWithDomainObject, is(nullValue()));
-    }
-
-    @Test
-    public void wrap_ofWrapped_differentMode_delegates_to_createProxy() throws Exception {
-        // given
-        final DomainObject wrappedObject = new DomainObject();
-        final DomainObject domainObject = new WrappedDomainObject(wrappedObject, WrapperFactory.ExecutionMode.EXECUTE);
-
-        // when
-        final DomainObject wrappingObject = wrapperFactory.wrap(domainObject, WrapperFactory.ExecutionMode.SKIP_RULES);
-
-        // then
-        assertThat(wrappingObject, is(not(domainObject)));
-        assertThat(createProxyCalledWithDomainObject, is(wrappedObject));
-        assertThat(createProxyCalledWithMode, is(WrapperFactory.ExecutionMode.SKIP_RULES));
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject.java b/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject.java
deleted file mode 100644
index a3609b8..0000000
--- a/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.progmodel.wrapper;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.Assert.assertThat;
-
-import java.lang.reflect.Method;
-import java.util.Collections;
-
-import org.jmock.Expectations;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import org.apache.isis.applib.services.wrapper.DisabledException;
-import org.apache.isis.applib.services.wrapper.HiddenException;
-import org.apache.isis.applib.services.wrapper.InvalidException;
-import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ObjectPersistor;
-import org.apache.isis.core.metamodel.adapter.QuerySubmitter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.core.metamodel.adapter.ServicesProvider;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facets.FacetedMethod;
-import org.apache.isis.core.metamodel.facets.all.named.NamedFacetInferred;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
-import org.apache.isis.core.metamodel.spec.feature.ObjectMemberContext;
-import org.apache.isis.core.metamodel.specloader.collectiontyperegistry.CollectionTypeRegistryDefault;
-import org.apache.isis.core.metamodel.specloader.specimpl.OneToOneAssociationImpl;
-import org.apache.isis.core.metamodel.specloader.specimpl.dflt.ObjectSpecificationDefault;
-import org.apache.isis.core.metamodel.facets.members.disabled.method.DisableForContextFacetViaMethod;
-import org.apache.isis.core.metamodel.facets.members.hidden.method.HideForContextFacetViaMethod;
-import org.apache.isis.core.metamodel.facets.properties.accessor.PropertyAccessorFacetViaAccessor;
-import org.apache.isis.core.metamodel.facets.properties.update.clear.PropertyClearFacetViaClearMethod;
-import org.apache.isis.core.metamodel.facets.properties.update.init.PropertyInitializationFacetViaSetterMethod;
-import org.apache.isis.core.metamodel.facets.properties.update.modify.PropertySetterFacetViaModifyMethod;
-import org.apache.isis.core.metamodel.facets.properties.validating.method.PropertyValidateFacetViaMethod;
-import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
-import org.apache.isis.core.tck.dom.claimapp.employees.Employee;
-import org.apache.isis.core.tck.dom.claimapp.employees.EmployeeRepository;
-import org.apache.isis.core.tck.dom.claimapp.employees.EmployeeRepositoryImpl;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.core.wrapper.WrapperFactoryAbstract;
-
-public abstract class WrapperFactoryAbstractTest_wrappedObject {
-
-    @Rule
-    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-    
-    @Mock
-    private AdapterManager mockAdapterManager;
-    @Mock
-    private AuthenticationSessionProvider mockAuthenticationSessionProvider;
-    @Mock
-    private ObjectPersistor mockObjectPersistor;
-    @Mock
-    private QuerySubmitter mockQuerySubmitter;
-    @Mock
-    private ServicesProvider mockServicesProvider;
-    @Mock
-    private SpecificationLoader mockSpecificationLookup;
-
-    private ObjectMemberContext objectMemberContext;
-
-    @Mock
-    private ObjectSpecificationDefault mockEmployeeSpec;
-    private ObjectMember employeeNameMember;
-
-    @Mock
-    private ObjectSpecificationDefault mockStringSpec;
-
-    @Mock
-    private ObjectAdapter mockEmployeeAdapter;
-
-    @Mock
-    private ObjectAdapter mockAdapterForStringSmith;
-    @Mock
-    private ObjectAdapter mockAdapterForStringJones;
-
-    private final SimpleSession session = new SimpleSession("tester", Collections.<String>emptyList());
-
-    private EmployeeRepository employeeRepository;
-
-    private Employee employeeDO;
-    private Employee employeeWO;
-
-    private WrapperFactoryAbstract wrapperFactory;
-
-
-    @Before
-    public void setUp() {
-
-        objectMemberContext = new ObjectMemberContext(DeploymentCategory.PRODUCTION, mockAuthenticationSessionProvider, mockSpecificationLookup, mockAdapterManager, mockQuerySubmitter, new CollectionTypeRegistryDefault(), mockServicesProvider);
-        
-        employeeRepository = new EmployeeRepositoryImpl();
-
-        employeeDO = new Employee();
-        employeeDO.setName("Smith");
-        employeeDO.setEmployeeRepository(employeeRepository); 
-
-        wrapperFactory = createWrapperFactory();
-        wrapperFactory.setAdapterManager(mockAdapterManager);
-        wrapperFactory.setAuthenticationSessionProvider(mockAuthenticationSessionProvider);
-        wrapperFactory.setObjectPersistor(mockObjectPersistor);
-        wrapperFactory.setSpecificationLookup(mockSpecificationLookup);
-
-        context.checking(new Expectations() {
-            {
-                allowing(mockSpecificationLookup).loadSpecification(String.class);
-                will(returnValue(mockStringSpec));
-
-                allowing(mockStringSpec).getShortIdentifier();
-                will(returnValue(String.class.getName()));
-            }
-        });
-        
-        
-        final Method employeeGetNameMethod = methodOf(Employee.class, "getName");
-        final Method employeeSetNameMethod = methodOf(Employee.class, "setName", String.class);
-        final Method employeeModifyNameMethod = methodOf(Employee.class, "modifyName", String.class);
-        final Method employeeHideNameMethod = methodOf(Employee.class, "hideName");
-        final Method employeeDisableNameMethod = methodOf(Employee.class, "disableName");
-        final Method employeeValidateNameMethod = methodOf(Employee.class, "validateName", String.class);
-        final Method employeeClearNameMethod = methodOf(Employee.class, "clearName");
-        employeeNameMember = new OneToOneAssociationImpl(
-                facetedMethodForProperty(
-                        employeeSetNameMethod, employeeGetNameMethod, employeeModifyNameMethod, employeeClearNameMethod, employeeHideNameMethod, employeeDisableNameMethod, employeeValidateNameMethod), objectMemberContext);
-        
-        context.checking(new Expectations() {
-            {
-                allowing(mockAuthenticationSessionProvider).getAuthenticationSession();
-                will(returnValue(session));
-
-                allowing(mockAdapterManager).getAdapterFor(employeeDO);
-                will(returnValue(mockEmployeeAdapter));
-
-                allowing(mockEmployeeAdapter).getSpecification();
-                will(returnValue(mockEmployeeSpec));
-
-                allowing(mockSpecificationLookup).loadSpecification(Employee.class);
-                will(returnValue(mockEmployeeSpec));
-
-                allowing(mockEmployeeSpec).getMember(methodOf(Employee.class, "getEmployeeRepository"));
-                will(returnValue(null));
-
-                allowing(mockEmployeeSpec).getMember(employeeGetNameMethod);
-                will(returnValue(employeeNameMember));
-
-                allowing(mockEmployeeSpec).getMember(employeeSetNameMethod);
-                will(returnValue(employeeNameMember));
-
-                allowing(mockEmployeeSpec).getMember(employeeModifyNameMethod);
-                will(returnValue(employeeNameMember));
-                
-                allowing(mockEmployeeSpec).getMember(employeeClearNameMethod);
-                will(returnValue(employeeNameMember));
-                
-                allowing(mockEmployeeAdapter).getObject();
-                will(returnValue(employeeDO));
-                
-                allowing(mockEmployeeAdapter).representsPersistent();
-                will(returnValue(true));
-            }
-        });
-
-
-        employeeWO = wrapperFactory.wrap(employeeDO);
-    }
-
-    /**
-     * Mandatory hook.
-     */
-    protected abstract WrapperFactoryAbstract createWrapperFactory();
-
-    @Test
-    public void shouldWrapDomainObject() {
-        // then
-        assertThat(employeeWO, is(notNullValue()));
-    }
-
-    @Test
-    public void shouldBeAbleToInjectIntoDomainObjects() {
-        assertThat(employeeDO.getEmployeeRepository(), is(notNullValue()));
-    }
-
-    @Test
-    public void cannotAccessMethodNotCorrespondingToMember() {
-
-        expectedException.expectMessage("Method 'getEmployeeRepository' being invoked does not correspond to any of the object's fields or actions.");
-        
-        // then
-        assertThat(employeeWO.getEmployeeRepository(), is(notNullValue()));
-    }
-    
-    @Test
-    public void shouldBeAbleToReadVisibleProperty() {
-
-        allowingEmployeeHasSmithAdapter();
-        
-
-        // then
-        assertThat(employeeWO.getName(), is(employeeDO.getName()));
-    }
-
-    @Test
-    public void shouldNotBeAbleToViewHiddenProperty() {
-
-        expectedException.expect(HiddenException.class);
-
-        allowingEmployeeHasSmithAdapter();
-
-        // given
-        employeeDO.whetherHideName = true;
-        // when
-        employeeWO.getName();
-        // then should throw exception
-    }
-
-    @Test
-    public void shouldBeAbleToModifyEnabledPropertyUsingSetter() {
-
-        allowingJonesStringValueAdapter();
-
-        context.checking(new Expectations() {
-            {
-
-                oneOf(mockAdapterManager).adapterFor("Jones", mockEmployeeAdapter);
-                will(returnValue(mockAdapterForStringJones));
-            }
-        });
-
-        // when
-        employeeWO.setName("Jones");
-        // then
-        assertThat(employeeDO.getName(), is("Jones"));
-        assertThat(employeeWO.getName(), is(employeeDO.getName()));
-    }
-
-    @Test
-    public void shouldNotBeAbleToModifyDisabledProperty() {
-
-        expectedException.expect(DisabledException.class);
-
-        // given
-        employeeDO.reasonDisableName = "sorry, no change allowed";
-        // when
-        employeeWO.setName("Jones");
-        // then should throw exception
-    }
-
-    @Test
-    public void shouldNotBeAbleToModifyPropertyUsingModify() {
-
-        allowingJonesStringValueAdapter();
-
-        expectedException.expect(UnsupportedOperationException.class);
-
-        // when
-        employeeWO.modifyName("Jones");
-        // then should throw exception
-    }
-
-    @Test
-    public void shouldNotBeAbleToModifyPropertyUsingClear() {
-
-        expectedException.expect(UnsupportedOperationException.class);
-
-        // when
-        employeeWO.clearName();
-        // then should throw exception
-    }
-
-    @Test
-    public void shouldNotBeAbleToModifyPropertyIfInvalid() {
-
-        allowingJonesStringValueAdapter();
-
-        expectedException.expect(InvalidException.class);
-
-        // given
-        employeeDO.reasonValidateName = "sorry, invalid data";
-        // when
-        employeeWO.setName("Jones");
-        // then should throw exception
-    }
-
-    
-    // //////////////////////////////////////
-
-    private static FacetedMethod facetedMethodForProperty(
-            Method init, Method accessor, Method modify, Method clear, Method hide, Method disable, Method validate) {
-        FacetedMethod facetedMethod = FacetedMethod.createForProperty(accessor.getDeclaringClass(), accessor);
-        FacetUtil.addFacet(new PropertyAccessorFacetViaAccessor(accessor, facetedMethod));
-        FacetUtil.addFacet(new PropertyInitializationFacetViaSetterMethod(init, facetedMethod));
-        FacetUtil.addFacet(new PropertySetterFacetViaModifyMethod(modify, facetedMethod));
-        FacetUtil.addFacet(new PropertyClearFacetViaClearMethod(clear, facetedMethod));
-        FacetUtil.addFacet(new HideForContextFacetViaMethod(hide, facetedMethod));
-        FacetUtil.addFacet(new DisableForContextFacetViaMethod(disable, facetedMethod));
-        FacetUtil.addFacet(new PropertyValidateFacetViaMethod(validate, facetedMethod));
-        FacetUtil.addFacet(new NamedFacetInferred(accessor.getName(), facetedMethod));
-        return facetedMethod;
-    }
-
-    private static Method methodOf(Class<?> cls, String methodName) {
-        return methodOf(cls, methodName, new Class<?>[]{});
-    }
-
-    private static Method methodOf(Class<?> cls, String methodName, Class<?>... args) {
-        try {
-            return cls.getMethod(methodName, args);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    // //////////////////////////////////////
-    
-    private void allowingEmployeeHasSmithAdapter() {
-        context.checking(new Expectations() {
-            {
-                allowing(mockAdapterManager).adapterFor("Smith", mockEmployeeAdapter);
-                will(returnValue(mockAdapterForStringSmith));
-
-                allowing(mockAdapterForStringSmith).getObject();
-                will(returnValue("Smith"));
-            }
-        });
-    }
-
-    private void allowingJonesStringValueAdapter() {
-        context.checking(new Expectations() {
-            {
-                allowing(mockAdapterManager).adapterFor("Jones");
-                will(returnValue(mockAdapterForStringJones));
-                
-                allowing(mockAdapterForStringJones).getObject();
-                will(returnValue("Jones"));
-                
-                allowing(mockAdapterForStringJones).isTransient();
-                will(returnValue(ResolveState.VALUE.isTransient()));
-            }
-        });
-    }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject_transient.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject_transient.java b/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject_transient.java
deleted file mode 100644
index e9d1adb..0000000
--- a/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject_transient.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.progmodel.wrapper;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.jmock.Expectations;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.events.PropertyModifyEvent;
-import org.apache.isis.applib.events.PropertyUsabilityEvent;
-import org.apache.isis.applib.events.PropertyVisibilityEvent;
-import org.apache.isis.applib.filter.Filter;
-import org.apache.isis.applib.services.wrapper.DisabledException;
-import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ObjectPersistor;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.consent.Allow;
-import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.consent.InteractionResult;
-import org.apache.isis.core.metamodel.consent.Veto;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.core.metamodel.specloader.specimpl.dflt.ObjectSpecificationDefault;
-import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacet;
-import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacetAlwaysEverywhere;
-import org.apache.isis.core.metamodel.facets.properties.accessor.PropertyAccessorFacetViaAccessor;
-import org.apache.isis.core.metamodel.facets.properties.update.modify.PropertySetterFacetViaSetterMethod;
-import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
-import org.apache.isis.core.tck.dom.claimapp.employees.Employee;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.core.wrapper.WrapperFactoryAbstract;
-
-/**
- * Contract test.
- */
-public abstract class WrapperFactoryAbstractTest_wrappedObject_transient {
-
-    @Rule
-    public final JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
-    @Mock
-    private AdapterManager mockAdapterManager;
-    @Mock
-    private AuthenticationSessionProvider mockAuthenticationSessionProvider;
-    @Mock
-    private ObjectPersistor mockObjectPersistor;
-    @Mock
-    private SpecificationLoader mockSpecificationLookup;
-
-    private Employee employeeDO;
-    @Mock
-    private ObjectAdapter mockEmployeeAdapter;
-    @Mock
-    private ObjectSpecificationDefault mockEmployeeSpec;
-    @Mock
-    private OneToOneAssociation mockPasswordMember;
-    @Mock
-    private Identifier mockPasswordIdentifier;
-
-    @Mock
-    protected ObjectAdapter mockPasswordAdapter;
-    
-    private final String passwordValue = "12345678";
-
-    private final SimpleSession session = new SimpleSession("tester", Collections.<String>emptyList());
-
-    private List<Facet> facets;
-    private Method getPasswordMethod;
-    private Method setPasswordMethod;
-
-    private WrapperFactoryAbstract wrapperFactory;
-    private Employee employeeWO;
-
-
-    @Before
-    public void setUp() throws Exception {
-
-        employeeDO = new Employee();
-        employeeDO.setName("Smith");
-        
-        getPasswordMethod = Employee.class.getMethod("getPassword");
-        setPasswordMethod = Employee.class.getMethod("setPassword", String.class);
-
-        wrapperFactory = createWrapperFactory();
-        wrapperFactory.setAdapterManager(mockAdapterManager);
-        wrapperFactory.setAuthenticationSessionProvider(mockAuthenticationSessionProvider);
-        wrapperFactory.setObjectPersistor(mockObjectPersistor);
-        wrapperFactory.setSpecificationLookup(mockSpecificationLookup);
-        
-        context.checking(new Expectations() {
-            {
-                allowing(mockAdapterManager).getAdapterFor(employeeDO);
-                will(returnValue(mockEmployeeAdapter));
-
-                allowing(mockAdapterManager).adapterFor(passwordValue);
-                will(returnValue(mockPasswordAdapter));
-
-                allowing(mockEmployeeAdapter).getSpecification();
-                will(returnValue(mockEmployeeSpec));
-
-                allowing(mockEmployeeAdapter).getObject();
-                will(returnValue(employeeDO));
-
-                allowing(mockPasswordAdapter).getObject();
-                will(returnValue(passwordValue));
-
-                allowing(mockPasswordMember).getIdentifier();
-                will(returnValue(mockPasswordIdentifier));
-
-                allowing(mockSpecificationLookup).loadSpecification(Employee.class);
-                will(returnValue(mockEmployeeSpec));
-                
-                allowing(mockEmployeeSpec).getMember(with(setPasswordMethod));
-                will(returnValue(mockPasswordMember));
-
-                allowing(mockEmployeeSpec).getMember(with(getPasswordMethod));
-                will(returnValue(mockPasswordMember));
-
-                allowing(mockPasswordMember).getName();
-                will(returnValue("password"));
-
-                allowing(mockAuthenticationSessionProvider).getAuthenticationSession();
-                will(returnValue(session));
-                
-                allowing(mockPasswordMember).isOneToOneAssociation();
-                will(returnValue(true));
-
-                allowing(mockPasswordMember).isOneToManyAssociation();
-                will(returnValue(false));
-            }
-        });
-
-        employeeWO = wrapperFactory.wrap(employeeDO);
-    }
-
-    /**
-     * Mandatory hook.
-     */
-    protected abstract WrapperFactoryAbstract createWrapperFactory();
-
-    @Test(expected = DisabledException.class)
-    public void shouldNotBeAbleToModifyProperty() {
-
-        // given
-        final DisabledFacet disabledFacet = new DisabledFacetAlwaysEverywhere(mockPasswordMember);
-        facets = Arrays.asList((Facet)disabledFacet, new PropertySetterFacetViaSetterMethod(setPasswordMethod, mockPasswordMember));
-
-        final Consent visibilityConsent = new Allow(new InteractionResult(new PropertyVisibilityEvent(employeeDO, null)));
-
-        final InteractionResult usabilityInteractionResult = new InteractionResult(new PropertyUsabilityEvent(employeeDO, null));
-        usabilityInteractionResult.advise("disabled", disabledFacet);
-        final Consent usabilityConsent = new Veto(usabilityInteractionResult);
-
-        context.checking(new Expectations() {
-            {
-                allowing(mockPasswordMember).getFacets(with(any(Filter.class)));
-                will(returnValue(facets));
-                
-                allowing(mockPasswordMember).isVisible(session, mockEmployeeAdapter, Where.ANYWHERE);
-                will(returnValue(visibilityConsent));
-                
-                allowing(mockPasswordMember).isUsable(session, mockEmployeeAdapter, Where.ANYWHERE);
-                will(returnValue(usabilityConsent));
-            }
-        });
-        
-        // when
-        employeeWO.setPassword(passwordValue);
-        
-        // then should throw exception
-    }
-
-    @Ignore("TODO - reinstate or replace with integration tests")
-    @Test
-    public void canModifyProperty() {
-        // given
-
-        final Consent visibilityConsent = new Allow(new InteractionResult(new PropertyVisibilityEvent(employeeDO, mockPasswordIdentifier)));
-        final Consent usabilityConsent = new Allow(new InteractionResult(new PropertyUsabilityEvent(employeeDO, mockPasswordIdentifier)));
-        final Consent validityConsent = new Allow(new InteractionResult(new PropertyModifyEvent(employeeDO, mockPasswordIdentifier, passwordValue)));
-
-        context.checking(new Expectations() {
-            {
-                allowing(mockPasswordMember).isVisible(session, mockEmployeeAdapter, Where.ANYWHERE);
-                will(returnValue(visibilityConsent));
-                
-                allowing(mockPasswordMember).isUsable(session, mockEmployeeAdapter, Where.ANYWHERE);
-                will(returnValue(usabilityConsent));
-                
-                allowing(mockPasswordMember).isAssociationValid(mockEmployeeAdapter, mockPasswordAdapter);
-                will(returnValue(validityConsent));
-            }
-        });
-
-        facets = Arrays.asList((Facet)new PropertySetterFacetViaSetterMethod(setPasswordMethod, mockPasswordMember));
-        context.checking(new Expectations() {
-            {
-                allowing(mockPasswordMember).getFacets(with(any(Filter.class)));
-                will(returnValue(facets));
-
-                oneOf(mockPasswordMember).set(mockEmployeeAdapter, mockPasswordAdapter);
-            }
-        });
-
-        // when
-        employeeWO.setPassword(passwordValue);
-
-
-        // and given
-        facets = Arrays.asList((Facet)new PropertyAccessorFacetViaAccessor(getPasswordMethod, mockPasswordMember));
-        context.checking(new Expectations() {
-            {
-                allowing(mockPasswordMember).getFacets(with(any(Filter.class)));
-                will(returnValue(facets));
-                
-                oneOf(mockPasswordMember).get(mockEmployeeAdapter);
-                will(returnValue(mockPasswordAdapter));
-            }
-        });
-
-        // then be allowed
-        assertThat(employeeWO.getPassword(), is(passwordValue));
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryCglibTest_wrappedObject.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryCglibTest_wrappedObject.java b/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryCglibTest_wrappedObject.java
deleted file mode 100644
index b867968..0000000
--- a/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryCglibTest_wrappedObject.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.progmodel.wrapper;
-
-import org.apache.isis.core.wrapper.WrapperFactoryAbstract;
-import org.apache.isis.core.wrapper.WrapperFactoryCglib;
-
-public class WrapperFactoryCglibTest_wrappedObject extends WrapperFactoryAbstractTest_wrappedObject {
-
-    @Override
-    protected WrapperFactoryAbstract createWrapperFactory() {
-        return new WrapperFactoryCglib();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryCglibTest_wrappedObject_transient.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryCglibTest_wrappedObject_transient.java b/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryCglibTest_wrappedObject_transient.java
deleted file mode 100644
index 05dfdec..0000000
--- a/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryCglibTest_wrappedObject_transient.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.progmodel.wrapper;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.apache.isis.core.wrapper.WrapperFactoryAbstract;
-import org.apache.isis.core.wrapper.WrapperFactoryCglib;
-
-public class WrapperFactoryCglibTest_wrappedObject_transient extends WrapperFactoryAbstractTest_wrappedObject_transient {
-
-    @Override
-    protected WrapperFactoryAbstract createWrapperFactory() {
-        return new WrapperFactoryCglib();
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryJavassistTest_wrappedObject.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryJavassistTest_wrappedObject.java b/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryJavassistTest_wrappedObject.java
deleted file mode 100644
index b7ce494..0000000
--- a/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryJavassistTest_wrappedObject.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.progmodel.wrapper;
-
-import org.apache.isis.core.wrapper.WrapperFactoryAbstract;
-import org.apache.isis.core.wrapper.WrapperFactoryJavassist;
-
-public class WrapperFactoryJavassistTest_wrappedObject extends WrapperFactoryAbstractTest_wrappedObject {
-
-    @Override
-    protected WrapperFactoryAbstract createWrapperFactory() {
-        return new WrapperFactoryJavassist();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryJavassistTest_wrappedObject_transient.java
----------------------------------------------------------------------
diff --git a/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryJavassistTest_wrappedObject_transient.java b/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryJavassistTest_wrappedObject_transient.java
deleted file mode 100644
index c613348..0000000
--- a/core/module-wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryJavassistTest_wrappedObject_transient.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.progmodel.wrapper;
-
-import org.apache.isis.core.wrapper.WrapperFactoryAbstract;
-import org.apache.isis.core.wrapper.WrapperFactoryJavassist;
-
-public class WrapperFactoryJavassistTest_wrappedObject_transient extends WrapperFactoryAbstractTest_wrappedObject_transient {
-
-    @Override
-    protected WrapperFactoryAbstract createWrapperFactory() {
-        return new WrapperFactoryJavassist();
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index f013902..f806d8f 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -1095,6 +1095,11 @@ ${license.additional-notes}
                 <type>test-jar</type>
                 <scope>test</scope>
             </dependency>
+            <dependency>
+                <groupId>org.apache.isis.core</groupId>
+                <artifactId>isis-core-wrapper</artifactId>
+                <version>1.6.0-SNAPSHOT</version>
+            </dependency>
 
             <!-- bytecode components -->
             <dependency>
@@ -1388,11 +1393,6 @@ ${license.additional-notes}
                 <scope>test</scope>
                 <type>test-jar</type>
             </dependency>
-            <dependency>
-                <groupId>org.apache.isis.module</groupId>
-                <artifactId>isis-module-wrapper</artifactId>
-                <version>1.6.0-SNAPSHOT</version>
-            </dependency>
 
 
             <!-- JodaTime -->
@@ -2074,6 +2074,7 @@ ${license.additional-notes}
         <module>log4j</module>
         <module>metamodel</module>
         <module>runtime</module>
+        <module>wrapper</module>
         <module>webserver</module>
 
         <module>bytecode-cglib</module>
@@ -2103,7 +2104,6 @@ ${license.additional-notes}
         <module>module-publishing-jdo</module>
         <module>module-publishingeventserializer-ro</module>
         <module>module-settings</module>
-        <module>module-wrapper</module>
 
         <module>tck</module>
     </modules>

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/specsupport/pom.xml
----------------------------------------------------------------------
diff --git a/core/specsupport/pom.xml b/core/specsupport/pom.xml
index 50d6048..8d85116 100644
--- a/core/specsupport/pom.xml
+++ b/core/specsupport/pom.xml
@@ -64,8 +64,8 @@
             <artifactId>isis-core-applib</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.isis.module</groupId>
-            <artifactId>isis-module-wrapper</artifactId>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-wrapper</artifactId>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/wrapper/pom.xml
----------------------------------------------------------------------
diff --git a/core/wrapper/pom.xml b/core/wrapper/pom.xml
new file mode 100644
index 0000000..c5a58b3
--- /dev/null
+++ b/core/wrapper/pom.xml
@@ -0,0 +1,138 @@
+<?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.core</groupId>
+        <artifactId>isis</artifactId>
+        <version>1.6.0-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>isis-core-wrapper</artifactId>
+
+	<name>Isis Core Wrapper Service</name>
+	<description>Isis Core Wrapper Service</description>
+
+
+	<properties>
+        <siteBaseDir>..</siteBaseDir>
+		<relativeUrl>wrapper/</relativeUrl>
+	</properties>
+
+    <!-- used in Site generation for relative references. -->
+    <url>http://isis.apache.org/${relativeUrl}</url>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+                <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>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>asm</groupId>
+                <artifactId>asm</artifactId>
+                <version>3.3.1</version>
+            </dependency>
+            <dependency>
+                <groupId>cglib</groupId>
+                <artifactId>cglib-nodep</artifactId>
+                <version>2.2.2</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+	<dependencies>
+        <dependency>
+		    <groupId>org.apache.isis.core</groupId>
+		    <artifactId>isis-core-runtime</artifactId>
+        </dependency>
+
+		<dependency>
+		    <groupId>org.apache.isis.core</groupId>
+		    <artifactId>isis-core-metamodel</artifactId>
+		    <type>test-jar</type>
+		    <scope>test</scope>
+        </dependency>
+		<dependency>
+		    <groupId>org.apache.isis.core</groupId>
+		    <artifactId>isis-core-runtime</artifactId>
+		    <type>test-jar</type>
+		    <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-unittestsupport</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-tck-dom</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.objenesis</groupId>
+            <artifactId>objenesis</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.javassist</groupId>
+            <artifactId>javassist</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>asm</groupId>
+            <artifactId>asm</artifactId>
+            <!-- explicitly include for use of WrapperFactoryCglib -->
+            <optional>true</optional>
+        </dependency>
+
+        <dependency>
+            <groupId>cglib</groupId>
+            <artifactId>cglib-nodep</artifactId>
+            <!-- explicitly include for use of WrapperFactoryCglib -->
+            <optional>true</optional>
+        </dependency>
+
+	</dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryAbstract.java
----------------------------------------------------------------------
diff --git a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryAbstract.java b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryAbstract.java
new file mode 100644
index 0000000..ceea4a5
--- /dev/null
+++ b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryAbstract.java
@@ -0,0 +1,314 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.wrapper;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.events.*;
+import org.apache.isis.applib.services.wrapper.WrapperFactory;
+import org.apache.isis.applib.services.wrapper.WrappingObject;
+import org.apache.isis.applib.services.wrapper.listeners.InteractionListener;
+import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
+import org.apache.isis.core.commons.authentication.AuthenticationSessionProviderAware;
+import org.apache.isis.core.metamodel.adapter.ObjectPersistor;
+import org.apache.isis.core.metamodel.adapter.ObjectPersistorAware;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderAware;
+import org.apache.isis.core.wrapper.dispatchers.InteractionEventDispatcher;
+import org.apache.isis.core.wrapper.dispatchers.InteractionEventDispatcherTypeSafe;
+import org.apache.isis.core.wrapper.handlers.ProxyContextHandler;
+import org.apache.isis.core.wrapper.proxy.ProxyInstantiator;
+
+public abstract class WrapperFactoryAbstract implements WrapperFactory, AuthenticationSessionProviderAware, SpecificationLoaderAware, AdapterManagerAware, ObjectPersistorAware {
+
+    private final List<InteractionListener> listeners = new ArrayList<InteractionListener>();
+    private final Map<Class<? extends InteractionEvent>, InteractionEventDispatcher> dispatchersByEventClass = new HashMap<Class<? extends InteractionEvent>, InteractionEventDispatcher>();
+
+    private AuthenticationSessionProvider authenticationSessionProvider;
+    private SpecificationLoader specificationLookup;
+    private AdapterManager adapterManager;
+    private ObjectPersistor objectPersistor;
+
+    private final ProxyContextHandler proxy;
+
+    public WrapperFactoryAbstract(final ProxyInstantiator proxyInstantiator) {
+        
+        proxy = new ProxyContextHandler(proxyInstantiator);
+        
+        dispatchersByEventClass.put(ObjectTitleEvent.class, new InteractionEventDispatcherTypeSafe<ObjectTitleEvent>() {
+            @Override
+            public void dispatchTypeSafe(final ObjectTitleEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.objectTitleRead(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(PropertyVisibilityEvent.class, new InteractionEventDispatcherTypeSafe<PropertyVisibilityEvent>() {
+            @Override
+            public void dispatchTypeSafe(final PropertyVisibilityEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.propertyVisible(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(PropertyUsabilityEvent.class, new InteractionEventDispatcherTypeSafe<PropertyUsabilityEvent>() {
+            @Override
+            public void dispatchTypeSafe(final PropertyUsabilityEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.propertyUsable(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(PropertyAccessEvent.class, new InteractionEventDispatcherTypeSafe<PropertyAccessEvent>() {
+            @Override
+            public void dispatchTypeSafe(final PropertyAccessEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.propertyAccessed(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(PropertyModifyEvent.class, new InteractionEventDispatcherTypeSafe<PropertyModifyEvent>() {
+            @Override
+            public void dispatchTypeSafe(final PropertyModifyEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.propertyModified(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(CollectionVisibilityEvent.class, new InteractionEventDispatcherTypeSafe<CollectionVisibilityEvent>() {
+            @Override
+            public void dispatchTypeSafe(final CollectionVisibilityEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.collectionVisible(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(CollectionUsabilityEvent.class, new InteractionEventDispatcherTypeSafe<CollectionUsabilityEvent>() {
+            @Override
+            public void dispatchTypeSafe(final CollectionUsabilityEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.collectionUsable(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(CollectionAccessEvent.class, new InteractionEventDispatcherTypeSafe<CollectionAccessEvent>() {
+            @Override
+            public void dispatchTypeSafe(final CollectionAccessEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.collectionAccessed(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(CollectionAddToEvent.class, new InteractionEventDispatcherTypeSafe<CollectionAddToEvent>() {
+            @Override
+            public void dispatchTypeSafe(final CollectionAddToEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.collectionAddedTo(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(CollectionRemoveFromEvent.class, new InteractionEventDispatcherTypeSafe<CollectionRemoveFromEvent>() {
+            @Override
+            public void dispatchTypeSafe(final CollectionRemoveFromEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.collectionRemovedFrom(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(ActionVisibilityEvent.class, new InteractionEventDispatcherTypeSafe<ActionVisibilityEvent>() {
+            @Override
+            public void dispatchTypeSafe(final ActionVisibilityEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.actionVisible(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(ActionUsabilityEvent.class, new InteractionEventDispatcherTypeSafe<ActionUsabilityEvent>() {
+            @Override
+            public void dispatchTypeSafe(final ActionUsabilityEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.actionUsable(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(ActionArgumentEvent.class, new InteractionEventDispatcherTypeSafe<ActionArgumentEvent>() {
+            @Override
+            public void dispatchTypeSafe(final ActionArgumentEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.actionArgument(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(ActionInvocationEvent.class, new InteractionEventDispatcherTypeSafe<ActionInvocationEvent>() {
+            @Override
+            public void dispatchTypeSafe(final ActionInvocationEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.actionInvoked(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(ObjectValidityEvent.class, new InteractionEventDispatcherTypeSafe<ObjectValidityEvent>() {
+            @Override
+            public void dispatchTypeSafe(final ObjectValidityEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.objectPersisted(interactionEvent);
+                }
+            }
+        });
+        dispatchersByEventClass.put(CollectionMethodEvent.class, new InteractionEventDispatcherTypeSafe<CollectionMethodEvent>() {
+            @Override
+            public void dispatchTypeSafe(final CollectionMethodEvent interactionEvent) {
+                for (final InteractionListener l : getListeners()) {
+                    l.collectionMethodInvoked(interactionEvent);
+                }
+            }
+        });
+    }
+
+    // /////////////////////////////////////////////////////////////
+    // wrap and unwrap
+    // /////////////////////////////////////////////////////////////
+
+    @Override
+    public <T> T wrap(final T domainObject) {
+        return wrap(domainObject, ExecutionMode.EXECUTE);
+    }
+
+    @Override
+    public <T> T wrapNoExecute(final T domainObject) {
+        return wrap(domainObject, ExecutionMode.NO_EXECUTE);
+    }
+    
+    @Override
+    public <T> T wrapSkipRules(final T domainObject) {
+        return wrap(domainObject, ExecutionMode.SKIP_RULES);
+    }
+    
+    @Override
+    public <T> T wrap(final T domainObject, final ExecutionMode mode) {
+        if (domainObject instanceof WrappingObject) {
+            final WrappingObject wrapperObject = (WrappingObject) domainObject;
+            final ExecutionMode wrapperMode = wrapperObject.__isis_executionMode();
+            if(wrapperMode != mode) {
+                final Object underlyingDomainObject = wrapperObject.__isis_wrapped();
+                return (T)createProxy(underlyingDomainObject, mode);
+            }
+            return domainObject;
+        }
+        return createProxy(domainObject, mode);
+    }
+
+    protected <T> T createProxy(final T domainObject, final ExecutionMode mode) {
+        return proxy.proxy(domainObject, this, mode, getAuthenticationSessionProvider(), getSpecificationLookup(), getAdapterManager(), getObjectPersistor());
+    }
+
+    @Override
+    public boolean isWrapper(final Object possibleWrappedDomainObject) {
+        return possibleWrappedDomainObject instanceof WrappingObject;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    @Programmatic
+    public <T> T unwrap(T possibleWrappedDomainObject) {
+        if(isWrapper(possibleWrappedDomainObject)) {
+            final WrappingObject wrappingObject = (WrappingObject) possibleWrappedDomainObject;
+            return (T) wrappingObject.__isis_wrapped();
+        } 
+        return possibleWrappedDomainObject;
+    }
+
+    // /////////////////////////////////////////////////////////////
+    // Listeners
+    // /////////////////////////////////////////////////////////////
+
+    @Override
+    public List<InteractionListener> getListeners() {
+        return listeners;
+    }
+
+    @Override
+    public boolean addInteractionListener(final InteractionListener listener) {
+        return listeners.add(listener);
+    }
+
+    @Override
+    public boolean removeInteractionListener(final InteractionListener listener) {
+        return listeners.remove(listener);
+    }
+
+    @Override
+    public void notifyListeners(final InteractionEvent interactionEvent) {
+        final InteractionEventDispatcher dispatcher = dispatchersByEventClass.get(interactionEvent.getClass());
+        if (dispatcher == null) {
+            throw new RuntimeException("Unknown InteractionEvent - register into dispatchers map");
+        }
+        dispatcher.dispatch(interactionEvent);
+    }
+
+    // /////////////////////////////////////////////////////////////
+    // Listeners
+    // /////////////////////////////////////////////////////////////
+
+    protected AuthenticationSessionProvider getAuthenticationSessionProvider() {
+        return authenticationSessionProvider;
+    }
+    @Programmatic
+    @Override
+    public void setAuthenticationSessionProvider(final AuthenticationSessionProvider authenticationSessionProvider) {
+        this.authenticationSessionProvider = authenticationSessionProvider;
+    }
+
+    protected AdapterManager getAdapterManager() {
+        return adapterManager;
+    }
+    @Programmatic
+    @Override
+    public void setAdapterManager(final AdapterManager adapterManager) {
+        this.adapterManager = adapterManager;
+    }
+
+    
+    protected SpecificationLoader getSpecificationLookup() {
+        return specificationLookup;
+    }
+    @Programmatic
+    @Override
+    public void setSpecificationLookup(final SpecificationLoader specificationLookup) {
+        this.specificationLookup = specificationLookup;
+    }
+
+    protected ObjectPersistor getObjectPersistor() {
+        return objectPersistor;
+    }
+    @Programmatic
+    @Override
+    public void setObjectPersistor(final ObjectPersistor objectPersistor) {
+        this.objectPersistor = objectPersistor;
+    }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dec67056/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryCglib.java
----------------------------------------------------------------------
diff --git a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryCglib.java b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryCglib.java
new file mode 100644
index 0000000..fd75b59
--- /dev/null
+++ b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryCglib.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.wrapper;
+
+import org.apache.isis.core.wrapper.proxy.ProxyInstantiatorForCglib;
+
+public class WrapperFactoryCglib extends WrapperFactoryAbstract  {
+
+    public WrapperFactoryCglib() {
+        super(new ProxyInstantiatorForCglib());
+    }
+
+}