Coverage Report - net.admin4j.dao.DAOFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
DAOFactory
100%
7/7
100%
4/4
4
 
 1  
 /*
 2  
  * This software is licensed under the Apache License, Version 2.0
 3  
  * (the "License") agreement; you may not use this file except in compliance with
 4  
  * the License.  You may obtain a copy of the License at
 5  
  * 
 6  
  *      http://www.apache.org/licenses/LICENSE-2.0
 7  
  * 
 8  
  * Unless required by applicable law or agreed to in writing, software
 9  
  * distributed under the License is distributed on an "AS IS" BASIS,
 10  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 11  
  * See the License for the specific language governing permissions and
 12  
  * limitations under the License.
 13  
  */
 14  
 package net.admin4j.dao;
 15  
 
 16  
 import net.admin4j.config.Admin4JConfiguration;
 17  
 import net.admin4j.config.Admin4JConfiguration.StorageFormat;
 18  
 import net.admin4j.dao.xml.ExceptionInfoDAOXml;
 19  
 import net.admin4j.dao.xml.TaskTimerDAOXml;
 20  
 import net.admin4j.util.Admin4jRuntimeException;
 21  
 
 22  
 /**
 23  
  * Provides implemented DAO based on Configuration.
 24  
  * @author D. Ashmore
 25  
  * @since 1.0
 26  
  */
 27  3
 public class DAOFactory {
 28  
     
 29  
     public static ExceptionInfoDAO getExceptionInfoDAO() {
 30  6
         if (StorageFormat.XML.equals(Admin4JConfiguration.getExceptionInformationStorageFormat())) {
 31  3
             return new ExceptionInfoDAOXml();
 32  
         }
 33  3
         throw new Admin4jRuntimeException("Invalid Exception Storage Format")
 34  
             .addContextValue("Format", Admin4JConfiguration.getExceptionInformationStorageFormat());
 35  
     }
 36  
     
 37  
     public static TaskTimerDAO getTaskTimerDAO() {
 38  9
         if (StorageFormat.XML.equals(Admin4JConfiguration.getPerformanceInformationStorageFormat())) {
 39  6
             return new TaskTimerDAOXml();
 40  
         }
 41  3
         throw new Admin4jRuntimeException("Invalid Performance Timing Storage Format")
 42  
             .addContextValue("Format", Admin4JConfiguration.getPerformanceInformationStorageFormat());
 43  
     }
 44  
 
 45  
 }