Clover coverage report - Code Coverage for hivemind release 1.1-alpha-2
Coverage timestamp: Wed Feb 23 2005 09:59:04 EST
file stats: LOC: 118   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  3108
     public void setExtensionPointId(String extensionPointId)
 60   
     {
 61  3108
         _extensionPointId = extensionPointId;
 62   
     }
 63   
 
 64  9350
     public String getExtensionPointId()
 65   
     {
 66  9350
         return _extensionPointId;
 67   
     }
 68   
 
 69  3112
     public void setModule(Module module)
 70   
     {
 71  3112
         _module = module;
 72   
     }
 73   
 
 74  4322
     public Module getModule()
 75   
     {
 76  4322
         return _module;
 77   
     }
 78   
 
 79   
     /**
 80   
      * @since 1.1
 81   
      */
 82  3110
     public void setVisibility(Visibility visibility)
 83   
     {
 84  3110
         _visibility = visibility;
 85   
     }
 86   
 
 87   
     /**
 88   
      * Returns true if the extension point is public, or the extgension point is visible to the
 89   
      * module.
 90   
      * 
 91   
      * @param module
 92   
      *            The module to validate visibility against, or null for no module ... such as when
 93   
      *            the application accesses an extension via {@link org.apache.hivemind.Registry}.
 94   
      * @since 1.1
 95   
      */
 96  6954
     public boolean visibleToModule(Module module)
 97   
     {
 98  6954
         if (_visibility == Visibility.PUBLIC)
 99  5318
             return true;
 100   
 
 101  1636
         return _module.equals(module);
 102   
     }
 103   
 
 104   
     /** @since 1.1 */
 105  1589
     public Log getLog()
 106   
     {
 107  1589
         return LogFactory.getLog(getExtensionPointId());
 108   
     }
 109   
 
 110   
     /** @since 1.1 */
 111  1023
     public synchronized ErrorLog getErrorLog()
 112   
     {
 113  1023
         if (_errorLog == null)
 114  894
             _errorLog = new ErrorLogImpl(_module.getErrorHandler(), getLog());
 115   
 
 116  1023
         return _errorLog;
 117   
     }
 118   
 }