1 2 Previous Next 16 Replies Latest reply on Jan 22, 2010 3:27 AM by Ales Justin Go to original post
      • 15. Re: Undemanding Dependencies
        David Lloyd Master

        alesj wrote:

         

        In this case, what do you consider "-->" to mean?
        A --> B, by this I mean that from A you can get a hold of B.
        I'm producing a BeanMetaData but after that I don't have any control over how the beans are installed.  I don't see any way to get a ControllerContext or DependencyInfo off of a BMD.  I think I see what you're getting at (using a lifecycle callback on the parent to enable the child), I just don't see how to connect the dots.

        Even from BMD you have access to underlying ControllerContext, you just don't know it yet. :-)

        It's the MetaDataVisitorNode methods, that get you that, we just need to properly override them.

         

        BMD.initialVisit(MDVN node) <-- override this

        ControllerContext context = node.getControllerContext();

        DependencyInfo info = context.getDependencyInfo();

        LifecycleCallbackItem item = new MyStarterLCI(); // this is what starts As

        info.addLifecycleCallback(item);

         

        Does this make more sense?

        Ah, I see.  However I can't affect the parent's BMD in this case - only the child's.

        • 16. Re: Undemanding Dependencies
          Ales Justin Master

          Ah, I see.  However I can't affect the parent's BMD in this case - only the child's.

          Not a lot different, just using another callback mechanism.

           

          BMD.initialVisit(MDVN node) <-- override this

          ControllerContext context = node.getControllerContext(); // child context

          DependencyInfo info = context.getDependencyInfo();

          CallbackItem callback = new BTrackingCallback(); // we keep track of all Bs, do something on the right one

          info.addInstallItem(callback);

          1 2 Previous Next