Hi Chamikara!

OK, I'll take care of this refactor over the weekend. Before I do, let me confirm the design with you. You're only concerned about the creation of contexts, and you don't want to actually inject creation functionality yourself? In other words, this kind of thing is sufficient:

ServiceContext {
  OperationContext createOperationContext(AxisOperation op) {
    if (op == null) throw new IllegalArgumentException();
    OperationContext oc = new OperationContext(op, this);
    ContextListener cl = myConfigCtx.getContextListener();
    if (cl != null) cl.contextCreated(oc);
    return oc;
  }
}

Yes/no?

--Glen

Chamikara Jayalath wrote:
Hi Glen, Deepal,

All we needed was a way to get notified when a certain context get created in the system. I think we didn't go for the ContextListener method becoz of possible performance drawbacks. But it absolutely was my preference. Would be glad if we can get that introduced.

Chamikara


On 5/4/07, *Glen Daniels* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Deepal Jayasinghe wrote:
     > I really like the idea, but one of the reason to introduce that
    factory
     > was to support clustering requirements. They wanted to have a single
     > place of creating all the Contexts , then they have only one
    place to
     > worry about. They wanted to have some triggering mechanism when when
     > creating Contexts that is why we introduced that.

    Hm... and yet that doesn't seem to happen, because everything right now
    uses ContextFactory directly, and I don't see any hooks in there for
    supporting notifications, just a bunch of static methods.  ?

    I'll go read those threads (thanks for the pointers), but I think there
    are perhaps better ways to achieve the goals than a static factory
    class, depending on exactly what the requirements are.  For example:

    ConfigurationContext {
         public void setContextListener(ContextListener);
    }

    then every sub-context create method does something like this:

    ServiceContext {
       public OperationContext createOpContext(AxisOperation) {
         if (myConfigContext.hasContextListener()) {
           // Either ask the listener to get the context itself,
           // or just notify it, etc... then return it.
         } else {
           return new OperationContext(AxisOperation, this);
         }
       }
    }

    Thanks,
    --Glen

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    For additional commands, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>




--
Chamikara Jayalath
WSO2 Inc.
http://wso2.com/
http://wso2.org/ - For your Oxygen needs

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to