Clover coverage report - Acegi Security System for Spring - 1.0.0-RC1
Coverage timestamp: Mon Dec 5 2005 09:05:15 EST
file stats: LOC: 82   Methods: 2
NCLOC: 25   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AbstractFilterInvocationDefinitionSource.java 100% 100% 100% 100%
coverage
 1    /* Copyright 2004 Acegi Technology Pty Limited
 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   
 16    package org.acegisecurity.intercept.web;
 17   
 18    import org.acegisecurity.ConfigAttributeDefinition;
 19   
 20    import org.apache.commons.logging.Log;
 21    import org.apache.commons.logging.LogFactory;
 22   
 23   
 24    /**
 25    * Abstract implementation of <Code>FilterInvocationDefinitionSource</code>.
 26    *
 27    * @author Ben Alex
 28    * @version $Id: AbstractFilterInvocationDefinitionSource.java,v 1.3 2005/11/17 00:55:50 benalex Exp $
 29    */
 30    public abstract class AbstractFilterInvocationDefinitionSource
 31    implements FilterInvocationDefinitionSource {
 32    //~ Static fields/initializers =============================================
 33   
 34    private static final Log logger = LogFactory.getLog(AbstractFilterInvocationDefinitionSource.class);
 35   
 36    //~ Methods ================================================================
 37   
 38  13 public ConfigAttributeDefinition getAttributes(Object object)
 39    throws IllegalArgumentException {
 40  13 if ((object == null) || !this.supports(object.getClass())) {
 41  2 throw new IllegalArgumentException(
 42    "Object must be a FilterInvocation");
 43    }
 44   
 45  11 String url = ((FilterInvocation) object).getRequestUrl();
 46   
 47  11 return this.lookupAttributes(url);
 48    }
 49   
 50    /**
 51    * Performs the actual lookup of the relevant
 52    * <code>ConfigAttributeDefinition</code> for the specified
 53    * <code>FilterInvocation</code>.
 54    *
 55    * <P>
 56    * Provided so subclasses need only to provide one basic method to properly
 57    * interface with the <code>FilterInvocationDefinitionSource</code>.
 58    * </p>
 59    *
 60    * <P>
 61    * Public visiblity so that tablibs or other view helper classes can access
 62    * the <code>ConfigAttributeDefinition</code> applying to a given URI
 63    * pattern without needing to construct a mock
 64    * <code>FilterInvocation</code> and retrieving the attibutes via the
 65    * {@link #getAttributes(Object)} method.
 66    * </p>
 67    *
 68    * @param url the URI to retrieve configuration attributes for
 69    *
 70    * @return the <code>ConfigAttributeDefinition</code> that applies to the
 71    * specified <code>FilterInvocation</code>
 72    */
 73    public abstract ConfigAttributeDefinition lookupAttributes(String url);
 74   
 75  17 public boolean supports(Class clazz) {
 76  17 if (FilterInvocation.class.isAssignableFrom(clazz)) {
 77  15 return true;
 78    } else {
 79  2 return false;
 80    }
 81    }
 82    }