Clover coverage report - Maven Clover report
Coverage timestamp: Sun Jun 1 2008 20:05:56 EST
file stats: LOC: 93   Methods: 9
NCLOC: 57   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
JGroupsDispatcher.java - 72.2% 77.8% 74.1%
coverage coverage
 1    /**
 2    *
 3    * Copyright 2003-2005 Core Developers Network Ltd.
 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    package org.codehaus.wadi.jgroups;
 18   
 19    import java.util.Collection;
 20   
 21    import org.codehaus.wadi.group.Address;
 22    import org.codehaus.wadi.group.Cluster;
 23    import org.codehaus.wadi.group.ClusterException;
 24    import org.codehaus.wadi.group.EndPoint;
 25    import org.codehaus.wadi.group.Envelope;
 26    import org.codehaus.wadi.group.MessageExchangeException;
 27    import org.codehaus.wadi.group.impl.AbstractDispatcher;
 28    import org.jgroups.ChannelException;
 29    import org.jgroups.blocks.MessageDispatcher;
 30   
 31    /**
 32    * A WADI Dispatcher mapped onto a number of JGroups listeners
 33    *
 34    * @author <a href="mailto:jules@coredevelopers.net">Jules Gosnell</a>
 35    * @version $Revision: 2422 $
 36    */
 37    public class JGroupsDispatcher extends AbstractDispatcher {
 38   
 39    protected final boolean _excludeSelf = true;
 40    protected final JGroupsCluster _cluster;
 41    protected final org.jgroups.Address _localJGAddress;
 42    protected final MessageDispatcher _dispatcher;
 43   
 44  4 public JGroupsDispatcher(String clusterName, String localPeerName, EndPoint endPoint, String config) throws ChannelException {
 45  4 _cluster = new JGroupsCluster(clusterName, localPeerName, config, this, endPoint);
 46  4 _localJGAddress = ((JGroupsPeer) _cluster.getLocalPeer()).getJGAddress();
 47  4 _dispatcher = new MessageDispatcher(_cluster.getChannel(), _cluster, _cluster, null);
 48    }
 49   
 50  4 public String toString() {
 51  4 return "JGroupsDispatcher [" + _cluster + "]";
 52    }
 53   
 54  4 public void start() throws MessageExchangeException {
 55  4 _dispatcher.start();
 56  4 try {
 57  4 _cluster.start();
 58    } catch (ClusterException e) {
 59  0 throw new MessageExchangeException(e);
 60    }
 61    }
 62   
 63  4 public void stop() throws MessageExchangeException {
 64  4 try {
 65  4 _cluster.stop();
 66    } catch (ClusterException e) {
 67  0 throw new MessageExchangeException(e);
 68    }
 69  4 _dispatcher.stop();
 70    }
 71   
 72  10 public Envelope createEnvelope() {
 73  11 return new JGroupsEnvelope();
 74    }
 75   
 76  11 protected void doSend(Address target, Envelope envelope) throws MessageExchangeException {
 77  11 _cluster.send(target, envelope);
 78    }
 79   
 80  0 public String getPeerName(Address address) {
 81  0 JGroupsPeer peer = (JGroupsPeer) address;
 82  0 return peer.getName();
 83    }
 84   
 85  22 public Cluster getCluster() {
 86  22 return _cluster;
 87    }
 88   
 89  0 public void findRelevantSessionNames(int numPartitions, Collection[] resultSet) {
 90  0 throw new UnsupportedOperationException("NYI");
 91    }
 92   
 93    }