Coverage Report - org.mule.RegistryContext
 
Classes in this File Line Coverage Branch Coverage Complexity
RegistryContext
88%
7/8
25%
1/4
1.25
 
 1  
 /*
 2  
  * $Id: RegistryContext.java 12269 2008-07-10 04:19:03Z dfeist $
 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  
 package org.mule;
 11  
 
 12  
 import org.mule.api.config.MuleConfiguration;
 13  
 import org.mule.api.registry.Registry;
 14  
 import org.mule.registry.TransientRegistry;
 15  
 
 16  
 /** 
 17  
  * A handle to the Mule Registry.  We should make no assumptions about the location of the actual Registry
 18  
  * implementation.  It might be simply a singleton object in the same JVM, or it might be in another JVM or 
 19  
  * even running remotely on another machine.
 20  
  */
 21  0
 public class RegistryContext
 22  
 {
 23  
     protected static Registry registry;
 24  
     
 25  
     public static Registry getRegistry()
 26  
     {
 27  39506
         return registry;
 28  
     }
 29  
 
 30  
     public static synchronized void setRegistry(Registry registry)
 31  
     {
 32  4898
         RegistryContext.registry = registry;
 33  4898
     }
 34  
 
 35  
     public static MuleConfiguration getConfiguration()
 36  
     {
 37  
         // TODO Migrate uses to obtain configuration from MuleContext
 38  30
         return MuleServer.getMuleContext().getConfiguration();
 39  
     }
 40  
 
 41  
     public static Registry getOrCreateRegistry()
 42  
     {
 43  1160
         if (registry == null || registry.isDisposed())
 44  
         {
 45  1160
             registry = new TransientRegistry();
 46  
         }
 47  1160
         return registry;
 48  
     }
 49  
 }