Package org.dspace.servicemanager
Class DSpaceKernelImpl
- java.lang.Object
-
- org.dspace.servicemanager.DSpaceKernelImpl
-
- All Implemented Interfaces:
DynamicMBean
,CommonLifecycle<DSpaceKernel>
,DSpaceKernel
public final class DSpaceKernelImpl extends Object implements DSpaceKernel, DynamicMBean
This is the kernel implementation which starts up the core of DSpace, registers the mbean, and initializes the DSpace object. It also loads up the configuration. Sets a JRE shutdown hook.Note that this does not start itself and calling the constuctor does not actually start it up either. It has to be explicitly started by calling the start method so something in the system needs to do that. If the bean is already started then calling start on it again has no effect.
The name of this instance can be specified if desired.
- Author:
- Aaron Zeckoski (azeckoski @ gmail.com)
-
-
Field Summary
-
Fields inherited from interface org.dspace.kernel.DSpaceKernel
KERNEL_NAME, MBEAN_NAME, MBEAN_PREFIX, MBEAN_SUFFIX
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DSpaceKernelImpl(String name)
Creates a DSpace Kernel, does not do any checks though.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Destroy the managed bean entirely.protected void
doDestroy()
Called from within the shutdown thread.protected void
finalize()
Object
getAttribute(String attribute)
AttributeList
getAttributes(String[] attributes)
ConfigurationService
getConfigurationService()
Date
getLastLoadDate()
Time that this kernel was started, as a java.util.Date.long
getLoadTime()
Time that this kernel was started, as seconds since the epoch.DSpaceKernel
getManagedBean()
Gets a reference to the bean that is being managed inside this lifecycle.MBeanInfo
getMBeanInfo()
String
getMBeanName()
ServiceManager
getServiceManager()
Object
invoke(String actionName, Object[] params, String[] signature)
boolean
isRunning()
protected void
registerShutdownHook()
void
setAttribute(Attribute attribute)
AttributeList
setAttributes(AttributeList attributes)
void
start()
Starts the bean.void
start(String dspaceHome)
This starts up the entire core system.void
stop()
Stops the bean.String
toString()
-
-
-
Constructor Detail
-
DSpaceKernelImpl
protected DSpaceKernelImpl(String name)
Creates a DSpace Kernel, does not do any checks though. Do not call this; useDSpaceKernelInit.getKernel(String)
.- Parameters:
name
- the name for the kernel
-
-
Method Detail
-
registerShutdownHook
protected void registerShutdownHook()
-
getConfigurationService
public ConfigurationService getConfigurationService()
- Specified by:
getConfigurationService
in interfaceDSpaceKernel
- Returns:
- the DSpace configuration service for this Kernel
-
getServiceManager
public ServiceManager getServiceManager()
- Specified by:
getServiceManager
in interfaceDSpaceKernel
- Returns:
- the DSpace service manager instance for this Kernel
-
getMBeanName
public String getMBeanName()
- Specified by:
getMBeanName
in interfaceDSpaceKernel
- Returns:
- the unique MBean name of this DSpace Kernel
-
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interfaceDSpaceKernel
- Returns:
- true if this Kernel is started and running
-
getManagedBean
public DSpaceKernel getManagedBean()
Description copied from interface:CommonLifecycle
Gets a reference to the bean that is being managed inside this lifecycle.- Specified by:
getManagedBean
in interfaceCommonLifecycle<DSpaceKernel>
- Returns:
- the managed object
-
start
public void start()
Description copied from interface:CommonLifecycle
Starts the bean. This initializes and causes the object to begin functioning. Should not happen automatically when the object is created.- Specified by:
start
in interfaceCommonLifecycle<DSpaceKernel>
-
start
public void start(String dspaceHome)
This starts up the entire core system. May be called more than once: subsequent calls return without effect.- Parameters:
dspaceHome
- path to DSpace home directory
-
stop
public void stop()
Description copied from interface:CommonLifecycle
Stops the bean. This turns the object off and causes related things to be shutdown. Object should be able to be started again.- Specified by:
stop
in interfaceCommonLifecycle<DSpaceKernel>
-
destroy
public void destroy()
Description copied from interface:CommonLifecycle
Destroy the managed bean entirely. It will be stopped first if not stopped and cannot be started again afterwards.- Specified by:
destroy
in interfaceCommonLifecycle<DSpaceKernel>
-
doDestroy
protected void doDestroy()
Called from within the shutdown thread.
-
finalize
protected void finalize() throws Throwable
-
getLastLoadDate
public Date getLastLoadDate()
Time that this kernel was started, as a java.util.Date.- Returns:
- date object
-
getLoadTime
public long getLoadTime()
Time that this kernel was started, as seconds since the epoch.- Returns:
- seconds since epoch (as a long)
-
invoke
public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException
- Specified by:
invoke
in interfaceDynamicMBean
- Throws:
MBeanException
ReflectionException
-
getMBeanInfo
public MBeanInfo getMBeanInfo()
- Specified by:
getMBeanInfo
in interfaceDynamicMBean
-
getAttribute
public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException
- Specified by:
getAttribute
in interfaceDynamicMBean
- Throws:
AttributeNotFoundException
MBeanException
ReflectionException
-
getAttributes
public AttributeList getAttributes(String[] attributes)
- Specified by:
getAttributes
in interfaceDynamicMBean
-
setAttribute
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
- Specified by:
setAttribute
in interfaceDynamicMBean
- Throws:
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException
-
setAttributes
public AttributeList setAttributes(AttributeList attributes)
- Specified by:
setAttributes
in interfaceDynamicMBean
-
-