@Override
  @NotNull
  public JpsModel loadModel(@NotNull Path projectPath, @Nullable Path externalConfigurationDirectory, @Nullable Path optionsPath,
                            boolean loadUnloadedModules) throws IOException {
    JpsSerializationViaWorkspaceModel serializationViaWorkspaceModel = JpsSerializationViaWorkspaceModel.getInstance();
    if (serializationViaWorkspaceModel != null) {
      String projectCachePath = System.getProperty("jps.workspace.storage.project.cache.path");
      Path workspaceStorageCachePath = projectCachePath != null ? Paths.get(projectCachePath) : null;
      String globalCachePath = System.getProperty("jps.workspace.storage.global.cache.path");
      Path globalWorkspaceStoragePath = globalCachePath != null ? Paths.get(globalCachePath) : null;
      return serializationViaWorkspaceModel.loadModel(projectPath, workspaceStorageCachePath, externalConfigurationDirectory, optionsPath,
                                                      globalWorkspaceStoragePath, loadUnloadedModules);
    }

    JpsModel model = JpsElementFactory.getInstance().createModel();
    if (optionsPath != null) {
      JpsGlobalSettingsLoading.loadGlobalSettings(model.getGlobal(), optionsPath);
    }
    Map<String, String> pathVariables = JpsModelSerializationDataService.computeAllPathVariables(model.getGlobal());
    JpsProject project = model.getProject();
    JpsPathMapper pathMapper = model.getGlobal().getPathMapper();
    JpsProjectLoader.loadProject(project, pathVariables, pathMapper, projectPath, loadUnloadedModules, externalConfigurationDirectory);
    return model;
  }
@Override
  @NotNull
  public JpsModel loadModel(@NotNull Path projectPath, @Nullable Path externalConfigurationDirectory, @Nullable Path optionsPath,
                            boolean loadUnloadedModules)