org.mule
Class MuleServer

java.lang.Object
  extended by org.mule.MuleServer
All Implemented Interfaces:
Runnable

public class MuleServer
extends Object
implements Runnable

MuleServer is a simple application that represents a local Mule Server daemon. It is initialised with a mule-config.xml file.


Field Summary
protected static String CLASSNAME_DEFAULT_CONFIG_BUILDER
          Don't use a class object so the core doesn't depend on mule-module-spring-config.
protected static String CLASSNAME_DEFAULT_IDLE_CONFIG_BUILDER
          This builder sets up the configuration for an idle Mule node - a node that doesn't do anything initially but is fed configuration during runtime
protected static String CLASSNAME_SPRING_CONFIG_BUILDER
          Required to support the '-config spring' shortcut.
static String[][] CLI_OPTIONS
           
static String DEFAULT_CONFIGURATION
           
protected static MuleContext muleContext
          The MuleContext should contain anything which does not belong in the Registry.
protected  Map options
           
 
Constructor Summary
MuleServer()
           
MuleServer(String configResources)
           
MuleServer(String[] args)
          Configure the server with command-line arguments.
 
Method Summary
static String getConfigBuilderClassName()
          Returns the class name of the configuration builder used to create this MuleServer.
 String getConfigurationResources()
          Getter for property messengerURL.
 Log getLogger()
           
static MuleContext getMuleContext()
           
static String getStartupPropertiesFile()
           
protected  void init(String[] args)
           
 void initialize()
          Initializes this daemon.
static void main(String[] args)
          Application entry point.
 void registerShutdownHook(MuleShutdownHook muleShutdownHook)
           
 void run()
          Overloaded the [main] thread run method.
static void setConfigBuilderClassName(String builderClassName)
          Sets the configuration builder to use for this server.
 void setConfigurationResources(String configurationResources)
          Setter for property configurationResources.
static void setMuleContext(MuleContext muleContext)
           
static void setStartupPropertiesFile(String startupPropertiesFile)
           
 void shutdown()
          shutdown the server.
 void shutdown(Throwable e)
          Will shut down the server displaying the cause and time of the shutdown
 void start(boolean ownThread, boolean registerShutdownHook)
          Start the mule server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLI_OPTIONS

public static final String[][] CLI_OPTIONS

CLASSNAME_DEFAULT_CONFIG_BUILDER

protected static final String CLASSNAME_DEFAULT_CONFIG_BUILDER
Don't use a class object so the core doesn't depend on mule-module-spring-config.

See Also:
Constant Field Values

CLASSNAME_DEFAULT_IDLE_CONFIG_BUILDER

protected static final String CLASSNAME_DEFAULT_IDLE_CONFIG_BUILDER
This builder sets up the configuration for an idle Mule node - a node that doesn't do anything initially but is fed configuration during runtime

See Also:
Constant Field Values

CLASSNAME_SPRING_CONFIG_BUILDER

protected static final String CLASSNAME_SPRING_CONFIG_BUILDER
Required to support the '-config spring' shortcut. Don't use a class object so the core doesn't depend on mule-module-spring. TODO this may not be a problem for Mule 2.x

See Also:
Constant Field Values

DEFAULT_CONFIGURATION

public static final String DEFAULT_CONFIGURATION
See Also:
Constant Field Values

options

protected Map options

muleContext

protected static MuleContext muleContext
The MuleContext should contain anything which does not belong in the Registry. There is one MuleContext per Mule instance. Assuming it has been created, a handle to the local MuleContext can be obtained from anywhere by calling MuleServer.getMuleContext()

Constructor Detail

MuleServer

public MuleServer()

MuleServer

public MuleServer(String configResources)

MuleServer

public MuleServer(String[] args)
           throws IllegalArgumentException
Configure the server with command-line arguments.

Throws:
IllegalArgumentException
Method Detail

main

public static void main(String[] args)
                 throws Exception
Application entry point.

Parameters:
args - command-line args
Throws:
Exception

init

protected void init(String[] args)
             throws IllegalArgumentException
Throws:
IllegalArgumentException

start

public void start(boolean ownThread,
                  boolean registerShutdownHook)
Start the mule server

Parameters:
ownThread - determines if the server will run in its own daemon thread or the current calling thread

run

public void run()
Overloaded the [main] thread run method. This calls initialise and shuts down if an exception occurs

Specified by:
run in interface Runnable

setConfigBuilderClassName

public static void setConfigBuilderClassName(String builderClassName)
                                      throws ClassNotFoundException
Sets the configuration builder to use for this server. Note that if a builder is not set and the server's start method is called the default is an instance of SpringXmlConfigurationBuilder.

Parameters:
builderClassName - the configuration builder FQN to use
Throws:
ClassNotFoundException - if the class with the given name can not be loaded

getConfigBuilderClassName

public static String getConfigBuilderClassName()
Returns the class name of the configuration builder used to create this MuleServer.

Returns:
FQN of the current config builder

initialize

public void initialize()
                throws Exception
Initializes this daemon. Derived classes could add some extra behaviour if they wish.

Throws:
Exception - if failed to initialize

shutdown

public void shutdown(Throwable e)
Will shut down the server displaying the cause and time of the shutdown

Parameters:
e - the exception that caused the shutdown

shutdown

public void shutdown()
shutdown the server. This just displays the time the server shut down


getLogger

public Log getLogger()

registerShutdownHook

public void registerShutdownHook(MuleShutdownHook muleShutdownHook)

getConfigurationResources

public String getConfigurationResources()
Getter for property messengerURL.

Returns:
Value of property messengerURL.

setConfigurationResources

public void setConfigurationResources(String configurationResources)
Setter for property configurationResources.

Parameters:
configurationResources - New value of property configurationResources.

getStartupPropertiesFile

public static String getStartupPropertiesFile()

setStartupPropertiesFile

public static void setStartupPropertiesFile(String startupPropertiesFile)

getMuleContext

public static MuleContext getMuleContext()

setMuleContext

public static void setMuleContext(MuleContext muleContext)


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.