Clover coverage report - Maven Clover report
Coverage timestamp: Sun Jun 1 2008 19:59:48 EST
file stats: LOC: 79   Methods: 8
NCLOC: 47   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
VMDispatcher.java 0% 53.3% 87.5% 51.7%
coverage coverage
 1    /**
 2    * Copyright 2006 The Apache Software Foundation
 3    *
 4    * Licensed under the Apache License, Version 2.0 (the "License");
 5    * you may not use this file except in compliance with the License.
 6    * You may obtain a copy of the License at
 7    *
 8    * http://www.apache.org/licenses/LICENSE-2.0
 9    *
 10    * Unless required by applicable law or agreed to in writing, software
 11    * distributed under the License is distributed on an "AS IS" BASIS,
 12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13    * See the License for the specific language governing permissions and
 14    * limitations under the License.
 15    */
 16    package org.codehaus.wadi.group.vm;
 17   
 18    import org.codehaus.wadi.group.Address;
 19    import org.codehaus.wadi.group.Cluster;
 20    import org.codehaus.wadi.group.EndPoint;
 21    import org.codehaus.wadi.group.Envelope;
 22    import org.codehaus.wadi.group.MessageExchangeException;
 23    import org.codehaus.wadi.group.impl.AbstractDispatcher;
 24   
 25    /**
 26    *
 27    * @version $Revision: 1603 $
 28    */
 29    public class VMDispatcher extends AbstractDispatcher {
 30    private final VMLocalPeer localNode;
 31    private final VMLocalCluster cluster;
 32   
 33  8 public VMDispatcher(VMBroker cluster, String nodeName, EndPoint endPoint) {
 34  8 localNode = new VMLocalPeer(nodeName);
 35  8 this.cluster = new VMLocalCluster(cluster, localNode, this);
 36    }
 37   
 38  91 public Cluster getCluster() {
 39  91 return cluster;
 40    }
 41   
 42  8 public void start() throws MessageExchangeException {
 43  8 cluster.registerDispatcher(this);
 44    }
 45   
 46  4 public void stop() throws MessageExchangeException {
 47  4 cluster.unregisterDispatcher(this);
 48    }
 49   
 50  0 public String getPeerName(Address address) {
 51  0 if (null == address) {
 52  0 return "<NULL Destination>";
 53    }
 54   
 55  0 if (address instanceof VMAddress) {
 56  0 return ((VMAddress) address).getNodeName();
 57  0 } else if (address instanceof VMClusterAddress) {
 58  0 return ((VMClusterAddress) address).getClusterName();
 59    }
 60   
 61  0 throw new IllegalArgumentException("Expected " +
 62    VMAddress.class.getName() +
 63    " or " + VMClusterAddress.class.getName() +
 64    ". Was:" + address.getClass().getName());
 65    }
 66   
 67  3 protected void doSend(Address target, Envelope envelope) throws MessageExchangeException {
 68  3 cluster.send(target, envelope);
 69    }
 70   
 71  3 public Envelope createEnvelope() {
 72  3 return new VMEnvelope();
 73    }
 74   
 75  4 public String toString() {
 76  4 return "VMDispatcher for node " + localNode;
 77    }
 78   
 79    }