-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEtoileSystem.h
134 lines (98 loc) · 4.73 KB
/
EtoileSystem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
EtoileSystem.h
Etoile main system process, playing the role of both init process and main
server process. It takes care to start, stop and monitor Etoile core
processes, possibly restarting them when they die.
Copyright (C) 2006 Quentin Mathe
Author: Quentin Mathe <[email protected]>
Date: March 2006
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#import <Foundation/Foundation.h>
/* Domains are related to CoreObject domains.
This process is going to be itself registered in CoreObject server under the
simple 'etoilesystem' entry. Every other core processes related objects will
have to be registered under this namespace.
Finally it is logically in charge to start the CoreObject server. */
/** Task/Process Info Dictionary Schema
option object type
LaunchPath NSString
Arguments NSArray
UserName (or Identity) NSString
Priority NSNumber
OnStart NSNumber/BOOL (<*BN> is NO and <*BY> is YES)
OnDemand NSNumber/BOOL (<*BN> is NO and <*BY> is YES)
Persistent NSNumber/BOOL (<*BN> is NO and <*BY> is YES)
Hidden NSNumber/BOOL (<*BN> is NO and <*BY> is YES)
Priority --> All the tasks are launched sequentially by ascending priority
order. When the priority values are identical, then they are launched in
parallel. For such tasks launch order becomes unpredictable.
OnStart --> 'YES' means the task is launched only when a new session is
initiated as when the user logs in or launches a project. Default value
is 'YES'.
OnDemand --> 'YES' means the task is launched only when the user or some
applications request it. Default value is 'NO'. If you set both 'OnStart'
and 'OnDemand' to 'YES', your task will be launched at the beginning of the
session but won't restarted automatically when it terminates. You can use
this flag combination to let the user specify favorite applications which
get launched at login time.
Persistent --> 'YES' means the task will be restarted on system boot if it
was already running during the previous session. It is usually bound to
tasks running in background. 'Default value is 'NO'.
Hidden --> 'YES' means the task is going to be unvisible on user side. Not
listed as part of any kind of running application list specific to the
user. 'Default value is 'NO'.
*/
extern NSString * const EtoileSystemServerName;
extern NSString *SCNoneOperation;
extern NSString *SCLogOutOperation;
extern NSString *SCShutDownOperation;
extern NSString *SCRebootOperation;
@interface SCSystem : NSObject
{
NSMutableDictionary *_processes; /* Main data structure */
NSMutableArray *_launchQueue;
NSMutableArray *_launchGroup;
/* Config file handling related ivars */
NSTimer *monitoringTimer;
NSString *configFilePath;
NSDate *modificationDate;
/* DO support */
//NSConnection *serverConnection;
NSConnection *clientConnection;
/* Session or Power Management operation underway (nil by default) */
NSString *_operation;
/* Flag used in -synchronizeProcessWithConfigFile */
BOOL _launchQueueScheduled;
}
+ (SCSystem *) sharedInstance;
/* Process Management */
- (BOOL) startProcessWithDomain: (NSString *)domain error: (NSError **)error;
- (BOOL) restartProcessWithDomain: (NSString *)domain error: (NSError **)error;
- (BOOL) stopProcessWithDomain: (NSString *)domain error: (NSError **)error;
- (BOOL) suspendProcessWithDomain: (NSString *)domain error: (NSError **)error;
- (void) run;
- (void) loadConfigList;
- (void) saveConfigList;
- (NSArray *) maskedProcesses;
- (BOOL) terminateAllProcessesOnOperation: (NSString *)op;
/* Session and Power Management */
- (oneway void) logOut;
- (oneway void) powerOff: (BOOL)reboot;
- (oneway void) suspend;
- (oneway void) extendPowerOffBy: (int)delay;
- (void) replyToLogOutOrPowerOff: (NSDictionary *)info;
/* SCSystem server daemon set up methods */
+ (id) serverInstance;
+ (BOOL) setUpServerInstance: (id)instance;
@end