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 12:09:57 UTC
[36/51] [partial] ISIS-188: moving components into correct
directories.
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/InvocationHandlerMethodInterceptor.java
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/InvocationHandlerMethodInterceptor.java b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/InvocationHandlerMethodInterceptor.java
new file mode 100644
index 0000000..ebdcb52
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/InvocationHandlerMethodInterceptor.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.progmodel.wrapper.metamodel.internal;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+
+public class InvocationHandlerMethodInterceptor implements MethodInterceptor {
+ private final InvocationHandler handler;
+
+ InvocationHandlerMethodInterceptor(final InvocationHandler handler) {
+ this.handler = handler;
+ }
+
+ @Override
+ public Object intercept(final Object obj, final Method method, final Object[] args, final MethodProxy proxy) throws Throwable {
+ return handler.invoke(obj, method, args);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/JavaProxyFactory.java
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/JavaProxyFactory.java b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/JavaProxyFactory.java
new file mode 100644
index 0000000..173d777
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/JavaProxyFactory.java
@@ -0,0 +1,40 @@
+/*
+ * 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.metamodel.internal;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+
+import org.apache.isis.progmodel.wrapper.applib.WrapperObject;
+
+public class JavaProxyFactory<T> implements IProxyFactory<T> {
+ @Override
+ @SuppressWarnings("unchecked")
+ public T createProxy(final T toProxy, final InvocationHandler handler) {
+ final Class<T> proxyClass = (Class<T>) toProxy.getClass();
+ return (T) Proxy.newProxyInstance(proxyClass.getClassLoader(), new Class[] { proxyClass }, handler);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public T createProxy(final Class<T> toProxy, final InvocationHandler handler) {
+ return (T) Proxy.newProxyInstance(toProxy.getClassLoader(), new Class[] { toProxy, WrapperObject.class }, handler);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/MapInvocationHandler.java
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/MapInvocationHandler.java b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/MapInvocationHandler.java
new file mode 100644
index 0000000..779afac
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/MapInvocationHandler.java
@@ -0,0 +1,49 @@
+/*
+ * 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.metamodel.internal;
+
+import static org.apache.isis.core.commons.lang.MethodUtils.getMethod;
+
+import java.util.Map;
+
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+
+class MapInvocationHandler<T, C> extends AbstractCollectionInvocationHandler<T, C> {
+
+ public MapInvocationHandler(final C collectionToProxy, final String collectionName, final DomainObjectInvocationHandler<T> handler, final OneToManyAssociation otma) {
+ super(collectionToProxy, collectionName, handler, otma);
+
+ try {
+ intercept(getMethod(collectionToProxy, "containsKey", Object.class));
+ intercept(getMethod(collectionToProxy, "containsValue", Object.class));
+ intercept(getMethod(collectionToProxy, "size"));
+ intercept(getMethod(collectionToProxy, "isEmpty"));
+ veto(getMethod(collectionToProxy, "put", Object.class, Object.class));
+ veto(getMethod(collectionToProxy, "remove", Object.class));
+ veto(getMethod(collectionToProxy, "putAll", Map.class));
+ veto(getMethod(collectionToProxy, "clear"));
+ } catch (final NoSuchMethodException e) {
+ // ///CLOVER:OFF
+ throw new RuntimeException("A Collection method could not be found: " + e.getMessage());
+ // ///CLOVER:ON
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/ObjenesisClassInstantiatorCE.java
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/ObjenesisClassInstantiatorCE.java b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/ObjenesisClassInstantiatorCE.java
new file mode 100644
index 0000000..00028f1
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/ObjenesisClassInstantiatorCE.java
@@ -0,0 +1,31 @@
+/*
+ * 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.metamodel.internal;
+
+import org.objenesis.ObjenesisHelper;
+
+class ObjenesisClassInstantiatorCE implements IClassInstantiatorCE {
+
+ @Override
+ public Object newInstance(final Class<?> clazz) throws InstantiationException {
+ return ObjenesisHelper.newInstance(clazz);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/Proxy.java
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/Proxy.java b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/Proxy.java
new file mode 100644
index 0000000..dbcf4bb
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/Proxy.java
@@ -0,0 +1,80 @@
+/*
+ * 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.metamodel.internal;
+
+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.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.progmodel.wrapper.applib.WrapperFactory;
+import org.apache.isis.progmodel.wrapper.applib.WrapperFactory.ExecutionMode;
+
+public class Proxy {
+
+ public static <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);
+
+ final CgLibProxy<T> cglibProxy = new CgLibProxy<T>(invocationHandler);
+ return cglibProxy.proxy();
+ }
+
+ /**
+ * Whether to execute or not will be picked up from the supplied parent
+ * handler.
+ */
+ public static <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());
+
+ final CgLibProxy<Collection<E>> cglibProxy = new CgLibProxy<Collection<E>>(collectionInvocationHandler);
+ return cglibProxy.proxy();
+ }
+
+ /**
+ * Whether to execute or not will be picked up from the supplied parent
+ * handler.
+ */
+ public static <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());
+
+ final CgLibProxy<Map<P, Q>> cglibProxy = new CgLibProxy<Map<P, Q>>(mapInvocationHandler);
+ return cglibProxy.proxy();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/RuntimeExceptionWrapper.java
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/RuntimeExceptionWrapper.java b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/RuntimeExceptionWrapper.java
new file mode 100644
index 0000000..b6eae03
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/RuntimeExceptionWrapper.java
@@ -0,0 +1,33 @@
+/*
+ * 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.metamodel.internal;
+
+public class RuntimeExceptionWrapper extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+ private final RuntimeException runtimeException;
+
+ public RuntimeExceptionWrapper(final RuntimeException runtimeException) {
+ this.runtimeException = runtimeException;
+ }
+
+ public RuntimeException getRuntimeException() {
+ return runtimeException;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/WrapperFactoryDefault.java
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/WrapperFactoryDefault.java b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/WrapperFactoryDefault.java
new file mode 100644
index 0000000..ad22797
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/WrapperFactoryDefault.java
@@ -0,0 +1,271 @@
+/*
+ * 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.metamodel.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.isis.applib.events.ActionArgumentEvent;
+import org.apache.isis.applib.events.ActionInvocationEvent;
+import org.apache.isis.applib.events.ActionUsabilityEvent;
+import org.apache.isis.applib.events.ActionVisibilityEvent;
+import org.apache.isis.applib.events.CollectionAccessEvent;
+import org.apache.isis.applib.events.CollectionAddToEvent;
+import org.apache.isis.applib.events.CollectionMethodEvent;
+import org.apache.isis.applib.events.CollectionRemoveFromEvent;
+import org.apache.isis.applib.events.CollectionUsabilityEvent;
+import org.apache.isis.applib.events.CollectionVisibilityEvent;
+import org.apache.isis.applib.events.InteractionEvent;
+import org.apache.isis.applib.events.ObjectTitleEvent;
+import org.apache.isis.applib.events.ObjectValidityEvent;
+import org.apache.isis.applib.events.PropertyAccessEvent;
+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.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.progmodel.wrapper.applib.WrapperFactory;
+import org.apache.isis.progmodel.wrapper.applib.WrapperObject;
+import org.apache.isis.progmodel.wrapper.applib.listeners.InteractionListener;
+
+public class WrapperFactoryDefault 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;
+
+ public WrapperFactoryDefault() {
+ 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);
+ }
+ }
+ });
+ }
+
+ // /////////////////////////////////////////////////////////////
+ // Views
+ // /////////////////////////////////////////////////////////////
+
+ @Override
+ public <T> T wrap(final T domainObject) {
+ return wrap(domainObject, ExecutionMode.EXECUTE);
+ }
+
+ @Override
+ public <T> T wrap(final T domainObject, final ExecutionMode mode) {
+ if (isWrapper(domainObject)) {
+ return domainObject;
+ }
+ return Proxy.proxy(domainObject, this, mode, authenticationSessionProvider, specificationLookup, adapterManager, objectPersistor);
+ }
+
+ @Override
+ public boolean isWrapper(final Object possibleWrapper) {
+ return possibleWrapper instanceof WrapperObject;
+ }
+
+ // /////////////////////////////////////////////////////////////
+ // 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
+ // /////////////////////////////////////////////////////////////
+
+ @Override
+ public void setAuthenticationSessionProvider(final AuthenticationSessionProvider authenticationSessionProvider) {
+ this.authenticationSessionProvider = authenticationSessionProvider;
+ }
+
+ @Override
+ public void setAdapterManager(final AdapterManager adapterManager) {
+ this.adapterManager = adapterManager;
+ }
+
+ @Override
+ public void setSpecificationLookup(final SpecificationLoader specificationLookup) {
+ this.specificationLookup = specificationLookup;
+ }
+
+ @Override
+ public void setObjectPersistor(final ObjectPersistor objectPersistor) {
+ this.objectPersistor = objectPersistor;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/Constants.java
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/Constants.java b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/Constants.java
new file mode 100644
index 0000000..2b743c5
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/Constants.java
@@ -0,0 +1,52 @@
+/*
+ * 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.metamodel.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/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/MethodPrefixFinder.java
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/MethodPrefixFinder.java b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/MethodPrefixFinder.java
new file mode 100644
index 0000000..b2de21c
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/MethodPrefixFinder.java
@@ -0,0 +1,48 @@
+/*
+ * 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.metamodel.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/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/site/apt/index.apt b/framework/progmodel/wrapper/wrapper-metamodel/src/site/apt/index.apt
new file mode 100644
index 0000000..1a1f4fa
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/site/apt/index.apt
@@ -0,0 +1,22 @@
+~~ 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.
+
+
+
+Headless Viewer
+
+ The <headless viewer> module provides the main implementation of the headless viewer functionality.
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/site/apt/jottings.apt b/framework/progmodel/wrapper/wrapper-metamodel/src/site/apt/jottings.apt
new file mode 100644
index 0000000..c5d1200
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/site/apt/jottings.apt
@@ -0,0 +1,24 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+
+
+Jottings
+
+ This page is to capture any random jottings relating to this module prior
+ to being moved into formal documentation.
+
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/site/site.xml
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/site/site.xml b/framework/progmodel/wrapper/wrapper-metamodel/src/site/site.xml
new file mode 100644
index 0000000..6def7c8
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/site/site.xml
@@ -0,0 +1,39 @@
+<?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="Metamodel" href="index.html" />
+ </breadcrumbs>
+
+ <menu name="Wrapper Metamodel">
+ <item name="About" href="index.html" />
+ <item name="Jottings" href="jottings.html" />
+ </menu>
+
+ <menu name="Wrapper Modules">
+ <item name="Applib" href="../wrapper-applib/index.html" />
+ <item name="Metamodel" href="../wrapper-metamodel/index.html" />
+ </menu>
+
+ <menu name="Maven Reports" ref="reports" />
+ </body>
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/test/java/org/apache/isis/progmodel/wrapper/WrappedFactoryDefaultTest_wrappedObject.java
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/test/java/org/apache/isis/progmodel/wrapper/WrappedFactoryDefaultTest_wrappedObject.java b/framework/progmodel/wrapper/wrapper-metamodel/src/test/java/org/apache/isis/progmodel/wrapper/WrappedFactoryDefaultTest_wrappedObject.java
new file mode 100644
index 0000000..ba2c219
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/test/java/org/apache/isis/progmodel/wrapper/WrappedFactoryDefaultTest_wrappedObject.java
@@ -0,0 +1,153 @@
+/*
+ * 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 org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+import org.apache.isis.progmodel.wrapper.applib.DisabledException;
+import org.apache.isis.progmodel.wrapper.applib.HiddenException;
+import org.apache.isis.progmodel.wrapper.applib.InvalidException;
+import org.apache.isis.progmodel.wrapper.applib.WrapperFactory;
+import org.apache.isis.progmodel.wrapper.metamodel.internal.WrapperFactoryDefault;
+import org.apache.isis.tck.dom.claimapp.employees.Employee;
+import org.apache.isis.tck.dom.claimapp.employees.EmployeeRepository;
+import org.apache.isis.tck.dom.claimapp.employees.EmployeeRepositoryImpl;
+
+public class WrappedFactoryDefaultTest_wrappedObject {
+
+ @Rule
+ public JUnitRuleMockery2 mockery = JUnitRuleMockery2.createFor(Mode.INTERFACES_ONLY);
+
+ private EmployeeRepository employeeRepository;
+ // private ClaimRepository claimRepository;
+
+ private Employee employeeDO;
+ private Employee employeeWO;
+
+ private WrapperFactory wrapperFactory;
+
+ @Before
+ public void setUp() {
+
+ employeeRepository = new EmployeeRepositoryImpl();
+ // claimRepository = new ClaimRepositoryImpl();
+
+ employeeDO = new Employee();
+ employeeDO.setName("Smith");
+ employeeDO.setEmployeeRepository(employeeRepository); // would be done
+ // by the
+ // EmbeddedContext
+ // impl
+
+ wrapperFactory = new WrapperFactoryDefault();
+ employeeWO = wrapperFactory.wrap(employeeDO);
+ }
+
+ @Ignore("TODO - moved from embedded runtime, need to re-enable")
+ @Test
+ public void shouldWrapDomainObject() {
+ // then
+ assertThat(employeeWO, is(notNullValue()));
+ }
+
+ @Ignore("TODO - moved from embedded runtime, need to re-enable")
+ @Test
+ public void shouldBeAbleToInjectIntoDomainObjects() {
+
+ // given
+ assertThat(employeeDO.getEmployeeRepository(), is(notNullValue()));
+
+ // then
+ assertThat(employeeWO.getEmployeeRepository(), is(notNullValue()));
+ }
+
+ @Ignore("TODO - moved from embedded runtime, need to re-enable")
+ @Test
+ public void shouldBeAbleToReadVisibleProperty() {
+ // then
+ assertThat(employeeWO.getName(), is(employeeDO.getName()));
+ }
+
+ @Ignore("TODO - moved from embedded runtime, need to re-enable")
+ @Test(expected = HiddenException.class)
+ public void shouldNotBeAbleToViewHiddenProperty() {
+ // given
+ employeeDO.whetherHideName = true;
+ // when
+ employeeWO.getName();
+ // then should throw exception
+ }
+
+ @Ignore("TODO - moved from embedded runtime, need to re-enable")
+ @Test
+ public void shouldBeAbleToModifyEnabledPropertyUsingSetter() {
+ // when
+ employeeWO.setName("Jones");
+ // then
+ assertThat(employeeDO.getName(), is("Jones"));
+ assertThat(employeeWO.getName(), is(employeeDO.getName()));
+ }
+
+ @Ignore("TODO - moved from embedded runtime, need to re-enable")
+ @Test(expected = DisabledException.class)
+ public void shouldNotBeAbleToModifyDisabledProperty() {
+ // given
+ employeeDO.reasonDisableName = "sorry, no change allowed";
+ // when
+ employeeWO.setName("Jones");
+ // then should throw exception
+ }
+
+ @Ignore("TODO - moved from embedded runtime, need to re-enable")
+ @Test(expected = UnsupportedOperationException.class)
+ public void shouldNotBeAbleToModifyPropertyUsingModify() {
+ // when
+ employeeWO.modifyName("Jones");
+ // then should throw exception
+ }
+
+ @Ignore("TODO - moved from embedded runtime, need to re-enable")
+ @Test(expected = UnsupportedOperationException.class)
+ public void shouldNotBeAbleToModifyPropertyUsingClear() {
+ // when
+ employeeWO.clearName();
+ // then should throw exception
+ }
+
+ @Ignore("TODO - moved from embedded runtime, need to re-enable")
+ @Test(expected = InvalidException.class)
+ public void shouldNotBeAbleToModifyPropertyIfInvalid() {
+ // given
+ employeeDO.reasonValidateName = "sorry, invalid data";
+ // when
+ employeeWO.setName("Jones");
+ // then should throw exception
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodel/wrapper/wrapper-metamodel/src/test/java/org/apache/isis/progmodel/wrapper/WrappedFactoryDefaultTest_wrappedObject_transient.java
----------------------------------------------------------------------
diff --git a/framework/progmodel/wrapper/wrapper-metamodel/src/test/java/org/apache/isis/progmodel/wrapper/WrappedFactoryDefaultTest_wrappedObject_transient.java b/framework/progmodel/wrapper/wrapper-metamodel/src/test/java/org/apache/isis/progmodel/wrapper/WrappedFactoryDefaultTest_wrappedObject_transient.java
new file mode 100644
index 0000000..3d1a1e4
--- /dev/null
+++ b/framework/progmodel/wrapper/wrapper-metamodel/src/test/java/org/apache/isis/progmodel/wrapper/WrappedFactoryDefaultTest_wrappedObject_transient.java
@@ -0,0 +1,251 @@
+/*
+ * 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.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.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.progmodel.facets.members.disabled.DisabledFacet;
+import org.apache.isis.core.progmodel.facets.members.disabled.staticmethod.DisabledFacetAlwaysEverywhere;
+import org.apache.isis.core.progmodel.facets.properties.accessor.PropertyAccessorFacetViaAccessor;
+import org.apache.isis.core.progmodel.facets.properties.modify.PropertySetterFacetViaSetterMethod;
+import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+import org.apache.isis.progmodel.wrapper.applib.DisabledException;
+import org.apache.isis.progmodel.wrapper.metamodel.internal.WrapperFactoryDefault;
+import org.apache.isis.tck.dom.claimapp.employees.Employee;
+
+public class WrappedFactoryDefaultTest_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 WrapperFactoryDefault wrapperFactory;
+ private Employee employeeWO;
+
+
+ @Before
+ public void setUp() throws Exception {
+
+ // employeeRepository = new EmployeeRepositoryImpl();
+ // claimRepository = new ClaimRepositoryImpl();
+
+ employeeDO = new Employee();
+ employeeDO.setName("Smith");
+
+ getPasswordMethod = Employee.class.getMethod("getPassword");
+ setPasswordMethod = Employee.class.getMethod("setPassword", String.class);
+
+ wrapperFactory = new WrapperFactoryDefault();
+ 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);
+ }
+
+ @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
+ }
+
+ @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() {
+ {
+ one(mockPasswordMember).getFacets(with(any(Filter.class)));
+ will(returnValue(facets));
+
+ one(mockPasswordMember).set(mockEmployeeAdapter, mockPasswordAdapter);
+ }
+ });
+
+ // when
+ employeeWO.setPassword(passwordValue);
+
+
+ // and given
+ facets = Arrays.asList((Facet)new PropertyAccessorFacetViaAccessor(getPasswordMethod, mockPasswordMember));
+ context.checking(new Expectations() {
+ {
+ one(mockPasswordMember).getFacets(with(any(Filter.class)));
+ will(returnValue(facets));
+
+ one(mockPasswordMember).get(mockEmployeeAdapter);
+ will(returnValue(mockPasswordAdapter));
+ }
+ });
+
+ // then be allowed
+ assertThat(employeeWO.getPassword(), is(passwordValue));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/NOTICE
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/NOTICE b/framework/progmodels/groovy/NOTICE
deleted file mode 100644
index d391f54..0000000
--- a/framework/progmodels/groovy/NOTICE
+++ /dev/null
@@ -1,7 +0,0 @@
-Apache Isis
-Copyright 2010-2011 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/applib/NOTICE
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/applib/NOTICE b/framework/progmodels/groovy/applib/NOTICE
deleted file mode 100644
index d391f54..0000000
--- a/framework/progmodels/groovy/applib/NOTICE
+++ /dev/null
@@ -1,7 +0,0 @@
-Apache Isis
-Copyright 2010-2011 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/applib/pom.xml
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/applib/pom.xml b/framework/progmodels/groovy/applib/pom.xml
deleted file mode 100644
index d9fbb26..0000000
--- a/framework/progmodels/groovy/applib/pom.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?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.progmodels</groupId>
- <artifactId>groovy</artifactId>
- <version>0.3.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>groovy-applib</artifactId>
- <name>Groovy ProgModel AppLib</name>
-
- <properties>
- <siteBaseDir>../../..</siteBaseDir>
- <relativeUrl>progmodels/groovy/applib/</relativeUrl>
- </properties>
-
- <!-- used in Site generation for relative references. -->
- <url>http://incubator.apache.org/isis/${relativeUrl}</url>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis</groupId>
- <artifactId>applib</artifactId>
- </dependency>
-
- <!-- is marked as optional in parent, so not exported as a transitive dependency -->
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- </dependency>
-
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/applib/src/main/java/org/apache/isis/progmodel/groovy/applib/DomainObjectBuilder.java
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/applib/src/main/java/org/apache/isis/progmodel/groovy/applib/DomainObjectBuilder.java b/framework/progmodels/groovy/applib/src/main/java/org/apache/isis/progmodel/groovy/applib/DomainObjectBuilder.java
deleted file mode 100644
index f5698d6..0000000
--- a/framework/progmodels/groovy/applib/src/main/java/org/apache/isis/progmodel/groovy/applib/DomainObjectBuilder.java
+++ /dev/null
@@ -1,72 +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.groovy.applib;
-
-import groovy.util.ObjectGraphBuilder;
-
-import java.util.Map;
-
-import org.apache.isis.applib.DomainObjectContainer;
-
-public class DomainObjectBuilder<T> extends ObjectGraphBuilder {
-
- private final DomainObjectContainer container;
-
- public DomainObjectBuilder(final DomainObjectContainer container, final Class<?>... classes) {
- this.container = container;
- final ClassNameResolver classNameResolver = new ClassNameResolver() {
- @Override
- public String resolveClassname(final String classname) {
- for (final Class<?> cls : classes) {
- final String packageName = cls.getPackage().getName();
- final String fqcn = packageName + "." + upperFirst(classname);
- try {
- Thread.currentThread().getContextClassLoader().loadClass(fqcn);
- return fqcn;
- } catch (final ClassNotFoundException ex) {
- // continue
- }
- }
- throw new RuntimeException("could not resolve " + classname + "'");
- }
-
- };
- this.setClassNameResolver(classNameResolver);
- final NewInstanceResolver instanceResolver = new DefaultNewInstanceResolver() {
- @SuppressWarnings("unchecked")
- @Override
- public Object newInstance(final Class cls, final Map attributes) throws InstantiationException, IllegalAccessException {
- return container.newTransientInstance(cls);
- }
- };
- this.setNewInstanceResolver(instanceResolver);
- }
-
- private static String upperFirst(final String name) {
- return name.substring(0, 1).toUpperCase() + name.substring(1);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected Object createNode(final Object arg0, final Map arg1, final Object arg2) {
- final Object domainObject = super.createNode(arg0, arg1, arg2);
- container.persistIfNotAlready(domainObject);
- return domainObject;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/applib/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/applib/src/site/apt/index.apt b/framework/progmodels/groovy/applib/src/site/apt/index.apt
deleted file mode 100644
index 31ab5b9..0000000
--- a/framework/progmodels/groovy/applib/src/site/apt/index.apt
+++ /dev/null
@@ -1,29 +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.
-
-Documentation
-
- The <Groovy Objects> applib defines:
-
- * helper classes for writing fixtures
-
- * a transitive dependency to the <Isis> applib
-
- []
-
- See the {{{../../docbkx/html/guide/isis-progmodels.html}Isis Programming Model user guide}} for more information.
-
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/applib/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/applib/src/site/apt/jottings.apt b/framework/progmodels/groovy/applib/src/site/apt/jottings.apt
deleted file mode 100644
index c5d1200..0000000
--- a/framework/progmodels/groovy/applib/src/site/apt/jottings.apt
+++ /dev/null
@@ -1,24 +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.
-
-
-
-Jottings
-
- This page is to capture any random jottings relating to this module prior
- to being moved into formal documentation.
-
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/applib/src/site/site.xml
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/applib/src/site/site.xml b/framework/progmodels/groovy/applib/src/site/site.xml
deleted file mode 100644
index 725e8ca..0000000
--- a/framework/progmodels/groovy/applib/src/site/site.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<project name="${project.name}">
- <body>
- <breadcrumbs>
- <item name="Applib" href="index.html"/>
- </breadcrumbs>
-
- <menu name="Groovy Applib">
- <item name="About" href="index.html" />
- <item name="Jottings" href="jottings.html" />
- </menu>
-
- <menu name="Groovy Modules">
- <item name="Applib" href="../groovy-applib/index.html" />
- <item name="Metamodel" href="../groovy-metamodel/index.html" />
- </menu>
-
- <menu name="Maven Reports" ref="reports" />
- </body>
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/metamodel/NOTICE
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/metamodel/NOTICE b/framework/progmodels/groovy/metamodel/NOTICE
deleted file mode 100644
index d391f54..0000000
--- a/framework/progmodels/groovy/metamodel/NOTICE
+++ /dev/null
@@ -1,7 +0,0 @@
-Apache Isis
-Copyright 2010-2011 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/metamodel/pom.xml
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/metamodel/pom.xml b/framework/progmodels/groovy/metamodel/pom.xml
deleted file mode 100644
index f468cec..0000000
--- a/framework/progmodels/groovy/metamodel/pom.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?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.progmodels</groupId>
- <artifactId>groovy</artifactId>
- <version>0.3.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>groovy-metamodel</artifactId>
- <name>Groovy ProgModel MetaModel</name>
-
- <properties>
- <siteBaseDir>../../..</siteBaseDir>
- <relativeUrl>progmodels/groovy/metamodel/</relativeUrl>
- </properties>
-
- <!-- used in Site generation for relative references. -->
- <url>http://incubator.apache.org/isis/${relativeUrl}</url>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.progmodels</groupId>
- <artifactId>groovy-applib</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-metamodel</artifactId>
- </dependency>
-
- <!-- is marked as optional in parent, so not exported as a transitive dependency -->
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/metamodel/src/main/java/org/apache/isis/progmodel/groovy/metamodel/RemoveGroovyMethodsFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/metamodel/src/main/java/org/apache/isis/progmodel/groovy/metamodel/RemoveGroovyMethodsFacetFactory.java b/framework/progmodels/groovy/metamodel/src/main/java/org/apache/isis/progmodel/groovy/metamodel/RemoveGroovyMethodsFacetFactory.java
deleted file mode 100644
index c2346af..0000000
--- a/framework/progmodels/groovy/metamodel/src/main/java/org/apache/isis/progmodel/groovy/metamodel/RemoveGroovyMethodsFacetFactory.java
+++ /dev/null
@@ -1,115 +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.groovy.metamodel;
-
-import java.lang.reflect.Method;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.config.IsisConfigurationAware;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facetapi.MethodRemover;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.core.metamodel.methodutils.MethodScope;
-
-public class RemoveGroovyMethodsFacetFactory extends FacetFactoryAbstract implements IsisConfigurationAware {
-
- private static final String DEPTH_KEY = "isis.groovy.depth";
- private static final int DEPTH_DEFAULT = 5;
-
- private IsisConfiguration configuration;
-
- public RemoveGroovyMethodsFacetFactory() {
- super(FeatureType.OBJECTS_ONLY);
- }
-
- static class MethodSpec {
- static class Builder {
-
- private final MethodSpec methodSpec = new MethodSpec();
-
- public Builder param(final Class<?>... paramTypes) {
- methodSpec.parameterTypes = paramTypes;
- return this;
- }
-
- public Builder ret(final Class<?> returnType) {
- methodSpec.returnType = returnType;
- return this;
- }
-
- public MethodSpec build() {
- return methodSpec;
- }
-
- public void remove(final MethodRemover remover) {
- build().removeMethod(remover);
- }
- }
-
- static Builder specFor(final String methodName) {
- final Builder builder = new Builder();
- builder.methodSpec.methodName = methodName;
- return builder;
- }
-
- static Builder specFor(final String formatStr, final Object... args) {
- return specFor(String.format(formatStr, args));
- }
-
- private String methodName;
- private Class<?> returnType = void.class;
- private Class<?>[] parameterTypes = new Class[0];
-
- void removeMethod(final MethodRemover methodRemover) {
- methodRemover.removeMethod(MethodScope.OBJECT, methodName, returnType, parameterTypes);
- }
- }
-
- @Override
- public void process(final ProcessClassContext processClassContext) {
- MethodSpec.specFor("invokeMethod").param(String.class, Object.class).ret(Object.class).remove(processClassContext);
- MethodSpec.specFor("getMetaClass").ret(groovy.lang.MetaClass.class).remove(processClassContext);
- MethodSpec.specFor("setMetaClass").param(groovy.lang.MetaClass.class).remove(processClassContext);
- MethodSpec.specFor("getProperty").param(String.class).ret(Object.class).remove(processClassContext);
-
- final int depth = determineDepth();
- for (int i = 1; i < depth; i++) {
- MethodSpec.specFor("this$dist$invoke$%d", i).param(String.class, Object.class).ret(Object.class).remove(processClassContext);
- MethodSpec.specFor("this$dist$set$%d", i).param(String.class, Object.class).remove(processClassContext);
- MethodSpec.specFor("this$dist$get$%d", i).param(String.class).ret(Object.class).remove(processClassContext);
- }
- final Method[] methods = processClassContext.getCls().getMethods();
- for (final Method method : methods) {
- if (method.getName().startsWith("super$")) {
- processClassContext.removeMethod(method);
- }
- }
- }
-
- private int determineDepth() {
- final int depth = configuration.getInteger(DEPTH_KEY, DEPTH_DEFAULT);
- return depth;
- }
-
- @Override
- public void setConfiguration(final IsisConfiguration configuration) {
- this.configuration = configuration;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/metamodel/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/metamodel/src/site/apt/index.apt b/framework/progmodels/groovy/metamodel/src/site/apt/index.apt
deleted file mode 100644
index 2887427..0000000
--- a/framework/progmodels/groovy/metamodel/src/site/apt/index.apt
+++ /dev/null
@@ -1,28 +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.
-
-Documentation
-
- The <Groovy Objects> metamodel provides the customization required for <Isis> so that it can build the metamodel from
- domain objects written in Groovy.
-
- []
-
- See the {{{../../docbkx/html/guide/isis-progmodels.html}Isis Programming Model user guide}} for more information.
-
-~~ See the {{{../gdocumentation}user guide}} for more information as to how this is configured.
-
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/metamodel/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/metamodel/src/site/apt/jottings.apt b/framework/progmodels/groovy/metamodel/src/site/apt/jottings.apt
deleted file mode 100644
index c5d1200..0000000
--- a/framework/progmodels/groovy/metamodel/src/site/apt/jottings.apt
+++ /dev/null
@@ -1,24 +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.
-
-
-
-Jottings
-
- This page is to capture any random jottings relating to this module prior
- to being moved into formal documentation.
-
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/metamodel/src/site/site.xml
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/metamodel/src/site/site.xml b/framework/progmodels/groovy/metamodel/src/site/site.xml
deleted file mode 100644
index 64831c1..0000000
--- a/framework/progmodels/groovy/metamodel/src/site/site.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<project name="${project.name}">
- <body>
- <breadcrumbs>
- <item name="MetaModel" href="index.html"/>
- </breadcrumbs>
-
- <menu name="Groovy MetaModel">
- <item name="About" href="index.html" />
- <item name="Jottings" href="jottings.html" />
- </menu>
-
- <menu name="Groovy Modules">
- <item name="Applib" href="../groovy-applib/index.html" />
- <item name="Metamodel" href="../groovy-metamodel/index.html" />
- </menu>
-
- <menu name="Maven Reports" ref="reports" />
- </body>
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/cd9f2e4a/framework/progmodels/groovy/pom.xml
----------------------------------------------------------------------
diff --git a/framework/progmodels/groovy/pom.xml b/framework/progmodels/groovy/pom.xml
deleted file mode 100644
index f1f19ee..0000000
--- a/framework/progmodels/groovy/pom.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-<?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/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.isis</groupId>
- <artifactId>isis</artifactId>
- <version>0.3.1-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <groupId>org.apache.isis.progmodels</groupId>
- <artifactId>groovy</artifactId>
-
- <name>Groovy ProgModel</name>
-
- <packaging>pom</packaging>
-
- <properties>
- <siteBaseDir>../..</siteBaseDir>
- <relativeUrl>progmodels/groovy/</relativeUrl>
-
- <groovy.version>2.0.5</groovy.version>
- </properties>
-
- <!-- used in Site generation for relative references. -->
- <url>http://incubator.apache.org/isis/${relativeUrl}</url>
-
- <modules>
- <module>applib</module>
- <module>metamodel</module>
- </modules>
-
- <dependencyManagement>
- <dependencies>
-
- <!-- Groovy Support -->
- <dependency>
- <groupId>org.apache.isis.progmodels</groupId>
- <artifactId>groovy-applib</artifactId>
- <version>0.3.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.progmodels</groupId>
- <artifactId>groovy-metamodel</artifactId>
- <version>0.3.1-SNAPSHOT</version>
- </dependency>
-
- <!-- Apache Isis -->
- <dependency>
- <groupId>org.apache.isis</groupId>
- <artifactId>applib</artifactId>
- <version>0.3.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-metamodel</artifactId>
- <version>0.3.1-SNAPSHOT</version>
- </dependency>
-
- <!-- Groovy -->
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- <version>${groovy.version}</version>
- <scope>compile</scope>
- <optional>true</optional>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
-
-</project>