modules._pike
Go to the documentation of this file.
1 /* Copyright (C) 2000-2004 Thomas Bopp, Thorsten Hampel, Ludger Merkens
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * $Id: modules.pike,v 1.1 2008/03/31 13:39:57 exodusd Exp $
18  */
19 inherit "/kernel/db_mapping";
20 #include <macros.h>
21 #include <attributes.h>
22 //! This module is used for storing all other modules inside the database.
23 //! So it enables a lookup "module" and get the related sTeam module object.
24 class modules : public db_mapping{
25 public:
26 
27 
28 
29 
30 
31 
32 
33 mixed get_value(string|int key)
34 {
35  return ::get_value(key);
36 }
37 
38 int set_value(string|int key, mixed value)
39 {
40  if (CALLER!=_Database && CALLER!= _Server)
41  THROW("illegal attempt to register a module from "+
42  master()->stupid_describe(CALLER)+ "different from "+
43  master()->stupid_describe(_Database), E_ACCESS);
44  return ::set_value(key, value);
45 }
46 
47 /**
48  * This is a hack, since the modules module is no real object, it is
49  * created each time the server is started. So database connection is done
50  * on creation and not on (post)_initialization
51  * @see create
52 private:
53  * @see post_init_db_mapping
54  */
55 void create()
56 {
57  load_db_mapping();
58 }
59 
60 public:
61 
62 array index()
63 {
64  return ::index();
65 }
66 
67 string get_identifier() { return "modules"; }
68 
69 int get_object_id() {
70  return 0;
71 }
72 
73 string get_table_name() {
74  return "modules";
75 }
76 
77 
78 };