private static void validateServicesBeforeLaunch( Application application, MicroServiceRepoManager microServiceRepoManager, ServiceInstance instance) throws FioranoException { String servGUID = instance.getGUID(); String version = String.valueOf(instance.getVersion()); // If any of the services doesn't exist in SP-Repository then throw an exception. Service service; try { service = microServiceRepoManager.getServiceInfo(servGUID, version); } catch (Throwable thr) { logger.error( RBUtil.getMessage(Bundle.class, Bundle.SERVICE_NOT_FOUND, instance.getGUID()), thr); throw new FioranoException( I18NUtil.getMessage(Bundle.class, Bundle.SERVICE_NOT_FOUND, instance.getGUID())); } // Ensure that if the Configuration is Required, then we must ensure // that the corresponding component instance has non-null value for // configuration data set using CPS. // Even if the Configuration is not required, if it is partially configured, // Exception must be thrown if (service.getExecution().getCPS() != null) { if (instance.isPartiallyConfigured()) { logger.error( RBUtil.getMessage( Bundle.class, Bundle.ERROR_COMPONENT_NOT_FULLY_CONFIGURED_ERROR, servGUID, application.getGUID() + Constants.NAME_DELIMITER + Float.toString(application.getVersion()))); throw new FioranoException( I18NUtil.getMessage( Bundle.class, Bundle.ERROR_COMPONENT_NOT_FULLY_CONFIGURED_ERROR, servGUID, application.getGUID() + Constants.NAME_DELIMITER + Float.toString(application.getVersion()))); } String config = instance.getConfiguration(); if ((config == null || config.trim().length() == 0) && service.getExecution().getCPS().isMandatory()) { logger.error( RBUtil.getMessage( Bundle.class, Bundle.ERROR_COMPONENT_NOT_CONFIGURED_ERROR, servGUID, application.getGUID() + Constants.NAME_DELIMITER + Float.toString(application.getVersion()))); throw new FioranoException( I18NUtil.getMessage( Bundle.class, Bundle.ERROR_COMPONENT_NOT_CONFIGURED_ERROR, servGUID, application.getGUID() + Constants.NAME_DELIMITER + Float.toString(application.getVersion()))); } } // We also need to check if the zip file of the service exist or not. try { microServiceRepoManager.checkServiceResourceFiles( instance.getGUID(), String.valueOf(instance.getVersion())); } catch (Throwable thr) { logger.error( RBUtil.getMessage(Bundle.class, Bundle.ERROR_RESOURCE_NOT_EXISTS, servGUID, ""), thr); throw new FioranoException( I18NUtil.getMessage( Bundle.class, Bundle.ERROR_RESOURCE_NOT_EXISTS, servGUID, thr.getMessage())); } // Ensure that this service is LAUNCHABLE if (service.getExecution() == null) { logger.error(RBUtil.getMessage(Bundle.class, Bundle.SERVICE_NOT_LAUNCHABLE, servGUID)); throw new FioranoException( I18NUtil.getMessage(Bundle.class, Bundle.SERVICE_NOT_LAUNCHABLE, servGUID)); } // check the service dependencies. checkServiceResources(microServiceRepoManager, service, service); // Changes related to debugMode. if (instance.isDebugMode()) checkUniquenessOfDebugPorts(instance, application); }