Clover coverage report - ActiveIO - 1.0
Coverage timestamp: Fri Apr 22 2005 14:27:22 PDT
file stats: LOC: 101   Methods: 11
NCLOC: 50   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
FilterAsynchChannelServer.java 37.5% 50% 54.5% 48.7%
coverage coverage
 1   
 /**
 2   
  *
 3   
  * Copyright 2004 Hiram Chirino
 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.activeio;
 18   
 
 19   
 import java.io.IOException;
 20   
 import java.net.URI;
 21   
 
 22   
 
 23   
 /**
 24   
  * A AsynchChannelFilter can be used as a filter between a {@see org.activeio.AsynchChannel}
 25   
  * and it's {@see org.activeio.ChannelConsumer}.  Most {@see org.activeio.AsynchChannel}
 26   
  * that are not directly accessing the network will extends the AsynchChannelFilter since they act as a
 27   
  * filter between the client and the network.  O 
 28   
  * 
 29   
  * @version $Revision$
 30   
  */
 31   
 public class FilterAsynchChannelServer implements AsynchChannelServer, AcceptListener {
 32   
 
 33   
     final protected AsynchChannelServer next;
 34   
     protected AcceptListener acceptListener;
 35   
 
 36  36
     public FilterAsynchChannelServer(AsynchChannelServer next) {
 37  36
         this.next = next;
 38  36
         if( next == null )
 39  0
             throw new IllegalArgumentException("The next AsynchChannelServer cannot be null.");
 40   
     }
 41   
 
 42  36
     public void setAcceptListener(AcceptListener acceptListener) {
 43  36
         this.acceptListener = acceptListener;
 44  36
         if (acceptListener == null)
 45  0
             next.setAcceptListener(null);
 46   
         else
 47  36
             next.setAcceptListener(this);
 48   
         
 49   
     }
 50   
     
 51   
     /**
 52   
      * @see org.activeio.Disposable#dispose()
 53   
      */
 54  36
     public void dispose() {
 55  36
         next.dispose();
 56   
     }
 57   
 
 58   
     /**
 59   
      * @see org.activeio.Service#start()
 60   
      * @throws IOException if the next channel has not been set.
 61   
      */
 62  36
     public void start() throws IOException {
 63  36
         if( acceptListener ==null )
 64  0
             throw new IOException("The AcceptListener has not been set.");
 65  36
         next.start();
 66   
     }
 67   
 
 68   
     /**
 69   
      * @see org.activeio.Service#stop(long)
 70   
      */
 71  0
     public void stop(long timeout) throws IOException {
 72  0
         next.stop(timeout);
 73   
     }
 74   
 
 75  48
     public void onAccept(Channel channel) {
 76  48
         acceptListener.onAccept(channel);
 77   
     }
 78   
 
 79  0
     public void onAcceptError(IOException error) {
 80  0
         acceptListener.onAcceptError(error);
 81   
     }
 82   
 
 83  0
     public URI getBindURI() {
 84  0
         return next.getBindURI();
 85   
     }
 86   
 
 87  80
     public URI getConnectURI() {
 88  80
         return next.getConnectURI();
 89   
     }
 90   
     
 91  0
     public Object narrow(Class target) {
 92  0
         if( target.isAssignableFrom(getClass()) ) {
 93  0
             return this;
 94   
         }
 95  0
         return next.narrow(target);
 96   
     }    
 97   
     
 98  0
     public String toString() {
 99  0
         return next.toString();
 100   
     }
 101   
  }