Coverage Report - org.apache.camel.Route
 
Classes in this File Line Coverage Branch Coverage Complexity
Route
67% 
N/A 
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;
 19  
 
 20  
 import java.util.ArrayList;
 21  
 import java.util.HashMap;
 22  
 import java.util.List;
 23  
 import java.util.Map;
 24  
 
 25  
 /**
 26  
  * A <a href="http://activemq.apache.org/camel/routes.html">Route</a>
 27  
  * defines the processing used on an inbound message exchange
 28  
  * from a specific {@see Endpoint} within a {@link CamelContext}
 29  
  *
 30  
  * @version $Revision: 541693 $
 31  
  */
 32  
 public abstract class Route<E extends Exchange> {
 33  54
     private final Map<String, Object> properties = new HashMap<String, Object>(16);
 34  
     private Endpoint<E> endpoint;
 35  54
     private List<Service> services = new ArrayList<Service>();
 36  
 
 37  54
     public Route(Endpoint<E> endpoint) {
 38  54
         this.endpoint = endpoint;
 39  54
     }
 40  
 
 41  
     public Endpoint<E> getEndpoint() {
 42  109
         return endpoint;
 43  
     }
 44  
 
 45  
     public void setEndpoint(Endpoint<E> endpoint) {
 46  0
         this.endpoint = endpoint;
 47  0
     }
 48  
 
 49  
     /**
 50  
      * This property map is used to associate information about
 51  
      * the route.
 52  
      *
 53  
      * @return
 54  
      */
 55  
     public Map<String, Object> getProperties() {
 56  0
         return properties;
 57  
     }
 58  
 
 59  
     public List<Service> getServicesForRoute() throws Exception {
 60  41
         List<Service> servicesForRoute = new ArrayList<Service>(getServices());
 61  41
         addServices(servicesForRoute);
 62  41
         return servicesForRoute;
 63  
     }
 64  
 
 65  
     /**
 66  
      * Returns the additional services required for this particular route
 67  
      */
 68  
     public List<Service> getServices() throws Exception {
 69  41
         return services;
 70  
     }
 71  
 
 72  
     public void setServices(List<Service> services) {
 73  0
         this.services = services;
 74  0
     }
 75  
 
 76  
     /**
 77  
      * Strategy method to allow derived classes to lazily load services for the route
 78  
      */
 79  
     protected abstract void addServices(List<Service> services) throws Exception;
 80  
 }