00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _XmlExchange_
00022 #define _XmlExchange_
00023
00024 #include "Exchange.h"
00025 #include "qpid/framing/FieldTable.h"
00026 #include "qpid/sys/Monitor.h"
00027 #include "Queue.h"
00028
00029 #include <xqilla/xqilla-simple.hpp>
00030
00031 #include <boost/scoped_ptr.hpp>
00032
00033 #include <map>
00034 #include <vector>
00035
00036 namespace qpid {
00037 namespace broker {
00038
00039 class XmlExchange : public virtual Exchange {
00040
00041 typedef boost::shared_ptr<XQQuery> Query;
00042
00043 struct XmlBinding : public Exchange::Binding {
00044 typedef boost::shared_ptr<XmlBinding> shared_ptr;
00045 typedef std::vector<XmlBinding::shared_ptr> vector;
00046
00047 boost::shared_ptr<XQQuery> xquery;
00048
00049 XmlBinding(const std::string& key, const Queue::shared_ptr queue, Exchange* parent, Query query):
00050 Binding(key, queue, parent), xquery(query) {}
00051 };
00052
00053
00054 typedef std::map<string, XmlBinding::vector > XmlBindingsMap;
00055
00056 XmlBindingsMap bindingsMap;
00057 XQilla xqilla;
00058 qpid::sys::RWlock lock;
00059
00060 bool matches(Query& query, Deliverable& msg, const qpid::framing::FieldTable* args);
00061
00062 public:
00063 static const std::string typeName;
00064
00065 XmlExchange(const std::string& name, management::Manageable* parent = 0);
00066 XmlExchange(const string& _name, bool _durable,
00067 const qpid::framing::FieldTable& _args, management::Manageable* parent = 0);
00068
00069 virtual std::string getType() const { return typeName; }
00070
00071 virtual bool bind(Queue::shared_ptr queue, const std::string& routingKey, const qpid::framing::FieldTable* args);
00072
00073 virtual bool unbind(Queue::shared_ptr queue, const std::string& routingKey, const qpid::framing::FieldTable* args);
00074
00075 virtual void route(Deliverable& msg, const std::string& routingKey, const qpid::framing::FieldTable* args);
00076
00077 virtual bool isBound(Queue::shared_ptr queue, const string* const routingKey, const qpid::framing::FieldTable* const args);
00078
00079 virtual ~XmlExchange();
00080 };
00081
00082
00083 }
00084 }
00085
00086
00087 #endif