Class DSpaceKernelManager


  • public final class DSpaceKernelManager
    extends Object
    Allows the DSpace kernel to be accessed if desired.
    Author:
    Aaron Zeckoski (azeckoski @ gmail.com)
    • Constructor Detail

      • DSpaceKernelManager

        public DSpaceKernelManager()
    • 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 use
        kernel - 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