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

Decouple Mobile Service creating from MobileCore

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      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

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

              Dates

              Created:
              Updated:
              Resolved: