Class CommonApplicationLogic
Provides base implementation of IApplication for various application kinds
Inheritance
System.Object
CommonApplicationLogic
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Azos.dll
Syntax
[ConfigMacroContext]
public abstract class CommonApplicationLogic : DisposableObject, IDisposable, IApplication, INamed, ILocalizedTimeProvider
Constructors
CommonApplicationLogic()
Declaration
protected CommonApplicationLogic()
Fields
CONFIG_APP_NAME_ATTR
Declaration
public const string CONFIG_APP_NAME_ATTR = "application-name"
Field Value
Type |
Description |
System.String |
|
CONFIG_DATA_STORE_SECTION
Declaration
public const string CONFIG_DATA_STORE_SECTION = "data-store"
Field Value
Type |
Description |
System.String |
|
CONFIG_DEPENDENCY_INJECTOR_SECTION
Declaration
public const string CONFIG_DEPENDENCY_INJECTOR_SECTION = "dependency-injector"
Field Value
Type |
Description |
System.String |
|
CONFIG_ENABLED_ATTR
Declaration
public const string CONFIG_ENABLED_ATTR = "enabled"
Field Value
Type |
Description |
System.String |
|
CONFIG_ENVIRONMENT_NAME_ATTR
Declaration
public const string CONFIG_ENVIRONMENT_NAME_ATTR = "environment-name"
Field Value
Type |
Description |
System.String |
|
CONFIG_EVENT_TIMER_SECTION
Declaration
public const string CONFIG_EVENT_TIMER_SECTION = "event-timer"
Field Value
Type |
Description |
System.String |
|
CONFIG_FORCE_INVARIANT_CULTURE_ATTR
Declaration
public const string CONFIG_FORCE_INVARIANT_CULTURE_ATTR = "force-invariant-culture"
Field Value
Type |
Description |
System.String |
|
CONFIG_GLUE_SECTION
Declaration
public const string CONFIG_GLUE_SECTION = "glue"
Field Value
Type |
Description |
System.String |
|
CONFIG_INSTRUMENTATION_SECTION
Declaration
public const string CONFIG_INSTRUMENTATION_SECTION = "instrumentation"
Field Value
Type |
Description |
System.String |
|
CONFIG_LOG_SECTION
Declaration
public const string CONFIG_LOG_SECTION = "log"
Field Value
Type |
Description |
System.String |
|
CONFIG_MEMORY_MANAGEMENT_SECTION
Declaration
public const string CONFIG_MEMORY_MANAGEMENT_SECTION = "memory-management"
Field Value
Type |
Description |
System.String |
|
CONFIG_MODULE_SECTION
Declaration
public const string CONFIG_MODULE_SECTION = "module"
Field Value
Type |
Description |
System.String |
|
CONFIG_MODULES_SECTION
Declaration
public const string CONFIG_MODULES_SECTION = "modules"
Field Value
Type |
Description |
System.String |
|
CONFIG_OBJECT_STORE_SECTION
Declaration
public const string CONFIG_OBJECT_STORE_SECTION = "object-store"
Field Value
Type |
Description |
System.String |
|
CONFIG_PATH_ATTR
Declaration
public const string CONFIG_PATH_ATTR = "path"
Field Value
Type |
Description |
System.String |
|
CONFIG_SECURITY_SECTION
Declaration
public const string CONFIG_SECURITY_SECTION = "security"
Field Value
Type |
Description |
System.String |
|
CONFIG_STARTER_SECTION
Declaration
public const string CONFIG_STARTER_SECTION = "starter"
Field Value
Type |
Description |
System.String |
|
CONFIG_STARTERS_SECTION
Declaration
public const string CONFIG_STARTERS_SECTION = "starters"
Field Value
Type |
Description |
System.String |
|
CONFIG_SWITCH
Declaration
public const string CONFIG_SWITCH = "config"
Field Value
Type |
Description |
System.String |
|
CONFIG_TIMESOURCE_SECTION
Declaration
public const string CONFIG_TIMESOURCE_SECTION = "time-source"
Field Value
Type |
Description |
System.String |
|
CONFIG_UNIT_TEST_ATTR
Declaration
public const string CONFIG_UNIT_TEST_ATTR = "unit-test"
Field Value
Type |
Description |
System.String |
|
m_CommandArgs
Declaration
protected ConfigSectionNode m_CommandArgs
Field Value
m_ConfigRoot
Declaration
protected ConfigSectionNode m_ConfigRoot
Field Value
m_ConfigSettings
Declaration
protected List<IConfigSettings> m_ConfigSettings
Field Value
m_DataStore
Declaration
protected IDataStoreImplementation m_DataStore
Field Value
m_DefaultDependencyInjector
Declaration
protected IApplicationDependencyInjectorImplementation m_DefaultDependencyInjector
Field Value
m_DefaultTimeSource
Declaration
protected ITimeSourceImplementation m_DefaultTimeSource
Field Value
m_DependencyInjector
Declaration
protected IApplicationDependencyInjectorImplementation m_DependencyInjector
Field Value
m_EventTimer
Declaration
protected IEventTimerImplementation m_EventTimer
Field Value
m_FinishNotifiables
Declaration
protected List<IApplicationFinishNotifiable> m_FinishNotifiables
Field Value
m_Glue
Declaration
protected IGlueImplementation m_Glue
Field Value
m_Instrumentation
Declaration
protected IInstrumentationImplementation m_Instrumentation
Field Value
m_Log
Declaration
protected ILogImplementation m_Log
Field Value
m_Module
Declaration
protected IModuleImplementation m_Module
Field Value
m_NOPDataStore
Declaration
protected IDataStoreImplementation m_NOPDataStore
Field Value
m_NOPEventTimer
Declaration
protected IEventTimerImplementation m_NOPEventTimer
Field Value
m_NOPGlue
Declaration
protected IGlueImplementation m_NOPGlue
Field Value
m_NOPInstrumentation
Declaration
protected IInstrumentationImplementation m_NOPInstrumentation
Field Value
m_NOPLog
Declaration
protected ILogImplementation m_NOPLog
Field Value
m_NOPModule
Declaration
protected IModuleImplementation m_NOPModule
Field Value
m_NOPObjectStore
Declaration
protected IObjectStoreImplementation m_NOPObjectStore
Field Value
m_NOPSecurityManager
Declaration
protected ISecurityManagerImplementation m_NOPSecurityManager
Field Value
m_ObjectStore
Declaration
protected IObjectStoreImplementation m_ObjectStore
Field Value
m_Realm
Declaration
protected IApplicationRealmImplementation m_Realm
Field Value
m_SecurityManager
Declaration
protected ISecurityManagerImplementation m_SecurityManager
Field Value
m_ShutdownStarted
Declaration
protected volatile bool m_ShutdownStarted
Field Value
Type |
Description |
System.Boolean |
|
m_Singletons
Declaration
protected ApplicationSingletonManager m_Singletons
Field Value
m_StartTime
Declaration
protected DateTime m_StartTime
Field Value
Type |
Description |
System.DateTime |
|
m_TimeSource
Declaration
protected ITimeSourceImplementation m_TimeSource
Field Value
Properties
Active
Returns true when application instance is active and working. This property returns false as soon as application finalization starts on shutdown
Use to exit long-running loops and such as a cancellation flag
Declaration
public bool Active { get; }
Property Value
Type |
Description |
System.Boolean |
|
AllComponents
Enumerates all components of this application
Declaration
public IEnumerable<IApplicationComponent> AllComponents { get; }
Property Value
AllowNesting
Returns true if the app container allows nesting of another app container
Declaration
public virtual bool AllowNesting { get; }
Property Value
Type |
Description |
System.Boolean |
|
CommandArgs
Declaration
public IConfigSectionNode CommandArgs { get; }
Property Value
ConfigRoot
Declaration
public IConfigSectionNode ConfigRoot { get; }
Property Value
DataStore
Declaration
public IDataStore DataStore { get; }
Property Value
DependencyInjector
Declaration
public IApplicationDependencyInjector DependencyInjector { get; }
Property Value
EnvironmentName
Provides access to "environment-name" attribute, e.g. "DEV" vs "PROD"
Declaration
public string EnvironmentName { get; }
Property Value
Type |
Description |
System.String |
|
EventTimer
Declaration
public IEventTimer EventTimer { get; }
Property Value
ForceInvariantCulture
True to force app container set process-wide invariant culture on boot
Declaration
public virtual bool ForceInvariantCulture { get; }
Property Value
Type |
Description |
System.Boolean |
|
Glue
Declaration
public IGlue Glue { get; }
Property Value
InstanceID
Returns unique identifier of this running instance
Declaration
public Guid InstanceID { get; }
Property Value
Type |
Description |
System.Guid |
|
Instrumentation
Declaration
public IInstrumentation Instrumentation { get; }
Property Value
IsUnitTest
True if this app chassis is a test rig
Declaration
public virtual bool IsUnitTest { get; }
Property Value
Type |
Description |
System.Boolean |
|
LocalizedTime
Returns current time localized per TimeLocation
Declaration
public DateTime LocalizedTime { get; }
Property Value
Type |
Description |
System.DateTime |
|
Log
Declaration
Property Value
ModuleRoot
Declaration
public IModule ModuleRoot { get; }
Property Value
Name
Returns the name of this application
Declaration
public string Name { get; }
Property Value
Type |
Description |
System.String |
|
ObjectStore
Declaration
public IObjectStore ObjectStore { get; }
Property Value
Random
Returns app random generator
Declaration
public RandomGenerator Random { get; }
Property Value
Realm
Returns an accessor to the application surrounding environment (realm) in which app gets executed.
This realm is sub-divided into uniquely-named areas each reporting their status. Realms are used in distributed
systems and represent zone/section of cluster
Declaration
public IApplicationRealm Realm { get; }
Property Value
SecurityManager
Declaration
public ISecurityManager SecurityManager { get; }
Property Value
ShutdownStarted
Returns true to indicate that Dispose() has been called and shutdown has started
Declaration
public bool ShutdownStarted { get; }
Property Value
Type |
Description |
System.Boolean |
|
Singletons
Declaration
public IApplicationSingletonManager Singletons { get; }
Property Value
StartTime
Returns timestamp when application started as localized app time
Declaration
public DateTime StartTime { get; }
Property Value
Type |
Description |
System.DateTime |
|
Stopping
Returns true to indicate that Stop() was called
Declaration
public bool Stopping { get; }
Property Value
Type |
Description |
System.Boolean |
|
TimeLocation
Returns time location of this LocalizedTimeProvider implementation
Declaration
public TimeLocation TimeLocation { get; set; }
Property Value
TimeSource
Declaration
public ITimeSource TimeSource { get; }
Property Value
Methods
CleanupApplication()
Declaration
protected virtual void CleanupApplication()
CleanupComponent<T>(ref T, String)
Declaration
protected virtual void CleanupComponent<T>(ref T cmp, string name)
where T : class, IDisposable
Parameters
Type |
Name |
Description |
T |
cmp |
|
System.String |
name |
|
Type Parameters
Constructor(Boolean, Configuration, ConfigSectionNode, IApplicationDependencyInjectorImplementation)
Declaration
protected void Constructor(bool allowNesting, Configuration cmdLineArgs, ConfigSectionNode rootConfig, IApplicationDependencyInjectorImplementation defaultDI = null)
Parameters
Destructor()
Declaration
protected override void Destructor()
Overrides
DoCleanupApplication()
Declaration
protected virtual void DoCleanupApplication()
DoInitApplication()
Declaration
protected virtual void DoInitApplication()
DoModuleAfterInitApplication()
Declaration
protected virtual void DoModuleAfterInitApplication()
DoModuleBeforeCleanupApplication()
Declaration
protected virtual void DoModuleBeforeCleanupApplication()
GetComponentByCommonName(String)
Returns an existing application component instance by its ComponentCommonName or null. The search is case-insensitive
Declaration
public IApplicationComponent GetComponentByCommonName(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
GetComponentBySID(UInt64)
Returns a component by SID or null
Declaration
public IApplicationComponent GetComponentBySID(ulong sid)
Parameters
Type |
Name |
Description |
System.UInt64 |
sid |
|
Returns
GetConfiguration()
Declaration
protected virtual Configuration GetConfiguration()
Returns
GetDefaultConfigFileName()
Tries to find a configuration file name looping through various supported extensions
Declaration
protected string GetDefaultConfigFileName()
Returns
Type |
Description |
System.String |
File name that exists or empty string
|
GetStarters()
Declaration
protected IEnumerable<IApplicationStarter> GetStarters()
Returns
InitApplication()
Declaration
protected virtual void InitApplication()
InitDataStore()
Declaration
protected virtual void InitDataStore()
InitDependencyInjector()
Declaration
protected virtual void InitDependencyInjector()
InitEventTimer()
Declaration
protected virtual void InitEventTimer()
InitGlue()
Declaration
protected virtual void InitGlue()
InitInstrumentation()
Declaration
protected virtual void InitInstrumentation()
InitLog()
Declaration
protected virtual void InitLog()
InitModule()
Declaration
protected virtual void InitModule()
InitObjectStore()
Declaration
protected virtual void InitObjectStore()
InitSecurityManager()
Declaration
protected virtual void InitSecurityManager()
InitTimeSource()
Declaration
protected virtual void InitTimeSource()
LocalizedTimeToUniversalTime(DateTime)
Converts localized time to UTC time as of TimeLocation property
Declaration
public DateTime LocalizedTimeToUniversalTime(DateTime local)
Parameters
Type |
Name |
Description |
System.DateTime |
local |
|
Returns
Type |
Description |
System.DateTime |
|
MakeNewSessionInstance(Guid, User)
Makes BaseSession instance
Declaration
public virtual ISession MakeNewSessionInstance(Guid sessionID, User user = null)
Parameters
Type |
Name |
Description |
System.Guid |
sessionID |
|
User |
user |
|
Returns
NotifyAllConfigSettingsAboutChange()
Forces notification of all registered IConfigSettings-implementers about configuration change
Declaration
public void NotifyAllConfigSettingsAboutChange()
NotifyAllConfigSettingsAboutChange(IConfigSectionNode)
Forces notification of all registered IConfigSettings-implementers about configuration change
Declaration
protected void NotifyAllConfigSettingsAboutChange(IConfigSectionNode node)
Parameters
RegisterAppFinishNotifiable(IApplicationFinishNotifiable)
Registers an instance of IApplicationFinishNotifiable with application container to receive a call when
underlying application instance will finish its life cycle
Declaration
public bool RegisterAppFinishNotifiable(IApplicationFinishNotifiable notifiable)
Parameters
Returns
Type |
Description |
System.Boolean |
True if notifiable instance was not found and was added
|
RegisterConfigSettings(IConfigSettings)
Registers an instance of IConfigSettings with application container to receive a call when
underlying app configuration changes
Declaration
public bool RegisterConfigSettings(IConfigSettings settings)
Parameters
Returns
Type |
Description |
System.Boolean |
True if settings instance was not found and was added
|
Stop()
Initiates the stop of the application by setting its Stopping to true and Active to false so dependent services may start to terminate
Declaration
UniversalTimeToLocalizedTime(DateTime)
Converts universal time to local time as of TimeLocation property
Declaration
public DateTime UniversalTimeToLocalizedTime(DateTime utc)
Parameters
Type |
Name |
Description |
System.DateTime |
utc |
|
Returns
Type |
Description |
System.DateTime |
|
UnregisterAppFinishNotifiable(IApplicationFinishNotifiable)
Removes the registration of IConfigSettings from application container
Declaration
public bool UnregisterAppFinishNotifiable(IApplicationFinishNotifiable notifiable)
Parameters
Returns
Type |
Description |
System.Boolean |
True if notifiable instance was found and removed
|
UnregisterConfigSettings(IConfigSettings)
Removes the registration of IConfigSettings from application container
Declaration
public bool UnregisterConfigSettings(IConfigSettings settings)
Parameters
Returns
Type |
Description |
System.Boolean |
True if settings instance was found and removed
|
WriteLog(MessageType, String, String, Exception, String, Int32, Object, Nullable<Guid>)
Declaration
protected Guid WriteLog(MessageType type, string from, string msgText, Exception error = null, string file = "", int line = 0, object pars = null, Guid? related = default(Guid? ))
Parameters
Type |
Name |
Description |
MessageType |
type |
|
System.String |
from |
|
System.String |
msgText |
|
System.Exception |
error |
|
System.String |
file |
|
System.Int32 |
line |
|
System.Object |
pars |
|
System.Nullable<System.Guid> |
related |
|
Returns
Type |
Description |
System.Guid |
|
Implements
System.IDisposable
Extension Methods