Public Types | Public Member Functions

wosh::WoshKernel Class Reference
[Core-Modules]

The Core of a generic WOSH application. Manage life-cycle of CoreModules. More...

#include <H:/WOSH/win32_vc2010/src/core/WoshKernel.h>

List of all members.

Public Types

enum  KERNEL_STATE {
  STATE_UNKNOWN = 0x00, STATE_CREATING = 0x01, STATE_INITIALIZING = 0x02, STATE_INITIALIZED = 0x03,
  STATE_RUNNING = 0x04, STATE_STOPPING = 0x05, STATE_STOPPED = 0x06, STATE_DESTROYING = 0x07,
  STATE_FAILURE = 0x09
}
 

state of the kernel

More...

Public Member Functions

 WoshKernel (const std::string &WoshKernel_name, WoshSettings *settings_default)
 Constructor with initializer(s)
virtual ~WoshKernel ()
 Empty destructor.
Kernel control methods
WRESULT init ()
 Initialize Core-Modules (allocation order). Switching state to STATE_INITIALIZING and later to STATE_INITIALIZED. On Failure it will follow directive _WoshKernel_KEY_StateResumeNext.
WRESULT start ()
 Start-up Core-Modules (allocation order). Switching state to STATE_RUNNING.
WRESULT shutdown ()
 Stop Core-Modules (reverse allocation order). Reentrant. Switching state to STATE_STOPPING and later to STATE_STOPPED.
WRESULT enterLoop ()
WRESULT waitStarted ()
Configuration methods
void setListener (IWoshKernelListener *ptr)
Getters and Access to Core-Modules
void setName (const std::string &value)
 Set the name (string) associated with the object, it will also update URI's name.
bool isRunning () const
KERNEL_STATE getState () const
WoshSettingssettings ()
ObjectFactoryfactory ()
BundleManagerbundles ()
DeviceManagerdevices ()
UserManagerusers ()
PersistenceManagerpersistence ()
FileSystemfilesystem ()
BusManagerbusses ()
NetworkManagernetwork ()
SessionManagersessions ()
ThreadManagerthreads ()
SecurityManagersecurity ()
SystemMonitormonitor ()
SystemLoggerlogger ()
IPropertiesProviderListener interface
bool readingProperty (Property *, const PropertiesProvider *)
bool updatingProperty (bool &do_update, const Variant &value_proposed, Property &property_current, const PropertiesProvider *source)
IBusListener interface
void busMessage (const Message &message, const Bus *source)
 Method raised by the Bus when it processes a new message. Implementations will probably analyze the message and perform actions.

Static Public Member Functions

Static Methods (Getters)
static const char * getKernelName ()
static KERNEL_STATE getKernelState ()
static WoshKernelgetInstance ()
static struct
EnumerationDescription
< KERNEL_STATE > * 
getStateEnum ()
static const char * getStateAsString (KERNEL_STATE state)
static KERNEL_STATE getStateFromString (const char *state)
static WRESULT importInstance (WoshKernel *global_instance)
static bool fixName (std::string &name)

Protected Member Functions

Internal methods
WRESULT setState (KERNEL_STATE state, bool raise_event=true)

Protected Attributes

Internal modules
WoshModule ** modules
 shadow modules' pointer list
ObjectFactoryFactory
 core module managing (dynamic) creation of new (generic) objects
BundleManagerBundles
 core module managing Bundles
DeviceManagerDevices
 core module managing Devices (as shadow objects)
ThreadManagerThreads
 core module managing Threads
UserManagerUsers
 core module managing Users
SecurityManagerSecurity
 core module managing Security of the Host (system)
SessionManagerSessions
 core module managing (user) Sessions
PersistenceManagerPersistence
 core module managing Database (access, serialization)
FileSystemFS
 core module managing FileSystem (mappings, virtual_local, shared)
BusManagerBusses
 core module managing Busses (instances and routing)
NetworkManagerNetwork
 core module managing Networking (WoshHosts, NetworkChannels, NetworkProtocols)
SystemMonitorMonitor
 core module monitoring the system for issues
SystemLoggerSysLog
 core module offering logging features
Internal vars
LogContext Log
 my own logger
PropertiesProvider Properties
 my own properties
MethodsProvider Methods
 my own methods
BusConnector BusCore
 my bus connector to wosh.Bus.Core
WoshSettingsSettingsDefault
 default global settings (acquired on constructor or allocated)
KERNEL_STATE state
 current kernel state
bool stopRequest
 flag, enabled when a stop request has been activated
bool loopAcquired
 flag, enabled when calling enterLoop()
IWoshKernelListener * listener
 listener reference for callbacks

Private Member Functions

Supported methods
ResponsemmDoListURI (const Request *request)
ResponsemmDoShutdown (const Request *request)
ResponsemmDoReboot (const Request *request)

Detailed Description

The Core of a generic WOSH application. Manage life-cycle of CoreModules.

Kernel instance is also the owner of the main wosh::Bus of the system (wosh.Bus.Core).

WoshKernel.png

wosh::WoshKernel UML diagram

Version:
0.8.013
Id:
WoshKernel.h 3775 2011-01-01 16:38:17Z alex
Author:
Alessandro Polo

Definition at line 140 of file WoshKernel.h.


Member Enumeration Documentation

state of the kernel

Enumerator:
STATE_UNKNOWN 

unknown state, should never happen

STATE_CREATING 

constructor called, kernel is allocating (or retrieving references of) core-modules

STATE_INITIALIZING 

constructor finished, kernel ready to be initialized (init() call)

STATE_INITIALIZED 

core modules have been initialized successfully

STATE_RUNNING 

wosh is running

STATE_STOPPING 

shutdown request was raised, system is switching to STATE_STOPPED

STATE_STOPPED 

STATE_STOPPING succeeded and going to be officially stopped.

STATE_DESTROYING 

desctructor called, kernel is destroying modules and internal components

STATE_FAILURE 

something weird happened on previous/current state transition

Definition at line 149 of file WoshKernel.h.


Constructor & Destructor Documentation

wosh::WoshKernel::WoshKernel ( const std::string &  WoshKernel_name,
WoshSettings settings_default 
)

Constructor with initializer(s)

Parameters:
WoshKernel_name[in] the name of new Kernel (host)
settings_default[in] WoshSettings instance to be associated. Otherwise it will be allocated.

Definition at line 96 of file WoshKernel.cpp.

References _METHOD_ListMethods, _WOSH_VER_CODENAME, _WOSH_VER_MAJOR, _WOSH_VER_MINOR, BusCore, wosh::BusConnector::connect(), wosh::getLogLevelAsString(), wosh::LOG_CRITICAL, wosh::LOG_DEBUG, wosh::LOG_INFO, wosh::LOG_VERBOSE, wosh::ms_WoshKernel_instance, and wosh::BusConnector::setMessageHandler().

wosh::WoshKernel::~WoshKernel (  ) [virtual]

Member Function Documentation

void wosh::WoshKernel::busMessage ( const Message message,
const Bus source 
) [virtual]

Method raised by the Bus when it processes a new message. Implementations will probably analyze the message and perform actions.

Parameters:
[in]messagethe incoming message
[in]sourcethe source Bus of the incoming message
Warning:
The current thread is own and managed by the caller Bus. Heavy, dangerous or time expensive operations should be executed asynchronously and not inline!

Implements wosh::IBusListener.

Definition at line 464 of file WoshKernel.cpp.

References BusCore, wosh::Message::getContent(), wosh::Message::isEmpty(), wosh::MessageContent::isRequest(), wosh::BusConnector::postMessage(), and wosh::Message::setSource().

WRESULT wosh::WoshKernel::init (  )

Initialize Core-Modules (allocation order). Switching state to STATE_INITIALIZING and later to STATE_INITIALIZED. On Failure it will follow directive _WoshKernel_KEY_StateResumeNext.

Returns:
WRET_OK on success; a standard setState() error on failure
See also:
WoshKernel::start()
Note:
may re-apply settings

Definition at line 351 of file WoshKernel.cpp.

References wosh::LOG_CRITICAL, wosh::LOG_INFO, and wosh::LOG_VERBOSE.

Referenced by main(), and WinMain().

Response * wosh::WoshKernel::mmDoListURI ( const Request request ) [private]

Todo:
implement here

Definition at line 489 of file WoshKernel.cpp.

References wosh::Request::replyResponse(), and WRET_OK.

void wosh::WoshKernel::setName ( const std::string &  value ) [virtual]

Set the name (string) associated with the object, it will also update URI's name.

Parameters:
value[in] the name of the object as STL string

Reimplemented from wosh::Object.

Definition at line 562 of file WoshKernel.cpp.

References wosh::LOG_WARNING.

WRESULT wosh::WoshKernel::shutdown (  )

Stop Core-Modules (reverse allocation order). Reentrant. Switching state to STATE_STOPPING and later to STATE_STOPPED.

Returns:
WRET_OK on success; a standard setState() error on failure
See also:
WoshKernel::start()
Note:
flag stopRequest if enterLoop was called, else set state to STATE_STOPPED (raising event) when called by user (like executing a generic command, it's proxied by mmDoShutdown due to caller thread restriction (it can't be called within a bus' thread)

Definition at line 395 of file WoshKernel.cpp.

References wosh::LOG_CRITICAL, wosh::LOG_DEBUG, wosh::LOG_INFO, wosh::LOG_WARNING, WRET_ERR_ILLEGAL_USE, and WRET_OK.

Referenced by main(), and WinMain().

WRESULT wosh::WoshKernel::start (  )

Start-up Core-Modules (allocation order). Switching state to STATE_RUNNING.

Returns:
WRET_OK on success; a standard setState() error on failure
See also:
WoshKernel::init()
Note:
previous state must be STATE_INITIALIZED

Definition at line 383 of file WoshKernel.cpp.

References wosh::LOG_CRITICAL, and wosh::LOG_INFO.

Referenced by main(), and WinMain().


Member Data Documentation

core module managing Bundles

Definition at line 315 of file WoshKernel.h.

my bus connector to wosh.Bus.Core

Definition at line 341 of file WoshKernel.h.

core module managing Busses (instances and routing)

Definition at line 327 of file WoshKernel.h.

core module managing Devices (as shadow objects)

Definition at line 316 of file WoshKernel.h.

core module managing (dynamic) creation of new (generic) objects

Definition at line 313 of file WoshKernel.h.

core module managing FileSystem (mappings, virtual_local, shared)

Definition at line 325 of file WoshKernel.h.

IWoshKernelListener* wosh::WoshKernel::listener [protected]

listener reference for callbacks

Definition at line 348 of file WoshKernel.h.

LogContext wosh::WoshKernel::Log [mutable, protected]

my own logger

Definition at line 338 of file WoshKernel.h.

flag, enabled when calling enterLoop()

Definition at line 347 of file WoshKernel.h.

my own methods

Definition at line 340 of file WoshKernel.h.

shadow modules' pointer list

Definition at line 311 of file WoshKernel.h.

core module monitoring the system for issues

Definition at line 330 of file WoshKernel.h.

core module managing Networking (WoshHosts, NetworkChannels, NetworkProtocols)

Definition at line 328 of file WoshKernel.h.

core module managing Database (access, serialization)

Definition at line 323 of file WoshKernel.h.

my own properties

Definition at line 339 of file WoshKernel.h.

core module managing Security of the Host (system)

Definition at line 319 of file WoshKernel.h.

core module managing (user) Sessions

Definition at line 321 of file WoshKernel.h.

default global settings (acquired on constructor or allocated)

Definition at line 343 of file WoshKernel.h.

current kernel state

Definition at line 345 of file WoshKernel.h.

flag, enabled when a stop request has been activated

Definition at line 346 of file WoshKernel.h.

core module offering logging features

Definition at line 331 of file WoshKernel.h.

core module managing Threads

Definition at line 317 of file WoshKernel.h.

core module managing Users

Definition at line 318 of file WoshKernel.h.


The documentation for this class was generated from the following files:

Generated on Tue Feb 8 2011 09:33:33 for WOSH system 0.8.888 [wolf] by Alessandro Polo, using DoxyGen 1.7.2 hosted by WOSH Framework