NanoContainer
  1. NanoContainer
  2. NANO-186

NanoContainer XMLContainerBuilder doesn't support all ComponentParameter constructors from PicoContainer

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      4

      Description

      While there are five constructors for the ComponentParameter from Pico:

      http://www.picocontainer.org/picocontainer/latest/picocontainer/apidocs/org/picocontainer/defaults/ComponentParameter.html

      ComponentParameter()
      Expect any scalar paramter of the appropriate type or an Array.
      ComponentParameter(boolean emptyCollection)
      Expect any scalar paramter of the appropriate type or an Array.
      ComponentParameter(Class componentValueType, boolean emptyCollection)
      Expect any scalar paramter of the appropriate type or the collecting type Array,Collectionor Map.
      ComponentParameter(Class componentKeyType, Class componentValueType, boolean emptyCollection)
      Expect any scalar paramter of the appropriate type or the collecting type Array,Collectionor Map.
      ComponentParameter(Object componentKey)
      Expect a parameter matching a component of a specific key.

      Only two of these are supported within the XMLContainerBuilder. This precludes important use cases such as empty List and Map support. See here:

      http://www.picocontainer.org/Arrays,+Collections+and+Maps

      I have modified the XMLContainerBuilder and the DTD to support three additional attributes: emptyCollection, componentValueType, and componentKeyType. I added copious documentation and error checking on these cases as well, as well as test cases.

      Perhaps analogous support should be added for the other builders?

      1. Nano2-XMLContainerBuilder.patch
        26 kB
        Jeff Steward
      2. nanocontainer-xml-1_0.dtd
        7 kB
        Jeff Steward
      3. XMLContainerBuilder.patch
        15 kB
        Jeff Steward
      4. XMLContainerBuilder-MapSupport-test.patch
        2 kB
        Jeff Steward

        Activity

        Jeff Steward logged work - 21/May/07 12:55 AM
        • Time Spent:
          3 hours
           
          Finished the case for the XMLContainerBuilder. I think similar work needs to be done for the other builders.
        Jeff Steward made changes -
        Field Original Value New Value
        Remaining Estimate 3 hours [ 10800 ] 6 hours [ 21600 ]
        Time Spent 3 hours [ 10800 ]
        Hide
        Jeff Steward added a comment -

        This also required changing the TestModel to add two classes to show support for Lists and Maps.

        Show
        Jeff Steward added a comment - This also required changing the TestModel to add two classes to show support for Lists and Maps.
        Hide
        Paul Hammant added a comment -

        Applied. Can you take a look at http://svn.codehaus.org/picocontainer/java/sandbox/baby-steps/nano2/container/ and see it its right for Pico & Nano 2.0 please ?

        Show
        Paul Hammant added a comment - Applied. Can you take a look at http://svn.codehaus.org/picocontainer/java/sandbox/baby-steps/nano2/container/ and see it its right for Pico & Nano 2.0 please ?
        Hide
        Jeff Steward added a comment -

        Looks good for nano2 as well. Attached is the patch with test cases.

        Show
        Jeff Steward added a comment - Looks good for nano2 as well. Attached is the patch with test cases.
        Jeff Steward made changes -
        Attachment Nano2-XMLContainerBuilder.patch [ 27493 ]
        Hide
        Jeff Steward added a comment -

        In addition, a MapSupport test was left out of the original patch. Here is a patch for the XMLContainerBuilderTestCase for trunk.

        Show
        Jeff Steward added a comment - In addition, a MapSupport test was left out of the original patch. Here is a patch for the XMLContainerBuilderTestCase for trunk.
        Jeff Steward made changes -
        Hide
        Paul Hammant added a comment -

        Jeff can you attach the whole of the dtd for Nano2, the diff is huge, and unapplicable on my Mac. Cheers.

        Show
        Paul Hammant added a comment - Jeff can you attach the whole of the dtd for Nano2, the diff is huge, and unapplicable on my Mac. Cheers.
        Hide
        Jeff Steward added a comment -

        Sure. I wonder why the diff ended up being so large. There are three files I changed - the dtd, the XMLContainerBuilder, and the XMLContainerBuilderTestCase. Did the others come across okay?

        Show
        Jeff Steward added a comment - Sure. I wonder why the diff ended up being so large. There are three files I changed - the dtd, the XMLContainerBuilder, and the XMLContainerBuilderTestCase. Did the others come across okay?
        Jeff Steward made changes -
        Attachment nanocontainer-xml-1_0.dtd [ 27502 ]
        Hide
        Paul Hammant added a comment -

        we should probably bump the dtd versions for both 1.x and 2.x before release

        Show
        Paul Hammant added a comment - we should probably bump the dtd versions for both 1.x and 2.x before release

          People

          • Assignee:
            Unassigned
            Reporter:
            Jeff Steward
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Time Tracking

              Estimated:
              Original Estimate - 3 hours Original Estimate - 3 hours
              3h
              Remaining:
              Time Spent - 3 hours Remaining Estimate - 6 hours
              6h
              Logged:
              Time Spent - 3 hours Remaining Estimate - 6 hours
              3h