C# Class GSF.ServiceProcess.ServiceHelper

Inheritance: System.ComponentModel.Component, ISupportLifecycle, ISupportInitialize, IProvideStatus, IPersistSettings
Mostra file Open project: GridProtectionAlliance/gsf Class Usage Examples

Private Properties

Property Type Description
AbortProcess void
BeginInit void
CurtailMessageLength string
EndInit void
ErrorLogger_LoggingException void
LoadSchedules void
LogicalThread_ProcessException void
ManageFiles void
OnPause void
OnResume void
OnShutdown void
OnStart void
OnStop void
PrioritizeStatusUpdate void
ProcessStatusUpdates void
Process_StateChanged void
QueueStatusUpdate void
ReloadCryptoCache void
ReloadSettings void
RemoteCommandProcess_ErrorDataReceived void
RemoteCommandProcess_OutputDataReceived void
RemoteTelnetSession void
RemotingServer_ClientConnectingException void
RemotingServer_ClientDisconnected void
RemotingServer_ReceiveClientDataComplete void
RescheduleProcess void
ResetHealthMonitor void
SaveSchedules void
Scheduler_ScheduleDue void
SendAuthenticationFailureResponse void
SendAuthenticationSuccessResponse void
SendProcessStateChangedResponse void
SendServiceStateChangedResponse void
SendUpdateClientStatusResponse void
ShowClients void
ShowHealthReport void
ShowProcesses void
ShowRequestHelp void
ShowRequestHistory void
ShowSchedules void
ShowServiceStatus void
ShowSettings void
ShowTime void
ShowUser void
ShowVersion void
StartProcess void
StatusLog_LogException void
TransferFile void
TrySetCurrentThreadPrincipal bool
UnscheduleProcess void
UpdateClientFilter void
UpdateSettings void
UpdateStatus void
UpdateStatus void
UpdateStatus void
UpdateStatus void
UpdateStatusAppendLine void
UpdateStatusAppendLine void
VerifySecurity bool

Public Methods

Method Description
AddProcess ( object[]>.Action processExecutionMethod, string processName ) : bool

Adds a new ServiceProcess to the ServiceHelper.

AddProcess ( object[]>.Action processExecutionMethod, string processName, object processArguments ) : bool

Adds a new ServiceProcess to the ServiceHelper.

AddScheduledProcess ( object[]>.Action processExecutionMethod, string processName, object processArguments, string processSchedule ) : bool

Adds a new ServiceProcess to the ServiceHelper that executes on a schedule.

AddScheduledProcess ( object[]>.Action processExecutionMethod, string processName, string processSchedule ) : bool

Adds a new ServiceProcess to the ServiceHelper that executes on a schedule.

DisconnectClient ( System.Guid clientID ) : void

Disconnects the client from the service.

FindClientRequestHandler ( string handlerCommand ) : GSF.ServiceProcess.ClientRequestHandler

Returns the ClientRequestHandler object for the specified handlerCommand.

FindConnectedClient ( System.Guid clientID ) : ClientInfo

Returns the ClientInfo object for the specified clientID.

FindProcess ( string processName ) : ServiceProcess

Returns the ServiceProcess for the specified processName.

Initialize ( ) : void

Initializes the ServiceHelper.

Initialize() is to be called by user-code directly only if the ServiceHelper object is not consumed through the designer surface of the IDE.

LoadSettings ( ) : void

Loads saved settings of the ServiceHelper from the config file if the PersistSettings property is set to true.

LoadSettings ( bool includeServiceComponents ) : void

Loads saved settings of the ServiceHelper from the config file if the PersistSettings property is set to true.

LogException ( Exception ex ) : void

Log exception to ErrorLogger.

RemoveProcess ( string processName ) : bool

Removes an existing ServiceProcess from the ServiceHelper.

RemoveScheduledProcess ( string processName ) : bool

Removes an existing ServiceProcess from the ServiceHelper that is scheduled for automatic execution.

SaveSettings ( ) : void

Saves settings of the ServiceHelper to the config file if the PersistSettings property is set to true.

SaveSettings ( bool includeServiceComponents ) : void

Saves settings of the ServiceHelper to the config file if the PersistSettings property is set to true.

ScheduleProcess ( string processName, string scheduleRule ) : bool

Schedules an existing ServiceProcess for automatic execution.

ScheduleProcess ( string processName, string scheduleRule, bool updateExistingSchedule ) : bool

Schedules an existing ServiceProcess for automatic execution.

SendActionableResponse ( GSF.ServiceProcess.ClientRequestInfo requestInfo, bool success, object attachment = null, string status = null ) : void

Sends an actionable response to client along with an optional formatted message and attachment.

This method is used to send an actionable client response that can be used for responding to an event after a command has been issued.

SendResponse ( System.Guid client, ServiceResponse response ) : void

Sends the specified response to the specified client only.

SendResponse ( System.Guid client, ServiceResponse response, bool async ) : void

Sends the specified response to the specified client only.

SendResponse ( ServiceResponse response ) : void

Sends the specified response to all RemoteClients.

ServiceHelper ( ) : GSF.Annotations

Initializes a new instance of the ServiceHelper class.

ServiceHelper ( IContainer container ) : GSF.Annotations

Initializes a new instance of the ServiceHelper class.

UnscheduleProcess ( string processName ) : bool

Unschedules an existing ServiceProcess scheduled for automatic execution.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the ServiceHelper object and optionally releases the managed resources.

OnLoggedException ( Exception ex ) : void

Raises LoggedException event with logged exception.

OnProcessStateChanged ( string processName, ServiceProcessState processState ) : void

Raises the ProcessStateChanged event.

OnReceivedClientRequest ( ClientRequest request, ClientInfo requestSender ) : void

Raises the ReceivedClientRequest event.

OnServicePaused ( ) : void

Raises the ServicePaused event.

OnServicePausing ( ) : void

Raises the ServicePausing event.

OnServiceResumed ( ) : void

Raises the ServiceResumed event.

OnServiceResuming ( ) : void

Raises the ServiceResuming event.

OnServiceStarted ( ) : void

Raises the ServiceStarted event.

OnServiceStarting ( string args ) : void

Raises the ServiceStarting event.

OnServiceStopped ( ) : void

Raises the ServiceStopped event.

OnServiceStopping ( ) : void

Raises the ServiceStopping event.

OnSystemShutdown ( ) : void

Raises the SystemShutdown event.

OnUpdatedStatus ( System.Guid clientID, string status, UpdateType type ) : void

Raises the UpdatedStatus event with the updated status message.

This overload combines string.Format and SendStatusMessage for convenience.

Private Methods

Method Description
AbortProcess ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
BeginInit ( ) : void
CurtailMessageLength ( string message ) : string
EndInit ( ) : void
ErrorLogger_LoggingException ( object sender, EventArgs e ) : void
LoadSchedules ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
LogicalThread_ProcessException ( object sender, EventArgs e ) : void
ManageFiles ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
OnPause ( ) : void
OnResume ( ) : void
OnShutdown ( ) : void
OnStart ( string args ) : void
OnStop ( ) : void
PrioritizeStatusUpdate ( StatusUpdate update ) : void
ProcessStatusUpdates ( ) : void
Process_StateChanged ( object sender, EventArgs e ) : void
QueueStatusUpdate ( StatusUpdate update ) : void
ReloadCryptoCache ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
ReloadSettings ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
RemoteCommandProcess_ErrorDataReceived ( object sender, DataReceivedEventArgs e ) : void
RemoteCommandProcess_OutputDataReceived ( object sender, DataReceivedEventArgs e ) : void
RemoteTelnetSession ( GSF.ServiceProcess.ClientRequestInfo requestinfo ) : void
RemotingServer_ClientConnectingException ( object sender, EventArgs e ) : void
RemotingServer_ClientDisconnected ( object sender, EventArgs e ) : void
RemotingServer_ReceiveClientDataComplete ( object sender, EventArgs e ) : void
RescheduleProcess ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
ResetHealthMonitor ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
SaveSchedules ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
Scheduler_ScheduleDue ( object sender, EventArgs e ) : void
SendAuthenticationFailureResponse ( System.Guid clientID ) : void
SendAuthenticationSuccessResponse ( System.Guid clientID ) : void
SendProcessStateChangedResponse ( string processName, ServiceProcessState currentState ) : void
SendServiceStateChangedResponse ( ServiceState currentState ) : void
SendUpdateClientStatusResponse ( System.Guid clientID, UpdateType type, string responseMessage, bool telnetMessage = false ) : void
ShowClients ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
ShowHealthReport ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
ShowProcesses ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
ShowRequestHelp ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
ShowRequestHistory ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
ShowSchedules ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
ShowServiceStatus ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
ShowSettings ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
ShowTime ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
ShowUser ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
ShowVersion ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
StartProcess ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
StatusLog_LogException ( object sender, EventArgs e ) : void
TransferFile ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
TrySetCurrentThreadPrincipal ( ClientInfo client ) : bool
UnscheduleProcess ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
UpdateClientFilter ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
UpdateSettings ( GSF.ServiceProcess.ClientRequestInfo requestInfo ) : void
UpdateStatus ( System.Guid client, UpdateType type, bool publishToLog, string message ) : void
UpdateStatus ( System.Guid client, UpdateType type, string message ) : void
UpdateStatus ( UpdateType type, bool publishToLog, string message ) : void
UpdateStatus ( UpdateType type, string message ) : void
UpdateStatusAppendLine ( System.Guid client, UpdateType type, string message ) : void
UpdateStatusAppendLine ( UpdateType type, string message ) : void
VerifySecurity ( ClientInfo client ) : bool

Method Details

AddProcess() public method

Adds a new ServiceProcess to the ServiceHelper.
public AddProcess ( object[]>.Action processExecutionMethod, string processName ) : bool
processExecutionMethod object[]>.Action The to be invoked the is started.
processName string Name of the being added.
return bool

AddProcess() public method

Adds a new ServiceProcess to the ServiceHelper.
public AddProcess ( object[]>.Action processExecutionMethod, string processName, object processArguments ) : bool
processExecutionMethod object[]>.Action The to be invoked the is started.
processName string Name of the being added.
processArguments object Arguments to be passed in to the during execution.
return bool

AddScheduledProcess() public method

Adds a new ServiceProcess to the ServiceHelper that executes on a schedule.
public AddScheduledProcess ( object[]>.Action processExecutionMethod, string processName, object processArguments, string processSchedule ) : bool
processExecutionMethod object[]>.Action The to be invoked the is started.
processName string Name of the being added.
processArguments object Arguments to be passed in to the during execution.
processSchedule string for the execution of the .
return bool

AddScheduledProcess() public method

Adds a new ServiceProcess to the ServiceHelper that executes on a schedule.
public AddScheduledProcess ( object[]>.Action processExecutionMethod, string processName, string processSchedule ) : bool
processExecutionMethod object[]>.Action The to be invoked the is started.
processName string Name of the being added.
processSchedule string for the execution of the .
return bool

DisconnectClient() public method

Disconnects the client from the service.
public DisconnectClient ( System.Guid clientID ) : void
clientID System.Guid The ID of the client.
return void

Dispose() protected method

Releases the unmanaged resources used by the ServiceHelper object and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
return void

FindClientRequestHandler() public method

Returns the ClientRequestHandler object for the specified handlerCommand.
public FindClientRequestHandler ( string handlerCommand ) : GSF.ServiceProcess.ClientRequestHandler
handlerCommand string Request type whose object is to be retrieved.
return GSF.ServiceProcess.ClientRequestHandler

FindConnectedClient() public method

Returns the ClientInfo object for the specified clientID.
public FindConnectedClient ( System.Guid clientID ) : ClientInfo
clientID System.Guid ID of the client whose object is to be retrieved.
return ClientInfo

FindProcess() public method

Returns the ServiceProcess for the specified processName.
public FindProcess ( string processName ) : ServiceProcess
processName string Name of the to be retrieved.
return ServiceProcess

Initialize() public method

Initializes the ServiceHelper.
Initialize() is to be called by user-code directly only if the ServiceHelper object is not consumed through the designer surface of the IDE.
public Initialize ( ) : void
return void

LoadSettings() public method

Loads saved settings of the ServiceHelper from the config file if the PersistSettings property is set to true.
has a value of null or empty string.
public LoadSettings ( ) : void
return void

LoadSettings() public method

Loads saved settings of the ServiceHelper from the config file if the PersistSettings property is set to true.
public LoadSettings ( bool includeServiceComponents ) : void
includeServiceComponents bool A boolean value that indicates whether the settings of are to be loaded.
return void

LogException() public method

Log exception to ErrorLogger.
public LogException ( Exception ex ) : void
ex System.Exception Exception to log.
return void

OnLoggedException() protected method

Raises LoggedException event with logged exception.
protected OnLoggedException ( Exception ex ) : void
ex System.Exception Logged .
return void

OnProcessStateChanged() protected method

Raises the ProcessStateChanged event.
protected OnProcessStateChanged ( string processName, ServiceProcessState processState ) : void
processName string Name of the whose state changed.
processState ServiceProcessState New of the .
return void

OnReceivedClientRequest() protected method

Raises the ReceivedClientRequest event.
protected OnReceivedClientRequest ( ClientRequest request, ClientInfo requestSender ) : void
request ClientRequest The that was received.
requestSender ClientInfo The object of the sender.
return void

OnServicePaused() protected method

Raises the ServicePaused event.
protected OnServicePaused ( ) : void
return void

OnServicePausing() protected method

Raises the ServicePausing event.
protected OnServicePausing ( ) : void
return void

OnServiceResumed() protected method

Raises the ServiceResumed event.
protected OnServiceResumed ( ) : void
return void

OnServiceResuming() protected method

Raises the ServiceResuming event.
protected OnServiceResuming ( ) : void
return void

OnServiceStarted() protected method

Raises the ServiceStarted event.
protected OnServiceStarted ( ) : void
return void

OnServiceStarting() protected method

Raises the ServiceStarting event.
protected OnServiceStarting ( string args ) : void
args string Arguments to be sent to event.
return void

OnServiceStopped() protected method

Raises the ServiceStopped event.
protected OnServiceStopped ( ) : void
return void

OnServiceStopping() protected method

Raises the ServiceStopping event.
protected OnServiceStopping ( ) : void
return void

OnSystemShutdown() protected method

Raises the SystemShutdown event.
protected OnSystemShutdown ( ) : void
return void

OnUpdatedStatus() protected method

Raises the UpdatedStatus event with the updated status message.
This overload combines string.Format and SendStatusMessage for convenience.
protected OnUpdatedStatus ( System.Guid clientID, string status, UpdateType type ) : void
clientID System.Guid ID of the client receiving the message.
status string Updated status message.
type UpdateType of status message.
return void

RemoveProcess() public method

Removes an existing ServiceProcess from the ServiceHelper.
public RemoveProcess ( string processName ) : bool
processName string Name of the to be removed.
return bool

RemoveScheduledProcess() public method

Removes an existing ServiceProcess from the ServiceHelper that is scheduled for automatic execution.
public RemoveScheduledProcess ( string processName ) : bool
processName string Name of the scheduled to be removed.
return bool

SaveSettings() public method

Saves settings of the ServiceHelper to the config file if the PersistSettings property is set to true.
has a value of null or empty string.
public SaveSettings ( ) : void
return void

SaveSettings() public method

Saves settings of the ServiceHelper to the config file if the PersistSettings property is set to true.
has a value of null or empty string.
public SaveSettings ( bool includeServiceComponents ) : void
includeServiceComponents bool A boolean value that indicates whether the settings of are to be saved.
return void

ScheduleProcess() public method

Schedules an existing ServiceProcess for automatic execution.
public ScheduleProcess ( string processName, string scheduleRule ) : bool
processName string Name of the to be scheduled.
scheduleRule string Rule that defines the execution pattern of the .
return bool

ScheduleProcess() public method

Schedules an existing ServiceProcess for automatic execution.
public ScheduleProcess ( string processName, string scheduleRule, bool updateExistingSchedule ) : bool
processName string Name of the to be scheduled.
scheduleRule string Rule that defines the execution pattern of the .
updateExistingSchedule bool true if the is to be re-scheduled; otherwise false.
return bool

SendActionableResponse() public method

Sends an actionable response to client along with an optional formatted message and attachment.
This method is used to send an actionable client response that can be used for responding to an event after a command has been issued.
public SendActionableResponse ( GSF.ServiceProcess.ClientRequestInfo requestInfo, bool success, object attachment = null, string status = null ) : void
requestInfo GSF.ServiceProcess.ClientRequestInfo instance containing the client request.
success bool Flag that determines if this response to client request was a success.
attachment object Attachment to send with response.
status string Formatted status message to send with response.
return void

SendResponse() public method

Sends the specified response to the specified client only.
public SendResponse ( System.Guid client, ServiceResponse response ) : void
client System.Guid ID of the client to whom the is to be sent.
response ServiceResponse The to be sent to the .
return void

SendResponse() public method

Sends the specified response to the specified client only.
public SendResponse ( System.Guid client, ServiceResponse response, bool async ) : void
client System.Guid ID of the client to whom the is to be sent.
response ServiceResponse The to be sent to the .
async bool Flag to determine whether to wait for the send operations to complete.
return void

SendResponse() public method

Sends the specified response to all RemoteClients.
public SendResponse ( ServiceResponse response ) : void
response ServiceResponse The to be sent to all .
return void

ServiceHelper() public method

Initializes a new instance of the ServiceHelper class.
public ServiceHelper ( ) : GSF.Annotations
return GSF.Annotations

ServiceHelper() public method

Initializes a new instance of the ServiceHelper class.
public ServiceHelper ( IContainer container ) : GSF.Annotations
container IContainer object that contains the .
return GSF.Annotations

UnscheduleProcess() public method

Unschedules an existing ServiceProcess scheduled for automatic execution.
public UnscheduleProcess ( string processName ) : bool
processName string Name of the to be unscheduled.
return bool