magja/magja — Issue #39: 39 - Change getInstance behavior 
Author: ceefour
Created: 2011-11-02 11:34:13+00:00
State: open

I don't really understand what's the purpose of INSTANCE_CUSTOM, and in my implementation it makes a lot of sense if i can initialize the INSTANCE with a defined SoapConfig that could be used throughout the run-time. I really would like to bypass the PROPERTIES loading.

Purposed code that works in both situations:

/**
* MagentoSoapClientHolder is loaded on the first execution of
* MagentoSoapClient.getInstance() or the first access to
* MagentoSoapClientHolder.INSTANCE, not before.
*/
public static MagentoSoapClient getInstance(SoapConfig soapConfig) {
if (INSTANCE_DEFAULT == null) {
INSTANCE_DEFAULT = new MagentoSoapClient(soapConfig);
}
return INSTANCE_DEFAULT;
}

public static MagentoSoapClient getInstance() {
return getInstance(new SoapConfig(PropertyLoader.loadProperties(CONFIG_PROPERTIES_FILE)));
}

Original link: http://code.google.com/p/magja/issues/detail?id=39