File: slCluster.h

package info (click to toggle)
pgadmin3 1.20.0~beta2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 73,704 kB
  • ctags: 18,591
  • sloc: cpp: 193,786; ansic: 18,736; sh: 5,154; pascal: 1,120; yacc: 927; makefile: 516; lex: 421; xml: 126; perl: 40
file content (226 lines) | stat: -rw-r--r-- 4,665 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// slCluster.h PostgreSQL Slony-I Cluster
//
//////////////////////////////////////////////////////////////////////////

#ifndef SLCLUSTER_H
#define SLCLUSTER_H

#include "schema/pgDatabase.h"

class frmMain;
class RemoteConn;
class slNode;


WX_DECLARE_OBJARRAY(RemoteConn, RemoteConnArray);


class pgaSlClusterFactory : public pgDatabaseObjFactory
{
public:
	pgaSlClusterFactory();
	virtual dlgProperty *CreateDialog(frmMain *frame, pgObject *node, pgObject *parent);
	virtual pgObject *CreateObjects(pgCollection *obj, ctlTree *browser, const wxString &restr = wxEmptyString);
	virtual pgCollection *CreateCollection(pgObject *obj);
};
extern pgaSlClusterFactory slClusterFactory;


class slCluster : public pgDatabaseObject
{
public:
	slCluster(const wxString &newName = wxT(""));

	void ShowTreeDetail(ctlTree *browser, frmMain *form = 0, ctlListView *properties = 0, ctlSQLBox *sqlPane = 0);
	static pgObject *ReadObjects(pgCollection *coll, ctlTree *browser);

	wxString GetTranslatedMessage(int kindOfMessage) const;

	bool ClusterMinimumVersion(int major, int minor);

	void iSetSchemaPrefix(const wxString &s)
	{
		schemaPrefix = s;
	}
	wxString GetSchemaPrefix() const
	{
		return schemaPrefix;
	}
	void iSetLocalNodeID(long l)
	{
		localNodeID = l;
	}
	long GetLocalNodeID()
	{
		return localNodeID;
	}
	void iSetLocalNodeName(const wxString &s)
	{
		localNodeName = s;
	}
	wxString GetLocalNodeName() const
	{
		return localNodeName;
	}
	void iSetAdminNodeID(long l)
	{
		adminNodeID = l;
	}
	long GetAdminNodeID()
	{
		return adminNodeID;
	}
	void iSetAdminNodeName(const wxString &s)
	{
		adminNodeName = s;
	}
	wxString GetAdminNodeName() const
	{
		return adminNodeName;
	}
	void iSetClusterVersion(const wxString &s)
	{
		clusterVersion = s;
	}
	wxString GetClusterVersion() const
	{
		return clusterVersion;
	}
	long GetSlonPid();

	slNode *GetLocalNode(ctlTree *browser);

	bool RequireDropConfirm()
	{
		return true;
	}
	bool WantDummyChild()
	{
		return true;
	}

	pgConn *GetNodeConn(frmMain *form, long nodeId, bool create = true);

	bool DropObject(wxFrame *frame, ctlTree *browser, bool cascaded);
	wxMenu *GetNewMenu();
	wxString GetSql(ctlTree *browser);
	pgObject *Refresh(ctlTree *browser, const wxTreeItemId item);

private:
	wxString schemaPrefix;
	wxString localNodeName, adminNodeName;
	wxString clusterVersion;
	long localNodeID, adminNodeID;
	slNode *localNode;

	RemoteConnArray remoteConns;
};


class slClusterCollection : public pgDatabaseObjCollection
{
public:
	slClusterCollection(pgaFactory *factory, pgDatabase *db);
	wxString GetTranslatedMessage(int kindOfMessage) const;
};


// Slony-I object
class slObject : public pgDatabaseObject
{
public:
	slObject(slCluster *_slCluster, pgaFactory &factory, const wxString &newName = wxT(""));
	slCluster *GetCluster()
	{
		return cluster;
	}

	void iSetSlId(long i)
	{
		slId = i;
	}
	long GetSlId() const
	{
		return slId;
	}

private:
	slCluster *cluster;
	long slId;
};


// Collection of Slony-I objects
class slObjCollection : public pgDatabaseObjCollection
{
public:
	slObjCollection(pgaFactory *factory, slCluster *_cluster);

	slCluster *GetCluster()
	{
		return cluster;
	}
	long GetSlId() const
	{
		return slId;
	}
	void iSetSlId(long l)
	{
		slId = l;
	}

private:
	slCluster *cluster;
	long slId;
};

class slObjFactory : public pgDatabaseObjFactory
{
public:
	slObjFactory(const wxChar *tn, const wxChar *ns, const wxChar *nls, wxImage *img, wxImage *imgSm = 0) : pgDatabaseObjFactory(tn, ns, nls, img, imgSm) {}
	virtual pgCollection *CreateCollection(pgObject *obj);
};

class clusterActionFactory : public contextActionFactory
{
public:
	clusterActionFactory(menuFactoryList *list) : contextActionFactory(list) {}
	bool CheckEnable(pgObject *obj);
};


class slonyRestartFactory : public clusterActionFactory
{
public:
	slonyRestartFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar);
	wxWindow *StartDialog(frmMain *form, pgObject *obj);
};


class slonyUpgradeFactory : public clusterActionFactory
{
public:
	slonyUpgradeFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar);
	wxWindow *StartDialog(frmMain *form, pgObject *obj);
};


class slonyFailoverFactory : public clusterActionFactory
{
public:
	slonyFailoverFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar);
	wxWindow *StartDialog(frmMain *form, pgObject *obj);
	bool CheckEnable(pgObject *obj);
};


#endif