Clover coverage report - Code Coverage for tapestry release 4.0-alpha-3
Coverage timestamp: Mon May 16 2005 09:05:49 EDT
file stats: LOC: 98   Methods: 8
NCLOC: 41   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
InfrastructureContribution.java 100% 100% 100% 100%
coverage
 1   
 // Copyright 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.tapestry.services.impl;
 16   
 
 17   
 import org.apache.hivemind.impl.BaseLocatable;
 18   
 
 19   
 /**
 20   
  * A contribution to the {@link org.apache.tapestry.services.Infrastructure} service. Defines
 21   
  * a property of Infrastructure and the value for that property. The infrastructure is setup in a
 22   
  * <em>mode</em> (currently, either "servlet" or "portlet"). Contributions that define a non-null
 23   
  * mode are ignored unless their mode matches the Infrastructure mode.
 24   
  * <p>
 25   
  * There are two configuration points that control Infrastructure:
 26   
  * <code>tapestry.Infrastructure</code> and <code>tapestry.InfrastructureOverride</code>.
 27   
  * 
 28   
  * @author Howard M. Lewis Ship
 29   
  * @since 4.0
 30   
  */
 31   
 public class InfrastructureContribution extends BaseLocatable
 32   
 {
 33   
     private String _property;
 34   
 
 35   
     private String _mode;
 36   
 
 37   
     private DeferredObject _deferredObject;
 38   
 
 39  1403
     public void setDeferredObject(DeferredObject deferredObject)
 40   
     {
 41  1403
         _deferredObject = deferredObject;
 42   
     }
 43   
 
 44  270
     public void setValue(String value)
 45   
     {
 46  270
         _deferredObject = new LiteralDeferredObject(value, getLocation());
 47   
     }
 48   
 
 49   
     /**
 50   
      * The object which should be exposed as the given Infrastructure property.
 51   
      */
 52  1489
     public Object getObject()
 53   
     {
 54  1489
         return _deferredObject.getObject();
 55   
     }
 56   
 
 57   
     /**
 58   
      * The mode for which this contribution applies, or null if the contribution applies to all
 59   
      * modes.
 60   
      */
 61   
 
 62  2
     public String getMode()
 63   
     {
 64  2
         return _mode;
 65   
     }
 66   
 
 67  188
     public void setMode(String mode)
 68   
     {
 69  188
         _mode = mode;
 70   
     }
 71   
 
 72   
     /**
 73   
      * The property of the {@link org.apache.tapestry.services.Infrastructure}for which a value is
 74   
      * to be provided.
 75   
      */
 76   
 
 77  3041
     public String getProperty()
 78   
     {
 79  3041
         return _property;
 80   
     }
 81   
 
 82  1673
     public void setProperty(String property)
 83   
     {
 84  1673
         _property = property;
 85   
     }
 86   
 
 87  3346
     public boolean matchesMode(String mode)
 88   
     {
 89   
         // If our mode is null, then we only match null.
 90   
 
 91  3346
         if (_mode == mode)
 92  1492
             return true;
 93   
 
 94   
         // Otherwise, match our non-null model against their possibly-null mode.
 95   
 
 96  1854
         return _mode != null && _mode.equals(mode);
 97   
     }
 98   
 }