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
|
// **********************************************************************
//
// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef ICE_GRID_NODE_I_H
#define ICE_GRID_NODE_I_H
#include <IceUtil/Timer.h>
#include <IcePatch2/FileServer.h>
#include <IceGrid/Internal.h>
#include <IceGrid/PlatformInfo.h>
#include <IceGrid/UserAccountMapper.h>
#include <IceGrid/FileCache.h>
#include <set>
namespace IceGrid
{
class TraceLevels;
typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
class Activator;
typedef IceUtil::Handle<Activator> ActivatorPtr;
class ServerI;
typedef IceUtil::Handle<ServerI> ServerIPtr;
class ServerCommand;
typedef IceUtil::Handle<ServerCommand> ServerCommandPtr;
class NodeSessionManager;
class NodeI : public Node, public IceUtil::Monitor<IceUtil::Mutex>
{
public:
NodeI(const Ice::ObjectAdapterPtr&, NodeSessionManager&, const ActivatorPtr&, const IceUtil::TimerPtr&,
const TraceLevelsPtr&, const NodePrx&, const std::string&, const UserAccountMapperPrx&);
virtual ~NodeI();
virtual void loadServer_async(const AMD_Node_loadServerPtr&,
const InternalServerDescriptorPtr&,
const std::string&,
const Ice::Current&);
virtual void destroyServer_async(const AMD_Node_destroyServerPtr&,
const std::string&,
const std::string&,
int,
const std::string&,
const Ice::Current&);
virtual void patch_async(const AMD_Node_patchPtr&, const PatcherFeedbackPrx&, const std::string&,
const std::string&, const InternalDistributionDescriptorPtr&, bool, const Ice::Current&);
virtual void registerWithReplica(const InternalRegistryPrx&, const Ice::Current&);
virtual void replicaInit(const InternalRegistryPrxSeq&, const Ice::Current&);
virtual void replicaAdded(const InternalRegistryPrx&, const Ice::Current&);
virtual void replicaRemoved(const InternalRegistryPrx&, const Ice::Current&);
virtual std::string getName(const Ice::Current& = Ice::Current()) const;
virtual std::string getHostname(const Ice::Current& = Ice::Current()) const;
virtual LoadInfo getLoad(const Ice::Current& = Ice::Current()) const;
virtual void shutdown(const Ice::Current&) const;
virtual Ice::Long getOffsetFromEnd(const std::string&, int, const Ice::Current&) const;
virtual bool read(const std::string&, Ice::Long, int, Ice::Long&, Ice::StringSeq&, const Ice::Current&) const;
void destroy();
IceUtil::TimerPtr getTimer() const;
Ice::CommunicatorPtr getCommunicator() const;
Ice::ObjectAdapterPtr getAdapter() const;
ActivatorPtr getActivator() const;
TraceLevelsPtr getTraceLevels() const;
UserAccountMapperPrx getUserAccountMapper() const;
PlatformInfo& getPlatformInfo() const;
FileCachePtr getFileCache() const;
NodePrx getProxy() const;
const PropertyDescriptorSeq& getPropertiesOverride() const;
std::string getOutputDir() const;
bool getRedirectErrToOut() const;
bool allowEndpointsOverride() const;
NodeSessionPrx registerWithRegistry(const InternalRegistryPrx&);
void checkConsistency(const NodeSessionPrx&);
NodeSessionPrx getMasterNodeSession() const;
void addObserver(const NodeSessionPrx&, const NodeObserverPrx&);
void removeObserver(const NodeSessionPrx&);
void observerUpdateServer(const ServerDynamicInfo&);
void observerUpdateAdapter(const AdapterDynamicInfo&);
void addServer(const ServerIPtr&, const std::string&);
void removeServer(const ServerIPtr&, const std::string&);
Ice::Identity createServerIdentity(const std::string&) const;
std::string getServerAdminCategory() const;
private:
std::vector<ServerCommandPtr> checkConsistencyNoSync(const Ice::StringSeq&);
bool canRemoveServerDirectory(const std::string&);
void patch(const IcePatch2::FileServerPrx&, const std::string&, const std::vector<std::string>&);
std::set<ServerIPtr> getApplicationServers(const std::string&) const;
std::string getFilePath(const std::string&) const;
const Ice::CommunicatorPtr _communicator;
const Ice::ObjectAdapterPtr _adapter;
NodeSessionManager& _sessions;
const ActivatorPtr _activator;
const IceUtil::TimerPtr _timer;
const TraceLevelsPtr _traceLevels;
const std::string _name;
const NodePrx _proxy;
const std::string _outputDir;
const bool _redirectErrToOut;
const bool _allowEndpointsOverride;
const Ice::Int _waitTime;
const std::string _instanceName;
const UserAccountMapperPrx _userAccountMapper;
mutable PlatformInfo _platform;
const std::string _dataDir;
const std::string _serversDir;
const std::string _tmpDir;
const FileCachePtr _fileCache;
PropertyDescriptorSeq _propertiesOverride;
unsigned long _serial;
IceUtil::Mutex _observerMutex;
std::map<NodeSessionPrx, NodeObserverPrx> _observers;
std::map<std::string, ServerDynamicInfo> _serversDynamicInfo;
std::map<std::string, AdapterDynamicInfo> _adaptersDynamicInfo;
IceUtil::Mutex _serversLock;
std::map<std::string, std::set<ServerIPtr> > _serversByApplication;
std::set<std::string> _patchInProgress;
};
typedef IceUtil::Handle<NodeI> NodeIPtr;
}
#endif
|