Coverage Report - org.mule.config.dsl.ComponentBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
ComponentBuilder
0%
0/16
0%
0/4
0
ComponentBuilder$Scope
0%
0/4
N/A
0
 
 1  
 /*
 2  
  * $Id: ComponentBuilder.java 20321 2010-11-24 15:21:24Z dfeist $
 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.component.Component;
 14  
 import org.mule.api.object.ObjectFactory;
 15  
 import org.mule.component.DefaultJavaComponent;
 16  
 import org.mule.component.PooledJavaComponent;
 17  
 import org.mule.object.AbstractObjectFactory;
 18  
 import org.mule.object.PrototypeObjectFactory;
 19  
 import org.mule.object.SingletonObjectFactory;
 20  
 
 21  
 /**
 22  
  * TODO
 23  
  */
 24  
 public class ComponentBuilder
 25  
 {
 26  0
     public enum Scope
 27  
     {
 28  0
         Prototype,
 29  0
         Pooled,
 30  0
         Singleton;
 31  
     }
 32  
 
 33  
     private Component component;
 34  
     private MuleContext muleContext;
 35  
 
 36  
     ComponentBuilder(Scope scope, Class clazz, MuleContext muleContext)
 37  0
     {
 38  0
         this.muleContext = muleContext;
 39  
         AbstractObjectFactory factory;
 40  0
         if (scope == Scope.Singleton)
 41  
         {
 42  0
             factory = new SingletonObjectFactory(clazz);
 43  
         }
 44  
         else
 45  
         {
 46  0
             factory = new PrototypeObjectFactory(clazz);
 47  
         }
 48  
 
 49  0
         if (scope == Scope.Pooled)
 50  
         {
 51  0
             component = new PooledJavaComponent(factory);
 52  
         }
 53  
         else
 54  
         {
 55  0
             component = new DefaultJavaComponent(factory);
 56  
         }
 57  0
     }
 58  
 
 59  
     ComponentBuilder(Object instance, MuleContext muleContext)
 60  0
     {
 61  0
         this.muleContext = muleContext;
 62  0
         ObjectFactory  factory = new SingletonObjectFactory(instance);
 63  0
         component = new DefaultJavaComponent(factory);
 64  0
     }
 65  
 
 66  
     Component create()
 67  
     {
 68  0
         return component;
 69  
     }
 70  
 
 71  
     public OutRouteBuilder to(String uri)
 72  
     {
 73  0
         return null;
 74  
     }
 75  
 }