Tapestry 5
  1. Tapestry 5
  2. TAP5-1565

It should be easier to make a series of contributions to an OrderedConfiguration so that the contributions are in sequential orderer

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.3
    • Fix Version/s: 5.3
    • Component/s: tapestry-ioc
    • Labels:
      None

      Description

      It is not uncommon to have a series of elements to add to an OrderedConfiguration in a specific order; it would be nice if there was a way to add sequential items without manually tracking each nodes name and adding "after:" clauses.

      Example:

      configuration.add("item1", new Item1());
      configuration.addSequential("item2", new Item2());
      configuration.addInstanceSequential("item3", Item3.class);

      This would simply add an "after:item1" ordering constraint for item2, and an "after:item3" constraint for item3.

      It should be legal to add an item sequentially, even if there is no previously added item (added in this contribution method, or elsewhere), in which case, no ordering constraint it added.

      Would "next" and "nextInstance" be better than "addSequential" and "addInstanceSequential"? I'm open to other suggestions on the naming.

        Issue Links

          Activity

          Hide
          Josh Canfield added a comment -

          Instead of adding a new method, can we just consider add(String, Object) to be sequential?

          I can't see that breaking any existing code.

          configuration.add("item1", new Item1());
          configuration.add("item2", new Item2());
          configuration.add("item3", new Item3());
          configuration.add("before2", new Item4(), "before:item2");

          Results in:

          [
          Item1(),
          Item4(),
          Item2(),
          Item3()
          ]

          Show
          Josh Canfield added a comment - Instead of adding a new method, can we just consider add(String, Object) to be sequential? I can't see that breaking any existing code. configuration.add("item1", new Item1()); configuration.add("item2", new Item2()); configuration.add("item3", new Item3()); configuration.add("before2", new Item4(), "before:item2"); Results in: [ Item1(), Item4(), Item2(), Item3() ]
          Hide
          Howard M. Lewis Ship added a comment -

          That's prettty cool ... so no explicit ordering supplies "after last added item, whatever that is". That shouldn't break any existing code, because if you don't specify an ordering constraint, it means you don't care where in the final list it is ordered, and so sequential ordering should be just as good as arbitrary.

          Show
          Howard M. Lewis Ship added a comment - That's prettty cool ... so no explicit ordering supplies "after last added item, whatever that is". That shouldn't break any existing code, because if you don't specify an ordering constraint, it means you don't care where in the final list it is ordered, and so sequential ordering should be just as good as arbitrary.
          Hide
          Robert Zeigler added a comment -

          It probably has the potential to break some code where there are ordering constraints specified, but perhaps not enough to precisely lock down the ordering where it needs to be. I know when upgrading an app from 5.0.x to 5.1.x that I had some situations like that, where my original ordering constraints were suddenly insufficient (I think new services in Tapestry created new ambiguities in the ordering). That said, even given the risk of breaking apps, I would take the implicit ordering over random ordering because it will mean greater ordering stability in the future.

          Show
          Robert Zeigler added a comment - It probably has the potential to break some code where there are ordering constraints specified, but perhaps not enough to precisely lock down the ordering where it needs to be. I know when upgrading an app from 5.0.x to 5.1.x that I had some situations like that, where my original ordering constraints were suddenly insufficient (I think new services in Tapestry created new ambiguities in the ordering). That said, even given the risk of breaking apps, I would take the implicit ordering over random ordering because it will mean greater ordering stability in the future.
          Hide
          Howard M. Lewis Ship added a comment -

          Also, I've updated the wiki.

          Show
          Howard M. Lewis Ship added a comment - Also, I've updated the wiki.
          Hide
          Hudson added a comment -

          Integrated in tapestry-trunk-freestyle #425 (See https://builds.apache.org/job/tapestry-trunk-freestyle/425/)
          TAP5-1565: OrderedConfiguration should have methods to make it easy to add elements in sequential order

          hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1148905
          Files :

          • /tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ValidatingOrderedConfigurationWrapper.java
          • /tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/FredModule.java
          • /tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ValidatingOrderedConfigurationWrapperTest.java
          • /tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java
          • /tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/OrderedConfiguration.java
          Show
          Hudson added a comment - Integrated in tapestry-trunk-freestyle #425 (See https://builds.apache.org/job/tapestry-trunk-freestyle/425/ ) TAP5-1565 : OrderedConfiguration should have methods to make it easy to add elements in sequential order hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1148905 Files : /tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ValidatingOrderedConfigurationWrapper.java /tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/FredModule.java /tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ValidatingOrderedConfigurationWrapperTest.java /tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java /tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/OrderedConfiguration.java
          Hide
          Thiago H. de Paula Figueiredo added a comment -

          Related to TAP5-2358.

          Show
          Thiago H. de Paula Figueiredo added a comment - Related to TAP5-2358 .

            People

            • Assignee:
              Howard M. Lewis Ship
              Reporter:
              Howard M. Lewis Ship
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development