Coverage Report - org.mule.config.dsl.ServiceBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
ServiceBuilder
0%
0/18
N/A
1
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.config.dsl;
 8  
 
 9  
 import org.mule.api.MuleContext;
 10  
 import org.mule.api.routing.OutboundRouterCollection;
 11  
 import org.mule.api.service.Service;
 12  
 import org.mule.model.seda.SedaService;
 13  
 
 14  
 /**
 15  
  * TODO
 16  
  */
 17  
 public class ServiceBuilder
 18  
 {
 19  
     private Service service;
 20  
     private MuleContext muleContext;
 21  
 
 22  
 
 23  
     public ServiceBuilder(String name, MuleContext muleContext)
 24  0
     {
 25  0
         this.muleContext = muleContext;
 26  0
         service = new SedaService(muleContext);
 27  0
         service.setName(name);
 28  0
     }
 29  
 
 30  
     public ComponentBuilder toComponent(Class clazz)
 31  
     {
 32  0
         ComponentBuilder builder = new ComponentBuilder(ComponentBuilder.Scope.Prototype, clazz, muleContext);
 33  0
         service.setComponent(builder.create());
 34  0
         return builder;
 35  
     }
 36  
 
 37  
     public ComponentBuilder toPooledComponent(Class clazz)
 38  
     {
 39  0
         ComponentBuilder builder = new ComponentBuilder(ComponentBuilder.Scope.Pooled, clazz, muleContext);
 40  0
         service.setComponent(builder.create());
 41  0
         return builder;
 42  
     }
 43  
 
 44  
     public ComponentBuilder toComponent(Object instance)
 45  
     {
 46  0
         ComponentBuilder builder = new ComponentBuilder(instance, muleContext);
 47  0
         service.setComponent(builder.create());
 48  0
         return builder;
 49  
     }
 50  
 
 51  
     public OutRouteBuilder to(String uri)
 52  
     {
 53  0
         OutRouteBuilder rb = new OutRouteBuilder(
 54  
             (OutboundRouterCollection) service.getOutboundMessageProcessor(), muleContext);
 55  0
         rb.to(uri);
 56  0
         return rb;
 57  
     }
 58  
 
 59  
     Service create()
 60  
     {
 61  0
         return service;
 62  
     }
 63  
 }