Uploaded image for project: 'AeroGear'
  1. AeroGear
  2. AEROGEAR-3088

Decouple Mobile Service creating from MobileCore

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Done
    • Major
    • None
    • None
    • None

    Description

      Today all ServiceModule are being created by MobileCore on getInstance method

      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);
              }
      }
      

      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 communicate with mobilecore when need something like service config, http layer or anything else.

      Attachments

        Activity

          People

            danielpassos Daniel Passos (Inactive)
            danielpassos Daniel Passos (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: