PicoContainer
  1. PicoContainer
  2. PICO-32

Support multiple implementations of same service

    Details

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

      Description

      Jon Tirsen:

      I think we are ready to support multiple implementations now.

      I'm suggesting something along the lines of:
      SomeContainer container = new SomeContainer();
      container.registerComponent("impl1", Service.class, ServiceImpl.class);
      container.registerComponent("impl2", Service.class, ServiceImpl.class);
      // register component
      container.registerComponent(Component.class, Component.class,
      new Parameter[]

      { new ComponentParameter("impl1"), new ComponentParameter("impl2") }

      );
      // access component
      container.getComponent("impl1");

      Ie. implementations are optionally keyed (type: Object?), a
      ComponentParameter optionally takes a key as an argument and wires in
      the implementation based on that key.

      James Strachan:
      I want to refactor the Messenger project so that all the JMS
      Connections & JMS Destinations are managed in a Pico container (and
      in this particular case, constructed from an XML config file).

      http://jakarta.apache.org/commons/sandbox/messenger/

      Then I want to create a bunch of Consumer objects which use the JMS
      Connections and Destinations, which are just pico components using
      type-3 constructors. Again I want to use an XML config file to define
      the consumers, their component class and the connection & destination
      names & bind the named connections & destinations to the Consumers.

      Then I want the whole lot managed via a single root PicoContainer for
      lifecycles etc.

      i.e. I need a container of components which all implement the same
      interface (Consumer, Destination, Connection).

      plus lengthy discussion on mailing list.

        Activity

        Jon Tirsen made changes -
        Field Original Value New Value
        Description James Strachan:
        I want to refactor the Messenger project so that all the JMS
        Connections & JMS Destinations are managed in a Pico container (and
        in this particular case, constructed from an XML config file).

        http://jakarta.apache.org/commons/sandbox/messenger/
         
        Then I want to create a bunch of Consumer objects which use the JMS
        Connections and Destinations, which are just pico components using
        type-3 constructors. Again I want to use an XML config file to define
        the consumers, their component class and the connection & destination
        names & bind the named connections & destinations to the Consumers.
         
        Then I want the whole lot managed via a single root PicoContainer for
        lifecycles etc.
         
        i.e. I need a container of components which all implement the same
        interface (Consumer, Destination, Connection).
         
        plus lengthy discussion on mailing list.
        Jon Tirsen:

        I think we are ready to support multiple implementations now.
         
        I'm suggesting something along the lines of:
        SomeContainer container = new SomeContainer();
        container.registerComponent("impl1", Service.class, ServiceImpl.class);
        container.registerComponent("impl2", Service.class, ServiceImpl.class);
        // register component
        container.registerComponent(Component.class, Component.class,
        new Parameter[] { new ComponentParameter("impl1"), new
        ComponentParameter("impl2") });
        // access component
        container.getComponent("impl1");
         
        Ie. implementations are optionally keyed (type: Object?), a
        ComponentParameter optionally takes a key as an argument and wires in
        the implementation based on that key.

        James Strachan:
        I want to refactor the Messenger project so that all the JMS
        Connections & JMS Destinations are managed in a Pico container (and
        in this particular case, constructed from an XML config file).

        http://jakarta.apache.org/commons/sandbox/messenger/
         
        Then I want to create a bunch of Consumer objects which use the JMS
        Connections and Destinations, which are just pico components using
        type-3 constructors. Again I want to use an XML config file to define
        the consumers, their component class and the connection & destination
        names & bind the named connections & destinations to the Consumers.
         
        Then I want the whole lot managed via a single root PicoContainer for
        lifecycles etc.
         
        i.e. I need a container of components which all implement the same
        interface (Consumer, Destination, Connection).
         
        plus lengthy discussion on mailing list.
        Hide
        Aslak Hellesøy added a comment -

        Scheduling for 1.0-beta-1

        Show
        Aslak Hellesøy added a comment - Scheduling for 1.0-beta-1
        Aslak Hellesøy made changes -
        Affects Version/s 1.0-beta-1 [ 10144 ]
        Component/s Core [ 10191 ]
        Fix Version/s 1.0-beta-1 [ 10144 ]
        Jon Tirsen made changes -
        Status Unassigned [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Jon Tirsen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: