    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     */
    017    package org.apache.commons.scxml.env;
    018
    019    import java.io.Serializable;
    020    import java.util.List;
    021    import java.util.Map;
    022
    023    import org.apache.commons.logging.Log;
    024    import org.apache.commons.logging.LogFactory;
    025    import org.apache.commons.scxml.EventDispatcher;
    026
    027    /**
    028     * Trivial EventDispatcher implementation.
    029     * No remote eventing.
    030     *
    031     */
    032    public final class SimpleDispatcher implements EventDispatcher, Serializable {
    033
    034         /** Serial version UID. */
    035        private static final long serialVersionUID = 1L;
    036        /** Implementation independent log category. */
    037         private Log log = LogFactory.getLog(EventDispatcher.class);
    038
    039        /**
    040         *  Constructor.
    041         */
    042        public SimpleDispatcher() {
    043            super();
    044        }
    045
    046        /**
    047         * @see EventDispatcher#cancel(String)
    048         */
    049        public void cancel(final String sendId) {
    050            if (log.isInfoEnabled()) {
    051                log.info("cancel( sendId: " + sendId + ")");
    052            }
    053        }
    054
    055        /**
    056        @see EventDispatcher#send(String,String,String,String,Map,Object,long,List)
    057         */
    058        public void send(final String sendId, final String target,
    059                final String targetType, final String event, final Map params,
    060                final Object hints, final long delay, final List externalNodes) {
    061            if (log.isInfoEnabled()) {
    062                StringBuffer buf = new StringBuffer();
    063                buf.append("send ( sendId: ").append(sendId);
    064                buf.append(", target: ").append(target);
    065                buf.append(", targetType: ").append(targetType);
    066                buf.append(", event: ").append(event);
    067                buf.append(", params: ").append(String.valueOf(params));
    068                buf.append(", hints: ").append(String.valueOf(hints));
    069                buf.append(", delay: ").append(delay);
    070                buf.append(')');
    071                log.info(buf.toString());
    072            }
    073
    074        }
    075
    076    }
    077