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