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_TRANSPORT_MOCK_INTERNALCOMMANDLISTENER_H_ 00019 #define _ACTIVEMQ_TRANSPORT_MOCK_INTERNALCOMMANDLISTENER_H_ 00020 00021 #include <activemq/util/Config.h> 00022 #include <activemq/transport/mock/ResponseBuilder.h> 00023 #include <activemq/transport/DefaultTransportListener.h> 00024 00025 #include <decaf/lang/Thread.h> 00026 #include <decaf/lang/Pointer.h> 00027 #include <decaf/util/LinkedList.h> 00028 #include <decaf/util/concurrent/Concurrent.h> 00029 #include <decaf/util/concurrent/atomic/AtomicInteger.h> 00030 #include <decaf/util/concurrent/CountDownLatch.h> 00031 00032 namespace activemq { 00033 namespace transport { 00034 namespace mock { 00035 00036 class MockTransport; 00037 00045 class AMQCPP_API InternalCommandListener : public DefaultTransportListener, 00046 public decaf::lang::Thread { 00047 private: 00048 00049 MockTransport* transport; 00050 Pointer<ResponseBuilder> responseBuilder; 00051 bool done; 00052 decaf::util::concurrent::CountDownLatch startedLatch; 00053 decaf::util::LinkedList<Pointer<Command> > inboundQueue; 00054 00055 private: 00056 00057 InternalCommandListener(const InternalCommandListener&); 00058 InternalCommandListener operator=(const InternalCommandListener&); 00059 00060 public: 00061 00062 InternalCommandListener(); 00063 00064 virtual ~InternalCommandListener(); 00065 00066 void setTransport(MockTransport* transport) { 00067 this->transport = transport; 00068 } 00069 00070 void setResponseBuilder(const Pointer<ResponseBuilder> responseBuilder) { 00071 this->responseBuilder = responseBuilder; 00072 } 00073 00074 virtual void onCommand(const Pointer<Command> command); 00075 00076 void run(); 00077 00078 }; 00079 00080 }}} 00081 00082 #endif /* _ACTIVEMQ_TRANSPORT_MOCK_INTERNALCOMMANDLISTENER_H_ */
1.6.1