You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2006/07/06 00:27:47 UTC
svn commit: r419365 [12/25] - in /incubator/activemq/trunk:
activemq-core/src/main/java/org/apache/activemq/thread/
activemq-core/src/test/java/org/apache/activemq/openwire/v1/
activemq-cpp/src/main/activemq/concurrent/
activemq-cpp/src/main/activemq/c...
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.h Wed Jul 5 15:27:34 2006
@@ -1,283 +1,283 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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.
- */
-#ifndef _ACTIVEMQ_CORE_ACTIVEMQTRANSACTION_H_
-#define _ACTIVEMQ_CORE_ACTIVEMQTRANSACTION_H_
-
-#include <map>
-#include <list>
-
-#include <cms/Message.h>
-#include <cms/CMSException.h>
-
-#include <activemq/concurrent/Mutex.h>
-#include <activemq/concurrent/TaskListener.h>
-#include <activemq/concurrent/Runnable.h>
-#include <activemq/connector/TransactionInfo.h>
-#include <activemq/exceptions/InvalidStateException.h>
-#include <activemq/exceptions/IllegalArgumentException.h>
-#include <activemq/util/Properties.h>
-#include <activemq/core/ActiveMQSessionResource.h>
-
-namespace activemq{
-namespace core{
-
- class ActiveMQConnection;
- class ActiveMQSession;
- class ActiveMQMessage;
- class ActiveMQMessageListener;
-
- /**
- * Transaction Management class, hold messages that are to be redelivered
- * upon a request to rollback. The Tranasction represents an always
- * running transaction, when it is committed or rolled back it silently
- * creates a new transaction for the next set of messages. The only
- * way to permanently end this tranaction is to delete it.
- *
- * Configuration options
- *
- * transaction.redeliveryDelay
- * Wait time between the redelivery of each message
- *
- * transaction.maxRedeliveryCount
- * Max number of times a message can be redelivered, if the session is
- * rolled back more than this many time, the message is dropped.
- */
- class ActiveMQTransaction : public concurrent::TaskListener,
- public connector::TransactionInfo,
- public ActiveMQSessionResource
- {
- private:
-
- // List type for holding messages
- typedef std::list< ActiveMQMessage* > MessageList;
-
- // Mapping of MessageListener Ids to Lists of Messages that are
- // redelivered on a Rollback
- typedef std::map< ActiveMQMessageListener*, MessageList > RollbackMap;
-
- private:
-
- // Connection this Transaction is associated with
- ActiveMQConnection* connection;
-
- // Session this Transaction is associated with
- ActiveMQSession* session;
-
- // Transaction Info for the current Transaction
- connector::TransactionInfo* transactionInfo;
-
- // Map of ActiveMQMessageListener to Messages to Rollback
- RollbackMap rollbackMap;
-
- // Lock object to protect the rollback Map
- concurrent::Mutex rollbackLock;
-
- // Max number of redeliveries before we quit
- int maxRedeliveries;
-
- // Wait time between sends of message on a rollback
- int redeliveryDelay;
-
- // Mutex that is signaled when all tasks complete.
- concurrent::Mutex tasksDone;
-
- // Count of Tasks that are outstanding
- int taskCount;
-
- public:
-
- /**
- * Constructor
- */
- ActiveMQTransaction( ActiveMQConnection* connection,
- ActiveMQSession* session,
- const util::Properties& properties );
-
- /**
- * Destructor
- */
- virtual ~ActiveMQTransaction(void);
-
- /**
- * Adds the Message as a part of the Transaction for the specified
- * ActiveMQConsumer.
- * @param ActiveMQMessage
- * @param ActiveMQMessageListener
- */
- virtual void addToTransaction( ActiveMQMessage* message,
- ActiveMQMessageListener* listener );
-
- /**
- * Removes the ActiveMQMessageListener and all of its transacted
- * messages from the Transaction, this is usually only done when
- * a ActiveMQMessageListener is destroyed.
- * @param consumer who is to be removed.
- */
- virtual void removeFromTransaction( ActiveMQMessageListener* listener );
-
- /**
- * Commit the current Transaction
- * @throw CMSException
- */
- virtual void commit(void) throw ( exceptions::ActiveMQException );
-
- /**
- * Rollback the current Transaction
- * @throw CMSException
- */
- virtual void rollback(void) throw ( exceptions::ActiveMQException );
-
- /**
- * Get the Transaction Information object for the current
- * Transaction, returns NULL if no transaction is running
- * @return TransactionInfo
- */
- virtual connector::TransactionInfo* getTransactionInfo(void) const {
- return transactionInfo;
- }
-
- public: // TransactionInfo Interface
-
- /**
- * Gets the Transction Id
- * @return unsigned int Id
- */
- virtual unsigned int getTransactionId(void) const {
- return transactionInfo->getTransactionId();
- }
-
- /**
- * Sets the Transction Id
- * @param unsigned int Id
- */
- virtual void setTransactionId( const unsigned int id ) {
- transactionInfo->setTransactionId( id );
- }
-
- /**
- * Gets the Session Info that this transaction is attached too
- * @return SessionnInfo pointer
- */
- virtual const connector::SessionInfo* getSessionInfo(void) const {
- return transactionInfo->getSessionInfo();
- }
-
- /**
- * Gets the Session Info that this transaction is attached too
- * @return SessionnInfo pointer
- */
- virtual void setSessionInfo( const connector::SessionInfo* session ) {
- transactionInfo->setSessionInfo( session );
- }
-
- protected: // Task Listener Interface
-
- /**
- * Called when a queued task has completed, the task that
- * finished is passed along for user consumption. The task is
- * deleted and the count of outstanding tasks is reduced.
- * @param Runnable Pointer to the task that finished
- */
- virtual void onTaskComplete( concurrent::Runnable* task );
-
- /**
- * Called when a queued task has thrown an exception while
- * being run. The Callee should assume that this was an
- * unrecoverable exeption and that this task is now defunct.
- * Deletes the Task and notifies the connection that the
- * exception has occurred. Reduce the outstanding task count.
- * @param Runnable Pointer to the task
- * @param The ActiveMQException that was thrown.
- */
- virtual void onTaskException( concurrent::Runnable* task,
- exceptions::ActiveMQException& ex );
-
- public: // ActiveMQSessionResource
-
- /**
- * Retrieve the Connector resource that is associated with
- * this Session resource.
- * @return pointer to a Connector Resource, can be NULL
- */
- virtual connector::ConnectorResource* getConnectorResource(void) {
- return transactionInfo;
- }
-
- protected:
-
- /**
- * Clean out all Messages from the Rollback Map, deleting the
- * messages as it goes. Destroys the Transaction Info object as
- * well.
- * @throw ActiveMQException
- */
- virtual void clearTransaction(void);
-
- private:
-
- // Internal class that is used to redeliver one consumers worth
- // of messages from this transaction.
- class RollbackTask : public concurrent::Runnable
- {
- private:
-
- // Wait time before redelivery in millisecs
- int redeliveryDelay;
-
- // Max number of time to redeliver this message
- int maxRedeliveries;
-
- // Messages to Redeliver
- MessageList messages;
-
- // Consumer we are redelivering to
- ActiveMQMessageListener* listener;
-
- // Connection to use for sending message acks
- ActiveMQConnection* connection;
-
- // Session for this Transaction
- ActiveMQSession* session;
-
- public:
-
- RollbackTask( ActiveMQMessageListener* listener,
- ActiveMQConnection* connection,
- ActiveMQSession* session,
- MessageList& messages,
- int maxRedeliveries,
- int redeliveryDelay ){
-
- // Store State Data.
- this->messages = messages;
- this->listener = listener;
- this->redeliveryDelay = redeliveryDelay;
- this->maxRedeliveries = maxRedeliveries;
- this->session = session;
- this->connection = connection;
- }
-
- // Dispatches the Messages to the Consumer.
- virtual void run(void);
-
- };
-
- };
-
-}}
-
-#endif /*_ACTIVEMQ_CORE_ACTIVEMQTRANSACTION_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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.
+ */
+#ifndef _ACTIVEMQ_CORE_ACTIVEMQTRANSACTION_H_
+#define _ACTIVEMQ_CORE_ACTIVEMQTRANSACTION_H_
+
+#include <map>
+#include <list>
+
+#include <cms/Message.h>
+#include <cms/CMSException.h>
+
+#include <activemq/concurrent/Mutex.h>
+#include <activemq/concurrent/TaskListener.h>
+#include <activemq/concurrent/Runnable.h>
+#include <activemq/connector/TransactionInfo.h>
+#include <activemq/exceptions/InvalidStateException.h>
+#include <activemq/exceptions/IllegalArgumentException.h>
+#include <activemq/util/Properties.h>
+#include <activemq/core/ActiveMQSessionResource.h>
+
+namespace activemq{
+namespace core{
+
+ class ActiveMQConnection;
+ class ActiveMQSession;
+ class ActiveMQMessage;
+ class ActiveMQMessageListener;
+
+ /**
+ * Transaction Management class, hold messages that are to be redelivered
+ * upon a request to rollback. The Tranasction represents an always
+ * running transaction, when it is committed or rolled back it silently
+ * creates a new transaction for the next set of messages. The only
+ * way to permanently end this tranaction is to delete it.
+ *
+ * Configuration options
+ *
+ * transaction.redeliveryDelay
+ * Wait time between the redelivery of each message
+ *
+ * transaction.maxRedeliveryCount
+ * Max number of times a message can be redelivered, if the session is
+ * rolled back more than this many time, the message is dropped.
+ */
+ class ActiveMQTransaction : public concurrent::TaskListener,
+ public connector::TransactionInfo,
+ public ActiveMQSessionResource
+ {
+ private:
+
+ // List type for holding messages
+ typedef std::list< ActiveMQMessage* > MessageList;
+
+ // Mapping of MessageListener Ids to Lists of Messages that are
+ // redelivered on a Rollback
+ typedef std::map< ActiveMQMessageListener*, MessageList > RollbackMap;
+
+ private:
+
+ // Connection this Transaction is associated with
+ ActiveMQConnection* connection;
+
+ // Session this Transaction is associated with
+ ActiveMQSession* session;
+
+ // Transaction Info for the current Transaction
+ connector::TransactionInfo* transactionInfo;
+
+ // Map of ActiveMQMessageListener to Messages to Rollback
+ RollbackMap rollbackMap;
+
+ // Lock object to protect the rollback Map
+ concurrent::Mutex rollbackLock;
+
+ // Max number of redeliveries before we quit
+ int maxRedeliveries;
+
+ // Wait time between sends of message on a rollback
+ int redeliveryDelay;
+
+ // Mutex that is signaled when all tasks complete.
+ concurrent::Mutex tasksDone;
+
+ // Count of Tasks that are outstanding
+ int taskCount;
+
+ public:
+
+ /**
+ * Constructor
+ */
+ ActiveMQTransaction( ActiveMQConnection* connection,
+ ActiveMQSession* session,
+ const util::Properties& properties );
+
+ /**
+ * Destructor
+ */
+ virtual ~ActiveMQTransaction(void);
+
+ /**
+ * Adds the Message as a part of the Transaction for the specified
+ * ActiveMQConsumer.
+ * @param ActiveMQMessage
+ * @param ActiveMQMessageListener
+ */
+ virtual void addToTransaction( ActiveMQMessage* message,
+ ActiveMQMessageListener* listener );
+
+ /**
+ * Removes the ActiveMQMessageListener and all of its transacted
+ * messages from the Transaction, this is usually only done when
+ * a ActiveMQMessageListener is destroyed.
+ * @param consumer who is to be removed.
+ */
+ virtual void removeFromTransaction( ActiveMQMessageListener* listener );
+
+ /**
+ * Commit the current Transaction
+ * @throw CMSException
+ */
+ virtual void commit(void) throw ( exceptions::ActiveMQException );
+
+ /**
+ * Rollback the current Transaction
+ * @throw CMSException
+ */
+ virtual void rollback(void) throw ( exceptions::ActiveMQException );
+
+ /**
+ * Get the Transaction Information object for the current
+ * Transaction, returns NULL if no transaction is running
+ * @return TransactionInfo
+ */
+ virtual connector::TransactionInfo* getTransactionInfo(void) const {
+ return transactionInfo;
+ }
+
+ public: // TransactionInfo Interface
+
+ /**
+ * Gets the Transction Id
+ * @return unsigned int Id
+ */
+ virtual unsigned int getTransactionId(void) const {
+ return transactionInfo->getTransactionId();
+ }
+
+ /**
+ * Sets the Transction Id
+ * @param unsigned int Id
+ */
+ virtual void setTransactionId( const unsigned int id ) {
+ transactionInfo->setTransactionId( id );
+ }
+
+ /**
+ * Gets the Session Info that this transaction is attached too
+ * @return SessionnInfo pointer
+ */
+ virtual const connector::SessionInfo* getSessionInfo(void) const {
+ return transactionInfo->getSessionInfo();
+ }
+
+ /**
+ * Gets the Session Info that this transaction is attached too
+ * @return SessionnInfo pointer
+ */
+ virtual void setSessionInfo( const connector::SessionInfo* session ) {
+ transactionInfo->setSessionInfo( session );
+ }
+
+ protected: // Task Listener Interface
+
+ /**
+ * Called when a queued task has completed, the task that
+ * finished is passed along for user consumption. The task is
+ * deleted and the count of outstanding tasks is reduced.
+ * @param Runnable Pointer to the task that finished
+ */
+ virtual void onTaskComplete( concurrent::Runnable* task );
+
+ /**
+ * Called when a queued task has thrown an exception while
+ * being run. The Callee should assume that this was an
+ * unrecoverable exeption and that this task is now defunct.
+ * Deletes the Task and notifies the connection that the
+ * exception has occurred. Reduce the outstanding task count.
+ * @param Runnable Pointer to the task
+ * @param The ActiveMQException that was thrown.
+ */
+ virtual void onTaskException( concurrent::Runnable* task,
+ exceptions::ActiveMQException& ex );
+
+ public: // ActiveMQSessionResource
+
+ /**
+ * Retrieve the Connector resource that is associated with
+ * this Session resource.
+ * @return pointer to a Connector Resource, can be NULL
+ */
+ virtual connector::ConnectorResource* getConnectorResource(void) {
+ return transactionInfo;
+ }
+
+ protected:
+
+ /**
+ * Clean out all Messages from the Rollback Map, deleting the
+ * messages as it goes. Destroys the Transaction Info object as
+ * well.
+ * @throw ActiveMQException
+ */
+ virtual void clearTransaction(void);
+
+ private:
+
+ // Internal class that is used to redeliver one consumers worth
+ // of messages from this transaction.
+ class RollbackTask : public concurrent::Runnable
+ {
+ private:
+
+ // Wait time before redelivery in millisecs
+ int redeliveryDelay;
+
+ // Max number of time to redeliver this message
+ int maxRedeliveries;
+
+ // Messages to Redeliver
+ MessageList messages;
+
+ // Consumer we are redelivering to
+ ActiveMQMessageListener* listener;
+
+ // Connection to use for sending message acks
+ ActiveMQConnection* connection;
+
+ // Session for this Transaction
+ ActiveMQSession* session;
+
+ public:
+
+ RollbackTask( ActiveMQMessageListener* listener,
+ ActiveMQConnection* connection,
+ ActiveMQSession* session,
+ MessageList& messages,
+ int maxRedeliveries,
+ int redeliveryDelay ){
+
+ // Store State Data.
+ this->messages = messages;
+ this->listener = listener;
+ this->redeliveryDelay = redeliveryDelay;
+ this->maxRedeliveries = maxRedeliveries;
+ this->session = session;
+ this->connection = connection;
+ }
+
+ // Dispatches the Messages to the Consumer.
+ virtual void run(void);
+
+ };
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_CORE_ACTIVEMQTRANSACTION_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransaction.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp Wed Jul 5 15:27:34 2006
@@ -1,70 +1,70 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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 <stdio.h>
-#include "ActiveMQException.h"
-#include <activemq/logger/LoggerDefines.h>
-
-using namespace activemq;
-using namespace activemq::exceptions;
-using namespace std;
-
-////////////////////////////////////////////////////////////////////////////////
-void ActiveMQException::buildMessage(const char* format, va_list& vargs)
-{
- // Allocate buffer with a guess of it's size
- int size = 128;
-
- // Format string
- while( true ){
-
- // Allocate a buffer of the specified size.
- char* buffer = new char[size];
-
- int written = vsnprintf(buffer, size, format, vargs);
- if (written > -1 && written < size-1) {
-
- // Guessed size was enough. Assign the string.
- message.assign (buffer, written);
- break;
- }
-
- // Our buffer wasn't big enough - destroy the old buffer,
- // double the size and try again.
- delete [] buffer;
- size *= 2;
- }
-
- activemq::logger::SimpleLogger logger("com.yadda1");
- logger.log( message );
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void ActiveMQException::setMark( const char* file, const int lineNumber ){
-
- // Add this mark to the end of the stack trace.
- stackTrace.push_back( std::make_pair( (std::string)file, (int)lineNumber ) );
-
- ostringstream stream;
- stream << "\tFILE: " << stackTrace[stackTrace.size()-1].first;
- stream << ", LINE: " << stackTrace[stackTrace.size()-1].second;
-
- activemq::logger::SimpleLogger logger("com.yadda2");
- logger.log( stream.str() );
-}
-
-
-
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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 <stdio.h>
+#include "ActiveMQException.h"
+#include <activemq/logger/LoggerDefines.h>
+
+using namespace activemq;
+using namespace activemq::exceptions;
+using namespace std;
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQException::buildMessage(const char* format, va_list& vargs)
+{
+ // Allocate buffer with a guess of it's size
+ int size = 128;
+
+ // Format string
+ while( true ){
+
+ // Allocate a buffer of the specified size.
+ char* buffer = new char[size];
+
+ int written = vsnprintf(buffer, size, format, vargs);
+ if (written > -1 && written < size-1) {
+
+ // Guessed size was enough. Assign the string.
+ message.assign (buffer, written);
+ break;
+ }
+
+ // Our buffer wasn't big enough - destroy the old buffer,
+ // double the size and try again.
+ delete [] buffer;
+ size *= 2;
+ }
+
+ activemq::logger::SimpleLogger logger("com.yadda1");
+ logger.log( message );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQException::setMark( const char* file, const int lineNumber ){
+
+ // Add this mark to the end of the stack trace.
+ stackTrace.push_back( std::make_pair( (std::string)file, (int)lineNumber ) );
+
+ ostringstream stream;
+ stream << "\tFILE: " << stackTrace[stackTrace.size()-1].first;
+ stream << ", LINE: " << stackTrace[stackTrace.size()-1].second;
+
+ activemq::logger::SimpleLogger logger("com.yadda2");
+ logger.log( stream.str() );
+}
+
+
+
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h Wed Jul 5 15:27:34 2006
@@ -1,178 +1,178 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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.
- */
-#ifndef ACTIVEMQ_EXCEPTIONS_ACTIVEMQEXCEPTION_H
-#define ACTIVEMQ_EXCEPTIONS_ACTIVEMQEXCEPTION_H
-
-#include <cms/CMSException.h>
-#include <activemq/exceptions/ExceptionDefines.h>
-#include <stdarg.h>
-#include <sstream>
-
-namespace activemq{
-namespace exceptions{
-
- /*
- * Base class for all exceptions.
- */
- class ActiveMQException : public cms::CMSException
- {
- private:
-
- /**
- * The cause of this exception.
- */
- std::string message;
-
- /**
- * The stack trace.
- */
- std::vector< std::pair< std::string, int> > stackTrace;
-
- public:
-
- /**
- * Default Constructor
- */
- ActiveMQException(void) {}
-
- /**
- * Copy Constructor
- */
- ActiveMQException( const ActiveMQException& ex ){
- *this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- ActiveMQException(const char* file, const int lineNumber,
- const char* msg, ...)
- {
- va_list vargs ;
- va_start(vargs, msg) ;
- buildMessage(msg, vargs) ;
-
- // Set the first mark for this exception.
- setMark( file, lineNumber );
- }
-
- /**
- * Destructor
- */
- virtual ~ActiveMQException(){}
-
- /**
- * Gets the message for this exception.
- */
- virtual const char* getMessage() const{ return message.c_str(); }
-
- /**
- * Sets the cause for this exception.
- * @param msg the format string for the msg.
- */
- virtual void setMessage( const char* msg, ... ){
- va_list vargs ;
- va_start(vargs, msg) ;
- buildMessage(msg, vargs) ;
- }
-
- /**
- * Adds a file/line number to the stack trace.
- * @param file The name of the file calling this method (use __FILE__).
- * @param lineNumber The line number in the calling file (use __LINE__).
- */
- virtual void setMark( const char* file, const int lineNumber );
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual ActiveMQException* clone() const{
- return new ActiveMQException( *this );
- }
-
- /**
- * Provides the stack trace for every point where
- * this exception was caught, marked, and rethrown. The first
- * item in the returned vector is the first point where the mark
- * was set (e.g. where the exception was created).
- * @return the stack trace.
- */
- virtual std::vector< std::pair< std::string, int> > getStackTrace() const{
- return stackTrace;
- }
-
- /**
- * Prints the stack trace to std::err
- */
- virtual void printStackTrace() const{
- printStackTrace( std::cerr );
- }
-
- /**
- * Prints the stack trace to the given output stream.
- * @param stream the target output stream.
- */
- virtual void printStackTrace( std::ostream& stream ) const{
- stream << getStackTraceString();
- }
-
- /**
- * Gets the stack trace as one contiguous string.
- */
- virtual std::string getStackTraceString() const{
-
- // Create the output stream.
- std::ostringstream stream;
-
- // Write the message and each stack entry.
- stream << message << std::endl;
- for( unsigned int ix=0; ix<stackTrace.size(); ++ix ){
- stream << "\tFILE: " << stackTrace[ix].first;
- stream << ", LINE: " << stackTrace[ix].second;
- stream << std::endl;
- }
-
- // Return the string from the output stream.
- return stream.str();
- }
-
- /**
- * Assignment operator.
- */
- virtual ActiveMQException& operator =( const ActiveMQException& ex ){
- this->message = ex.message;
- this->stackTrace = ex.stackTrace;
- return *this;
- }
-
- protected:
-
- virtual void buildMessage(const char* format, va_list& vargs);
-
- };
-
-}}
-
-#endif /*ACTIVEMQ_EXCEPTIONS_ACTIVEMQEXCEPTION_H*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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.
+ */
+#ifndef ACTIVEMQ_EXCEPTIONS_ACTIVEMQEXCEPTION_H
+#define ACTIVEMQ_EXCEPTIONS_ACTIVEMQEXCEPTION_H
+
+#include <cms/CMSException.h>
+#include <activemq/exceptions/ExceptionDefines.h>
+#include <stdarg.h>
+#include <sstream>
+
+namespace activemq{
+namespace exceptions{
+
+ /*
+ * Base class for all exceptions.
+ */
+ class ActiveMQException : public cms::CMSException
+ {
+ private:
+
+ /**
+ * The cause of this exception.
+ */
+ std::string message;
+
+ /**
+ * The stack trace.
+ */
+ std::vector< std::pair< std::string, int> > stackTrace;
+
+ public:
+
+ /**
+ * Default Constructor
+ */
+ ActiveMQException(void) {}
+
+ /**
+ * Copy Constructor
+ */
+ ActiveMQException( const ActiveMQException& ex ){
+ *this = ex;
+ }
+
+ /**
+ * Constructor - Initializes the file name and line number where
+ * this message occured. Sets the message to report, using an
+ * optional list of arguments to parse into the message
+ * @param file name where exception occurs
+ * @param line number where the exception occurred.
+ * @param message to report
+ * @param list of primitives that are formatted into the message
+ */
+ ActiveMQException(const char* file, const int lineNumber,
+ const char* msg, ...)
+ {
+ va_list vargs ;
+ va_start(vargs, msg) ;
+ buildMessage(msg, vargs) ;
+
+ // Set the first mark for this exception.
+ setMark( file, lineNumber );
+ }
+
+ /**
+ * Destructor
+ */
+ virtual ~ActiveMQException(){}
+
+ /**
+ * Gets the message for this exception.
+ */
+ virtual const char* getMessage() const{ return message.c_str(); }
+
+ /**
+ * Sets the cause for this exception.
+ * @param msg the format string for the msg.
+ */
+ virtual void setMessage( const char* msg, ... ){
+ va_list vargs ;
+ va_start(vargs, msg) ;
+ buildMessage(msg, vargs) ;
+ }
+
+ /**
+ * Adds a file/line number to the stack trace.
+ * @param file The name of the file calling this method (use __FILE__).
+ * @param lineNumber The line number in the calling file (use __LINE__).
+ */
+ virtual void setMark( const char* file, const int lineNumber );
+
+ /**
+ * Clones this exception. This is useful for cases where you need
+ * to preserve the type of the original exception as well as the message.
+ * All subclasses should override.
+ */
+ virtual ActiveMQException* clone() const{
+ return new ActiveMQException( *this );
+ }
+
+ /**
+ * Provides the stack trace for every point where
+ * this exception was caught, marked, and rethrown. The first
+ * item in the returned vector is the first point where the mark
+ * was set (e.g. where the exception was created).
+ * @return the stack trace.
+ */
+ virtual std::vector< std::pair< std::string, int> > getStackTrace() const{
+ return stackTrace;
+ }
+
+ /**
+ * Prints the stack trace to std::err
+ */
+ virtual void printStackTrace() const{
+ printStackTrace( std::cerr );
+ }
+
+ /**
+ * Prints the stack trace to the given output stream.
+ * @param stream the target output stream.
+ */
+ virtual void printStackTrace( std::ostream& stream ) const{
+ stream << getStackTraceString();
+ }
+
+ /**
+ * Gets the stack trace as one contiguous string.
+ */
+ virtual std::string getStackTraceString() const{
+
+ // Create the output stream.
+ std::ostringstream stream;
+
+ // Write the message and each stack entry.
+ stream << message << std::endl;
+ for( unsigned int ix=0; ix<stackTrace.size(); ++ix ){
+ stream << "\tFILE: " << stackTrace[ix].first;
+ stream << ", LINE: " << stackTrace[ix].second;
+ stream << std::endl;
+ }
+
+ // Return the string from the output stream.
+ return stream.str();
+ }
+
+ /**
+ * Assignment operator.
+ */
+ virtual ActiveMQException& operator =( const ActiveMQException& ex ){
+ this->message = ex.message;
+ this->stackTrace = ex.stackTrace;
+ return *this;
+ }
+
+ protected:
+
+ virtual void buildMessage(const char* format, va_list& vargs);
+
+ };
+
+}}
+
+#endif /*ACTIVEMQ_EXCEPTIONS_ACTIVEMQEXCEPTION_H*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ActiveMQException.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ExceptionDefines.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ExceptionDefines.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ExceptionDefines.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ExceptionDefines.h Wed Jul 5 15:27:34 2006
@@ -1,78 +1,78 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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.
- */
-#ifndef _ACTIVEMQ_EXCEPTIONS_EXCEPTIONDEFINES_H_
-#define _ACTIVEMQ_EXCEPTIONS_EXCEPTIONDEFINES_H_
-
-/**
- * Macro for catching and rethrowing an exception of
- * a given type.
- * @param type The type of the exception to throw
- * (e.g. ActiveMQException ).
- */
-#define AMQ_CATCH_RETHROW( type ) \
- catch( type& ex ){ \
- ex.setMark( __FILE__, __LINE__ ); \
- throw ex; \
- }
-
-/**
- * Macro for catching an exception of one type and then rethrowing
- * as another type.
- * @param sourceType the type of the exception to be caught.
- * @param targetType the type of the exception to be thrown.
- */
-#define AMQ_CATCH_EXCEPTION_CONVERT( sourceType, targetType ) \
- catch( sourceType& ex ){ \
- targetType target( ex ); \
- target.setMark( __FILE__, __LINE__ ); \
- throw target; \
- }
-
-/**
- * A catch-all that throws a known exception.
- * @param type the type of exception to be thrown.
- */
-#define AMQ_CATCHALL_THROW( type ) \
- catch( ... ){ \
- type ex( __FILE__, __LINE__, \
- "caught unknown exception" ); \
- throw ex; \
- }
-
-/**
- * A catch-all that does not throw an exception, one use would
- * be to catch any exception in a destructor and mark it, but not
- * throw so that cleanup would continue as normal.
- */
-#define AMQ_CATCHALL_NOTHROW( ) \
- catch( ... ){ \
- exceptions::ActiveMQException ex( __FILE__, __LINE__, \
- "caught unknown exception, not rethrowing" ); \
- }
-
-/**
- * Macro for catching and rethrowing an exception of
- * a given type.
- * @param type The type of the exception to throw
- * (e.g. ActiveMQException ).
- */
-#define AMQ_CATCH_NOTHROW( type ) \
- catch( type& ex ){ \
- ex.setMark( __FILE__, __LINE__ ); \
- }
-
-#endif /*_ACTIVEMQ_EXCEPTIONS_EXCEPTIONDEFINES_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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.
+ */
+#ifndef _ACTIVEMQ_EXCEPTIONS_EXCEPTIONDEFINES_H_
+#define _ACTIVEMQ_EXCEPTIONS_EXCEPTIONDEFINES_H_
+
+/**
+ * Macro for catching and rethrowing an exception of
+ * a given type.
+ * @param type The type of the exception to throw
+ * (e.g. ActiveMQException ).
+ */
+#define AMQ_CATCH_RETHROW( type ) \
+ catch( type& ex ){ \
+ ex.setMark( __FILE__, __LINE__ ); \
+ throw ex; \
+ }
+
+/**
+ * Macro for catching an exception of one type and then rethrowing
+ * as another type.
+ * @param sourceType the type of the exception to be caught.
+ * @param targetType the type of the exception to be thrown.
+ */
+#define AMQ_CATCH_EXCEPTION_CONVERT( sourceType, targetType ) \
+ catch( sourceType& ex ){ \
+ targetType target( ex ); \
+ target.setMark( __FILE__, __LINE__ ); \
+ throw target; \
+ }
+
+/**
+ * A catch-all that throws a known exception.
+ * @param type the type of exception to be thrown.
+ */
+#define AMQ_CATCHALL_THROW( type ) \
+ catch( ... ){ \
+ type ex( __FILE__, __LINE__, \
+ "caught unknown exception" ); \
+ throw ex; \
+ }
+
+/**
+ * A catch-all that does not throw an exception, one use would
+ * be to catch any exception in a destructor and mark it, but not
+ * throw so that cleanup would continue as normal.
+ */
+#define AMQ_CATCHALL_NOTHROW( ) \
+ catch( ... ){ \
+ exceptions::ActiveMQException ex( __FILE__, __LINE__, \
+ "caught unknown exception, not rethrowing" ); \
+ }
+
+/**
+ * Macro for catching and rethrowing an exception of
+ * a given type.
+ * @param type The type of the exception to throw
+ * (e.g. ActiveMQException ).
+ */
+#define AMQ_CATCH_NOTHROW( type ) \
+ catch( type& ex ){ \
+ ex.setMark( __FILE__, __LINE__ ); \
+ }
+
+#endif /*_ACTIVEMQ_EXCEPTIONS_EXCEPTIONDEFINES_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/ExceptionDefines.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/IllegalArgumentException.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/IllegalMonitorStateException.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/InterruptedException.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/InvalidStateException.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/InvalidStateException.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/InvalidStateException.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/InvalidStateException.h Wed Jul 5 15:27:34 2006
@@ -1,92 +1,92 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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.
- */
-#ifndef _ACTIVEMQ_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_
-#define _ACTIVEMQ_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_
-
-#include <activemq/exceptions/ActiveMQException.h>
-
-namespace activemq{
-namespace exceptions{
-
- /*
- * Thrown when an operation is requested, but the state of the object
- * servicing the request is not correct for that request.
- */
- class InvalidStateException : public ActiveMQException
- {
- public:
-
- /**
- * Default Constructor
- */
- InvalidStateException(void) {}
-
- /**
- * Conversion Constructor from some other ActiveMQException
- * @param An exception that should become this type of Exception
- */
- InvalidStateException(const ActiveMQException& ex){
- *(ActiveMQException*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- InvalidStateException(const InvalidStateException& ex){
- *(ActiveMQException*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- InvalidStateException(const char* file,
- const int lineNumber,
- const char* msg, ...)
- {
- va_list vargs;
- va_start(vargs, msg);
- buildMessage(msg, vargs);
-
- // Set the first mark for this exception.
- setMark(file, lineNumber);
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual ActiveMQException* clone(void) const{
- return new InvalidStateException(*this);
- }
-
- /**
- * Destructor
- */
- virtual ~InvalidStateException(void) {}
-
- };
-
-}}
-
-#endif /*_ACTIVEMQ_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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.
+ */
+#ifndef _ACTIVEMQ_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_
+#define _ACTIVEMQ_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_
+
+#include <activemq/exceptions/ActiveMQException.h>
+
+namespace activemq{
+namespace exceptions{
+
+ /*
+ * Thrown when an operation is requested, but the state of the object
+ * servicing the request is not correct for that request.
+ */
+ class InvalidStateException : public ActiveMQException
+ {
+ public:
+
+ /**
+ * Default Constructor
+ */
+ InvalidStateException(void) {}
+
+ /**
+ * Conversion Constructor from some other ActiveMQException
+ * @param An exception that should become this type of Exception
+ */
+ InvalidStateException(const ActiveMQException& ex){
+ *(ActiveMQException*)this = ex;
+ }
+
+ /**
+ * Copy Constructor
+ */
+ InvalidStateException(const InvalidStateException& ex){
+ *(ActiveMQException*)this = ex;
+ }
+
+ /**
+ * Constructor - Initializes the file name and line number where
+ * this message occured. Sets the message to report, using an
+ * optional list of arguments to parse into the message
+ * @param file name where exception occurs
+ * @param line number where the exception occurred.
+ * @param message to report
+ * @param list of primitives that are formatted into the message
+ */
+ InvalidStateException(const char* file,
+ const int lineNumber,
+ const char* msg, ...)
+ {
+ va_list vargs;
+ va_start(vargs, msg);
+ buildMessage(msg, vargs);
+
+ // Set the first mark for this exception.
+ setMark(file, lineNumber);
+ }
+
+ /**
+ * Clones this exception. This is useful for cases where you need
+ * to preserve the type of the original exception as well as the message.
+ * All subclasses should override.
+ */
+ virtual ActiveMQException* clone(void) const{
+ return new InvalidStateException(*this);
+ }
+
+ /**
+ * Destructor
+ */
+ virtual ~InvalidStateException(void) {}
+
+ };
+
+}}
+
+#endif /*_ACTIVEMQ_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/InvalidStateException.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/NoSuchElementException.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/NoSuchElementException.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/NoSuchElementException.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/NoSuchElementException.h Wed Jul 5 15:27:34 2006
@@ -1,92 +1,92 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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.
- */
-#ifndef ACTIVEMQ_EXCEPTIONS_NOSUCHELEMENTEXCEPTION_H_
-#define ACTIVEMQ_EXCEPTIONS_NOSUCHELEMENTEXCEPTION_H_
-
-#include <activemq/exceptions/ActiveMQException.h>
-
-namespace activemq{
-namespace exceptions{
-
- /*
- * Thrown from an operation that attempts to access some element that does
- * not exist.
- */
- class NoSuchElementException : public ActiveMQException
- {
- public:
-
- /**
- * Default Constructor
- */
- NoSuchElementException(void) {};
-
- /**
- * Conversion Constructor from some other ActiveMQException
- * @param An exception that should become this type of Exception
- */
- NoSuchElementException(const ActiveMQException& ex){
- *(ActiveMQException*)this = ex;
- }
-
- /**
- * Copy Constructor
- */
- NoSuchElementException(const NoSuchElementException& ex){
- *(ActiveMQException*)this = ex;
- }
-
- /**
- * Constructor - Initializes the file name and line number where
- * this message occured. Sets the message to report, using an
- * optional list of arguments to parse into the message
- * @param file name where exception occurs
- * @param line number where the exception occurred.
- * @param message to report
- * @param list of primitives that are formatted into the message
- */
- NoSuchElementException(const char* file,
- const int lineNumber,
- const char* msg, ...)
- {
- va_list vargs;
- va_start(vargs, msg);
- buildMessage(msg, vargs);
-
- // Set the first mark for this exception.
- setMark(file, lineNumber);
- }
-
- /**
- * Clones this exception. This is useful for cases where you need
- * to preserve the type of the original exception as well as the message.
- * All subclasses should override.
- */
- virtual ActiveMQException* clone(void) const{
- return new NoSuchElementException(*this);
- }
-
- /**
- * Destructor
- */
- virtual ~NoSuchElementException(void) {}
-
- };
-
-}}
-
-#endif /*ACTIVEMQ_EXCEPTIONS_NOSUCHELEMENTEXCEPTION_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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.
+ */
+#ifndef ACTIVEMQ_EXCEPTIONS_NOSUCHELEMENTEXCEPTION_H_
+#define ACTIVEMQ_EXCEPTIONS_NOSUCHELEMENTEXCEPTION_H_
+
+#include <activemq/exceptions/ActiveMQException.h>
+
+namespace activemq{
+namespace exceptions{
+
+ /*
+ * Thrown from an operation that attempts to access some element that does
+ * not exist.
+ */
+ class NoSuchElementException : public ActiveMQException
+ {
+ public:
+
+ /**
+ * Default Constructor
+ */
+ NoSuchElementException(void) {};
+
+ /**
+ * Conversion Constructor from some other ActiveMQException
+ * @param An exception that should become this type of Exception
+ */
+ NoSuchElementException(const ActiveMQException& ex){
+ *(ActiveMQException*)this = ex;
+ }
+
+ /**
+ * Copy Constructor
+ */
+ NoSuchElementException(const NoSuchElementException& ex){
+ *(ActiveMQException*)this = ex;
+ }
+
+ /**
+ * Constructor - Initializes the file name and line number where
+ * this message occured. Sets the message to report, using an
+ * optional list of arguments to parse into the message
+ * @param file name where exception occurs
+ * @param line number where the exception occurred.
+ * @param message to report
+ * @param list of primitives that are formatted into the message
+ */
+ NoSuchElementException(const char* file,
+ const int lineNumber,
+ const char* msg, ...)
+ {
+ va_list vargs;
+ va_start(vargs, msg);
+ buildMessage(msg, vargs);
+
+ // Set the first mark for this exception.
+ setMark(file, lineNumber);
+ }
+
+ /**
+ * Clones this exception. This is useful for cases where you need
+ * to preserve the type of the original exception as well as the message.
+ * All subclasses should override.
+ */
+ virtual ActiveMQException* clone(void) const{
+ return new NoSuchElementException(*this);
+ }
+
+ /**
+ * Destructor
+ */
+ virtual ~NoSuchElementException(void) {}
+
+ };
+
+}}
+
+#endif /*ACTIVEMQ_EXCEPTIONS_NOSUCHELEMENTEXCEPTION_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/NoSuchElementException.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/NullPointerException.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/RuntimeException.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/exceptions/UnsupportedOperationException.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.h Wed Jul 5 15:27:34 2006
@@ -1,191 +1,191 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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.
- */
-
-#ifndef ACTIVEMQ_IO_BUFFEREDINPUTSTREAM_H_
-#define ACTIVEMQ_IO_BUFFEREDINPUTSTREAM_H_
-
-#include <activemq/io/InputStream.h>
-#include <assert.h>
-
-namespace activemq{
-namespace io{
-
- /**
- * A wrapper around another input stream that performs
- * a buffered read, where it reads more data than it needs
- * in order to reduce the number of io operations on the
- * input stream.
- */
- class BufferedInputStream : public InputStream
- {
- private:
-
- /**
- * The target input stream.
- */
- InputStream* stream;
-
- /**
- * The internal buffer.
- */
- unsigned char* buffer;
-
- /**
- * The buffer size.
- */
- int bufferSize;
-
- /**
- * The current head of the buffer.
- */
- int head;
-
- /**
- * The current tail of the buffer.
- */
- int tail;
-
- public:
-
- /**
- * Constructor
- * @param stream The target input stream.
- */
- BufferedInputStream( InputStream* stream );
-
- /**
- * Constructor
- * @param stream the target input stream
- * @param bufferSize the size for the internal buffer.
- */
- BufferedInputStream( InputStream* stream, const int bufferSize );
-
- /**
- * Destructor.
- */
- virtual ~BufferedInputStream();
-
- /**
- * Locks the object.
- */
- virtual void lock() throw(exceptions::ActiveMQException){
- assert( stream != NULL );
- stream->lock();
- }
-
- /**
- * Unlocks the object.
- */
- virtual void unlock() throw(exceptions::ActiveMQException){
- assert( stream != NULL );
- stream->unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- */
- virtual void wait() throw(exceptions::ActiveMQException){
- assert( stream != NULL );
- stream->wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param time in millisecsonds to wait, or WAIT_INIFINITE
- * @throws ActiveMQException
- */
- virtual void wait(unsigned long millisecs)
- throw(exceptions::ActiveMQException) {
-
- assert( stream != NULL );
- stream->wait(millisecs);
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notify() throw(exceptions::ActiveMQException){
- assert( stream != NULL );
- stream->notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notifyAll() throw(exceptions::ActiveMQException){
- assert( stream != NULL );
- stream->notifyAll();
- }
-
- /**
- * Indcates the number of bytes avaialable.
- * @return the sum of the amount of data avalable
- * in the buffer and the data available on the target
- * input stream.
- */
- virtual int available() const{
- return (tail-head)+stream->available();
- }
-
- /**
- * Reads a single byte from the buffer.
- * @return The next byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual unsigned char read() throw (IOException);
-
- /**
- * Reads an array of bytes from the buffer.
- * @param buffer (out) the target buffer.
- * @param bufferSize the size of the output buffer.
- * @return The number of bytes read.
- * @throws IOException thrown if an error occurs.
- */
- virtual int read( unsigned char* buffer, const int bufferSize ) throw (IOException);
-
- /**
- * Closes the target input stream.
- */
- virtual void close(void) throw(cms::CMSException);
-
- private:
-
- /**
- * Initializes the internal structures.
- */
- void init( InputStream* stream, const int bufferSize );
-
- /**
- * Populates the buffer with as much data as possible
- * from the target input stream.
- */
- void bufferData(void) throw (IOException);
-
- };
-
-}}
-
-#endif /*ACTIVEMQ_IO_BUFFEREDINPUTSTREAM_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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.
+ */
+
+#ifndef ACTIVEMQ_IO_BUFFEREDINPUTSTREAM_H_
+#define ACTIVEMQ_IO_BUFFEREDINPUTSTREAM_H_
+
+#include <activemq/io/InputStream.h>
+#include <assert.h>
+
+namespace activemq{
+namespace io{
+
+ /**
+ * A wrapper around another input stream that performs
+ * a buffered read, where it reads more data than it needs
+ * in order to reduce the number of io operations on the
+ * input stream.
+ */
+ class BufferedInputStream : public InputStream
+ {
+ private:
+
+ /**
+ * The target input stream.
+ */
+ InputStream* stream;
+
+ /**
+ * The internal buffer.
+ */
+ unsigned char* buffer;
+
+ /**
+ * The buffer size.
+ */
+ int bufferSize;
+
+ /**
+ * The current head of the buffer.
+ */
+ int head;
+
+ /**
+ * The current tail of the buffer.
+ */
+ int tail;
+
+ public:
+
+ /**
+ * Constructor
+ * @param stream The target input stream.
+ */
+ BufferedInputStream( InputStream* stream );
+
+ /**
+ * Constructor
+ * @param stream the target input stream
+ * @param bufferSize the size for the internal buffer.
+ */
+ BufferedInputStream( InputStream* stream, const int bufferSize );
+
+ /**
+ * Destructor.
+ */
+ virtual ~BufferedInputStream();
+
+ /**
+ * Locks the object.
+ */
+ virtual void lock() throw(exceptions::ActiveMQException){
+ assert( stream != NULL );
+ stream->lock();
+ }
+
+ /**
+ * Unlocks the object.
+ */
+ virtual void unlock() throw(exceptions::ActiveMQException){
+ assert( stream != NULL );
+ stream->unlock();
+ }
+
+ /**
+ * Waits on a signal from this object, which is generated
+ * by a call to Notify. Must have this object locked before
+ * calling.
+ */
+ virtual void wait() throw(exceptions::ActiveMQException){
+ assert( stream != NULL );
+ stream->wait();
+ }
+
+ /**
+ * Waits on a signal from this object, which is generated
+ * by a call to Notify. Must have this object locked before
+ * calling. This wait will timeout after the specified time
+ * interval.
+ * @param time in millisecsonds to wait, or WAIT_INIFINITE
+ * @throws ActiveMQException
+ */
+ virtual void wait(unsigned long millisecs)
+ throw(exceptions::ActiveMQException) {
+
+ assert( stream != NULL );
+ stream->wait(millisecs);
+ }
+
+ /**
+ * Signals a waiter on this object that it can now wake
+ * up and continue. Must have this object locked before
+ * calling.
+ */
+ virtual void notify() throw(exceptions::ActiveMQException){
+ assert( stream != NULL );
+ stream->notify();
+ }
+
+ /**
+ * Signals the waiters on this object that it can now wake
+ * up and continue. Must have this object locked before
+ * calling.
+ */
+ virtual void notifyAll() throw(exceptions::ActiveMQException){
+ assert( stream != NULL );
+ stream->notifyAll();
+ }
+
+ /**
+ * Indcates the number of bytes avaialable.
+ * @return the sum of the amount of data avalable
+ * in the buffer and the data available on the target
+ * input stream.
+ */
+ virtual int available() const{
+ return (tail-head)+stream->available();
+ }
+
+ /**
+ * Reads a single byte from the buffer.
+ * @return The next byte.
+ * @throws IOException thrown if an error occurs.
+ */
+ virtual unsigned char read() throw (IOException);
+
+ /**
+ * Reads an array of bytes from the buffer.
+ * @param buffer (out) the target buffer.
+ * @param bufferSize the size of the output buffer.
+ * @return The number of bytes read.
+ * @throws IOException thrown if an error occurs.
+ */
+ virtual int read( unsigned char* buffer, const int bufferSize ) throw (IOException);
+
+ /**
+ * Closes the target input stream.
+ */
+ virtual void close(void) throw(cms::CMSException);
+
+ private:
+
+ /**
+ * Initializes the internal structures.
+ */
+ void init( InputStream* stream, const int bufferSize );
+
+ /**
+ * Populates the buffer with as much data as possible
+ * from the target input stream.
+ */
+ void bufferData(void) throw (IOException);
+
+ };
+
+}}
+
+#endif /*ACTIVEMQ_IO_BUFFEREDINPUTSTREAM_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/BufferedInputStream.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.h?rev=419365&r1=419364&r2=419365&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.h Wed Jul 5 15:27:34 2006
@@ -1,181 +1,181 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * 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.
- */
-
-#ifndef ACTIVEMQ_IO_BUFFEREDOUTPUTSTREAM_H_
-#define ACTIVEMQ_IO_BUFFEREDOUTPUTSTREAM_H_
-
-#include <activemq/io/OutputStream.h>
-#include <assert.h>
-
-namespace activemq{
-namespace io{
-
- /**
- * Wrapper around another output stream that buffers
- * output before writing to the target output stream.
- */
- class BufferedOutputStream : public OutputStream
- {
- private:
-
- /**
- * The target output stream.
- */
- OutputStream* stream;
-
- /**
- * The internal buffer.
- */
- unsigned char* buffer;
-
- /**
- * The size of the internal buffer.
- */
- int bufferSize;
-
- /**
- * The current head of the buffer.
- */
- int head;
-
- /**
- * The current tail of the buffer.
- */
- int tail;
-
- public:
-
- /**
- * Constructor.
- * @param stream the target output stream.
- */
- BufferedOutputStream( OutputStream* stream );
-
- /**
- * Constructor
- * @param stream the target output stream.
- * @param bufSize the size for the internal buffer.
- */
- BufferedOutputStream( OutputStream* stream, const int bufSize );
-
- /**
- * Destructor
- */
- virtual ~BufferedOutputStream();
-
- /**
- * Locks the object.
- */
- virtual void lock() throw(exceptions::ActiveMQException){
- assert( stream != NULL );
- stream->lock();
- }
-
- /**
- * Unlocks the object.
- */
- virtual void unlock() throw(exceptions::ActiveMQException){
- assert( stream != NULL );
- stream->unlock();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- */
- virtual void wait() throw(exceptions::ActiveMQException){
- assert( stream != NULL );
- stream->wait();
- }
-
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param time in millisecsonds to wait, or WAIT_INIFINITE
- * @throws ActiveMQException
- */
- virtual void wait(unsigned long millisecs)
- throw(exceptions::ActiveMQException) {
-
- assert( stream != NULL );
- stream->wait(millisecs);
- }
-
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notify() throw(exceptions::ActiveMQException){
- assert( stream != NULL );
- stream->notify();
- }
-
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notifyAll() throw(exceptions::ActiveMQException){
- assert( stream != NULL );
- stream->notifyAll();
- }
-
- /**
- * Writes a single byte to the output stream.
- * @param c the byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char c ) throw (IOException);
-
- /**
- * Writes an array of bytes to the output stream.
- * @param buffer The array of bytes to write.
- * @param len The number of bytes from the buffer to be written.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char* buffer, const int len ) throw (IOException);
-
- /**
- * Invokes flush on the target output stream.
- */
- virtual void flush() throw (IOException);
-
- /**
- * Invokes close on the target output stream.
- */
- void close() throw(cms::CMSException);
-
- private:
-
- /**
- * Initializes the internal structures.
- */
- void init( OutputStream* stream, const int bufSize );
-
- /**
- * Writes the contents of the buffer to the output stream.
- */
- void emptyBuffer() throw (IOException);
- };
-
-}}
-
-#endif /*ACTIVEMQ_IO_BUFFEREDOUTPUTSTREAM_H_*/
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * 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.
+ */
+
+#ifndef ACTIVEMQ_IO_BUFFEREDOUTPUTSTREAM_H_
+#define ACTIVEMQ_IO_BUFFEREDOUTPUTSTREAM_H_
+
+#include <activemq/io/OutputStream.h>
+#include <assert.h>
+
+namespace activemq{
+namespace io{
+
+ /**
+ * Wrapper around another output stream that buffers
+ * output before writing to the target output stream.
+ */
+ class BufferedOutputStream : public OutputStream
+ {
+ private:
+
+ /**
+ * The target output stream.
+ */
+ OutputStream* stream;
+
+ /**
+ * The internal buffer.
+ */
+ unsigned char* buffer;
+
+ /**
+ * The size of the internal buffer.
+ */
+ int bufferSize;
+
+ /**
+ * The current head of the buffer.
+ */
+ int head;
+
+ /**
+ * The current tail of the buffer.
+ */
+ int tail;
+
+ public:
+
+ /**
+ * Constructor.
+ * @param stream the target output stream.
+ */
+ BufferedOutputStream( OutputStream* stream );
+
+ /**
+ * Constructor
+ * @param stream the target output stream.
+ * @param bufSize the size for the internal buffer.
+ */
+ BufferedOutputStream( OutputStream* stream, const int bufSize );
+
+ /**
+ * Destructor
+ */
+ virtual ~BufferedOutputStream();
+
+ /**
+ * Locks the object.
+ */
+ virtual void lock() throw(exceptions::ActiveMQException){
+ assert( stream != NULL );
+ stream->lock();
+ }
+
+ /**
+ * Unlocks the object.
+ */
+ virtual void unlock() throw(exceptions::ActiveMQException){
+ assert( stream != NULL );
+ stream->unlock();
+ }
+
+ /**
+ * Waits on a signal from this object, which is generated
+ * by a call to Notify. Must have this object locked before
+ * calling.
+ */
+ virtual void wait() throw(exceptions::ActiveMQException){
+ assert( stream != NULL );
+ stream->wait();
+ }
+
+ /**
+ * Waits on a signal from this object, which is generated
+ * by a call to Notify. Must have this object locked before
+ * calling. This wait will timeout after the specified time
+ * interval.
+ * @param time in millisecsonds to wait, or WAIT_INIFINITE
+ * @throws ActiveMQException
+ */
+ virtual void wait(unsigned long millisecs)
+ throw(exceptions::ActiveMQException) {
+
+ assert( stream != NULL );
+ stream->wait(millisecs);
+ }
+
+ /**
+ * Signals a waiter on this object that it can now wake
+ * up and continue. Must have this object locked before
+ * calling.
+ */
+ virtual void notify() throw(exceptions::ActiveMQException){
+ assert( stream != NULL );
+ stream->notify();
+ }
+
+ /**
+ * Signals the waiters on this object that it can now wake
+ * up and continue. Must have this object locked before
+ * calling.
+ */
+ virtual void notifyAll() throw(exceptions::ActiveMQException){
+ assert( stream != NULL );
+ stream->notifyAll();
+ }
+
+ /**
+ * Writes a single byte to the output stream.
+ * @param c the byte.
+ * @throws IOException thrown if an error occurs.
+ */
+ virtual void write( const unsigned char c ) throw (IOException);
+
+ /**
+ * Writes an array of bytes to the output stream.
+ * @param buffer The array of bytes to write.
+ * @param len The number of bytes from the buffer to be written.
+ * @throws IOException thrown if an error occurs.
+ */
+ virtual void write( const unsigned char* buffer, const int len ) throw (IOException);
+
+ /**
+ * Invokes flush on the target output stream.
+ */
+ virtual void flush() throw (IOException);
+
+ /**
+ * Invokes close on the target output stream.
+ */
+ void close() throw(cms::CMSException);
+
+ private:
+
+ /**
+ * Initializes the internal structures.
+ */
+ void init( OutputStream* stream, const int bufSize );
+
+ /**
+ * Writes the contents of the buffer to the output stream.
+ */
+ void emptyBuffer() throw (IOException);
+ };
+
+}}
+
+#endif /*ACTIVEMQ_IO_BUFFEREDOUTPUTSTREAM_H_*/
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/BufferedOutputStream.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/activemq/trunk/activemq-cpp/src/main/activemq/io/ByteArrayInputStream.cpp
------------------------------------------------------------------------------
svn:eol-style = native