RE: [axis2] ContextFactory - get rid of it?
Hi I am trying to create a ServiceClient by ServiceClient = new ServiceClient().But I am getting a runtimeException there and could not proceed from there.Do you have any idea how can I come out of that? Thanks And Regards Smitha Aldrin -Original Message- From: Deepal Jayasinghe [mailto:[EMAIL PROTECTED] Sent: Friday, May 04, 2007 3:21 AM To: axis-dev@ws.apache.org Subject: Re: [axis2] ContextFactory - get rid of it? 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: So let's go for those. Thanks Deepal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Axis2] ServiceClient exception. was Re: [axis2] ContextFactory - get rid of it?
Smitha Could you please post the exception trace? Paul On 5/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi I am trying to create a ServiceClient by ServiceClient = new ServiceClient().But I am getting a runtimeException there and could not proceed from there.Do you have any idea how can I come out of that? Thanks And Regards Smitha Aldrin -Original Message- From: Deepal Jayasinghe [mailto:[EMAIL PROTECTED] Sent: Friday, May 04, 2007 3:21 AM To: axis-dev@ws.apache.org Subject: Re: [axis2] ContextFactory - get rid of it? 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: So let's go for those. Thanks Deepal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Paul Fremantle VP/Technology, WSO2 and OASIS WS-RX TC Co-chair http://bloglines.com/blog/paulfremantle [EMAIL PROTECTED] Oxygenating the Web Service Platform, www.wso2.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2] ContextFactory - get rid of it?
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] 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] For additional commands, e-mail: [EMAIL PROTECTED] -- Chamikara Jayalath WSO2 Inc. http://wso2.com/ http://wso2.org/ - For your Oxygen needs
Re: [axis2] ContextFactory - get rid of it?
Chamikara, What do they say about premature optimization? :) -- dims On 5/4/07, Chamikara Jayalath [EMAIL PROTECTED] 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] 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] For additional commands, e-mail: [EMAIL PROTECTED] -- Chamikara Jayalath WSO2 Inc. http://wso2.com/ http://wso2.org/ - For your Oxygen needs -- Davanum Srinivas :: http://davanum.wordpress.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2] ContextFactory - get rid of it?
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]
Re: [axis2] ContextFactory - get rid of it?
Hi Dims, On 5/4/07, Davanum Srinivas [EMAIL PROTECTED] wrote: Chamikara, What do they say about premature optimization? :) Good point :-) So lets do it the correct way. Chamikara -- dims On 5/4/07, Chamikara Jayalath [EMAIL PROTECTED] 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] 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] For additional commands, e-mail: [EMAIL PROTECTED] -- Chamikara Jayalath WSO2 Inc. http://wso2.com/ http://wso2.org/ - For your Oxygen needs -- Davanum Srinivas :: http://davanum.wordpress.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Chamikara Jayalath WSO2 Inc. http://wso2.com/ http://wso2.org/ - For your Oxygen needs
Re: [axis2] ContextFactory - get rid of it?
Hi Glen, On 5/4/07, Glen Daniels [EMAIL PROTECTED] wrote: 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? Well, we need to inform other instances that a context was created. So we need to hv something like ClusteringContextListener deployed. Guess we hv to go for a array of listeners. Something like, ServiceContext { OperationContext createOperationContext(AxisOperation op) { if (op == null) throw new IllegalArgumentException(); OperationContext oc = new OperationContext(op, this); Iterator listeners = myConfigCtx.getContextListeners(); while (listeners.hasNext) { ((ContextListener) listener).contextCreated(oc); } return oc; } } Chamikara --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] -- Chamikara Jayalath WSO2 Inc. http://wso2.com/ http://wso2.org/ - For your Oxygen needs
Re: [axis2] ContextFactory - get rid of it?
Hi Glen, 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. All the communications are happen in the mailing list , I think Chamikra might remember more than me. I can not exactly remember which mail thread we had that conversation [1] , [2] or some other. [1] - http://marc.info/?t=11717471353r=1w=2 [2] - http://marc.info/?w=2r=1s=clustering+prototype+availableq=t Thanks Deepal Glen Daniels wrote: Hi folks! Recently I was in the midst of writing a test which used ServiceClient directly (i.e. not a Stub). I wanted to get at the last OperationContext by using client.getLastOperationContext() but it wasn't working... turns out this was because there are (at least) two ways of making an OperationContext and associating it with a ServiceContext. You could call serviceContext.createOperationContext() (which as it happens was the place where the code to cache the lastOperationContext lived), OR you could call ContextFactory.createOperationContext(AxisOperation, ServiceContext) directly, which did NOT have the caching code - and this is what was happening when you used the ServiceClient directly (via ServiceClient.createClient()). I took a look into this, and came to the following conclusion. I'd like to get rid of ContextFactory entirely, for a few reasons. First it's confusing to have multiple ways of doing things, and that's why the above problem occurred. Second, since contexts depend on each other (it doesn't make sense to have a MessageContext without a ConfigurationContext, for example), it is a little odd that there are currently a bunch of ways to build contexts with inappropriately disconnected references. I think we should be as flexible as possible, but it should not be possible to build context hierarchies that aren't really usable (i.e. an OperationContext without a ServiceContext). Finally, the Factory pattern (http://en.wikipedia.org/wiki/Factory_method_pattern) isn't really reflected by ContextFactory - it's neither generating potentially different versions of a base class interface, nor is it doing a lot of setup work for you. In fact the work it does could (and should) be more easily accomplished by simply putting factory methods in the Context classes themselves. I believe this also simplifies the code. So I'm thinking the context generation should work as follows. The methods which take args should all be protected against nulls. cc = new ConfigurationContext() // this one you can just make mc = configContext.createMessageContext() sgc = configContext.createServiceGroupContext(AxisServiceGroup) sc = serviceGroupContext.createServiceContext(AxisService) oc = serviceContext.createOperationContext(AxisOperation) mc = operationContext.createMessageContext(AxisMessage) Thoughts? Thanks, --Glen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thanks, Deepal The highest tower is built one brick at a time - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2] ContextFactory - get rid of it?
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] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2] ContextFactory - get rid of it?
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: So let's go for those. Thanks Deepal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2] ContextFactory - get rid of it?
Let's go for it glen! -- dims On 5/3/07, Deepal Jayasinghe [EMAIL PROTECTED] wrote: 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: So let's go for those. Thanks Deepal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Davanum Srinivas :: http://davanum.wordpress.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]