00001 #ifndef _QmfAgent_
00002 #define _QmfAgent_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "qmf/QmfImportExport.h"
00024
00025 namespace qmf {
00026
00027 class AgentImpl;
00028 class Connection;
00029 class ObjectId;
00030 class AgentObject;
00031 class Value;
00032 class Event;
00033 class SchemaObjectClass;
00034
00041 class AgentListener {
00042 QMF_EXTERN virtual ~AgentListener();
00043
00052 virtual bool allowQuery(const Query& q, const char* userId);
00053
00065 virtual bool allowMethod(const char* name, const Value& args, const ObjectId& oid,
00066 const SchemaObjectClass& cls, const char* userId);
00067
00081 virtual void query(uint32_t context, const Query& q, const char* userId);
00082
00099 virtual void syncStart(uint32_t context, const Query& q, const char* userId);
00100
00112 virtual void syncTouch(uint32_t context, const char* userId);
00113
00124 virtual void syncStop(uint32_t context, const char* userId);
00125
00141 virtual void methodCall(uint32_t context, const char* name, Value& args,
00142 const ObjectId& oid, const SchemaObjectClass& cls, const char* userId);
00143 };
00144
00151 class Agent {
00152 public:
00171 QMF_EXTERN Agent(char* label="qmfa", bool internalStore=true, AgentListener* listener=0);
00172
00176 QMF_EXTERN ~Agent();
00177
00185 QMF_EXTERN void setStoreDir(const char* path);
00186
00192 QMF_EXTERN void setConnection(Connection* conn);
00193
00201 QMF_EXTERN void registerClass(SchemaObjectClass* cls);
00202 QMF_EXTERN void registerClass(SchemaEventClass* cls);
00203
00218 QMF_EXTERN const ObjectId* addObject(AgentObject& obj, bool persistent=false, uint64_t oid=0);
00219 QMF_EXTERN const ObjectId* addObject(AgentObject& obj, bool persistent, uint32_t oidLo, uint32_t oidHi);
00220
00233 QMF_EXTERN const ObjectId* allocObjectId(bool persistent=false, uint64_t oid=0);
00234 QMF_EXTERN const ObjectId* allocObjectId(bool persistent, uint32_t oidLo, uint32_t oidHi);
00235
00241 QMF_EXTERN void raiseEvent(Event& event);
00242
00254 QMF_EXTERN void queryResponse(uint32_t context, AgentObject& object, bool prop = true, bool stat = true);
00255
00261 QMF_EXTERN void queryComplete(uint32_t context);
00262
00278 QMF_EXTERN void methodResponse(uint32_t context, const Value& args, uint32_t status=0,
00279 const Value* exception=0);
00280
00281 private:
00282 AgentImpl* impl;
00283 };
00284
00285 }
00286
00287 #endif