Clover coverage report - Code Coverage for hivemind release 1.1-alpha-1
Coverage timestamp: Tue Jan 18 2005 07:55:08 EST
file stats: LOC: 116   Methods: 9
NCLOC: 59   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
AbstractExtensionPoint.java 100% 100% 100% 100%
coverage
 1   
 // Copyright 2004, 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.hivemind.impl;
 16   
 
 17   
 import org.apache.commons.logging.Log;
 18   
 import org.apache.commons.logging.LogFactory;
 19   
 import org.apache.hivemind.ErrorLog;
 20   
 import org.apache.hivemind.internal.ExtensionPoint;
 21   
 import org.apache.hivemind.internal.Module;
 22   
 import org.apache.hivemind.internal.Visibility;
 23   
 import org.apache.hivemind.util.ToStringBuilder;
 24   
 
 25   
 /**
 26   
  * Base class for extension points; provides module, visibility and extensionPointId properties.
 27   
  * 
 28   
  * @author Howard Lewis Ship
 29   
  */
 30   
 public abstract class AbstractExtensionPoint extends BaseLocatable implements ExtensionPoint
 31   
 {
 32   
     private Module _module;
 33   
 
 34   
     private String _extensionPointId;
 35   
 
 36   
     /** @since 1.1 */
 37   
     private Visibility _visibility;
 38   
 
 39   
     /** @since 1.1 */
 40   
 
 41   
     private ErrorLog _errorLog;
 42   
 
 43  2
     public synchronized String toString()
 44   
     {
 45  2
         ToStringBuilder builder = new ToStringBuilder(this);
 46  2
         builder.append("extensionPointId", _extensionPointId);
 47  2
         builder.append("visibility", _visibility);
 48   
 
 49  2
         extendDescription(builder);
 50   
 
 51  2
         return builder.toString();
 52   
     }
 53   
 
 54   
     /**
 55   
      * Implemented in subclasses to provide details about subclass properties.
 56   
      */
 57   
     protected abstract void extendDescription(ToStringBuilder builder);
 58   
 
 59  2523
     public void setExtensionPointId(String extensionPointId)
 60   
     {
 61  2523
         _extensionPointId = extensionPointId;
 62   
     }
 63   
 
 64  8603
     public String getExtensionPointId()
 65   
     {
 66  8603
         return _extensionPointId;
 67   
     }
 68   
 
 69  2527
     public void setModule(Module module)
 70   
     {
 71  2527
         _module = module;
 72   
     }
 73   
 
 74  4256
     public Module getModule()
 75   
     {
 76  4256
         return _module;
 77   
     }
 78   
 
 79   
     /**
 80   
      * @since 1.1
 81   
      */
 82  2524
     public void setVisibility(Visibility visibility)
 83   
     {
 84  2524
         _visibility = visibility;
 85   
     }
 86   
 
 87   
     /**
 88   
      * Returns true if the extension point is public, or iff the extension point's module equals the
 89   
      * provided module (which may be null, to indicate no module ... such as when the application
 90   
      * accesses an extension via {@link org.apache.hivemind.Registry}.
 91   
      * 
 92   
      * @since 1.1
 93   
      */
 94  5756
     public boolean visibleToModule(Module module)
 95   
     {
 96  5756
         if (_visibility == Visibility.PUBLIC)
 97  4521
             return true;
 98   
 
 99  1235
         return _module.equals(module);
 100   
     }
 101   
 
 102   
     /** @since 1.1 */
 103  1496
     public Log getLog()
 104   
     {
 105  1496
         return LogFactory.getLog(getExtensionPointId());
 106   
     }
 107   
 
 108   
     /** @since 1.1 */
 109  961
     public synchronized ErrorLog getErrorLog()
 110   
     {
 111  961
         if (_errorLog == null)
 112  838
             _errorLog = new ErrorLogImpl(_module.getErrorHandler(), getLog());
 113   
 
 114  961
         return _errorLog;
 115   
     }
 116   
 }