OpenPetra
Free Administration Software for Non-Profits
Ict.Petra.Server.App.Core.TServerManager Class Reference

Main class for Server startup and shutdown and Server interaction via a Server Admin application. More...

Inheritance diagram for Ict.Petra.Server.App.Core.TServerManager:
Ict.Common.Remoting.Server.TServerManagerBase Ict.Common.Remoting.Shared.IServerAdminInterface

Public Member Functions

 TServerManager ()
 Initialises Logging and parses Server settings from different sources. More...
 
override bool UpgradeDatabase ()
 upgrade the database More...
 
override string BackupDatabaseToYmlGZ ()
 Returns a string with yml.gz data. More...
 
override bool RestoreDatabaseFromYmlGZ (string AYmlGzData)
 Restore the database from a string with yml.gz data. More...
 
override void RefreshAllCachedTables ()
 Marks all DataTables in the Cache to be no longer up-to-date (=out of sync with the data that was originally placed in the DataTable). More...
 
override bool SetPassword (string AUserID, string APassword)
 SetPassword More...
 
override bool LockSysadmin ()
 LockSysadmin More...
 
override bool AddUser (string AUserID, string APassword="")
 AddUser More...
 
override void PerformTimedProcessingNow (string AProcessName)
 Allows the server or admin console to run a timed processing job now More...
 
void HookupProperShutdownProcessing ()
 Ensures Logging and an 'ordered cooperative shutdown' in case an Unhandled Exception is thrown in Threads, ThreadPool work items or Finalizers anywhere in the PetraServer. More...
 
bool StopServerControlled (bool AForceAutomaticClosing)
 Stops the Petra Server in a more controlled way than the StopServer Method. More...
 
void StopServer ()
 Stops the Petra Server. A GC is invoked and waits for pending tasks before the application ends. More...
 
bool DisconnectClient (System.Int16 AClientID, out String ACantDisconnectReason)
 Requests disconnection of a certain Client from the Petra Server. More...
 
bool QueueClientTask (System.Int16 AClientID, String ATaskGroup, String ATaskCode, object ATaskParameter1, object ATaskParameter2, object ATaskParameter3, object ATaskParameter4, System.Int16 ATaskPriority)
 Queues a ClientTask for a certain Client. More...
 
String FormatClientList (Boolean AListDisconnectedClients)
 Formats the client list array for output in a fixed-width font (eg. to the Console) More...
 
String FormatClientListSysadm (Boolean AListDisconnectedClients)
 Formats the client list array for output in the sysadm dialog for selection of a client id More...
 
System.Int64 PerformGC ()
 Performs a GarbageCollection on the Server. More...
 
virtual int ClearConnectionPoolAndGetNumberOfDBConnections ()
 Clears (flushes) all RDMBS Connection Pools and returns the new number of DB Connections after clearing all RDMBS Connection Pools. More...
 
virtual int ListGpgKeys (out string List)
 Lists the GPG keys for the Intranet server that are available to the Petra Server. More...
 
virtual int ImportGpgKeys (out string List)
 Imports the GPG encryption keys for the Intranet server. More...
 
virtual bool TimedProcessingJobEnabled (string AProcessName)
 Is the process job enabled? More...
 

Static Public Member Functions

static void ResetStaticVariables ()
 reset the static variables for each Web Request call. More...
 
static bool CheckServerAdminToken (string AServerAdminToken)
 check if a file with this security token exists More...
 

Static Public Attributes

static IServerAdminInterface TheServerManager = null
 static: only initialised once for the whole server More...
 

Static Protected Attributes

static Int64 FDBReconnectionAttemptsCounter = -1
 DB Reconnection attempts (-1 = no connection established yet at all; 0 = none are being made). More...
 
static bool FServerTimedProcessingSetup = false
 Whether the Timed Processing has been set up already. More...
 

Properties

static TServerManager TheCastedServerManager [get]
 get a casted version of the static variable More...
 
Int64 DBReconnectionAttemptsCounter [get, set]
 DB Reconnection attempts (-1 = no connection established yet at all; 0 = none are being made). More...
 
Int64 SiteKey [get]
 SiteKey of the OpenPetra DB that the Server is connected to. More...
 
int ClientsConnected [get]
 Number of Clients that are currently connected to the Petra Server. More...
 
bool ServerTimedProcessingSetup [get]
 Whether the 'Server Timed Processing' has been set up. More...
 
int ClientsConnectedTotal [get]
 Total number of Clients that connected to the Petra Server since the start of the Petra Server More...
 
ArrayList ClientList [get]
 Array that contains information about the Clients that are currently connected to the Petra Server. More...
 
ArrayList ClientListDisconnected [get]
 Array that contains information about the Clients that are currently connected to the Petra Server. More...
 
int IPPort [get]
 Server setting: IP Port that the Server listens for .NET Remoting calls More...
 
String ConfigurationFileName [get]
 Server setting: Name of the Server configuration file More...
 
String ServerInfoVersion [get]
 Version of the Petra Server and operating system on which the Server runs More...
 
String ServerInfoState [get]
 State of the Server More...
 
System.Int64 ServerInfoMemory [get]
 Result of a call to GC.GetTotalMemory More...
 
virtual string TimedProcessingDailyStartTime24Hrs [get]
 the daily start time for the timed processing More...
 

Detailed Description

Main class for Server startup and shutdown and Server interaction via a Server Admin application.

It is designed in a way that the Server .exe file can be either a Command line application or any other form of .NET application (eg. WinForms) to provide Petra Server functionality. (The Server .exe file contains almost no logic because the logic is centralised in this class.)

TServerManager gets remoted and can be accessed via an Interface from a Server Admin application such as PetraServerAdminConsole.exe

Constructor & Destructor Documentation

◆ TServerManager()

Ict.Petra.Server.App.Core.TServerManager.TServerManager ( )
inline

Initialises Logging and parses Server settings from different sources.

Member Function Documentation

◆ AddUser()

override bool Ict.Petra.Server.App.Core.TServerManager.AddUser ( string  AUserID,
string  APassword = "" 
)
inlinevirtual

AddUser

Reimplemented from Ict.Common.Remoting.Server.TServerManagerBase.

◆ BackupDatabaseToYmlGZ()

override string Ict.Petra.Server.App.Core.TServerManager.BackupDatabaseToYmlGZ ( )
inlinevirtual

Returns a string with yml.gz data.

Returns

Reimplemented from Ict.Common.Remoting.Server.TServerManagerBase.

◆ CheckServerAdminToken()

static bool Ict.Common.Remoting.Server.TServerManagerBase.CheckServerAdminToken ( string  AServerAdminToken)
inlinestaticinherited

check if a file with this security token exists

◆ ClearConnectionPoolAndGetNumberOfDBConnections()

virtual int Ict.Common.Remoting.Server.TServerManagerBase.ClearConnectionPoolAndGetNumberOfDBConnections ( )
inlinevirtualinherited

Clears (flushes) all RDMBS Connection Pools and returns the new number of DB Connections after clearing all RDMBS Connection Pools.

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ DisconnectClient()

bool Ict.Common.Remoting.Server.TServerManagerBase.DisconnectClient ( System.Int16  AClientID,
out String  ACantDisconnectReason 
)
inlineinherited

Requests disconnection of a certain Client from the Petra Server.

Parameters
AClientIDServer-assigned ID of the Client
ACantDisconnectReasonReason why the Client cannot be disconnected
Returns
true if disconnection succeeded, otherwise false.

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ FormatClientList()

String Ict.Common.Remoting.Server.TServerManagerBase.FormatClientList ( Boolean  AListDisconnectedClients)
inlineinherited

Formats the client list array for output in a fixed-width font (eg. to the Console)

Returns
Formatted client list.

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ FormatClientListSysadm()

String Ict.Common.Remoting.Server.TServerManagerBase.FormatClientListSysadm ( Boolean  AListDisconnectedClients)
inlineinherited

Formats the client list array for output in the sysadm dialog for selection of a client id

Returns
Formatted client list for sysadm dialog.

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ HookupProperShutdownProcessing()

void Ict.Common.Remoting.Server.TServerManagerBase.HookupProperShutdownProcessing ( )
inlineinherited

Ensures Logging and an 'ordered cooperative shutdown' in case an Unhandled Exception is thrown in Threads, ThreadPool work items or Finalizers anywhere in the PetraServer.

Ensures proper handling of the mentioned situations which were non-fatal to the PetraServer Process in .NET 1.1, but are fatal with .NET 2.0 (also true when running on mono)!

See http://msdn.microsoft.com/en-us/netframework/aa497241.aspx (Text block with Short Desciption 'Unhandled Exceptions will always be fatal to a process').

Returns
void

◆ ImportGpgKeys()

virtual int Ict.Common.Remoting.Server.TServerManagerBase.ImportGpgKeys ( out string  List)
inlinevirtualinherited

Imports the GPG encryption keys for the Intranet server.

Parameters
ListReturn the output of the gpg command.
Returns
Return code of external gpg command.

◆ ListGpgKeys()

virtual int Ict.Common.Remoting.Server.TServerManagerBase.ListGpgKeys ( out string  List)
inlinevirtualinherited

Lists the GPG keys for the Intranet server that are available to the Petra Server.

Parameters
ListReturns the output of the external gpg command.
Returns
Return code of gpg command.

◆ LockSysadmin()

override bool Ict.Petra.Server.App.Core.TServerManager.LockSysadmin ( )
inlinevirtual

LockSysadmin

Reimplemented from Ict.Common.Remoting.Server.TServerManagerBase.

◆ PerformGC()

System.Int64 Ict.Common.Remoting.Server.TServerManagerBase.PerformGC ( )
inlineinherited

Performs a GarbageCollection on the Server.

Returns
Result of a call to GC.GetTotalMemory after the GC was performed.

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ PerformTimedProcessingNow()

override void Ict.Petra.Server.App.Core.TServerManager.PerformTimedProcessingNow ( string  AProcessName)
inlinevirtual

Allows the server or admin console to run a timed processing job now

Reimplemented from Ict.Common.Remoting.Server.TServerManagerBase.

◆ QueueClientTask()

bool Ict.Common.Remoting.Server.TServerManagerBase.QueueClientTask ( System.Int16  AClientID,
String  ATaskGroup,
String  ATaskCode,
object  ATaskParameter1,
object  ATaskParameter2,
object  ATaskParameter3,
object  ATaskParameter4,
System.Int16  ATaskPriority 
)
inlineinherited

Queues a ClientTask for a certain Client.

Parameters
AClientIDServer-assigned ID of the Client
ATaskGroupGroup of the Task
ATaskCodeCode of the Task
ATaskParameter1Parameter #1 for the Task (depending on the TaskGroup this can be left empty)
ATaskParameter2Parameter #2 for the Task (depending on the TaskGroup this can be left empty)
ATaskParameter3Parameter #3 for the Task (depending on the TaskGroup this can be left empty)
ATaskParameter4Parameter #4 for the Task (depending on the TaskGroup this can be left empty)
ATaskPriorityPriority of the Task
Returns
true if ClientTask was queued, otherwise false.

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ RefreshAllCachedTables()

override void Ict.Petra.Server.App.Core.TServerManager.RefreshAllCachedTables ( )
inlinevirtual

Marks all DataTables in the Cache to be no longer up-to-date (=out of sync with the data that was originally placed in the DataTable).

Reimplemented from Ict.Common.Remoting.Server.TServerManagerBase.

◆ ResetStaticVariables()

static void Ict.Common.Remoting.Server.TServerManagerBase.ResetStaticVariables ( )
inlinestaticinherited

reset the static variables for each Web Request call.

◆ RestoreDatabaseFromYmlGZ()

override bool Ict.Petra.Server.App.Core.TServerManager.RestoreDatabaseFromYmlGZ ( string  AYmlGzData)
inlinevirtual

Restore the database from a string with yml.gz data.

Returns

Reimplemented from Ict.Common.Remoting.Server.TServerManagerBase.

◆ SetPassword()

override bool Ict.Petra.Server.App.Core.TServerManager.SetPassword ( string  AUserID,
string  APassword 
)
inlinevirtual

SetPassword

Reimplemented from Ict.Common.Remoting.Server.TServerManagerBase.

◆ StopServer()

void Ict.Common.Remoting.Server.TServerManagerBase.StopServer ( )
inlineinherited

Stops the Petra Server. A GC is invoked and waits for pending tasks before the application ends.

Returns
void

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ StopServerControlled()

bool Ict.Common.Remoting.Server.TServerManagerBase.StopServerControlled ( bool  AForceAutomaticClosing)
inlineinherited

Stops the Petra Server in a more controlled way than the StopServer Method.

A ClientTask is queued for all connected Clients that asks them to save the UserDefaults, to disconnect from the Server and to close. This Method monitors the connected Clients until either all Clients have responded by disconnecting or if at least one Client didn't respond and a timeout was exceeded. If this is the case and the Argument AForceAutomaticClosing is true, a different ClientTask is queued for all Clients that are still connected that asks them to close (no saving of UserDefaults and no disconnection from the server!). This is a fallback in case (1) the client(s) crashed and can't either save the UserDefaults or can't disconnect, (2) the saving of UserDefaults or the disconnecting of Clients doesn't work for some server-side reason (e.g. broken DB connection would prevent saving of UserDefaults).

Parameters
AForceAutomaticClosingSet to true to force closing of non-responding Clients (this is set to true by the ServerAdminConsole as this process is non-interactive in this case).
Returns
False if AForceAutomaticClosing is false and there are still clients logged in.

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ TimedProcessingJobEnabled()

virtual bool Ict.Common.Remoting.Server.TServerManagerBase.TimedProcessingJobEnabled ( string  AProcessName)
inlinevirtualinherited

Is the process job enabled?

◆ UpgradeDatabase()

override bool Ict.Petra.Server.App.Core.TServerManager.UpgradeDatabase ( )
inlinevirtual

upgrade the database

Returns
true if the database was upgraded

Reimplemented from Ict.Common.Remoting.Server.TServerManagerBase.

Member Data Documentation

◆ FDBReconnectionAttemptsCounter

Int64 Ict.Common.Remoting.Server.TServerManagerBase.FDBReconnectionAttemptsCounter = -1
staticprotectedinherited

DB Reconnection attempts (-1 = no connection established yet at all; 0 = none are being made).

◆ FServerTimedProcessingSetup

bool Ict.Common.Remoting.Server.TServerManagerBase.FServerTimedProcessingSetup = false
staticprotectedinherited

Whether the Timed Processing has been set up already.

◆ TheServerManager

IServerAdminInterface Ict.Common.Remoting.Server.TServerManagerBase.TheServerManager = null
staticinherited

static: only initialised once for the whole server

Property Documentation

◆ ClientList

ArrayList Ict.Common.Remoting.Server.TServerManagerBase.ClientList
getinherited

Array that contains information about the Clients that are currently connected to the Petra Server.

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ ClientListDisconnected

ArrayList Ict.Common.Remoting.Server.TServerManagerBase.ClientListDisconnected
getinherited

Array that contains information about the Clients that are currently connected to the Petra Server.

◆ ClientsConnected

int Ict.Common.Remoting.Server.TServerManagerBase.ClientsConnected
getinherited

Number of Clients that are currently connected to the Petra Server.

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ ClientsConnectedTotal

int Ict.Common.Remoting.Server.TServerManagerBase.ClientsConnectedTotal
getinherited

Total number of Clients that connected to the Petra Server since the start of the Petra Server

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ ConfigurationFileName

String Ict.Common.Remoting.Server.TServerManagerBase.ConfigurationFileName
getinherited

Server setting: Name of the Server configuration file

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ DBReconnectionAttemptsCounter

Int64 Ict.Common.Remoting.Server.TServerManagerBase.DBReconnectionAttemptsCounter
getsetinherited

DB Reconnection attempts (-1 = no connection established yet at all; 0 = none are being made).

◆ IPPort

int Ict.Common.Remoting.Server.TServerManagerBase.IPPort
getinherited

Server setting: IP Port that the Server listens for .NET Remoting calls

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ ServerInfoMemory

System.Int64 Ict.Common.Remoting.Server.TServerManagerBase.ServerInfoMemory
getinherited

Result of a call to GC.GetTotalMemory

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ ServerInfoState

String Ict.Common.Remoting.Server.TServerManagerBase.ServerInfoState
getinherited

◆ ServerInfoVersion

String Ict.Common.Remoting.Server.TServerManagerBase.ServerInfoVersion
getinherited

Version of the Petra Server and operating system on which the Server runs

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ ServerTimedProcessingSetup

bool Ict.Common.Remoting.Server.TServerManagerBase.ServerTimedProcessingSetup
getinherited

Whether the 'Server Timed Processing' has been set up.

◆ SiteKey

Int64 Ict.Common.Remoting.Server.TServerManagerBase.SiteKey
getinherited

SiteKey of the OpenPetra DB that the Server is connected to.

Implements Ict.Common.Remoting.Shared.IServerAdminInterface.

◆ TheCastedServerManager

TServerManager Ict.Petra.Server.App.Core.TServerManager.TheCastedServerManager
staticget

get a casted version of the static variable

◆ TimedProcessingDailyStartTime24Hrs

virtual string Ict.Common.Remoting.Server.TServerManagerBase.TimedProcessingDailyStartTime24Hrs
getinherited

the daily start time for the timed processing


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