PicoContainer
  1. PicoContainer
  2. PICO-172

Make PicoContainer XStream compatible

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0-RC-1
    • Component/s: PicoContainer (Java)
    • Labels:
      None
    • Number of attachments :
      0

      Description

      XStream (http://xstream.codehaus.org/) provides a neat serialisation format in XML. It would be nice to serialise the state of a PicoContainer with XStream, and this would complement the default serialisation as well as the mechanism provided by org.nanocontainer.reflection.recorder.ContainerRecorder. (3 different serialisation schemes, each of which have their strengths and weaknesses).

      Here is a testcase that should pass with XStream compatibility in place:

      public void testShouldBeAbleToSerializeContainerWithXStream()

      { MutablePicoContainer pico = new DefaultPicoContainer(); pico.registerComponentImplementation(ArrayList.class); XStream xStream = new XStream(); String picoXML = xStream.toXML(pico); MutablePicoContainer pico2 = (MutablePicoContainer) xStream.fromXML(picoXML); assertNotNull(pico2.getComponentInstance(ArrayList.class)); }

        Issue Links

          Activity

          Konstantin Pribluda made changes -
          Field Original Value New Value
          Assignee Aslak Hellesoy [ rinkrank ] Konstantin Pribluda [ ko5tik ]
          Joe Walnes made changes -
          Link This issue depends upon XSTR-45 [ XSTR-45 ]
          Hide
          Aslak Hellesøy added a comment -

          Resolving this issue will require most of the current final fields in various classes to be made non final.

          This is a bit of a hack, but has no impact on the bytecode (final info is not in the bytecode afaik).

          Any objections about making fields non final can be discussed here.

          Show
          Aslak Hellesøy added a comment - Resolving this issue will require most of the current final fields in various classes to be made non final. This is a bit of a hack, but has no impact on the bytecode (final info is not in the bytecode afaik). Any objections about making fields non final can be discussed here.
          Hide
          Jörg Schaible added a comment -

          Maybe we can take the chance and introduce more transient fields, e.g. the componentKeyToAdapterCache is superflous in the object stream. The information can be recreated easily.

          Show
          Jörg Schaible added a comment - Maybe we can take the chance and introduce more transient fields, e.g. the componentKeyToAdapterCache is superflous in the object stream. The information can be recreated easily.
          Aslak Hellesøy made changes -
          Assignee Konstantin Pribluda [ ko5tik ] Aslak Hellesoy [ rinkrank ]
          Hide
          Aslak Hellesøy added a comment -

          I have solved this one. Will commit it this weekend.

          Show
          Aslak Hellesøy added a comment - I have solved this one. Will commit it this weekend.
          Paul Hammant made changes -
          Affects Version/s 1.0.1 [ 10307 ]
          Fix Version/s 1.0.1 [ 10307 ]
          Hide
          Aslak Hellesøy added a comment -

          It's now possible to serialise/deserialise a picocontainer through xstream

          Show
          Aslak Hellesøy added a comment - It's now possible to serialise/deserialise a picocontainer through xstream
          Aslak Hellesøy made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Fix Version/s 1.0-RC-1 [ 10461 ]
          Resolution Fixed [ 1 ]
          Fix Version/s 1.0.1 [ 10307 ]
          Hide
          Jacob Kjome added a comment -

          According to the XStream 1.0-RC1 release notes, final fields are serializable under JDK 1.4+. So, it may be possible to switch back to using final fields. What's Picocontainer's stated JDK support level? Actually, it wouldn't much matter what Picocontainer's state JDK support level is. It is more of an XStream/JDK problem and as long as XStream can support this under JDk 1.4+ I'd go back to using final's and simply mention XStream's limitations with JDK's less than 1.4.

          Jake

          Show
          Jacob Kjome added a comment - According to the XStream 1.0-RC1 release notes, final fields are serializable under JDK 1.4+. So, it may be possible to switch back to using final fields. What's Picocontainer's stated JDK support level? Actually, it wouldn't much matter what Picocontainer's state JDK support level is. It is more of an XStream/JDK problem and as long as XStream can support this under JDk 1.4+ I'd go back to using final's and simply mention XStream's limitations with JDK's less than 1.4. Jake

            People

            • Assignee:
              Aslak Hellesøy
              Reporter:
              Aslak Hellesøy
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: