Coverage Report - org.apache.commons.resources.impl.WebappXMLResourcesFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
WebappXMLResourcesFactory
0%
0/5
N/A
1
 
 1  
 /*
 2  
  * $Id: WebappXMLResourcesFactory.java 349025 2005-11-25 21:09:54Z niallp $
 3  
  * $Revision: 349025 $
 4  
  * $Date: 2005-11-25 21:09:54 +0000 (Fri, 25 Nov 2005) $
 5  
  *
 6  
  * ====================================================================
 7  
  *
 8  
  *  Copyright 2003-2005 The Apache Software Foundation
 9  
  *
 10  
  *  Licensed under the Apache License, Version 2.0 (the "License");
 11  
  *  you may not use this file except in compliance with the License.
 12  
  *  You may obtain a copy of the License at
 13  
  *
 14  
  *      http://www.apache.org/licenses/LICENSE-2.0
 15  
  *
 16  
  *  Unless required by applicable law or agreed to in writing, software
 17  
  *  distributed under the License is distributed on an "AS IS" BASIS,
 18  
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 19  
  *  See the License for the specific language governing permissions and
 20  
  *  limitations under the License.
 21  
  *
 22  
  */
 23  
 
 24  
 package org.apache.commons.resources.impl;
 25  
 
 26  
 
 27  
 import org.apache.commons.resources.Resources;
 28  
 import org.apache.commons.resources.ResourcesException;
 29  
 
 30  
 /**
 31  
  * <p>Concrete implementation of {@link org.apache.commons.resources.ResourcesFactory} that creates
 32  
  * {@link org.apache.commons.resources.Resources} instances that wrap a family (one per Locale) of
 33  
  * XML documents that share a base context-relative path for
 34  
  * servlet context resources, and have name suffixes reflecting
 35  
  * the Locale for which the document's messages apply.  Resources are
 36  
  * looked up in a hierarchy of documents in a manner identical to that
 37  
  * performed by <code>java.util.ResourceBundle.getBundle()</code>.</p>
 38  
  *
 39  
  * <p>The configuration variable passed to the <code>createResources()</code>
 40  
  * method must be the context-relative base name of the XML document family,
 41  
  * and must begin with a slash ('/') character.
 42  
  * For example, if the configuration URL is passed as
 43  
  * <code>/WEB-INF/resources/MyResources</code>, the resources for the
 44  
  * <code>en_US</code> Locale would be stored under context resource
 45  
  * <code>/WEB-INF/resources/MyReesources_en_US.xml</code>, and the default
 46  
  * resources would be stored in
 47  
  * <code>/WEB-INF/resources/MyResources.xml</code>.</p>
 48  
  */
 49  0
 public class WebappXMLResourcesFactory extends WebappResourcesFactoryBase {
 50  
 
 51  
     /**
 52  
      * <p>Create and return a new {@link org.apache.commons.resources.Resources} instance with the
 53  
      * specified logical name, after calling its <code>init()</code>
 54  
      * method and delegating the relevant properties.</p>
 55  
      *
 56  
      * @param name Logical name of the {@link org.apache.commons.resources.Resources} instance to create
 57  
      * @param config Configuration string for this resource (if any)
 58  
      * @return The new Resources instance.
 59  
      *
 60  
      * @exception ResourcesException if a {@link org.apache.commons.resources.Resources} instance
 61  
      *  of the specified logical name cannot be created.
 62  
      */
 63  
     protected Resources createResources(String name, String config) {
 64  
 
 65  0
         Resources res =
 66  
             new WebappXMLResources(name, config, getServletContext());
 67  0
         res.setReturnNull(isReturnNull());
 68  0
         res.init();
 69  0
         return (res);
 70  
 
 71  
     }
 72  
 
 73  
 
 74  
 }