Clover coverage report - Code Coverage for tapestry release 4.0-beta-2
Coverage timestamp: Sat Jul 9 2005 22:02:17 EDT
file stats: LOC: 179   Methods: 15
NCLOC: 78   Classes: 1
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
AbstractSpecificationResolver.java - 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.tapestry.resolver;
 16   
 17    import org.apache.hivemind.Resource;
 18    import org.apache.tapestry.INamespace;
 19    import org.apache.tapestry.Tapestry;
 20    import org.apache.tapestry.engine.ISpecificationSource;
 21    import org.apache.tapestry.spec.IComponentSpecification;
 22   
 23    /**
 24    * Base class for resolving a {@link org.apache.tapestry.spec.IComponentSpecification}for a
 25    * particular page or component, within a specified {@link org.apache.tapestry.INamespace}. In some
 26    * cases, a search is necessary.
 27    *
 28    * @author Howard Lewis Ship
 29    * @since 3.0
 30    */
 31   
 32    public class AbstractSpecificationResolver
 33    {
 34    /** Set by resolve() */
 35    private INamespace _namespace;
 36   
 37    /** Set by resolve() */
 38    private IComponentSpecification _specification;
 39   
 40    /** Set by container */
 41    private ISpecificationSource _specificationSource;
 42   
 43    private ISpecificationResolverDelegate _delegate;
 44   
 45    private String _applicationId;
 46   
 47    private Resource _contextRoot;
 48   
 49    /** Initialized in initializeService() */
 50   
 51    private Resource _webInfLocation;
 52   
 53    private Resource _webInfAppLocation;
 54   
 55  217 public void initializeService()
 56    {
 57  217 _webInfLocation = _contextRoot.getRelativeResource("WEB-INF/");
 58   
 59  217 _webInfAppLocation = _webInfLocation.getRelativeResource(_applicationId + "/");
 60    }
 61   
 62    /**
 63    * Returns the {@link ISpecificationResolverDelegate}instance registered in the application
 64    * specification as extension {@link Tapestry#SPECIFICATION_RESOLVER_DELEGATE_EXTENSION_NAME},
 65    * or null if no such extension exists.
 66    */
 67   
 68  5 public ISpecificationResolverDelegate getDelegate()
 69    {
 70  5 return _delegate;
 71    }
 72   
 73    /**
 74    * Returns the location of the servlet, within the servlet context.
 75    */
 76   
 77  216 protected Resource getContextRoot()
 78    {
 79  216 return _contextRoot;
 80    }
 81   
 82  217 public void setContextRoot(Resource contextRoot)
 83    {
 84  217 _contextRoot = contextRoot;
 85    }
 86   
 87    /**
 88    * Invoked in subclasses to identify the resolved namespace.
 89    */
 90   
 91  1641 protected void setNamespace(INamespace namespace)
 92    {
 93  1641 _namespace = namespace;
 94    }
 95   
 96    /**
 97    * Returns the resolve namespace.
 98    */
 99   
 100  1670 public INamespace getNamespace()
 101    {
 102  1670 return _namespace;
 103    }
 104   
 105    /**
 106    * Returns the specification source for the running application.
 107    */
 108   
 109  441 protected ISpecificationSource getSpecificationSource()
 110    {
 111  441 return _specificationSource;
 112    }
 113   
 114    /**
 115    * Returns the location of /WEB-INF/, in the servlet context.
 116    */
 117   
 118  168 protected Resource getWebInfLocation()
 119    {
 120  168 return _webInfLocation;
 121    }
 122   
 123    /**
 124    * Returns the location of the application-specific subdirectory, under /WEB-INF/, in the
 125    * servlet context.
 126    */
 127   
 128  170 protected Resource getWebInfAppLocation()
 129    {
 130  170 return _webInfAppLocation;
 131    }
 132   
 133    /**
 134    * Returns the resolved specification.
 135    */
 136   
 137  4391 public IComponentSpecification getSpecification()
 138    {
 139  4391 return _specification;
 140    }
 141   
 142    /**
 143    * Invoked in subclass to set the final specification the initial inputs are resolved to.
 144    */
 145   
 146  1609 protected void setSpecification(IComponentSpecification specification)
 147    {
 148  1609 _specification = specification;
 149    }
 150   
 151    /**
 152    * Clears the namespace and specification properties.
 153    */
 154   
 155  1612 protected void reset()
 156    {
 157  1612 _namespace = null;
 158  1612 _specification = null;
 159    }
 160   
 161    /** @since 4.0 */
 162  207 public void setDelegate(ISpecificationResolverDelegate delegate)
 163    {
 164  207 _delegate = delegate;
 165    }
 166   
 167    /** @since 4.0 */
 168  213 public void setApplicationId(String applicationId)
 169    {
 170  213 _applicationId = applicationId;
 171    }
 172   
 173    /** @since 4.0 */
 174  221 public void setSpecificationSource(ISpecificationSource source)
 175    {
 176  221 _specificationSource = source;
 177    }
 178   
 179    }