activemq-cpp-3.4.0

src/main/activemq/state/CommandVisitorAdapter.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef _ACTIVEMQ_STATE_COMMANDVISITORADAPTER_H_
00019 #define _ACTIVEMQ_STATE_COMMANDVISITORADAPTER_H_
00020 
00021 #include <activemq/util/Config.h>
00022 
00023 #include <activemq/state/CommandVisitor.h>
00024 #include <activemq/core/ActiveMQConstants.h>
00025 
00026 #include <activemq/commands/ConnectionInfo.h>
00027 #include <activemq/commands/SessionInfo.h>
00028 #include <activemq/commands/ProducerInfo.h>
00029 #include <activemq/commands/ConsumerInfo.h>
00030 #include <activemq/commands/ConnectionId.h>
00031 #include <activemq/commands/SessionId.h>
00032 #include <activemq/commands/ProducerId.h>
00033 #include <activemq/commands/ConsumerId.h>
00034 #include <activemq/commands/DestinationInfo.h>
00035 #include <activemq/commands/RemoveSubscriptionInfo.h>
00036 #include <activemq/commands/Message.h>
00037 #include <activemq/commands/MessageAck.h>
00038 #include <activemq/commands/MessagePull.h>
00039 #include <activemq/commands/TransactionInfo.h>
00040 #include <activemq/commands/WireFormatInfo.h>
00041 #include <activemq/commands/ProducerAck.h>
00042 #include <activemq/commands/MessageDispatch.h>
00043 #include <activemq/commands/MessageDispatchNotification.h>
00044 #include <activemq/commands/ControlCommand.h>
00045 #include <activemq/commands/ConnectionInfo.h>
00046 #include <activemq/commands/ConnectionError.h>
00047 #include <activemq/commands/ConnectionControl.h>
00048 #include <activemq/commands/ConsumerControl.h>
00049 #include <activemq/commands/ShutdownInfo.h>
00050 #include <activemq/commands/KeepAliveInfo.h>
00051 #include <activemq/commands/FlushCommand.h>
00052 #include <activemq/commands/BrokerError.h>
00053 #include <activemq/commands/BrokerInfo.h>
00054 #include <activemq/commands/RemoveInfo.h>
00055 #include <activemq/commands/ReplayCommand.h>
00056 #include <activemq/commands/Response.h>
00057 
00058 namespace activemq {
00059 namespace state {
00060 
00066     class AMQCPP_API CommandVisitorAdapter : public CommandVisitor {
00067     public:
00068 
00069         virtual ~CommandVisitorAdapter() {}
00070 
00071         virtual decaf::lang::Pointer<commands::Command> processRemoveConnection(
00072             commands::ConnectionId* id AMQCPP_UNUSED ) {
00073 
00074             return decaf::lang::Pointer<commands::Command>();
00075         }
00076 
00077         virtual decaf::lang::Pointer<commands::Command> processRemoveSession(
00078             commands::SessionId* id AMQCPP_UNUSED ) {
00079 
00080             return decaf::lang::Pointer<commands::Command>();
00081         }
00082 
00083         virtual decaf::lang::Pointer<commands::Command> processRemoveProducer(
00084             commands::ProducerId* id AMQCPP_UNUSED ) {
00085 
00086             return decaf::lang::Pointer<commands::Command>();
00087         }
00088 
00089         virtual decaf::lang::Pointer<commands::Command> processRemoveConsumer(
00090             commands::ConsumerId* id AMQCPP_UNUSED ) {
00091 
00092             return decaf::lang::Pointer<commands::Command>();
00093         }
00094 
00095         virtual decaf::lang::Pointer<commands::Command> processDestinationInfo(
00096             commands::DestinationInfo* info AMQCPP_UNUSED ) {
00097 
00098             return decaf::lang::Pointer<commands::Command>();
00099         }
00100 
00101         virtual decaf::lang::Pointer<commands::Command> processRemoveDestination(
00102             commands::DestinationInfo* info AMQCPP_UNUSED ) {
00103 
00104             return decaf::lang::Pointer<commands::Command>();
00105         }
00106 
00107         virtual decaf::lang::Pointer<commands::Command> processRemoveSubscriptionInfo(
00108             commands::RemoveSubscriptionInfo* info AMQCPP_UNUSED ) {
00109 
00110             return decaf::lang::Pointer<commands::Command>();
00111         }
00112 
00113         virtual decaf::lang::Pointer<commands::Command> processMessage(
00114             commands::Message* send AMQCPP_UNUSED ) {
00115 
00116             return decaf::lang::Pointer<commands::Command>();
00117         }
00118 
00119         virtual decaf::lang::Pointer<commands::Command> processMessageAck(
00120             commands::MessageAck* ack AMQCPP_UNUSED ) {
00121 
00122             return decaf::lang::Pointer<commands::Command>();
00123         }
00124 
00125         virtual decaf::lang::Pointer<commands::Command> processMessagePull(
00126             commands::MessagePull* pull AMQCPP_UNUSED ) {
00127 
00128             return decaf::lang::Pointer<commands::Command>();
00129         }
00130 
00131         virtual decaf::lang::Pointer<commands::Command> processBeginTransaction(
00132             commands::TransactionInfo* info AMQCPP_UNUSED ) {
00133 
00134             return decaf::lang::Pointer<commands::Command>();
00135         }
00136 
00137         virtual decaf::lang::Pointer<commands::Command> processPrepareTransaction(
00138             commands::TransactionInfo* info AMQCPP_UNUSED ) {
00139 
00140             return decaf::lang::Pointer<commands::Command>();
00141         }
00142 
00143         virtual decaf::lang::Pointer<commands::Command> processCommitTransactionOnePhase(
00144             commands::TransactionInfo* info AMQCPP_UNUSED ) {
00145 
00146             return decaf::lang::Pointer<commands::Command>();
00147         }
00148 
00149         virtual decaf::lang::Pointer<commands::Command> processCommitTransactionTwoPhase(
00150             commands::TransactionInfo* info AMQCPP_UNUSED ) {
00151 
00152             return decaf::lang::Pointer<commands::Command>();
00153         }
00154 
00155         virtual decaf::lang::Pointer<commands::Command> processRollbackTransaction(
00156             commands::TransactionInfo* info AMQCPP_UNUSED ) {
00157 
00158             return decaf::lang::Pointer<commands::Command>();
00159         }
00160 
00161         virtual decaf::lang::Pointer<commands::Command> processWireFormat(
00162             commands::WireFormatInfo* info AMQCPP_UNUSED ) {
00163 
00164             return decaf::lang::Pointer<commands::Command>();
00165         }
00166 
00167         virtual decaf::lang::Pointer<commands::Command> processKeepAliveInfo(
00168             commands::KeepAliveInfo* info AMQCPP_UNUSED ) {
00169 
00170             return decaf::lang::Pointer<commands::Command>();
00171         }
00172 
00173         virtual decaf::lang::Pointer<commands::Command> processShutdownInfo(
00174             commands::ShutdownInfo* info AMQCPP_UNUSED ) {
00175 
00176             return decaf::lang::Pointer<commands::Command>();
00177         }
00178 
00179         virtual decaf::lang::Pointer<commands::Command> processFlushCommand(
00180             commands::FlushCommand* command AMQCPP_UNUSED ) {
00181 
00182             return decaf::lang::Pointer<commands::Command>();
00183         }
00184 
00185         virtual decaf::lang::Pointer<commands::Command> processBrokerInfo(
00186             commands::BrokerInfo* info AMQCPP_UNUSED ) {
00187 
00188             return decaf::lang::Pointer<commands::Command>();
00189         }
00190 
00191         virtual decaf::lang::Pointer<commands::Command> processRecoverTransactions(
00192             commands::TransactionInfo* info AMQCPP_UNUSED ) {
00193 
00194             return decaf::lang::Pointer<commands::Command>();
00195         }
00196 
00197         virtual decaf::lang::Pointer<commands::Command> processForgetTransaction(
00198             commands::TransactionInfo* info AMQCPP_UNUSED ) {
00199 
00200             return decaf::lang::Pointer<commands::Command>();
00201         }
00202 
00203         virtual decaf::lang::Pointer<commands::Command> processEndTransaction(
00204             commands::TransactionInfo* info AMQCPP_UNUSED ) {
00205 
00206             return decaf::lang::Pointer<commands::Command>();
00207         }
00208 
00209         virtual decaf::lang::Pointer<commands::Command> processMessageDispatchNotification(
00210             commands::MessageDispatchNotification* notification AMQCPP_UNUSED ) {
00211 
00212             return decaf::lang::Pointer<commands::Command>();
00213         }
00214 
00215         virtual decaf::lang::Pointer<commands::Command> processProducerAck(
00216             commands::ProducerAck* ack AMQCPP_UNUSED ) {
00217 
00218             return decaf::lang::Pointer<commands::Command>();
00219         }
00220 
00221         virtual decaf::lang::Pointer<commands::Command> processMessageDispatch(
00222             commands::MessageDispatch* dispatch AMQCPP_UNUSED ) {
00223 
00224             return decaf::lang::Pointer<commands::Command>();
00225         }
00226 
00227         virtual decaf::lang::Pointer<commands::Command> processControlCommand(
00228             commands::ControlCommand* command AMQCPP_UNUSED ) {
00229 
00230             return decaf::lang::Pointer<commands::Command>();
00231         }
00232 
00233         virtual decaf::lang::Pointer<commands::Command> processConnectionError(
00234             commands::ConnectionError* error AMQCPP_UNUSED ) {
00235 
00236             return decaf::lang::Pointer<commands::Command>();
00237         }
00238 
00239         virtual decaf::lang::Pointer<commands::Command> processConnectionControl(
00240             commands::ConnectionControl* control AMQCPP_UNUSED ) {
00241 
00242             return decaf::lang::Pointer<commands::Command>();
00243         }
00244 
00245         virtual decaf::lang::Pointer<commands::Command> processConsumerControl(
00246             commands::ConsumerControl* control AMQCPP_UNUSED ) {
00247 
00248             return decaf::lang::Pointer<commands::Command>();
00249         }
00250 
00251         virtual decaf::lang::Pointer<commands::Command> processBrokerError(
00252             commands::BrokerError* error AMQCPP_UNUSED ) {
00253 
00254             return decaf::lang::Pointer<commands::Command>();
00255         }
00256 
00257         virtual decaf::lang::Pointer<commands::Command> processReplayCommand(
00258             commands::ReplayCommand* replay AMQCPP_UNUSED ) {
00259 
00260             return decaf::lang::Pointer<commands::Command>();
00261         }
00262 
00263         virtual decaf::lang::Pointer<commands::Command> processResponse(
00264             commands::Response* response AMQCPP_UNUSED ) {
00265 
00266             return decaf::lang::Pointer<commands::Command>();
00267         }
00268 
00269         virtual decaf::lang::Pointer<commands::Command> processConnectionInfo(
00270             commands::ConnectionInfo* info AMQCPP_UNUSED ) {
00271 
00272             return decaf::lang::Pointer<commands::Command>();
00273         }
00274 
00275         virtual decaf::lang::Pointer<commands::Command> processSessionInfo(
00276             commands::SessionInfo* info AMQCPP_UNUSED ) {
00277 
00278             return decaf::lang::Pointer<commands::Command>();
00279         }
00280 
00281         virtual decaf::lang::Pointer<commands::Command> processProducerInfo(
00282             commands::ProducerInfo* info AMQCPP_UNUSED ) {
00283 
00284             return decaf::lang::Pointer<commands::Command>();
00285         }
00286 
00287         virtual decaf::lang::Pointer<commands::Command> processConsumerInfo(
00288             commands::ConsumerInfo* info AMQCPP_UNUSED ) {
00289 
00290             return decaf::lang::Pointer<commands::Command>();
00291         }
00292 
00293         virtual decaf::lang::Pointer<commands::Command> processTransactionInfo(
00294             commands::TransactionInfo* info ) {
00295 
00296             if( info != decaf::lang::Pointer<commands::Command>() ) {
00297                 switch( info->getType() ) {
00298                     case core::ActiveMQConstants::TRANSACTION_STATE_BEGIN:
00299                         return this->processBeginTransaction( info );
00300                     case core::ActiveMQConstants::TRANSACTION_STATE_COMMITONEPHASE:
00301                         return this->processCommitTransactionOnePhase( info );
00302                     case core::ActiveMQConstants::TRANSACTION_STATE_COMMITTWOPHASE:
00303                         return this->processCommitTransactionTwoPhase( info );
00304                     case core::ActiveMQConstants::TRANSACTION_STATE_END:
00305                         return this->processEndTransaction( info );
00306                     case core::ActiveMQConstants::TRANSACTION_STATE_FORGET:
00307                         return this->processForgetTransaction( info );
00308                     case core::ActiveMQConstants::TRANSACTION_STATE_PREPARE:
00309                         return this->processPrepareTransaction( info );
00310                     case core::ActiveMQConstants::TRANSACTION_STATE_RECOVER:
00311                         return this->processRecoverTransactions( info );
00312                     case core::ActiveMQConstants::TRANSACTION_STATE_ROLLBACK:
00313                         return this->processRollbackTransaction( info );
00314                     default:
00315                         throw exceptions::ActiveMQException(
00316                             __FILE__, __LINE__, "Unknown Transaction Info Type.");
00317                 }
00318             }
00319             return decaf::lang::Pointer<commands::Command>();
00320         }
00321 
00322         virtual decaf::lang::Pointer<commands::Command> processRemoveInfo(
00323             commands::RemoveInfo* info ) {
00324 
00325             if( info != decaf::lang::Pointer<commands::Command>() ) {
00326                 switch( info->getObjectId()->getDataStructureType() ) {
00327                     case commands::ConnectionId::ID_CONNECTIONID:
00328                         return this->processRemoveConnection(
00329                             dynamic_cast<commands::ConnectionId*>( info->getObjectId().get() ) );
00330                     case commands::SessionId::ID_SESSIONID:
00331                         return this->processRemoveSession(
00332                             dynamic_cast<commands::SessionId*>( info->getObjectId().get() ) );
00333                     case commands::ConsumerId::ID_CONSUMERID:
00334                         return this->processRemoveConsumer(
00335                             dynamic_cast<commands::ConsumerId*>( info->getObjectId().get() ) );
00336                     case commands::ProducerId::ID_PRODUCERID:
00337                         return this->processRemoveProducer(
00338                             dynamic_cast<commands::ProducerId*>( info->getObjectId().get() ) );
00339                     default:
00340                         throw exceptions::ActiveMQException(
00341                             __FILE__, __LINE__, "Unknown Remove Info Type.");
00342                 }
00343             }
00344             return decaf::lang::Pointer<commands::Command>();
00345         }
00346 
00347     };
00348 
00349 }}
00350 
00351 #endif /*_ACTIVEMQ_STATE_COMMANDVISITORADAPTER_H_*/