Qpid Management Framework  0.24
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
AgentSession.h
Go to the documentation of this file.
1 #ifndef QMF_AGENT_SESSION_H
2 #define QMF_AGENT_SESSION_H
3 /*
4  *
5  * Licensed to the Apache Software Foundation (ASF) under one
6  * or more contributor license agreements. See the NOTICE file
7  * distributed with this work for additional information
8  * regarding copyright ownership. The ASF licenses this file
9  * to you under the Apache License, Version 2.0 (the
10  * "License"); you may not use this file except in compliance
11  * with the License. You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing,
16  * software distributed under the License is distributed on an
17  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  * KIND, either express or implied. See the License for the
19  * specific language governing permissions and limitations
20  * under the License.
21  *
22  */
23 
24 #include <qmf/ImportExport.h>
25 #include "qmf/Handle.h"
26 #include "qpid/messaging/Duration.h"
27 #include "qpid/messaging/Connection.h"
28 #include "qpid/types/Variant.h"
29 #include <string>
30 
31 namespace qmf {
32 
33 #ifndef SWIG
34  template <class> class PrivateImplRef;
35 #endif
36 
37  class AgentSessionImpl;
38  class AgentEvent;
39  class Schema;
40  class Data;
41  class DataAddr;
42 
43  class QMF_CLASS_EXTERN AgentSession : public qmf::Handle<AgentSessionImpl> {
44  public:
45  QMF_EXTERN AgentSession(AgentSessionImpl* impl = 0);
46  QMF_EXTERN AgentSession(const AgentSession&);
47  QMF_EXTERN AgentSession& operator=(const AgentSession&);
48  QMF_EXTERN ~AgentSession();
49 
80  QMF_EXTERN AgentSession(qpid::messaging::Connection& conn, const std::string& options="");
81 
87  QMF_EXTERN void setDomain(const std::string& domain);
88 
96  QMF_EXTERN void setVendor(const std::string& vendor);
97  QMF_EXTERN void setProduct(const std::string& product);
98  QMF_EXTERN void setInstance(const std::string& instance);
99 
105  QMF_EXTERN void setAttribute(const std::string& key, const qpid::types::Variant& value);
106 
110  QMF_EXTERN const std::string& getName() const;
111 
116  QMF_EXTERN void open();
117 
121  QMF_EXTERN void close();
122 
129  QMF_EXTERN bool nextEvent(AgentEvent& outEvent, qpid::messaging::Duration timeout=qpid::messaging::Duration::FOREVER);
130 
134  QMF_EXTERN int pendingEvents() const;
135 
139  QMF_EXTERN void registerSchema(Schema& schema);
140 
152  QMF_EXTERN DataAddr addData(Data& data, const std::string& name="", bool persistent=false);
153 
157  QMF_EXTERN void delData(const DataAddr& dataAddr);
158 
169  QMF_EXTERN void authAccept(AgentEvent& event);
170  QMF_EXTERN void authReject(AgentEvent& event, const std::string& diag="");
171  QMF_EXTERN void raiseException(AgentEvent& event, const std::string& errorText);
172  QMF_EXTERN void raiseException(AgentEvent& event, const Data& errorData);
173  QMF_EXTERN void response(AgentEvent& event, const Data& responseData);
174  QMF_EXTERN void complete(AgentEvent& event);
175  QMF_EXTERN void methodSuccess(AgentEvent& event);
176 
185  QMF_EXTERN void raiseEvent(const Data& data);
186  QMF_EXTERN void raiseEvent(const Data& data, int severity);
187 
188 #ifndef SWIG
189  private:
190  friend class qmf::PrivateImplRef<AgentSession>;
191  friend struct AgentSessionImplAccess;
192 #endif
193  };
194 
195 }
196 
197 #endif