You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2006/07/31 15:56:34 UTC

svn commit: r427117 - in /tapestry/tapestry5/tapestry-core/trunk/src: main/java/org/apache/tapestry/internal/ main/java/org/apache/tapestry/internal/ioc/ main/java/org/apache/tapestry/internal/transform/ main/java/org/apache/tapestry/internal/util/ mai...

Author: hlship
Date: Mon Jul 31 06:56:32 2006
New Revision: 427117

URL: http://svn.apache.org/viewvc?rev=427117&view=rev
Log:
TAPESTRY-1022: Ordering with pre/post requisites could be simplified, improved

Added:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Order.java
      - copied, changed from r426823, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Before.java
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/order.apt
Removed:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/annotations/After.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Before.java
Modified:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/InternalModule.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/DecoratorDefImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/DefaultModuleDefImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/RegistryImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/ValidatingOrderedConfigurationWrapper.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/transform/InternalTransformModule.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/util/Orderer.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/Orderable.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/OrderedConfiguration.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/def/DecoratorDef.java
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/configuration.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/decorator.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/DefaultModuleDefImplTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/ValidatingOrderedConfigurationWrapperTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/transform/ComponentInstantiatorSourceImplTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/util/OrdererTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/BarneyModule.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/FredModule.java

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/InternalModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/InternalModule.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/InternalModule.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/InternalModule.java Mon Jul 31 06:56:32 2006
@@ -18,7 +18,7 @@
 import org.apache.tapestry.annotations.Match;
 import org.apache.tapestry.internal.services.UpdateListenerHub;
 import org.apache.tapestry.internal.services.UpdateListenerHubImpl;
-import org.apache.tapestry.ioc.annotations.Before;
+import org.apache.tapestry.ioc.annotations.Order;
 import org.apache.tapestry.ioc.annotations.Id;
 import org.apache.tapestry.ioc.annotations.InjectService;
 import org.apache.tapestry.ioc.services.LoggingDecorator;
@@ -44,7 +44,7 @@
      */
     @Match(
     { "tapestry.*", "tapestry.*.*" })
-    @Before("*")
+    @Order("before:*.*")
     public <T> T decorateWithLogging(Class<T> serviceInterface, T delegate, String serviceId,
             Log log, @InjectService("tapestry.ioc.LoggingDecorator")
             LoggingDecorator loggingDecorator)

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/DecoratorDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/DecoratorDefImpl.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/DecoratorDefImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/DecoratorDefImpl.java Mon Jul 31 06:56:32 2006
@@ -38,21 +38,17 @@
 {
     private final String _decoratorId;
 
-    private final String _before;
-
-    private final String _after;
-
     private final Method _decoratorMethod;
 
     private final IdMatcher _idMatcher;
 
+    private final String[] _constraints;
+
     @SuppressNullCheck
-    public DecoratorDefImpl(String decoratorId, String before, String after,
-            Method decoratorMethod, String[] patterns)
+    public DecoratorDefImpl(String decoratorId, Method decoratorMethod, String[] patterns,
+            String[] constraints)
     {
         _decoratorId = notBlank(decoratorId, "decoratorId");
-        _before = before;
-        _after = after;
         _decoratorMethod = notNull(decoratorMethod, "decoratorMethod");
 
         List<IdMatcher> matchers = CollectionFactory.newList();
@@ -64,6 +60,8 @@
         }
 
         _idMatcher = new OrIdMatcher(matchers);
+
+        _constraints = constraints != null ? constraints : new String[0];
     }
 
     @Override
@@ -72,14 +70,9 @@
         return InternalUtils.asString(_decoratorMethod);
     }
 
-    public String getAfter()
-    {
-        return _after;
-    }
-
-    public String getBefore()
+    public String[] getConstraints()
     {
-        return _before;
+        return _constraints;
     }
 
     public String getDecoratorId()

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/DefaultModuleDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/DefaultModuleDefImpl.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/DefaultModuleDefImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/DefaultModuleDefImpl.java Mon Jul 31 06:56:32 2006
@@ -29,11 +29,10 @@
 import org.apache.tapestry.ioc.IOCUtilities;
 import org.apache.tapestry.ioc.MappedConfiguration;
 import org.apache.tapestry.ioc.OrderedConfiguration;
-import org.apache.tapestry.ioc.annotations.After;
-import org.apache.tapestry.ioc.annotations.Before;
 import org.apache.tapestry.ioc.annotations.Contribute;
 import org.apache.tapestry.ioc.annotations.Id;
 import org.apache.tapestry.ioc.annotations.Lifecycle;
+import org.apache.tapestry.ioc.annotations.Order;
 import org.apache.tapestry.ioc.annotations.Private;
 import org.apache.tapestry.ioc.def.ContributionDef;
 import org.apache.tapestry.ioc.def.DecoratorDef;
@@ -46,7 +45,6 @@
 import static org.apache.tapestry.internal.ioc.IOCMessages.buildMethodConflict;
 import static org.apache.tapestry.internal.ioc.IOCMessages.buildMethodWrongReturnType;
 import static org.apache.tapestry.internal.ioc.IOCMessages.decoratorMethodWrongReturnType;
-import static org.apache.tapestry.ioc.IOCUtilities.qualifySimpleIdList;
 import static org.apache.tapestry.ioc.IOCUtilities.toQualifiedId;
 import static org.apache.tapestry.util.CollectionFactory.newMap;
 import static org.apache.tapestry.util.CollectionFactory.newSet;
@@ -273,16 +271,13 @@
         // TODO: Check that at least one parameter is type java.lang.Object,
         // since that's how the delegate is passed in.
 
-        After afterAnnotation = method.getAnnotation(After.class);
-        Before beforeAnnotation = method.getAnnotation(Before.class);
+        Order orderAnnotation = method.getAnnotation(Order.class);
         Match match = method.getAnnotation(Match.class);
 
-        String after = afterAnnotation == null ? null : qualifySimpleIdList(
-                _moduleId,
-                afterAnnotation.value());
-        String before = beforeAnnotation == null ? null : qualifySimpleIdList(
-                _moduleId,
-                beforeAnnotation.value());
+        String[] constraints = orderAnnotation != null ? orderAnnotation.value() : null;
+
+        // TODO: Validate constraints here?
+
         String[] patterns = match == null ? new String[]
         { simpleDecoratorId } : match.value();
 
@@ -291,7 +286,7 @@
         for (int i = 0; i < patterns.length; i++)
             patterns[i] = toQualifiedId(_moduleId, patterns[i]);
 
-        DecoratorDef def = new DecoratorDefImpl(id, before, after, method, patterns);
+        DecoratorDef def = new DecoratorDefImpl(id, method, patterns, constraints);
 
         _decoratorDefs.put(id, def);
     }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/RegistryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/RegistryImpl.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/RegistryImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/RegistryImpl.java Mon Jul 31 06:56:32 2006
@@ -61,14 +61,9 @@
             _orderer = orderer;
         }
 
-        public void add(String id, T object, String prerequisites, String postrequisites)
+        public void add(String id, T object, String... constraints)
         {
-            _orderer.add(id, prerequisites, postrequisites, object);
-        }
-
-        public void add(String id, T object)
-        {
-            _orderer.add(id, object);
+            _orderer.add(id, object, constraints);
         }
     }
 
@@ -408,7 +403,7 @@
     {
         for (DecoratorDef df : decorators)
         {
-            orderer.add(df.getDecoratorId(), df.getAfter(), df.getBefore(), df);
+            orderer.add(df.getDecoratorId(), df, df.getConstraints());
         }
     }
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/ValidatingOrderedConfigurationWrapper.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/ValidatingOrderedConfigurationWrapper.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/ValidatingOrderedConfigurationWrapper.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/ioc/ValidatingOrderedConfigurationWrapper.java Mon Jul 31 06:56:32 2006
@@ -19,7 +19,6 @@
 import org.apache.tapestry.ioc.OrderedConfiguration;
 import org.apache.tapestry.ioc.def.ContributionDef;
 
-import static org.apache.tapestry.ioc.IOCUtilities.qualifySimpleIdList;
 import static org.apache.tapestry.ioc.IOCUtilities.toQualifiedId;
 
 /**
@@ -60,19 +59,9 @@
     }
 
     @SuppressNullCheck
-    public void add(String id, T object, String prerequisites, String postrequisites)
+    public void add(String id, T object, String... constraints)
     {
-        _delegate.add(
-                toQualifiedId(_moduleId, id),
-                validVersionOf(object),
-                qualifySimpleIdList(_moduleId, prerequisites),
-                qualifySimpleIdList(_moduleId, postrequisites));
-    }
-
-    @SuppressNullCheck
-    public void add(String id, T object)
-    {
-        _delegate.add(toQualifiedId(_moduleId, id), validVersionOf(object));
+        _delegate.add(toQualifiedId(_moduleId, id), validVersionOf(object), constraints);
     }
 
     private T validVersionOf(T object)

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/transform/InternalTransformModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/transform/InternalTransformModule.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/transform/InternalTransformModule.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/transform/InternalTransformModule.java Mon Jul 31 06:56:32 2006
@@ -38,7 +38,7 @@
             OrderedConfiguration<ComponentClassTransformWorker> configuration)
     {
         configuration.add("Retain", new RetainWorker());
-        configuration.add("UnclaimedField", new UnclaimedFieldWorker(), "*", null);
+        configuration.add("UnclaimedField", new UnclaimedFieldWorker(), "after:*.*");
     }
 
     public ComponentClassTransformer buildComponentClassTransformer(

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/util/Orderer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/util/Orderer.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/util/Orderer.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/util/Orderer.java Mon Jul 31 06:56:32 2006
@@ -14,23 +14,25 @@
 
 package org.apache.tapestry.internal.util;
 
-import static org.apache.tapestry.util.CollectionFactory.newList;
-import static org.apache.tapestry.util.CollectionFactory.newMap;
-
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
-import org.apache.hivemind.util.StringUtils;
 import org.apache.tapestry.internal.annotations.OneShot;
 import org.apache.tapestry.internal.annotations.SuppressNullCheck;
+import org.apache.tapestry.ioc.IOCUtilities;
+import org.apache.tapestry.ioc.IdMatcher;
+import org.apache.tapestry.ioc.IdMatcherImpl;
+import org.apache.tapestry.ioc.OrIdMatcher;
 import org.apache.tapestry.ioc.Orderable;
 
+import static org.apache.tapestry.util.CollectionFactory.newList;
+import static org.apache.tapestry.util.CollectionFactory.newMap;
+
 /**
  * Used to order objects into an "execution" order. Each object must have a unique id. It may
- * specify a list of pre-requisites (objects that must preceded it in the ordered list, i.e.,
- * "after") and a list of post-requisites (objects which must follow it in the ordered list, i.e.,
- * "before").
+ * specify a list of constraints which identify the ordering of the objects.
  */
 @OneShot
 public class Orderer<T>
@@ -43,10 +45,35 @@
 
     private final Map<String, DependencyNode<T>> _dependencyNodesById = newMap();
 
-    private DependencyNode<T> _leader;
-
     private DependencyNode<T> _trailer;
 
+    interface DependencyLinker<T>
+    {
+        void link(DependencyNode<T> source, DependencyNode<T> target);
+    }
+
+    // before: source is added as a dependency of target, so source will
+    // appear before target.
+
+    final DependencyLinker<T> _before = new DependencyLinker<T>()
+    {
+        public void link(DependencyNode<T> source, DependencyNode<T> target)
+        {
+            target.addDependency(source);
+        }
+    };
+
+    // after: target is added as a dependency of source, so source will appear
+    // after target.
+
+    final DependencyLinker<T> _after = new DependencyLinker<T>()
+    {
+        public void link(DependencyNode<T> source, DependencyNode<T> target)
+        {
+            source.addDependency(target);
+        }
+    };
+
     public Orderer(Log log)
     {
         _log = log;
@@ -68,15 +95,9 @@
     }
 
     @SuppressNullCheck
-    public void add(String id, T target)
-    {
-        add(new Orderable<T>(id, target));
-    }
-
-    @SuppressNullCheck
-    public void add(String id, String prereqs, String postreqs, T target)
+    public void add(String id, T target, String... constraints)
     {
-        add(new Orderable<T>(id, target, prereqs, postreqs));
+        add(new Orderable<T>(id, target, constraints));
     }
 
     @OneShot.Lockdown
@@ -101,13 +122,9 @@
 
     private void initializeGraph()
     {
-        addNodes();
-
-        if (_leader == null)
-            _leader = new DependencyNode<T>(_log, new Orderable<T>("*-leader-*", null));
+        _trailer = new DependencyNode<T>(_log, new Orderable<T>("*-trailer-*", null));
 
-        if (_trailer == null)
-            _trailer = new DependencyNode<T>(_log, new Orderable<T>("*-trailer-*", null));
+        addNodes();
 
         addDependencies();
     }
@@ -120,26 +137,7 @@
 
             _dependencyNodesById.put(orderable.getId(), node);
 
-            if ("*".equals(orderable.getPostreqs()))
-            {
-                if (_leader == null)
-                    _leader = node;
-                else
-                {
-                    _log.warn(UtilMessages.duplicateLeader(node, _leader), null);
-                }
-            }
-
-            if ("*".equals(orderable.getPrereqs()))
-            {
-                if (_trailer == null)
-                    _trailer = node;
-                else
-                {
-                    _log.warn(UtilMessages.duplicateTrailer(node, _trailer), null);
-                }
-            }
-
+            _trailer.addDependency(node);
         }
     }
 
@@ -153,70 +151,69 @@
 
     private void addDependencies(Orderable<T> orderable)
     {
-        DependencyNode<T> node = _dependencyNodesById.get(orderable.getId());
-
-        addPreRequisites(orderable, node);
-        addPostRequisites(orderable, node);
+        String sourceId = orderable.getId();
 
-        // The leader node is dependened upon by every other
-        // node.
-
-        if (node != _leader)
-            node.addDependency(_leader);
+        for (String constraint : orderable.getConstraints())
+        {
+            addDependencies(sourceId, constraint);
+        }
+    }
 
-        // The trailer dependes upon every other node.
+    private void addDependencies(String sourceId, String constraint)
+    {
+        int colonx = constraint.indexOf(':');
+        String type = constraint.substring(0, colonx);
+        String patternList = constraint.substring(colonx + 1);
 
-        if (node != _trailer)
-            _trailer.addDependency(node);
+        DependencyLinker<T> linker = type.equals("after") ? _after : _before;
 
+        linkNodes(sourceId, patternList, linker);
     }
 
-    private void addPreRequisites(Orderable<T> orderable, DependencyNode<T> node)
+    private void linkNodes(String sourceId, String patternList, DependencyLinker linker)
     {
-        String prereqs = orderable.getPrereqs();
+        Collection<DependencyNode<T>> nodes = findDependencies(sourceId, patternList);
 
-        if ("*".equals(prereqs))
-            return;
+        DependencyNode<T> source = _dependencyNodesById.get(sourceId);
 
-        for (String id : StringUtils.split(prereqs))
+        for (DependencyNode<T> target : nodes)
         {
-            DependencyNode<T> dependency = _dependencyNodesById.get(id);
-
-            if (dependency == null)
-            {
-                return;
-            }
-            else
-            {
-                // id is a pre-requisite of the node, so add the dependency
-                // to the node.
-                node.addDependency(dependency);
-            }
+            linker.link(source, target);
         }
     }
 
-    private void addPostRequisites(Orderable<T> orderable, DependencyNode<T> node)
+    private Collection<DependencyNode<T>> findDependencies(String sourceId, String patternList)
     {
-        String postreqs = orderable.getPostreqs();
+        String sourceModuleId = IOCUtilities.extractModuleId(sourceId);
 
-        if ("*".equals(postreqs))
-            return;
+        IdMatcher matcher = buildMatcherForPattern(sourceModuleId, patternList);
 
-        for (String id : StringUtils.split(postreqs))
+        Collection<DependencyNode<T>> result = newList();
+
+        for (String id : _dependencyNodesById.keySet())
         {
-            DependencyNode<T> dependant = _dependencyNodesById.get(id);
+            if (sourceId.equals(id))
+                continue;
 
-            if (dependant == null)
-            {
-                // TODO!
-            }
-            else
-            {
-                // id is a post-requisite, so we reverse it, and make the
-                // node identify by id dependent on this node.
-                dependant.addDependency(node);
-            }
+            if (matcher.matches(id))
+                result.add(_dependencyNodesById.get(id));
         }
+
+        return result;
     }
 
+    private IdMatcher buildMatcherForPattern(String sourceModuleId, String patternList)
+    {
+        List<IdMatcher> matchers = newList();
+
+        for (String pattern : patternList.split(","))
+        {
+            IdMatcher matcher = new IdMatcherImpl(IOCUtilities.toQualifiedId(
+                    sourceModuleId,
+                    pattern.trim()));
+            matchers.add(matcher);
+        }
+
+        return matchers.size() == 1 ? matchers.get(0) : new OrIdMatcher(matchers);
+    }
 }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/Orderable.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/Orderable.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/Orderable.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/Orderable.java Mon Jul 31 06:56:32 2006
@@ -14,13 +14,10 @@
 
 package org.apache.tapestry.ioc;
 
-import static org.apache.tapestry.util.Defense.notBlank;
-
-import java.io.Serializable;
-
-import org.apache.hivemind.HiveMind;
 import org.apache.tapestry.internal.annotations.SuppressNullCheck;
 
+import static org.apache.tapestry.util.Defense.notBlank;
+
 /**
  * A wrapper that allows objects of a target type to be ordered. Each Orderable object is given a
  * unique id and a set of pre-requisites (objects which should be ordered earlier) and
@@ -28,42 +25,27 @@
  * 
  * @param <T>
  */
-public class Orderable<T> implements Serializable
+public class Orderable<T>
 {
-    private static final long serialVersionUID = -5133760853920427942L;
-
     private final String _id;
 
-    private final String _prereqs;
-
-    private final String _postreqs;
-
     private final T _target;
 
+    private final String[] _constraints;
+
     /**
      * @param id
      *            unique identifier for the target object
      * @param target
      *            the object to be ordered; this may also be null (in which case the id represents a
      *            placeholder)
-     * @param prereqs
-     *            list of preceding objects, or "*" to order this object last, or null to not care
-     * @param postreqs
-     *            list of following objects, or "*" to order this object last, or null to not care
      */
     @SuppressNullCheck
-    public Orderable(String id, T target, String prereqs, String postreqs)
+    public Orderable(String id, T target, String... constraints)
     {
         _id = notBlank(id, "id");
-        _prereqs = prereqs;
-        _postreqs = postreqs;
         _target = target;
-    }
-
-    @SuppressNullCheck
-    public Orderable(String id, T target)
-    {
-        this(id, target, null, null);
+        _constraints = constraints;
     }
 
     public String getId()
@@ -71,19 +53,14 @@
         return _id;
     }
 
-    public String getPostreqs()
-    {
-        return _postreqs;
-    }
-
-    public String getPrereqs()
+    public T getTarget()
     {
-        return _prereqs;
+        return _target;
     }
 
-    public T getTarget()
+    public String[] getConstraints()
     {
-        return _target;
+        return _constraints;
     }
 
     @Override
@@ -93,16 +70,10 @@
 
         buffer.append(_id);
 
-        if (HiveMind.isNonBlank(_prereqs))
-        {
-            buffer.append(" pre:");
-            buffer.append(_prereqs);
-        }
-
-        if (HiveMind.isNonBlank(_postreqs))
+        for (String c : _constraints)
         {
-            buffer.append(" post:");
-            buffer.append(_postreqs);
+            buffer.append(" ");
+            buffer.append(c);
         }
 
         buffer.append(" ");

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/OrderedConfiguration.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/OrderedConfiguration.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/OrderedConfiguration.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/OrderedConfiguration.java Mon Jul 31 06:56:32 2006
@@ -42,21 +42,8 @@
      *            a unique id for the object; the id will be fully qualified with the contributing
      *            module's id
      * @parm object to add to the service's configuration
-     * @param prerequisites
-     *            comma separated list of ids, or "*", or null (aka "after")
-     * @param postrequisites
-     *            comma separated list of ids, or, "*", or null (aka "before")
+     * @param constraints
+     *            used to order the object relative to other contributed objects
      */
-    void add(String id, T object, String prerequisites, String postrequisites);
-
-    /**
-     * Simplified version of {@link #add(String, T, String, String)} that assumes null for the pre-
-     * and post-requisites.
-     * 
-     * @param id
-     *            a unique id for the object; the id will be fully qualified with the contributing
-     *            module's id
-     * @parm object to add to the service's configuration
-     */
-    void add(String id, T object);
+    void add(String id, T object, String... constraints);
 }

Copied: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Order.java (from r426823, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Before.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Order.java?p2=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Order.java&p1=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Before.java&r1=426823&r2=427117&rev=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Before.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Order.java Mon Jul 31 06:56:32 2006
@@ -31,11 +31,9 @@
 @Target(METHOD)
 @Retention(RUNTIME)
 @Documented
-public @interface Before {
+public @interface Order {
     /**
-     * A comma separated list of ids. Ids that are simple (unqualified) will be qualified with the
-     * appropriate module id. Alternately, the value "*" may be used to indicate the method should
-     * be ordered last.
+     * Any number of ordering constraint strings.
      */
-    String value();
+    String[] value();
 }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/def/DecoratorDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/def/DecoratorDef.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/def/DecoratorDef.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ioc/def/DecoratorDef.java Mon Jul 31 06:56:32 2006
@@ -24,8 +24,8 @@
  * Thus, if logging should occur before security checks, and security checks should occur before
  * transaction management, then the desired decorator order is Logging, Security, Transactions. This
  * might be specified as having Security occur after Logging, and Transactions occur after Security.
- * It might also be specified by having Logging occur before "*", and Transactions occur after "*",
- * with no specified scheduling for Security.
+ * It might also be specified by having Logging occur before "*.*", and Transactions occur after
+ * "*.*", with no specified scheduling for Security.
  * <p>
  * Once this order is established, decorators are <em>applied</em> in reverse order. Each
  * decorator's job is to create an <em>interceptor</em> for the service, that delegates to the
@@ -50,18 +50,11 @@
     String getDecoratorId();
 
     /**
-     * Returns a comma-seperated list of decorators who should precede this decorator. May also
-     * return "*" to indicate that this decorator is always last. May return an empty string.
+     * Returns zero or more ordering constraint strings, used to order the decorated relative to the
+     * other decorators.
      */
 
-    String getBefore();
-
-    /**
-     * Returns a comma-seperated list of decorators who should follow this decorator. May also
-     * return a "*" to indicate that this decorator is always first. May return an empty string.
-     */
-
-    String getAfter();
+    String[] getConstraints();
 
     /**
      * Creates an object that can perform the decoration (in the default case, by invoking the
@@ -87,6 +80,4 @@
      * @return true if the decorator applies to the service
      */
     boolean matches(ServiceDef serviceDef);
-
-    // TODO: Filtering information ... what modules and services are decorated by the decorator
 }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/configuration.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/configuration.apt?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/configuration.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/configuration.apt Mon Jul 31 06:56:32 2006
@@ -156,6 +156,7 @@
   Tapestry supports only this simple form of parameterized types.  Java generics supports a wider
   form, "wildcards", that Tapestry doesn't understand.
   
+{ordered}  
 * Ordered List
 
   Ordered lists are much more common. With an ordered list, the contributions are sorted into a
@@ -196,7 +197,7 @@
   public void contributeStartups(OrderedConfiguration<Runnable> configuration)
   {
     configuration.add("JMS", new JMSStartup());
-    configuration.add("FileSystem", new FileSystemStartup(), "some.other.module.ClassLoader", null);
+    configuration.add("FileSystem", new FileSystemStartup(), "after:*.CacheSetup");
   }    
 +------+
   
@@ -204,9 +205,11 @@
   provide will be prefixed with the contributing module's id.  The ordering algorithm will find a spot for the
   object (here the JMSStartup instance) based on the constraints of other contributed objects.
   
-  The second form is more specific, it allows pre-requisites and post-requisites. Each is a comma
-  separated list of ids.  Unqualified ids in the list will be qualified with the <contributing> module's id.
-  As elsewhere, you may use the value "*" to indicate the item must be last or first in the list.
+  For the "FileSystem" contribution, a constraint has been specified, indicating
+  that FileSystem should be ordered after some other contribution named "CacheSetup"
+  in an unspecified module (the "*" part).  Any number of such
+  {{{order.html}ordering constraints}} may be specified (the add() method accepts
+  a variable number of arguments).
   
   The object passed in may be null; this is valid, and is considered a "join point": points of reference in the
   list that don't actually have any meaning of their own, but can be used when ordering other elements.

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/decorator.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/decorator.apt?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/decorator.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/decorator.apt Mon Jul 31 06:56:32 2006
@@ -184,35 +184,19 @@
 Ordering of Decorators
 
    In cases where multiple decorators will apply to a single service, you can control
-   the order in which decorators are applied using two additional annotations:
-   {{{../apidocs/org/apache/tapestry/ioc/annotations/Before.html}@Before}} and 
-   {{{../apidocs/org/apache/tapestry/ioc/annotations/After.html}@After}}.
+   the order in which decorators are applied using  an additional annotation:
+   {{{../apidocs/org/apache/tapestry/ioc/annotations/Order.html}@Order}}.
    
-   For each annotation, the value is a string containing a comma-separated list of
-   decorator ids.  The ids can be unqualified (if within the same module) or fully qualified
-   (if within another module).
+   This annotation allows any number of {{{order.html}ordering constraints}}
+   to be specified for the decorator, to order it relative to
+   any other decorators.
    
-   The value can also be "*" to force the decorator to be applied first (with @Before)
-   or last (with @After).
-   
-   For example, say you had decorators for logging, security checks, transaction management,
-   and request timing (to report on how long method invocations were taking).
-   It makes sense that logging should come first, so the logging decorator method would
-   use <<<@Before("*")>>>.  Likewise, timing should come before security checks and the rest
-   (because we want to account for the time it takes to make those checks and to manage those
-   transactions), so we might see
-   <<<@Before("Security")>>> on the timing decorator.  Starting and committing transactions
-   is likely the last thing to occur before invoking the core service implementation,
-   so we'll use <<<@After("*")>>> on its decorator method.
-    
-   If you reference services that don't exist, you will see warnings logged to the console
-   (or log file) as your services are decorated.
-   
-   Note: the ordering of decorators is in terms of the <effect> desired. In the previous 
+   <<Note:>> the ordering of decorators is in terms of the <effect> desired. In the previous 
    example, the order of the effects is logging, then timing, then security, then transactions
    (then the core service implementation). Internally, the decorators are invoked
    last to first (since each once receives the "next" interceptor as its delegate).
    So the core service implementation is created (via a service builder method)
    and that is passed to the transaction decorator method. The interceptor created there
    is passed to the the security decorator, and so forth.
+
     

Added: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/order.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/order.apt?rev=427117&view=auto
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/order.apt (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/ioc/order.apt Mon Jul 31 06:56:32 2006
@@ -0,0 +1,22 @@
+ ----
+ Ordering by Constraints
+ ----
+ 
+Ordering by Constraints
+
+  Tapestry IoC has two specific areas where it must put some form of contribution into
+  a specific order:
+  
+  * {{{configuration.html#ordered}Ordered Configurations}, where different modules
+    may contribute into a service's configuration
+    
+  * {{{decorator.html}Service Decorators} which must be applied to services from 
+    a number of modules.
+    
+  []
+  
+  In both these cases, objects (either contributions to a configuration, or decorators)
+  are assigning qualified ids, simple ids qualified with the containing/contributing
+  module's id.
+  
+  
\ No newline at end of file

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml Mon Jul 31 06:56:32 2006
@@ -56,6 +56,7 @@
             <item name="Services" href="ioc/service.html"/>
             <item name="Decorators" href="ioc/decorator.html"/>
             <item name="Configuration" href="ioc/configuration.html"/>
+            <item name="Ordering" href="ioc/order.html"/>
             <item name="Chain Of Command" href="ioc/command.html"/>
         </menu>
                 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/DefaultModuleDefImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/DefaultModuleDefImplTest.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/DefaultModuleDefImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/DefaultModuleDefImplTest.java Mon Jul 31 06:56:32 2006
@@ -120,8 +120,6 @@
         DecoratorDef dd = defs.iterator().next();
 
         assertEquals(dd.getDecoratorId(), "ioc.Logging");
-        assertNull(dd.getAfter());
-        assertNull(dd.getBefore());
         assertEquals(dd.toString(), className + ".decorateLogging(Class, Object)");
 
         verify();

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/ValidatingOrderedConfigurationWrapperTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/ValidatingOrderedConfigurationWrapperTest.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/ValidatingOrderedConfigurationWrapperTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/ioc/ValidatingOrderedConfigurationWrapperTest.java Mon Jul 31 06:56:32 2006
@@ -35,14 +35,14 @@
         OrderedConfiguration<Runnable> configuration = newOrderedConfiguration();
         Runnable contribution = newRunnable();
 
-        configuration.add("fred.id", contribution, "fred.pre", "fred.post");
+        configuration.add("fred.id", contribution, "after:fred.pre", "before:fred.post");
 
         replay();
 
         OrderedConfiguration<Runnable> wrapper = new ValidatingOrderedConfigurationWrapper<Runnable>(
                 "barney.Service", "fred", def, log, Runnable.class, configuration);
 
-        wrapper.add("id", contribution, "pre", "post");
+        wrapper.add("id", contribution, "after:fred.pre", "before:fred.post");
 
         verify();
     }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/transform/ComponentInstantiatorSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/transform/ComponentInstantiatorSourceImplTest.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/transform/ComponentInstantiatorSourceImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/transform/ComponentInstantiatorSourceImplTest.java Mon Jul 31 06:56:32 2006
@@ -51,8 +51,9 @@
 import static org.testng.Assert.assertNull;
 
 /**
- * Tests for {@link org.apache.tapestry.internal.transform.ComponentInstantiatorSourceImpl}. Many
- * of these tests are more of the form of integration tests that instantiate the HiveMind Registry.
+ * Tests for {@link org.apache.tapestry.internal.transform.ComponentInstantiatorSourceImpl}.
+ * Several of these tests are more of the form of integration tests that instantiate the Tapestry
+ * IoC Registry.
  * 
  * @author Howard M. Lewis Ship
  */
@@ -170,7 +171,7 @@
 
         // Detect the change and clear out the internal caches
 
-        UpdateListenerHub hub = (UpdateListenerHub) _registry.getService(
+        UpdateListenerHub hub = _registry.getService(
                 "tapestry.internal.services.UpdateListenerHub",
                 UpdateListenerHub.class);
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/util/OrdererTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/util/OrdererTest.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/util/OrdererTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/util/OrdererTest.java Mon Jul 31 06:56:32 2006
@@ -82,24 +82,24 @@
 
         Orderer<String> o = new Orderer<String>(log);
 
-        o.add("fred", "FRED");
-        o.add("barney", "BARNEY");
-        o.add("wilma", "WILMA");
+        o.add("foo.fred", "FRED");
+        o.add("foo.barney", "BARNEY");
+        o.add("foo.wilma", "WILMA");
 
         verify();
 
-        log.warn("Could not add object with duplicate id 'fred'.  "
+        log.warn("Could not add object with duplicate id 'foo.fred'.  "
                 + "The duplicate object has been ignored.", null);
 
         replay();
 
-        o.add("fred", "FRED2");
+        o.add("foo.fred", "FRED2");
 
         verify();
 
         replay();
 
-        o.add("betty", "BETTY");
+        o.add("foo.betty", "BETTY");
 
         List<String> ordered = o.getOrdered();
 
@@ -117,10 +117,10 @@
 
         Orderer<String> o = new Orderer<String>(log);
 
-        o.add("fred", "FRED");
-        o.add("barney", null, "*", "BARNEY");
-        o.add("wilma", "WILMA");
-        o.add("betty", "BETTY");
+        o.add("foo.fred", "FRED");
+        o.add("foo.barney", "BARNEY", "before:*.*");
+        o.add("foo.wilma", "WILMA");
+        o.add("foo.betty", "BETTY");
 
         List<String> ordered = o.getOrdered();
 
@@ -138,68 +138,41 @@
 
         Orderer<String> o = new Orderer<String>(log);
 
-        o.add("fred", "FRED");
-        o.add("barney", "*", null, "BARNEY");
-        o.add("wilma", "WILMA");
-        o.add("betty", "BETTY");
+        o.add("foo.fred", "FRED");
+        o.add("foo.barney", "BARNEY", "after:*");
+        o.add("foo.wilma", "WILMA");
+        o.add("foo.betty", "BETTY");
 
         List<String> ordered = o.getOrdered();
 
-        assertEquals(ordered, Arrays.asList("FRED", "WILMA", "BETTY", "BARNEY"));
+        assertEquals(ordered.get(3), "BARNEY");
 
         verify();
     }
 
     @Test
-    public void duplicate_trailer()
-    {
-        Log log = newLog();
-
-        log.warn("Could not set 'wilma' as the last object, "
-                + "because 'barney' has already been set.", null);
-
-        replay();
-
-        Orderer<String> o = new Orderer<String>(log);
-
-        o.add("fred", "FRED");
-        o.add("barney", "*", null, "BARNEY");
-        o.add("wilma", "*", null, "WILMA");
-        o.add("betty", "BETTY");
-
-        List<String> ordered = o.getOrdered();
-
-        assertEquals(ordered, Arrays.asList("FRED", "WILMA", "BETTY", "BARNEY"));
-
-        verify();
-    }
-
-    @Test
-    public void duplicate_leader()
+    public void prereqs()
     {
         Log log = newLog();
 
-        log.warn("Could not set 'wilma' as the first object, "
-                + "because 'barney' has already been set.", null);
-
         replay();
 
         Orderer<String> o = new Orderer<String>(log);
 
-        o.add("fred", "FRED");
-        o.add("barney", null, "*", "BARNEY");
-        o.add("wilma", null, "*", "WILMA");
-        o.add("betty", "BETTY");
+        o.add("foo.fred", "FRED", "after:wilma");
+        o.add("foo.barney", "BARNEY", "after:fred,betty");
+        o.add("foo.wilma", "WILMA");
+        o.add("foo.betty", "BETTY");
 
         List<String> ordered = o.getOrdered();
 
-        assertEquals(ordered, Arrays.asList("BARNEY", "FRED", "WILMA", "BETTY"));
+        assertEquals(ordered, Arrays.asList("WILMA", "FRED", "BETTY", "BARNEY"));
 
         verify();
     }
 
     @Test
-    public void prereqs()
+    public void pre_and_post_reqs()
     {
         Log log = newLog();
 
@@ -207,20 +180,20 @@
 
         Orderer<String> o = new Orderer<String>(log);
 
-        o.add("fred", "wilma", null, "FRED");
-        o.add("barney", "fred,betty", null, "BARNEY");
-        o.add("wilma", "WILMA");
-        o.add("betty", "BETTY");
+        o.add("foo.fred", "FRED", "after:wilma");
+        o.add("foo.barney", "BARNEY", "after:fred,betty");
+        o.add("foo.wilma", "WILMA");
+        o.add("foo.betty", "BETTY", "before:wilma");
 
         List<String> ordered = o.getOrdered();
 
-        assertEquals(ordered, Arrays.asList("WILMA", "FRED", "BETTY", "BARNEY"));
+        assertEquals(ordered, Arrays.asList("BETTY", "WILMA", "FRED", "BARNEY"));
 
         verify();
     }
 
     @Test
-    public void pre_and_post_reqs()
+    public void cross_module()
     {
         Log log = newLog();
 
@@ -228,10 +201,10 @@
 
         Orderer<String> o = new Orderer<String>(log);
 
-        o.add("fred", "wilma", null, "FRED");
-        o.add("barney", "fred,betty", null, "BARNEY");
-        o.add("wilma", "WILMA");
-        o.add("betty", null, "wilma", "BETTY");
+        o.add("foo.fred", "FRED", "after:*.wilma");
+        o.add("bar.barney", "BARNEY", "after:*.fred,*.betty");
+        o.add("baz.wilma", "WILMA");
+        o.add("biff.betty", "BETTY", "before:baz.*");
 
         List<String> ordered = o.getOrdered();
 
@@ -245,18 +218,18 @@
     {
         Log log = newLog();
 
-        log.warn("Unable to add 'barney' as a dependency of 'betty', as that forms a "
-                + "dependency cycle ('betty' depends on itself via 'barney'). "
+        log.warn("Unable to add 'foo.barney' as a dependency of 'foo.betty', as that forms a "
+                + "dependency cycle ('foo.betty' depends on itself via 'foo.barney'). "
                 + "The dependency has been ignored.", null);
 
         replay();
 
         Orderer<String> o = new Orderer<String>(log);
 
-        o.add("fred", "wilma", null, "FRED");
-        o.add("barney", "fred,betty", null, "BARNEY");
-        o.add("wilma", "WILMA");
-        o.add("betty", "barney", "wilma", "BETTY");
+        o.add("foo.fred", "FRED", "after:wilma");
+        o.add("foo.barney", "BARNEY", "after:fred,betty");
+        o.add("foo.wilma", "WILMA");
+        o.add("foo.betty", "BETTY", "after:barney", "before:wilma");
 
         List<String> ordered = o.getOrdered();
 
@@ -272,9 +245,10 @@
 
         assertEquals(simple.toString(), "Orderable[simple SIMPLE]");
 
-        Orderable<String> complex = new Orderable<String>("complex", "COMPLEX", "pre", "post");
+        Orderable<String> complex = new Orderable<String>("complex", "COMPLEX", "after:foo",
+                "before:bar");
 
-        assertEquals(complex.toString(), "Orderable[complex pre:pre post:post COMPLEX]");
+        assertEquals(complex.toString(), "Orderable[complex after:foo before:bar COMPLEX]");
     }
 
     @Test

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/BarneyModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/BarneyModule.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/BarneyModule.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/BarneyModule.java Mon Jul 31 06:56:32 2006
@@ -21,9 +21,9 @@
 
 import org.apache.tapestry.annotations.Match;
 import org.apache.tapestry.internal.annotations.SuppressNullCheck;
-import org.apache.tapestry.ioc.annotations.After;
 import org.apache.tapestry.ioc.annotations.Contribute;
 import org.apache.tapestry.ioc.annotations.Id;
+import org.apache.tapestry.ioc.annotations.Order;
 
 import static org.apache.tapestry.util.CollectionFactory.newList;
 
@@ -37,7 +37,7 @@
 public class BarneyModule
 {
     @Match("fred.*")
-    @After("fred.Beta")
+    @Order("after:fred.Beta")
     public Object decorateGamma(Object delegate, DecoratorList list)
     {
         list.add("gamma");
@@ -53,7 +53,7 @@
             {
                 if (object == null)
                     return 0;
-                
+
                 Sizer sizer = configuration.get(object.getClass());
 
                 if (sizer != null)

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/FredModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/FredModule.java?rev=427117&r1=427116&r2=427117&view=diff
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/FredModule.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ioc/FredModule.java Mon Jul 31 06:56:32 2006
@@ -19,7 +19,7 @@
 import java.util.List;
 
 import org.apache.tapestry.annotations.Match;
-import org.apache.tapestry.ioc.annotations.Before;
+import org.apache.tapestry.ioc.annotations.Order;
 import org.apache.tapestry.ioc.annotations.Contribute;
 import org.apache.tapestry.ioc.annotations.Id;
 import org.apache.tapestry.ioc.annotations.InjectService;
@@ -64,7 +64,7 @@
     }
 
     @Match("fred.*")
-    @Before("Beta")
+    @Order("before:Beta")
     public Object decorateAlpha(Object delegate, DecoratorList list)
     {
         list.add("alpha");
@@ -114,7 +114,7 @@
     {
         // Order "FRED" after "BARNEY"
 
-        configuration.add("fred", "FRED", "barney", null);
+        configuration.add("fred", "FRED", "after:barney");
         configuration.add("barney", "BARNEY");
     }