2009/04/15 - Apache HiveMind has been retired.

For more information, please explore the Attic.

Clover coverage report - Code Coverage for hivemind release 1.2.1
Coverage timestamp: Fri Feb 10 2006 16:33:43 PST
file stats: LOC: 118   Methods: 9
NCLOC: 59   Classes: 1
 
 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  3617 public void setExtensionPointId(String extensionPointId)
 60    {
 61  3617 _extensionPointId = extensionPointId;
 62    }
 63   
 64  12019 public String getExtensionPointId()
 65    {
 66  12021 return _extensionPointId;
 67    }
 68   
 69  3618 public void setModule(Module module)
 70    {
 71  3618 _module = module;
 72    }
 73   
 74  4984 public Module getModule()
 75    {
 76  4984 return _module;
 77    }
 78   
 79    /**
 80    * @since 1.1
 81    */
 82  3613 public void setVisibility(Visibility visibility)
 83    {
 84  3613 _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  9680 public boolean visibleToModule(Module module)
 97    {
 98  9678 if (_visibility == Visibility.PUBLIC)
 99  7830 return true;
 100   
 101  1848 return _module.equals(module);
 102    }
 103   
 104    /** @since 1.1 */
 105  2582 public Log getLog()
 106    {
 107  2582 return LogFactory.getLog(getExtensionPointId());
 108    }
 109   
 110    /** @since 1.1 */
 111  1161 public synchronized ErrorLog getErrorLog()
 112    {
 113  1161 if (_errorLog == null)
 114  1018 _errorLog = new ErrorLogImpl(_module.getErrorHandler(), getLog());
 115   
 116  1161 return _errorLog;
 117    }
 118    }