NanoContainer
  1. NanoContainer
  2. NANO-21

XStream deserializer for NanoContainer (or Nano Project)

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      XStream (also at Codehaus), can take an SAX element and make an instance. We need to use this inside XMLAssemblyNanoContainer (see test case) to allow configuration (pseudo-components) to be inlined in the main xml document.

      XStream is only one case of course..

      <component impl='org.nanocontainer.testmodel.WebServerConfigBean' instansior='XStream'>
      <host>foobar.com</host>
      <port>4321</port>
      </component>

      ... or...

      <pseudo-component instansior='XStream'>
      <persisted-state impl='org.nanocontainer.testmodel.WebServerConfigBean'>
      <host>foobar.com</host>
      <port>4321</port>
      </persisted-state>
      </pseudo-component>

      It may be that PseudoComponentXMLInstansior is simple like so -

      interface PseudoComponentXMLInstansior {
      Object makeInstance(Element elem)
      throws SAXException, ClassNotFoundException;
      }

        Activity

        Hide
        Paul Hammant added a comment -

        Joe says :-

        Element element = ....;

        XStream xs = new XStream();
        Object result = xs.readObject(new DomXMLReader(element));
        pico.registerInstance(foo, result); // blah

        He also say see how XStream serializes first

        System.out.println(xs.writeObject(myobj));

        Show
        Paul Hammant added a comment - Joe says :- Element element = ....; XStream xs = new XStream(); Object result = xs.readObject(new DomXMLReader(element)); pico.registerInstance(foo, result); // blah He also say see how XStream serializes first System.out.println(xs.writeObject(myobj));
        Hide
        Paul Hammant added a comment -

        See XmlPseudoComponentFactory - hook point created.

        Show
        Paul Hammant added a comment - See XmlPseudoComponentFactory - hook point created.
        Hide
        Paul Hammant added a comment -

        All this needs now is a new Maven module in nano/ that implements XmlPseudoComponentFactory and uses XStream

        Show
        Paul Hammant added a comment - All this needs now is a new Maven module in nano/ that implements XmlPseudoComponentFactory and uses XStream
        Paul Hammant made changes -
        Field Original Value New Value
        Status Unassigned [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Paul Hammant
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 2 hours
              2h
              Remaining:
              Remaining Estimate - 2 hours
              2h
              Logged:
              Time Spent - Not Specified
              Not Specified