You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Hiranya Jayathilaka <hi...@gmail.com> on 2009/07/23 12:47:06 UTC

SynapseConfiguration Requires Some Refactoring?

Hi Folks,

When going through the SynapseConfiguration class I noticed some minor
design issues in the code. For instance some of the add methods in the class
(eg: addProxyService, addStartup) do not guarantee that adding a new item
does not overwirte any existing item. Let's take the addProxyService method
for example.

public void addProxyService(String name, ProxyService proxy) {
        proxyServices.put(name, proxy);
}

If we call this method with two ProxyService objects having the same name
the second service object will overwrite the first one. It seems that
SynapseConfiguration class relies on higher layers to take care of such
issues. As a result in classes like SynapseXMLConfigurationFactory we need
to do this.

if (config.getProxyService(proxy.getName()) != null) {
        handleException("Duplicate proxy service with name : " +
proxy.getName());
}
config.addProxyService(proxy.getName(), proxy);

IMHO such validation should take place at the lowest level, ie at the
SynapseConfiguration class itself. Higher levels shouldn't have to dig into
the existing configuration before trying to add a new item. It should just
add the item and the lower level should perform the necessary validation and
throw an exception in case of an error.

Secondly I have acome across some methods that are not used anywhere in the
code.

eg:
public void addSequence(String key, Entry entry)
public void addEndpoint(String key, Entry entry)

I think it's safe to get rid of these methods and simply the API. So what do
you folks think about carrying out the necessary refactoring operations to
fix these design issues? If you all agree I can spend some time on this.

Thanks
-- 
Hiranya Jayathilaka
Software Engineer;
WSO2 Inc.;  http://wso2.org
E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com

Re: SynapseConfiguration Requires Some Refactoring?

Posted by Hiranya Jayathilaka <hi...@gmail.com>.
On Sun, Jul 26, 2009 at 6:06 AM, Ruwan Linton <ru...@gmail.com>wrote:

> Paul,
>
> These are the methods that we have earlier used to cache the remote entries
> (sequences for an instance) but now we are using a single map instead of
> different maps for sequences, endpoints and so on. We do have addSequence
> method which accepts a Mediator in the SynapseConfiguration and we are not
> going to touch it at all.


+1. To add a sequence one should use addSequence(String key, Mediator seq)
method and to add an endpoint one should use addEndpoint(String key,
Endpoint ep) method. How the Mediator and Endpoint objects are constructed
is determined by the configuration mechanism being used (XML based or some
other way).

The proper way to add an entry is by using the addEntry(String key, Entry e)
method.

Thanks,
Hiranya


>
> We just want to remove the code duplication in the addSequence, addEndpoint
> methods (and no use of them in Synapse and users will not be using them as
> well, as it doesn't give anything important to the user) which were being
> used by the caching remote entries. Now we are not using those methods.
>
> Thanks,
> Ruwan
>
>
> On Sun, Jul 26, 2009 at 1:03 AM, Paul Fremantle <pz...@gmail.com> wrote:
>
>> Sorry. I'm only just reading this thread properly. Suppose I want to
>> build a configuration manually or using a different approach to the
>> standard XML. How do I add sequences and endpoints if you remove these
>> methods?
>>
>> Paul
>>
>> On Sat, Jul 25, 2009 at 5:44 PM, Hiranya
>> Jayathilaka<hi...@gmail.com> wrote:
>> > Hi Paul,
>> >
>> > On Sat, Jul 25, 2009 at 6:23 PM, Paul Fremantle <pz...@gmail.com>
>> wrote:
>> >>
>> >> Folks
>> >>
>> >> What impact does this have on user-written extensions to Synapse? Do
>> >> they need to be rebuilt after this change?
>> >
>> > I have deprecated the unused methods for now. I think we should leave it
>> > that way for the upcoming release. If any custom extensions are using
>> these
>> > methods they will continue to function and there is no need to rebuild
>> > anything. However when building code which uses deprecated API methods
>> the
>> > compiler will generate warnings. So hopefully developers of such custom
>> > extensions will notice that and update their code to use the recommended
>> API
>> > methods.
>> > Then after this release we can permanently get rid of these methods.
>> > Thanks,
>> > Hiranya
>> >>
>> >>
>> >> Paul
>> >>
>> >> On Fri, Jul 24, 2009 at 5:16 AM, Hiranya
>> >> Jayathilaka<hi...@gmail.com> wrote:
>> >> >
>> >> >
>> >> > On Fri, Jul 24, 2009 at 9:35 AM, Ruwan Linton <
>> ruwan.linton@gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> Hiranya,
>> >> >>
>> >> >> Please go ahead with the proposed modifications, the above two
>> methods
>> >> >> which adds the sequences as a Entry was there to support the cached
>> >> >> sequence
>> >> >> entries from the registry but then we removed the sequences and
>> >> >> endpoints
>> >> >> map from the Synapse Configuration and decided to use one single map
>> >> >> which
>> >> >> is the localEntries map.
>> >> >>
>> >> >> So it is safe to remove those or may be we can deprecate them and
>> >> >> remove
>> >> >> in the next release since it is a public method.
>> >> >
>> >> > +1... Let's deprecate them for the moment.
>> >> >
>> >> > Thanks,
>> >> > Hiranya
>> >> >
>> >> >>
>> >> >>
>> >> >> Thanks,
>> >> >> Ruwan
>> >> >>
>> >> >> On Thu, Jul 23, 2009 at 4:50 PM, Hiranya Jayathilaka
>> >> >> <hi...@gmail.com> wrote:
>> >> >>>
>> >> >>> I believe the first change is almost a trivial one hence doesn't
>> >> >>> require
>> >> >>> any confirmation. But the second one (removing of the unused
>> methods)
>> >> >>> probably needs some insight from the devs.
>> >> >>>
>> >> >>> Thanks,
>> >> >>> Hiranya
>> >> >>>
>> >> >>> On Thu, Jul 23, 2009 at 4:17 PM, Hiranya Jayathilaka
>> >> >>> <hi...@gmail.com> wrote:
>> >> >>>>
>> >> >>>> Hi Folks,
>> >> >>>>
>> >> >>>> When going through the SynapseConfiguration class I noticed some
>> >> >>>> minor
>> >> >>>> design issues in the code. For instance some of the add methods in
>> >> >>>> the class
>> >> >>>> (eg: addProxyService, addStartup) do not guarantee that adding a
>> new
>> >> >>>> item
>> >> >>>> does not overwirte any existing item. Let's take the
>> addProxyService
>> >> >>>> method
>> >> >>>> for example.
>> >> >>>>
>> >> >>>> public void addProxyService(String name, ProxyService proxy) {
>> >> >>>>         proxyServices.put(name, proxy);
>> >> >>>> }
>> >> >>>>
>> >> >>>> If we call this method with two ProxyService objects having the
>> same
>> >> >>>> name the second service object will overwrite the first one. It
>> seems
>> >> >>>> that
>> >> >>>> SynapseConfiguration class relies on higher layers to take care of
>> >> >>>> such
>> >> >>>> issues. As a result in classes like SynapseXMLConfigurationFactory
>> we
>> >> >>>> need
>> >> >>>> to do this.
>> >> >>>>
>> >> >>>> if (config.getProxyService(proxy.getName()) != null) {
>> >> >>>>         handleException("Duplicate proxy service with name : " +
>> >> >>>> proxy.getName());
>> >> >>>> }
>> >> >>>> config.addProxyService(proxy.getName(), proxy);
>> >> >>>>
>> >> >>>> IMHO such validation should take place at the lowest level, ie at
>> the
>> >> >>>> SynapseConfiguration class itself. Higher levels shouldn't have to
>> >> >>>> dig into
>> >> >>>> the existing configuration before trying to add a new item. It
>> should
>> >> >>>> just
>> >> >>>> add the item and the lower level should perform the necessary
>> >> >>>> validation and
>> >> >>>> throw an exception in case of an error.
>> >> >>>>
>> >> >>>> Secondly I have acome across some methods that are not used
>> anywhere
>> >> >>>> in
>> >> >>>> the code.
>> >> >>>>
>> >> >>>> eg:
>> >> >>>> public void addSequence(String key, Entry entry)
>> >> >>>> public void addEndpoint(String key, Entry entry)
>> >> >>>>
>> >> >>>> I think it's safe to get rid of these methods and simply the API.
>> So
>> >> >>>> what do you folks think about carrying out the necessary
>> refactoring
>> >> >>>> operations to fix these design issues? If you all agree I can
>> spend
>> >> >>>> some
>> >> >>>> time on this.
>> >> >>>>
>> >> >>>> Thanks
>> >> >>>> --
>> >> >>>> Hiranya Jayathilaka
>> >> >>>> Software Engineer;
>> >> >>>> WSO2 Inc.;  http://wso2.org
>> >> >>>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>> >> >>>> Blog: http://techfeast-hiranya.blogspot.com
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> --
>> >> >>> Hiranya Jayathilaka
>> >> >>> Software Engineer;
>> >> >>> WSO2 Inc.;  http://wso2.org
>> >> >>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>> >> >>> Blog: http://techfeast-hiranya.blogspot.com
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Ruwan Linton
>> >> >> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
>> >> >> WSO2 Inc.; http://wso2.org
>> >> >> email: ruwan@wso2.com; cell: +94 77 341 3097
>> >> >> blog: http://ruwansblog.blogspot.com
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Hiranya Jayathilaka
>> >> > Software Engineer;
>> >> > WSO2 Inc.;  http://wso2.org
>> >> > E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>> >> > Blog: http://techfeast-hiranya.blogspot.com
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Paul Fremantle
>> >> Co-Founder and CTO, WSO2
>> >> Apache Synapse PMC Chair
>> >> OASIS WS-RX TC Co-chair
>> >>
>> >> blog: http://pzf.fremantle.org
>> >> paul@wso2.com
>> >>
>> >> "Oxygenating the Web Service Platform", www.wso2.com
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>> >> For additional commands, e-mail: dev-help@synapse.apache.org
>> >>
>> >
>> >
>> >
>> > --
>> > Hiranya Jayathilaka
>> > Software Engineer;
>> > WSO2 Inc.;  http://wso2.org
>> > E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>> > Blog: http://techfeast-hiranya.blogspot.com
>> >
>>
>>
>>
>> --
>> Paul Fremantle
>> Co-Founder and CTO, WSO2
>> Apache Synapse PMC Chair
>> OASIS WS-RX TC Co-chair
>>
>> blog: http://pzf.fremantle.org
>> paul@wso2.com
>>
>> "Oxygenating the Web Service Platform", www.wso2.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>> For additional commands, e-mail: dev-help@synapse.apache.org
>>
>>
>
>
> --
> Ruwan Linton
> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> WSO2 Inc.; http://wso2.org
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://ruwansblog.blogspot.com
>



-- 
Hiranya Jayathilaka
Software Engineer;
WSO2 Inc.;  http://wso2.org
E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com

Re: SynapseConfiguration Requires Some Refactoring?

Posted by Ruwan Linton <ru...@gmail.com>.
Paul,

These are the methods that we have earlier used to cache the remote entries
(sequences for an instance) but now we are using a single map instead of
different maps for sequences, endpoints and so on. We do have addSequence
method which accepts a Mediator in the SynapseConfiguration and we are not
going to touch it at all.

We just want to remove the code duplication in the addSequence, addEndpoint
methods (and no use of them in Synapse and users will not be using them as
well, as it doesn't give anything important to the user) which were being
used by the caching remote entries. Now we are not using those methods.

Thanks,
Ruwan

On Sun, Jul 26, 2009 at 1:03 AM, Paul Fremantle <pz...@gmail.com> wrote:

> Sorry. I'm only just reading this thread properly. Suppose I want to
> build a configuration manually or using a different approach to the
> standard XML. How do I add sequences and endpoints if you remove these
> methods?
>
> Paul
>
> On Sat, Jul 25, 2009 at 5:44 PM, Hiranya
> Jayathilaka<hi...@gmail.com> wrote:
> > Hi Paul,
> >
> > On Sat, Jul 25, 2009 at 6:23 PM, Paul Fremantle <pz...@gmail.com>
> wrote:
> >>
> >> Folks
> >>
> >> What impact does this have on user-written extensions to Synapse? Do
> >> they need to be rebuilt after this change?
> >
> > I have deprecated the unused methods for now. I think we should leave it
> > that way for the upcoming release. If any custom extensions are using
> these
> > methods they will continue to function and there is no need to rebuild
> > anything. However when building code which uses deprecated API methods
> the
> > compiler will generate warnings. So hopefully developers of such custom
> > extensions will notice that and update their code to use the recommended
> API
> > methods.
> > Then after this release we can permanently get rid of these methods.
> > Thanks,
> > Hiranya
> >>
> >>
> >> Paul
> >>
> >> On Fri, Jul 24, 2009 at 5:16 AM, Hiranya
> >> Jayathilaka<hi...@gmail.com> wrote:
> >> >
> >> >
> >> > On Fri, Jul 24, 2009 at 9:35 AM, Ruwan Linton <ruwan.linton@gmail.com
> >
> >> > wrote:
> >> >>
> >> >> Hiranya,
> >> >>
> >> >> Please go ahead with the proposed modifications, the above two
> methods
> >> >> which adds the sequences as a Entry was there to support the cached
> >> >> sequence
> >> >> entries from the registry but then we removed the sequences and
> >> >> endpoints
> >> >> map from the Synapse Configuration and decided to use one single map
> >> >> which
> >> >> is the localEntries map.
> >> >>
> >> >> So it is safe to remove those or may be we can deprecate them and
> >> >> remove
> >> >> in the next release since it is a public method.
> >> >
> >> > +1... Let's deprecate them for the moment.
> >> >
> >> > Thanks,
> >> > Hiranya
> >> >
> >> >>
> >> >>
> >> >> Thanks,
> >> >> Ruwan
> >> >>
> >> >> On Thu, Jul 23, 2009 at 4:50 PM, Hiranya Jayathilaka
> >> >> <hi...@gmail.com> wrote:
> >> >>>
> >> >>> I believe the first change is almost a trivial one hence doesn't
> >> >>> require
> >> >>> any confirmation. But the second one (removing of the unused
> methods)
> >> >>> probably needs some insight from the devs.
> >> >>>
> >> >>> Thanks,
> >> >>> Hiranya
> >> >>>
> >> >>> On Thu, Jul 23, 2009 at 4:17 PM, Hiranya Jayathilaka
> >> >>> <hi...@gmail.com> wrote:
> >> >>>>
> >> >>>> Hi Folks,
> >> >>>>
> >> >>>> When going through the SynapseConfiguration class I noticed some
> >> >>>> minor
> >> >>>> design issues in the code. For instance some of the add methods in
> >> >>>> the class
> >> >>>> (eg: addProxyService, addStartup) do not guarantee that adding a
> new
> >> >>>> item
> >> >>>> does not overwirte any existing item. Let's take the
> addProxyService
> >> >>>> method
> >> >>>> for example.
> >> >>>>
> >> >>>> public void addProxyService(String name, ProxyService proxy) {
> >> >>>>         proxyServices.put(name, proxy);
> >> >>>> }
> >> >>>>
> >> >>>> If we call this method with two ProxyService objects having the
> same
> >> >>>> name the second service object will overwrite the first one. It
> seems
> >> >>>> that
> >> >>>> SynapseConfiguration class relies on higher layers to take care of
> >> >>>> such
> >> >>>> issues. As a result in classes like SynapseXMLConfigurationFactory
> we
> >> >>>> need
> >> >>>> to do this.
> >> >>>>
> >> >>>> if (config.getProxyService(proxy.getName()) != null) {
> >> >>>>         handleException("Duplicate proxy service with name : " +
> >> >>>> proxy.getName());
> >> >>>> }
> >> >>>> config.addProxyService(proxy.getName(), proxy);
> >> >>>>
> >> >>>> IMHO such validation should take place at the lowest level, ie at
> the
> >> >>>> SynapseConfiguration class itself. Higher levels shouldn't have to
> >> >>>> dig into
> >> >>>> the existing configuration before trying to add a new item. It
> should
> >> >>>> just
> >> >>>> add the item and the lower level should perform the necessary
> >> >>>> validation and
> >> >>>> throw an exception in case of an error.
> >> >>>>
> >> >>>> Secondly I have acome across some methods that are not used
> anywhere
> >> >>>> in
> >> >>>> the code.
> >> >>>>
> >> >>>> eg:
> >> >>>> public void addSequence(String key, Entry entry)
> >> >>>> public void addEndpoint(String key, Entry entry)
> >> >>>>
> >> >>>> I think it's safe to get rid of these methods and simply the API.
> So
> >> >>>> what do you folks think about carrying out the necessary
> refactoring
> >> >>>> operations to fix these design issues? If you all agree I can spend
> >> >>>> some
> >> >>>> time on this.
> >> >>>>
> >> >>>> Thanks
> >> >>>> --
> >> >>>> Hiranya Jayathilaka
> >> >>>> Software Engineer;
> >> >>>> WSO2 Inc.;  http://wso2.org
> >> >>>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> >> >>>> Blog: http://techfeast-hiranya.blogspot.com
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> Hiranya Jayathilaka
> >> >>> Software Engineer;
> >> >>> WSO2 Inc.;  http://wso2.org
> >> >>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> >> >>> Blog: http://techfeast-hiranya.blogspot.com
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Ruwan Linton
> >> >> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> >> >> WSO2 Inc.; http://wso2.org
> >> >> email: ruwan@wso2.com; cell: +94 77 341 3097
> >> >> blog: http://ruwansblog.blogspot.com
> >> >
> >> >
> >> >
> >> > --
> >> > Hiranya Jayathilaka
> >> > Software Engineer;
> >> > WSO2 Inc.;  http://wso2.org
> >> > E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> >> > Blog: http://techfeast-hiranya.blogspot.com
> >> >
> >>
> >>
> >>
> >> --
> >> Paul Fremantle
> >> Co-Founder and CTO, WSO2
> >> Apache Synapse PMC Chair
> >> OASIS WS-RX TC Co-chair
> >>
> >> blog: http://pzf.fremantle.org
> >> paul@wso2.com
> >>
> >> "Oxygenating the Web Service Platform", www.wso2.com
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> >> For additional commands, e-mail: dev-help@synapse.apache.org
> >>
> >
> >
> >
> > --
> > Hiranya Jayathilaka
> > Software Engineer;
> > WSO2 Inc.;  http://wso2.org
> > E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> > Blog: http://techfeast-hiranya.blogspot.com
> >
>
>
>
> --
> Paul Fremantle
> Co-Founder and CTO, WSO2
> Apache Synapse PMC Chair
> OASIS WS-RX TC Co-chair
>
> blog: http://pzf.fremantle.org
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>
>


-- 
Ruwan Linton
Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com

Re: SynapseConfiguration Requires Some Refactoring?

Posted by Paul Fremantle <pz...@gmail.com>.
Sorry. I'm only just reading this thread properly. Suppose I want to
build a configuration manually or using a different approach to the
standard XML. How do I add sequences and endpoints if you remove these
methods?

Paul

On Sat, Jul 25, 2009 at 5:44 PM, Hiranya
Jayathilaka<hi...@gmail.com> wrote:
> Hi Paul,
>
> On Sat, Jul 25, 2009 at 6:23 PM, Paul Fremantle <pz...@gmail.com> wrote:
>>
>> Folks
>>
>> What impact does this have on user-written extensions to Synapse? Do
>> they need to be rebuilt after this change?
>
> I have deprecated the unused methods for now. I think we should leave it
> that way for the upcoming release. If any custom extensions are using these
> methods they will continue to function and there is no need to rebuild
> anything. However when building code which uses deprecated API methods the
> compiler will generate warnings. So hopefully developers of such custom
> extensions will notice that and update their code to use the recommended API
> methods.
> Then after this release we can permanently get rid of these methods.
> Thanks,
> Hiranya
>>
>>
>> Paul
>>
>> On Fri, Jul 24, 2009 at 5:16 AM, Hiranya
>> Jayathilaka<hi...@gmail.com> wrote:
>> >
>> >
>> > On Fri, Jul 24, 2009 at 9:35 AM, Ruwan Linton <ru...@gmail.com>
>> > wrote:
>> >>
>> >> Hiranya,
>> >>
>> >> Please go ahead with the proposed modifications, the above two methods
>> >> which adds the sequences as a Entry was there to support the cached
>> >> sequence
>> >> entries from the registry but then we removed the sequences and
>> >> endpoints
>> >> map from the Synapse Configuration and decided to use one single map
>> >> which
>> >> is the localEntries map.
>> >>
>> >> So it is safe to remove those or may be we can deprecate them and
>> >> remove
>> >> in the next release since it is a public method.
>> >
>> > +1... Let's deprecate them for the moment.
>> >
>> > Thanks,
>> > Hiranya
>> >
>> >>
>> >>
>> >> Thanks,
>> >> Ruwan
>> >>
>> >> On Thu, Jul 23, 2009 at 4:50 PM, Hiranya Jayathilaka
>> >> <hi...@gmail.com> wrote:
>> >>>
>> >>> I believe the first change is almost a trivial one hence doesn't
>> >>> require
>> >>> any confirmation. But the second one (removing of the unused methods)
>> >>> probably needs some insight from the devs.
>> >>>
>> >>> Thanks,
>> >>> Hiranya
>> >>>
>> >>> On Thu, Jul 23, 2009 at 4:17 PM, Hiranya Jayathilaka
>> >>> <hi...@gmail.com> wrote:
>> >>>>
>> >>>> Hi Folks,
>> >>>>
>> >>>> When going through the SynapseConfiguration class I noticed some
>> >>>> minor
>> >>>> design issues in the code. For instance some of the add methods in
>> >>>> the class
>> >>>> (eg: addProxyService, addStartup) do not guarantee that adding a new
>> >>>> item
>> >>>> does not overwirte any existing item. Let's take the addProxyService
>> >>>> method
>> >>>> for example.
>> >>>>
>> >>>> public void addProxyService(String name, ProxyService proxy) {
>> >>>>         proxyServices.put(name, proxy);
>> >>>> }
>> >>>>
>> >>>> If we call this method with two ProxyService objects having the same
>> >>>> name the second service object will overwrite the first one. It seems
>> >>>> that
>> >>>> SynapseConfiguration class relies on higher layers to take care of
>> >>>> such
>> >>>> issues. As a result in classes like SynapseXMLConfigurationFactory we
>> >>>> need
>> >>>> to do this.
>> >>>>
>> >>>> if (config.getProxyService(proxy.getName()) != null) {
>> >>>>         handleException("Duplicate proxy service with name : " +
>> >>>> proxy.getName());
>> >>>> }
>> >>>> config.addProxyService(proxy.getName(), proxy);
>> >>>>
>> >>>> IMHO such validation should take place at the lowest level, ie at the
>> >>>> SynapseConfiguration class itself. Higher levels shouldn't have to
>> >>>> dig into
>> >>>> the existing configuration before trying to add a new item. It should
>> >>>> just
>> >>>> add the item and the lower level should perform the necessary
>> >>>> validation and
>> >>>> throw an exception in case of an error.
>> >>>>
>> >>>> Secondly I have acome across some methods that are not used anywhere
>> >>>> in
>> >>>> the code.
>> >>>>
>> >>>> eg:
>> >>>> public void addSequence(String key, Entry entry)
>> >>>> public void addEndpoint(String key, Entry entry)
>> >>>>
>> >>>> I think it's safe to get rid of these methods and simply the API. So
>> >>>> what do you folks think about carrying out the necessary refactoring
>> >>>> operations to fix these design issues? If you all agree I can spend
>> >>>> some
>> >>>> time on this.
>> >>>>
>> >>>> Thanks
>> >>>> --
>> >>>> Hiranya Jayathilaka
>> >>>> Software Engineer;
>> >>>> WSO2 Inc.;  http://wso2.org
>> >>>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>> >>>> Blog: http://techfeast-hiranya.blogspot.com
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Hiranya Jayathilaka
>> >>> Software Engineer;
>> >>> WSO2 Inc.;  http://wso2.org
>> >>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>> >>> Blog: http://techfeast-hiranya.blogspot.com
>> >>
>> >>
>> >>
>> >> --
>> >> Ruwan Linton
>> >> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
>> >> WSO2 Inc.; http://wso2.org
>> >> email: ruwan@wso2.com; cell: +94 77 341 3097
>> >> blog: http://ruwansblog.blogspot.com
>> >
>> >
>> >
>> > --
>> > Hiranya Jayathilaka
>> > Software Engineer;
>> > WSO2 Inc.;  http://wso2.org
>> > E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>> > Blog: http://techfeast-hiranya.blogspot.com
>> >
>>
>>
>>
>> --
>> Paul Fremantle
>> Co-Founder and CTO, WSO2
>> Apache Synapse PMC Chair
>> OASIS WS-RX TC Co-chair
>>
>> blog: http://pzf.fremantle.org
>> paul@wso2.com
>>
>> "Oxygenating the Web Service Platform", www.wso2.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>> For additional commands, e-mail: dev-help@synapse.apache.org
>>
>
>
>
> --
> Hiranya Jayathilaka
> Software Engineer;
> WSO2 Inc.;  http://wso2.org
> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> Blog: http://techfeast-hiranya.blogspot.com
>



-- 
Paul Fremantle
Co-Founder and CTO, WSO2
Apache Synapse PMC Chair
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Re: SynapseConfiguration Requires Some Refactoring?

Posted by Hiranya Jayathilaka <hi...@gmail.com>.
Hi Paul,

On Sat, Jul 25, 2009 at 6:23 PM, Paul Fremantle <pz...@gmail.com> wrote:

> Folks
>
> What impact does this have on user-written extensions to Synapse? Do
> they need to be rebuilt after this change?


I have deprecated the unused methods for now. I think we should leave it
that way for the upcoming release. If any custom extensions are using these
methods they will continue to function and there is no need to rebuild
anything. However when building code which uses deprecated API methods the
compiler will generate warnings. So hopefully developers of such custom
extensions will notice that and update their code to use the recommended API
methods.

Then after this release we can permanently get rid of these methods.

Thanks,
Hiranya


>
> Paul
>
> On Fri, Jul 24, 2009 at 5:16 AM, Hiranya
> Jayathilaka<hi...@gmail.com> wrote:
> >
> >
> > On Fri, Jul 24, 2009 at 9:35 AM, Ruwan Linton <ru...@gmail.com>
> > wrote:
> >>
> >> Hiranya,
> >>
> >> Please go ahead with the proposed modifications, the above two methods
> >> which adds the sequences as a Entry was there to support the cached
> sequence
> >> entries from the registry but then we removed the sequences and
> endpoints
> >> map from the Synapse Configuration and decided to use one single map
> which
> >> is the localEntries map.
> >>
> >> So it is safe to remove those or may be we can deprecate them and remove
> >> in the next release since it is a public method.
> >
> > +1... Let's deprecate them for the moment.
> >
> > Thanks,
> > Hiranya
> >
> >>
> >>
> >> Thanks,
> >> Ruwan
> >>
> >> On Thu, Jul 23, 2009 at 4:50 PM, Hiranya Jayathilaka
> >> <hi...@gmail.com> wrote:
> >>>
> >>> I believe the first change is almost a trivial one hence doesn't
> require
> >>> any confirmation. But the second one (removing of the unused methods)
> >>> probably needs some insight from the devs.
> >>>
> >>> Thanks,
> >>> Hiranya
> >>>
> >>> On Thu, Jul 23, 2009 at 4:17 PM, Hiranya Jayathilaka
> >>> <hi...@gmail.com> wrote:
> >>>>
> >>>> Hi Folks,
> >>>>
> >>>> When going through the SynapseConfiguration class I noticed some minor
> >>>> design issues in the code. For instance some of the add methods in the
> class
> >>>> (eg: addProxyService, addStartup) do not guarantee that adding a new
> item
> >>>> does not overwirte any existing item. Let's take the addProxyService
> method
> >>>> for example.
> >>>>
> >>>> public void addProxyService(String name, ProxyService proxy) {
> >>>>         proxyServices.put(name, proxy);
> >>>> }
> >>>>
> >>>> If we call this method with two ProxyService objects having the same
> >>>> name the second service object will overwrite the first one. It seems
> that
> >>>> SynapseConfiguration class relies on higher layers to take care of
> such
> >>>> issues. As a result in classes like SynapseXMLConfigurationFactory we
> need
> >>>> to do this.
> >>>>
> >>>> if (config.getProxyService(proxy.getName()) != null) {
> >>>>         handleException("Duplicate proxy service with name : " +
> >>>> proxy.getName());
> >>>> }
> >>>> config.addProxyService(proxy.getName(), proxy);
> >>>>
> >>>> IMHO such validation should take place at the lowest level, ie at the
> >>>> SynapseConfiguration class itself. Higher levels shouldn't have to dig
> into
> >>>> the existing configuration before trying to add a new item. It should
> just
> >>>> add the item and the lower level should perform the necessary
> validation and
> >>>> throw an exception in case of an error.
> >>>>
> >>>> Secondly I have acome across some methods that are not used anywhere
> in
> >>>> the code.
> >>>>
> >>>> eg:
> >>>> public void addSequence(String key, Entry entry)
> >>>> public void addEndpoint(String key, Entry entry)
> >>>>
> >>>> I think it's safe to get rid of these methods and simply the API. So
> >>>> what do you folks think about carrying out the necessary refactoring
> >>>> operations to fix these design issues? If you all agree I can spend
> some
> >>>> time on this.
> >>>>
> >>>> Thanks
> >>>> --
> >>>> Hiranya Jayathilaka
> >>>> Software Engineer;
> >>>> WSO2 Inc.;  http://wso2.org
> >>>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> >>>> Blog: http://techfeast-hiranya.blogspot.com
> >>>
> >>>
> >>>
> >>> --
> >>> Hiranya Jayathilaka
> >>> Software Engineer;
> >>> WSO2 Inc.;  http://wso2.org
> >>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> >>> Blog: http://techfeast-hiranya.blogspot.com
> >>
> >>
> >>
> >> --
> >> Ruwan Linton
> >> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> >> WSO2 Inc.; http://wso2.org
> >> email: ruwan@wso2.com; cell: +94 77 341 3097
> >> blog: http://ruwansblog.blogspot.com
> >
> >
> >
> > --
> > Hiranya Jayathilaka
> > Software Engineer;
> > WSO2 Inc.;  http://wso2.org
> > E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> > Blog: http://techfeast-hiranya.blogspot.com
> >
>
>
>
> --
> Paul Fremantle
> Co-Founder and CTO, WSO2
> Apache Synapse PMC Chair
> OASIS WS-RX TC Co-chair
>
> blog: http://pzf.fremantle.org
> paul@wso2.com
>
> "Oxygenating the Web Service Platform", www.wso2.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>
>


-- 
Hiranya Jayathilaka
Software Engineer;
WSO2 Inc.;  http://wso2.org
E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com

Re: SynapseConfiguration Requires Some Refactoring?

Posted by Paul Fremantle <pz...@gmail.com>.
Folks

What impact does this have on user-written extensions to Synapse? Do
they need to be rebuilt after this change?

Paul

On Fri, Jul 24, 2009 at 5:16 AM, Hiranya
Jayathilaka<hi...@gmail.com> wrote:
>
>
> On Fri, Jul 24, 2009 at 9:35 AM, Ruwan Linton <ru...@gmail.com>
> wrote:
>>
>> Hiranya,
>>
>> Please go ahead with the proposed modifications, the above two methods
>> which adds the sequences as a Entry was there to support the cached sequence
>> entries from the registry but then we removed the sequences and endpoints
>> map from the Synapse Configuration and decided to use one single map which
>> is the localEntries map.
>>
>> So it is safe to remove those or may be we can deprecate them and remove
>> in the next release since it is a public method.
>
> +1... Let's deprecate them for the moment.
>
> Thanks,
> Hiranya
>
>>
>>
>> Thanks,
>> Ruwan
>>
>> On Thu, Jul 23, 2009 at 4:50 PM, Hiranya Jayathilaka
>> <hi...@gmail.com> wrote:
>>>
>>> I believe the first change is almost a trivial one hence doesn't require
>>> any confirmation. But the second one (removing of the unused methods)
>>> probably needs some insight from the devs.
>>>
>>> Thanks,
>>> Hiranya
>>>
>>> On Thu, Jul 23, 2009 at 4:17 PM, Hiranya Jayathilaka
>>> <hi...@gmail.com> wrote:
>>>>
>>>> Hi Folks,
>>>>
>>>> When going through the SynapseConfiguration class I noticed some minor
>>>> design issues in the code. For instance some of the add methods in the class
>>>> (eg: addProxyService, addStartup) do not guarantee that adding a new item
>>>> does not overwirte any existing item. Let's take the addProxyService method
>>>> for example.
>>>>
>>>> public void addProxyService(String name, ProxyService proxy) {
>>>>         proxyServices.put(name, proxy);
>>>> }
>>>>
>>>> If we call this method with two ProxyService objects having the same
>>>> name the second service object will overwrite the first one. It seems that
>>>> SynapseConfiguration class relies on higher layers to take care of such
>>>> issues. As a result in classes like SynapseXMLConfigurationFactory we need
>>>> to do this.
>>>>
>>>> if (config.getProxyService(proxy.getName()) != null) {
>>>>         handleException("Duplicate proxy service with name : " +
>>>> proxy.getName());
>>>> }
>>>> config.addProxyService(proxy.getName(), proxy);
>>>>
>>>> IMHO such validation should take place at the lowest level, ie at the
>>>> SynapseConfiguration class itself. Higher levels shouldn't have to dig into
>>>> the existing configuration before trying to add a new item. It should just
>>>> add the item and the lower level should perform the necessary validation and
>>>> throw an exception in case of an error.
>>>>
>>>> Secondly I have acome across some methods that are not used anywhere in
>>>> the code.
>>>>
>>>> eg:
>>>> public void addSequence(String key, Entry entry)
>>>> public void addEndpoint(String key, Entry entry)
>>>>
>>>> I think it's safe to get rid of these methods and simply the API. So
>>>> what do you folks think about carrying out the necessary refactoring
>>>> operations to fix these design issues? If you all agree I can spend some
>>>> time on this.
>>>>
>>>> Thanks
>>>> --
>>>> Hiranya Jayathilaka
>>>> Software Engineer;
>>>> WSO2 Inc.;  http://wso2.org
>>>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>>>> Blog: http://techfeast-hiranya.blogspot.com
>>>
>>>
>>>
>>> --
>>> Hiranya Jayathilaka
>>> Software Engineer;
>>> WSO2 Inc.;  http://wso2.org
>>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>>> Blog: http://techfeast-hiranya.blogspot.com
>>
>>
>>
>> --
>> Ruwan Linton
>> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
>> WSO2 Inc.; http://wso2.org
>> email: ruwan@wso2.com; cell: +94 77 341 3097
>> blog: http://ruwansblog.blogspot.com
>
>
>
> --
> Hiranya Jayathilaka
> Software Engineer;
> WSO2 Inc.;  http://wso2.org
> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> Blog: http://techfeast-hiranya.blogspot.com
>



-- 
Paul Fremantle
Co-Founder and CTO, WSO2
Apache Synapse PMC Chair
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Re: SynapseConfiguration Requires Some Refactoring?

Posted by Hiranya Jayathilaka <hi...@gmail.com>.
On Fri, Jul 24, 2009 at 9:35 AM, Ruwan Linton <ru...@gmail.com>wrote:

> Hiranya,
>
> Please go ahead with the proposed modifications, the above two methods
> which adds the sequences as a Entry was there to support the cached sequence
> entries from the registry but then we removed the sequences and endpoints
> map from the Synapse Configuration and decided to use one single map which
> is the localEntries map.
>
> So it is safe to remove those or may be we can deprecate them and remove in
> the next release since it is a public method.


+1... Let's deprecate them for the moment.

Thanks,
Hiranya


>
>
> Thanks,
> Ruwan
>
>
> On Thu, Jul 23, 2009 at 4:50 PM, Hiranya Jayathilaka <hiranya911@gmail.com
> > wrote:
>
>> I believe the first change is almost a trivial one hence doesn't require
>> any confirmation. But the second one (removing of the unused methods)
>> probably needs some insight from the devs.
>>
>> Thanks,
>> Hiranya
>>
>>
>> On Thu, Jul 23, 2009 at 4:17 PM, Hiranya Jayathilaka <
>> hiranya911@gmail.com> wrote:
>>
>>> Hi Folks,
>>>
>>> When going through the SynapseConfiguration class I noticed some minor
>>> design issues in the code. For instance some of the add methods in the class
>>> (eg: addProxyService, addStartup) do not guarantee that adding a new item
>>> does not overwirte any existing item. Let's take the addProxyService method
>>> for example.
>>>
>>> public void addProxyService(String name, ProxyService proxy) {
>>>         proxyServices.put(name, proxy);
>>> }
>>>
>>> If we call this method with two ProxyService objects having the same name
>>> the second service object will overwrite the first one. It seems that
>>> SynapseConfiguration class relies on higher layers to take care of such
>>> issues. As a result in classes like SynapseXMLConfigurationFactory we need
>>> to do this.
>>>
>>> if (config.getProxyService(proxy.getName()) != null) {
>>>         handleException("Duplicate proxy service with name : " +
>>> proxy.getName());
>>> }
>>> config.addProxyService(proxy.getName(), proxy);
>>>
>>> IMHO such validation should take place at the lowest level, ie at the
>>> SynapseConfiguration class itself. Higher levels shouldn't have to dig into
>>> the existing configuration before trying to add a new item. It should just
>>> add the item and the lower level should perform the necessary validation and
>>> throw an exception in case of an error.
>>>
>>> Secondly I have acome across some methods that are not used anywhere in
>>> the code.
>>>
>>> eg:
>>> public void addSequence(String key, Entry entry)
>>> public void addEndpoint(String key, Entry entry)
>>>
>>> I think it's safe to get rid of these methods and simply the API. So what
>>> do you folks think about carrying out the necessary refactoring operations
>>> to fix these design issues? If you all agree I can spend some time on this.
>>>
>>> Thanks
>>> --
>>> Hiranya Jayathilaka
>>> Software Engineer;
>>> WSO2 Inc.;  http://wso2.org
>>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>>> Blog: http://techfeast-hiranya.blogspot.com
>>>
>>
>>
>>
>> --
>> Hiranya Jayathilaka
>> Software Engineer;
>> WSO2 Inc.;  http://wso2.org
>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>> Blog: http://techfeast-hiranya.blogspot.com
>>
>
>
>
> --
> Ruwan Linton
> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> WSO2 Inc.; http://wso2.org
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://ruwansblog.blogspot.com
>



-- 
Hiranya Jayathilaka
Software Engineer;
WSO2 Inc.;  http://wso2.org
E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com

Re: SynapseConfiguration Requires Some Refactoring?

Posted by Ruwan Linton <ru...@gmail.com>.
Hiranya,

Please go ahead with the proposed modifications, the above two methods which
adds the sequences as a Entry was there to support the cached sequence
entries from the registry but then we removed the sequences and endpoints
map from the Synapse Configuration and decided to use one single map which
is the localEntries map.

So it is safe to remove those or may be we can deprecate them and remove in
the next release since it is a public method.

Thanks,
Ruwan

On Thu, Jul 23, 2009 at 4:50 PM, Hiranya Jayathilaka
<hi...@gmail.com>wrote:

> I believe the first change is almost a trivial one hence doesn't require
> any confirmation. But the second one (removing of the unused methods)
> probably needs some insight from the devs.
>
> Thanks,
> Hiranya
>
>
> On Thu, Jul 23, 2009 at 4:17 PM, Hiranya Jayathilaka <hiranya911@gmail.com
> > wrote:
>
>> Hi Folks,
>>
>> When going through the SynapseConfiguration class I noticed some minor
>> design issues in the code. For instance some of the add methods in the class
>> (eg: addProxyService, addStartup) do not guarantee that adding a new item
>> does not overwirte any existing item. Let's take the addProxyService method
>> for example.
>>
>> public void addProxyService(String name, ProxyService proxy) {
>>         proxyServices.put(name, proxy);
>> }
>>
>> If we call this method with two ProxyService objects having the same name
>> the second service object will overwrite the first one. It seems that
>> SynapseConfiguration class relies on higher layers to take care of such
>> issues. As a result in classes like SynapseXMLConfigurationFactory we need
>> to do this.
>>
>> if (config.getProxyService(proxy.getName()) != null) {
>>         handleException("Duplicate proxy service with name : " +
>> proxy.getName());
>> }
>> config.addProxyService(proxy.getName(), proxy);
>>
>> IMHO such validation should take place at the lowest level, ie at the
>> SynapseConfiguration class itself. Higher levels shouldn't have to dig into
>> the existing configuration before trying to add a new item. It should just
>> add the item and the lower level should perform the necessary validation and
>> throw an exception in case of an error.
>>
>> Secondly I have acome across some methods that are not used anywhere in
>> the code.
>>
>> eg:
>> public void addSequence(String key, Entry entry)
>> public void addEndpoint(String key, Entry entry)
>>
>> I think it's safe to get rid of these methods and simply the API. So what
>> do you folks think about carrying out the necessary refactoring operations
>> to fix these design issues? If you all agree I can spend some time on this.
>>
>> Thanks
>> --
>> Hiranya Jayathilaka
>> Software Engineer;
>> WSO2 Inc.;  http://wso2.org
>> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
>> Blog: http://techfeast-hiranya.blogspot.com
>>
>
>
>
> --
> Hiranya Jayathilaka
> Software Engineer;
> WSO2 Inc.;  http://wso2.org
> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> Blog: http://techfeast-hiranya.blogspot.com
>



-- 
Ruwan Linton
Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com

Re: SynapseConfiguration Requires Some Refactoring?

Posted by Hiranya Jayathilaka <hi...@gmail.com>.
I believe the first change is almost a trivial one hence doesn't require any
confirmation. But the second one (removing of the unused methods) probably
needs some insight from the devs.

Thanks,
Hiranya

On Thu, Jul 23, 2009 at 4:17 PM, Hiranya Jayathilaka
<hi...@gmail.com>wrote:

> Hi Folks,
>
> When going through the SynapseConfiguration class I noticed some minor
> design issues in the code. For instance some of the add methods in the class
> (eg: addProxyService, addStartup) do not guarantee that adding a new item
> does not overwirte any existing item. Let's take the addProxyService method
> for example.
>
> public void addProxyService(String name, ProxyService proxy) {
>         proxyServices.put(name, proxy);
> }
>
> If we call this method with two ProxyService objects having the same name
> the second service object will overwrite the first one. It seems that
> SynapseConfiguration class relies on higher layers to take care of such
> issues. As a result in classes like SynapseXMLConfigurationFactory we need
> to do this.
>
> if (config.getProxyService(proxy.getName()) != null) {
>         handleException("Duplicate proxy service with name : " +
> proxy.getName());
> }
> config.addProxyService(proxy.getName(), proxy);
>
> IMHO such validation should take place at the lowest level, ie at the
> SynapseConfiguration class itself. Higher levels shouldn't have to dig into
> the existing configuration before trying to add a new item. It should just
> add the item and the lower level should perform the necessary validation and
> throw an exception in case of an error.
>
> Secondly I have acome across some methods that are not used anywhere in the
> code.
>
> eg:
> public void addSequence(String key, Entry entry)
> public void addEndpoint(String key, Entry entry)
>
> I think it's safe to get rid of these methods and simply the API. So what
> do you folks think about carrying out the necessary refactoring operations
> to fix these design issues? If you all agree I can spend some time on this.
>
> Thanks
> --
> Hiranya Jayathilaka
> Software Engineer;
> WSO2 Inc.;  http://wso2.org
> E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
> Blog: http://techfeast-hiranya.blogspot.com
>



-- 
Hiranya Jayathilaka
Software Engineer;
WSO2 Inc.;  http://wso2.org
E-mail: hiranya@wso2.com;  Mobile: +94 77 633 3491
Blog: http://techfeast-hiranya.blogspot.com