Return-Path: Delivered-To: apmail-incubator-qpid-commits-archive@locus.apache.org Received: (qmail 10588 invoked from network); 20 Nov 2006 11:27:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Nov 2006 11:27:27 -0000 Received: (qmail 78350 invoked by uid 500); 20 Nov 2006 11:27:37 -0000 Delivered-To: apmail-incubator-qpid-commits-archive@incubator.apache.org Received: (qmail 78322 invoked by uid 500); 20 Nov 2006 11:27:37 -0000 Mailing-List: contact qpid-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: qpid-dev@incubator.apache.org Delivered-To: mailing list qpid-commits@incubator.apache.org Received: (qmail 78312 invoked by uid 99); 20 Nov 2006 11:27:37 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Nov 2006 03:27:36 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Nov 2006 03:27:26 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id B81A21A9846; Mon, 20 Nov 2006 03:26:52 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r477148 - in /incubator/qpid/trunk/qpid/cpp: src/qpid/broker/ test/unit/qpid/broker/ Date: Mon, 20 Nov 2006 11:26:51 -0000 To: qpid-commits@incubator.apache.org From: gsim@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061120112652.B81A21A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gsim Date: Mon Nov 20 03:26:45 2006 New Revision: 477148 URL: http://svn.apache.org/viewvc?view=rev&rev=477148 Log: Modifications to recovery process to allow for recovery of default bindings. Added: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp (with props) incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h (with props) Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxAckTest.cpp incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxPublishTest.cpp Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h?view=diff&rev=477148&r1=477147&r2=477148 ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStore.h Mon Nov 20 03:26:45 2006 @@ -22,14 +22,11 @@ #define _MessageStore_ #include -#include +#include #include namespace qpid { namespace broker { - class Queue; - class QueueRegistry; - /** * An abstraction of the persistent storage for messages. */ @@ -47,7 +44,7 @@ /** * Request recovery of queue and message state from store */ - virtual void recover(QueueRegistry& queues) = 0; + virtual void recover(RecoveryManager& queues) = 0; /** * Enqueues a message, storing the message if it has not Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp?view=diff&rev=477148&r1=477147&r2=477148 ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.cpp Mon Nov 20 03:26:45 2006 @@ -38,7 +38,7 @@ store->destroy(queue); } -void MessageStoreModule::recover(QueueRegistry& registry) +void MessageStoreModule::recover(RecoveryManager& registry) { store->recover(registry); } Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h?view=diff&rev=477148&r1=477147&r2=477148 ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/MessageStoreModule.h Mon Nov 20 03:26:45 2006 @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include namespace qpid { @@ -38,7 +38,7 @@ MessageStoreModule(const std::string& name); void create(const Queue& queue); void destroy(const Queue& queue); - void recover(QueueRegistry& queues); + void recover(RecoveryManager& queues); void enqueue(TransactionContext* ctxt, Message::shared_ptr& msg, const Queue& queue, const string * const xid); void dequeue(TransactionContext* ctxt, Message::shared_ptr& msg, const Queue& queue, const string * const xid); void committed(const string * const xid); Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp?view=diff&rev=477148&r1=477147&r2=477148 ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.cpp Mon Nov 20 03:26:45 2006 @@ -22,7 +22,7 @@ #include #include -#include +#include #include @@ -34,7 +34,7 @@ void NullMessageStore::destroy(const Queue& queue){ std::cout << "WARNING: Can't destroy durable queue '" << queue.getName() << "'. Persistence not enabled." << std::endl; } -void NullMessageStore::recover(QueueRegistry&){ +void NullMessageStore::recover(RecoveryManager&){ std::cout << "WARNING: Persistence not enabled, no recovery of queues or messages." << std::endl; } void NullMessageStore::enqueue(TransactionContext*, Message::shared_ptr&, const Queue& queue, const string * const){ Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h?view=diff&rev=477148&r1=477147&r2=477148 ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/NullMessageStore.h Mon Nov 20 03:26:45 2006 @@ -27,8 +27,6 @@ namespace qpid { namespace broker { - class Queue; - class QueueRegistry; /** * A null implementation of the MessageStore interface @@ -37,7 +35,7 @@ public: void create(const Queue& queue); void destroy(const Queue& queue); - void recover(QueueRegistry& queues); + void recover(RecoveryManager& queues); void enqueue(TransactionContext* ctxt, Message::shared_ptr& msg, const Queue& queue, const string * const xid); void dequeue(TransactionContext* ctxt, Message::shared_ptr& msg, const Queue& queue, const string * const xid); void committed(const string * const xid); Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h?view=diff&rev=477148&r1=477147&r2=477148 ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/QueueRegistry.h Mon Nov 20 03:26:45 2006 @@ -28,8 +28,6 @@ namespace qpid { namespace broker { -class SessionHandlerImpl; - /** * A registry of queues indexed by queue name. * Added: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp?view=auto&rev=477148 ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp (added) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp Mon Nov 20 03:26:45 2006 @@ -0,0 +1,42 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +#include + +using namespace qpid::broker; + +RecoveryManager::RecoveryManager(QueueRegistry& _queues, ExchangeRegistry& _exchanges) : queues(_queues), exchanges(_exchanges) {} + +RecoveryManager::~RecoveryManager() {} + +Queue::shared_ptr RecoveryManager::recoverQueue(const string& name) +{ + std::pair result = queues.declare(name, true); + Exchange::shared_ptr exchange = exchanges.getDefault(); + if (exchange) { + exchange->bind(result.first, result.first->getName(), 0); + } + return result.first; +} + +Exchange::shared_ptr RecoveryManager::recoverExchange(const string& name, const string& type) +{ + return exchanges.declare(name, type).first; +} Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.cpp ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h?view=auto&rev=477148 ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h (added) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h Mon Nov 20 03:26:45 2006 @@ -0,0 +1,45 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +#ifndef _RecoveryManager_ +#define _RecoveryManager_ + +#include +#include + +namespace qpid { +namespace broker { + + class RecoveryManager{ + QueueRegistry& queues; + ExchangeRegistry& exchanges; + public: + RecoveryManager(QueueRegistry& queues, ExchangeRegistry& exchanges); + ~RecoveryManager(); + Queue::shared_ptr recoverQueue(const string& name); + Exchange::shared_ptr recoverExchange(const string& name, const string& type); + }; + + +} +} + + +#endif Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/RecoveryManager.h ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp?view=diff&rev=477148&r1=477147&r2=477148 ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/SessionHandlerFactoryImpl.cpp Mon Nov 20 03:26:45 2006 @@ -49,7 +49,10 @@ exchanges.declare(amq_fanout, FanOutExchange::typeName); exchanges.declare(amq_match, HeadersExchange::typeName); - if(store.get()) store->recover(queues); + if(store.get()) { + RecoveryManager recoverer(queues, exchanges); + store->recover(recoverer); + } cleaner.start(); } Modified: incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxAckTest.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxAckTest.cpp?view=diff&rev=477148&r1=477147&r2=477148 ============================================================================== --- incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxAckTest.cpp (original) +++ incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxAckTest.cpp Mon Nov 20 03:26:45 2006 @@ -19,7 +19,7 @@ * */ #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ //dont care about any of the other methods: void create(const Queue&){} void destroy(const Queue&){} - void recover(QueueRegistry&){} + void recover(RecoveryManager&){} void enqueue(TransactionContext*, Message::shared_ptr&, const Queue&, const string * const){} void committed(const string * const){} void aborted(const string * const){} Modified: incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxPublishTest.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxPublishTest.cpp?view=diff&rev=477148&r1=477147&r2=477148 ============================================================================== --- incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxPublishTest.cpp (original) +++ incubator/qpid/trunk/qpid/cpp/test/unit/qpid/broker/TxPublishTest.cpp Mon Nov 20 03:26:45 2006 @@ -19,7 +19,7 @@ * */ #include -#include +#include #include #include #include @@ -48,7 +48,7 @@ //dont care about any of the other methods: void create(const Queue&){} void destroy(const Queue&){} - void recover(QueueRegistry&){} + void recover(RecoveryManager&){} void dequeue(TransactionContext*, Message::shared_ptr&, const Queue&, const string * const){} void committed(const string * const){} void aborted(const string * const){}