Coverage Report - org.mule.extras.spring.config.UMOManagerFactoryBean
 
Classes in this File Line Coverage Branch Coverage Complexity
UMOManagerFactoryBean
0%
0/37
0%
0/7
1.4
 
 1  
 /*
 2  
  * $Id: UMOManagerFactoryBean.java 7976 2007-08-21 14:26:13Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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  
 
 11  
 package org.mule.extras.spring.config;
 12  
 
 13  
 import org.mule.MuleManager;
 14  
 import org.mule.config.MuleConfiguration;
 15  
 import org.mule.umo.UMOException;
 16  
 import org.mule.umo.UMOInterceptorStack;
 17  
 import org.mule.umo.endpoint.UMOEndpoint;
 18  
 import org.mule.umo.lifecycle.InitialisationException;
 19  
 import org.mule.umo.manager.UMOManager;
 20  
 import org.mule.umo.manager.UMOTransactionManagerFactory;
 21  
 import org.mule.umo.model.UMOModel;
 22  
 import org.mule.umo.provider.UMOConnector;
 23  
 import org.mule.umo.transformer.UMOTransformer;
 24  
 
 25  
 import java.util.Iterator;
 26  
 import java.util.List;
 27  
 import java.util.Map;
 28  
 
 29  
 import org.springframework.beans.factory.DisposableBean;
 30  
 import org.springframework.beans.factory.FactoryBean;
 31  
 import org.springframework.beans.factory.InitializingBean;
 32  
 
 33  
 /**
 34  
  * <code>UMOManagerFactoryBean</code> is a Spring FactoryBean used for creating a
 35  
  * MuleManager from a Spring context. The context must explicitly wire the beans
 36  
  * together. Users might want to try AutowireUMOManagerFactoryBean for a simpler and
 37  
  * cleaner spring configuration.
 38  
  * 
 39  
  * @see AutowireUMOManagerFactoryBean
 40  
  * @deprecated use AutowireUMOManagerFactoryBean
 41  
  */
 42  
 public class UMOManagerFactoryBean implements FactoryBean, InitializingBean, DisposableBean
 43  
 {
 44  
     private final UMOManager manager;
 45  
 
 46  
     public UMOManagerFactoryBean() throws Exception
 47  0
     {
 48  0
         this.manager = MuleManager.getInstance();
 49  0
     }
 50  
 
 51  
     public Object getObject() throws Exception
 52  
     {
 53  0
         return manager;
 54  
     }
 55  
 
 56  
     public Class getObjectType()
 57  
     {
 58  0
         return UMOManager.class;
 59  
     }
 60  
 
 61  
     public boolean isSingleton()
 62  
     {
 63  0
         return true;
 64  
     }
 65  
 
 66  
     public void setMessageEndpoints(Map endpoints) throws InitialisationException
 67  
     {
 68  0
         for (Iterator iterator = endpoints.entrySet().iterator(); iterator.hasNext();)
 69  
         {
 70  0
             Map.Entry entry = (Map.Entry)iterator.next();
 71  0
             manager.registerEndpointIdentifier(entry.getKey().toString(), entry.getValue().toString());
 72  
         }
 73  0
     }
 74  
 
 75  
     public void setProperties(Map props)
 76  
     {
 77  0
         for (Iterator iterator = props.entrySet().iterator(); iterator.hasNext();)
 78  
         {
 79  0
             Map.Entry entry = (Map.Entry)iterator.next();
 80  0
             manager.setProperty(entry.getKey(), entry.getValue());
 81  
         }
 82  0
     }
 83  
 
 84  
     public void setConfiguration(MuleConfiguration config) throws UMOException
 85  
     {
 86  0
         MuleManager.setConfiguration(config);
 87  0
     }
 88  
 
 89  
     public void setTransactionManagerFactory(UMOTransactionManagerFactory factory) throws Exception
 90  
     {
 91  0
         manager.setTransactionManager(factory.create());
 92  0
     }
 93  
 
 94  
     public void setConnectors(List connectors) throws UMOException
 95  
     {
 96  0
         for (Iterator iterator = connectors.iterator(); iterator.hasNext();)
 97  
         {
 98  0
             manager.registerConnector((UMOConnector)iterator.next());
 99  
         }
 100  0
     }
 101  
 
 102  
     public void setTransformers(List transformers) throws InitialisationException
 103  
     {
 104  0
         for (Iterator iterator = transformers.iterator(); iterator.hasNext();)
 105  
         {
 106  0
             manager.registerTransformer((UMOTransformer)iterator.next());
 107  
         }
 108  0
     }
 109  
 
 110  
     public void setProviders(List endpoints) throws InitialisationException
 111  
     {
 112  0
         for (Iterator iterator = endpoints.iterator(); iterator.hasNext();)
 113  
         {
 114  0
             manager.registerEndpoint((UMOEndpoint)iterator.next());
 115  
         }
 116  0
     }
 117  
 
 118  
     public void setInterceptorStacks(Map interceptors)
 119  
     {
 120  0
         for (Iterator iterator = interceptors.entrySet().iterator(); iterator.hasNext();)
 121  
         {
 122  0
             Map.Entry entry = (Map.Entry)iterator.next();
 123  0
             manager.registerInterceptorStack(entry.getKey().toString(), (UMOInterceptorStack)entry.getValue());
 124  
         }
 125  0
     }
 126  
 
 127  
     public void setModel(UMOModel model) throws UMOException
 128  
     {
 129  0
         manager.registerModel(model);
 130  0
     }
 131  
 
 132  
     public void afterPropertiesSet() throws Exception
 133  
     {
 134  0
         manager.start();
 135  0
     }
 136  
 
 137  
     public void destroy() throws Exception
 138  
     {
 139  0
         manager.dispose();
 140  0
     }
 141  
 
 142  
 }