qmf/engine/Agent.h Source File

Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

qmf/engine/Agent.h
Go to the documentation of this file.

    00001 #ifndef _QmfEngineAgent_
    00002 #define _QmfEngineAgent_
    00003
    00004 /*
    00005  * Licensed to the Apache Software Foundation (ASF) under one
    00006  * or more contributor license agreements.  See the NOTICE file
    00007  * distributed with this work for additional information
    00008  * regarding copyright ownership.  The ASF licenses this file
    00009  * to you under the Apache License, Version 2.0 (the
    00010  * "License"); you may not use this file except in compliance
    00011  * with the License.  You may obtain a copy of the License at
    00012  *
    00013  *   http://www.apache.org/licenses/LICENSE-2.0
    00014  *
    00015  * Unless required by applicable law or agreed to in writing,
    00016  * software distributed under the License is distributed on an
    00017  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    00018  * KIND, either express or implied.  See the License for the
    00019  * specific language governing permissions and limitations
    00020  * under the License.
    00021  */
    00022
    00023 #include <qmf/engine/Schema.h>
    00024 #include <qmf/engine/ObjectId.h>
    00025 #include <qmf/engine/Object.h>
    00026 #include <qmf/engine/Event.h>
    00027 #include <qmf/engine/Query.h>
    00028 #include <qmf/engine/Value.h>
    00029 #include <qmf/engine/Message.h>
    00030
    00031 namespace qmf {
    00032 namespace engine {
    00033
    00040     struct AgentEvent {
    00041         enum EventKind {
    00042             GET_QUERY      = 1,
    00043             START_SYNC     = 2,
    00044             END_SYNC       = 3,
    00045             METHOD_CALL    = 4,
    00046             DECLARE_QUEUE  = 5,
    00047             DELETE_QUEUE   = 6,
    00048             BIND           = 7,
    00049             UNBIND         = 8,
    00050             SETUP_COMPLETE = 9
    00051         };
    00052
    00053         EventKind    kind;
    00054         uint32_t     sequence;    // Protocol sequence (for all kinds)
    00055         char*        authUserId;  // Authenticated user ID (for all kinds)
    00056         char*        authToken;   // Authentication token if issued (for all kinds)
    00057         char*        name;        // Name of the method/sync query
    00058                                   //    (METHOD_CALL, START_SYNC, END_SYNC, DECLARE_QUEUE, BIND, UNBIND)
    00059         Object*      object;      // Object involved in method call (METHOD_CALL)
    00060         ObjectId*    objectId;    // ObjectId for method call (METHOD_CALL)
    00061         Query*       query;       // Query parameters (GET_QUERY, START_SYNC)
    00062         Value*       arguments;   // Method parameters (METHOD_CALL)
    00063         char*        exchange;    // Exchange for bind (BIND, UNBIND)
    00064         char*        bindingKey;  // Key for bind (BIND, UNBIND)
    00065         const SchemaObjectClass* objectClass; // (METHOD_CALL)
    00066     };
    00067
    00068     class AgentImpl;
    00069
    00073     class Agent {
    00074     public:
    00075         Agent(char* label, bool internalStore=true);
    00076         ~Agent();
    00077
    00084         void setStoreDir(const char* path);
    00085
    00092         void setTransferDir(const char* path);
    00093
    00098         void handleRcvMessage(Message& message);
    00099
    00105         bool getXmtMessage(Message& item) const;
    00106
    00110         void popXmt();
    00111
    00117         bool getEvent(AgentEvent& event) const;
    00118
    00122         void popEvent();
    00123
    00127         void newSession();
    00128
    00133         void startProtocol();
    00134
    00138         void heartbeat();
    00139
    00147         void methodResponse(uint32_t sequence, uint32_t status, char* text, const Value& arguments);
    00148
    00158         void queryResponse(uint32_t sequence, Object& object, bool prop = true, bool stat = true);
    00159
    00164         void queryComplete(uint32_t sequence);
    00165
    00170         void registerClass(SchemaObjectClass* cls);
    00171
    00176         void registerClass(SchemaEventClass* cls);
    00177
    00185         const ObjectId* addObject(Object& obj, uint64_t persistId);
    00186         //        const ObjectId* addObject(Object& obj, uint32_t persistIdLo, uint32_t persistIdHi);
    00187
    00193         const ObjectId* allocObjectId(uint64_t persistId);
    00194         const ObjectId* allocObjectId(uint32_t persistIdLo, uint32_t persistIdHi);
    00195
    00200         void raiseEvent(Event& event);
    00201
    00202     private:
    00203         AgentImpl* impl;
    00204     };
    00205 }
    00206 }
    00207
    00208 #endif
    00209