/home/aconway/svn/qpid/cpp/src/qpid/broker/Broker.h

00001 #ifndef _Broker_
00002 #define _Broker_
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  * 
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  * 
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 
00025 #include "Configuration.h"
00026 #include "ConnectionFactory.h"
00027 #include "qpid/sys/Runnable.h"
00028 #include "qpid/sys/Acceptor.h"
00029 #include "qpid/SharedObject.h"
00030 #include "MessageStore.h"
00031 #include "AutoDelete.h"
00032 #include "ExchangeRegistry.h"
00033 #include "ConnectionToken.h"
00034 #include "DirectExchange.h"
00035 #include "qpid/framing/OutputHandler.h"
00036 #include "qpid/framing/ProtocolInitiation.h"
00037 #include "QueueRegistry.h"
00038 
00039 namespace qpid {
00040 namespace broker {
00044 class Broker : public sys::Runnable,
00045                public SharedObject<Broker>
00046 {
00047   public:
00048     static const int16_t DEFAULT_PORT;
00049             
00050     virtual ~Broker();
00051 
00056     static shared_ptr create(int16_t port = DEFAULT_PORT);
00057 
00061     static shared_ptr create(const Configuration& config);
00062 
00069     virtual int16_t getPort() const;
00070             
00075     virtual void run();
00076 
00078     virtual void shutdown();
00079 
00080     MessageStore& getStore() { return *store; }
00081     QueueRegistry& getQueues() { return queues; }
00082     ExchangeRegistry& getExchanges() { return exchanges; }
00083     uint32_t getTimeout() { return timeout; }
00084     uint64_t getStagingThreshold() { return stagingThreshold; }
00085     AutoDelete& getCleaner() { return cleaner; }
00086     
00087   private:
00088     Broker(const Configuration& config);
00089     sys::Acceptor& getAcceptor() const;
00090 
00091     Configuration config;
00092     sys::Acceptor::shared_ptr acceptor;
00093     const std::auto_ptr<MessageStore> store;
00094     QueueRegistry queues;
00095     ExchangeRegistry exchanges;
00096     uint32_t timeout;
00097     uint64_t stagingThreshold;
00098     AutoDelete cleaner;
00099     ConnectionFactory factory;
00100 
00101     static MessageStore* createStore(const Configuration& config);
00102 };
00103 
00104 }}
00105             
00106 
00107 
00108 #endif  

Generated on Tue Apr 17 14:22:03 2007 for Qpid by  doxygen 1.4.7