##### Coverage Report - org.apache.commons.scxml.env.SimpleDispatcher

Classes in this File | Line Coverage | Branch Coverage | Complexity
SimpleDispatcher |
39% |
100% |
| 1.6666666666666667;1.667

1 |  |
     /*
2 |  |
      *
3 |  |
      *   Copyright 2005-2006 The Apache Software Foundation.
4 |  |
      *
5 |  |
      *  Licensed under the Apache License, Version 2.0 (the "License");
6 |  |
      *  you may not use this file except in compliance with the License.
7 |  |
      *  You may obtain a copy of the License at
8 |  |
      *
9 |  |
      *      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 |  |
      */
18 |  |
     package org.apache.commons.scxml.env;
19 |  |
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 |  |
34 |  |
          /** Implementation independent log category. */
35 | 41 |
          private Log log = LogFactory.getLog(EventDispatcher.class);
36 |  |
37 |  |
         /**
38 |  |
          *  Constructor.
39 |  |
          */
40 |  |
         public SimpleDispatcher() {
41 | 36 |
             super();
42 | 36 |
         }
43 |  |
44 |  |
         /**
45 |  |
          * @see EventDispatcher#cancel(String)
46 |  |
          */
47 |  |
         public void cancel(final String sendId) {
48 | 1 |
             if (log.isInfoEnabled()) {
49 | 0 |
                 log.info("cancel( sendId: " + sendId + ")");
50 |  |
             }
51 | 1 |
         }
52 |  |
53 |  |
         /**
54 |  |
         @see EventDispatcher#send(String,String,String,String,Map,Object,long,List)
55 |  |
          */
56 |  |
         public void send(final String sendId, final String target,
57 |  |
                 final String targetType, final String event, final Map params,
58 |  |
                 final Object hints, final long delay, final List externalNodes) {
59 | 1 |
             if (log.isInfoEnabled()) {
60 | 0 |
                 StringBuffer buf = new StringBuffer();
61 | 0 |
                 buf.append("send ( sendId: ").append(sendId);
62 | 0 |
                 buf.append(", target: ").append(target);
63 | 0 |
                 buf.append(", targetType: ").append(targetType);
64 | 0 |
                 buf.append(", event: ").append(event);
65 | 0 |
                 buf.append(", params: ").append(String.valueOf(params));
66 | 0 |
                 buf.append(", hints: ").append(String.valueOf(hints));
67 | 0 |
                 buf.append(", delay: ").append(delay);
68 | 0 |
                 buf.append(')');
69 | 0 |
                 log.info(buf.toString());
70 |  |
             }
71 |  |
72 | 1 |
         }
73 |  |
74 |  |
     }
75 |  |