mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-22 19:31:53 +00:00
Add a couple of convenience methods
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@36496 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8fccbdf89d
commit
43a8768871
3 changed files with 76 additions and 2 deletions
|
@ -461,6 +461,8 @@ EcMakeManagedObject(NSString *host, NSString *process, NSString *component);
|
||||||
|
|
||||||
/** <init/>
|
/** <init/>
|
||||||
* Initialises the receiver as an alarm for a particular event.<br />
|
* Initialises the receiver as an alarm for a particular event.<br />
|
||||||
|
* The managedObject argument may be nil if the alarm should use the
|
||||||
|
* default managed object value for the current process.<br />
|
||||||
* The eventDate argument may be nil if the alarm should use the current
|
* The eventDate argument may be nil if the alarm should use the current
|
||||||
* timestamp.<br />
|
* timestamp.<br />
|
||||||
* The managedObject, eventType, probableCause, and specificProblem
|
* The managedObject, eventType, probableCause, and specificProblem
|
||||||
|
|
25
EcProcess.h
25
EcProcess.h
|
@ -345,10 +345,35 @@ extern NSString* cmdVersion(NSString *ver);
|
||||||
*/
|
*/
|
||||||
@interface EcProcess : NSObject <CmdClient,EcAlarmDestination>
|
@interface EcProcess : NSObject <CmdClient,EcAlarmDestination>
|
||||||
|
|
||||||
|
/** Convenience method to produce a generic configuration alarm and send
|
||||||
|
* it via the -alarm: method.<br />
|
||||||
|
* The managed object may be nil (in which case it's the current process).<br />
|
||||||
|
* The implied event type is EcAlarmEventTypeProcessingError.<br />
|
||||||
|
* The implied probable cause is EcAlarmConfigurationOrCustomizationError.<br />
|
||||||
|
* The implied severity is EcAlarmSeverityMajor unless isCritical is YES.<br />
|
||||||
|
* The implied trend is EcAlarmTrendNone.<br />
|
||||||
|
* The implied proposed repair action is to check/correct the config.<br />
|
||||||
|
* The specific problem and additional text should be used to suggest
|
||||||
|
* what is wrong with the config and where the config error should be
|
||||||
|
* found/corrected.
|
||||||
|
*/
|
||||||
|
- (EcAlarm*) alarmConfigurationFor: (NSString*)managedObject
|
||||||
|
specificProblem: (NSString*)specificProblem
|
||||||
|
additionalText: (NSString*)additionalText
|
||||||
|
critical: (BOOL)isCritical;
|
||||||
|
|
||||||
/** Returns the array of current alarms.
|
/** Returns the array of current alarms.
|
||||||
*/
|
*/
|
||||||
- (NSArray*) alarms;
|
- (NSArray*) alarms;
|
||||||
|
|
||||||
|
/** Convenience method to clear an alarm as produced by the
|
||||||
|
* -alarmConfigErrorFor:specificProblem:perceivedSeverity:additionalText:
|
||||||
|
* method.
|
||||||
|
*/
|
||||||
|
- (void) clearConfigurationFor: (NSString*)managedObject
|
||||||
|
specificProblem: (NSString*)specificProblem
|
||||||
|
additionalText: (NSString*)additionalText;
|
||||||
|
|
||||||
/** Return a short copyright notice ... subclasses should override.
|
/** Return a short copyright notice ... subclasses should override.
|
||||||
*/
|
*/
|
||||||
- (NSString*) ecCopyright;
|
- (NSString*) ecCopyright;
|
||||||
|
|
51
EcProcess.m
51
EcProcess.m
|
@ -1310,14 +1310,61 @@ static NSString *noFiles = @"No log files to archive";
|
||||||
return started;
|
return started;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (oneway void) alarm: (in bycopy EcAlarm*)event
|
||||||
|
{
|
||||||
|
[alarmDestination alarm: event];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (EcAlarm*) alarmConfigurationFor: (NSString*)managedObject
|
||||||
|
specificProblem: (NSString*)specificProblem
|
||||||
|
additionalText: (NSString*)additionalText
|
||||||
|
critical: (BOOL)isCritical
|
||||||
|
{
|
||||||
|
EcAlarmSeverity severity;
|
||||||
|
NSString *action;
|
||||||
|
EcAlarm *a;
|
||||||
|
|
||||||
|
if (YES == isCritical)
|
||||||
|
{
|
||||||
|
severity = EcAlarmSeverityCritical;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
severity = EcAlarmSeverityMajor;
|
||||||
|
}
|
||||||
|
action = @"Check/correct configuration"; // FIXME ... localize
|
||||||
|
a = [EcAlarm alarmForManagedObject: managedObject
|
||||||
|
at: nil
|
||||||
|
withEventType: EcAlarmEventTypeProcessingError
|
||||||
|
probableCause: EcAlarmConfigurationOrCustomizationError
|
||||||
|
specificProblem: specificProblem
|
||||||
|
perceivedSeverity: severity
|
||||||
|
proposedRepairAction: action
|
||||||
|
additionalText: additionalText];
|
||||||
|
[self alarm: a];
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSArray*) alarms
|
- (NSArray*) alarms
|
||||||
{
|
{
|
||||||
return [alarmDestination alarms];
|
return [alarmDestination alarms];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (oneway void) alarm: (in bycopy EcAlarm*)event
|
- (void) clearConfigurationFor: (NSString*)managedObject
|
||||||
|
specificProblem: (NSString*)specificProblem
|
||||||
|
additionalText: (NSString*)additionalText
|
||||||
{
|
{
|
||||||
[alarmDestination alarm: event];
|
EcAlarm *a;
|
||||||
|
|
||||||
|
a = [EcAlarm alarmForManagedObject: managedObject
|
||||||
|
at: nil
|
||||||
|
withEventType: EcAlarmEventTypeProcessingError
|
||||||
|
probableCause: EcAlarmConfigurationOrCustomizationError
|
||||||
|
specificProblem: specificProblem
|
||||||
|
perceivedSeverity: EcAlarmSeverityCleared
|
||||||
|
proposedRepairAction: nil
|
||||||
|
additionalText: additionalText];
|
||||||
|
[self alarm: a];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (oneway void) domanage: (in bycopy NSString*)managedObject
|
- (oneway void) domanage: (in bycopy NSString*)managedObject
|
||||||
|
|
Loading…
Reference in a new issue