org.apache.xbean.server.main
Class KernelMain

java.lang.Object
  extended by org.apache.xbean.server.main.KernelMain
All Implemented Interfaces:
Main

public class KernelMain
extends Object
implements Main

KernelMain is the standard entry point class used for a server. It will initalize a kernel with a set of services and can optional hold the thread of execution until the kernel or virtual machine is destroyed.

Since:
2.0
Author:
Dain Sundstrom

Constructor Summary
KernelMain()
           
 
Method Summary
 void destroy()
           
 ClassLoader getClassLoader()
          Gets the class loader which is used as the thread context class loader during the main method.
 org.apache.xbean.kernel.Kernel getKernel()
          Gets the kernel that will be initialized in the main method.
 Main getNext()
          Gets the next main to call after the kernel has been initialized, but before destroying the kernel.
 Map getServices()
          Gets the services to be registered with the kernel during the main method.
 boolean isDaemon()
          Determines if the main method should hold the thread until the kernel is destroyed.
 void main(String[] args)
          Registers the services with the kernel, calls the next main, optionally holds the thread until the kernel is destroyed, and then destroys the kernel.
 void setClassLoader(ClassLoader classLoader)
          Sets the class loader to use as the thread context class loader during the main method.
 void setDaemon(boolean daemon)
          Sets the main method to hold the thread until the kernel is destroyed.
 void setKernel(org.apache.xbean.kernel.Kernel kernel)
          Sets the kernel to be initialized in the main method.
 void setNext(Main next)
          Sets the next main to call after the kernel has been initialized.
 void setServices(Map services)
          Sets the services to be registered with the kernel during the main method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KernelMain

public KernelMain()
Method Detail

getKernel

public org.apache.xbean.kernel.Kernel getKernel()
Gets the kernel that will be initialized in the main method. If the kernel is null, a new kernel will be created and initialized in the main method.

Returns:
the kernel that will be initialized in the main method

setKernel

public void setKernel(org.apache.xbean.kernel.Kernel kernel)
Sets the kernel to be initialized in the main method.

Parameters:
kernel - the kernel to initialize in the main method

getClassLoader

public ClassLoader getClassLoader()
Gets the class loader which is used as the thread context class loader during the main method.

Returns:
the class loader which is used as the thread context class loader during the main method

setClassLoader

public void setClassLoader(ClassLoader classLoader)
Sets the class loader to use as the thread context class loader during the main method.

Parameters:
classLoader - the class loader to use as the thread context class loader during the main method

getServices

public Map getServices()
Gets the services to be registered with the kernel during the main method.

Returns:
the services to be mounted added to the kernel during the main method

setServices

public void setServices(Map services)
Sets the services to be registered with the kernel during the main method.

Parameters:
services - the services to be registered with the kernel during the main method

isDaemon

public boolean isDaemon()
Determines if the main method should hold the thread until the kernel is destroyed.

Returns:
true if the main method should hold the thread until the kernel is destroyed; false otherwise

setDaemon

public void setDaemon(boolean daemon)
Sets the main method to hold the thread until the kernel is destroyed.

Parameters:
daemon - true if the main method should hold the thread until the kernel is destroyed

getNext

public Main getNext()
Gets the next main to call after the kernel has been initialized, but before destroying the kernel.

Returns:
the next main to call after the kernel has been initialized

setNext

public void setNext(Main next)
Sets the next main to call after the kernel has been initialized.

Parameters:
next - the next main to call after the kernel has been initialized

main

public void main(String[] args)
Registers the services with the kernel, calls the next main, optionally holds the thread until the kernel is destroyed, and then destroys the kernel.

Specified by:
main in interface Main
Parameters:
args - the arguments passed the next main

destroy

public void destroy()


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.