Today all [ServiceModule|https://github.com/aerogear/aerogear-android-sdk/blob/master/core/src/main/java/org/aerogear/mobile/core/ServiceModule.java] are being created by [MobileCore|https://github.com/aerogear/aerogear-android-sdk/blob/master/core/src/main/java/org/aerogear/mobile/core/MobileCore.java] on getInstance method
{code} public <T extends ServiceModule> T getInstance(final Class<T> serviceClass, final ServiceConfiguration serviceConfiguration) throws InitializationException { nonNull(serviceClass, "serviceClass");
if (services.containsKey(serviceClass)) { return (T) services.get(serviceClass); }
try { final ServiceModule serviceModule = serviceClass.newInstance();
ServiceConfiguration serviceCfg = serviceConfiguration;
if (serviceCfg == null) { serviceCfg = getServiceConfiguration(serviceModule.type()); }
if (serviceCfg == null && serviceModule.requiresConfiguration()) { throw new ConfigurationNotFoundException( serviceModule.type() + " not found on " + this.configFileName); }
serviceModule.configure(this, serviceCfg);
services.put(serviceClass, serviceModule);
return (T) serviceModule;
} catch (IllegalAccessException | InstantiationException e) { throw new InitializationException(e.getMessage(), e); } } {code}
It maybe was a good decision in the past but I can't see any value in it anymore, also it is blocking was to provide a non-openshift experience. For now all services should be self managed and comunicate communicate with mobilecore when need something like service config, http layer or anything else. |
|