Coverage Report - org.apache.commons.resources.impl.XMLResourcesFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
XMLResourcesFactory
0%
0/5
N/A
1
 
 1  
 /*
 2  
  * $Id: XMLResourcesFactory.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  
 import org.apache.commons.resources.Resources;
 27  
 import org.apache.commons.resources.ResourcesException;
 28  
 
 29  
 /**
 30  
  * <p>Concrete implementation of {@link org.apache.commons.resources.ResourcesFactory} that creates
 31  
  * {@link org.apache.commons.resources.Resources} instances that wrap a family (one per Locale) of
 32  
  * XML documents that share a base URL and have name suffices reflecting
 33  
  * the Locale for which the document's messages apply.  Resources are
 34  
  * looked up in a hierarchy of documents in a manner identical to that
 35  
  * performed by <code>java.util.ResourceBundle.getBundle()</code>.</p>
 36  
  *
 37  
  * <p>The configuration variable passed to the <code>createResources()</code>
 38  
  * method must be the URL of the base name of the XML document family.
 39  
  * For example, if the configuration URL is passed as
 40  
  * <code>http://localhost/foo/Bar</code>, the resources for the
 41  
  * <code>en_US</code> Locale would be stored under URL
 42  
  * <code>http://localhost/foo/Bar_en_US.xml</code>, and the default
 43  
  * resources would be stored in
 44  
  * <code>http://localhost/foo/Bar.xml</code>.</p>
 45  
  */
 46  0
 public class XMLResourcesFactory extends ResourcesFactoryBase {
 47  
 
 48  
     /**
 49  
      * <p>Create and return a new {@link org.apache.commons.resources.Resources} instance with the
 50  
      * specified logical name, after calling its <code>init()</code>
 51  
      * method and delegating the relevant properties.</p>
 52  
      *
 53  
      * @param name Logical name of the {@link org.apache.commons.resources.Resources} instance to create
 54  
      * @param config Configuration string for this resource (if any)
 55  
      * @return The new Resources instance.
 56  
      *
 57  
      * @exception ResourcesException if a {@link org.apache.commons.resources.Resources} instance
 58  
      *  of the specified logical name cannot be created.
 59  
      */
 60  
     protected Resources createResources(String name, String config) {
 61  
 
 62  0
         Resources res = new XMLResources(name, config);
 63  0
         res.setReturnNull(isReturnNull());
 64  0
         res.init();
 65  0
         return (res);
 66  
 
 67  
     }
 68  
 
 69  
 
 70  
 }