C# Class GSF.ServiceProcess.ServiceHelper

Inheritance: System.ComponentModel.Component, ISupportLifecycle, ISupportInitialize, IProvideStatus, IPersistSettings
Afficher le fichier Open project: GridProtectionAlliance/gsf Class Usage Examples

Private Properties

Свойство 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

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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

Méthode 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 méthode

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.
Résultat bool

AddProcess() public méthode

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.
Résultat bool

AddScheduledProcess() public méthode

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 .
Résultat bool

AddScheduledProcess() public méthode

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 .
Résultat bool

DisconnectClient() public méthode

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

Dispose() protected méthode

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.
Résultat void

FindClientRequestHandler() public méthode

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.
Résultat GSF.ServiceProcess.ClientRequestHandler

FindConnectedClient() public méthode

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.
Résultat ClientInfo

FindProcess() public méthode

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

Initialize() public méthode

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
Résultat void

LoadSettings() public méthode

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
Résultat void

LoadSettings() public méthode

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.
Résultat void

LogException() public méthode

Log exception to ErrorLogger.
public LogException ( Exception ex ) : void
ex System.Exception Exception to log.
Résultat void

OnLoggedException() protected méthode

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

OnProcessStateChanged() protected méthode

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

OnReceivedClientRequest() protected méthode

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

OnServicePaused() protected méthode

Raises the ServicePaused event.
protected OnServicePaused ( ) : void
Résultat void

OnServicePausing() protected méthode

Raises the ServicePausing event.
protected OnServicePausing ( ) : void
Résultat void

OnServiceResumed() protected méthode

Raises the ServiceResumed event.
protected OnServiceResumed ( ) : void
Résultat void

OnServiceResuming() protected méthode

Raises the ServiceResuming event.
protected OnServiceResuming ( ) : void
Résultat void

OnServiceStarted() protected méthode

Raises the ServiceStarted event.
protected OnServiceStarted ( ) : void
Résultat void

OnServiceStarting() protected méthode

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

OnServiceStopped() protected méthode

Raises the ServiceStopped event.
protected OnServiceStopped ( ) : void
Résultat void

OnServiceStopping() protected méthode

Raises the ServiceStopping event.
protected OnServiceStopping ( ) : void
Résultat void

OnSystemShutdown() protected méthode

Raises the SystemShutdown event.
protected OnSystemShutdown ( ) : void
Résultat void

OnUpdatedStatus() protected méthode

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.
Résultat void

RemoveProcess() public méthode

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

RemoveScheduledProcess() public méthode

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.
Résultat bool

SaveSettings() public méthode

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
Résultat void

SaveSettings() public méthode

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.
Résultat void

ScheduleProcess() public méthode

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 .
Résultat bool

ScheduleProcess() public méthode

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.
Résultat bool

SendActionableResponse() public méthode

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.
Résultat void

SendResponse() public méthode

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 .
Résultat void

SendResponse() public méthode

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.
Résultat void

SendResponse() public méthode

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

ServiceHelper() public méthode

Initializes a new instance of the ServiceHelper class.
public ServiceHelper ( ) : GSF.Annotations
Résultat GSF.Annotations

ServiceHelper() public méthode

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

UnscheduleProcess() public méthode

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