activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r834534 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util: CMSExceptionSupport.cpp CMSExceptionSupport.h
Date Tue, 10 Nov 2009 16:34:19 GMT
Author: tabish
Date: Tue Nov 10 16:34:19 2009
New Revision: 834534

URL: http://svn.apache.org/viewvc?rev=834534&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-265

Add in some utility code for use in this issue.

Added:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.cpp
  (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h
  (with props)

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.cpp?rev=834534&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.cpp
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.cpp
Tue Nov 10 16:34:19 2009
@@ -0,0 +1,84 @@
+/*
+ * 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 "CMSExceptionSupport.h"
+
+#include <typeinfo>
+
+using namespace std;
+using namespace cms;
+using namespace activemq;
+using namespace activemq::util;
+using namespace decaf;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+CMSExceptionSupport::CMSExceptionSupport() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CMSExceptionSupport::~CMSExceptionSupport() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CMSException CMSExceptionSupport::create( const std::string& msg, const Exception&
cause ) {
+
+    CMSException exception( msg, cause.clone() );
+    return exception;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+CMSException CMSExceptionSupport::create( const Exception& cause ) {
+
+    std::string msg = cause.getMessage();
+
+    if( msg.length() == 0 ) {
+        msg = typeid( &cause ).name();
+    }
+
+    CMSException exception( msg, cause.clone() );
+
+    return exception;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+MessageEOFException CMSExceptionSupport::createMessageEOFException( const Exception&
cause ) {
+
+    std::string msg = cause.getMessage();
+
+    if( msg.length() == 0 ) {
+        msg = typeid( &cause ).name();
+    }
+
+    MessageEOFException exception( msg, cause.clone() );
+
+    return exception;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+MessageFormatException CMSExceptionSupport::createMessageFormatException( const Exception&
cause ) {
+
+    std::string msg = cause.getMessage();
+
+    if( msg.length() == 0 ) {
+        msg = typeid( &cause ).name();
+    }
+
+    MessageFormatException exception( msg, cause.clone() );
+
+    return exception;
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=834534&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h
Tue Nov 10 16:34:19 2009
@@ -0,0 +1,55 @@
+/*
+ * 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 _ACTIVEMQ_UTIL_CMSEXCEPTIONSUPPORT_H_
+#define _ACTIVEMQ_UTIL_CMSEXCEPTIONSUPPORT_H_
+
+#include <activemq/util/Config.h>
+
+#include <cms/CMSException.h>
+#include <cms/MessageEOFException.h>
+#include <cms/MessageFormatException.h>
+
+#include <decaf/lang/Exception.h>
+
+#include <string>
+
+namespace activemq {
+namespace util {
+
+    class AMQCPP_API CMSExceptionSupport {
+    private:
+
+        CMSExceptionSupport();
+
+    public:
+
+        virtual ~CMSExceptionSupport();
+
+        static cms::CMSException create( const std::string& msg, const decaf::lang::Exception&
cause );
+
+        static cms::CMSException create( const decaf::lang::Exception& cause );
+
+        static cms::MessageEOFException createMessageEOFException( const decaf::lang::Exception&
cause );
+
+        static cms::MessageFormatException createMessageFormatException( const decaf::lang::Exception&
cause );
+
+    };
+
+}}
+
+#endif /* _ACTIVEMQ_UTIL_CMSEXCEPTIONSUPPORT_H_ */

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



Mime
View raw message