Clover coverage report - Code Coverage for tapestry release 4.0-alpha-3
Coverage timestamp: Mon May 16 2005 09:05:49 EDT
file stats: LOC: 53   Methods: 2
NCLOC: 24   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
ClasspathAssetFactory.java 50% 83.3% 100% 80%
coverage coverage
 1   
 // Copyright 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.asset;
 16   
 
 17   
 import java.util.Locale;
 18   
 
 19   
 import org.apache.hivemind.ApplicationRuntimeException;
 20   
 import org.apache.hivemind.Location;
 21   
 import org.apache.hivemind.Resource;
 22   
 import org.apache.hivemind.util.ClasspathResource;
 23   
 import org.apache.tapestry.IAsset;
 24   
 import org.apache.tapestry.engine.IEngineService;
 25   
 
 26   
 /**
 27   
  * Creates instances of {@link org.apache.tapestry.asset.PrivateAsset}, which are the holders of
 28   
  * classpath: resources.
 29   
  * 
 30   
  * @author Howard M. Lewis Ship
 31   
  * @since 4.0
 32   
  */
 33   
 public class ClasspathAssetFactory implements AssetFactory
 34   
 {
 35   
     private IEngineService _assetService;
 36   
 
 37  53
     public IAsset createAsset(Resource baseResource, String path, Locale locale, Location location)
 38   
     {
 39  53
         Resource asset = baseResource.getRelativeResource(path);
 40  53
         Resource localized = asset.getLocalization(locale);
 41   
 
 42  53
         if (localized == null)
 43  0
             throw new ApplicationRuntimeException(AssetMessages.missingAsset(path, baseResource),
 44   
                     location, null);
 45   
 
 46  53
         return new PrivateAsset((ClasspathResource) localized, _assetService, location);
 47   
     }
 48   
 
 49  27
     public void setAssetService(IEngineService assetService)
 50   
     {
 51  27
         _assetService = assetService;
 52   
     }
 53   
 }