Clover coverage report -
Coverage timestamp: Sun Feb 29 2004 21:42:04 CET
file stats: LOC: 136   Methods: 5
NCLOC: 76   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
BeanshellHTTPChannelFactory.java 0% 0% 0% 0%
coverage
 1   
 /* ====================================================================
 2   
  The Jicarilla Software License
 3   
 
 4   
  Copyright (c) 2003 Leo Simons.
 5   
  All rights reserved.
 6   
 
 7   
  Permission is hereby granted, free of charge, to any person obtaining
 8   
  a copy of this software and associated documentation files (the
 9   
  "Software"), to deal in the Software without restriction, including
 10   
  without limitation the rights to use, copy, modify, merge, publish,
 11   
  distribute, sublicense, and/or sell copies of the Software, and to
 12   
  permit persons to whom the Software is furnished to do so, subject to
 13   
  the following conditions:
 14   
 
 15   
  The above copyright notice and this permission notice shall be
 16   
  included in all copies or substantial portions of the Software.
 17   
 
 18   
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 19   
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 20   
  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 21   
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 22   
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 23   
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 24   
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 25   
 ==================================================================== */
 26   
 package org.jicarilla.http.plumbing;
 27   
 
 28   
 import EDU.oswego.cs.dl.util.concurrent.LinkedQueue;
 29   
 import org.jicarilla.framework.Assert;
 30   
 import org.jicarilla.framework.RecyclingObjectFactory;
 31   
 import org.jicarilla.framework.plumbing.NoopSink;
 32   
 import org.jicarilla.framework.plumbing.PostProcessor;
 33   
 import org.jicarilla.framework.plumbing.Stage;
 34   
 import org.jicarilla.net.Event;
 35   
 
 36   
 /**
 37   
  *
 38   
  *
 39   
  * @author <a href="lsimons at jicarilla dot org">Leo Simons</a>
 40   
  * @version $Id: BeanshellHTTPChannelFactory.java,v 1.6 2004/02/26 16:51:55 lsimons Exp $
 41   
  */
 42   
 public class BeanshellHTTPChannelFactory extends RecyclingObjectFactory
 43   
 {
 44   
     //private Stage m_stage;
 45   
 
 46  0
     public synchronized Object makeObject() throws Exception
 47   
     {
 48   
         //if( m_stage == null )
 49   
         //{
 50   
             /*Interpreter i = new Interpreter();
 51   
             i.source( "create-pipeline.bsh" );
 52   
 
 53   
             m_stage = (Stage)i.get( "pipeline" );*/
 54   
 
 55   
         //    m_stage = createPipeline();
 56   
         //}
 57   
         //return m_stage;
 58  0
         return createPipeline();
 59   
     }
 60   
 
 61  0
     public Stage createPipeline()
 62   
     {
 63  0
         final PostProcessor processor = new PostProcessor(
 64   
                 new LinkedQueue(),
 65   
                 new NoopSink()
 66   
                 )
 67   
         {
 68  0
             public void put( final Object o ) throws InterruptedException
 69   
             {
 70  0
                 final HTTPEvent e = getEvent( o );
 71  0
                 super.put( e );
 72   
             }
 73   
 
 74  0
             public boolean offer( final Object o, final long l ) throws InterruptedException
 75   
             {
 76  0
                 final HTTPEvent e = getEvent( o );
 77  0
                 return super.offer( e, l );
 78   
             }
 79   
 
 80  0
             protected HTTPEvent getEvent( final Object o )
 81   
             {
 82  0
                 Assert.assertTrue( o instanceof Event );
 83   
 
 84  0
                 if( o instanceof HTTPEvent )
 85  0
                     return (HTTPEvent)o;
 86   
 
 87  0
                 final Event ev = (Event)o;
 88  0
                 final HTTPEvent e = new HTTPEvent();
 89  0
                 e.setChannel( ev.getChannel() );
 90  0
                 e.setContext( ev.getContext() );
 91  0
                 return e;
 92   
             }
 93   
         };
 94   
 
 95  0
         processor.addStage(
 96   
                 new BenchmarkStage( // start
 97   
                         new LinkedQueue(),
 98   
                         new NoopSink()
 99   
                 )
 100   
         );
 101  0
         processor.addStage(
 102   
                 new ParsingStage(
 103   
                         new LinkedQueue(),
 104   
                         new NoopSink()
 105   
                 )
 106   
         );
 107  0
         processor.addStage(
 108   
                 new EchoStage(
 109   
                         new LinkedQueue(),
 110   
                         new NoopSink()
 111   
                 )
 112   
         );
 113   
         /*processor.addStage(
 114   
                 new FilesystemStage(
 115   
                         new LinkedQueue(),
 116   
                         new NoopSink(),
 117   
                         new FilesystemImpl(".")
 118   
                 )
 119   
         );*/
 120  0
         processor.addStage(
 121   
                 new BenchmarkStage( // finish
 122   
                         new LinkedQueue(),
 123   
                         new NoopSink()
 124   
                 )
 125   
         );
 126  0
         processor.addStage(
 127   
                 new WritingStage(
 128   
                         new LinkedQueue(),
 129   
                         new NoopSink()
 130   
                 )
 131   
         );
 132   
 
 133  0
         return processor;
 134   
     }
 135   
 }
 136