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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
|
// **********************************************************************
//
// Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef ICE_PACK_INTERNAL_ICE
#define ICE_PACK_INTERNAL_ICE
#include <Ice/Identity.ice>
#include <Ice/BuiltinSequences.ice>
#include <Ice/ProcessF.ice>
#include <IcePack/Admin.ice>
module IcePack
{
/**
*
* The object registry interface.
*
**/
interface ObjectRegistry
{
/**
*
* Add an object to the registry.
*
**/
void add(ObjectDescriptor desc)
throws ObjectExistsException;
/**
*
* Remove an object from the registry.
*
**/
void remove(Ice::Identity id)
throws ObjectNotExistException;
/**
*
* Find an object by identity and returns its description.
*
**/
nonmutating ObjectDescriptor getObjectDescriptor(Ice::Identity id)
throws ObjectNotExistException;
/**
*
* Find an object by identity and return its proxy.
*
**/
nonmutating Object* findById(Ice::Identity id)
throws ObjectNotExistException;
/**
*
* Find an object by type and return its proxy.
*
**/
nonmutating Object* findByType(string type);
/**
*
* Find all the objects with the given type.
*
**/
nonmutating Ice::ObjectProxySeq findAllWithType(string type);
/**
*
* Find all the objects matching the given expression.
*
**/
nonmutating ObjectDescriptorSeq findAll(string expression);
};
/**
*
* This exception is raised if an adapter is active.
*
**/
exception AdapterActiveException
{
};
exception AdapterNotActiveException
{
/** True if the adapter can be activated on demand. */
bool activatable;
/** How long to wait for the adapter to become active. */
int timeout;
};
interface Adapter
{
/**
*
* Activate this adapter. If this adapter can be activated, this
* will activate the adapter and return the direct proxy of the
* adapter once it's active. If this adapter can be activated on
* demand, this will return 0 if the adapter is inactive or the
* adapter direct proxy it's active.
*
**/
["ami", "amd"] Object* activate();
/**
*
* Get the adapter direct proxy. The adapter direct proxy is a
* proxy created with the object adapter. The proxy contains the
* last known adapter endpoints.
*
* @return A direct proxy containing the last known adapter
* endpoints if the adapter is already active.
*
**/
["ami"] nonmutating Object* getDirectProxy()
throws AdapterNotActiveException;
/**
*
* Set the direct proxy for this adapter.
*
* @param The direct proxy. The direct proxy should be created
* with the object adapter and should contain the object adapter
* endpoints.
*
* @throws AdapterActiveException The adapter is already
* active. It's not possible to override the direct proxy of an
* active adapter.
*
**/
["ami"] void setDirectProxy(Object* proxy)
throws AdapterActiveException;
/**
*
* Destroy the adapter.
*
**/
void destroy();
};
/**
*
* This exception is raised if an adapter with the same name already
* exists.
*
**/
exception AdapterExistsException
{
};
/**
*
* The adapter registry interface.
*
**/
interface AdapterRegistry
{
/**
*
* Add an adapter to the registry.
*
**/
void add(string id, Adapter* adpt)
throws AdapterExistsException;
/**
*
* Remove an adapter from the registry. If the given adapter proxy is not null, the adapter will
* be removed from the registry only if the proxy matches.
*
**/
Adapter* remove(string id, Adapter* adpt)
throws AdapterNotExistException;
/**
*
* Find an adapter and return its proxy.
*
**/
Adapter* findById(string id)
throws AdapterNotExistException;
/**
*
* Get all adapter ids.
*
**/
nonmutating Ice::StringSeq getAll();
};
/**
*
* A standalone adapter doesn't provide on demand activation. It just
* store the adapter endpoints in the proxy attribute.
*
**/
class StandaloneAdapter implements Adapter
{
/**
*
* The adapter direct proxy.
*
**/
Object* proxy;
};
class Server;
/**
*
* This class implements the [Adapter] interface and provides on
* demand server activation when the adapter endpoints are requested
* through the [getDirectProxy] method.
*
**/
class ServerAdapter implements Adapter
{
/**
*
* Returns the adaper id.
*
**/
string getId();
/**
*
* The adapter server.
*
**/
Server* svr;
/**
*
* The adapter id.
*
**/
string id;
};
/**
*
* A sequence of server adapter proxies.
*
**/
dictionary<Ice::Identity, ServerAdapter*> ServerAdapterPrxDict;
class Server
{
/**
*
* Start the server.
*
* @param mode The activation mode requested, start returns false
* if the activation mode requested is not compatible with the
* server activation mode. For example if mode is Automatic and
* the server activation mode is Manual the start will return
* false.
*
* @return True if the server was successfully started, false
* otherwise.
*
**/
bool start(ServerActivation mode);
/**
*
* Stop the server. This methods returns only when the server is
* deactivated. If the server doesn't stop after a configurable
* amount of time, it will be killed.
*
**/
void stop();
/**
*
* Send signal to the server
*
**/
void sendSignal(string signal)
throws BadSignalException;
/**
*
* Write message on servers' stdout or stderr.
*
**/
void writeMessage(string message, int fd);
/**
*
* Destroy the server. This method destroys the server and
* eventually deactivates if it's still active.
*
**/
void destroy();
/**
*
* This method is called by the activator when it detects that the
* server has terminated.
*
**/
void terminated();
/**
*
* Return the server state.
*
* @return The server state.
*
* @see ServerState
*
**/
ServerState getState();
/**
*
* Get the server pid. Note that the value returned by this method
* is system dependant. On Unix operating systems, it's the pid
* value returned by the fork() system call and converted to an
* integer.
*
**/
int getPid();
/**
*
* Get the descriptor used to deploy this server.
*
**/
ServerDescriptor getDescriptor();
/**
*
* Set the server activation mode.
*
**/
void setActivationMode(ServerActivation mode);
/**
*
* Get the server activation mode.
*
**/
ServerActivation getActivationMode();
/**
*
* Set the process proxy.
*
**/
["ami"] void setProcess(Ice::Process* proc);
/**
*
* Set the server executable path.
*
**/
void setExePath(string name);
/**
*
* Set the path of the server working directory.
*
**/
void setPwd(string path);
/**
*
* Set the server environment variables.
*
**/
void setEnvs(Ice::StringSeq envs);
/**
*
* Set the server command line options.
*
**/
void setOptions(Ice::StringSeq options);
/**
*
* Add an adapter to this server.
*
**/
void addAdapter(ServerAdapter* adapter, bool registerProcess)
throws DeploymentException;
/**
*
* Remove an adapter from this server.
*
**/
void removeAdapter(ServerAdapter* adapter);
/**
*
* Add a configuration file.
*
**/
string addConfigFile(string name, PropertyDescriptorSeq properties)
throws DeploymentException;
/**
*
* Remove a configuration file.
*
**/
void removeConfigFile(string name);
/**
*
* Add a database environment.
*
**/
string addDbEnv(DbEnvDescriptor dbEnv, string path)
throws DeploymentException;
/**
*
* Remove a database environment.
*
**/
void removeDbEnv(DbEnvDescriptor dbEnv, string path);
/** The server name. */
string name;
/** The path of the server executable. */
string exePath;
/** The server environment variables. */
Ice::StringSeq envs;
/** The server command line options. */
Ice::StringSeq options;
/** The path to the server working directory. */
string pwd;
/** The server adapter proxies. */
ServerAdapterPrxDict adapters;
/** The server activation mode. */
ServerActivation activation;
/** True if an adapter is configured to register a process object. */
bool processRegistered;
/** The descriptor used to deploy this server. */
ServerDescriptor descriptor;
};
/**
*
* This exception is raised if a server with the same name already
* exists.
*
**/
exception ServerExistsException
{
};
interface ServerRegistry
{
/**
*
* Add a server to the registry.
*
**/
void add(string name, Server* svr, ServerDescriptor descriptor)
throws ServerExistsException;
/**
*
* Remove a server from the registry.
*
**/
Server* remove(string name)
throws ServerNotExistException;
/**
*
* Find a server.
*
* @param name Name of the server.
*
* @return Server proxy.
*
**/
Server* findByName(string name)
throws ServerNotExistException;
/**
*
* Get a server descriptor.
*
**/
ServerDescriptor getDescriptor(string name)
throws ServerNotExistException;
/**
*
* Get all the server names.
*
**/
nonmutating Ice::StringSeq getAll();
/**
*
* Get all the server descriptors for servers deployed on the given node.
*
**/
nonmutating ServerDescriptorSeq getAllDescriptorsOnNode(string node);
};
/**
*
* This exception is raised if a server with the same name already
* exists.
*
**/
exception ApplicationExistsException
{
};
interface ApplicationRegistry
{
/**
*
* Add an application to the registry.
*
**/
void add(string name)
throws ApplicationExistsException;
/**
*
* Remove an application from the registry.
*
**/
void remove(string name)
throws ApplicationNotExistException;
/**
*
* Register a server with the given application.
*
**/
void registerServer(string application, string name)
throws ApplicationNotExistException;
/**
*
* Unregister a server from the given application.
*
**/
void unregisterServer(string application, string name)
throws ApplicationNotExistException;
/**
*
* Get an application descriptor.
*
**/
ApplicationDescriptor getDescriptor(string name)
throws ApplicationNotExistException;
/**
*
* Get all the application names.
*
**/
nonmutating Ice::StringSeq getAll();
};
interface Node
{
/**
*
* Create a new server on this node.
*
* @param The name of the server.
*
* @param The descriptor of the server.
*
**/
nonmutating Server* createServer(string name, ServerDescriptor desc)
throws DeploymentException;
/**
*
* Create a new adapter of a given server on this node.
*
* @param server The server associted to the adapter.
*
* @param id The id of the adapter.
*
**/
nonmutating ServerAdapter* createServerAdapter(Server* srv, string id);
/**
*
* Create a temporary directory.
*
**/
nonmutating string createTmpDir();
/**
*
* Destroy a temporary directory.
*
**/
nonmutating void destroyTmpDir(string path);
/**
*
* Get the node name.
*
**/
nonmutating string getName();
/**
*
* Get the node hostname.
*
**/
nonmutating string getHostname();
/**
*
* Shutdown the node.
*
**/
nonmutating void shutdown();
};
/**
*
* This exception is raised if a node is already registered and
* active.
*
**/
exception NodeActiveException
{
};
interface NodeRegistry
{
/**
*
* Add a node to the registry. If a node with the same name is
* already registered, [add] will overide the previous node only
* if it's not active.
*
* @throws NodeActiveException Raised if the node is already
* registered and currently active.
*
**/
void add(string name, Node* nd)
throws NodeActiveException;
/**
*
* Remove a node from the registry.
*
**/
void remove(string name)
throws NodeNotExistException;
/**
*
* Find a node.
*
* @param name Name of the node.
*
* @return Node proxy or a null proxy if the node is not found.
*
**/
Node* findByName(string name)
throws NodeNotExistException;
/**
*
* Get all the node names.
*
**/
nonmutating Ice::StringSeq getAll();
};
};
#endif
|