synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiranya Jayathilaka <hiranya...@gmail.com>
Subject Re: SynapseConfiguration Requires Some Refactoring?
Date Thu, 23 Jul 2009 11:20:28 GMT
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

Mime
View raw message