Ejemplo n.º 1
0
  @Override
  protected DataMessageComponent getTransformedMessage(List<DataMessageComponent> cache)
      throws ProcessingException {

    final DataMessageComponent ret = MessageUtils.mergeAll(cache);
    ret.putScalar("message_text", "Hello World");
    return ret;
  }
Ejemplo n.º 2
0
  protected DataMessageComponent getTransformedMessage(
      List<DataMessageComponent> port1Cache, List<DataMessageComponent> port2Cache)
      throws ProcessingException {

    final List<IDataset> sets1 = MessageUtils.getDatasets(port1Cache);
    final List<IDataset> sets2 = MessageUtils.getDatasets(port2Cache);
    final Collection<IDataset> sets = new HashSet<IDataset>(7);
    if (sets1 != null) sets.addAll(sets1);
    if (sets2 != null) sets.addAll(sets2);
    final AbstractDataset prod = Maths.multiply(sets, isCreateClone());

    try {
      final DataMessageComponent ret = new DataMessageComponent();
      ret.setList(prod);
      setUpstreamValues(ret, port1Cache, port2Cache);
      ret.putScalar("operation_names", MessageUtils.getNames(sets));
      return ret;

    } catch (Exception e) {
      throw createDataMessageException("Cannot generate multiplied data sets", e);
    }
  }
  @Override
  protected DataMessageComponent getTransformedMessage(List<DataMessageComponent> cache)
      throws ProcessingException {

    try {
      final MotorContainer cont =
          (MotorContainer) motorsParam.getBeanFromValue(MotorContainer.class);
      final DataMessageComponent comp = MessageUtils.mergeAll(cache);

      if (cont == null) {
        comp.putScalar("error_messsage", "No motors configured, '" + getName() + "' did nothing.");
        return comp;
      }

      final Map<String, String> values = setMotors(cont, comp);
      if (values != null) comp.addScalar(values);

      return comp;

    } catch (Exception e) {
      throw createDataMessageException("Cannot set motor values!", e);
    }
  }