| /** |
| * ******************************************************************************* |
| * Copyright (c) 2020 Robert Bosch GmbH. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Robert Bosch GmbH - initial API and implementation |
| * ******************************************************************************* |
| */ |
| |
| package org.eclipse.app4mc.slg.commons.m2t; |
| |
| import org.eclipse.app4mc.amalthea.model.AmaltheaFactory; |
| import org.eclipse.app4mc.transformation.executiontype.IModelToTextConfig; |
| import org.eclipse.emf.ecore.resource.ResourceSet; |
| import org.slf4j.Logger; |
| import org.slf4j.LoggerFactory; |
| |
| public class M2TTransformationConfig implements IModelToTextConfig { |
| |
| private static final Logger LOG = LoggerFactory.getLogger(M2TTransformationConfig.class); |
| |
| protected AmaltheaMultiFileLoader amaltheaMultiFileLoader = new AmaltheaMultiFileLoader(); |
| protected String folderPath; |
| |
| public ResourceSet getInputResourceSet() { |
| if (this.folderPath != null) { |
| ResourceSet resourceSet = this.amaltheaMultiFileLoader.loadMultipleFiles(this.folderPath); |
| |
| if (resourceSet.getResources().isEmpty()) { |
| LOG.error( |
| "No Amalthea model files are loaded. Verify if the model version is : {}", |
| AmaltheaFactory.eINSTANCE.createAmalthea().getVersion()); |
| } |
| |
| return resourceSet; |
| } |
| LOG.error("input_models_folder parameter not set"); |
| |
| return null; |
| } |
| } |