001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.scxml2;
018
019import java.util.Map;
020
021/**
022 * The event controller interface used to send messages containing
023 * events or other information directly to another SCXML Interpreter,
024 * other external systems using an Event I/O Processor or to raise
025 * events in the current SCXML session.
026 *
027 */
028public interface EventDispatcher {
029
030    /**
031     * Cancel the specified send message.
032     *
033     * @param sendId The ID of the send message to cancel
034     */
035    void cancel(String sendId);
036
037    /**
038     * Send this message to the target.
039     *
040     * @param ioProcessors the available SCXMLIOProcessors, the same map as the SCXML system variable _ioprocessors
041     * @param id The ID of the send message
042     * @param target An expression returning the target location of the event
043     * @param type The type of the Event I/O Processor that the event should
044     *  be dispatched to
045     * @param event The type of event being generated.
046     * @param data The event payload
047     * @param hints The data containing information which may be
048     *  used by the implementing platform to configure the event processor
049     * @param delay The event is dispatched after the delay interval elapses
050     */
051    void send(Map<String, SCXMLIOProcessor> ioProcessors, String id, String target, String type, String event,
052              Object data, Object hints, long delay);
053
054}
055