Combines the context data, and the local static or dynamic context data, and reformats the message

@param context input data
@param message message string

@return reformatted message string
12578
public String reformat(final Map<String, String> context, final String message) {
        final HashMap<String, String> tokens = new HashMap<String, String>();
        if (null != context) {
            tokens.putAll(context);
        }
        if (null != generator) {
            tokens.putAll(generator.getMap());
        } else if(null!=data) {
            tokens.putAll(data);
        }
        final String[] arr = {
            null!= tokens.get("user")? tokens.get("user"):"",
            null != tokens.get("node") ? tokens.get("node") : "",
            null != tokens.get("command") ? tokens.get("command") : "",
            tokens.get("level"),
            message
        };
        synchronized (messageFormat){
            return messageFormat.format(arr);
        }
    }
554661
public static String msgToString(SIBusMessage message)
   {
     if (message == null) return STRING_NULL;
     return message + "[" + message.getSystemMessageId() + "]";
   }
581707
private void doDeployNetwork(final NetworkContext context, final Message<JsonObject> message) {
    final WrappedWatchableMap<String, String> data = new WrappedWatchableMap<String, String>(context.address(), this.data.<String, String>getMap(context.address()), vertx);

    // When the context is set in the cluster, the network's manager will be notified
    // via a cluster event. The manager will then unset the network's status key and
    // update the network. Once the network has been updated (components are deployed
    // and undeployed and connections are created or removed as necessary) the manager
    // will reset the network's status key to the updated version. We can use this fact
    // to determine when the configuration change is complete by watching the network's
    // status key for the new context version.
    data.watch(context.status(), null, new Handler<MapEvent<String, String>>() {
      @Override
      public void handle(MapEvent<String, String> event) {
        // Once the network has been updated we can stop watching the network's status key.
        // Once the status key is unwatched trigger the async handler indicating that the
        // update is complete.
        if (event.type().equals(MapEvent.Type.CREATE) && event.value().equals(context.version())) {
          data.unwatch(context.status(), null, this, new Handler<AsyncResult<Void>>() {
            @Override
            public void handle(AsyncResult<Void> result) {
              message.reply(new JsonObject().putString("status", "ok").putObject("context", Contexts.serialize(context)));
            }
          });
        }
      }
    }, new Handler<AsyncResult<Void>>() {
      @Override
      public void handle(AsyncResult<Void> result) {
        // Once the network's status key is being watched, set the new configuration in
        // the cluster. This change will be recognized by the network's manager which will
        // then update the running network's configuration.
        if (result.failed()) {
          message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
        } else {
          try {
            data.put(context.address(), Contexts.serialize(context).encode());
          } catch (Exception e) {
            message.reply(new JsonObject().putString("status", "error").putString("message", e.getMessage()));
          }
        }
      }
    });
  }
1171101
public static <T> Parser<T> fail(final String message) {
    return new Parser<T>() {
      @Override boolean apply(ParseContext ctxt) {
        ctxt.fail(message);
        return false;
      }
      
      @Override public String toString() {
        return message;
      }
    };
  }
1164796
protected function addContextToMessages()
    {
        $context = $this->getContextMessage();

        if ($context === []) {
            return;
        }

        foreach ($this->messages as &$message) {
            $message[0] = ArrayHelper::merge($context, $this->parseText($message[0]));
        }
    }
250390
public static <M extends net.morimekta.providence.PMessage<M, F>, F extends net.morimekta.providence.descriptor.PField>
    Any wrapMessage(@javax.annotation.Nonnull M message) {
        return wrapMessage(message, new net.morimekta.providence.serializer.BinarySerializer());
    }
415805
public function process(Message $message, Context $context)
    {
        $container = $this->kernel->getContainer();

        $data = \json_decode($message->getBody());

        $eventName = $this->prefix . $data->uri;
        $payload = $data->path;

        $dispatcher = $container->get('event_dispatcher');
        $dispatcher->dispatch($eventName, new BusEvent($payload));

        return self::ACK;
    }
243628
public static Intent sendSms(Context context, String to, String message) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            String defaultSmsPackageName = Telephony.Sms.getDefaultSmsPackage(context);
            Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" + to));
            intent.putExtra("sms_body", message);
            if (defaultSmsPackageName != null) {
                intent.setPackage(defaultSmsPackageName);
            }
            return intent;
        } else {
            Uri smsUri = Uri.parse("tel:" + to);
            Intent intent = new Intent(Intent.ACTION_VIEW, smsUri);
            intent.putExtra("address", to);
            intent.putExtra("sms_body", message);
            intent.setType("vnd.android-dir/mms-sms");
            return intent;
        }
    }
262825
public SimpleDialog message(CharSequence message){
        if(mScrollView == null)
            initScrollView();

        if(mMessage == null)
            initMessageView();

        if(mScrollView.getChildAt(0) != mMessage) {
            mScrollView.removeAllViews();
            mScrollView.addView(mMessage);
        }

        mMessage.setText(message);
        if(!TextUtils.isEmpty(message)) {
            mMode = MODE_MESSAGE;
            super.contentView(mScrollView);
        }
        return this;
    }
1211661
protected static function interpolateMessage($message, array $context = array())
    {
        if (strpos($message, '{') === false) {
            return $message;
        }

        // build a replacement array with braces around the context keys
        $replace = array();
        foreach ($context as $key => $val) {
            $replace['{' . $key . '}'] = $val;
        }

        // interpolate replacement values into the the message and return
        return strtr($message, $replace);
    }
1113283
protected function interpolate($message, array $context = [])
    {
        $replace = [];
        foreach ($context as $key => $val) {
            // check that the value can be casted to string
            if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
                $replace['{' . $key . '}'] = $val;
            }
        }

        return strtr($message, $replace);
    }
1012260
public static List<FlatMessage> messageConverter(Message message) {
        try {
            if (message == null) {
                return null;
            }

            List<FlatMessage> flatMessages = new ArrayList<>();
            List<CanalEntry.Entry> entrys = null;
            if (message.isRaw()) {
                List<ByteString> rawEntries = message.getRawEntries();
                entrys = new ArrayList<CanalEntry.Entry>(rawEntries.size());
                for (ByteString byteString : rawEntries) {
                    CanalEntry.Entry entry = CanalEntry.Entry.parseFrom(byteString);
                    entrys.add(entry);
                }
            } else {
                entrys = message.getEntries();
            }

            for (CanalEntry.Entry entry : entrys) {
                if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN
                    || entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONEND) {
                    continue;
                }

                CanalEntry.RowChange rowChange;
                try {
                    rowChange = CanalEntry.RowChange.parseFrom(entry.getStoreValue());
                } catch (Exception e) {
                    throw new RuntimeException("ERROR ## parser of eromanga-event has an error , data:"
                                               + entry.toString(), e);
                }

                CanalEntry.EventType eventType = rowChange.getEventType();

                FlatMessage flatMessage = new FlatMessage(message.getId());
                flatMessages.add(flatMessage);
                flatMessage.setDatabase(entry.getHeader().getSchemaName());
                flatMessage.setTable(entry.getHeader().getTableName());
                flatMessage.setIsDdl(rowChange.getIsDdl());
                flatMessage.setType(eventType.toString());
                flatMessage.setEs(entry.getHeader().getExecuteTime());
                flatMessage.setTs(System.currentTimeMillis());
                flatMessage.setSql(rowChange.getSql());

                if (!rowChange.getIsDdl()) {
                    Map<String, Integer> sqlType = new LinkedHashMap<>();
                    Map<String, String> mysqlType = new LinkedHashMap<>();
                    List<Map<String, String>> data = new ArrayList<>();
                    List<Map<String, String>> old = new ArrayList<>();

                    Set<String> updateSet = new HashSet<>();
                    boolean hasInitPkNames = false;
                    for (CanalEntry.RowData rowData : rowChange.getRowDatasList()) {
                        if (eventType != CanalEntry.EventType.INSERT && eventType != CanalEntry.EventType.UPDATE
                            && eventType != CanalEntry.EventType.DELETE) {
                            continue;
                        }

                        Map<String, String> row = new LinkedHashMap<>();
                        List<CanalEntry.Column> columns;

                        if (eventType == CanalEntry.EventType.DELETE) {
                            columns = rowData.getBeforeColumnsList();
                        } else {
                            columns = rowData.getAfterColumnsList();
                        }

                        for (CanalEntry.Column column : columns) {
                            if (!hasInitPkNames && column.getIsKey()) {
                                flatMessage.addPkName(column.getName());
                            }
                            sqlType.put(column.getName(), column.getSqlType());
                            mysqlType.put(column.getName(), column.getMysqlType());
                            if (column.getIsNull()) {
                                row.put(column.getName(), null);
                            } else {
                                row.put(column.getName(), column.getValue());
                            }
                            // 获取update为true的字段
                            if (column.getUpdated()) {
                                updateSet.add(column.getName());
                            }
                        }

                        hasInitPkNames = true;
                        if (!row.isEmpty()) {
                            data.add(row);
                        }

                        if (eventType == CanalEntry.EventType.UPDATE) {
                            Map<String, String> rowOld = new LinkedHashMap<>();
                            for (CanalEntry.Column column : rowData.getBeforeColumnsList()) {
                                if (updateSet.contains(column.getName())) {
                                    if (column.getIsNull()) {
                                        rowOld.put(column.getName(), null);
                                    } else {
                                        rowOld.put(column.getName(), column.getValue());
                                    }
                                }
                            }
                            // update操作将记录修改前的值
                            if (!rowOld.isEmpty()) {
                                old.add(rowOld);
                            }
                        }
                    }
                    if (!sqlType.isEmpty()) {
                        flatMessage.setSqlType(sqlType);
                    }
                    if (!mysqlType.isEmpty()) {
                        flatMessage.setMysqlType(mysqlType);
                    }
                    if (!data.isEmpty()) {
                        flatMessage.setData(data);
                    }
                    if (!old.isEmpty()) {
                        flatMessage.setOld(old);
                    }
                }
            }
            return flatMessages;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
632310
public void addMessage(Message message) {
        synchronized (messages) {
            api.addMessageToCache(message);
            if (messages.stream().map(Reference::get).anyMatch(message::equals)) {
                return;
            }
            // Add the message in the correct order
            messages.removeIf(messageRef -> messageRef.get() == null);
            Reference<Message> messageRef = new SoftReference<>(message, messagesCleanupQueue);
            int pos = Collections.binarySearch(messages, messageRef, Comparator.comparing(Reference::get));
            if (pos < 0) {
                pos = -pos - 1;
            }
            messages.add(pos, messageRef);
        }
    }
121493
private function _interpolate($message, array $context) {
        // build a replacement array with braces around the context keys
        $replace = array();
        foreach ($context as $key => $val) {
            $replace['{' . $key . '}'] = $val;
        }

        // interpolate replacement values into the message and return
        return strtr($message, $replace);
    }
788578
private void checkMessageID(Message message) {
        if (!MessageUtils.isOutbound(message)) return;

        AddressingProperties maps =
                ContextUtils.retrieveMAPs(message, false, MessageUtils.isOutbound(message));
        if (maps == null) {
            maps = new AddressingProperties();
        }
        if (maps.getMessageID() == null) {
            String messageID = ContextUtils.generateUUID();
            boolean isRequestor = ContextUtils.isRequestor(message);
            maps.setMessageID(ContextUtils.getAttributedURI(messageID));
            ContextUtils.storeMAPs(maps, message, ContextUtils.isOutbound(message), isRequestor);
        }
    }
90947
protected String createExceptionMessage(final String message, final Object... messageParameters) {

        if (ArrayUtils.isEmpty(messageParameters)) {
            return message;
        } else {
            return String.format(message, messageParameters);
        }
    }
878967
public String getMessage(Context context) {
        if (customMessage != null) {
            return customMessage;
        }
        return context.getResources().getString(message);
    }