Clover Coverage Report - ARESTC 0.1.5
Coverage timestamp: Tue Aug 10 2010 10:22:22 CEST
../../../../../img/srcFileCovDistChart7.png 69% of files have more coverage
14   90   4   7
4   33   0.29   2
2     2  
1    
 
  ChainBuilder       Line # 29 14 0% 4 6 70% 0.7
 
  (16)
 
1    /*
2    *
3    * (C)opyright 2010, Nikolaos Georgosopoulos
4    *
5    * This file is part of ARESTC.
6   
7    ARESTC is free software: you can redistribute it and/or modify
8    it under the terms of the Lesser General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11   
12    ARESTC is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15    GNU General Public License for more details.
16   
17    You should have received a copy of the Lesser General Public License
18    along with ARESTC. If not, see <http://www.gnu.org/licenses/>.
19   
20    */
21    package net.sf.arestc.core.commands;
22   
23    import net.sf.arestc.core.ConnectorCommand;
24    import net.sf.arestc.core.ConnectorContext;
25   
26    /**
27    * The Class ChainBuilder.
28    */
 
29    public class ChainBuilder {
30   
31    /** The Constant instance. */
32    public static final ChainBuilder instance = new ChainBuilder();
33   
34    /**
35    * Gets the default chain.
36    *
37    * @param context
38    * the context
39    * @param initialTransformer
40    * the initial transformer
41    * @param endTransformer
42    * the end transformer
43    * @return the default chain
44    */
 
45  17 toggle public ConnectorCommand getDefaultChain(final ConnectorContext context,
46    final ConnectorCommand initialTransformer,
47    final ConnectorCommand endTransformer) {
48   
49   
50  17 final ConnectorCommand transform = context.getService()
51    .getRequestTransformer();
52  17 final ConnectorCommand call = new CallServer(new TransformResponse(
53    endTransformer));
54  17 transform.setNextLink(call);
55  17 ConnectorCommand firstLink = transform;
56  17 if (null != initialTransformer) {
57  0 initialTransformer.setNextLink(transform);
58  0 firstLink = initialTransformer;
59    }
60   
61  17 return firstLink;
62    }
63   
64    /**
65    * Gets the dummy chain.
66    *
67    * @param context
68    * the context
69    * @param initialTransformer
70    * the initial transformer
71    * @param endTransformer
72    * the end transformer
73    * @return the dummy chain
74    */
 
75  1 toggle public ConnectorCommand getDummyChain(final ConnectorContext context,
76    final ConnectorCommand initialTransformer,
77    final ConnectorCommand endTransformer) {
78   
79  1 final ConnectorCommand dummy = new DummyTransformer(
80    new TransformResponse(endTransformer));
81   
82  1 ConnectorCommand firstLink = dummy;
83  1 if (null != initialTransformer) {
84  0 initialTransformer.setNextLink(dummy);
85  0 firstLink = initialTransformer;
86    }
87   
88  1 return firstLink;
89    }
90    }