Package org.dspace.kernel
Class DSpaceKernelManager
- java.lang.Object
-
- org.dspace.kernel.DSpaceKernelManager
-
public final class DSpaceKernelManager extends Object
Allows the DSpace kernel to be accessed if desired.- Author:
- Aaron Zeckoski (azeckoski @ gmail.com)
-
-
Constructor Summary
Constructors Constructor Description DSpaceKernelManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
checkName(String name)
Ensure that we have a name suitable for an mbean.static DSpaceKernel
getDefaultKernel()
DSpaceKernel
getKernel()
Get the kernel.DSpaceKernel
getKernel(String name)
Get the kernel.static void
registerMBean(String mBeanName, DSpaceKernel kernel)
Register a new kernel MBean with the given name or failstatic void
setDefaultKernel(DSpaceKernel kernel)
static boolean
unregisterMBean(String mBeanName)
Unregister an MBean if possible
-
-
-
Method Detail
-
getDefaultKernel
public static DSpaceKernel getDefaultKernel()
-
setDefaultKernel
public static void setDefaultKernel(DSpaceKernel kernel)
-
getKernel
public DSpaceKernel getKernel()
Get the kernel. This will be a single instance for the JVM, but the method will retrieve the same instance regardless of this object instance.- Returns:
- the DSpace kernel
- Throws:
IllegalStateException
- if the kernel is not available
-
getKernel
public DSpaceKernel getKernel(String name)
Get the kernel. This will be a single instance for the JVM, but the method will retrieve the same instance regardless of this object instance.- Parameters:
name
- this is the name of this kernel instance. If you do not know what this is then use null.- Returns:
- the DSpace kernel
- Throws:
IllegalStateException
- if the kernel is not available or not running
-
checkName
public static String checkName(String name)
Ensure that we have a name suitable for an mbean.- Parameters:
name
- the name for the kernel- Returns:
- a proper mbean name based on the given name
-
registerMBean
public static void registerMBean(String mBeanName, DSpaceKernel kernel)
Register a new kernel MBean with the given name or fail- Parameters:
mBeanName
- the bean name to usekernel
- the kernel bean to register- Throws:
IllegalStateException
- if the MBean cannot be registered
-
unregisterMBean
public static boolean unregisterMBean(String mBeanName)
Unregister an MBean if possible- Parameters:
mBeanName
- the bean name to use- Returns:
- true if the MBean was unregistered, false otherwise
-
-