00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #if !defined(_SPECS_H_)
00028 #define _SPECS_H_
00029
00030 #include "DotString.h"
00031 #include "Parameter.h"
00032 #include "Collection.h"
00033 #include "ObjectCollection.h"
00034 #include "Dictionary.h"
00035 #include "ObjectDictionary.h"
00036 #include "XMLParser.h"
00037 #include "TCPLocation.h"
00038 #include "NetworkConnection.h"
00039
00040 namespace cmlabs {
00041
00042 class TriggerSpec : public Object {
00043 public:
00044 TriggerSpec();
00045 TriggerSpec(const JString& xml, JString globalFrom = "");
00046 TriggerSpec(XMLNode* node, JString globalFrom = "");
00047 ~TriggerSpec();
00048 Object* clone() const;
00049 bool fromXML(const JString& xml);
00050 bool fromXML(XMLNode* node);
00051 JString toXML();
00052 JString print();
00053 JString toHTML();
00054
00055 virtual unsigned long getPayloadSize() const;
00056
00057
00058
00059 JString alias;
00060 JString from;
00061 DotString type;
00062 int delayMS;
00063 };
00064
00065 class RetrieveSpec : public Object {
00066 public:
00067 RetrieveSpec();
00068 RetrieveSpec(const JString& xml, JString globalFrom = "");
00069 RetrieveSpec(XMLNode* node, JString globalFrom = "");
00070 ~RetrieveSpec();
00071 Object* clone() const;
00072 bool fromXML(const JString& xml);
00073 bool fromXML(XMLNode* node);
00074 JString toXML();
00075 JString print();
00076 JString toHTML();
00077
00078 virtual unsigned long getPayloadSize() const;
00079
00080 static ObjectCollection* fromRetrievesXML(const JString& xml);
00081 static ObjectCollection* fromRetrievesXML(XMLNode* node);
00082
00083 JString from;
00084 JString sender;
00085 JString id;
00086 DotString type;
00087 JString content;
00088 JString contentmatch;
00089 DotString beforeContext;
00090 DotString duringContext;
00091 DotString afterContext;
00092
00093 JTime afterTime;
00094 JTime untilTime;
00095
00096 int maxCount;
00097 int minCount;
00098 int latest;
00099 int lastMS;
00100 };
00101
00102 class CrankSpec : public Object {
00103 public:
00104 CrankSpec();
00105 CrankSpec(const JString& xml);
00106 CrankSpec(XMLNode* node);
00107 ~CrankSpec();
00108 Object* clone() const;
00109 bool fromXML(const JString& xml);
00110 bool fromXML(XMLNode* node);
00111 JString toXML();
00112 JString print();
00113 JString toHTML();
00114
00115 virtual unsigned long getPayloadSize() const;
00116
00117 bool continuous;
00118 JString name;
00119
00120 };
00121
00122 class PostSpec : public Object {
00123 public:
00124 PostSpec();
00125 PostSpec(const JString& xml, JString globalTo = "");
00126 PostSpec(XMLNode* node, JString globalTo = "");
00127 ~PostSpec();
00128 Object* clone() const;
00129 bool fromXML(const JString& xml);
00130 bool fromXML(XMLNode* node);
00131 JString toXML();
00132 JString print();
00133 JString toHTML();
00134
00135 virtual unsigned long getPayloadSize() const;
00136
00137
00138
00139
00140
00141
00142 long getBinarySize(int chunk);
00143
00144 int getBinaryChunkCount();
00145
00146 long toBinaryBuffer(int chunk, char* buffer, int maxlen);
00147
00148 bool fromBinaryBuffer(int chunk, char* buffer, long len);
00149
00150 JString alias;
00151 JString from;
00152 JString to;
00153 JString cc;
00154 JString phasechange;
00155 DotString type;
00156 JString content;
00157 JString language;
00158 double priority;
00159 bool useInReplyTo;
00160 bool noreply;
00161 Object* object;
00162 };
00163
00164 class PhaseSpec : public Object {
00165 public:
00166 PhaseSpec();
00167 PhaseSpec(const JString& xml);
00168 PhaseSpec(XMLNode* node);
00169 ~PhaseSpec();
00170
00171 virtual unsigned long getPayloadSize() const;
00172
00173 Object* clone() const;
00174 bool fromXML(const JString& xml);
00175 bool fromXML(XMLNode* node);
00176 JString toXML();
00177 JString toHTML();
00178 JString print();
00179 bool equals(const Object *o2);
00180 int compare(const Object *o2);
00181 bool isNewerThan(const PhaseSpec* spec);
00182 bool isOlderThan(const PhaseSpec* spec);
00183
00184 JTime activationTime;
00185 JString name;
00186 JString pid;
00187 JString moduleName;
00188 JString context;
00189 bool allowSelfTriggering;
00190 JString lastTriggerName;
00191 ObjectDictionary* currentContexts;
00192 double priority;
00193
00194
00195
00196
00197
00198
00199 long getBinarySize(int chunk);
00200
00201 int getBinaryChunkCount();
00202
00203 long toBinaryBuffer(int chunk, char* buffer, int maxlen);
00204
00205 bool fromBinaryBuffer(int chunk, char* buffer, long len);
00206
00207
00208 ObjectCollection* triggers;
00209
00210
00211
00212
00213
00214 ObjectCollection* retrieves;
00215
00216
00217 ObjectCollection* cranks;
00218
00219
00220 ObjectCollection* posts;
00221
00222
00223 ObjectCollection* streams;
00224
00225 bool containsGlobalTrigger();
00226 };
00227
00228 class ContextSpec : public Object {
00229 public:
00230 ContextSpec();
00231 ContextSpec(const JString& xml);
00232 ContextSpec(XMLNode* node);
00233 ~ContextSpec();
00234
00235 virtual unsigned long getPayloadSize() const;
00236
00237 Object* clone() const;
00238 bool fromXML(const JString& xml);
00239 bool fromXML(XMLNode* node);
00240 JString toXML();
00241 JString toHTML();
00242
00243 bool reset();
00244 bool setCurrentContexts(ObjectDictionary* newContexts);
00245 bool isActive();
00246 ObjectCollection* getActivePhases();
00247 ObjectCollection* getAllPhases();
00248 bool switchPhase();
00249 bool calcCurrentPhases();
00250
00251
00252
00253
00254
00255
00256 long getBinarySize(int chunk);
00257
00258 int getBinaryChunkCount();
00259
00260 long toBinaryBuffer(int chunk, char* buffer, int maxlen);
00261
00262 bool fromBinaryBuffer(int chunk, char* buffer, long len);
00263
00264 JString name;
00265 JString moduleName;
00266 int currentPhaseNum;
00267 PhaseSpec* currentPhase;
00268 ObjectCollection* currentActivePhases;
00269 DotString ownContext;
00270 double priority;
00271 bool allowSelfTriggering;
00272
00273 bool wasActive;
00274
00275 ObjectCollection* phases;
00276
00277 ObjectDictionary* currentContexts;
00278 };
00279
00280
00281 class ExecutableSpec;
00282 class ModuleSpec : public Object {
00283 public:
00284 ModuleSpec();
00285 ModuleSpec(const JString& xml);
00286 ModuleSpec(XMLNode* node);
00287 ~ModuleSpec();
00288
00289 virtual unsigned long getPayloadSize() const;
00290
00291 Object* clone() const;
00292 bool fromXML(const JString& xml);
00293 bool fromXML(XMLNode* node);
00294 JString toXML();
00295 JString toHTML();
00296 JString toHTMLCurrent();
00297
00298 bool switchPhase();
00299 bool setCurrentContexts(ObjectDictionary* newContexts);
00300
00301 bool isCurrentlyTriggeredBy(JString wb, JString type);
00302 bool hasCranks();
00303
00304 ObjectCollection* getTriggersFor(JString wb, JString type);
00305 ObjectCollection* getActiveContexts();
00306 PhaseSpec* getFirstActivePhase();
00307 ObjectCollection* getActivePhases();
00308 ObjectCollection* getAllPhases();
00309
00310 Collection getReferredWhiteboards();
00311 Collection getReferredStreams();
00312
00313 Collection getContextNames();
00314
00315 bool resetCache();
00316
00317
00318
00319
00320
00321
00322 long getBinarySize(int chunk);
00323
00324 int getBinaryChunkCount();
00325
00326 long toBinaryBuffer(int chunk, char* buffer, int maxlen);
00327
00328 bool fromBinaryBuffer(int chunk, char* buffer, long len);
00329
00330
00331 ObjectDictionary* contexts;
00332
00333 JString moduleName;
00334 JString description;
00335 JString type;
00336 JString remote;
00337 JString share;
00338 JString configXML;
00339 double priority;
00340 bool allowSelfTriggering;
00341 JString plugFunction;
00342 int verbose;
00343 JString recordStorage;
00344 bool recordOverwrite;
00345
00346
00347
00348 ObjectDictionary* getTriggersCache;
00349
00350 JString currentContextsCacheString;
00351
00352
00353 ObjectDictionary* currentContexts;
00354 ObjectDictionary* parameters;
00355
00356 ExecutableSpec* exec;
00357 };
00358
00359
00360 class WhiteboardSpec : public Object {
00361 public:
00362 WhiteboardSpec();
00363 WhiteboardSpec(const JString& xml);
00364 WhiteboardSpec(XMLNode* node);
00365 ~WhiteboardSpec();
00366
00367 virtual unsigned long getPayloadSize() const;
00368
00369 Object* clone() const;
00370 bool fromXML(const JString& xml);
00371 bool fromXML(XMLNode* node);
00372 JString toXML();
00373 JString toHTML();
00374
00375 Collection getStreamNames();
00376
00377
00378 ObjectDictionary* streamSpecs;
00379
00380
00381 ObjectDictionary* catalogSpecs;
00382
00383 JString whiteboardName;
00384 JString description;
00385
00386 ObjectDictionary* parameters;
00387 JString remote;
00388 double priority;
00389 bool useLocalSystemInfo;
00390 };
00391
00392 class StreamSpec : public Object {
00393 public:
00394 StreamSpec();
00395 StreamSpec(const JString& xml);
00396 StreamSpec(XMLNode* node);
00397 ~StreamSpec();
00398
00399 virtual unsigned long getPayloadSize() const;
00400
00401 Object* clone() const;
00402 bool fromXML(const JString& xml);
00403 bool fromXML(XMLNode* node);
00404 JString toXML();
00405 JString toHTML();
00406
00407 JString streamName;
00408 JString description;
00409 long maxSize;
00410 long maxCount;
00411 long maxBackupCount;
00412 JString parent;
00413 JString remote;
00414 bool allowMultipleWriters;
00415 };
00416
00417 class StreamAccess : public Object {
00418 public:
00419 StreamAccess();
00420 StreamAccess(const JString& xml);
00421 StreamAccess(XMLNode* node);
00422 ~StreamAccess();
00423
00424 virtual unsigned long getPayloadSize() const;
00425
00426 Object* clone() const;
00427 bool fromXML(const JString& xml);
00428 bool fromXML(XMLNode* node);
00429 JString toXML();
00430 JString toHTML();
00431
00432 JString alias;
00433 JString source;
00434 JString mode;
00435 };
00436
00437
00438 class CatalogSpec : public Object {
00439 public:
00440 CatalogSpec();
00441 CatalogSpec(const JString& xml);
00442 CatalogSpec(XMLNode* node);
00443 ~CatalogSpec();
00444
00445 virtual unsigned long getPayloadSize() const;
00446
00447 Object* clone() const;
00448 bool fromXML(const JString& xml);
00449 bool fromXML(XMLNode* node);
00450 JString toXML();
00451 JString toHTML();
00452
00453 JString name;
00454 JString remote;
00455 JString description;
00456 JString parent;
00457 JString queryhandler;
00458 JString plug;
00459 ObjectDictionary parameters;
00460 };
00461
00462 class ExecutableSpec : public Object {
00463 public:
00464 ExecutableSpec();
00465 ExecutableSpec(const JString& xml);
00466 ExecutableSpec(XMLNode* node);
00467 ~ExecutableSpec();
00468
00469 virtual unsigned long getPayloadSize() const;
00470
00471 Object* clone() const;
00472 bool fromXML(const JString& xml);
00473 bool fromXML(XMLNode* node);
00474 JString toXML();
00475 JString toHTML();
00476
00477 JString getMatchingCommandLine();
00478 JString getMatchingCommandLine(SysInfo* sysInfo);
00479
00480 JString name;
00481 JString startupDir;
00482 ObjectDictionary sysSpecs;
00483 Dictionary commandLines;
00484 bool consoleOutput;
00485 bool autoRestart;
00486 };
00487
00488 class SatelliteSpec : public Object {
00489 public:
00490 SatelliteSpec();
00491 SatelliteSpec(const JString& xml);
00492 SatelliteSpec(XMLNode* node);
00493 ~SatelliteSpec();
00494
00495 virtual unsigned long getPayloadSize() const;
00496
00497 Object* clone() const;
00498 bool fromXML(const JString& xml);
00499 bool fromXML(XMLNode* node);
00500 JString toXML();
00501 JString toHTML();
00502
00503 TCPLocation getTCPLocation();
00504
00505 JString name;
00506 JString host;
00507 int port;
00508 };
00509
00510
00511 class ActionSpec : public Object {
00512 public:
00513 ActionSpec();
00514 ActionSpec(JString name, JString act, JString value, JString target = "", Object* obj = NULL, JString content = "");
00515 ActionSpec(const JString& xml);
00516 ActionSpec(XMLNode* node);
00517 ~ActionSpec();
00518
00519 virtual unsigned long getPayloadSize() const;
00520
00521 Object* clone() const;
00522 bool fromXML(const JString& xml);
00523 bool fromXML(XMLNode* node);
00524 JString toXML();
00525 JString toHTML();
00526 bool setParameter(JString name, JString value);
00527 JString getParameter(JString name);
00528
00529
00530
00531
00532
00533
00534 long getBinarySize(int chunk);
00535
00536 int getBinaryChunkCount();
00537
00538 long toBinaryBuffer(int chunk, char* buffer, int maxlen);
00539
00540 bool fromBinaryBuffer(int chunk, char* buffer, long len);
00541
00542 JString name;
00543 int delay;
00544 JString state;
00545 JString target;
00546 JString act;
00547 JString value;
00548 JString content;
00549 Object* object;
00550 Object* answer;
00551 Dictionary params;
00552 };
00553
00554 class ActionPerformer : public Object {
00555 public:
00556 virtual bool performAction(ActionSpec* action) = 0;
00557 virtual bool performAction(JString name, JString act, JString content = "", JString target = "", Object* object = NULL, JString value = "") = 0;
00558 virtual bool performActions(ObjectCollection* actions) = 0;
00559 };
00560
00561 class ClientProfile : public Object {
00562 public:
00563 ClientProfile();
00564 ClientProfile(const JString& xml);
00565 ClientProfile(XMLNode* node);
00566 ~ClientProfile();
00567
00568 virtual unsigned long getPayloadSize() const;
00569
00570 Object* clone() const;
00571 bool equals(const Object* otherProfile) const;
00572 bool fromXML(const JString& xml);
00573 bool fromXML(XMLNode* node);
00574 JString toXML();
00575 JString toHTML();
00576 JString print();
00577
00578 JString getCapability(const JString& category, const JString& capability);
00579 bool setCapability(const JString& category, const JString& capability, const JString& value);
00580 bool hasCapability(const JString& category, const JString& capability);
00581
00582 JString name;
00583 ObjectDictionary capabilities;
00584 ConnectionProfile connectionProfile;
00585 JString thisConvID;
00586 JString lastConvID;
00587 };
00588
00589
00590 class ServiceSpec : public Object {
00591 public:
00592 ServiceSpec();
00593 ServiceSpec(const JString& xml);
00594 ServiceSpec(XMLNode* node);
00595 ~ServiceSpec();
00596
00597 virtual unsigned long getPayloadSize() const;
00598
00599 Object* clone() const;
00600 bool fromXML(const JString& xml);
00601 bool fromXML(XMLNode* node);
00602 JString toXML();
00603 JString toHTML();
00604
00605
00606
00607
00608
00609
00610 long getBinarySize(int chunk);
00611
00612 int getBinaryChunkCount();
00613
00614 long toBinaryBuffer(int chunk, char* buffer, int maxlen);
00615
00616 bool fromBinaryBuffer(int chunk, char* buffer, long len);
00617
00618 JString name;
00619 JString service;
00620 JString type;
00621 JString remote;
00622 int maxConv;
00623 int timeout;
00624 double priority;
00625 JString provider;
00626
00627 TCPLocation location;
00628
00629
00630 ModuleSpec* moduleSpec;
00631 };
00632
00633 }
00634
00635
00636 #endif // _SPECS_H_