com.pentagaia.tb.start
Interface IPdsKernel

All Known Implementing Classes:
AbstractKernelImpl, KernelImpl_0_9_5_1, KernelImpl_0_9_6

public interface IPdsKernel

An interface to access the pds kernel library. This interface provides access to various pds kernel functions. It may be used to utilize the kernel. But only allowed modules may access the kernel. See the ptb configuration file for details.

Since:
0.1.0
Version:
0.1.0
Author:
mepeisen

Nested Class Summary
static class IPdsKernel.KernelStateType
          Kernel state types
static class IPdsKernel.KernelVersionType
          Kernel version types
 
Method Summary
 IPdsAppKernelAppContext getAppKernelAppContext()
          Returns the app kernel app context
 String getApplicationProperty(String key)
          Returns value of an application property
 String getApplicationProperty(String key, String defaultValue)
          Returns value of an application property
 IPdsClassLoaderExtension[] getClassLoaderExtensions()
          Returns a list of all available kernel class loader extensions.
 Object getComponentRegistry()
          Returns the kernel component registry for the running application
 Object getKernelCore()
          Returns the kernel core
 IPdsKernelListener[] getKernelListeners()
          Returns a list of all available kernel listeners.
 IPdsKernel.KernelStateType getKernelState()
          Returns the kernel state
 IPdsKernel.KernelVersionType getKernelVersion()
          Returns the version of this kernel
 IPdsPropertyParser[] getPropertyParsers()
          Returns a list of all available property parsers.
 void installAppKernelAppContext(IPdsAppKernelAppContext context)
          Installs a new app kernel app context
 void installClassLoaderExtension(IPdsClassLoaderExtension extension)
          Installs a new kernel class loader extension
 void installKernelListener(IPdsKernelListener listener)
          Installs a new kernel listener
 void installPropertyParser(IPdsPropertyParser parser)
          Installs a new property parser to manipulate the properties
 void joinState(IPdsKernel.KernelStateType state, long timeout)
          Joins the kernel state and waits till the kernel reaches the given state.
 void shutdown()
          Tries to shutdown the kernel.
 void shutdown(boolean shutdownVm)
          Tries to shutdown the kernel.
 

Method Detail

getKernelVersion

IPdsKernel.KernelVersionType getKernelVersion()
Returns the version of this kernel

Returns:
kernel version number

getKernelState

IPdsKernel.KernelStateType getKernelState()
Returns the kernel state

Returns:
kernel state

joinState

void joinState(IPdsKernel.KernelStateType state,
               long timeout)
Joins the kernel state and waits till the kernel reaches the given state.

Parameters:
state - The state to be reached
timeout - Milliseconds/timeout (greater than 0)
Throws:
IllegalStateException - thrown if the kernel does not reach the state or the timeout is reached.

shutdown

void shutdown()
Tries to shutdown the kernel.

Throws:
SecurityException - thrown if the caller is not allowed to shutdown the kernel instance.
IllegalStateException - thrown if the kernel is not running.

shutdown

void shutdown(boolean shutdownVm)
Tries to shutdown the kernel.

Parameters:
shutdownVm - true if the vm should be shut down and false if this method dhould return without shutting down the vm.
Throws:
SecurityException - thrown if the caller is not allowed to shutdown the kernel instance.
IllegalStateException - thrown if the kernel is not running.

installKernelListener

void installKernelListener(IPdsKernelListener listener)
Installs a new kernel listener

Parameters:
listener - Kernel listener.
Throws:
SecurityException - thrown if the caller is not allowed to install a new kernel listener.
IllegalStateException - thrown if we are in illegal state. The only way to install a kernel listener is method IPdsKernelProvider.onPreStartup(IPdsKernel). Whenever this method is called when the kernel is already running, this exception will be thrown.

installAppKernelAppContext

void installAppKernelAppContext(IPdsAppKernelAppContext context)
Installs a new app kernel app context

Parameters:
context - the app kernel app context
Throws:
SecurityException - thrown if the caller is not allowed to install a new app kernel app context.
IllegalStateException - thrown if we are in illegal state. The only way to install a app kernel app context is method IPdsKernelProvider.onPreStartup(IPdsKernel). Whenever this method is called when the kernel is already running, this exception will be thrown. Thrown if this method is called twice.

getAppKernelAppContext

IPdsAppKernelAppContext getAppKernelAppContext()
Returns the app kernel app context

Returns:
app kernel app context
Throws:
SecurityException - thrown if the caller is not allowed to receive the app kernel app context.

getKernelListeners

IPdsKernelListener[] getKernelListeners()
Returns a list of all available kernel listeners.

Returns:
List of all available kernel listeners.
Throws:
SecurityException - thrown if the caller is not allowed to receive the listeners list.

installClassLoaderExtension

void installClassLoaderExtension(IPdsClassLoaderExtension extension)
Installs a new kernel class loader extension

Parameters:
extension - Kernel class loader extension
Throws:
SecurityException - thrown if the caller is not allowed to install a new kernel class loader extension.
IllegalStateException - thrown if we are in illegal state. The only way to install a kernel class loader extension is method IPdsKernelProvider.onPreStartup(IPdsKernel). Whenever this method is called when the kernel is already running, this exception will be thrown.

getClassLoaderExtensions

IPdsClassLoaderExtension[] getClassLoaderExtensions()
Returns a list of all available kernel class loader extensions.

Returns:
List of all available kernel class loader extensions.
Throws:
SecurityException - thrown if the caller is not allowed to receive the class loader extensions.

installPropertyParser

void installPropertyParser(IPdsPropertyParser parser)
Installs a new property parser to manipulate the properties

Parameters:
parser - Property parser
Throws:
SecurityException - thrown if the caller is not allowed to install a new property parser.
IllegalStateException - thrown if we are in illegal state. The only way to install a property parser is method IPdsKernelProvider.onPreStartup(IPdsKernel). Whenever this method is called when the kernel is already running, this exception will be thrown.

getPropertyParsers

IPdsPropertyParser[] getPropertyParsers()
Returns a list of all available property parsers.

Returns:
List of all available property parsers.
Throws:
SecurityException - thrown if the caller is not allowed to receive the property parsers.

getKernelCore

Object getKernelCore()
Returns the kernel core

Returns:
The kernel core. Can be casted to com.sun.sgs.impl.kernel.Kernel inside the applications context. You may try to access the kernel by reflection because this class is only package visible.
Throws:
SecurityException - thrown if the caller is not allowed to receive the kernel instance.
IllegalStateException - thrown if we are in illegal state. If the kernel is not running, an exception is thrown.

getComponentRegistry

Object getComponentRegistry()
Returns the kernel component registry for the running application

Returns:
The kernel component registry. Can be casted to com.sun.sgs.kernel.ComponentRegistry inside the applications context.
Throws:
SecurityException - thrown if the caller is not allowed to receive the component registry.
IllegalStateException - thrown if we are in illegal state. If the kernel is not running, an exception is thrown.

getApplicationProperty

String getApplicationProperty(String key)
Returns value of an application property

Parameters:
key -
Returns:
value or null if this property is not present.

getApplicationProperty

String getApplicationProperty(String key,
                              String defaultValue)
Returns value of an application property

Parameters:
key -
defaultValue -
Returns:
value or defaultValue if this property is not present.


Copyright © 2008. All Rights Reserved.