Package org.openhab.core.transform

Examples of org.openhab.core.transform.TransformationService


   *     the transformed value or the original one, if there was no service registered for the
   *     given type or a transformation exception occurred.
   */
  public static String transform(String type, String function, String value) {
    String result;
    TransformationService service = TransformationHelper.getTransformationService(TransformationActivator.getContext(), type);
    if(service!=null) {
      try {
        result = service.transform(function, value);
      } catch (TransformationException e) {
        logger.error("Error executing the transformation '" + type + "': " + e.getMessage());
        result = value;
      }     
    } else {
View Full Code Here


    try {
      String[] parts = splitTransformationConfig(transformation);
      String transformationType = parts[0];
      String transformationFunction = parts[1];

      TransformationService transformationService =
          TransformationHelper.getTransformationService(TCPActivator.getContext(), transformationType);
      if (transformationService != null) {
        transformedResponse = transformationService.transform(transformationFunction, response);
      } else {
        transformedResponse = response;
        logger.warn("couldn't transform response because transformationService of type '{}' is unavailable", transformationType);
      }
    }
View Full Code Here

   
    if (transformationType != null && transformationFunction != null) {
      String transformedResponse = null;

      try {
        TransformationService transformationService = TransformationHelper
            .getTransformationService(
                OpenEnergyMonitorActivator.getContext(),
                transformationType);
        if (transformationService != null) {
          transformedResponse = transformationService.transform(
              transformationFunction, String.valueOf(data));
        } else {
          logger.warn(
              "couldn't transform response because transformationService of type '{}' is unavailable",
              transformationType);
View Full Code Here

    try {
      String[] parts = splitTransformationConfig(transformation);
      String transformationType = parts[0];
      String transformationFunction = parts[1];

      TransformationService transformationService =
          TransformationHelper.getTransformationService(TCPActivator.getContext(), transformationType);
      if (transformationService != null) {
        transformedResponse = transformationService.transform(transformationFunction, response);
      } else {
        transformedResponse = response;
        logger.warn("couldn't transform response because transformationService of type '{}' is unavailable", transformationType);
      }
    }
View Full Code Here

      Matcher matcher = EXTRACT_TRANSFORMFUNCTION_PATTERN.matcher(label);
      if(matcher.find()) {
        String type = matcher.group(1);
        String pattern = matcher.group(2);
        String value = matcher.group(3);
        TransformationService transformation =
          TransformationHelper.getTransformationService(UIActivator.getContext(), type);
        if(transformation!=null) {
          try {
            label = label.substring(0, label.indexOf("[")+1) + transformation.transform(pattern, value) + "]";
          } catch (TransformationException e) {
            logger.error("transformation throws exception [transformation="
                + transformation + ", value=" + value + "]", e);
            label = label.substring(0, label.indexOf("[")+1) + value + "]";
          }
View Full Code Here

            try {
              String[] parts = splitTransformationConfig(transformation);
              String transformationType = parts[0];
              String transformationFunction = parts[1];
             
              TransformationService transformationService =
                TransformationHelper.getTransformationService(ExecActivator.getContext(), transformationType);
              if (transformationService != null) {
                transformedResponse = transformationService.transform(transformationFunction, response);
              } else {
                transformedResponse = response;
                logger.warn("couldn't transform response because transformationService of type '{}' is unavailable", transformationType);
              }
            }
View Full Code Here

            try {
              String[] parts = splitTransformationConfig(transformation);
              String transformationType = parts[0];
              String transformationFunction = parts[1];
             
              TransformationService transformationService =
                TransformationHelper.getTransformationService(HttpActivator.getContext(), transformationType);
              if (transformationService != null) {
                transformedResponse = transformationService.transform(transformationFunction, response);
              } else {
                transformedResponse = response;
                logger.warn("couldn't transform response because transformationService of type '{}' is unavailable", transformationType);
              }
            }
View Full Code Here

TOP

Related Classes of org.openhab.core.transform.TransformationService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.