incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1098755 [2/2] - in /incubator/isis/trunk/progmodels/wrapper: applib/src/main/java/org/apache/isis/progmodel/wrapper/applib/ applib/src/main/java/org/apache/isis/progmodel/wrapper/applib/listeners/ metamodel/src/main/java/org/apache/isis/pr...
Date Mon, 02 May 2011 19:21:56 GMT
Modified: incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/Proxy.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/Proxy.java?rev=1098755&r1=1098754&r2=1098755&view=diff
==============================================================================
--- incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/Proxy.java
(original)
+++ incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/Proxy.java
Mon May  2 19:21:55 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.progmodel.wrapper.metamodel.internal;
 
 import java.util.Collection;
@@ -31,19 +30,15 @@ import org.apache.isis.core.metamodel.sp
 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 embeddedViewer,
-            final ExecutionMode mode, 
-            final AuthenticationSessionProvider authenticationSessionProvider, 
-            final SpecificationLookup specificationLookup, 
-            final AdapterMap adapterManager,
-            final ObjectPersistor objectPersistor) {
-        final DomainObjectInvocationHandler<T> invocationHandler = 
-        	new DomainObjectInvocationHandler<T>(domainObject, embeddedViewer, mode, authenticationSessionProvider,
specificationLookup, adapterManager, objectPersistor);
+    public static <T> T proxy(final T domainObject, final WrapperFactory embeddedViewer,
final ExecutionMode mode,
+        final AuthenticationSessionProvider authenticationSessionProvider,
+        final SpecificationLookup specificationLookup, final AdapterMap adapterManager,
+        final ObjectPersistor objectPersistor) {
+        final DomainObjectInvocationHandler<T> invocationHandler =
+            new DomainObjectInvocationHandler<T>(domainObject, embeddedViewer, mode,
authenticationSessionProvider,
+                specificationLookup, adapterManager, objectPersistor);
 
         final CgLibProxy<T> cglibProxy = new CgLibProxy<T>(invocationHandler);
         return cglibProxy.proxy();
@@ -52,15 +47,11 @@ public class 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);
+    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);
@@ -70,14 +61,11 @@ public class 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) {
+    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);
+        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);

Modified: incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/RuntimeExceptionWrapper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/RuntimeExceptionWrapper.java?rev=1098755&r1=1098754&r2=1098755&view=diff
==============================================================================
--- incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/RuntimeExceptionWrapper.java
(original)
+++ incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/RuntimeExceptionWrapper.java
Mon May  2 19:21:55 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.progmodel.wrapper.metamodel.internal;
 
 public class RuntimeExceptionWrapper extends RuntimeException {

Modified: incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/WrapperFactoryDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/WrapperFactoryDefault.java?rev=1098755&r1=1098754&r2=1098755&view=diff
==============================================================================
--- incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/WrapperFactoryDefault.java
(original)
+++ incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/WrapperFactoryDefault.java
Mon May  2 19:21:55 2011
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.progmodel.wrapper.metamodel.internal;
 
-package org.apache.isis.progmodel.wrapper.metamodel.internal;
-
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -53,227 +52,238 @@ import org.apache.isis.core.metamodel.sp
 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,
SpecificationLookupAware, AdapterMapAware, 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 SpecificationLookup specificationLookup; 
+
+public class WrapperFactoryDefault implements WrapperFactory, AuthenticationSessionProviderAware,
+    SpecificationLookupAware, AdapterMapAware, 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 SpecificationLookup specificationLookup;
     private AdapterMap 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, 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);
-    }
-
+
+    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(AuthenticationSessionProvider authenticationSessionProvider)
{
+    public void setAuthenticationSessionProvider(final AuthenticationSessionProvider authenticationSessionProvider)
{
         this.authenticationSessionProvider = authenticationSessionProvider;
     }
-    
+
     @Override
-    public void setAdapterMap(AdapterMap adapterManager) {
+    public void setAdapterMap(final AdapterMap adapterManager) {
         this.adapterManager = adapterManager;
     }
-    
+
     @Override
-    public void setSpecificationLookup(SpecificationLookup specificationLookup) {
+    public void setSpecificationLookup(final SpecificationLookup specificationLookup) {
         this.specificationLookup = specificationLookup;
     }
 
     @Override
-    public void setObjectPersistor(ObjectPersistor objectPersistor) {
+    public void setObjectPersistor(final ObjectPersistor objectPersistor) {
         this.objectPersistor = objectPersistor;
     }
-    
-}
+
+}

Modified: incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/Constants.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/Constants.java?rev=1098755&r1=1098754&r2=1098755&view=diff
==============================================================================
--- incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/Constants.java
(original)
+++ incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/Constants.java
Mon May  2 19:21:55 2011
@@ -17,43 +17,41 @@
  *  under the License.
  */
 
+package org.apache.isis.progmodel.wrapper.metamodel.internal.util;
 
-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, };
-
-
-}
+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, };
+
+}

Modified: incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/MethodPrefixFinder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/MethodPrefixFinder.java?rev=1098755&r1=1098754&r2=1098755&view=diff
==============================================================================
--- incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/MethodPrefixFinder.java
(original)
+++ incubator/isis/trunk/progmodels/wrapper/metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/util/MethodPrefixFinder.java
Mon May  2 19:21:55 2011
@@ -17,35 +17,32 @@
  *  under the License.
  */
 
+package org.apache.isis.progmodel.wrapper.metamodel.internal.util;
 
-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 "";
-    }
-
-}
+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 "";
+    }
+
+}



Mime
View raw message