activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1397585 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main: Makefile.am activemq/util/CMSExceptionSupport.h cms/ResourceAllocationException.cpp cms/ResourceAllocationException.h
Date Fri, 12 Oct 2012 14:34:45 GMT
Author: tabish
Date: Fri Oct 12 14:34:44 2012
New Revision: 1397585

URL: http://svn.apache.org/viewvc?rev=1397585&view=rev
Log:
Adds the missing ResourceAllocationException to the CMS API and ensure the correct types are
thrown from the helper macro

Added:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ResourceAllocationException.cpp
  (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ResourceAllocationException.h  
(with props)
Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am?rev=1397585&r1=1397584&r2=1397585&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am Fri Oct 12 14:34:44 2012
@@ -277,6 +277,7 @@ cc_sources = \
     cms/ObjectMessage.cpp \
     cms/Queue.cpp \
     cms/QueueBrowser.cpp \
+    cms/ResourceAllocationException.cpp \
     cms/Session.cpp \
     cms/Startable.cpp \
     cms/Stoppable.cpp \
@@ -816,6 +817,7 @@ h_sources = \
     cms/ObjectMessage.h \
     cms/Queue.h \
     cms/QueueBrowser.h \
+    cms/ResourceAllocationException.h \
     cms/Session.h \
     cms/Startable.h \
     cms/Stoppable.h \

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h?rev=1397585&r1=1397584&r2=1397585&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h
Fri Oct 12 14:34:44 2012
@@ -30,6 +30,9 @@
 #include <cms/InvalidDestinationException.h>
 #include <cms/InvalidSelectorException.h>
 #include <cms/IllegalStateException.h>
+#include <cms/ResourceAllocationException.h>
+#include <cms/TransactionInProgressException.h>
+#include <cms/TransactionRolledBackException.h>
 #include <cms/UnsupportedOperationException.h>
 
 #include <decaf/lang/Exception.h>
@@ -67,50 +70,59 @@ namespace util {
 * exception of MessageNotReadableException for instance.
 */
 #define AMQ_CATCH_ALL_THROW_CMSEXCEPTION() \
-    catch( cms::CMSSecurityException& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
-        throw ex; \
-    } catch( cms::IllegalStateException& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
-        throw ex; \
-    } catch( cms::InvalidClientIdException& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
-        throw ex; \
-    } catch( cms::InvalidDestinationException& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
-        throw ex; \
-    } catch( cms::InvalidSelectorException& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
-        throw ex; \
-    } catch( cms::MessageEOFException& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
-        throw ex; \
-    } catch( cms::MessageFormatException& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
-        throw ex; \
-    } catch( cms::MessageNotReadableException& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
-        throw ex; \
-    } catch( cms::MessageNotWriteableException& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
-        throw ex; \
-    } catch( cms::UnsupportedOperationException& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
-        throw ex; \
-    } catch( cms::CMSException& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
-        throw ex; \
-    } catch( activemq::exceptions::ActiveMQException& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
+    catch (cms::CMSSecurityException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::IllegalStateException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::InvalidClientIdException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::InvalidDestinationException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::InvalidSelectorException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::MessageEOFException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::MessageFormatException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::MessageNotReadableException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::MessageNotWriteableException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::ResourceAllocationException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::TransactionInProgressException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::TransactionRolledBackException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::UnsupportedOperationException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (cms::CMSException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
+        throw; \
+    } catch (activemq::exceptions::ActiveMQException& ex) { \
+        ex.setMark(__FILE__, __LINE__); \
         throw ex.convertToCMSException(); \
-    } catch( decaf::lang::Exception& ex ){ \
-        ex.setMark( __FILE__, __LINE__ ); \
-        activemq::exceptions::ActiveMQException amqEx( ex ); \
+    } catch(decaf::lang::Exception& ex){ \
+        ex.setMark(__FILE__, __LINE__); \
+        activemq::exceptions::ActiveMQException amqEx(ex); \
         throw amqEx.convertToCMSException(); \
-    } catch( std::exception& ex ){ \
-        throw cms::CMSException( ex.what(), NULL ); \
+    } catch(std::exception& ex){ \
+        throw cms::CMSException(ex.what(), NULL); \
     } catch(...) { \
-        throw cms::CMSException( "Caught Unknown Exception", NULL ); \
+        throw cms::CMSException("Caught Unknown Exception", NULL); \
     }
 
 #endif /* _ACTIVEMQ_UTIL_CMSEXCEPTIONSUPPORT_H_ */

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ResourceAllocationException.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ResourceAllocationException.cpp?rev=1397585&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ResourceAllocationException.cpp
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ResourceAllocationException.cpp
Fri Oct 12 14:34:44 2012
@@ -0,0 +1,49 @@
+/*
+ * 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 "ResourceAllocationException.h"
+
+using namespace cms;
+
+////////////////////////////////////////////////////////////////////////////////
+ResourceAllocationException::ResourceAllocationException() : CMSException() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ResourceAllocationException::ResourceAllocationException(const ResourceAllocationException&
ex) :
+    CMSException(ex) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ResourceAllocationException::ResourceAllocationException(const std::string& message)
:
+    CMSException(message, NULL) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ResourceAllocationException::ResourceAllocationException(const std::string& message,
const std::exception* cause) :
+    CMSException(message, cause) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ResourceAllocationException::ResourceAllocationException(const std::string& message,
const std::exception* cause,
+                                                         const std::vector<std::pair<std::string,
int> >& stackTrace) :
+    CMSException(message, cause, stackTrace) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ResourceAllocationException::~ResourceAllocationException() throw() {
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ResourceAllocationException.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ResourceAllocationException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ResourceAllocationException.h?rev=1397585&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ResourceAllocationException.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ResourceAllocationException.h Fri
Oct 12 14:34:44 2012
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+#ifndef _CMS_RESOURCEALLOCATIONEXCEPTION_H_
+#define _CMS_RESOURCEALLOCATIONEXCEPTION_H_
+
+#include <cms/Config.h>
+#include <cms/CMSException.h>
+
+namespace cms {
+
+    /**
+     * This exception is thrown when an operation is invalid because a transaction is in
progress.
+     * For instance, an attempt to call Session::commit when a session is part of a distributed
+     * transaction should throw a  ResourceAllocationException.
+     *
+     * @since 2.3
+     */
+    class CMS_API ResourceAllocationException : public cms::CMSException {
+    public:
+
+        ResourceAllocationException();
+
+        ResourceAllocationException(const ResourceAllocationException& ex);
+
+        ResourceAllocationException(const std::string& message);
+
+        ResourceAllocationException(const std::string& message, const std::exception*
cause);
+
+        ResourceAllocationException(const std::string& message, const std::exception*
cause,
+                                    const std::vector<std::pair<std::string, int>
>& stackTrace);
+
+        virtual ~ResourceAllocationException() throw();
+
+
+    };
+
+}
+
+#endif /* _CMS_RESOURCEALLOCATIONEXCEPTION_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/cms/ResourceAllocationException.h
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message