Coverage Report - org.apache.camel.component.direct.DirectComponent
 
Classes in this File Line Coverage Branch Coverage Complexity
DirectComponent
92% 
100% 
0
 
 1  
 /**
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.camel.component.direct;
 18  
 
 19  
 import java.net.URI;
 20  
 import java.util.Map;
 21  
 import java.util.concurrent.ScheduledExecutorService;
 22  
 
 23  
 import org.apache.camel.CamelContext;
 24  
 import org.apache.camel.Component;
 25  
 import org.apache.camel.Endpoint;
 26  
 import org.apache.camel.Exchange;
 27  
 import org.apache.camel.util.IntrospectionSupport;
 28  
 import org.apache.camel.util.ObjectHelper;
 29  
 import org.apache.camel.util.URISupport;
 30  
 
 31  
 /**
 32  
  * Represents the component that manages {@link DirectEndpoint}. It holds the
 33  
  * list of named direct endpoints.
 34  
  * 
 35  
  * @org.apache.xbean.XBean
 36  
  * @version $Revision: 519973 $
 37  
  */
 38  153
 public class DirectComponent<E extends Exchange> implements Component<E> {
 39  
 
 40  
     private CamelContext context;
 41  
 
 42  
     public CamelContext getCamelContext() {
 43  372
         return context;
 44  
     }
 45  
 
 46  
     public ScheduledExecutorService getExecutorService() {
 47  0
         return null;
 48  
     }
 49  
 
 50  
     public Endpoint<E> createEndpoint(String uri) throws Exception {
 51  
 
 52  186
         ObjectHelper.notNull(getCamelContext(), "camelContext");
 53  186
         URI u = new URI(uri);
 54  186
         Map parameters = URISupport.parseParamters(u);
 55  
 
 56  186
         Endpoint<E> endpoint = new DirectEndpoint<E>(uri, this);
 57  186
         if (parameters != null) {
 58  186
             IntrospectionSupport.setProperties(endpoint, parameters);
 59  
         }
 60  186
         return endpoint;
 61  
     }
 62  
 
 63  
     public void setCamelContext(CamelContext context) {
 64  153
         this.context = context;
 65  153
     }
 66  
 
 67  
 }