| /** |
| ******************************************************************************** |
| * Copyright (c) 2018-2021 Robert Bosch GmbH and others. |
| * |
| * 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 app4mc.example.transform.m2m.transformers |
| |
| import app4mc.example.transform.samplemodel.SampleModelFactory |
| import org.eclipse.app4mc.amalthea.model.Cache |
| import org.eclipse.app4mc.transformation.ServiceConstants |
| import org.eclipse.app4mc.transformation.transformers.AbstractTransformer |
| import org.osgi.service.component.annotations.Activate |
| import org.osgi.service.component.annotations.Component |
| import org.osgi.service.component.annotations.ConfigurationPolicy |
| import org.slf4j.Logger |
| import org.slf4j.LoggerFactory |
| |
| @Component( |
| configurationPid = ServiceConstants.SESSION_CONFIGURATION_PID, |
| configurationPolicy = ConfigurationPolicy.REQUIRE, |
| service = #[ CacheTransformer, AbstractTransformer ] |
| ) |
| class CacheTransformer extends AbstractTransformer { |
| |
| static final Logger LOG = LoggerFactory.getLogger(typeof(CacheTransformer)); |
| |
| @Activate |
| def package void activate() { |
| LOG.debug("CacheTransformer activated : "+this.hashCode) |
| } |
| |
| def transfromCache(Cache amltCache) { |
| |
| return createCache(amltCache) |
| } |
| |
| private def create SampleModelFactory.eINSTANCE.createCache createCache(Cache amltMemory) { |
| it.name = amltMemory.name |
| } |
| |
| } |