00001 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*- 00002 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 00003 * 00004 * Copyright (C) 2010 Brian Aker 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 00022 #pragma once 00023 00024 #include <drizzled/plugin/plugin.h> 00025 #include <drizzled/identifier.h> 00026 #include <drizzled/catalog/instance.h> 00027 #include <drizzled/catalog/engine.h> 00028 00029 #include <drizzled/visibility.h> 00030 00031 namespace drizzled 00032 { 00033 namespace plugin 00034 { 00035 00036 /* 00037 This object handles the aggregate of all operations for any/all of the Catalog engines. 00038 */ 00039 class DRIZZLED_API Catalog : public Plugin { 00040 /* Disable default constructors */ 00041 Catalog(); 00042 Catalog(const Catalog &); 00043 Catalog& operator=(const Catalog &); 00044 00045 public: 00046 typedef std::vector<Catalog *> vector; 00047 00048 explicit Catalog(std::string name_arg) : 00049 Plugin(name_arg, "Catalog") 00050 {} 00051 virtual ~Catalog(); 00052 00053 virtual catalog::Engine::shared_ptr engine()= 0; 00054 00055 static bool create(identifier::Catalog::const_reference); 00056 static bool create(identifier::Catalog::const_reference, message::catalog::shared_ptr &); 00057 static bool drop(identifier::Catalog::const_reference); 00058 00059 static bool lock(identifier::Catalog::const_reference); 00060 static bool unlock(identifier::Catalog::const_reference); 00061 00062 // Required for plugin interface 00063 static bool addPlugin(plugin::Catalog *plugin); 00064 static void removePlugin(plugin::Catalog *plugin); 00065 00066 // Get Meta information 00067 static bool exist(identifier::Catalog::const_reference); 00068 static void getIdentifiers(identifier::Catalog::vector &identifiers); 00069 static void getMessages(message::catalog::vector &messages); 00070 static message::catalog::shared_ptr getMessage(identifier::Catalog::const_reference); 00071 00072 // Get Instance 00073 static catalog::Instance::shared_ptr getInstance(identifier::Catalog::const_reference); 00074 }; 00075 00076 } /* namespace plugin */ 00077 } /* namespace drizzled */ 00078