Coverage Report - org.apache.camel.component.jpa.JpaComponent
 
Classes in this File Line Coverage Branch Coverage Complexity
JpaComponent
73% 
100% 
0
 
 1  
 /**
 2  
  *
 3  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 4  
  * contributor license agreements.  See the NOTICE file distributed with
 5  
  * this work for additional information regarding copyright ownership.
 6  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 7  
  * (the "License"); you may not use this file except in compliance with
 8  
  * the License.  You may obtain a copy of the License at
 9  
  *
 10  
  * http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 package org.apache.camel.component.jpa;
 19  
 
 20  
 import org.apache.camel.CamelContext;
 21  
 import org.apache.camel.Component;
 22  
 import org.apache.camel.Endpoint;
 23  
 import org.apache.camel.Exchange;
 24  
 import org.apache.camel.impl.DefaultComponent;
 25  
 import org.apache.camel.util.IntrospectionSupport;
 26  
 import org.apache.camel.util.ObjectHelper;
 27  
 
 28  
 import javax.persistence.EntityManagerFactory;
 29  
 import java.util.Map;
 30  
 
 31  
 /**
 32  
  * A JPA Component
 33  
  *
 34  
  * @version $Revision: 533794 $
 35  
  */
 36  3
 public class JpaComponent extends DefaultComponent<Exchange> {
 37  
     private EntityManagerFactory entityManagerFactory;
 38  
 
 39  
     public Component resolveComponent(CamelContext container, String uri) throws Exception {
 40  0
         return null;
 41  
     }
 42  
 
 43  
     // Properties
 44  
     //-------------------------------------------------------------------------
 45  
     public EntityManagerFactory getEntityManagerFactory() {
 46  3
         return entityManagerFactory;
 47  
     }
 48  
 
 49  
     public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
 50  0
         this.entityManagerFactory = entityManagerFactory;
 51  0
     }
 52  
 
 53  
     // Implementation methods
 54  
     //-------------------------------------------------------------------------
 55  
 
 56  
     @Override
 57  
     protected Endpoint<Exchange> createEndpoint(String uri, String path, Map options) throws Exception {
 58  3
         JpaEndpoint endpoint = new JpaEndpoint(uri, this);
 59  
 
 60  
         // lets interpret the next string as a class
 61  3
         if (path != null) {
 62  3
             Class<?> type = ObjectHelper.loadClass(path);
 63  3
             if (type != null) {
 64  3
                 endpoint.setEntityType(type);
 65  
             }
 66  
         }
 67  3
         return endpoint;
 68  
     }
 69  
 }