diff --git a/nativeLib/build.native/build-notification.sh b/nativeLib/build.native/build-notification.sh new file mode 100644 index 0000000000..4e808cc4c0 --- /dev/null +++ b/nativeLib/build.native/build-notification.sh @@ -0,0 +1,190 @@ +#!/bin/bash + +# Constants: +__ECLIPSE_="eclipse" +__NO_SPLASH_="-nosplash" +__APPLICATION_="-application" +__CDT_HEADLESS_="org.eclipse.cdt.managedbuilder.core.headlessbuild" +__IMPORT_="-import" +__DATA_="-data" +__BUILD_="-build" +__BUILD_CONFIG_32_="Build x86" +__BUILD_CONFIG_64_="Build x86_64" + +BUILD_CONFIGURATION= +FOSS_LIB_DIR="lib" +# determine which configuration to build +_arch=`uname -i` +if [ "${_arch}" = "x86_64" ]; then + BUILD_CONFIGURATION=${__BUILD_CONFIG_64_} + FOSS_LIB_DIR="lib64" +else + BUILD_CONFIGURATION=${__BUILD_CONFIG_32_} +fi + +# Arguments: +# 1) the workspace +# 2) the uframe-eclipse +# 3) the build root (will become the location of the temporary workspace) + +# ensure that there are at least three arguments +if [ $# -ne 3 ]; then + echo "Usage: $0 WORKSPACE UFRAME_ECLIPSE BUILD_ROOT" + exit 0 +fi + +WORKSPACE=${1} +UFRAME_ECLIPSE=${2} +BUILD_ROOT=${3} + +# ensure that the workspace directory exists +if [ ! -d ${WORKSPACE} ]; then + echo "ERROR: the specified workspace does not exist - ${WORKSPACE}" + exit 1 +fi +# ensure that Eclipse is present +if [ ! -f ${UFRAME_ECLIPSE}/${__ECLIPSE_} ]; then + echo "ERROR: the Eclipse executable does not exist at the specified location - ${UFRAME_ECLIPSE}" + exit 1 +fi +# ensure that the build root exists +if [ ! -d ${BUILD_ROOT} ]; then + echo "ERROR: the specified build root does not exist - ${BUILD_ROOT}" + exit 1 +fi +if [ -d ${BUILD_ROOT}/workspace_ ]; then + rm -rf ${BUILD_ROOT}/workspace_ + if [ $? -ne 0 ]; then + echo "ERROR: unable to remove the existing temporary workspace in the specified build root - ${BUILD_ROOT}" + exit 1 + fi +fi +mkdir ${BUILD_ROOT}/workspace_ +if [ $? -ne 0 ]; then + echo "ERROR: unable to create a temporary workspace in the specified build root - ${BUILD_ROOT}" + exit 1 +fi + +PROJECTS_TO_IMPORT=( "org.apache.thrift" "org.apache.qpid" ) +PROJECTS_TO_BUILD=( "edex_com" "edex_notify" ) + +for project in ${PROJECTS_TO_IMPORT[*]}; +do + if [ ! -d ${WORKSPACE}/${project} ]; then + echo "ERROR: required project ${project} is not available in the specified workspace." + exit 1 + fi + + # copy the project to the workspace; we do not want to disturb the original + cp -r ${WORKSPACE}/${project} ${BUILD_ROOT}/workspace_ + if [ $? -ne 0 ]; then + echo "ERROR: Failed to copy project ${project} to the temporary workspace." + exit 1 + fi + + # import the project into the workspace + ${UFRAME_ECLIPSE}/${__ECLIPSE_} ${__NO_SPLASH_} ${__APPLICATION_} \ + ${__CDT_HEADLESS_} ${__IMPORT_} ${BUILD_ROOT}/workspace_/${project} \ + ${__DATA_} ${BUILD_ROOT}/workspace_ + if [ $? -ne 0 ]; then + echo "ERROR: failed to import ${project} into the temporary workspace." + exit 1 + fi +done + +for project in ${PROJECTS_TO_BUILD[*]}; +do + if [ ! -d ${WORKSPACE}/${project} ]; then + echo "ERROR: required project ${project} is not available in the specified workspace." + exit 1 + fi + + # copy the project to the workspace; we do not want to disturb the original + cp -r ${WORKSPACE}/${project} ${BUILD_ROOT}/workspace_ + if [ $? -ne 0 ]; then + echo "ERROR: Failed to copy project ${project} to the temporary workspace." + exit 1 + fi + + # import the project into the workspace and build the project + ${UFRAME_ECLIPSE}/${__ECLIPSE_} ${__NO_SPLASH_} ${__APPLICATION_} \ + ${__CDT_HEADLESS_} ${__IMPORT_} ${WORKSPACE}/${project} \ + ${__DATA_} ${BUILD_ROOT}/workspace_ ${__BUILD_} "${project}/${BUILD_CONFIGURATION}" + if [ $? -ne 0 ]; then + echo "ERROR: failed to build project ${project}" + exit 1 + fi +done + +# create the notification sub-directories +mkdir ${BUILD_ROOT}/awips2/notification/bin +if [ $? -ne 0 ]; then + echo "ERROR: Unable to create directory - ${BUILD_ROOT}/workspace_/notification/bin." + exit 1 +fi +mkdir ${BUILD_ROOT}/awips2/notification/lib +if [ $? -ne 0 ]; then + echo "ERROR: Unable to create directory - ${BUILD_ROOT}/workspace_/notification/lib." + exit 1 +fi +mkdir ${BUILD_ROOT}/awips2/notification/src +if [ $? -ne 0 ]; then + echo "ERROR: Unable to create directory - ${BUILD_ROOT}/workspace_/notification/src." + exit 1 +fi +mkdir ${BUILD_ROOT}/awips2/notification/include +if [ $? -ne 0 ]; then + echo "ERROR: Unable to create directory - ${BUILD_ROOT}/workspace_/notification/include." + exit 1 +fi + +# libedex_com.so -> notification/lib +cp -v "${BUILD_ROOT}/workspace_/edex_com/${BUILD_CONFIGURATION}/libedex_com.so" \ + ${BUILD_ROOT}/awips2/notification/lib +if [ $? -ne 0 ]; then + echo "ERROR: Failed to copy libedex_com.so to its destination." + exit 1 +fi +# edex_com src -> notification/src +cp -vf ${BUILD_ROOT}/workspace_/edex_com/src/*.cpp \ + ${BUILD_ROOT}/awips2/notification/src +if [ $? -ne 0 ]; then + echo "ERROR: Failed to copy the edex_com src to its destination." + exit 1 +fi +# edex_com headers -> notification/include +cp -vf ${BUILD_ROOT}/workspace_/edex_com/src/*.h ${BUILD_ROOT}/awips2/notification/include +if [ $? -ne 0 ]; then + echo "ERROR: Failed to copy the edex_com header to its destination." + exit 1 +fi +# edex_notify -> notification/bin +cp -vf "${BUILD_ROOT}/workspace_/edex_notify/${BUILD_CONFIGURATION}/edex_notify" \ + ${BUILD_ROOT}/awips2/notification/bin +if [ $? -ne 0 ]; then + echo "ERROR: Failed to copy edex_notify to its destination." + exit 1 +fi +# edex_notify src -> notification/src +cp -vf ${BUILD_ROOT}/workspace_/edex_notify/src/*.c \ + ${BUILD_ROOT}/awips2/notification/src +if [ $? -ne 0 ]; then + echo "ERROR: Failed to copy the edex_notify src to its destination." + exit 1 +fi +# org.apache.thrift lib -> notification/lib +cp -vPf ${BUILD_ROOT}/workspace_/org.apache.thrift/${FOSS_LIB_DIR}/* \ + ${BUILD_ROOT}/awips2/notification/lib +if [ $? -ne 0 ]; then + echo "ERROR: Failed to copy the org.apache.thrift lib to its destination." + exit 1 +fi +# org.apache.qpid lib -> notification/lib +cp -vPf ${BUILD_ROOT}/workspace_/org.apache.qpid/${FOSS_LIB_DIR}/* \ + ${BUILD_ROOT}/awips2/notification/lib +if [ $? -ne 0 ]; then + echo "ERROR: Failed to copy the org.apache.qpid lib to its destination." + exit 1 +fi + +exit 0 diff --git a/nativeLib/edex_com/.cproject b/nativeLib/edex_com/.cproject index c74c136ad4..f556204569 100644 --- a/nativeLib/edex_com/.cproject +++ b/nativeLib/edex_com/.cproject @@ -3,8 +3,8 @@ - - + + @@ -15,6 +15,7 @@ + @@ -28,36 +29,36 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nativeLib/edex_notify/.cproject b/nativeLib/edex_notify/.cproject index 53e44baf97..ce16672252 100644 --- a/nativeLib/edex_notify/.cproject +++ b/nativeLib/edex_notify/.cproject @@ -3,8 +3,8 @@ - - + + @@ -30,48 +30,383 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nativeLib/edex_notify/.project b/nativeLib/edex_notify/.project index 5eec75b346..f155f51c67 100644 --- a/nativeLib/edex_notify/.project +++ b/nativeLib/edex_notify/.project @@ -4,6 +4,7 @@ edex_com + org.apache.qpid diff --git a/nativeLib/edex_notify/.settings/org.eclipse.cdt.core.prefs b/nativeLib/edex_notify/.settings/org.eclipse.cdt.core.prefs index 4064af2ae4..a8df9bd375 100644 --- a/nativeLib/edex_notify/.settings/org.eclipse.cdt.core.prefs +++ b/nativeLib/edex_notify/.settings/org.eclipse.cdt.core.prefs @@ -1,9 +1,19 @@ -#Fri Mar 11 11:26:24 CST 2011 +#Tue Dec 11 12:30:30 CST 2012 eclipse.preferences.version=1 environment/project/cdt.managedbuild.config.gnu.exe.debug.944270981= environment/project/cdt.managedbuild.config.gnu.exe.debug.944270981/append=true environment/project/cdt.managedbuild.config.gnu.exe.debug.944270981/appendContributed=true environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902= +environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902.1102278084/LD_LIBRARY_PATH/delimiter=; +environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902.1102278084/LD_LIBRARY_PATH/operation=append +environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902.1102278084/LD_LIBRARY_PATH/value=/usr/local/ldm/dev/lib +environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902.1102278084/append=true +environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902.1102278084/appendContributed=true +environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902.1884634819/LD_LIBRARY_PATH/delimiter=; +environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902.1884634819/LD_LIBRARY_PATH/operation=append +environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902.1884634819/LD_LIBRARY_PATH/value=/usr/local/ldm/dev/lib +environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902.1884634819/append=true +environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902.1884634819/appendContributed=true environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902/LD_LIBRARY_PATH/delimiter=; environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902/LD_LIBRARY_PATH/operation=append environment/project/cdt.managedbuild.config.gnu.exe.release.1309755902/LD_LIBRARY_PATH/value=/usr/local/ldm/dev/lib diff --git a/nativeLib/edex_notify/src/edex_notify.c b/nativeLib/edex_notify/src/edex_notify.c index 0706a2147f..1c34b88625 100644 --- a/nativeLib/edex_notify/src/edex_notify.c +++ b/nativeLib/edex_notify/src/edex_notify.c @@ -44,10 +44,10 @@ int main(int argc, char *argv[]) { if (argc != 2) { - printf("Usage:\nedex_notify "); + printf("Usage: %s \n", argv[0]); return 1; } else { - printf("Connecting to %s", argv[1]); + printf("Connecting to %s\n", argv[1]); } CEdexNotification * cedex = NULL; cedex = get_notification_instance(argv[1]); diff --git a/nativeLib/org.apache.qpid/README b/nativeLib/org.apache.qpid/README new file mode 100644 index 0000000000..95a3f9becf --- /dev/null +++ b/nativeLib/org.apache.qpid/README @@ -0,0 +1,8 @@ +Version = 0.7.946106 + +Origin +------ +(extracted from the qpid source rpm - available from multiple sources) +qpid-cpp-mrg-0.7.946106-28.el5.centos.1.src.rpm + +also in the AWIPS II Baseline - rpms/awips2.qpid/SOURCES/qpid-cpp-mrg-0.7.946106.tar.gz diff --git a/nativeLib/org.apache.qpid/include/qpid/Address.h b/nativeLib/org.apache.qpid/include/qpid/Address.h index fe82b21b9e..57c9139f87 100644 --- a/nativeLib/org.apache.qpid/include/qpid/Address.h +++ b/nativeLib/org.apache.qpid/include/qpid/Address.h @@ -21,64 +21,34 @@ #include "qpid/sys/IntegerTypes.h" #include "qpid/CommonImportExport.h" -#include #include #include -#include namespace qpid { +namespace client { struct ConnectionSettings; } -/** TCP address of a broker - host:port */ -struct TcpAddress { - static const uint16_t DEFAULT_PORT=5672; - QPID_COMMON_EXTERN explicit TcpAddress(const std::string& host_=std::string(),uint16_t port_=DEFAULT_PORT); - std::string host; - uint16_t port; -}; -bool operator==(const TcpAddress& x, const TcpAddress& y); -QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& os, const TcpAddress& a); - -/**@internal Not a real address type, this is a placeholder to - * demonstrate and validate multi-protocol Urls for unit tests and - * developer education only. An example address holds just a char. - */ -struct ExampleAddress { - explicit ExampleAddress(char data); - char data; -}; -bool operator==(const ExampleAddress& x, const ExampleAddress& y); -std::ostream& operator<<(std::ostream& os, const ExampleAddress& a); /** - * Contains the address of an AMQP broker. Can any supported type of - * broker address. Currently only TcpAddress is supported. + * Contains the protocol address of an AMQP broker. */ struct Address { public: - Address(const Address& a) : value(a.value) {} - Address(const TcpAddress& tcp) : value(tcp) {} - Address(const ExampleAddress& eg) : value(eg) {} ///<@internal + static const std::string TCP; // Default TCP protocol tag. + static const uint16_t AMQP_PORT=5672; // Default AMQP port. + + QPID_COMMON_EXTERN explicit Address( + const std::string& protocol_=std::string(), + const std::string& host_=std::string(), + uint16_t port_=0 + ) : protocol(protocol_), host(host_), port(port_) {} - template Address& operator=(const AddressType& t) { value=t; return *this; } - - /** Get the address of type AddressType. - *@return AddressType* pointing to the contained address or 0 if - *contained address is not of type AddressType. - */ - template AddressType* get() { return boost::get(&value); } - - /** Get the address of type AddressType. - *@return AddressType* pointing to the contained address or 0 if - *contained address is not of type AddressType. - */ - template const AddressType* get() const { return boost::get(&value); } - -private: - boost::variant value; - friend std::ostream& operator<<(std::ostream& os, const Address& addr); + std::string protocol; + std::string host; + uint16_t port; }; - +QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& os, const Address& addr); +QPID_COMMON_EXTERN bool operator==(const Address& x, const Address& y); } // namespace qpid diff --git a/nativeLib/org.apache.qpid/include/qpid/Exception.h b/nativeLib/org.apache.qpid/include/qpid/Exception.h index 7b937c242a..fa7111160c 100644 --- a/nativeLib/org.apache.qpid/include/qpid/Exception.h +++ b/nativeLib/org.apache.qpid/include/qpid/Exception.h @@ -26,9 +26,7 @@ #include "qpid/framing/constants.h" #include "qpid/framing/enum.h" #include "qpid/sys/StrError.h" -#include "qpid/Msg.h" #include "qpid/CommonImportExport.h" -#include #include #include diff --git a/nativeLib/org.apache.qpid/include/qpid/Msg.h b/nativeLib/org.apache.qpid/include/qpid/Msg.h index 6e08a89571..e1837c29e5 100644 --- a/nativeLib/org.apache.qpid/include/qpid/Msg.h +++ b/nativeLib/org.apache.qpid/include/qpid/Msg.h @@ -69,7 +69,9 @@ inline std::ostream& operator<<(std::ostream& o, const Msg& m) { } /** Construct a message using operator << and append (file:line) */ -#define QPID_MSG(message) ::qpid::Msg() << message << " (" << __FILE__ << ":" << __LINE__ << ")" +#define QUOTE_(x) #x +#define QUOTE(x) QUOTE_(x) +#define QPID_MSG(message) (::qpid::Msg() << message << " (" __FILE__ ":" QUOTE(__LINE__) ")") } // namespace qpid diff --git a/nativeLib/org.apache.qpid/include/qpid/Url.h b/nativeLib/org.apache.qpid/include/qpid/Url.h index d0f4bb0c22..353e9d5599 100644 --- a/nativeLib/org.apache.qpid/include/qpid/Url.h +++ b/nativeLib/org.apache.qpid/include/qpid/Url.h @@ -29,13 +29,11 @@ namespace qpid { -QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& os, const TcpAddress& a); - /** An AMQP URL contains a list of addresses */ struct Url : public std::vector
{ /** Url with the hostname as returned by gethostname(2) */ - static Url getHostNameUrl(uint16_t port); + QPID_COMMON_EXTERN static Url getHostNameUrl(uint16_t port); /** Url with local IP address(es), may be more than one address * on a multi-homed host. */ @@ -58,28 +56,36 @@ struct Url : public std::vector
{ /** Parse url, throw Invalid if invalid. */ explicit Url(const char* url) { parse(url); } - Url& operator=(const Url& u) { this->std::vector
::operator=(u); cache=u.cache; return *this; } Url& operator=(const char* s) { parse(s); return *this; } Url& operator=(const std::string& s) { parse(s); return *this; } /** Throw Invalid if the URL does not contain any addresses. */ QPID_COMMON_EXTERN void throwIfEmpty() const; - /** Replace contents with parsed URL as defined in - * https://wiki.108.redhat.com/jira/browse/AMQP-95 + /** Replace contents with parsed url *@exception Invalid if the url is invalid. */ QPID_COMMON_EXTERN void parse(const char* url); QPID_COMMON_EXTERN void parse(const std::string& url) { parse(url.c_str()); } - /** Replace contesnts with parsed URL as defined in - * https://wiki.108.redhat.com/jira/browse/AMQP-95 - * url.empty() will be true if url is invalid. + /** Replace contesnts with parsed URL. Replace with empty URL if invalid. */ + QPID_COMMON_EXTERN void parseNoThrow(const char* url); + + /** Add a protocol tag to be recognzed in URLs. + * Only for use by protcol plug-in initializers. */ - void parseNoThrow(const char* url); + QPID_COMMON_EXTERN static void addProtocol(const std::string& tag); + + QPID_COMMON_EXTERN void setUser(const std::string&); + QPID_COMMON_EXTERN void setPass(const std::string&); + QPID_COMMON_EXTERN std::string getUser() const; + QPID_COMMON_EXTERN std::string getPass() const; private: mutable std::string cache; // cache string form for efficiency. + std::string user, pass; + + friend class UrlParser; }; inline bool operator==(const Url& a, const Url& b) { return a.str()==b.str(); } diff --git a/nativeLib/org.apache.qpid/include/qpid/agent/ManagementAgent.h b/nativeLib/org.apache.qpid/include/qpid/agent/ManagementAgent.h index 1a8d0c4025..e2451244c1 100644 --- a/nativeLib/org.apache.qpid/include/qpid/agent/ManagementAgent.h +++ b/nativeLib/org.apache.qpid/include/qpid/agent/ManagementAgent.h @@ -24,12 +24,17 @@ #include "qpid/management/ManagementObject.h" #include "qpid/management/ManagementEvent.h" #include "qpid/management/Manageable.h" -#include "qpid/sys/Mutex.h" -#include "qpid/client/ConnectionSettings.h" +#include "qpid/management/ConnectionSettings.h" namespace qpid { namespace management { +class Notifyable { +public: + virtual ~Notifyable() {} + virtual void notify() = 0; +}; + class ManagementAgent { public: @@ -39,11 +44,6 @@ class ManagementAgent QMF_AGENT_EXTERN Singleton(bool disableManagement = false); QMF_AGENT_EXTERN ~Singleton(); QMF_AGENT_EXTERN static ManagementAgent* getInstance(); - private: - static sys::Mutex lock; - static bool disabled; - static int refCount; - static ManagementAgent* agent; }; typedef enum { @@ -63,6 +63,28 @@ class ManagementAgent virtual int getMaxThreads() = 0; + // Set the name of the agent + // + // vendor - Vendor name or domain (i.e. "apache.org") + // product - Product name (i.e. "qpid") + // instance - A unique identifier for this instance of the agent. + // If empty, the agent will create a GUID for the instance. + // Note: the ":" character is reserved - do no use it in the vendor or product name. + // + virtual void setName(const std::string& vendor, + const std::string& product, + const std::string& instance="") = 0; + + // Retrieve the name of the agent as assigned by setName() + // + virtual void getName(std::string& vendor, + std::string& product, + std::string& instance) = 0; + + // Obtain the fully qualified name of the agent + // + virtual const std::string& getAddress() = 0; + // Connect to a management broker // // brokerHost - Hostname or IP address (dotted-quad) of broker. @@ -93,11 +115,12 @@ class ManagementAgent const std::string& mech = "PLAIN", const std::string& proto = "tcp") = 0; - virtual void init(const client::ConnectionSettings& settings, + virtual void init(const management::ConnectionSettings& settings, uint16_t intervalSeconds = 10, bool useExternalThread = false, const std::string& storeFile = "") = 0; + // Register a schema with the management agent. This is normally called by the // package initializer generated by the management code generator. // @@ -112,7 +135,7 @@ class ManagementAgent const std::string& eventName, uint8_t* md5Sum, management::ManagementEvent::writeSchemaCall_t schemaCall) = 0; - + // Add a management object to the agent. Once added, this object shall be visible // in the greater management context. // @@ -128,6 +151,9 @@ class ManagementAgent // in an orderly way. // virtual ObjectId addObject(ManagementObject* objectPtr, uint64_t persistId = 0) = 0; + virtual ObjectId addObject(ManagementObject* objectPtr, + const std::string& key, + bool persistent = true) = 0; // // @@ -149,12 +175,28 @@ class ManagementAgent // virtual uint32_t pollCallbacks(uint32_t callLimit = 0) = 0; - // If "useExternalThread" was set to true in the constructor, this method provides - // a standard file descriptor that can be used in a select statement to signal that - // there are method callbacks ready (i.e. that "pollCallbacks" will result in at - // least one method call). When this fd is ready-for-read, pollCallbacks may be - // invoked. Calling pollCallbacks shall reset the ready-to-read state of the fd. + // In the "useExternalThread" scenario, there are three ways that an application can + // use to be notified that there is work to do. Of course the application may periodically + // call pollCallbacks if it wishes, but this will cause long latencies in the responses + // to method calls. // + // The notification methods are: + // + // 1) Register a C-style callback by providing a pointer to a function + // 2) Register a C++-style callback by providing an object of a class that is derived + // from Notifyable + // 3) Call getSignalFd() to get a file descriptor that can be used in a select + // call. The file descriptor shall become readable when the agent has work to + // do. Note that this mechanism is specific to Posix-based operating environments. + // getSignalFd will probably not function correctly on Windows. + // + // If a callback is registered, the callback function will be called on the agent's + // thread. The callback function must perform no work other than to signal the application + // thread to call pollCallbacks. + // + typedef void (*cb_t)(void*); + virtual void setSignalCallback(cb_t callback, void* context) = 0; + virtual void setSignalCallback(Notifyable& notifyable) = 0; virtual int getSignalFd() = 0; }; diff --git a/nativeLib/org.apache.qpid/include/qpid/agent/QmfAgentImportExport.h b/nativeLib/org.apache.qpid/include/qpid/agent/QmfAgentImportExport.h index 9eee4a18fd..e41425a7ba 100644 --- a/nativeLib/org.apache.qpid/include/qpid/agent/QmfAgentImportExport.h +++ b/nativeLib/org.apache.qpid/include/qpid/agent/QmfAgentImportExport.h @@ -21,7 +21,7 @@ */ #if defined(WIN32) && !defined(QPID_DECLARE_STATIC) -#if defined(QMF_AGENT_EXPORT) || defined (qmfagent_EXPORTS) +#if defined (qmf_EXPORTS) #define QMF_AGENT_EXTERN __declspec(dllexport) #else #define QMF_AGENT_EXTERN __declspec(dllimport) diff --git a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ApplyControl.h b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ApplyControl.h index 217a506d67..7101178ade 100644 --- a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ApplyControl.h +++ b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ApplyControl.h @@ -70,11 +70,16 @@ struct ApplyVisitor: virtual void visit(cluster::ConfigChange& x) { this->invoke(x); } virtual void visit(cluster::MessageExpired& x) { this->invoke(x); } virtual void visit(cluster::ErrorCheck& x) { this->invoke(x); } + virtual void visit(cluster::TimerWakeup& x) { this->invoke(x); } + virtual void visit(cluster::TimerDrop& x) { this->invoke(x); } virtual void visit(cluster::Shutdown& x) { this->invoke(x); } + virtual void visit(cluster::DeliverToQueue& x) { this->invoke(x); } virtual void visit(cluster-connection::Announce& x) { this->invoke(x); } virtual void visit(cluster-connection::DeliverClose& x) { this->invoke(x); } virtual void visit(cluster-connection::DeliverDoOutput& x) { this->invoke(x); } virtual void visit(cluster-connection::Abort& x) { this->invoke(x); } + virtual void visit(cluster-connection::ShadowSetUser& x) { this->invoke(x); } + virtual void visit(cluster-connection::ShadowPrepare& x) { this->invoke(x); } virtual void visit(cluster-connection::ConsumerState& x) { this->invoke(x); } virtual void visit(cluster-connection::DeliveryRecord& x) { this->invoke(x); } virtual void visit(cluster-connection::TxStart& x) { this->invoke(x); } @@ -94,6 +99,8 @@ struct ApplyVisitor: virtual void visit(cluster-connection::Queue& x) { this->invoke(x); } virtual void visit(cluster-connection::ExpiryId& x) { this->invoke(x); } virtual void visit(cluster-connection::AddQueueListener& x) { this->invoke(x); } + virtual void visit(cluster-connection::ManagementSetupState& x) { this->invoke(x); } + virtual void visit(cluster-connection::Config& x) { this->invoke(x); } }; template struct ApplyVisitor: @@ -132,11 +139,16 @@ struct ApplyVisitor: virtual void visit(const cluster::ConfigChange& x) { this->invoke(x); } virtual void visit(const cluster::MessageExpired& x) { this->invoke(x); } virtual void visit(const cluster::ErrorCheck& x) { this->invoke(x); } + virtual void visit(const cluster::TimerWakeup& x) { this->invoke(x); } + virtual void visit(const cluster::TimerDrop& x) { this->invoke(x); } virtual void visit(const cluster::Shutdown& x) { this->invoke(x); } + virtual void visit(const cluster::DeliverToQueue& x) { this->invoke(x); } virtual void visit(const cluster-connection::Announce& x) { this->invoke(x); } virtual void visit(const cluster-connection::DeliverClose& x) { this->invoke(x); } virtual void visit(const cluster-connection::DeliverDoOutput& x) { this->invoke(x); } virtual void visit(const cluster-connection::Abort& x) { this->invoke(x); } + virtual void visit(const cluster-connection::ShadowSetUser& x) { this->invoke(x); } + virtual void visit(const cluster-connection::ShadowPrepare& x) { this->invoke(x); } virtual void visit(const cluster-connection::ConsumerState& x) { this->invoke(x); } virtual void visit(const cluster-connection::DeliveryRecord& x) { this->invoke(x); } virtual void visit(const cluster-connection::TxStart& x) { this->invoke(x); } @@ -156,6 +168,8 @@ struct ApplyVisitor: virtual void visit(const cluster-connection::Queue& x) { this->invoke(x); } virtual void visit(const cluster-connection::ExpiryId& x) { this->invoke(x); } virtual void visit(const cluster-connection::AddQueueListener& x) { this->invoke(x); } + virtual void visit(const cluster-connection::ManagementSetupState& x) { this->invoke(x); } + virtual void visit(const cluster-connection::Config& x) { this->invoke(x); } }; }} // namespace qpid::amqp_0_10 diff --git a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/Codecs.h b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/Codecs.h new file mode 100644 index 0000000000..08275402fc --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/Codecs.h @@ -0,0 +1,77 @@ +#ifndef QPID_AMQP_0_10_CODECS_H +#define QPID_AMQP_0_10_CODECS_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#include "qpid/CommonImportExport.h" +#include "qpid/types/Variant.h" + +namespace qpid { +namespace framing { +class FieldTable; +} +namespace amqp_0_10 { +/** + * Codec for encoding/decoding a map of Variants using the AMQP 0-10 + * map encoding. + */ +class QPID_COMMON_EXTERN MapCodec +{ + public: + typedef qpid::types::Variant::Map ObjectType; + static void encode(const ObjectType&, std::string&); + static void decode(const std::string&, ObjectType&); + static size_t encodedSize(const ObjectType&); + static const std::string contentType; + private: +}; + +/** + * Codec for encoding/decoding a list of Variants using the AMQP 0-10 + * list encoding. + */ +class QPID_COMMON_EXTERN ListCodec +{ + public: + typedef qpid::types::Variant::List ObjectType; + static void encode(const ObjectType&, std::string&); + static void decode(const std::string&, ObjectType&); + static size_t encodedSize(const ObjectType&); + static const std::string contentType; + private: +}; + +/** + * @internal + * + * Conversion functions between qpid::types:Variant::Map and the + * deprecated qpid::framing::FieldTable. + * + */ +QPID_COMMON_EXTERN void translate(const qpid::types::Variant::Map& from, + qpid::framing::FieldTable& to); +QPID_COMMON_EXTERN void translate(const qpid::framing::FieldTable& from, + qpid::types::Variant::Map& to); + +}} // namespace qpid::amqp_0_10 + +#endif /*!QPID_AMQP_0_10_CODECS_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ControlHolder.h b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ControlHolder.h index c7446fb56c..90a15bc1be 100644 --- a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ControlHolder.h +++ b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ControlHolder.h @@ -71,31 +71,38 @@ static const size_t MAX030 = sizeof(cluster::Ready) > MAX029 ? sizeof(cluster::R static const size_t MAX031 = sizeof(cluster::ConfigChange) > MAX030 ? sizeof(cluster::ConfigChange) : MAX030; static const size_t MAX032 = sizeof(cluster::MessageExpired) > MAX031 ? sizeof(cluster::MessageExpired) : MAX031; static const size_t MAX033 = sizeof(cluster::ErrorCheck) > MAX032 ? sizeof(cluster::ErrorCheck) : MAX032; -static const size_t MAX034 = sizeof(cluster::Shutdown) > MAX033 ? sizeof(cluster::Shutdown) : MAX033; -static const size_t MAX035 = sizeof(cluster-connection::Announce) > MAX034 ? sizeof(cluster-connection::Announce) : MAX034; -static const size_t MAX036 = sizeof(cluster-connection::DeliverClose) > MAX035 ? sizeof(cluster-connection::DeliverClose) : MAX035; -static const size_t MAX037 = sizeof(cluster-connection::DeliverDoOutput) > MAX036 ? sizeof(cluster-connection::DeliverDoOutput) : MAX036; -static const size_t MAX038 = sizeof(cluster-connection::Abort) > MAX037 ? sizeof(cluster-connection::Abort) : MAX037; -static const size_t MAX039 = sizeof(cluster-connection::ConsumerState) > MAX038 ? sizeof(cluster-connection::ConsumerState) : MAX038; -static const size_t MAX040 = sizeof(cluster-connection::DeliveryRecord) > MAX039 ? sizeof(cluster-connection::DeliveryRecord) : MAX039; -static const size_t MAX041 = sizeof(cluster-connection::TxStart) > MAX040 ? sizeof(cluster-connection::TxStart) : MAX040; -static const size_t MAX042 = sizeof(cluster-connection::TxAccept) > MAX041 ? sizeof(cluster-connection::TxAccept) : MAX041; -static const size_t MAX043 = sizeof(cluster-connection::TxDequeue) > MAX042 ? sizeof(cluster-connection::TxDequeue) : MAX042; -static const size_t MAX044 = sizeof(cluster-connection::TxEnqueue) > MAX043 ? sizeof(cluster-connection::TxEnqueue) : MAX043; -static const size_t MAX045 = sizeof(cluster-connection::TxPublish) > MAX044 ? sizeof(cluster-connection::TxPublish) : MAX044; -static const size_t MAX046 = sizeof(cluster-connection::TxEnd) > MAX045 ? sizeof(cluster-connection::TxEnd) : MAX045; -static const size_t MAX047 = sizeof(cluster-connection::AccumulatedAck) > MAX046 ? sizeof(cluster-connection::AccumulatedAck) : MAX046; -static const size_t MAX048 = sizeof(cluster-connection::OutputTask) > MAX047 ? sizeof(cluster-connection::OutputTask) : MAX047; -static const size_t MAX049 = sizeof(cluster-connection::SessionState) > MAX048 ? sizeof(cluster-connection::SessionState) : MAX048; -static const size_t MAX050 = sizeof(cluster-connection::ShadowReady) > MAX049 ? sizeof(cluster-connection::ShadowReady) : MAX049; -static const size_t MAX051 = sizeof(cluster-connection::Membership) > MAX050 ? sizeof(cluster-connection::Membership) : MAX050; -static const size_t MAX052 = sizeof(cluster-connection::RetractOffer) > MAX051 ? sizeof(cluster-connection::RetractOffer) : MAX051; -static const size_t MAX053 = sizeof(cluster-connection::QueuePosition) > MAX052 ? sizeof(cluster-connection::QueuePosition) : MAX052; -static const size_t MAX054 = sizeof(cluster-connection::Exchange) > MAX053 ? sizeof(cluster-connection::Exchange) : MAX053; -static const size_t MAX055 = sizeof(cluster-connection::Queue) > MAX054 ? sizeof(cluster-connection::Queue) : MAX054; -static const size_t MAX056 = sizeof(cluster-connection::ExpiryId) > MAX055 ? sizeof(cluster-connection::ExpiryId) : MAX055; -static const size_t MAX057 = sizeof(cluster-connection::AddQueueListener) > MAX056 ? sizeof(cluster-connection::AddQueueListener) : MAX056; -static const int MAX=MAX057; +static const size_t MAX034 = sizeof(cluster::TimerWakeup) > MAX033 ? sizeof(cluster::TimerWakeup) : MAX033; +static const size_t MAX035 = sizeof(cluster::TimerDrop) > MAX034 ? sizeof(cluster::TimerDrop) : MAX034; +static const size_t MAX036 = sizeof(cluster::Shutdown) > MAX035 ? sizeof(cluster::Shutdown) : MAX035; +static const size_t MAX037 = sizeof(cluster::DeliverToQueue) > MAX036 ? sizeof(cluster::DeliverToQueue) : MAX036; +static const size_t MAX038 = sizeof(cluster-connection::Announce) > MAX037 ? sizeof(cluster-connection::Announce) : MAX037; +static const size_t MAX039 = sizeof(cluster-connection::DeliverClose) > MAX038 ? sizeof(cluster-connection::DeliverClose) : MAX038; +static const size_t MAX040 = sizeof(cluster-connection::DeliverDoOutput) > MAX039 ? sizeof(cluster-connection::DeliverDoOutput) : MAX039; +static const size_t MAX041 = sizeof(cluster-connection::Abort) > MAX040 ? sizeof(cluster-connection::Abort) : MAX040; +static const size_t MAX042 = sizeof(cluster-connection::ShadowSetUser) > MAX041 ? sizeof(cluster-connection::ShadowSetUser) : MAX041; +static const size_t MAX043 = sizeof(cluster-connection::ShadowPrepare) > MAX042 ? sizeof(cluster-connection::ShadowPrepare) : MAX042; +static const size_t MAX044 = sizeof(cluster-connection::ConsumerState) > MAX043 ? sizeof(cluster-connection::ConsumerState) : MAX043; +static const size_t MAX045 = sizeof(cluster-connection::DeliveryRecord) > MAX044 ? sizeof(cluster-connection::DeliveryRecord) : MAX044; +static const size_t MAX046 = sizeof(cluster-connection::TxStart) > MAX045 ? sizeof(cluster-connection::TxStart) : MAX045; +static const size_t MAX047 = sizeof(cluster-connection::TxAccept) > MAX046 ? sizeof(cluster-connection::TxAccept) : MAX046; +static const size_t MAX048 = sizeof(cluster-connection::TxDequeue) > MAX047 ? sizeof(cluster-connection::TxDequeue) : MAX047; +static const size_t MAX049 = sizeof(cluster-connection::TxEnqueue) > MAX048 ? sizeof(cluster-connection::TxEnqueue) : MAX048; +static const size_t MAX050 = sizeof(cluster-connection::TxPublish) > MAX049 ? sizeof(cluster-connection::TxPublish) : MAX049; +static const size_t MAX051 = sizeof(cluster-connection::TxEnd) > MAX050 ? sizeof(cluster-connection::TxEnd) : MAX050; +static const size_t MAX052 = sizeof(cluster-connection::AccumulatedAck) > MAX051 ? sizeof(cluster-connection::AccumulatedAck) : MAX051; +static const size_t MAX053 = sizeof(cluster-connection::OutputTask) > MAX052 ? sizeof(cluster-connection::OutputTask) : MAX052; +static const size_t MAX054 = sizeof(cluster-connection::SessionState) > MAX053 ? sizeof(cluster-connection::SessionState) : MAX053; +static const size_t MAX055 = sizeof(cluster-connection::ShadowReady) > MAX054 ? sizeof(cluster-connection::ShadowReady) : MAX054; +static const size_t MAX056 = sizeof(cluster-connection::Membership) > MAX055 ? sizeof(cluster-connection::Membership) : MAX055; +static const size_t MAX057 = sizeof(cluster-connection::RetractOffer) > MAX056 ? sizeof(cluster-connection::RetractOffer) : MAX056; +static const size_t MAX058 = sizeof(cluster-connection::QueuePosition) > MAX057 ? sizeof(cluster-connection::QueuePosition) : MAX057; +static const size_t MAX059 = sizeof(cluster-connection::Exchange) > MAX058 ? sizeof(cluster-connection::Exchange) : MAX058; +static const size_t MAX060 = sizeof(cluster-connection::Queue) > MAX059 ? sizeof(cluster-connection::Queue) : MAX059; +static const size_t MAX061 = sizeof(cluster-connection::ExpiryId) > MAX060 ? sizeof(cluster-connection::ExpiryId) : MAX060; +static const size_t MAX062 = sizeof(cluster-connection::AddQueueListener) > MAX061 ? sizeof(cluster-connection::AddQueueListener) : MAX061; +static const size_t MAX063 = sizeof(cluster-connection::ManagementSetupState) > MAX062 ? sizeof(cluster-connection::ManagementSetupState) : MAX062; +static const size_t MAX064 = sizeof(cluster-connection::Config) > MAX063 ? sizeof(cluster-connection::Config) : MAX063; +static const int MAX=MAX064; } // namespace control_max diff --git a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ControlVisitor.h b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ControlVisitor.h index 135fde96ad..3d8a804be0 100644 --- a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ControlVisitor.h +++ b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ControlVisitor.h @@ -69,11 +69,16 @@ struct ControlVisitor virtual void visit(cluster::ConfigChange&) = 0; virtual void visit(cluster::MessageExpired&) = 0; virtual void visit(cluster::ErrorCheck&) = 0; + virtual void visit(cluster::TimerWakeup&) = 0; + virtual void visit(cluster::TimerDrop&) = 0; virtual void visit(cluster::Shutdown&) = 0; + virtual void visit(cluster::DeliverToQueue&) = 0; virtual void visit(cluster-connection::Announce&) = 0; virtual void visit(cluster-connection::DeliverClose&) = 0; virtual void visit(cluster-connection::DeliverDoOutput&) = 0; virtual void visit(cluster-connection::Abort&) = 0; + virtual void visit(cluster-connection::ShadowSetUser&) = 0; + virtual void visit(cluster-connection::ShadowPrepare&) = 0; virtual void visit(cluster-connection::ConsumerState&) = 0; virtual void visit(cluster-connection::DeliveryRecord&) = 0; virtual void visit(cluster-connection::TxStart&) = 0; @@ -93,6 +98,8 @@ struct ControlVisitor virtual void visit(cluster-connection::Queue&) = 0; virtual void visit(cluster-connection::ExpiryId&) = 0; virtual void visit(cluster-connection::AddQueueListener&) = 0; + virtual void visit(cluster-connection::ManagementSetupState&) = 0; + virtual void visit(cluster-connection::Config&) = 0; }; struct ConstControlVisitor { @@ -131,11 +138,16 @@ struct ConstControlVisitor virtual void visit(const cluster::ConfigChange&) = 0; virtual void visit(const cluster::MessageExpired&) = 0; virtual void visit(const cluster::ErrorCheck&) = 0; + virtual void visit(const cluster::TimerWakeup&) = 0; + virtual void visit(const cluster::TimerDrop&) = 0; virtual void visit(const cluster::Shutdown&) = 0; + virtual void visit(const cluster::DeliverToQueue&) = 0; virtual void visit(const cluster-connection::Announce&) = 0; virtual void visit(const cluster-connection::DeliverClose&) = 0; virtual void visit(const cluster-connection::DeliverDoOutput&) = 0; virtual void visit(const cluster-connection::Abort&) = 0; + virtual void visit(const cluster-connection::ShadowSetUser&) = 0; + virtual void visit(const cluster-connection::ShadowPrepare&) = 0; virtual void visit(const cluster-connection::ConsumerState&) = 0; virtual void visit(const cluster-connection::DeliveryRecord&) = 0; virtual void visit(const cluster-connection::TxStart&) = 0; @@ -155,6 +167,8 @@ struct ConstControlVisitor virtual void visit(const cluster-connection::Queue&) = 0; virtual void visit(const cluster-connection::ExpiryId&) = 0; virtual void visit(const cluster-connection::AddQueueListener&) = 0; + virtual void visit(const cluster-connection::ManagementSetupState&) = 0; + virtual void visit(const cluster-connection::Config&) = 0; }; }} // namespace qpid::amqp_0_10 diff --git a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ProxyTemplate.h b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ProxyTemplate.h index 061a74ca5f..26479e3285 100644 --- a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ProxyTemplate.h +++ b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/ProxyTemplate.h @@ -861,10 +861,11 @@ class ProxyTemplate Bit active_, const Uuid& clusterId_, const cluster::StoreState& storeState_, - const Uuid& shutdownId_ + const Uuid& shutdownId_, + const Str16& firstConfig_ ) { - cluster::InitialStatus initialStatus(version_, active_, clusterId_, storeState_, shutdownId_); + cluster::InitialStatus initialStatus(version_, active_, clusterId_, storeState_, shutdownId_, firstConfig_); return functor(initialStatus); } @@ -876,9 +877,13 @@ class ProxyTemplate } - R clusterConfigChange(const Vbin16& current_) + R clusterConfigChange( + const Vbin16& members_, + const Vbin16& joined_, + const Vbin16& left_ + ) { - cluster::ConfigChange configChange(current_); + cluster::ConfigChange configChange(members_, joined_, left_); return functor(configChange); } @@ -900,6 +905,20 @@ class ProxyTemplate } + R clusterTimerWakeup(const Str16& name_) + { + cluster::TimerWakeup timerWakeup(name_); + return functor(timerWakeup); + } + + + R clusterTimerDrop(const Str16& name_) + { + cluster::TimerDrop timerDrop(name_); + return functor(timerDrop); + } + + R clusterShutdown(const Uuid& shutdownId_) { cluster::Shutdown shutdown(shutdownId_); @@ -907,9 +926,26 @@ class ProxyTemplate } - R clusterConnectionAnnounce(Uint32 ssf_) + R clusterDeliverToQueue( + const Str16& queue_, + const Vbin32& message_ + ) { - cluster-connection::Announce announce(ssf_); + cluster::DeliverToQueue deliverToQueue(queue_, message_); + return functor(deliverToQueue); + } + + + R clusterConnectionAnnounce( + const Str16& managementId_, + Uint32 ssf_, + const Str16& authid_, + Bit nodict_, + const Str32& username_, + const Str32& initialFrames_ + ) + { + cluster-connection::Announce announce(managementId_, ssf_, authid_, nodict_, username_, initialFrames_); return functor(announce); } @@ -935,6 +971,20 @@ class ProxyTemplate } + R clusterConnectionShadowSetUser(const Str16& userId_) + { + cluster-connection::ShadowSetUser shadowSetUser(userId_); + return functor(shadowSetUser); + } + + + R clusterConnectionShadowPrepare(const Str16& managementId_) + { + cluster-connection::ShadowPrepare shadowPrepare(managementId_); + return functor(shadowPrepare); + } + + R clusterConnectionConsumerState( const Str8& name_, Bit blocked_, @@ -1047,12 +1097,13 @@ class ProxyTemplate R clusterConnectionShadowReady( Uint64 memberId_, Uint64 connectionId_, + const Str16& managementId_, const Str8& userName_, const Str32& fragment_, Uint32 sendMax_ ) { - cluster-connection::ShadowReady shadowReady(memberId_, connectionId_, userName_, fragment_, sendMax_); + cluster-connection::ShadowReady shadowReady(memberId_, connectionId_, managementId_, userName_, fragment_, sendMax_); return functor(shadowReady); } @@ -1114,6 +1165,27 @@ class ProxyTemplate cluster-connection::AddQueueListener addQueueListener(queue_, consumer_); return functor(addQueueListener); } + + + R clusterConnectionManagementSetupState( + Uint64 objectNum_, + Uint16 bootSequence_, + const Uuid& brokerId_, + const Str32& vendor_, + const Str32& product_, + const Str32& instance_ + ) + { + cluster-connection::ManagementSetupState managementSetupState(objectNum_, bootSequence_, brokerId_, vendor_, product_, instance_); + return functor(managementSetupState); + } + + + R clusterConnectionConfig(const Str32& encoded_) + { + cluster-connection::Config config(encoded_); + return functor(config); + } private: F functor; }; diff --git a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/handlers.h b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/handlers.h index a6cc3325ed..9ec90229c8 100644 --- a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/handlers.h +++ b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/handlers.h @@ -130,11 +130,16 @@ struct ControlHandler: public cluster::ConfigChange::Handler, public cluster::MessageExpired::Handler, public cluster::ErrorCheck::Handler, + public cluster::TimerWakeup::Handler, + public cluster::TimerDrop::Handler, public cluster::Shutdown::Handler, + public cluster::DeliverToQueue::Handler, public cluster-connection::Announce::Handler, public cluster-connection::DeliverClose::Handler, public cluster-connection::DeliverDoOutput::Handler, public cluster-connection::Abort::Handler, + public cluster-connection::ShadowSetUser::Handler, + public cluster-connection::ShadowPrepare::Handler, public cluster-connection::ConsumerState::Handler, public cluster-connection::DeliveryRecord::Handler, public cluster-connection::TxStart::Handler, @@ -153,7 +158,9 @@ struct ControlHandler: public cluster-connection::Exchange::Handler, public cluster-connection::Queue::Handler, public cluster-connection::ExpiryId::Handler, - public cluster-connection::AddQueueListener::Handler + public cluster-connection::AddQueueListener::Handler, + public cluster-connection::ManagementSetupState::Handler, + public cluster-connection::Config::Handler { }; diff --git a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/specification.h b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/specification.h index d78908703c..859759db91 100644 --- a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/specification.h +++ b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/specification.h @@ -3299,6 +3299,7 @@ struct InitialStatus: Uuid clusterId; StoreState storeState; Uuid shutdownId; + Str16 firstConfig; static const char* NAME; static const uint8_t CODE=0x5; @@ -3309,12 +3310,13 @@ struct InitialStatus: Bit active_=Bit(), const Uuid& clusterId_=Uuid(), const cluster::StoreState& storeState_=cluster::StoreState(), - const Uuid& shutdownId_=Uuid() + const Uuid& shutdownId_=Uuid(), + const Str16& firstConfig_=Str16() ); void accept(Visitor&); void accept(ConstVisitor&) const; template void serialize(S& s) { - s(version)(active)(clusterId)(storeState)(shutdownId); + s(version)(active)(clusterId)(storeState)(shutdownId)(firstConfig); } struct Handler @@ -3324,13 +3326,14 @@ struct InitialStatus: Bit active_, const Uuid& clusterId_, const cluster::StoreState& storeState_, - const Uuid& shutdownId_ + const Uuid& shutdownId_, + const Str16& firstConfig_ ); }; template void invoke(T& target)const { - target.clusterInitialStatus(version, active, clusterId, storeState, shutdownId ); + target.clusterInitialStatus(version, active, clusterId, storeState, shutdownId, firstConfig ); } }; inline Packer serializable(InitialStatus& x) { return Packer(x); } @@ -3372,29 +3375,37 @@ bool operator==(const Ready&, const Ready&); struct ConfigChange: public Control { - Vbin16 current; + Vbin16 members; + Vbin16 joined; + Vbin16 left; static const char* NAME; static const uint8_t CODE=0x11; static const uint8_t CLASS_CODE=cluster::CODE; static const char* CLASS_NAME; - explicit ConfigChange(const Vbin16& current_=Vbin16()); + explicit ConfigChange( + const Vbin16& members_=Vbin16(), + const Vbin16& joined_=Vbin16(), + const Vbin16& left_=Vbin16() + ); void accept(Visitor&); void accept(ConstVisitor&) const; template void serialize(S& s) { - s(current); + s(members)(joined)(left); } struct Handler { void clusterConfigChange( - const Vbin16& current_ + const Vbin16& members_, + const Vbin16& joined_, + const Vbin16& left_ ); }; template void invoke(T& target)const { - target.clusterConfigChange(current ); + target.clusterConfigChange(members, joined, left ); } }; inline Packer serializable(ConfigChange& x) { return Packer(x); } @@ -3470,6 +3481,70 @@ inline Packer serializable(ErrorCheck& x) { return Packer void serialize(S& s) { + s(name); + } + + struct Handler + { + void clusterTimerWakeup( + const Str16& name_ + ); + }; + + template void invoke(T& target)const + { + target.clusterTimerWakeup(name ); + } +}; +inline Packer serializable(TimerWakeup& x) { return Packer(x); } +std::ostream& operator << (std::ostream&, const TimerWakeup&); +bool operator==(const TimerWakeup&, const TimerWakeup&); + +struct TimerDrop: + public Control +{ + Str16 name; + + static const char* NAME; + static const uint8_t CODE=0x16; + static const uint8_t CLASS_CODE=cluster::CODE; + static const char* CLASS_NAME; + explicit TimerDrop(const Str16& name_=Str16()); + void accept(Visitor&); + void accept(ConstVisitor&) const; + template void serialize(S& s) { + s(name); + } + + struct Handler + { + void clusterTimerDrop( + const Str16& name_ + ); + }; + + template void invoke(T& target)const + { + target.clusterTimerDrop(name ); + } +}; +inline Packer serializable(TimerDrop& x) { return Packer(x); } +std::ostream& operator << (std::ostream&, const TimerDrop&); +bool operator==(const TimerDrop&, const TimerDrop&); + struct Shutdown: public Control { @@ -3502,6 +3577,43 @@ inline Packer serializable(Shutdown& x) { return Packer(x); std::ostream& operator << (std::ostream&, const Shutdown&); bool operator==(const Shutdown&, const Shutdown&); +struct DeliverToQueue: + public Control +{ + Str16 queue; + Vbin32 message; + + static const char* NAME; + static const uint8_t CODE=0x21; + static const uint8_t CLASS_CODE=cluster::CODE; + static const char* CLASS_NAME; + explicit DeliverToQueue( + const Str16& queue_=Str16(), + const Vbin32& message_=Vbin32() + ); + void accept(Visitor&); + void accept(ConstVisitor&) const; + template void serialize(S& s) { + s(queue)(message); + } + + struct Handler + { + void clusterDeliverToQueue( + const Str16& queue_, + const Vbin32& message_ + ); + }; + + template void invoke(T& target)const + { + target.clusterDeliverToQueue(queue, message ); + } +}; +inline Packer serializable(DeliverToQueue& x) { return Packer(x); } +std::ostream& operator << (std::ostream&, const DeliverToQueue&); +bool operator==(const DeliverToQueue&, const DeliverToQueue&); + } // namespace cluster @@ -3511,29 +3623,46 @@ namespace cluster_connection { struct Announce: public Control { + Str16 managementId; Uint32 ssf; + Str16 authid; + Bit nodict; + Str32 username; + Str32 initialFrames; static const char* NAME; static const uint8_t CODE=0x1; static const uint8_t CLASS_CODE=cluster_connection::CODE; static const char* CLASS_NAME; - explicit Announce(Uint32 ssf_=Uint32()); + explicit Announce( + const Str16& managementId_=Str16(), + Uint32 ssf_=Uint32(), + const Str16& authid_=Str16(), + Bit nodict_=Bit(), + const Str32& username_=Str32(), + const Str32& initialFrames_=Str32() + ); void accept(Visitor&); void accept(ConstVisitor&) const; template void serialize(S& s) { - s(ssf); + s(managementId)(ssf)(authid)(nodict)(username)(initialFrames); } struct Handler { void clusterConnectionAnnounce( - Uint32 ssf_ + const Str16& managementId_, + Uint32 ssf_, + const Str16& authid_, + Bit nodict_, + const Str32& username_, + const Str32& initialFrames_ ); }; template void invoke(T& target)const { - target.clusterConnectionAnnounce(ssf ); + target.clusterConnectionAnnounce(managementId, ssf, authid, nodict, username, initialFrames ); } }; inline Packer serializable(Announce& x) { return Packer(x); } @@ -3630,6 +3759,70 @@ inline Packer serializable(Abort& x) { return Packer(x); } std::ostream& operator << (std::ostream&, const Abort&); bool operator==(const Abort&, const Abort&); +struct ShadowSetUser: + public Control +{ + Str16 userId; + + static const char* NAME; + static const uint8_t CODE=0x0E; + static const uint8_t CLASS_CODE=cluster_connection::CODE; + static const char* CLASS_NAME; + explicit ShadowSetUser(const Str16& userId_=Str16()); + void accept(Visitor&); + void accept(ConstVisitor&) const; + template void serialize(S& s) { + s(userId); + } + + struct Handler + { + void clusterConnectionShadowSetUser( + const Str16& userId_ + ); + }; + + template void invoke(T& target)const + { + target.clusterConnectionShadowSetUser(userId ); + } +}; +inline Packer serializable(ShadowSetUser& x) { return Packer(x); } +std::ostream& operator << (std::ostream&, const ShadowSetUser&); +bool operator==(const ShadowSetUser&, const ShadowSetUser&); + +struct ShadowPrepare: + public Control +{ + Str16 managementId; + + static const char* NAME; + static const uint8_t CODE=0x0F; + static const uint8_t CLASS_CODE=cluster_connection::CODE; + static const char* CLASS_NAME; + explicit ShadowPrepare(const Str16& managementId_=Str16()); + void accept(Visitor&); + void accept(ConstVisitor&) const; + template void serialize(S& s) { + s(managementId); + } + + struct Handler + { + void clusterConnectionShadowPrepare( + const Str16& managementId_ + ); + }; + + template void invoke(T& target)const + { + target.clusterConnectionShadowPrepare(managementId ); + } +}; +inline Packer serializable(ShadowPrepare& x) { return Packer(x); } +std::ostream& operator << (std::ostream&, const ShadowPrepare&); +bool operator==(const ShadowPrepare&, const ShadowPrepare&); + struct ConsumerState: public Control { @@ -4057,6 +4250,7 @@ struct ShadowReady: { Uint64 memberId; Uint64 connectionId; + Str16 managementId; Str8 userName; Str32 fragment; Uint32 sendMax; @@ -4068,6 +4262,7 @@ struct ShadowReady: explicit ShadowReady( Uint64 memberId_=Uint64(), Uint64 connectionId_=Uint64(), + const Str16& managementId_=Str16(), const Str8& userName_=Str8(), const Str32& fragment_=Str32(), Uint32 sendMax_=Uint32() @@ -4075,7 +4270,7 @@ struct ShadowReady: void accept(Visitor&); void accept(ConstVisitor&) const; template void serialize(S& s) { - s(memberId)(connectionId)(userName)(fragment)(sendMax); + s(memberId)(connectionId)(managementId)(userName)(fragment)(sendMax); } struct Handler @@ -4083,6 +4278,7 @@ struct ShadowReady: void clusterConnectionShadowReady( Uint64 memberId_, Uint64 connectionId_, + const Str16& managementId_, const Str8& userName_, const Str32& fragment_, Uint32 sendMax_ @@ -4091,7 +4287,7 @@ struct ShadowReady: template void invoke(T& target)const { - target.clusterConnectionShadowReady(memberId, connectionId, userName, fragment, sendMax ); + target.clusterConnectionShadowReady(memberId, connectionId, managementId, userName, fragment, sendMax ); } }; inline Packer serializable(ShadowReady& x) { return Packer(x); } @@ -4337,6 +4533,87 @@ inline Packer serializable(AddQueueListener& x) { return Packe std::ostream& operator << (std::ostream&, const AddQueueListener&); bool operator==(const AddQueueListener&, const AddQueueListener&); +struct ManagementSetupState: + public Control +{ + Uint64 objectNum; + Uint16 bootSequence; + Uuid brokerId; + Str32 vendor; + Str32 product; + Str32 instance; + + static const char* NAME; + static const uint8_t CODE=0x36; + static const uint8_t CLASS_CODE=cluster_connection::CODE; + static const char* CLASS_NAME; + explicit ManagementSetupState( + Uint64 objectNum_=Uint64(), + Uint16 bootSequence_=Uint16(), + const Uuid& brokerId_=Uuid(), + const Str32& vendor_=Str32(), + const Str32& product_=Str32(), + const Str32& instance_=Str32() + ); + void accept(Visitor&); + void accept(ConstVisitor&) const; + template void serialize(S& s) { + s(objectNum)(bootSequence)(brokerId)(vendor)(product)(instance); + } + + struct Handler + { + void clusterConnectionManagementSetupState( + Uint64 objectNum_, + Uint16 bootSequence_, + const Uuid& brokerId_, + const Str32& vendor_, + const Str32& product_, + const Str32& instance_ + ); + }; + + template void invoke(T& target)const + { + target.clusterConnectionManagementSetupState(objectNum, bootSequence, brokerId, vendor, product, instance ); + } +}; +inline Packer serializable(ManagementSetupState& x) { return Packer(x); } +std::ostream& operator << (std::ostream&, const ManagementSetupState&); +bool operator==(const ManagementSetupState&, const ManagementSetupState&); + +struct Config: + public Control +{ + Str32 encoded; + + static const char* NAME; + static const uint8_t CODE=0x37; + static const uint8_t CLASS_CODE=cluster_connection::CODE; + static const char* CLASS_NAME; + explicit Config(const Str32& encoded_=Str32()); + void accept(Visitor&); + void accept(ConstVisitor&) const; + template void serialize(S& s) { + s(encoded); + } + + struct Handler + { + void clusterConnectionConfig( + const Str32& encoded_ + ); + }; + + template void invoke(T& target)const + { + target.clusterConnectionConfig(encoded ); + } +}; +inline Packer serializable(Config& x) { return Packer(x); } +std::ostream& operator << (std::ostream&, const Config&); +bool operator==(const Config&, const Config&); + } // namespace cluster_connection diff --git a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/specification_fwd.h b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/specification_fwd.h index d70899b603..5e9f94099f 100644 --- a/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/specification_fwd.h +++ b/nativeLib/org.apache.qpid/include/qpid/amqp_0_10/specification_fwd.h @@ -402,7 +402,10 @@ inline SerializeAs serializable(ErrorType& e) { return SerializeAs(e); } class ErrorCheck; +class TimerWakeup; +class TimerDrop; class Shutdown; +class DeliverToQueue; } // namespace cluster @@ -415,6 +418,8 @@ class Announce; class DeliverClose; class DeliverDoOutput; class Abort; +class ShadowSetUser; +class ShadowPrepare; class ConsumerState; class DeliveryRecord; class TxStart; @@ -434,6 +439,8 @@ class Exchange; class Queue; class ExpiryId; class AddQueueListener; +class ManagementSetupState; +class Config; } // namespace cluster_connection diff --git a/nativeLib/org.apache.qpid/include/qpid/client/Connection.h b/nativeLib/org.apache.qpid/include/qpid/client/Connection.h index bcf2962557..6ed0d98bc0 100644 --- a/nativeLib/org.apache.qpid/include/qpid/client/Connection.h +++ b/nativeLib/org.apache.qpid/include/qpid/client/Connection.h @@ -28,6 +28,8 @@ #include "qpid/client/ConnectionSettings.h" #include "qpid/framing/ProtocolVersion.h" +#include "boost/function.hpp" + namespace qpid { struct Url; @@ -71,11 +73,15 @@ class Connection public: /** - * Creates a connection object, but does not open the connection. + * Creates a Connection object, but does not open the connection. * @see open() */ QPID_CLIENT_EXTERN Connection(); + /** + * Destroys a Connection object but does not close the connection if it + * was open. @see close() + */ QPID_CLIENT_EXTERN ~Connection(); /** @@ -212,7 +218,7 @@ class Connection */ QPID_CLIENT_EXTERN const ConnectionSettings& getNegotiatedSettings(); - friend class ConnectionAccess; ///<@internal + friend struct ConnectionAccess; ///<@internal friend class SessionBase_0_10; ///<@internal }; diff --git a/nativeLib/org.apache.qpid/include/qpid/client/ConnectionSettings.h b/nativeLib/org.apache.qpid/include/qpid/client/ConnectionSettings.h index 46053e1fa8..bf060e73bb 100644 --- a/nativeLib/org.apache.qpid/include/qpid/client/ConnectionSettings.h +++ b/nativeLib/org.apache.qpid/include/qpid/client/ConnectionSettings.h @@ -22,13 +22,9 @@ * */ -#include "qpid/Options.h" -#include "qpid/log/Options.h" -#include "qpid/Url.h" #include "qpid/client/ClientImportExport.h" - -#include -#include +#include "qpid/sys/IntegerTypes.h" +#include namespace qpid { @@ -107,7 +103,7 @@ struct ConnectionSettings { * Limit the size of the connections send buffer . The buffer * is limited to bounds * maxFrameSize. */ - uint bounds; + unsigned int bounds; /** * If true, TCP_NODELAY will be set for the connection. */ @@ -120,12 +116,12 @@ struct ConnectionSettings { * Minimum acceptable strength of any SASL negotiated security * layer. 0 means no security layer required. */ - uint minSsf; + unsigned int minSsf; /** * Maximum acceptable strength of any SASL negotiated security * layer. 0 means no security layer allowed. */ - uint maxSsf; + unsigned int maxSsf; }; }} // namespace qpid::client diff --git a/nativeLib/org.apache.qpid/include/qpid/client/SessionBase_0_10.h b/nativeLib/org.apache.qpid/include/qpid/client/SessionBase_0_10.h index afa458bcee..3b5c84e74b 100644 --- a/nativeLib/org.apache.qpid/include/qpid/client/SessionBase_0_10.h +++ b/nativeLib/org.apache.qpid/include/qpid/client/SessionBase_0_10.h @@ -99,6 +99,7 @@ class SessionBase_0_10 { QPID_CLIENT_EXTERN bool isValid() const; + QPID_CLIENT_EXTERN Connection getConnection(); protected: boost::shared_ptr impl; friend class SessionBase_0_10Access; diff --git a/nativeLib/org.apache.qpid/include/qpid/client/amqp0_10/Codecs.h b/nativeLib/org.apache.qpid/include/qpid/client/amqp0_10/Codecs.h deleted file mode 100644 index 5ef0b9fffe..0000000000 --- a/nativeLib/org.apache.qpid/include/qpid/client/amqp0_10/Codecs.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef QPID_CLIENT_AMQP0_10_CODECS_H -#define QPID_CLIENT_AMQP0_10_CODECS_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "qpid/messaging/Codec.h" - -namespace qpid { -namespace client { -namespace amqp0_10 { - - -/** - * Codec for encoding/decoding a map of Variants using the AMQP 0-10 - * map encoding. - */ -class MapCodec : public qpid::messaging::Codec -{ - public: - void encode(const qpid::messaging::Variant&, std::string&); - void decode(const std::string&, qpid::messaging::Variant&); - - static const std::string contentType; - private: -}; - -/** - * Codec for encoding/decoding a list of Variants using the AMQP 0-10 - * list encoding. - */ -class ListCodec : public qpid::messaging::Codec -{ - public: - void encode(const qpid::messaging::Variant&, std::string&); - void decode(const std::string&, qpid::messaging::Variant&); - - static const std::string contentType; - private: -}; - -}}} // namespace qpid::client::amqp0_10 - -#endif /*!QPID_CLIENT_AMQP0_10_CODECS_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/console/Broker.h b/nativeLib/org.apache.qpid/include/qpid/console/Broker.h index af163b8bfd..0b2d1bcb61 100644 --- a/nativeLib/org.apache.qpid/include/qpid/console/Broker.h +++ b/nativeLib/org.apache.qpid/include/qpid/console/Broker.h @@ -55,15 +55,16 @@ namespace console { client::ConnectionSettings& settings); QPID_CONSOLE_EXTERN ~Broker(); - bool isConnected() const { return connected; } - const std::string& getError() const { return error; } - const std::string& getSessionId() const { return amqpSessionId; } - const framing::Uuid& getBrokerId() const { return brokerId; } - uint32_t getBrokerBank() const { return 1; } - void addBinding(const std::string& key) { + QPID_CONSOLE_EXTERN bool isConnected() const { return connected; } + QPID_CONSOLE_EXTERN const std::string& getError() const { return error; } + QPID_CONSOLE_EXTERN const std::string& getSessionId() const { return amqpSessionId; } + QPID_CONSOLE_EXTERN const framing::Uuid& getBrokerId() const { return brokerId; } + QPID_CONSOLE_EXTERN uint32_t getBrokerBank() const { return 1; } + QPID_CONSOLE_EXTERN void addBinding(const std::string& key) { connThreadBody.bindExchange("qpid.management", key); } QPID_CONSOLE_EXTERN std::string getUrl() const; + QPID_CONSOLE_EXTERN void waitForStable(); private: friend class SessionManager; @@ -117,7 +118,6 @@ namespace console { void received(client::Message& msg); void resetAgents(); void updateAgent(const Object& object); - void waitForStable(); void incOutstanding(); void decOutstanding(); void setBrokerId(const framing::Uuid& id) { brokerId = id; } diff --git a/nativeLib/org.apache.qpid/include/qpid/console/SessionManager.h b/nativeLib/org.apache.qpid/include/qpid/console/SessionManager.h index f27037a559..b46af549ff 100644 --- a/nativeLib/org.apache.qpid/include/qpid/console/SessionManager.h +++ b/nativeLib/org.apache.qpid/include/qpid/console/SessionManager.h @@ -138,6 +138,20 @@ class SessionManager QPID_CONSOLE_EXTERN void bindClass(const std::string& packageName, const std::string& className); + /** Request events from a particular package. + * + * Note that this method is only meaningful if a ConsoleListener was provided at session + * creation and if the 'userBindings' flag was set to true. + * + * @param classKey Class key of event of interest + * @param packageName Name of package of event of interest. + * @param eventName Name of event of interest. Default=All events defined by package. + */ + QPID_CONSOLE_EXTERN void bindEvent(const ClassKey& classKey); + QPID_CONSOLE_EXTERN void bindEvent(const std::string& packageName, + const std::string& eventName=""); + + /** Get a list of qmf agents known to the session manager. * *@param agents Vector of Agent objects returned by the session manager. diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/AMQP_AllOperations.h b/nativeLib/org.apache.qpid/include/qpid/framing/AMQP_AllOperations.h index 013ad4d8ef..923c1590c0 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/AMQP_AllOperations.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/AMQP_AllOperations.h @@ -441,18 +441,28 @@ class AMQP_AllOperations { bool active, const Uuid& clusterId, uint8_t storeState, - const Uuid& shutdownId) = 0; + const Uuid& shutdownId, + const string& firstConfig) = 0; virtual void ready(const string& url) = 0; - virtual void configChange(const string& current) = 0; + virtual void configChange(const string& members, + const string& joined, + const string& left) = 0; virtual void messageExpired(uint64_t id) = 0; virtual void errorCheck(uint8_t type, const SequenceNumber& frameSeq) = 0; + virtual void timerWakeup(const string& name) = 0; + + virtual void timerDrop(const string& name) = 0; + virtual void shutdown(const Uuid& shutdownId) = 0; + + virtual void deliverToQueue(const string& queue, + const string& message) = 0; }; // class ClusterHandler @@ -466,7 +476,12 @@ class AMQP_AllOperations { virtual ~ClusterConnectionHandler() {} // Protocol methods - virtual void announce(uint32_t ssf) = 0; + virtual void announce(const string& managementId, + uint32_t ssf, + const string& authid, + bool nodict, + const string& username, + const string& initialFrames) = 0; virtual void deliverClose( ) = 0; @@ -474,6 +489,10 @@ class AMQP_AllOperations { virtual void abort( ) = 0; + virtual void shadowSetUser(const string& userId) = 0; + + virtual void shadowPrepare(const string& managementId) = 0; + virtual void consumerState(const string& name, bool blocked, bool notifyEnabled, @@ -520,6 +539,7 @@ class AMQP_AllOperations { virtual void shadowReady(uint64_t memberId, uint64_t connectionId, + const string& managementId, const string& userName, const string& fragment, uint32_t sendMax) = 0; @@ -541,6 +561,15 @@ class AMQP_AllOperations { virtual void addQueueListener(const string& queue, uint32_t consumer) = 0; + + virtual void managementSetupState(uint64_t objectNum, + uint16_t bootSequence, + const Uuid& brokerId, + const string& vendor, + const string& product, + const string& instance) = 0; + + virtual void config(const string& encoded) = 0; }; // class ClusterConnectionHandler diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/AMQP_AllProxy.h b/nativeLib/org.apache.qpid/include/qpid/framing/AMQP_AllProxy.h index a4972b1ed0..32d971e25b 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/AMQP_AllProxy.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/AMQP_AllProxy.h @@ -440,19 +440,29 @@ class AMQP_AllProxy: bool active, const Uuid& clusterId, uint8_t storeState, - const Uuid& shutdownId); + const Uuid& shutdownId, + const string& firstConfig); QPID_COMMON_EXTERN virtual void ready(const string& url); - QPID_COMMON_EXTERN virtual void configChange(const string& current); + QPID_COMMON_EXTERN virtual void configChange(const string& members, + const string& joined, + const string& left); QPID_COMMON_EXTERN virtual void messageExpired(uint64_t id); QPID_COMMON_EXTERN virtual void errorCheck(uint8_t type, const SequenceNumber& frameSeq); + QPID_COMMON_EXTERN virtual void timerWakeup(const string& name); + + QPID_COMMON_EXTERN virtual void timerDrop(const string& name); + QPID_COMMON_EXTERN virtual void shutdown(const Uuid& shutdownId); + QPID_COMMON_EXTERN virtual void deliverToQueue(const string& queue, + const string& message); + }; Cluster& getCluster() { return clusterProxy; } @@ -463,7 +473,12 @@ class AMQP_AllProxy: public: ClusterConnection(FrameHandler& f) : Proxy(f) {} static ClusterConnection& get(AMQP_AllProxy& proxy) { return proxy.getClusterConnection(); } - QPID_COMMON_EXTERN virtual void announce(uint32_t ssf); + QPID_COMMON_EXTERN virtual void announce(const string& managementId, + uint32_t ssf, + const string& authid, + bool nodict, + const string& username, + const string& initialFrames); QPID_COMMON_EXTERN virtual void deliverClose(); @@ -471,6 +486,10 @@ class AMQP_AllProxy: QPID_COMMON_EXTERN virtual void abort(); + QPID_COMMON_EXTERN virtual void shadowSetUser(const string& userId); + + QPID_COMMON_EXTERN virtual void shadowPrepare(const string& managementId); + QPID_COMMON_EXTERN virtual void consumerState(const string& name, bool blocked, bool notifyEnabled, @@ -517,6 +536,7 @@ class AMQP_AllProxy: QPID_COMMON_EXTERN virtual void shadowReady(uint64_t memberId, uint64_t connectionId, + const string& managementId, const string& userName, const string& fragment, uint32_t sendMax); @@ -539,6 +559,15 @@ class AMQP_AllProxy: QPID_COMMON_EXTERN virtual void addQueueListener(const string& queue, uint32_t consumer); + QPID_COMMON_EXTERN virtual void managementSetupState(uint64_t objectNum, + uint16_t bootSequence, + const Uuid& brokerId, + const string& vendor, + const string& product, + const string& instance); + + QPID_COMMON_EXTERN virtual void config(const string& encoded); + }; ClusterConnection& getClusterConnection() { return clusterConnectionProxy; } diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/AllInvoker.h b/nativeLib/org.apache.qpid/include/qpid/framing/AllInvoker.h index bc64b8f596..92711b953a 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/AllInvoker.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/AllInvoker.h @@ -128,11 +128,16 @@ class AMQP_AllOperations::Invoker: QPID_COMMON_EXTERN void visit(const ClusterConfigChangeBody& body); QPID_COMMON_EXTERN void visit(const ClusterMessageExpiredBody& body); QPID_COMMON_EXTERN void visit(const ClusterErrorCheckBody& body); + QPID_COMMON_EXTERN void visit(const ClusterTimerWakeupBody& body); + QPID_COMMON_EXTERN void visit(const ClusterTimerDropBody& body); QPID_COMMON_EXTERN void visit(const ClusterShutdownBody& body); + QPID_COMMON_EXTERN void visit(const ClusterDeliverToQueueBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionAnnounceBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionDeliverCloseBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionDeliverDoOutputBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionAbortBody& body); + QPID_COMMON_EXTERN void visit(const ClusterConnectionShadowSetUserBody& body); + QPID_COMMON_EXTERN void visit(const ClusterConnectionShadowPrepareBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionConsumerStateBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionDeliveryRecordBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionTxStartBody& body); @@ -152,6 +157,8 @@ class AMQP_AllOperations::Invoker: QPID_COMMON_EXTERN void visit(const ClusterConnectionQueueBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionExpiryIdBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionAddQueueListenerBody& body); + QPID_COMMON_EXTERN void visit(const ClusterConnectionManagementSetupStateBody& body); + QPID_COMMON_EXTERN void visit(const ClusterConnectionConfigBody& body); }; class AMQP_AllOperations::ConnectionHandler::Invoker: @@ -337,7 +344,10 @@ class AMQP_AllOperations::ClusterHandler::Invoker: QPID_COMMON_EXTERN void visit(const ClusterConfigChangeBody& body); QPID_COMMON_EXTERN void visit(const ClusterMessageExpiredBody& body); QPID_COMMON_EXTERN void visit(const ClusterErrorCheckBody& body); + QPID_COMMON_EXTERN void visit(const ClusterTimerWakeupBody& body); + QPID_COMMON_EXTERN void visit(const ClusterTimerDropBody& body); QPID_COMMON_EXTERN void visit(const ClusterShutdownBody& body); + QPID_COMMON_EXTERN void visit(const ClusterDeliverToQueueBody& body); }; class AMQP_AllOperations::ClusterConnectionHandler::Invoker: @@ -351,6 +361,8 @@ class AMQP_AllOperations::ClusterConnectionHandler::Invoker: QPID_COMMON_EXTERN void visit(const ClusterConnectionDeliverCloseBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionDeliverDoOutputBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionAbortBody& body); + QPID_COMMON_EXTERN void visit(const ClusterConnectionShadowSetUserBody& body); + QPID_COMMON_EXTERN void visit(const ClusterConnectionShadowPrepareBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionConsumerStateBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionDeliveryRecordBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionTxStartBody& body); @@ -370,6 +382,8 @@ class AMQP_AllOperations::ClusterConnectionHandler::Invoker: QPID_COMMON_EXTERN void visit(const ClusterConnectionQueueBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionExpiryIdBody& body); QPID_COMMON_EXTERN void visit(const ClusterConnectionAddQueueListenerBody& body); + QPID_COMMON_EXTERN void visit(const ClusterConnectionManagementSetupStateBody& body); + QPID_COMMON_EXTERN void visit(const ClusterConnectionConfigBody& body); }; }} // namespace qpid::framing diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/Buffer.h b/nativeLib/org.apache.qpid/include/qpid/framing/Buffer.h index 8a6a5c0d5f..04583433c5 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/Buffer.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/Buffer.h @@ -43,9 +43,8 @@ class Buffer uint32_t position; uint32_t r_position; - void checkAvailable(uint32_t count) { if (position + count > size) throw OutOfBounds(); } - public: + void checkAvailable(uint32_t count) { if (position + count > size) throw OutOfBounds(); } /** Buffer input/output iterator. * Supports using an amqp_0_10::Codec with a framing::Buffer. @@ -76,6 +75,7 @@ class Buffer QPID_COMMON_EXTERN uint32_t available() { return size - position; } QPID_COMMON_EXTERN uint32_t getSize() { return size; } QPID_COMMON_EXTERN uint32_t getPosition() { return position; } + QPID_COMMON_EXTERN void setPosition(uint32_t p) { position = p; } QPID_COMMON_EXTERN Iterator getIterator() { return Iterator(*this); } QPID_COMMON_EXTERN char* getPointer() { return data; } diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConfigChangeBody.h b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConfigChangeBody.h index 45e02348a1..64c670db74 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConfigChangeBody.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConfigChangeBody.h @@ -40,27 +40,43 @@ namespace qpid { namespace framing { class ClusterConfigChangeBody : public ModelMethod { - string current; + string members; + string joined; + string left; uint16_t flags; public: static const ClassId CLASS_ID = 0x80; static const MethodId METHOD_ID = 0x11; ClusterConfigChangeBody( - ProtocolVersion, const string& _current) : - current(_current), + ProtocolVersion, const string& _members, + const string& _joined, + const string& _left) : + members(_members), + joined(_joined), + left(_left), flags(0){ flags |= (1 << 8); + flags |= (1 << 9); + flags |= (1 << 10); } ClusterConfigChangeBody(ProtocolVersion=ProtocolVersion()) : flags(0) {} - QPID_COMMON_EXTERN void setCurrent(const string& _current); - QPID_COMMON_EXTERN const string& getCurrent() const; - QPID_COMMON_EXTERN bool hasCurrent() const; - QPID_COMMON_EXTERN void clearCurrentFlag(); + QPID_COMMON_EXTERN void setMembers(const string& _members); + QPID_COMMON_EXTERN const string& getMembers() const; + QPID_COMMON_EXTERN bool hasMembers() const; + QPID_COMMON_EXTERN void clearMembersFlag(); + QPID_COMMON_EXTERN void setJoined(const string& _joined); + QPID_COMMON_EXTERN const string& getJoined() const; + QPID_COMMON_EXTERN bool hasJoined() const; + QPID_COMMON_EXTERN void clearJoinedFlag(); + QPID_COMMON_EXTERN void setLeft(const string& _left); + QPID_COMMON_EXTERN const string& getLeft() const; + QPID_COMMON_EXTERN bool hasLeft() const; + QPID_COMMON_EXTERN void clearLeftFlag(); typedef void ResultType; template ResultType invoke(T& invocable) const { - return invocable.configChange(getCurrent()); + return invocable.configChange(getMembers(), getJoined(), getLeft()); } using AMQMethodBody::accept; diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionAnnounceBody.h b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionAnnounceBody.h index 16364eb8e6..521f1a389f 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionAnnounceBody.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionAnnounceBody.h @@ -40,27 +40,63 @@ namespace qpid { namespace framing { class ClusterConnectionAnnounceBody : public ModelMethod { + string managementId; uint32_t ssf; + string authid; + string username; + string initialFrames; uint16_t flags; public: static const ClassId CLASS_ID = 0x81; static const MethodId METHOD_ID = 0x1; ClusterConnectionAnnounceBody( - ProtocolVersion, uint32_t _ssf) : + ProtocolVersion, const string& _managementId, + uint32_t _ssf, + const string& _authid, + bool _nodict, + const string& _username, + const string& _initialFrames) : + managementId(_managementId), ssf(_ssf), + authid(_authid), + username(_username), + initialFrames(_initialFrames), flags(0){ + setNodict(_nodict); flags |= (1 << 8); + flags |= (1 << 9); + flags |= (1 << 10); + flags |= (1 << 12); + flags |= (1 << 13); } ClusterConnectionAnnounceBody(ProtocolVersion=ProtocolVersion()) : ssf(0), flags(0) {} + QPID_COMMON_EXTERN void setManagementId(const string& _managementId); + QPID_COMMON_EXTERN const string& getManagementId() const; + QPID_COMMON_EXTERN bool hasManagementId() const; + QPID_COMMON_EXTERN void clearManagementIdFlag(); QPID_COMMON_EXTERN void setSsf(uint32_t _ssf); QPID_COMMON_EXTERN uint32_t getSsf() const; QPID_COMMON_EXTERN bool hasSsf() const; QPID_COMMON_EXTERN void clearSsfFlag(); + QPID_COMMON_EXTERN void setAuthid(const string& _authid); + QPID_COMMON_EXTERN const string& getAuthid() const; + QPID_COMMON_EXTERN bool hasAuthid() const; + QPID_COMMON_EXTERN void clearAuthidFlag(); + QPID_COMMON_EXTERN void setNodict(bool _nodict); + QPID_COMMON_EXTERN bool getNodict() const; + QPID_COMMON_EXTERN void setUsername(const string& _username); + QPID_COMMON_EXTERN const string& getUsername() const; + QPID_COMMON_EXTERN bool hasUsername() const; + QPID_COMMON_EXTERN void clearUsernameFlag(); + QPID_COMMON_EXTERN void setInitialFrames(const string& _initialFrames); + QPID_COMMON_EXTERN const string& getInitialFrames() const; + QPID_COMMON_EXTERN bool hasInitialFrames() const; + QPID_COMMON_EXTERN void clearInitialFramesFlag(); typedef void ResultType; template ResultType invoke(T& invocable) const { - return invocable.announce(getSsf()); + return invocable.announce(getManagementId(), getSsf(), getAuthid(), getNodict(), getUsername(), getInitialFrames()); } using AMQMethodBody::accept; diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionConfigBody.h b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionConfigBody.h new file mode 100644 index 0000000000..09e6669589 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionConfigBody.h @@ -0,0 +1,85 @@ +#ifndef QPID_FRAMING_CLUSTERCONNECTIONCONFIGBODY_H +#define QPID_FRAMING_CLUSTERCONNECTIONCONFIGBODY_H +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +/// +/// This file was automatically generated from the AMQP specification. +/// Do not edit. +/// + + +#include "qpid/framing/AMQMethodBody.h" +#include "qpid/framing/AMQP_ServerOperations.h" +#include "qpid/framing/MethodBodyConstVisitor.h" +#include "qpid/framing/ModelMethod.h" + +#include +#include "qpid/framing/amqp_types_full.h" +#include "qpid/CommonImportExport.h" + +namespace qpid { +namespace framing { + +class ClusterConnectionConfigBody : public ModelMethod { + string encoded; + uint16_t flags; +public: + static const ClassId CLASS_ID = 0x81; + static const MethodId METHOD_ID = 0x37; + ClusterConnectionConfigBody( + ProtocolVersion, const string& _encoded) : + encoded(_encoded), + flags(0){ + flags |= (1 << 8); + } + ClusterConnectionConfigBody(ProtocolVersion=ProtocolVersion()) : flags(0) {} + + QPID_COMMON_EXTERN void setEncoded(const string& _encoded); + QPID_COMMON_EXTERN const string& getEncoded() const; + QPID_COMMON_EXTERN bool hasEncoded() const; + QPID_COMMON_EXTERN void clearEncodedFlag(); + typedef void ResultType; + + template ResultType invoke(T& invocable) const { + return invocable.config(getEncoded()); + } + + using AMQMethodBody::accept; + void accept(MethodBodyConstVisitor& v) const { v.visit(*this); } + boost::intrusive_ptr clone() const { return BodyFactory::copy(*this); } + + ClassId amqpClassId() const { return CLASS_ID; } + MethodId amqpMethodId() const { return METHOD_ID; } + bool isContentBearing() const { return false; } + bool resultExpected() const { return false; } + bool responseExpected() const { return false; } + QPID_COMMON_EXTERN void encode(Buffer&) const; + QPID_COMMON_EXTERN void decode(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN void encodeStructBody(Buffer&) const; + QPID_COMMON_EXTERN void decodeStructBody(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN uint32_t encodedSize() const; + QPID_COMMON_EXTERN uint32_t bodySize() const; + QPID_COMMON_EXTERN void print(std::ostream& out) const; +}; /* class ClusterConnectionConfigBody */ + +}} +#endif /*!QPID_FRAMING_CLUSTERCONNECTIONCONFIGBODY_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionManagementSetupStateBody.h b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionManagementSetupStateBody.h new file mode 100644 index 0000000000..78a1cdea1d --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionManagementSetupStateBody.h @@ -0,0 +1,125 @@ +#ifndef QPID_FRAMING_CLUSTERCONNECTIONMANAGEMENTSETUPSTATEBODY_H +#define QPID_FRAMING_CLUSTERCONNECTIONMANAGEMENTSETUPSTATEBODY_H +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +/// +/// This file was automatically generated from the AMQP specification. +/// Do not edit. +/// + + +#include "qpid/framing/AMQMethodBody.h" +#include "qpid/framing/AMQP_ServerOperations.h" +#include "qpid/framing/MethodBodyConstVisitor.h" +#include "qpid/framing/ModelMethod.h" + +#include +#include "qpid/framing/amqp_types_full.h" +#include "qpid/CommonImportExport.h" + +namespace qpid { +namespace framing { + +class ClusterConnectionManagementSetupStateBody : public ModelMethod { + uint64_t objectNum; + uint16_t bootSequence; + Uuid brokerId; + string vendor; + string product; + string instance; + uint16_t flags; +public: + static const ClassId CLASS_ID = 0x81; + static const MethodId METHOD_ID = 0x36; + ClusterConnectionManagementSetupStateBody( + ProtocolVersion, uint64_t _objectNum, + uint16_t _bootSequence, + const Uuid& _brokerId, + const string& _vendor, + const string& _product, + const string& _instance) : + objectNum(_objectNum), + bootSequence(_bootSequence), + brokerId(_brokerId), + vendor(_vendor), + product(_product), + instance(_instance), + flags(0){ + flags |= (1 << 8); + flags |= (1 << 9); + flags |= (1 << 10); + flags |= (1 << 11); + flags |= (1 << 12); + flags |= (1 << 13); + } + ClusterConnectionManagementSetupStateBody(ProtocolVersion=ProtocolVersion()) : objectNum(0), bootSequence(0), flags(0) {} + + QPID_COMMON_EXTERN void setObjectNum(uint64_t _objectNum); + QPID_COMMON_EXTERN uint64_t getObjectNum() const; + QPID_COMMON_EXTERN bool hasObjectNum() const; + QPID_COMMON_EXTERN void clearObjectNumFlag(); + QPID_COMMON_EXTERN void setBootSequence(uint16_t _bootSequence); + QPID_COMMON_EXTERN uint16_t getBootSequence() const; + QPID_COMMON_EXTERN bool hasBootSequence() const; + QPID_COMMON_EXTERN void clearBootSequenceFlag(); + QPID_COMMON_EXTERN void setBrokerId(const Uuid& _brokerId); + QPID_COMMON_EXTERN const Uuid& getBrokerId() const; + QPID_COMMON_EXTERN bool hasBrokerId() const; + QPID_COMMON_EXTERN void clearBrokerIdFlag(); + QPID_COMMON_EXTERN void setVendor(const string& _vendor); + QPID_COMMON_EXTERN const string& getVendor() const; + QPID_COMMON_EXTERN bool hasVendor() const; + QPID_COMMON_EXTERN void clearVendorFlag(); + QPID_COMMON_EXTERN void setProduct(const string& _product); + QPID_COMMON_EXTERN const string& getProduct() const; + QPID_COMMON_EXTERN bool hasProduct() const; + QPID_COMMON_EXTERN void clearProductFlag(); + QPID_COMMON_EXTERN void setInstance(const string& _instance); + QPID_COMMON_EXTERN const string& getInstance() const; + QPID_COMMON_EXTERN bool hasInstance() const; + QPID_COMMON_EXTERN void clearInstanceFlag(); + typedef void ResultType; + + template ResultType invoke(T& invocable) const { + return invocable.managementSetupState(getObjectNum(), getBootSequence(), getBrokerId(), getVendor(), getProduct(), getInstance()); + } + + using AMQMethodBody::accept; + void accept(MethodBodyConstVisitor& v) const { v.visit(*this); } + boost::intrusive_ptr clone() const { return BodyFactory::copy(*this); } + + ClassId amqpClassId() const { return CLASS_ID; } + MethodId amqpMethodId() const { return METHOD_ID; } + bool isContentBearing() const { return false; } + bool resultExpected() const { return false; } + bool responseExpected() const { return false; } + QPID_COMMON_EXTERN void encode(Buffer&) const; + QPID_COMMON_EXTERN void decode(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN void encodeStructBody(Buffer&) const; + QPID_COMMON_EXTERN void decodeStructBody(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN uint32_t encodedSize() const; + QPID_COMMON_EXTERN uint32_t bodySize() const; + QPID_COMMON_EXTERN void print(std::ostream& out) const; +}; /* class ClusterConnectionManagementSetupStateBody */ + +}} +#endif /*!QPID_FRAMING_CLUSTERCONNECTIONMANAGEMENTSETUPSTATEBODY_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionShadowPrepareBody.h b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionShadowPrepareBody.h new file mode 100644 index 0000000000..f60798b88c --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionShadowPrepareBody.h @@ -0,0 +1,85 @@ +#ifndef QPID_FRAMING_CLUSTERCONNECTIONSHADOWPREPAREBODY_H +#define QPID_FRAMING_CLUSTERCONNECTIONSHADOWPREPAREBODY_H +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +/// +/// This file was automatically generated from the AMQP specification. +/// Do not edit. +/// + + +#include "qpid/framing/AMQMethodBody.h" +#include "qpid/framing/AMQP_ServerOperations.h" +#include "qpid/framing/MethodBodyConstVisitor.h" +#include "qpid/framing/ModelMethod.h" + +#include +#include "qpid/framing/amqp_types_full.h" +#include "qpid/CommonImportExport.h" + +namespace qpid { +namespace framing { + +class ClusterConnectionShadowPrepareBody : public ModelMethod { + string managementId; + uint16_t flags; +public: + static const ClassId CLASS_ID = 0x81; + static const MethodId METHOD_ID = 0x0F; + ClusterConnectionShadowPrepareBody( + ProtocolVersion, const string& _managementId) : + managementId(_managementId), + flags(0){ + flags |= (1 << 8); + } + ClusterConnectionShadowPrepareBody(ProtocolVersion=ProtocolVersion()) : flags(0) {} + + QPID_COMMON_EXTERN void setManagementId(const string& _managementId); + QPID_COMMON_EXTERN const string& getManagementId() const; + QPID_COMMON_EXTERN bool hasManagementId() const; + QPID_COMMON_EXTERN void clearManagementIdFlag(); + typedef void ResultType; + + template ResultType invoke(T& invocable) const { + return invocable.shadowPrepare(getManagementId()); + } + + using AMQMethodBody::accept; + void accept(MethodBodyConstVisitor& v) const { v.visit(*this); } + boost::intrusive_ptr clone() const { return BodyFactory::copy(*this); } + + ClassId amqpClassId() const { return CLASS_ID; } + MethodId amqpMethodId() const { return METHOD_ID; } + bool isContentBearing() const { return false; } + bool resultExpected() const { return false; } + bool responseExpected() const { return false; } + QPID_COMMON_EXTERN void encode(Buffer&) const; + QPID_COMMON_EXTERN void decode(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN void encodeStructBody(Buffer&) const; + QPID_COMMON_EXTERN void decodeStructBody(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN uint32_t encodedSize() const; + QPID_COMMON_EXTERN uint32_t bodySize() const; + QPID_COMMON_EXTERN void print(std::ostream& out) const; +}; /* class ClusterConnectionShadowPrepareBody */ + +}} +#endif /*!QPID_FRAMING_CLUSTERCONNECTIONSHADOWPREPAREBODY_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionShadowReadyBody.h b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionShadowReadyBody.h index c6971652b4..cee8b17d71 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionShadowReadyBody.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionShadowReadyBody.h @@ -42,6 +42,7 @@ namespace framing { class ClusterConnectionShadowReadyBody : public ModelMethod { uint64_t memberId; uint64_t connectionId; + string managementId; string userName; string fragment; uint32_t sendMax; @@ -52,11 +53,13 @@ public: ClusterConnectionShadowReadyBody( ProtocolVersion, uint64_t _memberId, uint64_t _connectionId, + const string& _managementId, const string& _userName, const string& _fragment, uint32_t _sendMax) : memberId(_memberId), connectionId(_connectionId), + managementId(_managementId), userName(_userName), fragment(_fragment), sendMax(_sendMax), @@ -66,6 +69,7 @@ public: flags |= (1 << 10); flags |= (1 << 11); flags |= (1 << 12); + flags |= (1 << 13); } ClusterConnectionShadowReadyBody(ProtocolVersion=ProtocolVersion()) : memberId(0), connectionId(0), sendMax(0), flags(0) {} @@ -77,6 +81,10 @@ public: QPID_COMMON_EXTERN uint64_t getConnectionId() const; QPID_COMMON_EXTERN bool hasConnectionId() const; QPID_COMMON_EXTERN void clearConnectionIdFlag(); + QPID_COMMON_EXTERN void setManagementId(const string& _managementId); + QPID_COMMON_EXTERN const string& getManagementId() const; + QPID_COMMON_EXTERN bool hasManagementId() const; + QPID_COMMON_EXTERN void clearManagementIdFlag(); QPID_COMMON_EXTERN void setUserName(const string& _userName); QPID_COMMON_EXTERN const string& getUserName() const; QPID_COMMON_EXTERN bool hasUserName() const; @@ -92,7 +100,7 @@ public: typedef void ResultType; template ResultType invoke(T& invocable) const { - return invocable.shadowReady(getMemberId(), getConnectionId(), getUserName(), getFragment(), getSendMax()); + return invocable.shadowReady(getMemberId(), getConnectionId(), getManagementId(), getUserName(), getFragment(), getSendMax()); } using AMQMethodBody::accept; diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionShadowSetUserBody.h b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionShadowSetUserBody.h new file mode 100644 index 0000000000..e53a0a2ad3 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterConnectionShadowSetUserBody.h @@ -0,0 +1,85 @@ +#ifndef QPID_FRAMING_CLUSTERCONNECTIONSHADOWSETUSERBODY_H +#define QPID_FRAMING_CLUSTERCONNECTIONSHADOWSETUSERBODY_H +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +/// +/// This file was automatically generated from the AMQP specification. +/// Do not edit. +/// + + +#include "qpid/framing/AMQMethodBody.h" +#include "qpid/framing/AMQP_ServerOperations.h" +#include "qpid/framing/MethodBodyConstVisitor.h" +#include "qpid/framing/ModelMethod.h" + +#include +#include "qpid/framing/amqp_types_full.h" +#include "qpid/CommonImportExport.h" + +namespace qpid { +namespace framing { + +class ClusterConnectionShadowSetUserBody : public ModelMethod { + string userId; + uint16_t flags; +public: + static const ClassId CLASS_ID = 0x81; + static const MethodId METHOD_ID = 0x0E; + ClusterConnectionShadowSetUserBody( + ProtocolVersion, const string& _userId) : + userId(_userId), + flags(0){ + flags |= (1 << 8); + } + ClusterConnectionShadowSetUserBody(ProtocolVersion=ProtocolVersion()) : flags(0) {} + + QPID_COMMON_EXTERN void setUserId(const string& _userId); + QPID_COMMON_EXTERN const string& getUserId() const; + QPID_COMMON_EXTERN bool hasUserId() const; + QPID_COMMON_EXTERN void clearUserIdFlag(); + typedef void ResultType; + + template ResultType invoke(T& invocable) const { + return invocable.shadowSetUser(getUserId()); + } + + using AMQMethodBody::accept; + void accept(MethodBodyConstVisitor& v) const { v.visit(*this); } + boost::intrusive_ptr clone() const { return BodyFactory::copy(*this); } + + ClassId amqpClassId() const { return CLASS_ID; } + MethodId amqpMethodId() const { return METHOD_ID; } + bool isContentBearing() const { return false; } + bool resultExpected() const { return false; } + bool responseExpected() const { return false; } + QPID_COMMON_EXTERN void encode(Buffer&) const; + QPID_COMMON_EXTERN void decode(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN void encodeStructBody(Buffer&) const; + QPID_COMMON_EXTERN void decodeStructBody(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN uint32_t encodedSize() const; + QPID_COMMON_EXTERN uint32_t bodySize() const; + QPID_COMMON_EXTERN void print(std::ostream& out) const; +}; /* class ClusterConnectionShadowSetUserBody */ + +}} +#endif /*!QPID_FRAMING_CLUSTERCONNECTIONSHADOWSETUSERBODY_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterDeliverToQueueBody.h b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterDeliverToQueueBody.h new file mode 100644 index 0000000000..3a66e141a2 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterDeliverToQueueBody.h @@ -0,0 +1,93 @@ +#ifndef QPID_FRAMING_CLUSTERDELIVERTOQUEUEBODY_H +#define QPID_FRAMING_CLUSTERDELIVERTOQUEUEBODY_H +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +/// +/// This file was automatically generated from the AMQP specification. +/// Do not edit. +/// + + +#include "qpid/framing/AMQMethodBody.h" +#include "qpid/framing/AMQP_ServerOperations.h" +#include "qpid/framing/MethodBodyConstVisitor.h" +#include "qpid/framing/ModelMethod.h" + +#include +#include "qpid/framing/amqp_types_full.h" +#include "qpid/CommonImportExport.h" + +namespace qpid { +namespace framing { + +class ClusterDeliverToQueueBody : public ModelMethod { + string queue; + string message; + uint16_t flags; +public: + static const ClassId CLASS_ID = 0x80; + static const MethodId METHOD_ID = 0x21; + ClusterDeliverToQueueBody( + ProtocolVersion, const string& _queue, + const string& _message) : + queue(_queue), + message(_message), + flags(0){ + flags |= (1 << 8); + flags |= (1 << 9); + } + ClusterDeliverToQueueBody(ProtocolVersion=ProtocolVersion()) : flags(0) {} + + QPID_COMMON_EXTERN void setQueue(const string& _queue); + QPID_COMMON_EXTERN const string& getQueue() const; + QPID_COMMON_EXTERN bool hasQueue() const; + QPID_COMMON_EXTERN void clearQueueFlag(); + QPID_COMMON_EXTERN void setMessage(const string& _message); + QPID_COMMON_EXTERN const string& getMessage() const; + QPID_COMMON_EXTERN bool hasMessage() const; + QPID_COMMON_EXTERN void clearMessageFlag(); + typedef void ResultType; + + template ResultType invoke(T& invocable) const { + return invocable.deliverToQueue(getQueue(), getMessage()); + } + + using AMQMethodBody::accept; + void accept(MethodBodyConstVisitor& v) const { v.visit(*this); } + boost::intrusive_ptr clone() const { return BodyFactory::copy(*this); } + + ClassId amqpClassId() const { return CLASS_ID; } + MethodId amqpMethodId() const { return METHOD_ID; } + bool isContentBearing() const { return false; } + bool resultExpected() const { return false; } + bool responseExpected() const { return false; } + QPID_COMMON_EXTERN void encode(Buffer&) const; + QPID_COMMON_EXTERN void decode(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN void encodeStructBody(Buffer&) const; + QPID_COMMON_EXTERN void decodeStructBody(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN uint32_t encodedSize() const; + QPID_COMMON_EXTERN uint32_t bodySize() const; + QPID_COMMON_EXTERN void print(std::ostream& out) const; +}; /* class ClusterDeliverToQueueBody */ + +}} +#endif /*!QPID_FRAMING_CLUSTERDELIVERTOQUEUEBODY_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterInitialStatusBody.h b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterInitialStatusBody.h index 6ab62d4e6e..985706c5ea 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterInitialStatusBody.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterInitialStatusBody.h @@ -44,6 +44,7 @@ class ClusterInitialStatusBody : public ModelMethod { Uuid clusterId; uint8_t storeState; Uuid shutdownId; + string firstConfig; uint16_t flags; public: static const ClassId CLASS_ID = 0x80; @@ -53,17 +54,20 @@ public: bool _active, const Uuid& _clusterId, uint8_t _storeState, - const Uuid& _shutdownId) : + const Uuid& _shutdownId, + const string& _firstConfig) : version(_version), clusterId(_clusterId), storeState(_storeState), shutdownId(_shutdownId), + firstConfig(_firstConfig), flags(0){ setActive(_active); flags |= (1 << 8); flags |= (1 << 10); flags |= (1 << 11); flags |= (1 << 12); + flags |= (1 << 13); } ClusterInitialStatusBody(ProtocolVersion=ProtocolVersion()) : version(0), storeState(0), flags(0) {} @@ -85,10 +89,14 @@ public: QPID_COMMON_EXTERN const Uuid& getShutdownId() const; QPID_COMMON_EXTERN bool hasShutdownId() const; QPID_COMMON_EXTERN void clearShutdownIdFlag(); + QPID_COMMON_EXTERN void setFirstConfig(const string& _firstConfig); + QPID_COMMON_EXTERN const string& getFirstConfig() const; + QPID_COMMON_EXTERN bool hasFirstConfig() const; + QPID_COMMON_EXTERN void clearFirstConfigFlag(); typedef void ResultType; template ResultType invoke(T& invocable) const { - return invocable.initialStatus(getVersion(), getActive(), getClusterId(), getStoreState(), getShutdownId()); + return invocable.initialStatus(getVersion(), getActive(), getClusterId(), getStoreState(), getShutdownId(), getFirstConfig()); } using AMQMethodBody::accept; diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterTimerDropBody.h b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterTimerDropBody.h new file mode 100644 index 0000000000..ecb2eda4f9 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterTimerDropBody.h @@ -0,0 +1,85 @@ +#ifndef QPID_FRAMING_CLUSTERTIMERDROPBODY_H +#define QPID_FRAMING_CLUSTERTIMERDROPBODY_H +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +/// +/// This file was automatically generated from the AMQP specification. +/// Do not edit. +/// + + +#include "qpid/framing/AMQMethodBody.h" +#include "qpid/framing/AMQP_ServerOperations.h" +#include "qpid/framing/MethodBodyConstVisitor.h" +#include "qpid/framing/ModelMethod.h" + +#include +#include "qpid/framing/amqp_types_full.h" +#include "qpid/CommonImportExport.h" + +namespace qpid { +namespace framing { + +class ClusterTimerDropBody : public ModelMethod { + string name; + uint16_t flags; +public: + static const ClassId CLASS_ID = 0x80; + static const MethodId METHOD_ID = 0x16; + ClusterTimerDropBody( + ProtocolVersion, const string& _name) : + name(_name), + flags(0){ + flags |= (1 << 8); + } + ClusterTimerDropBody(ProtocolVersion=ProtocolVersion()) : flags(0) {} + + QPID_COMMON_EXTERN void setName(const string& _name); + QPID_COMMON_EXTERN const string& getName() const; + QPID_COMMON_EXTERN bool hasName() const; + QPID_COMMON_EXTERN void clearNameFlag(); + typedef void ResultType; + + template ResultType invoke(T& invocable) const { + return invocable.timerDrop(getName()); + } + + using AMQMethodBody::accept; + void accept(MethodBodyConstVisitor& v) const { v.visit(*this); } + boost::intrusive_ptr clone() const { return BodyFactory::copy(*this); } + + ClassId amqpClassId() const { return CLASS_ID; } + MethodId amqpMethodId() const { return METHOD_ID; } + bool isContentBearing() const { return false; } + bool resultExpected() const { return false; } + bool responseExpected() const { return false; } + QPID_COMMON_EXTERN void encode(Buffer&) const; + QPID_COMMON_EXTERN void decode(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN void encodeStructBody(Buffer&) const; + QPID_COMMON_EXTERN void decodeStructBody(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN uint32_t encodedSize() const; + QPID_COMMON_EXTERN uint32_t bodySize() const; + QPID_COMMON_EXTERN void print(std::ostream& out) const; +}; /* class ClusterTimerDropBody */ + +}} +#endif /*!QPID_FRAMING_CLUSTERTIMERDROPBODY_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/ClusterTimerWakeupBody.h b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterTimerWakeupBody.h new file mode 100644 index 0000000000..dd55101ba7 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/framing/ClusterTimerWakeupBody.h @@ -0,0 +1,85 @@ +#ifndef QPID_FRAMING_CLUSTERTIMERWAKEUPBODY_H +#define QPID_FRAMING_CLUSTERTIMERWAKEUPBODY_H +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +/// +/// This file was automatically generated from the AMQP specification. +/// Do not edit. +/// + + +#include "qpid/framing/AMQMethodBody.h" +#include "qpid/framing/AMQP_ServerOperations.h" +#include "qpid/framing/MethodBodyConstVisitor.h" +#include "qpid/framing/ModelMethod.h" + +#include +#include "qpid/framing/amqp_types_full.h" +#include "qpid/CommonImportExport.h" + +namespace qpid { +namespace framing { + +class ClusterTimerWakeupBody : public ModelMethod { + string name; + uint16_t flags; +public: + static const ClassId CLASS_ID = 0x80; + static const MethodId METHOD_ID = 0x15; + ClusterTimerWakeupBody( + ProtocolVersion, const string& _name) : + name(_name), + flags(0){ + flags |= (1 << 8); + } + ClusterTimerWakeupBody(ProtocolVersion=ProtocolVersion()) : flags(0) {} + + QPID_COMMON_EXTERN void setName(const string& _name); + QPID_COMMON_EXTERN const string& getName() const; + QPID_COMMON_EXTERN bool hasName() const; + QPID_COMMON_EXTERN void clearNameFlag(); + typedef void ResultType; + + template ResultType invoke(T& invocable) const { + return invocable.timerWakeup(getName()); + } + + using AMQMethodBody::accept; + void accept(MethodBodyConstVisitor& v) const { v.visit(*this); } + boost::intrusive_ptr clone() const { return BodyFactory::copy(*this); } + + ClassId amqpClassId() const { return CLASS_ID; } + MethodId amqpMethodId() const { return METHOD_ID; } + bool isContentBearing() const { return false; } + bool resultExpected() const { return false; } + bool responseExpected() const { return false; } + QPID_COMMON_EXTERN void encode(Buffer&) const; + QPID_COMMON_EXTERN void decode(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN void encodeStructBody(Buffer&) const; + QPID_COMMON_EXTERN void decodeStructBody(Buffer&, uint32_t=0); + QPID_COMMON_EXTERN uint32_t encodedSize() const; + QPID_COMMON_EXTERN uint32_t bodySize() const; + QPID_COMMON_EXTERN void print(std::ostream& out) const; +}; /* class ClusterTimerWakeupBody */ + +}} +#endif /*!QPID_FRAMING_CLUSTERTIMERWAKEUPBODY_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/FieldTable.h b/nativeLib/org.apache.qpid/include/qpid/framing/FieldTable.h index 62b4a4bc08..fdb1a28b9d 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/FieldTable.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/FieldTable.h @@ -51,6 +51,7 @@ class FieldTable typedef boost::shared_ptr ValuePtr; typedef std::map ValueMap; typedef ValueMap::iterator iterator; + typedef ValueMap::const_iterator const_iterator; typedef ValueMap::const_reference const_reference; typedef ValueMap::reference reference; typedef ValueMap::value_type value_type; @@ -104,7 +105,7 @@ class FieldTable ValueMap::iterator end() { return values.end(); } ValueMap::iterator find(const std::string& s) { return values.find(s); } - std::pair insert(const ValueMap::value_type&); + QPID_COMMON_EXTERN std::pair insert(const ValueMap::value_type&); QPID_COMMON_EXTERN ValueMap::iterator insert(ValueMap::iterator, const ValueMap::value_type&); void clear() { values.clear(); } diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/FieldValue.h b/nativeLib/org.apache.qpid/include/qpid/framing/FieldValue.h index 60a887761f..19220e74d5 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/FieldValue.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/FieldValue.h @@ -83,7 +83,7 @@ class FieldValue { FieldValue(): data(0) {}; // Default assignment operator is fine void setType(uint8_t type); - QPID_COMMON_EXTERN uint8_t getType(); + QPID_COMMON_EXTERN uint8_t getType() const; Data& getData() { return *data; } uint32_t encodedSize() const { return 1 + data->encodedSize(); }; bool empty() const { return data.get() == 0; } @@ -99,6 +99,7 @@ class FieldValue { template T getIntegerValue() const; template T getFloatingPointValue() const; + template void getFixedWidthValue(unsigned char*) const; template bool get(T&) const; protected: @@ -122,7 +123,7 @@ template <> inline bool FieldValue::convertsTo() const { return data->convertsToString(); } template <> -inline int FieldValue::get() const { return data->getInt(); } +inline int FieldValue::get() const { return static_cast(data->getInt()); } template <> inline int64_t FieldValue::get() const { return data->getInt(); } @@ -202,13 +203,23 @@ inline T FieldValue::getFloatingPointValue() const { T value; uint8_t* const octets = convertIfRequired(fwv->rawOctets(), W); uint8_t* const target = reinterpret_cast(&value); - for (uint i = 0; i < W; ++i) target[i] = octets[i]; + for (size_t i = 0; i < W; ++i) target[i] = octets[i]; return value; } else { throw InvalidConversionException(); } } +template void FieldValue::getFixedWidthValue(unsigned char* value) const +{ + FixedWidthValue* const fwv = dynamic_cast< FixedWidthValue* const>(data.get()); + if (fwv) { + for (size_t i = 0; i < W; ++i) value[i] = fwv->rawOctets()[i]; + } else { + throw InvalidConversionException(); + } +} + template <> inline float FieldValue::get() const { return getFloatingPointValue(); @@ -324,6 +335,16 @@ class Str16Value : public FieldValue { QPID_COMMON_EXTERN Str16Value(const std::string& v); }; +class Var16Value : public FieldValue { + public: + QPID_COMMON_EXTERN Var16Value(const std::string& v, uint8_t code); +}; + +class Var32Value : public FieldValue { + public: + QPID_COMMON_EXTERN Var32Value(const std::string& v, uint8_t code); +}; + class Struct32Value : public FieldValue { public: QPID_COMMON_EXTERN Struct32Value(const std::string& v); @@ -417,6 +438,11 @@ class ListValue : public FieldValue { QPID_COMMON_EXTERN ListValue(const List&); }; +class UuidValue : public FieldValue { + public: + QPID_COMMON_EXTERN UuidValue(const unsigned char*); +}; + template bool getEncodedValue(FieldTable::ValuePtr vptr, T& value) { diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/MethodBodyConstVisitor.h b/nativeLib/org.apache.qpid/include/qpid/framing/MethodBodyConstVisitor.h index 29cfd8237c..19e85db755 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/MethodBodyConstVisitor.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/MethodBodyConstVisitor.h @@ -123,11 +123,16 @@ class ClusterReadyBody; class ClusterConfigChangeBody; class ClusterMessageExpiredBody; class ClusterErrorCheckBody; +class ClusterTimerWakeupBody; +class ClusterTimerDropBody; class ClusterShutdownBody; +class ClusterDeliverToQueueBody; class ClusterConnectionAnnounceBody; class ClusterConnectionDeliverCloseBody; class ClusterConnectionDeliverDoOutputBody; class ClusterConnectionAbortBody; +class ClusterConnectionShadowSetUserBody; +class ClusterConnectionShadowPrepareBody; class ClusterConnectionConsumerStateBody; class ClusterConnectionDeliveryRecordBody; class ClusterConnectionTxStartBody; @@ -147,6 +152,8 @@ class ClusterConnectionExchangeBody; class ClusterConnectionQueueBody; class ClusterConnectionExpiryIdBody; class ClusterConnectionAddQueueListenerBody; +class ClusterConnectionManagementSetupStateBody; +class ClusterConnectionConfigBody; class MethodBodyConstVisitor { public: @@ -243,11 +250,16 @@ class MethodBodyConstVisitor virtual void visit(const ClusterConfigChangeBody&) = 0; virtual void visit(const ClusterMessageExpiredBody&) = 0; virtual void visit(const ClusterErrorCheckBody&) = 0; + virtual void visit(const ClusterTimerWakeupBody&) = 0; + virtual void visit(const ClusterTimerDropBody&) = 0; virtual void visit(const ClusterShutdownBody&) = 0; + virtual void visit(const ClusterDeliverToQueueBody&) = 0; virtual void visit(const ClusterConnectionAnnounceBody&) = 0; virtual void visit(const ClusterConnectionDeliverCloseBody&) = 0; virtual void visit(const ClusterConnectionDeliverDoOutputBody&) = 0; virtual void visit(const ClusterConnectionAbortBody&) = 0; + virtual void visit(const ClusterConnectionShadowSetUserBody&) = 0; + virtual void visit(const ClusterConnectionShadowPrepareBody&) = 0; virtual void visit(const ClusterConnectionConsumerStateBody&) = 0; virtual void visit(const ClusterConnectionDeliveryRecordBody&) = 0; virtual void visit(const ClusterConnectionTxStartBody&) = 0; @@ -267,6 +279,8 @@ class MethodBodyConstVisitor virtual void visit(const ClusterConnectionQueueBody&) = 0; virtual void visit(const ClusterConnectionExpiryIdBody&) = 0; virtual void visit(const ClusterConnectionAddQueueListenerBody&) = 0; + virtual void visit(const ClusterConnectionManagementSetupStateBody&) = 0; + virtual void visit(const ClusterConnectionConfigBody&) = 0; }; }} // namespace qpid::framing diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/MethodBodyDefaultVisitor.h b/nativeLib/org.apache.qpid/include/qpid/framing/MethodBodyDefaultVisitor.h index 3d9b66f0bb..2f6e124b4e 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/MethodBodyDefaultVisitor.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/MethodBodyDefaultVisitor.h @@ -131,11 +131,16 @@ class MethodBodyDefaultVisitor: QPID_COMMON_EXTERN virtual void visit(const ClusterConfigChangeBody&); QPID_COMMON_EXTERN virtual void visit(const ClusterMessageExpiredBody&); QPID_COMMON_EXTERN virtual void visit(const ClusterErrorCheckBody&); + QPID_COMMON_EXTERN virtual void visit(const ClusterTimerWakeupBody&); + QPID_COMMON_EXTERN virtual void visit(const ClusterTimerDropBody&); QPID_COMMON_EXTERN virtual void visit(const ClusterShutdownBody&); + QPID_COMMON_EXTERN virtual void visit(const ClusterDeliverToQueueBody&); QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionAnnounceBody&); QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionDeliverCloseBody&); QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionDeliverDoOutputBody&); QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionAbortBody&); + QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionShadowSetUserBody&); + QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionShadowPrepareBody&); QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionConsumerStateBody&); QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionDeliveryRecordBody&); QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionTxStartBody&); @@ -155,6 +160,8 @@ class MethodBodyDefaultVisitor: QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionQueueBody&); QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionExpiryIdBody&); QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionAddQueueListenerBody&); + QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionManagementSetupStateBody&); + QPID_COMMON_EXTERN virtual void visit(const ClusterConnectionConfigBody&); }; }} // namespace qpid::framing diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/Uuid.h b/nativeLib/org.apache.qpid/include/qpid/framing/Uuid.h index 2cca6e9dfe..d357538b4d 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/Uuid.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/Uuid.h @@ -61,7 +61,7 @@ struct Uuid : public boost::array { void clear(); /** Test for null (all zeros). */ - bool isNull() const; + QPID_COMMON_EXTERN bool isNull() const; operator bool() const { return !isNull(); } bool operator!() const { return isNull(); } diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/all_method_bodies.h b/nativeLib/org.apache.qpid/include/qpid/framing/all_method_bodies.h index 914cf03cdd..b19fcec988 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/all_method_bodies.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/all_method_bodies.h @@ -119,11 +119,16 @@ #include "qpid/framing/ClusterConfigChangeBody.h" #include "qpid/framing/ClusterMessageExpiredBody.h" #include "qpid/framing/ClusterErrorCheckBody.h" +#include "qpid/framing/ClusterTimerWakeupBody.h" +#include "qpid/framing/ClusterTimerDropBody.h" #include "qpid/framing/ClusterShutdownBody.h" +#include "qpid/framing/ClusterDeliverToQueueBody.h" #include "qpid/framing/ClusterConnectionAnnounceBody.h" #include "qpid/framing/ClusterConnectionDeliverCloseBody.h" #include "qpid/framing/ClusterConnectionDeliverDoOutputBody.h" #include "qpid/framing/ClusterConnectionAbortBody.h" +#include "qpid/framing/ClusterConnectionShadowSetUserBody.h" +#include "qpid/framing/ClusterConnectionShadowPrepareBody.h" #include "qpid/framing/ClusterConnectionConsumerStateBody.h" #include "qpid/framing/ClusterConnectionDeliveryRecordBody.h" #include "qpid/framing/ClusterConnectionTxStartBody.h" @@ -143,4 +148,6 @@ #include "qpid/framing/ClusterConnectionQueueBody.h" #include "qpid/framing/ClusterConnectionExpiryIdBody.h" #include "qpid/framing/ClusterConnectionAddQueueListenerBody.h" +#include "qpid/framing/ClusterConnectionManagementSetupStateBody.h" +#include "qpid/framing/ClusterConnectionConfigBody.h" #endif /*!QPID_FRAMING_ALL_METHOD_BODIES_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/constants.h b/nativeLib/org.apache.qpid/include/qpid/framing/constants.h index acb8169c04..142700b338 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/constants.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/constants.h @@ -136,12 +136,17 @@ enum AmqpConstant { CLUSTER_CONFIG_CHANGE_METHOD_ID=0x11, CLUSTER_MESSAGE_EXPIRED_METHOD_ID=0x12, CLUSTER_ERROR_CHECK_METHOD_ID=0x14, + CLUSTER_TIMER_WAKEUP_METHOD_ID=0x15, + CLUSTER_TIMER_DROP_METHOD_ID=0x16, CLUSTER_SHUTDOWN_METHOD_ID=0x20, + CLUSTER_DELIVER_TO_QUEUE_METHOD_ID=0x21, CLUSTER_CONNECTION_CLASS_ID=0x81, CLUSTER_CONNECTION_ANNOUNCE_METHOD_ID=0x1, CLUSTER_CONNECTION_DELIVER_CLOSE_METHOD_ID=0x2, CLUSTER_CONNECTION_DELIVER_DO_OUTPUT_METHOD_ID=0x3, CLUSTER_CONNECTION_ABORT_METHOD_ID=0x4, + CLUSTER_CONNECTION_SHADOW_SET_USER_METHOD_ID=0x0E, + CLUSTER_CONNECTION_SHADOW_PREPARE_METHOD_ID=0x0F, CLUSTER_CONNECTION_CONSUMER_STATE_METHOD_ID=0x10, CLUSTER_CONNECTION_DELIVERY_RECORD_METHOD_ID=0x11, CLUSTER_CONNECTION_TX_START_METHOD_ID=0x12, @@ -160,7 +165,9 @@ enum AmqpConstant { CLUSTER_CONNECTION_EXCHANGE_METHOD_ID=0x31, CLUSTER_CONNECTION_QUEUE_METHOD_ID=0x32, CLUSTER_CONNECTION_EXPIRY_ID_METHOD_ID=0x33, - CLUSTER_CONNECTION_ADD_QUEUE_LISTENER_METHOD_ID=0x34 + CLUSTER_CONNECTION_ADD_QUEUE_LISTENER_METHOD_ID=0x34, + CLUSTER_CONNECTION_MANAGEMENT_SETUP_STATE_METHOD_ID=0x36, + CLUSTER_CONNECTION_CONFIG_METHOD_ID=0x37 }; }} // namespace qpid::framing diff --git a/nativeLib/org.apache.qpid/include/qpid/framing/frame_body_lists.h b/nativeLib/org.apache.qpid/include/qpid/framing/frame_body_lists.h index b58f88b692..4634ebac53 100644 --- a/nativeLib/org.apache.qpid/include/qpid/framing/frame_body_lists.h +++ b/nativeLib/org.apache.qpid/include/qpid/framing/frame_body_lists.h @@ -123,11 +123,16 @@ (ClusterConfigChangeBody) \ (ClusterMessageExpiredBody) \ (ClusterErrorCheckBody) \ + (ClusterTimerWakeupBody) \ + (ClusterTimerDropBody) \ (ClusterShutdownBody) \ + (ClusterDeliverToQueueBody) \ (ClusterConnectionAnnounceBody) \ (ClusterConnectionDeliverCloseBody) \ (ClusterConnectionDeliverDoOutputBody) \ (ClusterConnectionAbortBody) \ + (ClusterConnectionShadowSetUserBody) \ + (ClusterConnectionShadowPrepareBody) \ (ClusterConnectionConsumerStateBody) \ (ClusterConnectionDeliveryRecordBody) \ (ClusterConnectionTxStartBody) \ @@ -146,7 +151,9 @@ (ClusterConnectionExchangeBody) \ (ClusterConnectionQueueBody) \ (ClusterConnectionExpiryIdBody) \ - (ClusterConnectionAddQueueListenerBody) + (ClusterConnectionAddQueueListenerBody) \ + (ClusterConnectionManagementSetupStateBody) \ + (ClusterConnectionConfigBody) #define OTHER_BODIES() (AMQContentBody)(AMQHeaderBody)(AMQHeartbeatBody)) diff --git a/nativeLib/org.apache.qpid/include/qpid/log/Statement.h b/nativeLib/org.apache.qpid/include/qpid/log/Statement.h index 8f73175630..7b3ab60b81 100644 --- a/nativeLib/org.apache.qpid/include/qpid/log/Statement.h +++ b/nativeLib/org.apache.qpid/include/qpid/log/Statement.h @@ -95,6 +95,24 @@ struct Statement { stmt_.log(::qpid::Msg() << MESSAGE); \ } while(0) +/** + * FLAG must be a boolean variable. Assigns FLAG to true iff logging + * is enabled for LEVEL in the calling context. Use when extra + * support code is needed to generate log messages, to ensure that it + * is only run if the logging level is enabled. + * e.g. + * bool logWarning; + * QPID_LOG_TEST(LEVEL, logWarning); + * if (logWarning) { do stuff needed for warning log messages } + */ +#define QPID_LOG_TEST(LEVEL, FLAG) \ + do { \ + using ::qpid::log::Statement; \ + static Statement stmt_= QPID_LOG_STATEMENT_INIT(LEVEL); \ + static Statement::Initializer init_(stmt_); \ + FLAG = stmt_.enabled; \ + } while(0) + /** * Macro for log statements. Example of use: * @code diff --git a/nativeLib/org.apache.qpid/include/qpid/management/Buffer.h b/nativeLib/org.apache.qpid/include/qpid/management/Buffer.h new file mode 100644 index 0000000000..c32494b8c0 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/management/Buffer.h @@ -0,0 +1,106 @@ +#ifndef _Management_Buffer_ +#define _Management_Buffer_ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +#include "qpid/CommonImportExport.h" +#include "qpid/types/Exception.h" +#include "qpid/types/Variant.h" +#include + +namespace qpid { +namespace framing { + class Buffer; +} + +namespace management { + +struct OutOfBounds : qpid::types::Exception { + OutOfBounds() : qpid::types::Exception(std::string("Out of Bounds")) {} +}; + + +/** + * This class is a wrapper around qpid::framing::Buffer that does not include any dependencies + * from boost or from qpid::framing. + */ +class Buffer +{ +public: + QPID_COMMON_EXTERN Buffer(char* data=0, uint32_t size=0); + QPID_COMMON_EXTERN ~Buffer(); + + QPID_COMMON_EXTERN void record(); + QPID_COMMON_EXTERN void restore(bool reRecord = false); + QPID_COMMON_EXTERN void reset(); + + QPID_COMMON_EXTERN uint32_t available(); + QPID_COMMON_EXTERN uint32_t getSize(); + QPID_COMMON_EXTERN uint32_t getPosition(); + QPID_COMMON_EXTERN char* getPointer(); + + QPID_COMMON_EXTERN void putOctet(uint8_t i); + QPID_COMMON_EXTERN void putShort(uint16_t i); + QPID_COMMON_EXTERN void putLong(uint32_t i); + QPID_COMMON_EXTERN void putLongLong(uint64_t i); + QPID_COMMON_EXTERN void putInt8(int8_t i); + QPID_COMMON_EXTERN void putInt16(int16_t i); + QPID_COMMON_EXTERN void putInt32(int32_t i); + QPID_COMMON_EXTERN void putInt64(int64_t i); + QPID_COMMON_EXTERN void putFloat(float f); + QPID_COMMON_EXTERN void putDouble(double f); + QPID_COMMON_EXTERN void putBin128(const uint8_t* b); + + QPID_COMMON_EXTERN uint8_t getOctet(); + QPID_COMMON_EXTERN uint16_t getShort(); + QPID_COMMON_EXTERN uint32_t getLong(); + QPID_COMMON_EXTERN uint64_t getLongLong(); + QPID_COMMON_EXTERN int8_t getInt8(); + QPID_COMMON_EXTERN int16_t getInt16(); + QPID_COMMON_EXTERN int32_t getInt32(); + QPID_COMMON_EXTERN int64_t getInt64(); + QPID_COMMON_EXTERN float getFloat(); + QPID_COMMON_EXTERN double getDouble(); + + QPID_COMMON_EXTERN void putShortString(const std::string& s); + QPID_COMMON_EXTERN void putMediumString(const std::string& s); + QPID_COMMON_EXTERN void putLongString(const std::string& s); + QPID_COMMON_EXTERN void getShortString(std::string& s); + QPID_COMMON_EXTERN void getMediumString(std::string& s); + QPID_COMMON_EXTERN void getLongString(std::string& s); + QPID_COMMON_EXTERN void getBin128(uint8_t* b); + + QPID_COMMON_EXTERN void putMap(const types::Variant::Map& map); + QPID_COMMON_EXTERN void putList(const types::Variant::List& list); + QPID_COMMON_EXTERN void getMap(types::Variant::Map& map); + QPID_COMMON_EXTERN void getList(types::Variant::List& list); + + QPID_COMMON_EXTERN void putRawData(const std::string& s); + QPID_COMMON_EXTERN void getRawData(std::string& s, uint32_t size); + + QPID_COMMON_EXTERN void putRawData(const uint8_t* data, size_t size); + QPID_COMMON_EXTERN void getRawData(uint8_t* data, size_t size); + +private: + framing::Buffer* impl; +}; + +}} // namespace qpid::management + +#endif diff --git a/nativeLib/org.apache.qpid/include/qpid/management/ConnectionSettings.h b/nativeLib/org.apache.qpid/include/qpid/management/ConnectionSettings.h new file mode 100644 index 0000000000..b631ffa658 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/management/ConnectionSettings.h @@ -0,0 +1,118 @@ +#ifndef _management_ConnectionSettings_h +#define _management_ConnectionSettings_h +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#include "qpid/CommonImportExport.h" +#include "qpid/types/Variant.h" +#include + +namespace qpid { +namespace management { + +/** + * Settings for a Connection. + */ +struct ConnectionSettings { + + QPID_COMMON_EXTERN ConnectionSettings(); + QPID_COMMON_EXTERN virtual ~ConnectionSettings(); + + /** + * The protocol used for the connection (defaults to 'tcp') + */ + std::string protocol; + + /** + * The host (or ip address) to connect to (defaults to 'localhost'). + */ + std::string host; + /** + * The port to connect to (defaults to 5672). + */ + uint16_t port; + /** + * Allows an AMQP 'virtual host' to be specified for the + * connection. + */ + std::string virtualhost; + + /** + * The username to use when authenticating the connection. If not + * specified the current users login is used if available. + */ + std::string username; + /** + * The password to use when authenticating the connection. + */ + std::string password; + /** + * The SASL mechanism to use when authenticating the connection; + * the options are currently PLAIN or ANONYMOUS. + */ + std::string mechanism; + /** + * Allows a locale to be specified for the connection. + */ + std::string locale; + /** + * Allows a heartbeat frequency to be specified + */ + uint16_t heartbeat; + /** + * The maximum number of channels that the client will request for + * use on this connection. + */ + uint16_t maxChannels; + /** + * The maximum frame size that the client will request for this + * connection. + */ + uint16_t maxFrameSize; + /** + * Limit the size of the connections send buffer . The buffer + * is limited to bounds * maxFrameSize. + */ + unsigned int bounds; + /** + * If true, TCP_NODELAY will be set for the connection. + */ + bool tcpNoDelay; + /** + * SASL service name + */ + std::string service; + /** + * Minimum acceptable strength of any SASL negotiated security + * layer. 0 means no security layer required. + */ + unsigned int minSsf; + /** + * Maximum acceptable strength of any SASL negotiated security + * layer. 0 means no security layer allowed. + */ + unsigned int maxSsf; +}; + +}} + +#endif + diff --git a/nativeLib/org.apache.qpid/include/qpid/management/Manageable.h b/nativeLib/org.apache.qpid/include/qpid/management/Manageable.h index 7a72cc1592..1e5cd8bc42 100644 --- a/nativeLib/org.apache.qpid/include/qpid/management/Manageable.h +++ b/nativeLib/org.apache.qpid/include/qpid/management/Manageable.h @@ -63,6 +63,11 @@ class QPID_COMMON_EXTERN Manageable // method being called and must be down-cast to the appropriate sub class // before use. virtual status_t ManagementMethod(uint32_t methodId, Args& args, std::string& text); + + // This optional method can be overridden to allow the agent application to + // authorize method invocations. Return true iff the authenticated user identified + // in userId us authorized to execute the method. + virtual bool AuthorizeMethod(uint32_t methodId, Args& args, const std::string& userId); }; inline Manageable::~Manageable(void) {} diff --git a/nativeLib/org.apache.qpid/include/qpid/management/ManagementEvent.h b/nativeLib/org.apache.qpid/include/qpid/management/ManagementEvent.h index 01b9ae49ec..e80175096f 100644 --- a/nativeLib/org.apache.qpid/include/qpid/management/ManagementEvent.h +++ b/nativeLib/org.apache.qpid/include/qpid/management/ManagementEvent.h @@ -23,7 +23,7 @@ */ #include "qpid/management/ManagementObject.h" -#include +#include "qpid/types/Variant.h" #include namespace qpid { @@ -32,16 +32,20 @@ namespace management { class ManagementAgent; class ManagementEvent : public ManagementItem { -public: - typedef void (*writeSchemaCall_t)(qpid::framing::Buffer&); + public: + static const uint8_t MD5_LEN = 16; + //typedef void (*writeSchemaCall_t)(qpid::framing::Buffer&); + typedef void (*writeSchemaCall_t)(std::string&); virtual ~ManagementEvent() {} virtual writeSchemaCall_t getWriteSchemaCall(void) = 0; + //virtual mapEncodeSchemaCall_t getMapEncodeSchemaCall(void) = 0; virtual std::string& getEventName() const = 0; virtual std::string& getPackageName() const = 0; virtual uint8_t* getMd5Sum() const = 0; virtual uint8_t getSeverity() const = 0; - virtual void encode(qpid::framing::Buffer&) const = 0; + virtual void encode(std::string&) const = 0; + virtual void mapEncode(qpid::types::Variant::Map&) const = 0; }; }} diff --git a/nativeLib/org.apache.qpid/include/qpid/management/ManagementObject.h b/nativeLib/org.apache.qpid/include/qpid/management/ManagementObject.h index d0a443d6cb..747edda150 100644 --- a/nativeLib/org.apache.qpid/include/qpid/management/ManagementObject.h +++ b/nativeLib/org.apache.qpid/include/qpid/management/ManagementObject.h @@ -21,18 +21,20 @@ * under the License. * */ - -#include "qpid/sys/Time.h" -#include "qpid/sys/Mutex.h" -#include #include "qpid/CommonImportExport.h" + +#include "qpid/management/Mutex.h" +#include "qpid/types/Variant.h" + #include +#include namespace qpid { namespace management { class Manageable; class ObjectId; +class ManagementObject; class AgentAttachment { @@ -51,18 +53,38 @@ protected: const AgentAttachment* agent; uint64_t first; uint64_t second; + uint64_t agentEpoch; + std::string v2Key; + std::string agentName; void fromString(const std::string&); public: - QPID_COMMON_EXTERN ObjectId() : agent(0), first(0), second(0) {} - QPID_COMMON_EXTERN ObjectId(framing::Buffer& buf) : agent(0) { decode(buf); } - QPID_COMMON_EXTERN ObjectId(uint8_t flags, uint16_t seq, uint32_t broker, uint32_t bank, uint64_t object); - QPID_COMMON_EXTERN ObjectId(AgentAttachment* _agent, uint8_t flags, uint16_t seq, uint64_t object); + QPID_COMMON_EXTERN ObjectId() : agent(0), first(0), second(0), agentEpoch(0) {} + QPID_COMMON_EXTERN ObjectId(const types::Variant& map) : + agent(0), first(0), second(0), agentEpoch(0) { mapDecode(map.asMap()); } + QPID_COMMON_EXTERN ObjectId(uint8_t flags, uint16_t seq, uint32_t broker); + QPID_COMMON_EXTERN ObjectId(AgentAttachment* _agent, uint8_t flags, uint16_t seq); QPID_COMMON_EXTERN ObjectId(std::istream&); QPID_COMMON_EXTERN ObjectId(const std::string&); + QPID_COMMON_EXTERN ObjectId(const std::string& agentAddress, const std::string& key, + uint64_t epoch=0) : agent(0), first(0), second(0), + agentEpoch(epoch), v2Key(key), agentName(agentAddress) {} + + // Deprecated: + QPID_COMMON_EXTERN ObjectId(uint8_t flags, uint16_t seq, uint32_t broker, uint64_t object); QPID_COMMON_EXTERN bool operator==(const ObjectId &other) const; QPID_COMMON_EXTERN bool operator<(const ObjectId &other) const; - QPID_COMMON_EXTERN void encode(framing::Buffer& buffer); - QPID_COMMON_EXTERN void decode(framing::Buffer& buffer); + QPID_COMMON_EXTERN void mapEncode(types::Variant::Map& map) const; + QPID_COMMON_EXTERN void mapDecode(const types::Variant::Map& map); + QPID_COMMON_EXTERN operator types::Variant::Map() const; + QPID_COMMON_EXTERN uint32_t encodedSize() const { return 16; }; + QPID_COMMON_EXTERN void encode(std::string& buffer) const; + QPID_COMMON_EXTERN void decode(const std::string& buffer); + QPID_COMMON_EXTERN bool equalV1(const ObjectId &other) const; + QPID_COMMON_EXTERN void setV2Key(const std::string& _key) { v2Key = _key; } + QPID_COMMON_EXTERN void setV2Key(const ManagementObject& object); + QPID_COMMON_EXTERN void setAgentName(const std::string& _name) { agentName = _name; } + QPID_COMMON_EXTERN const std::string& getAgentName() const { return agentName; } + QPID_COMMON_EXTERN const std::string& getV2Key() const { return v2Key; } friend QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, const ObjectId&); }; @@ -86,6 +108,7 @@ public: static const uint8_t TYPE_S16 = 17; static const uint8_t TYPE_S32 = 18; static const uint8_t TYPE_S64 = 19; + static const uint8_t TYPE_LIST = 21; static const uint8_t ACCESS_RC = 1; static const uint8_t ACCESS_RW = 2; @@ -116,37 +139,56 @@ protected: uint64_t destroyTime; uint64_t updateTime; ObjectId objectId; - bool configChanged; - bool instChanged; + mutable bool configChanged; + mutable bool instChanged; bool deleted; Manageable* coreObject; - sys::Mutex accessLock; + mutable Mutex accessLock; uint32_t flags; static int nextThreadIndex; bool forcePublish; QPID_COMMON_EXTERN int getThreadIndex(); - QPID_COMMON_EXTERN void writeTimestamps(qpid::framing::Buffer& buf); + QPID_COMMON_EXTERN void writeTimestamps(std::string& buf) const; + QPID_COMMON_EXTERN void readTimestamps(const std::string& buf); + QPID_COMMON_EXTERN uint32_t writeTimestampsSize() const; public: + QPID_COMMON_EXTERN static const uint8_t MD5_LEN = 16; QPID_COMMON_EXTERN static int maxThreads; - typedef void (*writeSchemaCall_t) (qpid::framing::Buffer&); + //typedef void (*writeSchemaCall_t) (qpid::framing::Buffer&); + typedef void (*writeSchemaCall_t) (std::string&); - ManagementObject(Manageable* _core) : - createTime(uint64_t(qpid::sys::Duration(qpid::sys::now()))), - destroyTime(0), updateTime(createTime), configChanged(true), - instChanged(true), deleted(false), - coreObject(_core), forcePublish(false) {} + QPID_COMMON_EXTERN ManagementObject(Manageable* _core); virtual ~ManagementObject() {} virtual writeSchemaCall_t getWriteSchemaCall() = 0; - virtual void writeProperties(qpid::framing::Buffer& buf) = 0; - virtual void writeStatistics(qpid::framing::Buffer& buf, - bool skipHeaders = false) = 0; + virtual std::string getKey() const = 0; + + // Encode & Decode the property and statistics values + // for this object. + virtual void mapEncodeValues(types::Variant::Map& map, + bool includeProperties, + bool includeStatistics) = 0; + virtual void mapDecodeValues(const types::Variant::Map& map) = 0; virtual void doMethod(std::string& methodName, - qpid::framing::Buffer& inBuf, - qpid::framing::Buffer& outBuf) = 0; + const types::Variant::Map& inMap, + types::Variant::Map& outMap, + const std::string& userId) = 0; + QPID_COMMON_EXTERN void writeTimestamps(types::Variant::Map& map) const; + QPID_COMMON_EXTERN void readTimestamps(const types::Variant::Map& buf); + + /** + * The following five methods are not pure-virtual because they will only + * be overridden in cases where QMFv1 is to be supported. + */ + virtual uint32_t writePropertiesSize() const { return 0; } + virtual void readProperties(const std::string&) {} + virtual void writeProperties(std::string&) const {} + virtual void writeStatistics(std::string&, bool = false) {} + virtual void doMethod(std::string&, const std::string&, std::string&, const std::string&) {} + QPID_COMMON_EXTERN virtual void setReference(ObjectId objectId); virtual std::string& getClassName() const = 0; @@ -160,25 +202,33 @@ protected: virtual bool hasInst() { return true; } inline void setForcePublish(bool f) { forcePublish = f; } inline bool getForcePublish() { return forcePublish; } - inline void setUpdateTime() { updateTime = (uint64_t(sys::Duration(sys::now()))); } - - inline void resourceDestroy() { - destroyTime = uint64_t (qpid::sys::Duration(qpid::sys::now())); - deleted = true; - } + QPID_COMMON_EXTERN void setUpdateTime(); + QPID_COMMON_EXTERN void resourceDestroy(); inline bool isDeleted() { return deleted; } inline void setFlags(uint32_t f) { flags = f; } inline uint32_t getFlags() { return flags; } bool isSameClass(ManagementObject& other) { - for (int idx = 0; idx < 16; idx++) + for (int idx = 0; idx < MD5_LEN; idx++) if (other.getMd5Sum()[idx] != getMd5Sum()[idx]) return false; return other.getClassName() == getClassName() && other.getPackageName() == getPackageName(); } + + // QPID_COMMON_EXTERN void encode(qpid::framing::Buffer& buf) const { writeProperties(buf); } + // QPID_COMMON_EXTERN void decode(qpid::framing::Buffer& buf) { readProperties(buf); } + //QPID_COMMON_EXTERN uint32_t encodedSize() const { return writePropertiesSize(); } + + // Encode/Decode the entire object as a map + //QPID_COMMON_EXTERN void mapEncode(types::Variant::Map& map, + //bool includeProperties=true, + //bool includeStatistics=true); + + //QPID_COMMON_EXTERN void mapDecode(const types::Variant::Map& map); }; typedef std::map ManagementObjectMap; +typedef std::vector ManagementObjectVector; }} diff --git a/nativeLib/org.apache.qpid/include/qpid/management/Mutex.h b/nativeLib/org.apache.qpid/include/qpid/management/Mutex.h new file mode 100644 index 0000000000..67ae04bae9 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/management/Mutex.h @@ -0,0 +1,67 @@ +#ifndef _management_Mutex_h +#define _management_Mutex_h + +/* + * + * Copyright (c) 2008 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "qpid/CommonImportExport.h" + +namespace qpid { + namespace sys { + class Mutex; + } + + namespace management { + + /** + * Scoped lock template: calls lock() in ctor, unlock() in dtor. + * L can be any class with lock() and unlock() functions. + */ + template class ScopedLockTemplate { + public: + ScopedLockTemplate(L& l) : mutex(l) { mutex.lock(); } + ~ScopedLockTemplate() { mutex.unlock(); } + private: + L& mutex; + }; + + template class ScopedUnlockTemplate { + public: + ScopedUnlockTemplate(L& l) : mutex(l) { mutex.unlock(); } + ~ScopedUnlockTemplate() { mutex.lock(); } + private: + L& mutex; + }; + + class Mutex { + public: + typedef ScopedLockTemplate ScopedLock; + typedef ScopedUnlockTemplate ScopedUnlock; + + QPID_COMMON_EXTERN Mutex(); + QPID_COMMON_EXTERN ~Mutex(); + QPID_COMMON_EXTERN void lock(); + QPID_COMMON_EXTERN void unlock(); + private: + sys::Mutex* impl; + }; + } +} + +#endif + diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/Address.h b/nativeLib/org.apache.qpid/include/qpid/messaging/Address.h index 538cb6507c..2e36d0ae22 100644 --- a/nativeLib/org.apache.qpid/include/qpid/messaging/Address.h +++ b/nativeLib/org.apache.qpid/include/qpid/messaging/Address.h @@ -21,28 +21,20 @@ * under the License. * */ +#include "qpid/messaging/ImportExport.h" + +#include "qpid/messaging/exceptions.h" +#include "qpid/types/Variant.h" + #include -#include "qpid/Exception.h" -#include "qpid/messaging/Variant.h" -#include "qpid/client/ClientImportExport.h" #include namespace qpid { namespace messaging { -struct InvalidAddress : public qpid::Exception -{ - InvalidAddress(const std::string& msg); -}; - -struct MalformedAddress : public qpid::Exception -{ - MalformedAddress(const std::string& msg); -}; - class AddressImpl; -/** +/** \ingroup messaging * Represents an address to which messages can be sent and from which * messages can be received. Often a simple name is sufficient for * this, however this can be augmented with a subject pattern and @@ -65,111 +57,105 @@ class AddressImpl; * * * - * + * + * + * + * * - * + * + * + * + * * - * + * + * + * + * * - * + * + + * + * + * + * + * + * + * * - * The valid node-properties are: - *
    - *
  • type - queue or topic
  • - * - *
  • durable - true or false
  • - * - *
  • x-properties - a nested map that can contain implementation or - * protocol specifiec extedned properties. For the amqp 0-10 mapping, - * the fields in queue- or exchange- declare can be specified in here; - * anything that is not recognised as one of those will be passed - * through in the arguments field.,/li> - *
- * - * - *
createIndicate whether the address should be - * automatically created or not. Can be one of always, - * never, sender or receiver. The properties of - * the node to be created can be specified via the node-properties - * option (see below).
createIndicate whether the address should be automatically created + * or not. Can be one of always, never, + * sender or receiver. The properties of the node + * to be created can be specified via the node options (see + * below). + *
assertIndicate whether or not to assert any specified - * node-properties match the address. Can be one of always, - * never, sender or receiver.
assertIndicate whether or not to assert any specified node + * properties(see below) match the address. Can be one of + * always, never, sender or + * receiver. + *
deleteIndicate whether or not to delete the addressed - * nide when a sender or receiver is cancelled. Can be one of always, - * never, sender or receiver.
deleteIndicate whether or not to delete the addressed node when a + * sender or receiver is cancelled. Can be one of always, + * never, sender or receiver. + *
node-propertiesA nested map of properties of the addressed - * entity or 'node'. These can be used when automatically creating it, - * or to assert certain properties. + *
nodeA nested map describing properties of the addressed + * node. Current properties supported are type (topic or queue), + * durable (boolean), x-declare and x-bindings. The x-declare + * option is a nested map in whcih protocol amqp 0-10 specific + * options for queue or exchange declare can be specified. The + * x-bindings option is a nested list, each element of which can + * specify a queue, an exchange, a binding-key and arguments, + * which are used to establish a binding on create. The node + * will be used if queue or exchange values are not specified. + *
linkA nested map through which properties of the 'link' from + * sender/receiver to node can be configured. Current propeties + * are name, durable, realiability, x-declare, x-subscribe and + * x-bindings. + *
- * - * For receivers there are some further options of interest: + * For receivers there is one other option of interest: * * - * - * - * - * - * - * - * - * - * - * - * - * + * *
no-local(only relevant for topics at present) specifies that the - * receiver does not want to receiver messages published to the topic - * that originate from a sender on the same connection
browse(only relevant for queues) specifies that the receiver - * does not wish to consume the messages, but merely browse them
durable(only relevant for topics at present) specifies that a - * durable subscription is required
reliabilityindicates the level of reliability that the receiver - * expects. Can be one of unreliable, at-most-once, at-least-once or - * exactly-once (the latter is not yet correctly supported).
filter(only relevant for topics at present) allows bindings to - * be created for the queue that match the given criteris (or list of - * criteria).
x-propertiesallows protocol or implementation specific options - * to be specified for a receiver; this is a nested map and currently - * the implementation only recognises two specific nested properties - * within it (all others are passed through in the arguments of the - * message-subscribe command): - * - *
    - *
  • exclusive, which requests an exclusive subscription and - * is only relevant for queues
  • - * - *
  • x-queue-arguments, which ais only relevant for topics and - * allows arguments to the queue-declare for the subscription - * queue to be specified
  • - *
- *
mode(only relevant for queues) + * indicates whether the subscribe should consume (the default) or + * merely browse the messages. Valid values are 'consume' and + * 'browse'
+ * + * An address has value semantics. */ class Address { public: - QPID_CLIENT_EXTERN Address(); - QPID_CLIENT_EXTERN Address(const std::string& address); - QPID_CLIENT_EXTERN Address(const std::string& name, const std::string& subject, - const Variant::Map& options, const std::string& type = ""); - QPID_CLIENT_EXTERN Address(const Address& address); - QPID_CLIENT_EXTERN ~Address(); - QPID_CLIENT_EXTERN Address& operator=(const Address&); - QPID_CLIENT_EXTERN const std::string& getName() const; - QPID_CLIENT_EXTERN void setName(const std::string&); - QPID_CLIENT_EXTERN const std::string& getSubject() const; - QPID_CLIENT_EXTERN void setSubject(const std::string&); - QPID_CLIENT_EXTERN bool hasSubject() const; - QPID_CLIENT_EXTERN const Variant::Map& getOptions() const; - QPID_CLIENT_EXTERN Variant::Map& getOptions(); - QPID_CLIENT_EXTERN void setOptions(const Variant::Map&); + QPID_MESSAGING_EXTERN Address(); + QPID_MESSAGING_EXTERN Address(const std::string& address); + QPID_MESSAGING_EXTERN Address(const std::string& name, const std::string& subject, + const qpid::types::Variant::Map& options, const std::string& type = ""); + QPID_MESSAGING_EXTERN Address(const Address& address); + QPID_MESSAGING_EXTERN ~Address(); + QPID_MESSAGING_EXTERN Address& operator=(const Address&); + QPID_MESSAGING_EXTERN const std::string& getName() const; + QPID_MESSAGING_EXTERN void setName(const std::string&); + QPID_MESSAGING_EXTERN const std::string& getSubject() const; + QPID_MESSAGING_EXTERN void setSubject(const std::string&); + QPID_MESSAGING_EXTERN const qpid::types::Variant::Map& getOptions() const; + QPID_MESSAGING_EXTERN qpid::types::Variant::Map& getOptions(); + QPID_MESSAGING_EXTERN void setOptions(const qpid::types::Variant::Map&); - QPID_CLIENT_EXTERN std::string getType() const; - QPID_CLIENT_EXTERN void setType(const std::string&); + QPID_MESSAGING_EXTERN std::string getType() const; + /** + * The type of and addressed node influences how receivers and + * senders are constructed for it. It also affects how a reply-to + * address is encoded. If the type is not specified in the address + * itself, it will be automatically determined by querying the + * broker. The type can be explicitly set to prevent this if + * needed. + */ + QPID_MESSAGING_EXTERN void setType(const std::string&); - QPID_CLIENT_EXTERN const Variant& getOption(const std::string& key) const; - - QPID_CLIENT_EXTERN std::string toStr() const; - QPID_CLIENT_EXTERN operator bool() const; - QPID_CLIENT_EXTERN bool operator !() const; + QPID_MESSAGING_EXTERN std::string str() const; + QPID_MESSAGING_EXTERN operator bool() const; + QPID_MESSAGING_EXTERN bool operator !() const; private: AddressImpl* impl; }; -QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const Address& address); +QPID_MESSAGING_EXTERN std::ostream& operator<<(std::ostream& out, const Address& address); }} // namespace qpid::messaging diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/Connection.h b/nativeLib/org.apache.qpid/include/qpid/messaging/Connection.h index 5c5246ff82..6f2cd54b4b 100644 --- a/nativeLib/org.apache.qpid/include/qpid/messaging/Connection.h +++ b/nativeLib/org.apache.qpid/include/qpid/messaging/Connection.h @@ -21,27 +21,32 @@ * under the License. * */ +#include "qpid/messaging/ImportExport.h" + +#include "qpid/messaging/Handle.h" +#include "qpid/messaging/exceptions.h" +#include "qpid/types/Variant.h" + #include -#include "qpid/client/ClientImportExport.h" -#include "qpid/client/Handle.h" -#include "qpid/messaging/Variant.h" namespace qpid { -namespace client { - -template class PrivateImplRef; - -} - namespace messaging { +template class PrivateImplRef; class ConnectionImpl; class Session; -class Connection : public qpid::client::Handle +/** \ingroup messaging + * A connection represents a network connection to a remote endpoint. + */ + +class Connection : public qpid::messaging::Handle { public: - /** + QPID_MESSAGING_EXTERN Connection(ConnectionImpl* impl); + QPID_MESSAGING_EXTERN Connection(const Connection&); + QPID_MESSAGING_EXTERN Connection(); + /** * Current implementation supports the following options: * * username @@ -49,57 +54,56 @@ class Connection : public qpid::client::Handle * heartbeat * tcp-nodelay * sasl-mechanism + * sasl-service * sasl-min-ssf * sasl-max-ssf + * transport * - * (note also bounds, locale, max-channels and max-framesize, but not sure whether those should be docuemented here) + * Reconnect behaviour can be controlled through the following options: * - * Retry behaviour can be controlled through the following options: + * reconnect: true/false (enables/disables reconnect entirely) + * reconnect-timeout: number of seconds (give up and report failure after specified time) + * reconnect-limit: n (give up and report failure after specified number of attempts) + * reconnect-interval-min: number of seconds (initial delay between failed reconnection attempts) + * reconnect-interval-max: number of seconds (maximum delay between failed reconnection attempts) + * reconnect-interval: shorthand for setting the same reconnect_interval_min/max + * reconnect-urls: list of alternate urls to try when connecting * - * reconnection-timeout - determines how long it will try to - * reconnect for -1 means forever, 0 - * means don't try to reconnect - * min-retry-interval - * max-retry-interval - * - * The retry-interval is the time that the client waits for - * after a failed attempt to reconnect before retrying. It + * The reconnect-interval is the time that the client waits + * for after a failed attempt to reconnect before retrying. It * starts at the value of the min-retry-interval and is * doubled every failure until the value of max-retry-interval * is reached. - * - * */ - static QPID_CLIENT_EXTERN Connection open(const std::string& url, const Variant::Map& options = Variant::Map()); + QPID_MESSAGING_EXTERN Connection(const std::string& url, const qpid::types::Variant::Map& options = qpid::types::Variant::Map()); + /** + * Creates a connection using an option string of the form + * {name:value,name2:value2...}, see above for options supported. + * + * @exception InvalidOptionString if the string does not match the correct syntax + */ + QPID_MESSAGING_EXTERN Connection(const std::string& url, const std::string& options); + QPID_MESSAGING_EXTERN ~Connection(); + QPID_MESSAGING_EXTERN Connection& operator=(const Connection&); + QPID_MESSAGING_EXTERN void setOption(const std::string& name, const qpid::types::Variant& value); + QPID_MESSAGING_EXTERN void open(); + QPID_MESSAGING_EXTERN bool isOpen(); + /** + * Closes a connection and all sessions associated with it. An + * opened connection must be closed before the last handle is + * allowed to go out of scope. + */ + QPID_MESSAGING_EXTERN void close(); + QPID_MESSAGING_EXTERN Session createTransactionalSession(const std::string& name = std::string()); + QPID_MESSAGING_EXTERN Session createSession(const std::string& name = std::string()); - QPID_CLIENT_EXTERN Connection(ConnectionImpl* impl = 0); - QPID_CLIENT_EXTERN Connection(const Connection&); - QPID_CLIENT_EXTERN ~Connection(); - QPID_CLIENT_EXTERN Connection& operator=(const Connection&); - QPID_CLIENT_EXTERN void close(); - QPID_CLIENT_EXTERN Session newSession(bool transactional, const std::string& name = std::string()); - QPID_CLIENT_EXTERN Session newSession(const std::string& name = std::string()); - QPID_CLIENT_EXTERN Session newSession(const char* name); - - QPID_CLIENT_EXTERN Session getSession(const std::string& name) const; + QPID_MESSAGING_EXTERN Session getSession(const std::string& name) const; + QPID_MESSAGING_EXTERN std::string getAuthenticatedUsername(); private: - friend class qpid::client::PrivateImplRef; + friend class qpid::messaging::PrivateImplRef; }; -struct InvalidOptionString : public qpid::Exception -{ - InvalidOptionString(const std::string& msg); -}; - -/** - * TODO: need to change format of connection option string (currently - * name1=value1&name2=value2 etc, should probably use map syntax as - * per address options. - */ -QPID_CLIENT_EXTERN void parseOptionString(const std::string&, Variant::Map&); -QPID_CLIENT_EXTERN Variant::Map parseOptionString(const std::string&); - }} // namespace qpid::messaging #endif /*!QPID_MESSAGING_CONNECTION_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/Duration.h b/nativeLib/org.apache.qpid/include/qpid/messaging/Duration.h new file mode 100644 index 0000000000..abcf169090 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/messaging/Duration.h @@ -0,0 +1,55 @@ +#ifndef QPID_MESSAGING_DURATION_H +#define QPID_MESSAGING_DURATION_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#include "qpid/messaging/ImportExport.h" + +#include "qpid/sys/IntegerTypes.h" + +namespace qpid { +namespace messaging { + +/** \ingroup messaging + * A duration is a time in milliseconds. + */ +class Duration +{ + public: + QPID_MESSAGING_EXTERN explicit Duration(uint64_t milliseconds); + QPID_MESSAGING_EXTERN uint64_t getMilliseconds() const; + QPID_MESSAGING_EXTERN static const Duration FOREVER; + QPID_MESSAGING_EXTERN static const Duration IMMEDIATE; + QPID_MESSAGING_EXTERN static const Duration SECOND; + QPID_MESSAGING_EXTERN static const Duration MINUTE; + private: + uint64_t milliseconds; +}; + +QPID_MESSAGING_EXTERN Duration operator*(const Duration& duration, + uint64_t multiplier); +QPID_MESSAGING_EXTERN Duration operator*(uint64_t multiplier, + const Duration& duration); + +}} // namespace qpid::messaging + +#endif /*!QPID_MESSAGING_DURATION_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/FailoverUpdates.h b/nativeLib/org.apache.qpid/include/qpid/messaging/FailoverUpdates.h new file mode 100644 index 0000000000..fb9d106557 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/messaging/FailoverUpdates.h @@ -0,0 +1,49 @@ +#ifndef QPID_CLIENT_AMQP0_10_FAILOVERUPDATES_H +#define QPID_CLIENT_AMQP0_10_FAILOVERUPDATES_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +#include "qpid/messaging/ImportExport.h" + +namespace qpid { +namespace messaging { +class Connection; +class FailoverUpdatesImpl; + +/** + * A utility to listen for updates on cluster membership and update + * the list of known urls for a connection accordingly. + */ +class FailoverUpdates +{ + public: + QPID_MESSAGING_EXTERN FailoverUpdates(Connection& connection); + QPID_MESSAGING_EXTERN ~FailoverUpdates(); + private: + FailoverUpdatesImpl* impl; + + //no need to copy instances of this class + FailoverUpdates(const FailoverUpdates&); + FailoverUpdates& operator=(const FailoverUpdates&); +}; +}} // namespace qpid::messaging + +#endif /*!QPID_CLIENT_AMQP0_10_FAILOVERUPDATES_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/Handle.h b/nativeLib/org.apache.qpid/include/qpid/messaging/Handle.h new file mode 100644 index 0000000000..1e634ef888 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/messaging/Handle.h @@ -0,0 +1,71 @@ +#ifndef QPID_MESSAGING_HANDLE_H +#define QPID_MESSAGING_HANDLE_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#include "qpid/messaging/ImportExport.h" + +namespace qpid { +namespace messaging { + +template class PrivateImplRef; + +/** \ingroup messaging + * A handle is like a pointer: refers to an underlying implementation object. + * Copying the handle does not copy the object. + * + * Handles can be null, like a 0 pointer. Use isValid(), isNull() or the + * conversion to bool to test for a null handle. + */ +template class Handle { + public: + + /**@return true if handle is valid, i.e. not null. */ + QPID_MESSAGING_EXTERN bool isValid() const { return impl; } + + /**@return true if handle is null. It is an error to call any function on a null handle. */ + QPID_MESSAGING_EXTERN bool isNull() const { return !impl; } + + /** Conversion to bool supports idiom if (handle) { handle->... } */ + QPID_MESSAGING_EXTERN operator bool() const { return impl; } + + /** Operator ! supports idiom if (!handle) { do_if_handle_is_null(); } */ + QPID_MESSAGING_EXTERN bool operator !() const { return !impl; } + + void swap(Handle& h) { T* t = h.impl; h.impl = impl; impl = t; } + + protected: + typedef T Impl; + QPID_MESSAGING_EXTERN Handle() :impl() {} + + // Not implemented,subclasses must implement. + QPID_MESSAGING_EXTERN Handle(const Handle&); + QPID_MESSAGING_EXTERN Handle& operator=(const Handle&); + + Impl* impl; + + friend class PrivateImplRef; +}; + +}} // namespace qpid::messaging + +#endif /*!QPID_MESSAGING_HANDLE_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/ImportExport.h b/nativeLib/org.apache.qpid/include/qpid/messaging/ImportExport.h new file mode 100644 index 0000000000..52f3eb8568 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/messaging/ImportExport.h @@ -0,0 +1,33 @@ +#ifndef QPID_MESSAGING_IMPORTEXPORT_H +#define QPID_MESSAGING_IMPORTEXPORT_H + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#if defined(WIN32) && !defined(QPID_DECLARE_STATIC) +#if defined(CLIENT_EXPORT) || defined (qpidmessaging_EXPORTS) +#define QPID_MESSAGING_EXTERN __declspec(dllexport) +#else +#define QPID_MESSAGING_EXTERN __declspec(dllimport) +#endif +#else +#define QPID_MESSAGING_EXTERN +#endif + +#endif /*!QPID_MESSAGING_IMPORTEXPORT_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/ListContent.h b/nativeLib/org.apache.qpid/include/qpid/messaging/ListContent.h deleted file mode 100644 index 1c4e13716d..0000000000 --- a/nativeLib/org.apache.qpid/include/qpid/messaging/ListContent.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef QPID_MESSAGING_LISTCONTENT_H -#define QPID_MESSAGING_LISTCONTENT_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "qpid/client/ClientImportExport.h" -#include "Variant.h" - -namespace qpid { -namespace messaging { - -class ListContentImpl; -class Message; - -/** - * Allows message content to be manipulated as a list. - */ -class ListContent -{ - public: - typedef Variant::List::iterator iterator; - typedef Variant::List::reverse_iterator reverse_iterator; - typedef Variant::List::const_iterator const_iterator; - typedef Variant::List::const_reverse_iterator const_reverse_iterator; - - QPID_CLIENT_EXTERN ListContent(Message&); - QPID_CLIENT_EXTERN ~ListContent(); - - QPID_CLIENT_EXTERN const_iterator begin() const; - QPID_CLIENT_EXTERN iterator begin(); - QPID_CLIENT_EXTERN const_iterator end() const; - QPID_CLIENT_EXTERN iterator end(); - QPID_CLIENT_EXTERN const_reverse_iterator rbegin() const; - QPID_CLIENT_EXTERN reverse_iterator rbegin(); - QPID_CLIENT_EXTERN const_reverse_iterator rend() const; - QPID_CLIENT_EXTERN reverse_iterator rend(); - - QPID_CLIENT_EXTERN bool empty() const; - QPID_CLIENT_EXTERN size_t size() const; - - QPID_CLIENT_EXTERN const Variant& front() const; - QPID_CLIENT_EXTERN Variant& front(); - QPID_CLIENT_EXTERN const Variant& back() const; - QPID_CLIENT_EXTERN Variant& back(); - - QPID_CLIENT_EXTERN void push_front(const Variant&); - QPID_CLIENT_EXTERN void push_back(const Variant&); - - QPID_CLIENT_EXTERN void pop_front(); - QPID_CLIENT_EXTERN void pop_back(); - - QPID_CLIENT_EXTERN iterator insert(iterator position, const Variant&); - QPID_CLIENT_EXTERN void insert(iterator position, size_t n, const Variant&); - QPID_CLIENT_EXTERN iterator erase(iterator position); - QPID_CLIENT_EXTERN iterator erase(iterator first, iterator last); - QPID_CLIENT_EXTERN void clear(); - - QPID_CLIENT_EXTERN void encode(); - - QPID_CLIENT_EXTERN const Variant::List& asList() const; - QPID_CLIENT_EXTERN Variant::List& asList(); - private: - ListContentImpl* impl; - - QPID_CLIENT_EXTERN ListContent& operator=(const ListContent&); -}; - -QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const ListContent& m); - -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_LISTCONTENT_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/ListView.h b/nativeLib/org.apache.qpid/include/qpid/messaging/ListView.h deleted file mode 100644 index 4970a20072..0000000000 --- a/nativeLib/org.apache.qpid/include/qpid/messaging/ListView.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef QPID_MESSAGING_LISTVIEW_H -#define QPID_MESSAGING_LISTVIEW_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/client/ClientImportExport.h" -#include "Variant.h" - -namespace qpid { -namespace messaging { - -class ListViewImpl; -class Message; - -/** - * Provides a view of message content as a list - */ -class ListView -{ - public: - typedef Variant::List::const_iterator const_iterator; - typedef Variant::List::const_reverse_iterator const_reverse_iterator; - - QPID_CLIENT_EXTERN ListView(const Message&); - QPID_CLIENT_EXTERN ~ListView(); - QPID_CLIENT_EXTERN ListView& operator=(const ListView&); - - QPID_CLIENT_EXTERN const_iterator begin() const; - QPID_CLIENT_EXTERN const_iterator end() const; - QPID_CLIENT_EXTERN const_reverse_iterator rbegin() const; - QPID_CLIENT_EXTERN const_reverse_iterator rend() const; - - QPID_CLIENT_EXTERN bool empty() const; - QPID_CLIENT_EXTERN size_t size() const; - - QPID_CLIENT_EXTERN const Variant& front() const; - QPID_CLIENT_EXTERN const Variant& back() const; - - QPID_CLIENT_EXTERN const Variant::List& asList() const; - private: - ListViewImpl* impl; -}; - -QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const ListView& m); - -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_LISTVIEW_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/MapContent.h b/nativeLib/org.apache.qpid/include/qpid/messaging/MapContent.h deleted file mode 100644 index b05cb31295..0000000000 --- a/nativeLib/org.apache.qpid/include/qpid/messaging/MapContent.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef QPID_MESSAGING_MAPCONTENT_H -#define QPID_MESSAGING_MAPCONTENT_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include "qpid/client/ClientImportExport.h" -#include "Variant.h" -#include -#include - -namespace qpid { -namespace messaging { - -class MapContentImpl; -class Message; - -/** - * Allows message content to be manipulated as a map - */ -class MapContent -{ - public: - typedef std::string key_type; - typedef std::pair value_type; - typedef std::map::const_iterator const_iterator; - typedef std::map::iterator iterator; - typedef std::map::const_reverse_iterator const_reverse_iterator; - typedef std::map::reverse_iterator reverse_iterator; - - QPID_CLIENT_EXTERN MapContent(Message&); - QPID_CLIENT_EXTERN ~MapContent(); - - QPID_CLIENT_EXTERN const_iterator begin() const; - QPID_CLIENT_EXTERN const_iterator end() const; - QPID_CLIENT_EXTERN const_reverse_iterator rbegin() const; - QPID_CLIENT_EXTERN const_reverse_iterator rend() const; - QPID_CLIENT_EXTERN iterator begin(); - QPID_CLIENT_EXTERN iterator end(); - QPID_CLIENT_EXTERN reverse_iterator rbegin(); - QPID_CLIENT_EXTERN reverse_iterator rend(); - - QPID_CLIENT_EXTERN bool empty() const; - QPID_CLIENT_EXTERN size_t size() const; - - QPID_CLIENT_EXTERN const_iterator find(const key_type&) const; - QPID_CLIENT_EXTERN iterator find(const key_type&); - QPID_CLIENT_EXTERN const Variant& operator[](const key_type&) const; - QPID_CLIENT_EXTERN Variant& operator[](const key_type&); - - QPID_CLIENT_EXTERN std::pair insert(const value_type&); - QPID_CLIENT_EXTERN iterator insert(iterator position, const value_type&); - QPID_CLIENT_EXTERN void erase(iterator position); - QPID_CLIENT_EXTERN void erase(iterator first, iterator last); - QPID_CLIENT_EXTERN size_t erase(const key_type&); - QPID_CLIENT_EXTERN void clear(); - - QPID_CLIENT_EXTERN void encode(); - - QPID_CLIENT_EXTERN const std::map& asMap() const; - QPID_CLIENT_EXTERN std::map& asMap(); - private: - MapContentImpl* impl; - - QPID_CLIENT_EXTERN MapContent& operator=(const MapContent&); -}; - -QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const MapContent& m); - -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_MAPCONTENT_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/MapView.h b/nativeLib/org.apache.qpid/include/qpid/messaging/MapView.h deleted file mode 100644 index 910dfca5c2..0000000000 --- a/nativeLib/org.apache.qpid/include/qpid/messaging/MapView.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef QPID_MESSAGING_MAPVIEW_H -#define QPID_MESSAGING_MAPVIEW_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include "qpid/client/ClientImportExport.h" -#include "Variant.h" -#include -#include - -namespace qpid { -namespace messaging { - -class MapViewImpl; -class Message; - -/** - * Provides a view of message content as a list - */ -class MapView -{ - public: - typedef std::string key_type; - typedef std::pair value_type; - typedef std::map::const_iterator const_iterator; - typedef std::map::const_reverse_iterator const_reverse_iterator; - - QPID_CLIENT_EXTERN MapView(const Message&); - QPID_CLIENT_EXTERN ~MapView(); - QPID_CLIENT_EXTERN MapView& operator=(const MapView&); - - QPID_CLIENT_EXTERN const_iterator begin() const; - QPID_CLIENT_EXTERN const_iterator end() const; - QPID_CLIENT_EXTERN const_reverse_iterator rbegin() const; - QPID_CLIENT_EXTERN const_reverse_iterator rend() const; - - QPID_CLIENT_EXTERN bool empty() const; - QPID_CLIENT_EXTERN size_t size() const; - - QPID_CLIENT_EXTERN const_iterator find(const key_type&) const; - QPID_CLIENT_EXTERN const Variant& operator[](const key_type&) const; - - QPID_CLIENT_EXTERN const std::map& asMap() const; - private: - MapViewImpl* impl; -}; - -QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const MapView& m); - -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_MAPVIEW_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/Message.h b/nativeLib/org.apache.qpid/include/qpid/messaging/Message.h index 368fc89772..ba58b5887c 100644 --- a/nativeLib/org.apache.qpid/include/qpid/messaging/Message.h +++ b/nativeLib/org.apache.qpid/include/qpid/messaging/Message.h @@ -21,56 +21,144 @@ * under the License. * */ +#include "qpid/messaging/ImportExport.h" + +#include "qpid/messaging/Duration.h" +#include "qpid/types/Exception.h" +#include "qpid/types/Variant.h" #include -#include "qpid/messaging/Variant.h" -#include "qpid/client/ClientImportExport.h" namespace qpid { -namespace client { -} - namespace messaging { class Address; class Codec; struct MessageImpl; -/** +/** \ingroup messaging * Representation of a message. */ class Message { public: - QPID_CLIENT_EXTERN Message(const std::string& bytes = std::string()); - QPID_CLIENT_EXTERN Message(const char*, size_t); - QPID_CLIENT_EXTERN Message(const Message&); - QPID_CLIENT_EXTERN ~Message(); + QPID_MESSAGING_EXTERN Message(const std::string& bytes = std::string()); + QPID_MESSAGING_EXTERN Message(const char*, size_t); + QPID_MESSAGING_EXTERN Message(const Message&); + QPID_MESSAGING_EXTERN ~Message(); - QPID_CLIENT_EXTERN Message& operator=(const Message&); + QPID_MESSAGING_EXTERN Message& operator=(const Message&); - QPID_CLIENT_EXTERN void setReplyTo(const Address&); - QPID_CLIENT_EXTERN const Address& getReplyTo() const; + QPID_MESSAGING_EXTERN void setReplyTo(const Address&); + QPID_MESSAGING_EXTERN const Address& getReplyTo() const; - QPID_CLIENT_EXTERN void setSubject(const std::string&); - QPID_CLIENT_EXTERN const std::string& getSubject() const; + QPID_MESSAGING_EXTERN void setSubject(const std::string&); + QPID_MESSAGING_EXTERN const std::string& getSubject() const; - QPID_CLIENT_EXTERN void setContentType(const std::string&); - QPID_CLIENT_EXTERN const std::string& getContentType() const; + QPID_MESSAGING_EXTERN void setContentType(const std::string&); + QPID_MESSAGING_EXTERN const std::string& getContentType() const; - QPID_CLIENT_EXTERN const Variant::Map& getHeaders() const; - QPID_CLIENT_EXTERN Variant::Map& getHeaders(); + QPID_MESSAGING_EXTERN void setMessageId(const std::string&); + QPID_MESSAGING_EXTERN const std::string& getMessageId() const; - QPID_CLIENT_EXTERN const std::string& getContent() const; - QPID_CLIENT_EXTERN std::string& getContent(); - QPID_CLIENT_EXTERN void setContent(const std::string&); - QPID_CLIENT_EXTERN void setContent(const char* chars, size_t count); - QPID_CLIENT_EXTERN void getContent(std::pair& content) const; + QPID_MESSAGING_EXTERN void setUserId(const std::string&); + QPID_MESSAGING_EXTERN const std::string& getUserId() const; + QPID_MESSAGING_EXTERN void setCorrelationId(const std::string&); + QPID_MESSAGING_EXTERN const std::string& getCorrelationId() const; + + QPID_MESSAGING_EXTERN void setPriority(uint8_t); + QPID_MESSAGING_EXTERN uint8_t getPriority() const; + + /** + * Set the time to live for this message in milliseconds. + */ + QPID_MESSAGING_EXTERN void setTtl(Duration ttl); + /** + *Get the time to live for this message in milliseconds. + */ + QPID_MESSAGING_EXTERN Duration getTtl() const; + + QPID_MESSAGING_EXTERN void setDurable(bool durable); + QPID_MESSAGING_EXTERN bool getDurable() const; + + QPID_MESSAGING_EXTERN bool getRedelivered() const; + QPID_MESSAGING_EXTERN void setRedelivered(bool); + + QPID_MESSAGING_EXTERN const qpid::types::Variant::Map& getProperties() const; + QPID_MESSAGING_EXTERN qpid::types::Variant::Map& getProperties(); + + QPID_MESSAGING_EXTERN void setContent(const std::string&); + /** + * Note that chars are copied. + */ + QPID_MESSAGING_EXTERN void setContent(const char* chars, size_t count); + + /** Get the content as a std::string */ + QPID_MESSAGING_EXTERN std::string getContent() const; + /** Get a const pointer to the start of the content data. */ + QPID_MESSAGING_EXTERN const char* getContentPtr() const; + /** Get the size of content in bytes. */ + QPID_MESSAGING_EXTERN size_t getContentSize() const; private: MessageImpl* impl; friend struct MessageImplAccess; }; + +struct EncodingException : qpid::types::Exception +{ + EncodingException(const std::string& msg); +}; + +/** + * Decodes message content into a Variant::Map. + * + * @param message the message whose content should be decoded + * @param map the map into which the message contents will be decoded + * @param encoding if specified, the encoding to use - this overrides + * any encoding specified by the content-type of the message + * @exception EncodingException + */ +QPID_MESSAGING_EXTERN void decode(const Message& message, + qpid::types::Variant::Map& map, + const std::string& encoding = std::string()); +/** + * Decodes message content into a Variant::List. + * + * @param message the message whose content should be decoded + * @param list the list into which the message contents will be decoded + * @param encoding if specified, the encoding to use - this overrides + * any encoding specified by the content-type of the message + * @exception EncodingException + */ +QPID_MESSAGING_EXTERN void decode(const Message& message, + qpid::types::Variant::List& list, + const std::string& encoding = std::string()); +/** + * Encodes a Variant::Map into a message. + * + * @param map the map to be encoded + * @param message the message whose content should be set to the encoded map + * @param encoding if specified, the encoding to use - this overrides + * any encoding specified by the content-type of the message + * @exception EncodingException + */ +QPID_MESSAGING_EXTERN void encode(const qpid::types::Variant::Map& map, + Message& message, + const std::string& encoding = std::string()); +/** + * Encodes a Variant::List into a message. + * + * @param list the list to be encoded + * @param message the message whose content should be set to the encoded list + * @param encoding if specified, the encoding to use - this overrides + * any encoding specified by the content-type of the message + * @exception EncodingException + */ +QPID_MESSAGING_EXTERN void encode(const qpid::types::Variant::List& list, + Message& message, + const std::string& encoding = std::string()); + }} // namespace qpid::messaging #endif /*!QPID_MESSAGING_MESSAGE_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/Receiver.h b/nativeLib/org.apache.qpid/include/qpid/messaging/Receiver.h index 51630b12a2..a1129975cf 100644 --- a/nativeLib/org.apache.qpid/include/qpid/messaging/Receiver.h +++ b/nativeLib/org.apache.qpid/include/qpid/messaging/Receiver.h @@ -21,109 +21,119 @@ * under the License. * */ -#include "qpid/Exception.h" -#include "qpid/client/ClientImportExport.h" -#include "qpid/client/Handle.h" -#include "qpid/sys/Time.h" +#include "qpid/messaging/ImportExport.h" + +#include "qpid/messaging/exceptions.h" +#include "qpid/messaging/Handle.h" +#include "qpid/messaging/Duration.h" namespace qpid { -namespace client { +namespace messaging { template class PrivateImplRef; -} - -namespace messaging { - class Message; class ReceiverImpl; class Session; -/** +/** \ingroup messaging * Interface through which messages are received. */ -class Receiver : public qpid::client::Handle +class Receiver : public qpid::messaging::Handle { public: - struct NoMessageAvailable : qpid::Exception {}; - - QPID_CLIENT_EXTERN Receiver(ReceiverImpl* impl = 0); - QPID_CLIENT_EXTERN Receiver(const Receiver&); - QPID_CLIENT_EXTERN ~Receiver(); - QPID_CLIENT_EXTERN Receiver& operator=(const Receiver&); + QPID_MESSAGING_EXTERN Receiver(ReceiverImpl* impl = 0); + QPID_MESSAGING_EXTERN Receiver(const Receiver&); + QPID_MESSAGING_EXTERN ~Receiver(); + QPID_MESSAGING_EXTERN Receiver& operator=(const Receiver&); /** * Retrieves a message from this receivers local queue, or waits * for upto the specified timeout for a message to become - * available. Returns false if there is no message to give after - * waiting for the specified timeout. + * available. */ - QPID_CLIENT_EXTERN bool get(Message& message, qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE); + QPID_MESSAGING_EXTERN bool get(Message& message, Duration timeout=Duration::FOREVER); /** * Retrieves a message from this receivers local queue, or waits - * for upto the specified timeout for a message to become - * available. Throws NoMessageAvailable if there is no - * message to give after waiting for the specified timeout. + * for up to the specified timeout for a message to become + * available. + * + * @exception NoMessageAvailable if there is no message to give + * after waiting for the specified timeout, or if the Receiver is + * closed, in which case isClose() will be true. */ - QPID_CLIENT_EXTERN Message get(qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE); + QPID_MESSAGING_EXTERN Message get(Duration timeout=Duration::FOREVER); /** * Retrieves a message for this receivers subscription or waits - * for upto the specified timeout for one to become + * for up to the specified timeout for one to become * available. Unlike get() this method will check with the server * that there is no message for the subscription this receiver is * serving before returning false. + * + * @return false if there is no message to give after + * waiting for the specified timeout, or if the Receiver is + * closed, in which case isClose() will be true. */ - QPID_CLIENT_EXTERN bool fetch(Message& message, qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE); + QPID_MESSAGING_EXTERN bool fetch(Message& message, Duration timeout=Duration::FOREVER); /** * Retrieves a message for this receivers subscription or waits * for up to the specified timeout for one to become * available. Unlike get() this method will check with the server * that there is no message for the subscription this receiver is * serving before throwing an exception. + * + * @exception NoMessageAvailable if there is no message to give + * after waiting for the specified timeout, or if the Receiver is + * closed, in which case isClose() will be true. */ - QPID_CLIENT_EXTERN Message fetch(qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE); + QPID_MESSAGING_EXTERN Message fetch(Duration timeout=Duration::FOREVER); /** * Sets the capacity for the receiver. The capacity determines how * many incoming messages can be held in the receiver before being * requested by a client via fetch() (or pushed to a listener). */ - QPID_CLIENT_EXTERN void setCapacity(uint32_t); + QPID_MESSAGING_EXTERN void setCapacity(uint32_t); /** - * Returns the capacity of the receiver. The capacity determines + * @return the capacity of the receiver. The capacity determines * how many incoming messages can be held in the receiver before * being requested by a client via fetch() (or pushed to a * listener). */ - QPID_CLIENT_EXTERN uint32_t getCapacity(); + QPID_MESSAGING_EXTERN uint32_t getCapacity(); /** - * Returns the number of messages received and waiting to be + * @return the number of messages received and waiting to be * fetched. */ - QPID_CLIENT_EXTERN uint32_t available(); + QPID_MESSAGING_EXTERN uint32_t getAvailable(); /** - * Returns a count of the number of messages received on this + * @return a count of the number of messages received on this * receiver that have been acknowledged, but for which that * acknowledgement has not yet been confirmed as processed by the * server. */ - QPID_CLIENT_EXTERN uint32_t pendingAck(); + QPID_MESSAGING_EXTERN uint32_t getUnsettled(); /** * Cancels this receiver. */ - QPID_CLIENT_EXTERN void cancel(); + QPID_MESSAGING_EXTERN void close(); + + /** + * Return true if the receiver was closed by a call to close() + */ + QPID_MESSAGING_EXTERN bool isClosed() const; /** * Returns the name of this receiver. */ - QPID_CLIENT_EXTERN const std::string& getName() const; + QPID_MESSAGING_EXTERN const std::string& getName() const; /** * Returns a handle to the session associated with this receiver. */ - QPID_CLIENT_EXTERN Session getSession() const; + QPID_MESSAGING_EXTERN Session getSession() const; private: - friend class qpid::client::PrivateImplRef; + friend class qpid::messaging::PrivateImplRef; }; }} // namespace qpid::messaging diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/Sender.h b/nativeLib/org.apache.qpid/include/qpid/messaging/Sender.h index 335e61260c..80ebf517a4 100644 --- a/nativeLib/org.apache.qpid/include/qpid/messaging/Sender.h +++ b/nativeLib/org.apache.qpid/include/qpid/messaging/Sender.h @@ -21,65 +21,74 @@ * under the License. * */ -#include "qpid/client/ClientImportExport.h" -#include "qpid/client/Handle.h" +#include "qpid/messaging/ImportExport.h" + +#include "qpid/messaging/Handle.h" #include "qpid/sys/IntegerTypes.h" + #include namespace qpid { -namespace client { - -template class PrivateImplRef; - -} - namespace messaging { +template class PrivateImplRef; class Message; class SenderImpl; class Session; -/** +/** \ingroup messaging * Interface through which messages are sent. */ -class Sender : public qpid::client::Handle +class Sender : public qpid::messaging::Handle { public: - QPID_CLIENT_EXTERN Sender(SenderImpl* impl = 0); - QPID_CLIENT_EXTERN Sender(const Sender&); - QPID_CLIENT_EXTERN ~Sender(); - QPID_CLIENT_EXTERN Sender& operator=(const Sender&); + QPID_MESSAGING_EXTERN Sender(SenderImpl* impl = 0); + QPID_MESSAGING_EXTERN Sender(const Sender&); + QPID_MESSAGING_EXTERN ~Sender(); + QPID_MESSAGING_EXTERN Sender& operator=(const Sender&); - QPID_CLIENT_EXTERN void send(const Message& message); - QPID_CLIENT_EXTERN void cancel(); + /** + * Sends a message + * + * @param message the message to send + * @param sync if true the call will block until the server + * confirms receipt of the messages; if false will only block for + * available capacity (i.e. pending == capacity) + */ + QPID_MESSAGING_EXTERN void send(const Message& message, bool sync=false); + QPID_MESSAGING_EXTERN void close(); /** * Sets the capacity for the sender. The capacity determines how * many outgoing messages can be held pending confirmation of * receipt by the broker. */ - QPID_CLIENT_EXTERN void setCapacity(uint32_t); + QPID_MESSAGING_EXTERN void setCapacity(uint32_t); /** * Returns the capacity of the sender. * @see setCapacity */ - QPID_CLIENT_EXTERN uint32_t getCapacity(); + QPID_MESSAGING_EXTERN uint32_t getCapacity(); /** * Returns the number of sent messages pending confirmation of * receipt by the broker. (These are the 'in-doubt' messages). */ - QPID_CLIENT_EXTERN uint32_t pending(); - + QPID_MESSAGING_EXTERN uint32_t getUnsettled(); + /** + * Returns the number of messages for which there is available + * capacity. + */ + QPID_MESSAGING_EXTERN uint32_t getAvailable(); /** * Returns the name of this sender. */ - QPID_CLIENT_EXTERN const std::string& getName() const; + QPID_MESSAGING_EXTERN const std::string& getName() const; /** * Returns a handle to the session associated with this sender. */ - QPID_CLIENT_EXTERN Session getSession() const; + QPID_MESSAGING_EXTERN Session getSession() const; private: - friend class qpid::client::PrivateImplRef; + friend class qpid::messaging::PrivateImplRef; }; }} // namespace qpid::messaging diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/Session.h b/nativeLib/org.apache.qpid/include/qpid/messaging/Session.h index 46372cb849..34fccdb868 100644 --- a/nativeLib/org.apache.qpid/include/qpid/messaging/Session.h +++ b/nativeLib/org.apache.qpid/include/qpid/messaging/Session.h @@ -21,21 +21,18 @@ * under the License. * */ -#include "qpid/Exception.h" -#include "qpid/client/ClientImportExport.h" -#include "qpid/client/Handle.h" -#include "qpid/sys/Time.h" +#include "qpid/messaging/ImportExport.h" + +#include "qpid/messaging/exceptions.h" +#include "qpid/messaging/Duration.h" +#include "qpid/messaging/Handle.h" + #include namespace qpid { -namespace client { - -template class PrivateImplRef; - -} - namespace messaging { +template class PrivateImplRef; class Address; class Connection; class Message; @@ -45,103 +42,127 @@ class Receiver; class SessionImpl; class Subscription; -struct KeyError : qpid::Exception -{ - QPID_CLIENT_EXTERN KeyError(const std::string&); -}; - -/** +/** \ingroup messaging * A session represents a distinct 'conversation' which can involve * sending and receiving messages to and from different addresses. */ -class Session : public qpid::client::Handle +class Session : public qpid::messaging::Handle { public: - QPID_CLIENT_EXTERN Session(SessionImpl* impl = 0); - QPID_CLIENT_EXTERN Session(const Session&); - QPID_CLIENT_EXTERN ~Session(); - QPID_CLIENT_EXTERN Session& operator=(const Session&); + QPID_MESSAGING_EXTERN Session(SessionImpl* impl = 0); + QPID_MESSAGING_EXTERN Session(const Session&); + QPID_MESSAGING_EXTERN ~Session(); + QPID_MESSAGING_EXTERN Session& operator=(const Session&); - QPID_CLIENT_EXTERN void close(); + /** + * Closes a session and all associated senders and receivers. An + * opened session should be closed before the last handle to it + * goes out of scope. All a connections sessions can be closed by + * a call to Connection::close(). + */ + QPID_MESSAGING_EXTERN void close(); - QPID_CLIENT_EXTERN void commit(); - QPID_CLIENT_EXTERN void rollback(); + QPID_MESSAGING_EXTERN void commit(); + QPID_MESSAGING_EXTERN void rollback(); /** * Acknowledges all outstanding messages that have been received * by the application on this session. + * + * @param sync if true, blocks until the acknowledgement has been + * processed by the server */ - QPID_CLIENT_EXTERN void acknowledge(); + QPID_MESSAGING_EXTERN void acknowledge(bool sync=false); /** * Rejects the specified message. This will prevent the message - * being redelivered. + * being redelivered. This must be called before the message is + * acknowledged. */ - QPID_CLIENT_EXTERN void reject(Message&); - - QPID_CLIENT_EXTERN void sync(); - QPID_CLIENT_EXTERN void flush(); + QPID_MESSAGING_EXTERN void reject(Message&); + /** + * Releases the specified message. This will allow the broker to + * redeliver the message. This must be called before the message + * is acknowledged. + */ + QPID_MESSAGING_EXTERN void release(Message&); /** - * Returns the number of messages received and waiting to be - * fetched. + * Request synchronisation with the server. + * + * @param block if true, this call will block until the server + * confirms completion of all pending operations; if false the + * call will request notifcation from the server but will return + * before receiving it. */ - QPID_CLIENT_EXTERN uint32_t available(); + QPID_MESSAGING_EXTERN void sync(bool block=true); + + /** + * Returns the total number of messages received and waiting to be + * fetched by all Receivers belonging to this session. This is the + * total number of available messages across all receivers on this + * session. + */ + QPID_MESSAGING_EXTERN uint32_t getReceivable(); /** * Returns a count of the number of messages received this session * that have been acknowledged, but for which that acknowledgement * has not yet been confirmed as processed by the server. */ - QPID_CLIENT_EXTERN uint32_t pendingAck(); + QPID_MESSAGING_EXTERN uint32_t getUnsettledAcks(); /** * Retrieves the receiver for the next available message. If there * are no available messages at present the call will block for up * to the specified timeout waiting for one to arrive. Returns * true if a message was available at the point of return, in * which case the passed in receiver reference will be set to the - * receiver for that message or fals if no message was available. + * receiver for that message or false if no message was available. */ - QPID_CLIENT_EXTERN bool nextReceiver(Receiver&, qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE); + QPID_MESSAGING_EXTERN bool nextReceiver(Receiver&, Duration timeout=Duration::FOREVER); /** * Returns the receiver for the next available message. If there * are no available messages at present the call will block for up - * to the specified timeout waiting for one to arrive. Will throw - * Receiver::NoMessageAvailable if no message became available in - * time. + * to the specified timeout waiting for one to arrive. + * + * @exception Receiver::NoMessageAvailable if no message became + * available in time. */ - QPID_CLIENT_EXTERN Receiver nextReceiver(qpid::sys::Duration timeout=qpid::sys::TIME_INFINITE); + QPID_MESSAGING_EXTERN Receiver nextReceiver(Duration timeout=Duration::FOREVER); /** * Create a new sender through which messages can be sent to the * specified address. */ - QPID_CLIENT_EXTERN Sender createSender(const Address& address); - QPID_CLIENT_EXTERN Sender createSender(const std::string& address); + QPID_MESSAGING_EXTERN Sender createSender(const Address& address); + QPID_MESSAGING_EXTERN Sender createSender(const std::string& address); /** * Create a new receiver through which messages can be received * from the specified address. */ - QPID_CLIENT_EXTERN Receiver createReceiver(const Address& address); - QPID_CLIENT_EXTERN Receiver createReceiver(const std::string& address); + QPID_MESSAGING_EXTERN Receiver createReceiver(const Address& address); + QPID_MESSAGING_EXTERN Receiver createReceiver(const std::string& address); /** - * Returns the sender with the specified name or throws KeyError - * if there is none for that name. + * Returns the sender with the specified name. + *@exception KeyError if there is none for that name. */ - QPID_CLIENT_EXTERN Sender getSender(const std::string& name) const; + QPID_MESSAGING_EXTERN Sender getSender(const std::string& name) const; /** - * Returns the receiver with the specified name or throws KeyError - * if there is none for that name. + * Returns the receiver with the specified name. + *@exception KeyError if there is none for that name. */ - QPID_CLIENT_EXTERN Receiver getReceiver(const std::string& name) const; + QPID_MESSAGING_EXTERN Receiver getReceiver(const std::string& name) const; /** * Returns a handle to the connection this session is associated * with. */ - QPID_CLIENT_EXTERN Connection getConnection() const; + QPID_MESSAGING_EXTERN Connection getConnection() const; + + QPID_MESSAGING_EXTERN bool hasError(); + QPID_MESSAGING_EXTERN void checkError(); private: - friend class qpid::client::PrivateImplRef; + friend class qpid::messaging::PrivateImplRef; }; }} // namespace qpid::messaging diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/Variant.h b/nativeLib/org.apache.qpid/include/qpid/messaging/Variant.h deleted file mode 100644 index de5cef4d67..0000000000 --- a/nativeLib/org.apache.qpid/include/qpid/messaging/Variant.h +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef QPID_MESSAGING_VARIANT_H -#define QPID_MESSAGING_VARIANT_H - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#include -#include -#include -#include -#include "qpid/Exception.h" -#include "qpid/sys/IntegerTypes.h" -#include "qpid/client/ClientImportExport.h" - -namespace qpid { -namespace messaging { - -/** - * Thrown when an illegal conversion of a variant is attempted. - */ -struct InvalidConversion : public qpid::Exception -{ - InvalidConversion(const std::string& msg); -}; - -enum VariantType { - VAR_VOID = 0, - VAR_BOOL, - VAR_UINT8, - VAR_UINT16, - VAR_UINT32, - VAR_UINT64, - VAR_INT8, - VAR_INT16, - VAR_INT32, - VAR_INT64, - VAR_FLOAT, - VAR_DOUBLE, - VAR_STRING, - VAR_MAP, - VAR_LIST -}; - -class VariantImpl; - -/** - * Represents a value of variable type. - */ -class Variant -{ - public: - typedef std::map Map; - typedef std::list List; - - QPID_CLIENT_EXTERN Variant(); - QPID_CLIENT_EXTERN Variant(bool); - QPID_CLIENT_EXTERN Variant(uint8_t); - QPID_CLIENT_EXTERN Variant(uint16_t); - QPID_CLIENT_EXTERN Variant(uint32_t); - QPID_CLIENT_EXTERN Variant(uint64_t); - QPID_CLIENT_EXTERN Variant(int8_t); - QPID_CLIENT_EXTERN Variant(int16_t); - QPID_CLIENT_EXTERN Variant(int32_t); - QPID_CLIENT_EXTERN Variant(int64_t); - QPID_CLIENT_EXTERN Variant(float); - QPID_CLIENT_EXTERN Variant(double); - QPID_CLIENT_EXTERN Variant(const std::string&); - QPID_CLIENT_EXTERN Variant(const char*); - QPID_CLIENT_EXTERN Variant(const Map&); - QPID_CLIENT_EXTERN Variant(const List&); - QPID_CLIENT_EXTERN Variant(const Variant&); - - QPID_CLIENT_EXTERN ~Variant(); - - QPID_CLIENT_EXTERN VariantType getType() const; - QPID_CLIENT_EXTERN bool isVoid() const; - - QPID_CLIENT_EXTERN Variant& operator=(bool); - QPID_CLIENT_EXTERN Variant& operator=(uint8_t); - QPID_CLIENT_EXTERN Variant& operator=(uint16_t); - QPID_CLIENT_EXTERN Variant& operator=(uint32_t); - QPID_CLIENT_EXTERN Variant& operator=(uint64_t); - QPID_CLIENT_EXTERN Variant& operator=(int8_t); - QPID_CLIENT_EXTERN Variant& operator=(int16_t); - QPID_CLIENT_EXTERN Variant& operator=(int32_t); - QPID_CLIENT_EXTERN Variant& operator=(int64_t); - QPID_CLIENT_EXTERN Variant& operator=(float); - QPID_CLIENT_EXTERN Variant& operator=(double); - QPID_CLIENT_EXTERN Variant& operator=(const std::string&); - QPID_CLIENT_EXTERN Variant& operator=(const char*); - QPID_CLIENT_EXTERN Variant& operator=(const Map&); - QPID_CLIENT_EXTERN Variant& operator=(const List&); - QPID_CLIENT_EXTERN Variant& operator=(const Variant&); - - QPID_CLIENT_EXTERN bool asBool() const; - QPID_CLIENT_EXTERN uint8_t asUint8() const; - QPID_CLIENT_EXTERN uint16_t asUint16() const; - QPID_CLIENT_EXTERN uint32_t asUint32() const; - QPID_CLIENT_EXTERN uint64_t asUint64() const; - QPID_CLIENT_EXTERN int8_t asInt8() const; - QPID_CLIENT_EXTERN int16_t asInt16() const; - QPID_CLIENT_EXTERN int32_t asInt32() const; - QPID_CLIENT_EXTERN int64_t asInt64() const; - QPID_CLIENT_EXTERN float asFloat() const; - QPID_CLIENT_EXTERN double asDouble() const; - QPID_CLIENT_EXTERN std::string asString() const; - - QPID_CLIENT_EXTERN operator bool() const; - QPID_CLIENT_EXTERN operator uint8_t() const; - QPID_CLIENT_EXTERN operator uint16_t() const; - QPID_CLIENT_EXTERN operator uint32_t() const; - QPID_CLIENT_EXTERN operator uint64_t() const; - QPID_CLIENT_EXTERN operator int8_t() const; - QPID_CLIENT_EXTERN operator int16_t() const; - QPID_CLIENT_EXTERN operator int32_t() const; - QPID_CLIENT_EXTERN operator int64_t() const; - QPID_CLIENT_EXTERN operator float() const; - QPID_CLIENT_EXTERN operator double() const; - QPID_CLIENT_EXTERN operator const char*() const; - - QPID_CLIENT_EXTERN const Map& asMap() const; - QPID_CLIENT_EXTERN Map& asMap(); - QPID_CLIENT_EXTERN const List& asList() const; - QPID_CLIENT_EXTERN List& asList(); - /** - * Unlike asString(), getString() will not do any conversions and - * will throw InvalidConversion if the type is not STRING. - */ - QPID_CLIENT_EXTERN const std::string& getString() const; - QPID_CLIENT_EXTERN std::string& getString(); - - QPID_CLIENT_EXTERN void setEncoding(const std::string&); - QPID_CLIENT_EXTERN const std::string& getEncoding() const; - - QPID_CLIENT_EXTERN bool isEqualTo(const Variant& a) const; - - QPID_CLIENT_EXTERN void reset(); - private: - VariantImpl* impl; -}; - -QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const Variant& value); -QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const Variant::Map& map); -QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const Variant::List& list); -QPID_CLIENT_EXTERN bool operator==(const Variant& a, const Variant& b); - -typedef Variant::Map VariantMap; - -}} // namespace qpid::messaging - -#endif /*!QPID_MESSAGING_VARIANT_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/exceptions.h b/nativeLib/org.apache.qpid/include/qpid/messaging/exceptions.h new file mode 100644 index 0000000000..0ff608b343 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/messaging/exceptions.h @@ -0,0 +1,153 @@ +#ifndef QPID_MESSAGING_EXCEPTIONS_H +#define QPID_MESSAGING_EXCEPTIONS_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#include "qpid/messaging/ImportExport.h" +#include "qpid/types/Exception.h" +#include "qpid/types/Variant.h" + +namespace qpid { +namespace messaging { + +/** \ingroup messaging + */ + +struct MessagingException : public qpid::types::Exception +{ + QPID_MESSAGING_EXTERN MessagingException(const std::string& msg); + QPID_MESSAGING_EXTERN virtual ~MessagingException() throw(); + + qpid::types::Variant::Map detail; + //TODO: override what() to include detail if present +}; + +struct InvalidOptionString : public MessagingException +{ + QPID_MESSAGING_EXTERN InvalidOptionString(const std::string& msg); +}; + +struct KeyError : public MessagingException +{ + QPID_MESSAGING_EXTERN KeyError(const std::string&); +}; + +struct LinkError : public MessagingException +{ + QPID_MESSAGING_EXTERN LinkError(const std::string&); +}; + +struct AddressError : public LinkError +{ + QPID_MESSAGING_EXTERN AddressError(const std::string&); +}; + +/** + * Thrown when a syntactically correct address cannot be resolved or + * used. + */ +struct ResolutionError : public AddressError +{ + QPID_MESSAGING_EXTERN ResolutionError(const std::string& msg); +}; + +struct AssertionFailed : public ResolutionError +{ + QPID_MESSAGING_EXTERN AssertionFailed(const std::string& msg); +}; + +struct NotFound : public ResolutionError +{ + QPID_MESSAGING_EXTERN NotFound(const std::string& msg); +}; + +/** + * Thrown when an address string with inalid sytanx is used. + */ +struct MalformedAddress : public AddressError +{ + QPID_MESSAGING_EXTERN MalformedAddress(const std::string& msg); +}; + +struct ReceiverError : public LinkError +{ + QPID_MESSAGING_EXTERN ReceiverError(const std::string&); +}; + +struct FetchError : public ReceiverError +{ + QPID_MESSAGING_EXTERN FetchError(const std::string&); +}; + +struct NoMessageAvailable : public FetchError +{ + QPID_MESSAGING_EXTERN NoMessageAvailable(); +}; + +struct SenderError : public LinkError +{ + QPID_MESSAGING_EXTERN SenderError(const std::string&); +}; + +struct SendError : public SenderError +{ + QPID_MESSAGING_EXTERN SendError(const std::string&); +}; + +struct TargetCapacityExceeded : public SendError +{ + QPID_MESSAGING_EXTERN TargetCapacityExceeded(const std::string&); +}; + +struct SessionError : public MessagingException +{ + QPID_MESSAGING_EXTERN SessionError(const std::string&); +}; + +struct TransactionError : public SessionError +{ + QPID_MESSAGING_EXTERN TransactionError(const std::string&); +}; + +struct TransactionAborted : public TransactionError +{ + QPID_MESSAGING_EXTERN TransactionAborted(const std::string&); +}; + +struct UnauthorizedAccess : public SessionError +{ + QPID_MESSAGING_EXTERN UnauthorizedAccess(const std::string&); +}; + +struct ConnectionError : public MessagingException +{ + QPID_MESSAGING_EXTERN ConnectionError(const std::string&); +}; + +struct TransportFailure : public MessagingException +{ + QPID_MESSAGING_EXTERN TransportFailure(const std::string&); +}; + +}} // namespace qpid::messaging + +#endif /*!QPID_MESSAGING_EXCEPTIONS_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/sys/SystemInfo.h b/nativeLib/org.apache.qpid/include/qpid/sys/SystemInfo.h index 09f9980173..23594cf650 100644 --- a/nativeLib/org.apache.qpid/include/qpid/sys/SystemInfo.h +++ b/nativeLib/org.apache.qpid/include/qpid/sys/SystemInfo.h @@ -24,6 +24,7 @@ #include "qpid/sys/IntegerTypes.h" #include "qpid/Address.h" #include "qpid/CommonImportExport.h" +#include namespace qpid { namespace sys { @@ -40,10 +41,10 @@ namespace SystemInfo { QPID_COMMON_EXTERN long concurrency(); /** - * Get the local host name and set it in the specified TcpAddress. + * Get the local host name and set it in the specified. * Returns false if it can't be obtained and sets errno to any error value. */ - QPID_COMMON_EXTERN bool getLocalHostname (TcpAddress &address); + QPID_COMMON_EXTERN bool getLocalHostname (Address &address); QPID_COMMON_EXTERN void getLocalIpAddresses (uint16_t port, std::vector
&addrList); diff --git a/nativeLib/org.apache.qpid/include/qpid/sys/Thread.h b/nativeLib/org.apache.qpid/include/qpid/sys/Thread.h index bfea4b4944..45a39e796f 100644 --- a/nativeLib/org.apache.qpid/include/qpid/sys/Thread.h +++ b/nativeLib/org.apache.qpid/include/qpid/sys/Thread.h @@ -49,16 +49,18 @@ class Thread QPID_COMMON_EXTERN explicit Thread(qpid::sys::Runnable*); QPID_COMMON_EXTERN explicit Thread(qpid::sys::Runnable&); - QPID_COMMON_EXTERN void join(); + QPID_COMMON_EXTERN operator bool(); + QPID_COMMON_EXTERN bool operator==(const Thread&) const; + QPID_COMMON_EXTERN bool operator!=(const Thread&) const; - QPID_COMMON_EXTERN unsigned long id(); + QPID_COMMON_EXTERN void join(); QPID_COMMON_EXTERN static Thread current(); /** ID of current thread for logging. * Workaround for broken Thread::current() in APR */ - static unsigned long logId() { return current().id(); } + QPID_COMMON_EXTERN static unsigned long logId(); }; }} diff --git a/nativeLib/org.apache.qpid/include/qpid/sys/Time.h b/nativeLib/org.apache.qpid/include/qpid/sys/Time.h index c19757747b..d3ab832229 100644 --- a/nativeLib/org.apache.qpid/include/qpid/sys/Time.h +++ b/nativeLib/org.apache.qpid/include/qpid/sys/Time.h @@ -58,20 +58,15 @@ class Duration; * accessors to its internal state. If you think you want to replace its value, * you need to construct a new AbsTime and assign it, viz: * - * AbsTime when = AbsTime::now(); + * AbsTime when = now(); * ... * when = AbsTime(when, 2*TIME_SEC); // Advance timer 2 secs * - * If for some reason you need access to the internal nanosec value you need - * to convert the AbsTime to a Duration and use its conversion to int64_t, viz: + * AbsTime is not intended to be used to represent calendar dates/times + * but you can construct a Duration since the Unix Epoch, 1970-1-1-00:00, + * so that you can convert to a date/time if needed: * - * AbsTime now = AbsTime::now(); - * - * int64_t ns = Duration(now); - * - * However note that the nanosecond value that is returned here is not - * defined to be anything in particular and could vary from platform to - * platform. + * int64_t nanosec_since_epoch = Duration(EPOCH, now()); * * There are some sensible operations that are currently missing from * AbsTime, but nearly all that's needed can be done with a mixture of @@ -84,20 +79,22 @@ class Duration; */ class AbsTime { friend class Duration; + friend class Condition; TimePrivate timepoint; public: - QPID_COMMON_EXTERN inline AbsTime() {} + + inline AbsTime() : timepoint() {} QPID_COMMON_EXTERN AbsTime(const AbsTime& time0, const Duration& duration); // Default assignment operation fine // Default copy constructor fine QPID_COMMON_EXTERN static AbsTime now(); QPID_COMMON_EXTERN static AbsTime FarFuture(); - const TimePrivate& getPrivate(void) const { return timepoint; } + QPID_COMMON_EXTERN static AbsTime Epoch(); + bool operator==(const AbsTime& t) const { return t.timepoint == timepoint; } - template void serialize(S& s) { s(timepoint); } friend bool operator<(const AbsTime& a, const AbsTime& b); friend bool operator>(const AbsTime& a, const AbsTime& b); @@ -122,8 +119,7 @@ class Duration { friend class AbsTime; public: - QPID_COMMON_EXTERN inline Duration(int64_t time0); - QPID_COMMON_EXTERN explicit Duration(const AbsTime& time0); + QPID_COMMON_EXTERN inline Duration(int64_t time0 = 0); QPID_COMMON_EXTERN explicit Duration(const AbsTime& start, const AbsTime& finish); inline operator int64_t() const; }; @@ -156,6 +152,9 @@ const Duration TIME_NSEC = 1; /** Value to represent an infinite timeout */ const Duration TIME_INFINITE = std::numeric_limits::max(); +/** Absolute time point for the Unix epoch: 1970-01-01T00:00:00 */ +const AbsTime EPOCH = AbsTime::Epoch(); + /** Time greater than any other time */ const AbsTime FAR_FUTURE = AbsTime::FarFuture(); diff --git a/nativeLib/org.apache.qpid/include/qpid/sys/posix/Condition.h b/nativeLib/org.apache.qpid/include/qpid/sys/posix/Condition.h index 279039735a..36e7557ffd 100644 --- a/nativeLib/org.apache.qpid/include/qpid/sys/posix/Condition.h +++ b/nativeLib/org.apache.qpid/include/qpid/sys/posix/Condition.h @@ -65,7 +65,7 @@ void Condition::wait(Mutex& mutex) { bool Condition::wait(Mutex& mutex, const AbsTime& absoluteTime){ struct timespec ts; - toTimespec(ts, Duration(absoluteTime)); + toTimespec(ts, Duration(EPOCH, absoluteTime)); int status = pthread_cond_timedwait(&condition, &mutex.mutex, &ts); if (status != 0) { if (status == ETIMEDOUT) return false; diff --git a/nativeLib/org.apache.qpid/include/qpid/sys/posix/check.h b/nativeLib/org.apache.qpid/include/qpid/sys/posix/check.h index bbc66d389b..1bfe5d6d78 100644 --- a/nativeLib/org.apache.qpid/include/qpid/sys/posix/check.h +++ b/nativeLib/org.apache.qpid/include/qpid/sys/posix/check.h @@ -23,6 +23,7 @@ */ #include "qpid/Exception.h" +#include "qpid/Msg.h" #include #include diff --git a/nativeLib/org.apache.qpid/include/qpid/messaging/Codec.h b/nativeLib/org.apache.qpid/include/qpid/types/Exception.h similarity index 65% rename from nativeLib/org.apache.qpid/include/qpid/messaging/Codec.h rename to nativeLib/org.apache.qpid/include/qpid/types/Exception.h index bacec5c786..d061a7df0e 100644 --- a/nativeLib/org.apache.qpid/include/qpid/messaging/Codec.h +++ b/nativeLib/org.apache.qpid/include/qpid/types/Exception.h @@ -1,5 +1,5 @@ -#ifndef QPID_MESSAGING_CODEC_H -#define QPID_MESSAGING_CODEC_H +#ifndef QPID_TYPES_EXCEPTION_H +#define QPID_TYPES_EXCEPTION_H /* * @@ -21,24 +21,24 @@ * under the License. * */ + #include -#include "qpid/client/ClientImportExport.h" +#include "qpid/types/ImportExport.h" namespace qpid { -namespace messaging { +namespace types { -class Variant; -/** - * - */ -class Codec +class Exception : public std::exception { public: - QPID_CLIENT_EXTERN virtual ~Codec() {} - virtual void encode(const Variant&, std::string&) = 0; - virtual void decode(const std::string&, Variant&) = 0; - private: -}; -}} // namespace qpid::messaging + QPID_TYPES_EXTERN explicit Exception(const std::string& message=std::string()) throw(); + QPID_TYPES_EXTERN virtual ~Exception() throw(); + QPID_TYPES_EXTERN virtual const char* what() const throw(); -#endif /*!QPID_MESSAGING_CODEC_H*/ + private: + const std::string message; +}; + +}} // namespace qpid::types + +#endif /*!QPID_TYPES_EXCEPTION_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/types/ImportExport.h b/nativeLib/org.apache.qpid/include/qpid/types/ImportExport.h new file mode 100644 index 0000000000..bb10575fcd --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/types/ImportExport.h @@ -0,0 +1,33 @@ +#ifndef QPID_TYPES_IMPORTEXPORT_H +#define QPID_TYPES_IMPORTEXPORT_H + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#if defined(WIN32) && !defined(QPID_DECLARE_STATIC) +#if defined(TYPES_EXPORT) || defined (qpidtypes_EXPORTS) +#define QPID_TYPES_EXTERN __declspec(dllexport) +#else +#define QPID_TYPES_EXTERN __declspec(dllimport) +#endif +#else +#define QPID_TYPES_EXTERN +#endif + +#endif /*!QPID_TYPES_IMPORTEXPORT_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/types/Uuid.h b/nativeLib/org.apache.qpid/include/qpid/types/Uuid.h new file mode 100644 index 0000000000..467a895184 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/types/Uuid.h @@ -0,0 +1,94 @@ +#ifndef QPID_TYPES_UUID_H +#define QPID_TYPES_UUID_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#include "qpid/types/ImportExport.h" +#include +#include + +namespace qpid { +namespace types { + +class Uuid +{ + public: + static const size_t SIZE; + /** + * If unique is true, this will generate a new unique uuid, if not + * it will construct a null uuid. + */ + QPID_TYPES_EXTERN Uuid(bool unique=false); + QPID_TYPES_EXTERN Uuid(const Uuid&); + QPID_TYPES_EXTERN Uuid& operator=(const Uuid&); + /** Copy the UUID from data16, which must point to a 16-byte UUID */ + QPID_TYPES_EXTERN Uuid(const unsigned char* data16); + + /** Set to a new unique identifier. */ + QPID_TYPES_EXTERN void generate(); + + /** Set to all zeros. */ + QPID_TYPES_EXTERN void clear(); + + /** Test for null (all zeros). */ + QPID_TYPES_EXTERN bool isNull() const; + QPID_TYPES_EXTERN operator bool() const; + QPID_TYPES_EXTERN bool operator!() const; + + /** String value in format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb. */ + QPID_TYPES_EXTERN std::string str() const; + + QPID_TYPES_EXTERN size_t size() const; + QPID_TYPES_EXTERN const unsigned char* data() const; + + friend QPID_TYPES_EXTERN bool operator==(const Uuid&, const Uuid&); + friend QPID_TYPES_EXTERN bool operator!=(const Uuid&, const Uuid&); + friend QPID_TYPES_EXTERN bool operator<(const Uuid&, const Uuid&); + friend QPID_TYPES_EXTERN bool operator>(const Uuid&, const Uuid&); + friend QPID_TYPES_EXTERN bool operator<=(const Uuid&, const Uuid&); + friend QPID_TYPES_EXTERN bool operator>=(const Uuid&, const Uuid&); + friend QPID_TYPES_EXTERN std::ostream& operator<<(std::ostream&, Uuid); + friend QPID_TYPES_EXTERN std::istream& operator>>(std::istream&, Uuid&); + + private: + unsigned char bytes[16]; +}; + +/** Returns true if the uuids are equal, false otherwise. **/ +QPID_TYPES_EXTERN bool operator==(const Uuid&, const Uuid&); +/** Returns true if the uuids are NOT equal, false if they are. **/ +QPID_TYPES_EXTERN bool operator!=(const Uuid&, const Uuid&); + +QPID_TYPES_EXTERN bool operator<(const Uuid&, const Uuid&); +QPID_TYPES_EXTERN bool operator>(const Uuid&, const Uuid&); +QPID_TYPES_EXTERN bool operator<=(const Uuid&, const Uuid&); +QPID_TYPES_EXTERN bool operator>=(const Uuid&, const Uuid&); + +/** Print in format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb. */ +QPID_TYPES_EXTERN std::ostream& operator<<(std::ostream&, Uuid); + +/** Read from format 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb. */ +QPID_TYPES_EXTERN std::istream& operator>>(std::istream&, Uuid&); + +}} // namespace qpid::types + +#endif /*!QPID_TYPES_UUID_H*/ diff --git a/nativeLib/org.apache.qpid/include/qpid/types/Variant.h b/nativeLib/org.apache.qpid/include/qpid/types/Variant.h new file mode 100644 index 0000000000..993f1eb0c2 --- /dev/null +++ b/nativeLib/org.apache.qpid/include/qpid/types/Variant.h @@ -0,0 +1,173 @@ +#ifndef QPID_TYPES_VARIANT_H +#define QPID_TYPES_VARIANT_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +#include +#include +#include +#include +#include "Uuid.h" +#include "qpid/types/Exception.h" +#include "qpid/sys/IntegerTypes.h" +#include "qpid/types/ImportExport.h" + +namespace qpid { +namespace types { + +/** + * Thrown when an illegal conversion of a variant is attempted. + */ +struct InvalidConversion : public Exception +{ + InvalidConversion(const std::string& msg); +}; + +enum VariantType { + VAR_VOID = 0, + VAR_BOOL, + VAR_UINT8, + VAR_UINT16, + VAR_UINT32, + VAR_UINT64, + VAR_INT8, + VAR_INT16, + VAR_INT32, + VAR_INT64, + VAR_FLOAT, + VAR_DOUBLE, + VAR_STRING, + VAR_MAP, + VAR_LIST, + VAR_UUID +}; + +class VariantImpl; + +/** + * Represents a value of variable type. + */ +class Variant +{ + public: + typedef std::map Map; + typedef std::list List; + + QPID_TYPES_EXTERN Variant(); + QPID_TYPES_EXTERN Variant(bool); + QPID_TYPES_EXTERN Variant(uint8_t); + QPID_TYPES_EXTERN Variant(uint16_t); + QPID_TYPES_EXTERN Variant(uint32_t); + QPID_TYPES_EXTERN Variant(uint64_t); + QPID_TYPES_EXTERN Variant(int8_t); + QPID_TYPES_EXTERN Variant(int16_t); + QPID_TYPES_EXTERN Variant(int32_t); + QPID_TYPES_EXTERN Variant(int64_t); + QPID_TYPES_EXTERN Variant(float); + QPID_TYPES_EXTERN Variant(double); + QPID_TYPES_EXTERN Variant(const std::string&); + QPID_TYPES_EXTERN Variant(const char*); + QPID_TYPES_EXTERN Variant(const Map&); + QPID_TYPES_EXTERN Variant(const List&); + QPID_TYPES_EXTERN Variant(const Variant&); + QPID_TYPES_EXTERN Variant(const Uuid&); + + QPID_TYPES_EXTERN ~Variant(); + + QPID_TYPES_EXTERN VariantType getType() const; + QPID_TYPES_EXTERN bool isVoid() const; + + QPID_TYPES_EXTERN Variant& operator=(bool); + QPID_TYPES_EXTERN Variant& operator=(uint8_t); + QPID_TYPES_EXTERN Variant& operator=(uint16_t); + QPID_TYPES_EXTERN Variant& operator=(uint32_t); + QPID_TYPES_EXTERN Variant& operator=(uint64_t); + QPID_TYPES_EXTERN Variant& operator=(int8_t); + QPID_TYPES_EXTERN Variant& operator=(int16_t); + QPID_TYPES_EXTERN Variant& operator=(int32_t); + QPID_TYPES_EXTERN Variant& operator=(int64_t); + QPID_TYPES_EXTERN Variant& operator=(float); + QPID_TYPES_EXTERN Variant& operator=(double); + QPID_TYPES_EXTERN Variant& operator=(const std::string&); + QPID_TYPES_EXTERN Variant& operator=(const char*); + QPID_TYPES_EXTERN Variant& operator=(const Map&); + QPID_TYPES_EXTERN Variant& operator=(const List&); + QPID_TYPES_EXTERN Variant& operator=(const Variant&); + QPID_TYPES_EXTERN Variant& operator=(const Uuid&); + + QPID_TYPES_EXTERN Variant& fromString(const std::string&); + + QPID_TYPES_EXTERN bool asBool() const; + QPID_TYPES_EXTERN uint8_t asUint8() const; + QPID_TYPES_EXTERN uint16_t asUint16() const; + QPID_TYPES_EXTERN uint32_t asUint32() const; + QPID_TYPES_EXTERN uint64_t asUint64() const; + QPID_TYPES_EXTERN int8_t asInt8() const; + QPID_TYPES_EXTERN int16_t asInt16() const; + QPID_TYPES_EXTERN int32_t asInt32() const; + QPID_TYPES_EXTERN int64_t asInt64() const; + QPID_TYPES_EXTERN float asFloat() const; + QPID_TYPES_EXTERN double asDouble() const; + QPID_TYPES_EXTERN std::string asString() const; + QPID_TYPES_EXTERN Uuid asUuid() const; + + QPID_TYPES_EXTERN operator bool() const; + QPID_TYPES_EXTERN operator uint8_t() const; + QPID_TYPES_EXTERN operator uint16_t() const; + QPID_TYPES_EXTERN operator uint32_t() const; + QPID_TYPES_EXTERN operator uint64_t() const; + QPID_TYPES_EXTERN operator int8_t() const; + QPID_TYPES_EXTERN operator int16_t() const; + QPID_TYPES_EXTERN operator int32_t() const; + QPID_TYPES_EXTERN operator int64_t() const; + QPID_TYPES_EXTERN operator float() const; + QPID_TYPES_EXTERN operator double() const; + QPID_TYPES_EXTERN operator std::string() const; + QPID_TYPES_EXTERN operator Uuid() const; + + QPID_TYPES_EXTERN const Map& asMap() const; + QPID_TYPES_EXTERN Map& asMap(); + QPID_TYPES_EXTERN const List& asList() const; + QPID_TYPES_EXTERN List& asList(); + /** + * Unlike asString(), getString() will not do any conversions and + * will throw InvalidConversion if the type is not STRING. + */ + QPID_TYPES_EXTERN const std::string& getString() const; + QPID_TYPES_EXTERN std::string& getString(); + + QPID_TYPES_EXTERN void setEncoding(const std::string&); + QPID_TYPES_EXTERN const std::string& getEncoding() const; + + QPID_TYPES_EXTERN bool isEqualTo(const Variant& a) const; + + QPID_TYPES_EXTERN void reset(); + private: + VariantImpl* impl; +}; + +QPID_TYPES_EXTERN std::ostream& operator<<(std::ostream& out, const Variant& value); +QPID_TYPES_EXTERN std::ostream& operator<<(std::ostream& out, const Variant::Map& map); +QPID_TYPES_EXTERN std::ostream& operator<<(std::ostream& out, const Variant::List& list); +QPID_TYPES_EXTERN bool operator==(const Variant& a, const Variant& b); +}} // namespace qpid::types + +#endif /*!QPID_TYPES_VARIANT_H*/ diff --git a/nativeLib/org.apache.qpid/lib/libqpidclient.la b/nativeLib/org.apache.qpid/lib/libqpidclient.la deleted file mode 100755 index 5631ce25d3..0000000000 --- a/nativeLib/org.apache.qpid/lib/libqpidclient.la +++ /dev/null @@ -1,35 +0,0 @@ -# libqpidclient.la - a libtool library file -# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 22:14:06) -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libqpidclient.so.2' - -# Names of this library. -library_names='libqpidclient.so.2.0.0 libqpidclient.so.2 libqpidclient.so' - -# The name of the static archive. -old_library='' - -# Libraries that this one depends upon. -dependency_libs=' -L/awips2/qpid/lib -L/usr/local/lib -L/usr/lib/openais -L/usr/lib64/openais -L/usr/lib/corosync -L/usr/lib64/corosync /awips2/qpid/lib/libqpidcommon.la -lboost_program_options -lboost_filesystem -ldl -lrt -luuid -lcoroipcc' - -# Version information for libqpidclient. -current=2 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/awips2/qpid/lib' diff --git a/nativeLib/org.apache.qpid/lib/libqpidclient.so b/nativeLib/org.apache.qpid/lib/libqpidclient.so new file mode 120000 index 0000000000..be7a476349 --- /dev/null +++ b/nativeLib/org.apache.qpid/lib/libqpidclient.so @@ -0,0 +1 @@ +libqpidclient.so.4.0.0 \ No newline at end of file diff --git a/nativeLib/org.apache.qpid/lib/libqpidclient.so.2 b/nativeLib/org.apache.qpid/lib/libqpidclient.so.2 deleted file mode 100755 index 59f0871060..0000000000 Binary files a/nativeLib/org.apache.qpid/lib/libqpidclient.so.2 and /dev/null differ diff --git a/nativeLib/org.apache.qpid/lib/libqpidclient.so.2.0.0 b/nativeLib/org.apache.qpid/lib/libqpidclient.so.2.0.0 deleted file mode 100755 index 59f0871060..0000000000 Binary files a/nativeLib/org.apache.qpid/lib/libqpidclient.so.2.0.0 and /dev/null differ diff --git a/nativeLib/org.apache.qpid/lib/libqpidclient.so.4 b/nativeLib/org.apache.qpid/lib/libqpidclient.so.4 new file mode 120000 index 0000000000..be7a476349 --- /dev/null +++ b/nativeLib/org.apache.qpid/lib/libqpidclient.so.4 @@ -0,0 +1 @@ +libqpidclient.so.4.0.0 \ No newline at end of file diff --git a/nativeLib/org.apache.qpid/lib/libqpidclient.so.4.0.0 b/nativeLib/org.apache.qpid/lib/libqpidclient.so.4.0.0 new file mode 100755 index 0000000000..a605493071 Binary files /dev/null and b/nativeLib/org.apache.qpid/lib/libqpidclient.so.4.0.0 differ diff --git a/nativeLib/org.apache.qpid/lib/libqpidcommon.la b/nativeLib/org.apache.qpid/lib/libqpidcommon.la deleted file mode 100755 index 2e6ef6bda0..0000000000 --- a/nativeLib/org.apache.qpid/lib/libqpidcommon.la +++ /dev/null @@ -1,35 +0,0 @@ -# libqpidcommon.la - a libtool library file -# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 22:14:06) -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libqpidcommon.so.2' - -# Names of this library. -library_names='libqpidcommon.so.2.0.0 libqpidcommon.so.2 libqpidcommon.so' - -# The name of the static archive. -old_library='' - -# Libraries that this one depends upon. -dependency_libs=' -L/awips2/qpid/lib -L/usr/local/lib -L/usr/lib/openais -L/usr/lib64/openais -L/usr/lib/corosync -L/usr/lib64/corosync -lboost_program_options -lboost_filesystem -luuid -ldl -lrt -lcoroipcc' - -# Version information for libqpidcommon. -current=2 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/awips2/qpid/lib' diff --git a/nativeLib/org.apache.qpid/lib/libqpidcommon.so b/nativeLib/org.apache.qpid/lib/libqpidcommon.so new file mode 120000 index 0000000000..dd3f10f6f5 --- /dev/null +++ b/nativeLib/org.apache.qpid/lib/libqpidcommon.so @@ -0,0 +1 @@ +libqpidcommon.so.4.0.0 \ No newline at end of file diff --git a/nativeLib/org.apache.qpid/lib/libqpidcommon.so.2 b/nativeLib/org.apache.qpid/lib/libqpidcommon.so.2 deleted file mode 100755 index d16813b058..0000000000 Binary files a/nativeLib/org.apache.qpid/lib/libqpidcommon.so.2 and /dev/null differ diff --git a/nativeLib/org.apache.qpid/lib/libqpidcommon.so.2.0.0 b/nativeLib/org.apache.qpid/lib/libqpidcommon.so.2.0.0 deleted file mode 100755 index d16813b058..0000000000 Binary files a/nativeLib/org.apache.qpid/lib/libqpidcommon.so.2.0.0 and /dev/null differ diff --git a/nativeLib/org.apache.qpid/lib/libqpidcommon.so.4 b/nativeLib/org.apache.qpid/lib/libqpidcommon.so.4 new file mode 120000 index 0000000000..dd3f10f6f5 --- /dev/null +++ b/nativeLib/org.apache.qpid/lib/libqpidcommon.so.4 @@ -0,0 +1 @@ +libqpidcommon.so.4.0.0 \ No newline at end of file diff --git a/nativeLib/org.apache.qpid/lib/libqpidcommon.so.4.0.0 b/nativeLib/org.apache.qpid/lib/libqpidcommon.so.4.0.0 new file mode 100755 index 0000000000..118b5274db Binary files /dev/null and b/nativeLib/org.apache.qpid/lib/libqpidcommon.so.4.0.0 differ diff --git a/nativeLib/org.apache.qpid/lib/libqpidmessaging.so b/nativeLib/org.apache.qpid/lib/libqpidmessaging.so new file mode 120000 index 0000000000..4effa60ca2 --- /dev/null +++ b/nativeLib/org.apache.qpid/lib/libqpidmessaging.so @@ -0,0 +1 @@ +libqpidmessaging.so.3.0.2 \ No newline at end of file diff --git a/nativeLib/org.apache.qpid/lib/libqpidmessaging.so.3 b/nativeLib/org.apache.qpid/lib/libqpidmessaging.so.3 new file mode 120000 index 0000000000..4effa60ca2 --- /dev/null +++ b/nativeLib/org.apache.qpid/lib/libqpidmessaging.so.3 @@ -0,0 +1 @@ +libqpidmessaging.so.3.0.2 \ No newline at end of file diff --git a/nativeLib/org.apache.qpid/lib/libqpidmessaging.so.3.0.2 b/nativeLib/org.apache.qpid/lib/libqpidmessaging.so.3.0.2 new file mode 100755 index 0000000000..a1a4dfc0a8 Binary files /dev/null and b/nativeLib/org.apache.qpid/lib/libqpidmessaging.so.3.0.2 differ diff --git a/nativeLib/org.apache.qpid/lib/libqpidtypes.so b/nativeLib/org.apache.qpid/lib/libqpidtypes.so new file mode 120000 index 0000000000..5e9777f8f0 --- /dev/null +++ b/nativeLib/org.apache.qpid/lib/libqpidtypes.so @@ -0,0 +1 @@ +libqpidtypes.so.1.1.1 \ No newline at end of file diff --git a/nativeLib/org.apache.qpid/lib/libqpidtypes.so.1 b/nativeLib/org.apache.qpid/lib/libqpidtypes.so.1 new file mode 120000 index 0000000000..5e9777f8f0 --- /dev/null +++ b/nativeLib/org.apache.qpid/lib/libqpidtypes.so.1 @@ -0,0 +1 @@ +libqpidtypes.so.1.1.1 \ No newline at end of file diff --git a/nativeLib/org.apache.qpid/lib/libqpidtypes.so.1.1.1 b/nativeLib/org.apache.qpid/lib/libqpidtypes.so.1.1.1 new file mode 100755 index 0000000000..dac2b637df Binary files /dev/null and b/nativeLib/org.apache.qpid/lib/libqpidtypes.so.1.1.1 differ diff --git a/nativeLib/org.apache.qpid/lib64/libqpidclient.so b/nativeLib/org.apache.qpid/lib64/libqpidclient.so new file mode 100755 index 0000000000..85bfd72782 Binary files /dev/null and b/nativeLib/org.apache.qpid/lib64/libqpidclient.so differ diff --git a/nativeLib/org.apache.qpid/lib64/libqpidclient.so.4 b/nativeLib/org.apache.qpid/lib64/libqpidclient.so.4 new file mode 100755 index 0000000000..85bfd72782 Binary files /dev/null and b/nativeLib/org.apache.qpid/lib64/libqpidclient.so.4 differ diff --git a/nativeLib/org.apache.qpid/lib64/libqpidclient.so.4.0.0 b/nativeLib/org.apache.qpid/lib64/libqpidclient.so.4.0.0 new file mode 100755 index 0000000000..85bfd72782 Binary files /dev/null and b/nativeLib/org.apache.qpid/lib64/libqpidclient.so.4.0.0 differ diff --git a/nativeLib/org.apache.qpid/lib64/libqpidcommon.so b/nativeLib/org.apache.qpid/lib64/libqpidcommon.so new file mode 100755 index 0000000000..0da4707f69 Binary files /dev/null and b/nativeLib/org.apache.qpid/lib64/libqpidcommon.so differ diff --git a/nativeLib/org.apache.qpid/lib64/libqpidcommon.so.4 b/nativeLib/org.apache.qpid/lib64/libqpidcommon.so.4 new file mode 100755 index 0000000000..0da4707f69 Binary files /dev/null and b/nativeLib/org.apache.qpid/lib64/libqpidcommon.so.4 differ diff --git a/nativeLib/org.apache.qpid/lib64/libqpidcommon.so.4.0.0 b/nativeLib/org.apache.qpid/lib64/libqpidcommon.so.4.0.0 new file mode 100755 index 0000000000..0da4707f69 Binary files /dev/null and b/nativeLib/org.apache.qpid/lib64/libqpidcommon.so.4.0.0 differ diff --git a/nativeLib/org.apache.qpid/lib64/libqpidmessaging.so b/nativeLib/org.apache.qpid/lib64/libqpidmessaging.so new file mode 100755 index 0000000000..cbd348f53a Binary files /dev/null and b/nativeLib/org.apache.qpid/lib64/libqpidmessaging.so differ diff --git a/nativeLib/org.apache.qpid/lib64/libqpidmessaging.so.3 b/nativeLib/org.apache.qpid/lib64/libqpidmessaging.so.3 new file mode 100755 index 0000000000..cbd348f53a Binary files /dev/null and b/nativeLib/org.apache.qpid/lib64/libqpidmessaging.so.3 differ diff --git a/nativeLib/org.apache.qpid/lib64/libqpidmessaging.so.3.0.2 b/nativeLib/org.apache.qpid/lib64/libqpidmessaging.so.3.0.2 new file mode 100755 index 0000000000..cbd348f53a Binary files /dev/null and b/nativeLib/org.apache.qpid/lib64/libqpidmessaging.so.3.0.2 differ diff --git a/nativeLib/org.apache.qpid/lib64/libqpidtypes.so b/nativeLib/org.apache.qpid/lib64/libqpidtypes.so new file mode 100755 index 0000000000..e3e98656c8 Binary files /dev/null and b/nativeLib/org.apache.qpid/lib64/libqpidtypes.so differ diff --git a/nativeLib/org.apache.qpid/lib64/libqpidtypes.so.1 b/nativeLib/org.apache.qpid/lib64/libqpidtypes.so.1 new file mode 100755 index 0000000000..e3e98656c8 Binary files /dev/null and b/nativeLib/org.apache.qpid/lib64/libqpidtypes.so.1 differ diff --git a/nativeLib/org.apache.qpid/lib64/libqpidtypes.so.1.1.1 b/nativeLib/org.apache.qpid/lib64/libqpidtypes.so.1.1.1 new file mode 100755 index 0000000000..e3e98656c8 Binary files /dev/null and b/nativeLib/org.apache.qpid/lib64/libqpidtypes.so.1.1.1 differ diff --git a/nativeLib/org.apache.thrift/README b/nativeLib/org.apache.thrift/README new file mode 100644 index 0000000000..25c4105b21 --- /dev/null +++ b/nativeLib/org.apache.thrift/README @@ -0,0 +1,5 @@ +Version = 0.5.0 + +Origin +------ +http://archive.apache.org/dist/incubator/thrift/0.5.0-incubating/ diff --git a/nativeLib/org.apache.thrift/lib/libthrift.la b/nativeLib/org.apache.thrift/lib/libthrift.la deleted file mode 100755 index 81afc49691..0000000000 --- a/nativeLib/org.apache.thrift/lib/libthrift.la +++ /dev/null @@ -1,41 +0,0 @@ -# libthrift.la - a libtool library file -# Generated by ltmain.sh (GNU libtool) 2.2.6b -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libthrift.so.0' - -# Names of this library. -library_names='libthrift.so.0.0.0 libthrift.so.0 libthrift.so' - -# The name of the static archive. -old_library='libthrift.a' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -lrt -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libthrift. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/usr/local/lib' diff --git a/nativeLib/org.apache.thrift/lib/libthrift.so b/nativeLib/org.apache.thrift/lib/libthrift.so new file mode 100755 index 0000000000..a96945e24e Binary files /dev/null and b/nativeLib/org.apache.thrift/lib/libthrift.so differ diff --git a/nativeLib/org.apache.thrift/lib/libthriftz.la b/nativeLib/org.apache.thrift/lib/libthriftz.la deleted file mode 100755 index 6cadecd3ce..0000000000 --- a/nativeLib/org.apache.thrift/lib/libthriftz.la +++ /dev/null @@ -1,41 +0,0 @@ -# libthriftz.la - a libtool library file -# Generated by ltmain.sh (GNU libtool) 2.2.6b -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libthriftz.so.0' - -# Names of this library. -library_names='libthriftz.so.0.0.0 libthriftz.so.0 libthriftz.so' - -# The name of the static archive. -old_library='libthriftz.a' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -lrt -lpthread' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libthriftz. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/usr/local/lib' diff --git a/nativeLib/org.apache.thrift/lib/libthriftz.so b/nativeLib/org.apache.thrift/lib/libthriftz.so new file mode 100755 index 0000000000..7ab0c1cf3e Binary files /dev/null and b/nativeLib/org.apache.thrift/lib/libthriftz.so differ diff --git a/nativeLib/org.apache.thrift/lib64/libthrift.so b/nativeLib/org.apache.thrift/lib64/libthrift.so new file mode 100755 index 0000000000..36442b0c14 Binary files /dev/null and b/nativeLib/org.apache.thrift/lib64/libthrift.so differ diff --git a/nativeLib/org.apache.thrift/lib64/libthrift.so.0 b/nativeLib/org.apache.thrift/lib64/libthrift.so.0 new file mode 100755 index 0000000000..36442b0c14 Binary files /dev/null and b/nativeLib/org.apache.thrift/lib64/libthrift.so.0 differ diff --git a/nativeLib/org.apache.thrift/lib64/libthrift.so.0.0.0 b/nativeLib/org.apache.thrift/lib64/libthrift.so.0.0.0 new file mode 100755 index 0000000000..36442b0c14 Binary files /dev/null and b/nativeLib/org.apache.thrift/lib64/libthrift.so.0.0.0 differ diff --git a/nativeLib/org.apache.thrift/lib64/libthriftz.so b/nativeLib/org.apache.thrift/lib64/libthriftz.so new file mode 100755 index 0000000000..ac88762445 Binary files /dev/null and b/nativeLib/org.apache.thrift/lib64/libthriftz.so differ diff --git a/nativeLib/org.apache.thrift/lib64/libthriftz.so.0 b/nativeLib/org.apache.thrift/lib64/libthriftz.so.0 new file mode 100755 index 0000000000..ac88762445 Binary files /dev/null and b/nativeLib/org.apache.thrift/lib64/libthriftz.so.0 differ diff --git a/nativeLib/org.apache.thrift/lib64/libthriftz.so.0.0.0 b/nativeLib/org.apache.thrift/lib64/libthriftz.so.0.0.0 new file mode 100755 index 0000000000..ac88762445 Binary files /dev/null and b/nativeLib/org.apache.thrift/lib64/libthriftz.so.0.0.0 differ diff --git a/nativeLib/org.apache.thrift/thrift-0.5.0.tar.gz b/nativeLib/org.apache.thrift/thrift-0.5.0.tar.gz new file mode 100644 index 0000000000..e061fc78a0 Binary files /dev/null and b/nativeLib/org.apache.thrift/thrift-0.5.0.tar.gz differ diff --git a/pythonPackages/setuptools/setuptools-0.6c11.tar.gz b/pythonPackages/setuptools/setuptools-0.6c11.tar.gz new file mode 100644 index 0000000000..a87650c931 Binary files /dev/null and b/pythonPackages/setuptools/setuptools-0.6c11.tar.gz differ diff --git a/pythonPackages/shapely/Shapely-1.2.16.tar.gz b/pythonPackages/shapely/Shapely-1.2.16.tar.gz new file mode 100644 index 0000000000..cdee8b07a7 Binary files /dev/null and b/pythonPackages/shapely/Shapely-1.2.16.tar.gz differ diff --git a/rpms/awips2.core/Installer.notification/component.spec b/rpms/awips2.core/Installer.notification/component.spec index 4a44d80473..2e64153984 100644 --- a/rpms/awips2.core/Installer.notification/component.spec +++ b/rpms/awips2.core/Installer.notification/component.spec @@ -35,8 +35,20 @@ then exit 1 fi +if [ -d ${RPM_BUILD_ROOT} ]; then + rm -rf ${RPM_BUILD_ROOT} + if [ $? -ne 0 ]; then + exit 1 + fi +fi mkdir -p ${RPM_BUILD_ROOT}/awips2/notification +if [ $? -ne 0 ]; then + exit 1 +fi mkdir -p ${RPM_BUILD_ROOT}/etc/profile.d +if [ $? -ne 0 ]; then + exit 1 +fi PROFILE_D_DIR="rpms/awips2.core/Installer.notification/scripts/profile.d" cp %{_baseline_workspace}/${PROFILE_D_DIR}/* ${RPM_BUILD_ROOT}/etc/profile.d @@ -67,24 +79,20 @@ function copyLegal() rm -f %{_baseline_workspace}/rpms/legal/FOSS_licenses.tar } -RPM_CORE_PROJECT_DIR="%{_baseline_workspace}/rpms/awips2.core" -NOTIFICATION_TAR_FILE_DIR="${RPM_CORE_PROJECT_DIR}/Installer.notification/src" -NOTIFICATION_TAR_FILE="${NOTIFICATION_TAR_FILE_DIR}/edex_com.tar.bz2" +BUILD_NATIVE="%{_baseline_workspace}/build.native" -cd ${RPM_BUILD_ROOT}/awips2 -/bin/gtar -xpf ${NOTIFICATION_TAR_FILE} +pushd . > /dev/null 2>&1 +cd ${BUILD_NATIVE} +/bin/bash build-notification.sh %{_baseline_workspace} \ + %{_uframe_eclipse} ${RPM_BUILD_ROOT} if [ $? -ne 0 ]; then exit 1 fi - -cp -r ${RPM_BUILD_ROOT}/awips2/edex_com/* \ - ${RPM_BUILD_ROOT}/awips2/notification/ +rm -rf ${RPM_BUILD_ROOT}/workspace_ if [ $? -ne 0 ]; then exit 1 fi -# Remove the boost rpms directory -rm -rf ${RPM_BUILD_ROOT}/awips2/notification/rpms -rm -rf ${RPM_BUILD_ROOT}/awips2/edex_com +popd > /dev/null 2>&1 copyLegal "awips2/notification" @@ -138,7 +146,6 @@ rm -rf ${RPM_BUILD_ROOT} %docdir /awips2/notification/licenses %dir /awips2/notification/licenses /awips2/notification/licenses/* -%doc /awips2/notification/README %dir /awips2/notification/src /awips2/notification/src/* diff --git a/rpms/awips2.core/Installer.notification/scripts/profile.d/awips2Notification.csh b/rpms/awips2.core/Installer.notification/scripts/profile.d/awips2Notification.csh index 5de8cc8e1e..efdeb76069 100644 --- a/rpms/awips2.core/Installer.notification/scripts/profile.d/awips2Notification.csh +++ b/rpms/awips2.core/Installer.notification/scripts/profile.d/awips2Notification.csh @@ -1,7 +1,7 @@ #!/bin/csh # Determine where notification has been installed. -set NOTIFICATION_INSTALL=`rpm -q --queryformat '%{INSTALLPREFIX}' awips2-notification` +set NOTIFICATION_INSTALL="/awips2/notification" if $?LD_LIBRARY_PATH then setenv LD_LIBRARY_PATH ${NOTIFICATION_INSTALL}/lib:$LD_LIBRARY_PATH diff --git a/rpms/awips2.core/Installer.notification/scripts/profile.d/awips2Notification.sh b/rpms/awips2.core/Installer.notification/scripts/profile.d/awips2Notification.sh index f9084dbec9..332c059a6f 100644 --- a/rpms/awips2.core/Installer.notification/scripts/profile.d/awips2Notification.sh +++ b/rpms/awips2.core/Installer.notification/scripts/profile.d/awips2Notification.sh @@ -8,7 +8,7 @@ if [ ${RC} -ne 0 ]; then fi # Determine Where awips2-notification Has Been Installed. -NOTIFICATION_INSTALL=`rpm -q --queryformat '%{INSTALLPREFIX}' awips2-notification` +NOTIFICATION_INSTALL="/awips2/notification" if [ "${NOTIFICATION_INSTALL}" = "" ]; then return fi diff --git a/rpms/awips2.core/Installer.notification/src/edex_com.tar.bz2 b/rpms/awips2.core/Installer.notification/src/edex_com.tar.bz2 deleted file mode 100644 index f1697b7745..0000000000 Binary files a/rpms/awips2.core/Installer.notification/src/edex_com.tar.bz2 and /dev/null differ diff --git a/rpms/build/x86_64/build.sh b/rpms/build/x86_64/build.sh index 600e559367..457f5f4c93 100644 --- a/rpms/build/x86_64/build.sh +++ b/rpms/build/x86_64/build.sh @@ -116,6 +116,7 @@ if [ "${1}" = "-64bit" ]; then buildRPM "awips2-python-pycairo" buildRPM "awips2-java" buildRPM "awips2" + buildRPM "awips2-notification" exit 0 fi @@ -145,6 +146,7 @@ if [ "${1}" = "-delta" ]; then exit 1 fi buildRPM "awips2-edex-environment" + buildRPM "awips2-notification" exit 0 fi @@ -199,6 +201,7 @@ if [ "${1}" = "-full" ]; then exit 1 fi buildRPM "awips2-edex-environment" + buildRPM "awips2-notification" exit 0 fi @@ -231,7 +234,11 @@ if [ "${1}" = "-edex" ]; then fi if [ "${1}" = "-qpid" ]; then - echo "INFO: AWIPS II currently does not support a 64-bit version of QPID." + buildQPID + if [ $? -ne 0 ]; then + exit 1 + fi + exit 0 fi diff --git a/rpms/python.site-packages/Installer.shapely/component.spec b/rpms/python.site-packages/Installer.shapely/component.spec new file mode 100644 index 0000000000..03045408ac --- /dev/null +++ b/rpms/python.site-packages/Installer.shapely/component.spec @@ -0,0 +1,175 @@ +%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') +%define _build_arch %(uname -i) +%define _python_pkgs_dir "%{_baseline_workspace}/pythonPackages" + +# +# AWIPS II Python shapely Spec File +# + +Name: awips2-python-shapely +Summary: AWIPS II Python shapely Distribution +Version: 1.2.16 +Release: 1 +Group: AWIPSII +BuildRoot: %{_build_root} +BuildArch: %{_build_arch} +URL: N/A +License: N/A +Distribution: N/A +Vendor: Raytheon +Packager: Bryan Kowal + +AutoReq: no +requires: awips2-python +provides: awips2-python-shapely + +%description +AWIPS II Python shapely Site-Package + +%prep +# Verify That The User Has Specified A BuildRoot. +if [ "%{_build_root}" = "" ] +then + echo "A Build Root has not been specified." + echo "Unable To Continue ... Terminating" + exit 1 +fi + +if [ -d ${RPM_BUILD_ROOT} ]; then + rm -rf ${RPM_BUILD_ROOT} + if [ $? -ne 0 ]; then + exit 1 + fi +fi + +rm -rf %{_build_root} +mkdir -p %{_build_root} +mkdir -p %{_build_root}/build-python + +PYTHON_RPM_DIR="%{_baseline_workspace}/rpms/python.site-packages" +INSTALL_SETUPTOOLS_SH="${PYTHON_RPM_DIR}/deploy.builder/install-setuptools.sh" +# install setuptools +/bin/bash ${INSTALL_SETUPTOOLS_SH} %{_baseline_workspace} \ + %{_python_pkgs_dir} %{_build_root}/build-python +if [ $? -ne 0 ]; then + exit 1 +fi + +rm -rf %{_build_root}/build-python +mkdir -p %{_build_root}/build-python +mkdir -p %{_build_root}/awips2/python/lib +mkdir -p %{_build_root}/awips2/python/bin +mkdir -p %{_build_root}/awips2/python/include + +%build +# build geos +__GEOS_TAR=geos-3.3.6.tar.bz2 +__GEOS_UNTARRED=geos-3.3.6 +PYTHON_RPM_DIR="%{_baseline_workspace}/rpms/python.site-packages" +INSTALLER_SHAPELY_DIR="${PYTHON_RPM_DIR}/Installer.shapely" + +cp ${INSTALLER_SHAPELY_DIR}/${__GEOS_TAR} \ + %{_build_root}/build-python +if [ $? -ne 0 ]; then + exit 1 +fi + +cd %{_build_root}/build-python +tar -xvf ${__GEOS_TAR} +if [ $? -ne 0 ]; then + exit 1 +fi +cd ${__GEOS_UNTARRED} +./configure --prefix=%{_build_root}/awips2/python +if [ $? -ne 0 ]; then + exit 1 +fi +make +if [ $? -ne 0 ]; then + exit 1 +fi +make install +if [ $? -ne 0 ]; then + exit 1 +fi + +# rename libgeos and libgeos_c to prevent conflicts +# with the version of geos that we are using for PostgreSQL. +# if we finally update PostgreSQL, we will be able to use +# the same geos libraries for PostgreSQL and Python Shapely + +# this will ensure that python shapely will be bound to the newer +# version of geos because it is not compatible with the version +# of geos that we are currently using for PostgreSQL + +__GEOS_C_SO=libgeos_c.so +__GEOS_C_336_SO=libgeos_c336.so +__GEOS_SO=libgeos.so +__GEOS_336_SO=libgeos336.so +__GEOS_A=libgeos.a +__GEOS_336_A= +__GEOS_C_A=libgeos_c.a +__GEOS_C_336_A= + +pushd . > /dev/null 2>&1 +cd %{_build_root}/awips2/python/lib +mv ${__GEOS_C_SO} ${__GEOS_C_336_SO} +if [ $? -ne 0 ]; then + exit 1 +fi +mv ${__GEOS_SO} ${__GEOS_336_SO} +if [ $? -ne 0 ]; then + exit 1 +fi +popd > /dev/null 2>&1 + +# build the shapely python site-package +SHAPELY_SRC_DIR="%{_python_pkgs_dir}/shapely" +__SHAPELY=shapely +__SHAPELY_TAR=Shapely-1.2.16.tar.gz +__SHAPELY_UNTARRED=Shapely-1.2.16 + +cp %{_python_pkgs_dir}/${__SHAPELY}/${__SHAPELY_TAR} \ + %{_build_root}/build-python +if [ $? -ne 0 ]; then + exit 1 +fi +cd %{_build_root}/build-python + +tar -xvf ${__SHAPELY_TAR} +if [ $? -ne 0 ]; then + exit 1 +fi +cd ${__SHAPELY_UNTARRED} +export CPPFLAGS="-I%{_build_root}/awips2/python/include" +export CPPFLAGS="${CPPFLAGS} -L%{_build_root}/awips2/python/lib" +/awips2/python/bin/python setup.py build +if [ $? -ne 0 ]; then + exit 1 +fi +/awips2/python/bin/python setup.py install \ + --root=%{_build_root} \ + --prefix=/awips2/python +if [ $? -ne 0 ]; then + exit 1 +fi + +rm -rf %{_build_root}/build-python +if [ $? -ne 0 ]; then + exit 1 +fi +exit 1 + +%clean +rm -rf %{_build_root} + +%files +%defattr(644,awips,fxalpha,755) +%dir /awips2/python/bin +/awips2/python/bin/* +%dir /awips2/python/lib +/awips2/python/lib/* + +exit 1 + +%install \ No newline at end of file diff --git a/rpms/python.site-packages/Installer.shapely/geos-3.3.6.tar.bz2 b/rpms/python.site-packages/Installer.shapely/geos-3.3.6.tar.bz2 new file mode 100644 index 0000000000..b4c3320baf Binary files /dev/null and b/rpms/python.site-packages/Installer.shapely/geos-3.3.6.tar.bz2 differ diff --git a/rpms/python.site-packages/deploy.builder/install-setuptools.sh b/rpms/python.site-packages/deploy.builder/install-setuptools.sh new file mode 100644 index 0000000000..4e3d5abb03 --- /dev/null +++ b/rpms/python.site-packages/deploy.builder/install-setuptools.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# Ensure that we have the required access. +touch /awips2/python/lib/python2.7/site-packages +RC=$? +if [ ${RC} -ne 0 ]; then + exit 1 +fi +touch /awips2/python/bin +RC=$? +if [ ${RC} -ne 0 ]; then + exit 1 +fi + +# this script will install the python setuptools site-package on a build machine. it will be used +# by pupynere and/or shapely + +# contants +__SETUP_TOOLS=setuptools +__SETUP_TOOLS_TAR=setuptools-0.6c11.tar.gz +__SETUP_TOOLS_UNTARRED=setuptools-0.6c11 + +# arguments: +# 1) workspace +# 2) python packages directory +# 3) build root - temporary directory + +WORKSPACE="${1}" +PYTHON_PACKAGES="${2}" +BUILD_ROOT="${3}" + +cp -v ${PYTHON_PACKAGES}/${__SETUP_TOOLS}/${__SETUP_TOOLS_TAR} \ + ${BUILD_ROOT} +if [ $? -ne 0 ]; then + exit 1 +fi +pushd . > /dev/null 2>&1 +cd ${BUILD_ROOT} +tar -xvf ${__SETUP_TOOLS_TAR} +if [ $? -ne 0 ]; then + exit 1 +fi +cd ${__SETUP_TOOLS_UNTARRED} +source /etc/profile.d/awips2Python.sh +if [ $? -ne 0 ]; then + exit 1 +fi +/awips2/python/bin/python setup.py build +if [ $? -ne 0 ]; then + exit 1 +fi +/awips2/python/bin/python setup.py install +if [ $? -ne 0 ]; then + exit 1 +fi +popd > /dev/null 2>&1