01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.commons.scxml.env;
18:
19: import java.io.Serializable;
20: import java.util.List;
21: import java.util.Map;
22:
23: import org.apache.commons.logging.Log;
24: import org.apache.commons.logging.LogFactory;
25: import org.apache.commons.scxml.EventDispatcher;
26:
27: /**
28: * Trivial EventDispatcher implementation.
29: * No remote eventing.
30: *
31: */
32: public final class SimpleDispatcher implements EventDispatcher,
33: Serializable {
34:
35: /** Serial version UID. */
36: private static final long serialVersionUID = 1L;
37: /** Implementation independent log category. */
38: private Log log = LogFactory.getLog(EventDispatcher.class);
39:
40: /**
41: * Constructor.
42: */
43: public SimpleDispatcher() {
44: super ();
45: }
46:
47: /**
48: * @see EventDispatcher#cancel(String)
49: */
50: public void cancel(final String sendId) {
51: if (log.isInfoEnabled()) {
52: log.info("cancel( sendId: " + sendId + ")");
53: }
54: }
55:
56: /**
57: @see EventDispatcher#send(String,String,String,String,Map,Object,long,List)
58: */
59: public void send(final String sendId, final String target,
60: final String targetType, final String event,
61: final Map params, final Object hints, final long delay,
62: final List externalNodes) {
63: if (log.isInfoEnabled()) {
64: StringBuffer buf = new StringBuffer();
65: buf.append("send ( sendId: ").append(sendId);
66: buf.append(", target: ").append(target);
67: buf.append(", targetType: ").append(targetType);
68: buf.append(", event: ").append(event);
69: buf.append(", params: ").append(String.valueOf(params));
70: buf.append(", hints: ").append(String.valueOf(hints));
71: buf.append(", delay: ").append(delay);
72: buf.append(')');
73: log.info(buf.toString());
74: }
75:
76: }
77:
78: }
|