Coverage Report - org.mule.DefaultMuleContext
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultMuleContext
0%
0/167
0%
0/46
1.653
 
 1  
 /*
 2  
  * $Id: DefaultMuleContext.java 20088 2010-11-05 16:51:41Z aperepel $
 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;
 11  
 
 12  
 import org.mule.api.MuleContext;
 13  
 import org.mule.api.MuleException;
 14  
 import org.mule.api.MuleRuntimeException;
 15  
 import org.mule.api.client.LocalMuleClient;
 16  
 import org.mule.api.config.MuleConfiguration;
 17  
 import org.mule.api.config.MuleProperties;
 18  
 import org.mule.api.config.ThreadingProfile;
 19  
 import org.mule.api.context.MuleContextAware;
 20  
 import org.mule.api.context.WorkManager;
 21  
 import org.mule.api.context.notification.ServerNotification;
 22  
 import org.mule.api.context.notification.ServerNotificationListener;
 23  
 import org.mule.api.exception.SystemExceptionHandler;
 24  
 import org.mule.api.expression.ExpressionManager;
 25  
 import org.mule.api.lifecycle.Disposable;
 26  
 import org.mule.api.lifecycle.Initialisable;
 27  
 import org.mule.api.lifecycle.InitialisationException;
 28  
 import org.mule.api.lifecycle.LifecycleManager;
 29  
 import org.mule.api.lifecycle.Startable;
 30  
 import org.mule.api.lifecycle.Stoppable;
 31  
 import org.mule.api.registry.MuleRegistry;
 32  
 import org.mule.api.registry.RegistrationException;
 33  
 import org.mule.api.registry.Registry;
 34  
 import org.mule.api.security.SecurityManager;
 35  
 import org.mule.api.transaction.TransactionManagerFactory;
 36  
 import org.mule.client.DefaultLocalMuleClient;
 37  
 import org.mule.config.DefaultMuleConfiguration;
 38  
 import org.mule.config.i18n.CoreMessages;
 39  
 import org.mule.context.notification.MuleContextNotification;
 40  
 import org.mule.context.notification.NotificationException;
 41  
 import org.mule.context.notification.ServerNotificationManager;
 42  
 import org.mule.exception.DefaultSystemExceptionStrategy;
 43  
 import org.mule.expression.DefaultExpressionManager;
 44  
 import org.mule.lifecycle.MuleContextLifecycleManager;
 45  
 import org.mule.management.stats.AllStatistics;
 46  
 import org.mule.registry.DefaultRegistryBroker;
 47  
 import org.mule.registry.MuleRegistryHelper;
 48  
 import org.mule.util.ApplicationShutdownSplashScreen;
 49  
 import org.mule.util.ApplicationStartupSplashScreen;
 50  
 import org.mule.util.ServerShutdownSplashScreen;
 51  
 import org.mule.util.ServerStartupSplashScreen;
 52  
 import org.mule.util.SplashScreen;
 53  
 import org.mule.util.queue.QueueManager;
 54  
 
 55  
 import java.util.Collection;
 56  
 
 57  
 import javax.resource.spi.work.WorkListener;
 58  
 import javax.transaction.TransactionManager;
 59  
 
 60  
 import org.apache.commons.logging.Log;
 61  
 import org.apache.commons.logging.LogFactory;
 62  
 
 63  
 public class DefaultMuleContext implements MuleContext
 64  
 {
 65  
     /**
 66  
      * logger used by this class
 67  
      */
 68  0
     private transient Log logger = LogFactory.getLog(DefaultMuleContext.class);
 69  
 
 70  
     /**
 71  
      * Internal registry facade which delegates to other registries.
 72  
      */
 73  
     private DefaultRegistryBroker registryBroker;
 74  
 
 75  
     /**
 76  
      * Simplified Mule configuration interface
 77  
      */
 78  
     private MuleRegistry muleRegistryHelper;
 79  
 
 80  
     /**
 81  
      * stats used for management
 82  
      */
 83  0
     private AllStatistics stats = new AllStatistics();
 84  
 
 85  
     private WorkManager workManager;
 86  
 
 87  
     private WorkListener workListener;
 88  
 
 89  
     /**
 90  
      * LifecycleManager for the MuleContext.  Note: this is NOT the same lifecycle manager
 91  
      * as the one in the Registry.
 92  
      */
 93  
     protected MuleContextLifecycleManager lifecycleManager;
 94  
 
 95  
     protected ServerNotificationManager notificationManager;
 96  
 
 97  
     private MuleConfiguration config;
 98  
 
 99  
     /**
 100  
      * the date in milliseconds from when the server was started
 101  
      */
 102  
     private long startDate;
 103  
 
 104  
     private ExpressionManager expressionManager;
 105  
 
 106  
     private ClassLoader executionClassLoader;
 107  
     
 108  
     protected LocalMuleClient localMuleClient;
 109  
     
 110  
     /** Global exception handler which handles "system" exceptions (i.e., when no message is involved). */
 111  
     protected SystemExceptionHandler exceptionListener;
 112  
 
 113  
     public DefaultMuleContext(MuleConfiguration config,
 114  
                               WorkManager workManager,
 115  
                               WorkListener workListener,
 116  
                               MuleContextLifecycleManager lifecycleManager,
 117  
                               ServerNotificationManager notificationManager)
 118  0
     {
 119  0
         this.config = config;
 120  0
         ((MuleContextAware) config).setMuleContext(this);
 121  0
         this.workManager = workManager;
 122  0
         this.workListener = workListener;
 123  0
         this.lifecycleManager = lifecycleManager;
 124  0
         this.notificationManager = notificationManager;
 125  0
         this.notificationManager.setMuleContext(this);
 126  
         //there is no point having this object configurable
 127  0
         this.expressionManager = new DefaultExpressionManager();
 128  0
         ((MuleContextAware) this.expressionManager).setMuleContext(this);
 129  0
         registryBroker = createRegistryBroker();
 130  0
         muleRegistryHelper = createRegistryHelper(registryBroker);
 131  0
         localMuleClient = new DefaultLocalMuleClient(this);
 132  0
         exceptionListener = new DefaultSystemExceptionStrategy(this);
 133  0
     }
 134  
 
 135  
     protected DefaultRegistryBroker createRegistryBroker()
 136  
     {
 137  0
         return new DefaultRegistryBroker(this);
 138  
     }
 139  
 
 140  
     protected MuleRegistry createRegistryHelper(DefaultRegistryBroker registry)
 141  
     {
 142  0
         return new MuleRegistryHelper(registry, this);
 143  
     }
 144  
 
 145  
     public synchronized void initialise() throws InitialisationException
 146  
     {
 147  0
         lifecycleManager.checkPhase(Initialisable.PHASE_NAME);
 148  
 
 149  0
         if (getNotificationManager() == null)
 150  
         {
 151  0
             throw new MuleRuntimeException(
 152  
                     CoreMessages.objectIsNull(MuleProperties.OBJECT_NOTIFICATION_MANAGER));
 153  
         }
 154  0
         if (workManager == null)
 155  
         {
 156  0
             throw new MuleRuntimeException(CoreMessages.objectIsNull("workManager"));
 157  
         }
 158  
 
 159  
         try
 160  
         {
 161  
             // Initialize the helper, this only initialises the helper class and does not call the registry lifecycle manager
 162  
             //The registry lifecycle is called below using 'getLifecycleManager().fireLifecycle(Initialisable.PHASE_NAME);'
 163  0
             muleRegistryHelper.initialise();
 164  
 
 165  
             //We need to start the work manager straight away since we need it to fire notifications
 166  0
             if (workManager instanceof MuleContextAware)
 167  
             {
 168  0
                 MuleContextAware contextAware = (MuleContextAware) workManager;
 169  0
                 contextAware.setMuleContext(this);
 170  
             }
 171  
 
 172  0
             workManager.start();
 173  0
             getNotificationManager().start(workManager, workListener);
 174  0
             fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_INITIALISING));
 175  0
             getLifecycleManager().fireLifecycle(Initialisable.PHASE_NAME);
 176  
 
 177  0
             fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_INITIALISED));
 178  
         }
 179  0
         catch (Exception e)
 180  
         {
 181  0
             throw new InitialisationException(e, this);
 182  0
         }
 183  0
     }
 184  
 
 185  
     public synchronized void start() throws MuleException
 186  
     {
 187  0
         getLifecycleManager().checkPhase(Startable.PHASE_NAME);
 188  
 
 189  0
         if (getSecurityManager() == null)
 190  
         {
 191  0
             throw new MuleRuntimeException(CoreMessages.objectIsNull("securityManager"));
 192  
         }
 193  0
         if (getQueueManager() == null)
 194  
         {
 195  0
             throw new MuleRuntimeException(CoreMessages.objectIsNull("queueManager"));
 196  
         }
 197  
 
 198  0
         startDate = System.currentTimeMillis();
 199  
 
 200  0
         fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_STARTING));
 201  0
         getLifecycleManager().fireLifecycle(Startable.PHASE_NAME);
 202  
 
 203  
 
 204  0
         fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_STARTED));
 205  
 
 206  0
         if (logger.isInfoEnabled())
 207  
         {
 208  0
             SplashScreen startupScreen = buildStartupSplash();
 209  0
             logger.info(startupScreen.toString());
 210  
         }
 211  0
     }
 212  
 
 213  
     /**
 214  
      * Stops the <code>MuleContext</code> which stops all sessions and
 215  
      * connectors
 216  
      *
 217  
      * @throws MuleException if either any of the sessions or connectors fail to stop
 218  
      */
 219  
     public synchronized void stop() throws MuleException
 220  
     {
 221  0
         getLifecycleManager().checkPhase(Stoppable.PHASE_NAME);
 222  0
         fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_STOPPING));
 223  0
         getLifecycleManager().fireLifecycle(Stoppable.PHASE_NAME);
 224  0
         fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_STOPPED));
 225  0
     }
 226  
 
 227  
     public synchronized void dispose()
 228  
     {
 229  0
         if (isStarted())
 230  
         {
 231  
             try
 232  
             {
 233  0
                 stop();
 234  
             }
 235  0
             catch (MuleException e)
 236  
             {
 237  0
                 logger.error("Failed to stop Mule context", e);
 238  0
             }
 239  
         }
 240  
 
 241  0
         getLifecycleManager().checkPhase(Disposable.PHASE_NAME);
 242  
 
 243  0
         fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_DISPOSING));
 244  
 
 245  
         try
 246  
         {
 247  0
             getLifecycleManager().fireLifecycle(Disposable.PHASE_NAME);
 248  
 
 249  
             // THis is a little odd. I find the relationship between the MuleRegistry Helper and the registry broker, too much abstraction?
 250  0
             muleRegistryHelper.dispose();
 251  
         }
 252  0
         catch (Exception e)
 253  
         {
 254  0
             logger.debug("Failed to cleanly dispose Mule: " + e.getMessage(), e);
 255  0
         }
 256  
 
 257  0
         notificationManager.fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_DISPOSED));
 258  
 
 259  0
         notificationManager.dispose();
 260  0
         workManager.dispose();
 261  
 
 262  0
         if ((getStartDate() > 0) && logger.isInfoEnabled())
 263  
         {
 264  0
             SplashScreen shutdownScreen = buildShutdownSplash();
 265  0
             logger.info(shutdownScreen.toString());
 266  
         }
 267  
 
 268  
         //registryBroker.dispose();
 269  
 
 270  0
         setExecutionClassLoader(null);
 271  0
     }
 272  
 
 273  
     /**
 274  
      * Determines if the server has been initialised
 275  
      *
 276  
      * @return true if the server has been initialised
 277  
      */
 278  
     public boolean isInitialised()
 279  
     {
 280  0
         return getLifecycleManager().getState().isInitialised();
 281  
     }
 282  
 
 283  
     /**
 284  
      * Determines if the server is being initialised
 285  
      *
 286  
      * @return true if the server is beening initialised
 287  
      */
 288  
     public boolean isInitialising()
 289  
     {
 290  0
         return getLifecycleManager().getState().isInitialising();
 291  
     }
 292  
 
 293  
     public boolean isStopped()
 294  
     {
 295  0
         return getLifecycleManager().getState().isStopped();
 296  
     }
 297  
 
 298  
     public boolean isStopping()
 299  
     {
 300  0
         return getLifecycleManager().getState().isStopping();
 301  
     }
 302  
 
 303  
     /**
 304  
      * Determines if the server has been started
 305  
      *
 306  
      * @return true if the server has been started
 307  
      */
 308  
     public boolean isStarted()
 309  
     {
 310  0
         return getLifecycleManager().isPhaseComplete(Startable.PHASE_NAME);
 311  
     }
 312  
 
 313  
     public boolean isStarting()
 314  
     {
 315  0
         return getLifecycleManager().getState().isStarting();
 316  
     }
 317  
 
 318  
     public boolean isDisposed()
 319  
     {
 320  0
         return getLifecycleManager().getState().isDisposed();
 321  
     }
 322  
 
 323  
     public boolean isDisposing()
 324  
     {
 325  0
         return getLifecycleManager().getState().isDisposing();
 326  
     }
 327  
 
 328  
     public LifecycleManager getLifecycleManager()
 329  
     {
 330  0
         return lifecycleManager;
 331  
     }
 332  
 
 333  
     /**
 334  
      * Gets all statistics for this instance
 335  
      *
 336  
      * @return all statistics for this instance
 337  
      */
 338  
     public AllStatistics getStatistics()
 339  
     {
 340  0
         return stats;
 341  
     }
 342  
 
 343  
     public void registerListener(ServerNotificationListener l) throws NotificationException
 344  
     {
 345  0
         registerListener(l, null);
 346  0
     }
 347  
 
 348  
     public void registerListener(ServerNotificationListener l, String resourceIdentifier) throws NotificationException
 349  
     {
 350  0
         ServerNotificationManager notificationManager = getNotificationManager();
 351  0
         if (notificationManager == null)
 352  
         {
 353  0
             throw new MuleRuntimeException(CoreMessages.serverNotificationManagerNotEnabled());
 354  
         }
 355  0
         notificationManager.addListenerSubscription(l, resourceIdentifier);
 356  0
     }
 357  
 
 358  
     public void unregisterListener(ServerNotificationListener l)
 359  
     {
 360  0
         ServerNotificationManager notificationManager = getNotificationManager();
 361  0
         if (notificationManager != null)
 362  
         {
 363  0
             notificationManager.removeListener(l);
 364  
         }
 365  0
     }
 366  
 
 367  
     /**
 368  
      * Fires a server notification to all registered
 369  
      * {@link org.mule.api.context.notification.CustomNotificationListener} notificationManager.
 370  
      *
 371  
      * @param notification the notification to fire. This must be of type
 372  
      *                     {@link org.mule.context.notification.CustomNotification} otherwise an
 373  
      *                     exception will be thrown.
 374  
      * @throws UnsupportedOperationException if the notification fired is not a
 375  
      *                                       {@link org.mule.context.notification.CustomNotification}
 376  
      */
 377  
     public void fireNotification(ServerNotification notification)
 378  
     {
 379  0
         ServerNotificationManager notificationManager = getNotificationManager();
 380  0
         if (notificationManager != null)
 381  
         {
 382  0
             notificationManager.fireNotification(notification);
 383  
         }
 384  0
         else if (logger.isDebugEnabled())
 385  
         {
 386  0
             logger.debug("MuleEvent Manager is not enabled, ignoring notification: " + notification);
 387  
         }
 388  0
     }
 389  
 
 390  
     /**
 391  
      * Sets the security manager used by this Mule instance to authenticate and
 392  
      * authorise incoming and outgoing event traffic and service invocations
 393  
      *
 394  
      * @param securityManager the security manager used by this Mule instance to
 395  
      *                        authenticate and authorise incoming and outgoing event traffic
 396  
      *                        and service invocations
 397  
      */
 398  
     public void setSecurityManager(SecurityManager securityManager) throws RegistrationException
 399  
     {
 400  0
         checkLifecycleForPropertySet(MuleProperties.OBJECT_SECURITY_MANAGER, Initialisable.PHASE_NAME);
 401  0
         registryBroker.registerObject(MuleProperties.OBJECT_SECURITY_MANAGER, securityManager);
 402  0
     }
 403  
 
 404  
     /**
 405  
      * Gets the security manager used by this Mule instance to authenticate and
 406  
      * authorise incoming and outgoing event traffic and service invocations
 407  
      *
 408  
      * @return he security manager used by this Mule instance to authenticate
 409  
      *         and authorise incoming and outgoing event traffic and service
 410  
      *         invocations
 411  
      */
 412  
     public SecurityManager getSecurityManager()
 413  
     {
 414  0
         SecurityManager securityManager = (SecurityManager) registryBroker.lookupObject(MuleProperties.OBJECT_SECURITY_MANAGER);
 415  0
         if (securityManager == null)
 416  
         {
 417  0
             Collection temp = registryBroker.lookupObjects(SecurityManager.class);
 418  0
             if (temp.size() > 0)
 419  
             {
 420  0
                 securityManager = ((SecurityManager) temp.iterator().next());
 421  
             }
 422  
         }
 423  0
         return securityManager;
 424  
     }
 425  
 
 426  
     /**
 427  
      * Obtains a workManager instance that can be used to schedule work in a
 428  
      * thread pool. This will be used primarially by Agents wanting to
 429  
      * schedule work. This work Manager must <b>never</b> be used by provider
 430  
      * implementations as they have their own workManager accible on the
 431  
      * connector.
 432  
      * <p/>
 433  
      * If a workManager has not been set by the time the
 434  
      * <code>initialise()</code> method has been called a default
 435  
      * <code>MuleWorkManager</code> will be created using the
 436  
      * <i>DefaultThreadingProfile</i> on the <code>MuleConfiguration</code>
 437  
      * object.
 438  
      *
 439  
      * @return a workManager instance used by the current MuleManager
 440  
      * @see org.mule.api.config.ThreadingProfile
 441  
      * @see DefaultMuleConfiguration
 442  
      */
 443  
     public WorkManager getWorkManager()
 444  
     {
 445  0
         return workManager;
 446  
     }
 447  
 
 448  
     public WorkListener getWorkListener()
 449  
     {
 450  0
         return workListener;
 451  
     }
 452  
 
 453  
     public QueueManager getQueueManager()
 454  
     {
 455  0
         QueueManager queueManager = (QueueManager) registryBroker.lookupObject(MuleProperties.OBJECT_QUEUE_MANAGER);
 456  0
         if (queueManager == null)
 457  
         {
 458  0
             Collection temp = registryBroker.lookupObjects(QueueManager.class);
 459  0
             if (temp.size() > 0)
 460  
             {
 461  0
                 queueManager = ((QueueManager) temp.iterator().next());
 462  
             }
 463  
         }
 464  0
         return queueManager;
 465  
     }
 466  
 
 467  
     public void setQueueManager(QueueManager queueManager) throws RegistrationException
 468  
     {
 469  0
         checkLifecycleForPropertySet(MuleProperties.OBJECT_QUEUE_MANAGER, Initialisable.PHASE_NAME);
 470  0
         registryBroker.registerObject(MuleProperties.OBJECT_QUEUE_MANAGER, queueManager);
 471  0
     }
 472  
 
 473  
     /**
 474  
      * @return the MuleConfiguration for this MuleManager. This object is immutable
 475  
      *         once the manager has initialised.
 476  
      */
 477  
     public MuleConfiguration getConfiguration()
 478  
     {
 479  
 
 480  0
         return config;
 481  
         //return (MuleConfiguration) getRegistry().lookupObject(MuleProperties.OBJECT_MULE_CONFIGURATION);
 482  
     }
 483  
 
 484  
     public ServerNotificationManager getNotificationManager()
 485  
     {
 486  0
         return notificationManager;
 487  
     }
 488  
 
 489  
     /**
 490  
      * Sets the JTA Transaction Manager to use with this Mule server instance
 491  
      *
 492  
      * @param manager the manager to use
 493  
      * @throws RegistrationException if a transaction manager has already been set
 494  
      */
 495  
     public void setTransactionManager(TransactionManager manager) throws RegistrationException
 496  
     {
 497  
         //checkLifecycleForPropertySet(MuleProperties.OBJECT_TRANSACTION_MANAGER, Initialisable.PHASE_NAME);
 498  0
         registryBroker.registerObject(MuleProperties.OBJECT_TRANSACTION_MANAGER, manager);
 499  0
     }
 500  
 
 501  
     /**
 502  
      * Returns the Jta transaction manager used by this Mule server instance. or
 503  
      * null if a transaction manager has not been set
 504  
      *
 505  
      * @return the Jta transaction manager used by this Mule server instance. or
 506  
      *         null if a transaction manager has not been set
 507  
      */
 508  
     public TransactionManager getTransactionManager()
 509  
     {
 510  0
         TransactionManager transactionManager = (TransactionManager) registryBroker.lookupObject(MuleProperties.OBJECT_TRANSACTION_MANAGER);
 511  0
         if (transactionManager == null)
 512  
         {
 513  0
             Collection temp = registryBroker.lookupObjects(TransactionManagerFactory.class);
 514  0
             if (temp.size() > 0)
 515  
             {
 516  
                 try
 517  
                 {
 518  0
                     transactionManager = (((TransactionManagerFactory) temp.iterator().next()).create(config));
 519  
                 }
 520  0
                 catch (Exception e)
 521  
                 {
 522  0
                     throw new MuleRuntimeException(CoreMessages.failedToCreate("transaction manager"), e);
 523  0
                 }
 524  
             }
 525  
             else
 526  
             {
 527  0
                 temp = registryBroker.lookupObjects(TransactionManager.class);
 528  0
                 if (temp.size() > 0)
 529  
                 {
 530  0
                     transactionManager = (((TransactionManager) temp.iterator().next()));
 531  
                 }
 532  
             }
 533  
         }
 534  0
         return transactionManager;
 535  
     }
 536  
 
 537  
     protected void checkLifecycleForPropertySet(String propertyName, String phase) throws IllegalStateException
 538  
     {
 539  0
         if (lifecycleManager.isPhaseComplete(phase))
 540  
         {
 541  0
             throw new IllegalStateException("Cannot set property: '" + propertyName + "' once the server has been gone through the " + phase + " phase.");
 542  
         }
 543  0
     }
 544  
 
 545  
     public MuleRegistry getRegistry()
 546  
     {
 547  0
         return muleRegistryHelper;
 548  
     }
 549  
 
 550  
     public ThreadingProfile getDefaultMessageDispatcherThreadingProfile()
 551  
     {
 552  0
         return (ThreadingProfile) getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_MESSAGE_DISPATCHER_THREADING_PROFILE);
 553  
     }
 554  
 
 555  
     public ThreadingProfile getDefaultMessageRequesterThreadingProfile()
 556  
     {
 557  0
         return (ThreadingProfile) getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_MESSAGE_REQUESTER_THREADING_PROFILE);
 558  
     }
 559  
 
 560  
     public ThreadingProfile getDefaultMessageReceiverThreadingProfile()
 561  
     {
 562  0
         return (ThreadingProfile) getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_MESSAGE_RECEIVER_THREADING_PROFILE);
 563  
     }
 564  
 
 565  
     public ThreadingProfile getDefaultServiceThreadingProfile()
 566  
     {
 567  0
         return (ThreadingProfile) getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_SERVICE_THREADING_PROFILE);
 568  
     }
 569  
 
 570  
     public ThreadingProfile getDefaultThreadingProfile()
 571  
     {
 572  0
         return (ThreadingProfile) getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_THREADING_PROFILE);
 573  
     }
 574  
 
 575  
     /**
 576  
      * Returns the long date when the server was started
 577  
      *
 578  
      * @return the long date when the server was started
 579  
      */
 580  
     public long getStartDate()
 581  
     {
 582  0
         return startDate;
 583  
     }
 584  
 
 585  
     /**
 586  
      * Returns the Expression Manager configured for this instance of Mule
 587  
      *
 588  
      * @return the Expression Manager configured for this instance of Mule
 589  
      * @see org.mule.api.expression.ExpressionManager
 590  
      */
 591  
     public ExpressionManager getExpressionManager()
 592  
     {
 593  0
         return expressionManager;
 594  
     }
 595  
 
 596  
     public void setExecutionClassLoader(ClassLoader cl)
 597  
     {
 598  0
         this.executionClassLoader = cl;
 599  0
     }
 600  
 
 601  
     public ClassLoader getExecutionClassLoader()
 602  
     {
 603  0
         return executionClassLoader;
 604  
     }
 605  
 
 606  
     public void addRegistry(Registry registry)
 607  
     {
 608  0
         registryBroker.addRegistry(registry);
 609  0
     }
 610  
 
 611  
     public void removeRegistry(Registry registry)
 612  
     {
 613  0
         registryBroker.removeRegistry(registry);
 614  0
     }
 615  
 
 616  
     protected SplashScreen buildStartupSplash()
 617  
     {
 618  0
         SplashScreen startupScreen = config.isContainerMode()
 619  
                                          ? new ApplicationStartupSplashScreen()
 620  
                                          : new ServerStartupSplashScreen();
 621  0
         startupScreen.setHeader(this);
 622  0
         startupScreen.setFooter(this);
 623  0
         return startupScreen;
 624  
     }
 625  
 
 626  
     protected SplashScreen buildShutdownSplash()
 627  
     {
 628  0
         SplashScreen shutdownScreen = config.isContainerMode()
 629  
                                          ? new ApplicationShutdownSplashScreen()
 630  
                                          : new ServerShutdownSplashScreen();
 631  0
         shutdownScreen.setHeader(this);
 632  0
         return shutdownScreen;
 633  
     }
 634  
 
 635  
     public LocalMuleClient getClient()
 636  
     {
 637  0
         return localMuleClient;
 638  
     }
 639  
 
 640  
     public SystemExceptionHandler getExceptionListener()
 641  
     {
 642  0
         return exceptionListener;
 643  
     }
 644  
 
 645  
     public void setExceptionListener(SystemExceptionHandler exceptionListener)
 646  
     {
 647  0
         this.exceptionListener = exceptionListener;
 648  0
     }
 649  
 }