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