blob: aeeb05a15591c876248dd5f2571f6e062d6bc5e5 [file] [log] [blame]
/**
* *******************************************************************************
* Copyright (c) 2018-2019 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.transformation.extensions.base.templates
import java.util.Properties
import org.eclipse.app4mc.transformation.extensions.ICustomObjectsStore
import org.slf4j.Logger
abstract class AbstractTransformer {
/**
* Provides Log4J logger which can be used by the corresponding Transformer classes.
* Note: Root Logger is initialized during the startup and the corresponding Appenders are hooked to it accordingly.
* In case, if user specific appenders are to be attached to the logger, this method should be overridden and new Appenders should be attached to the logger
*
*/
protected def Logger getLogger(ICustomObjectsStore cust) {
return cust.getInstance(Logger);
}
protected def String getProperty(String propKey, ICustomObjectsStore customObjsStore) {
val Properties properties = customObjsStore.getInstance(Properties);
val value = properties.get(propKey)
if (value === null) {
throw new NullPointerException("Request input key : \"" + propKey +
"\" not supplied in the input properties file")
}
return value.toString
}
}