summaryrefslogtreecommitdiff
path: root/cpp/include
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/include')
-rw-r--r--cpp/include/qpid/client/SessionBase_0_10.h3
-rw-r--r--cpp/include/qpid/messaging/Address.h19
-rw-r--r--cpp/include/qpid/messaging/Connection.h14
-rw-r--r--cpp/include/qpid/messaging/Receiver.h4
-rw-r--r--cpp/include/qpid/messaging/Session.h10
-rw-r--r--cpp/include/qpid/messaging/exceptions.h150
-rw-r--r--cpp/include/qpid/types/Exception.h44
-rw-r--r--cpp/include/qpid/types/Variant.h4
8 files changed, 207 insertions, 41 deletions
diff --git a/cpp/include/qpid/client/SessionBase_0_10.h b/cpp/include/qpid/client/SessionBase_0_10.h
index 6b7ed97df4..3b5c84e74b 100644
--- a/cpp/include/qpid/client/SessionBase_0_10.h
+++ b/cpp/include/qpid/client/SessionBase_0_10.h
@@ -100,9 +100,6 @@ class SessionBase_0_10 {
QPID_CLIENT_EXTERN bool isValid() const;
QPID_CLIENT_EXTERN Connection getConnection();
-
- /** Send sync request without actually blocking for it**/
- QPID_CLIENT_EXTERN void sendSyncRequest();
protected:
boost::shared_ptr<SessionImpl> impl;
friend class SessionBase_0_10Access;
diff --git a/cpp/include/qpid/messaging/Address.h b/cpp/include/qpid/messaging/Address.h
index 34a186c9ce..3722db94e8 100644
--- a/cpp/include/qpid/messaging/Address.h
+++ b/cpp/include/qpid/messaging/Address.h
@@ -22,7 +22,7 @@
*
*/
#include <string>
-#include "qpid/Exception.h"
+#include "qpid/messaging/exceptions.h"
#include "qpid/types/Variant.h"
#include "qpid/messaging/ImportExport.h"
#include <ostream>
@@ -30,23 +30,6 @@
namespace qpid {
namespace messaging {
-/**
- * Thrown when a syntactically correct address cannot be resolved or
- * used.
- */
-struct InvalidAddress : public qpid::Exception
-{
- InvalidAddress(const std::string& msg);
-};
-
-/**
- * Thrown when an address string with inalid sytanx is used.
- */
-struct MalformedAddress : public qpid::Exception
-{
- MalformedAddress(const std::string& msg);
-};
-
class AddressImpl;
/**
diff --git a/cpp/include/qpid/messaging/Connection.h b/cpp/include/qpid/messaging/Connection.h
index e58abc1986..23711034d6 100644
--- a/cpp/include/qpid/messaging/Connection.h
+++ b/cpp/include/qpid/messaging/Connection.h
@@ -24,6 +24,7 @@
#include <string>
#include "qpid/messaging/ImportExport.h"
#include "qpid/messaging/Handle.h"
+#include "qpid/messaging/exceptions.h"
#include "qpid/types/Variant.h"
namespace qpid {
@@ -33,11 +34,6 @@ template <class> class PrivateImplRef;
class ConnectionImpl;
class Session;
-struct InvalidOptionString : public qpid::Exception
-{
- InvalidOptionString(const std::string& msg);
-};
-
class Connection : public qpid::messaging::Handle<ConnectionImpl>
{
public:
@@ -51,6 +47,7 @@ class Connection : public qpid::messaging::Handle<ConnectionImpl>
* heartbeat
* tcp-nodelay
* sasl-mechanism
+ * sasl-service
* sasl-min-ssf
* sasl-max-ssf
* transport
@@ -78,13 +75,12 @@ class Connection : public qpid::messaging::Handle<ConnectionImpl>
*
* @exception InvalidOptionString if the string does not match the correct syntax
*/
- QPID_CLIENT_EXTERN Connection(const std::string& url, const std::string& options);
+ QPID_CLIENT_EXTERN Connection(const std::string& url, const std::string& options) throw(InvalidOptionString);
QPID_CLIENT_EXTERN ~Connection();
QPID_CLIENT_EXTERN Connection& operator=(const Connection&);
QPID_CLIENT_EXTERN void setOption(const std::string& name, const qpid::types::Variant& value);
- QPID_CLIENT_EXTERN void connect();
- QPID_CLIENT_EXTERN bool isConnected();
- QPID_CLIENT_EXTERN void detach();
+ QPID_CLIENT_EXTERN void open();
+ QPID_CLIENT_EXTERN bool isOpen();
/**
* Closes a connection and all sessions associated with it. An
* opened connection must be closed before the last handle is
diff --git a/cpp/include/qpid/messaging/Receiver.h b/cpp/include/qpid/messaging/Receiver.h
index d89813acfc..6926d3401a 100644
--- a/cpp/include/qpid/messaging/Receiver.h
+++ b/cpp/include/qpid/messaging/Receiver.h
@@ -21,7 +21,7 @@
* under the License.
*
*/
-#include "qpid/Exception.h"
+#include "qpid/messaging/exceptions.h"
#include "qpid/messaging/ImportExport.h"
#include "qpid/messaging/Handle.h"
#include "qpid/messaging/Duration.h"
@@ -41,8 +41,6 @@ class Session;
class Receiver : public qpid::messaging::Handle<ReceiverImpl>
{
public:
- struct NoMessageAvailable : qpid::Exception {};
-
QPID_CLIENT_EXTERN Receiver(ReceiverImpl* impl = 0);
QPID_CLIENT_EXTERN Receiver(const Receiver&);
QPID_CLIENT_EXTERN ~Receiver();
diff --git a/cpp/include/qpid/messaging/Session.h b/cpp/include/qpid/messaging/Session.h
index 95f9832576..b3bc527329 100644
--- a/cpp/include/qpid/messaging/Session.h
+++ b/cpp/include/qpid/messaging/Session.h
@@ -21,7 +21,7 @@
* under the License.
*
*/
-#include "qpid/Exception.h"
+#include "qpid/messaging/exceptions.h"
#include "qpid/messaging/Duration.h"
#include "qpid/messaging/ImportExport.h"
#include "qpid/messaging/Handle.h"
@@ -40,11 +40,6 @@ class Receiver;
class SessionImpl;
class Subscription;
-struct KeyError : qpid::Exception
-{
- QPID_CLIENT_EXTERN KeyError(const std::string&);
-};
-
/**
* A session represents a distinct 'conversation' which can involve
* sending and receiving messages to and from different addresses.
@@ -159,6 +154,9 @@ class Session : public qpid::messaging::Handle<SessionImpl>
*/
QPID_CLIENT_EXTERN Connection getConnection() const;
+ QPID_CLIENT_EXTERN bool hasError();
+ QPID_CLIENT_EXTERN void checkError();
+
private:
friend class qpid::messaging::PrivateImplRef<Session>;
};
diff --git a/cpp/include/qpid/messaging/exceptions.h b/cpp/include/qpid/messaging/exceptions.h
new file mode 100644
index 0000000000..af7959fe13
--- /dev/null
+++ b/cpp/include/qpid/messaging/exceptions.h
@@ -0,0 +1,150 @@
+#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/types/Exception.h"
+#include "qpid/types/Variant.h"
+#include "qpid/messaging/ImportExport.h"
+
+namespace qpid {
+namespace messaging {
+
+struct MessagingException : public qpid::types::Exception
+{
+ QPID_CLIENT_EXTERN MessagingException(const std::string& msg);
+ QPID_CLIENT_EXTERN virtual ~MessagingException() throw();
+
+ qpid::types::Variant::Map detail;
+ //TODO: override what() to include detail if present
+};
+
+struct InvalidOptionString : public MessagingException
+{
+ QPID_CLIENT_EXTERN InvalidOptionString(const std::string& msg);
+};
+
+struct KeyError : MessagingException
+{
+ QPID_CLIENT_EXTERN KeyError(const std::string&);
+};
+
+struct LinkError : MessagingException
+{
+ QPID_CLIENT_EXTERN LinkError(const std::string&);
+};
+
+struct AddressError : LinkError
+{
+ QPID_CLIENT_EXTERN AddressError(const std::string&);
+};
+
+/**
+ * Thrown when a syntactically correct address cannot be resolved or
+ * used.
+ */
+struct ResolutionError : public AddressError
+{
+ QPID_CLIENT_EXTERN ResolutionError(const std::string& msg);
+};
+
+struct AssertionFailed : public ResolutionError
+{
+ QPID_CLIENT_EXTERN AssertionFailed(const std::string& msg);
+};
+
+struct NotFound : public ResolutionError
+{
+ QPID_CLIENT_EXTERN NotFound(const std::string& msg);
+};
+
+/**
+ * Thrown when an address string with inalid sytanx is used.
+ */
+struct MalformedAddress : public AddressError
+{
+ QPID_CLIENT_EXTERN MalformedAddress(const std::string& msg);
+};
+
+struct ReceiverError : LinkError
+{
+ QPID_CLIENT_EXTERN ReceiverError(const std::string&);
+};
+
+struct FetchError : ReceiverError
+{
+ QPID_CLIENT_EXTERN FetchError(const std::string&);
+};
+
+struct NoMessageAvailable : FetchError
+{
+ QPID_CLIENT_EXTERN NoMessageAvailable();
+};
+
+struct SenderError : LinkError
+{
+ QPID_CLIENT_EXTERN SenderError(const std::string&);
+};
+
+struct SendError : SenderError
+{
+ QPID_CLIENT_EXTERN SendError(const std::string&);
+};
+
+struct TargetCapacityExceeded : SendError
+{
+ QPID_CLIENT_EXTERN TargetCapacityExceeded(const std::string&);
+};
+
+struct SessionError : MessagingException
+{
+ QPID_CLIENT_EXTERN SessionError(const std::string&);
+};
+
+struct TransactionError : SessionError
+{
+ QPID_CLIENT_EXTERN TransactionError(const std::string&);
+};
+
+struct TransactionAborted : TransactionError
+{
+ QPID_CLIENT_EXTERN TransactionAborted(const std::string&);
+};
+
+struct UnauthorizedAccess : SessionError
+{
+ QPID_CLIENT_EXTERN UnauthorizedAccess(const std::string&);
+};
+
+struct ConnectionError : MessagingException
+{
+ QPID_CLIENT_EXTERN ConnectionError(const std::string&);
+};
+
+struct TransportFailure : MessagingException
+{
+ QPID_CLIENT_EXTERN TransportFailure(const std::string&);
+};
+
+}} // namespace qpid::messaging
+
+#endif /*!QPID_MESSAGING_EXCEPTIONS_H*/
diff --git a/cpp/include/qpid/types/Exception.h b/cpp/include/qpid/types/Exception.h
new file mode 100644
index 0000000000..a8b7d128af
--- /dev/null
+++ b/cpp/include/qpid/types/Exception.h
@@ -0,0 +1,44 @@
+#ifndef QPID_TYPES_EXCEPTION_H
+#define QPID_TYPES_EXCEPTION_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 <string>
+#include "qpid/CommonImportExport.h"
+
+namespace qpid {
+namespace types {
+
+class Exception : public std::exception
+{
+ public:
+ QPID_COMMON_EXTERN explicit Exception(const std::string& message=std::string()) throw();
+ QPID_COMMON_EXTERN virtual ~Exception() throw();
+ QPID_COMMON_EXTERN virtual const char* what() const throw();
+
+ private:
+ const std::string message;
+};
+
+}} // namespace qpid::types
+
+#endif /*!QPID_TYPES_EXCEPTION_H*/
diff --git a/cpp/include/qpid/types/Variant.h b/cpp/include/qpid/types/Variant.h
index 91e37242d0..059550bc9c 100644
--- a/cpp/include/qpid/types/Variant.h
+++ b/cpp/include/qpid/types/Variant.h
@@ -26,7 +26,7 @@
#include <ostream>
#include <string>
#include "Uuid.h"
-#include "qpid/Exception.h"
+#include "qpid/types/Exception.h"
#include "qpid/sys/IntegerTypes.h"
#include "qpid/CommonImportExport.h"
@@ -36,7 +36,7 @@ namespace types {
/**
* Thrown when an illegal conversion of a variant is attempted.
*/
-struct InvalidConversion : public qpid::Exception
+struct InvalidConversion : public Exception
{
InvalidConversion(const std::string& msg);
};