Coverage Report - org.kuali.rice.core.jpa.spring.RiceEntityManagerProxyFactoryBean
 
Classes in this File Line Coverage Branch Coverage Complexity
RiceEntityManagerProxyFactoryBean
0%
0/11
0%
0/6
1.6
 
 1  
 /*
 2  
  * Copyright 2007-2008 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.core.jpa.spring;
 17  
 
 18  
 import javax.persistence.EntityManagerFactory;
 19  
 import javax.sql.DataSource;
 20  
 
 21  
 import org.kuali.rice.core.util.OrmUtils;
 22  
 import org.springframework.beans.factory.FactoryBean;
 23  
 import org.springframework.beans.factory.InitializingBean;
 24  
 
 25  
 /**
 26  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 27  
  */
 28  
 public class RiceEntityManagerProxyFactoryBean implements FactoryBean, InitializingBean {
 29  
 
 30  
         private RiceLocalContainerEntityManagerFactoryBean factoryBean;
 31  
         private String prefix;
 32  
         private DataSource datasource;
 33  
                 
 34  0
         public RiceEntityManagerProxyFactoryBean(String prefix, DataSource datasource) {
 35  0
                 this.prefix = prefix;
 36  0
                 this.datasource = datasource;
 37  0
         }        
 38  
 
 39  
         public void afterPropertiesSet() throws Exception {
 40  0
                 if (OrmUtils.isJpaEnabled(prefix)) {
 41  0
                         factoryBean = new RiceLocalContainerEntityManagerFactoryBean(prefix, datasource);
 42  0
                         factoryBean.afterPropertiesSet();
 43  
                 }
 44  0
         }
 45  
         
 46  
         public Class getObjectType() {
 47  0
                 return (factoryBean != null ? factoryBean.getObjectType() : EntityManagerFactory.class);
 48  
         }
 49  
 
 50  
         public Object getObject() throws Exception {
 51  0
                 return (factoryBean != null ? factoryBean.getObject() : new NullEntityManagerFactory());
 52  
         }
 53  
 
 54  
         public boolean isSingleton() {
 55  0
                 return true;
 56  
         }
 57  
 
 58  
 }