IHMConfigClass.php
6.93 KB
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<?php
/**
* @class IHMConfigClass
* @brief Class that's contain all specific configuration of the IHM client
* @details
*/
class IHMConfigClass
{
private static $genericDataDir = "generic_data/";
private static $functionsDir = "Functions/";
private static $constantsFile = "constants.xml";
private static $functionsFile = "functions.xml";
private static $functionsArgsListFile = "functions_args_list.xml";
private static $paramTemplateDir = "LocalData/ParamTemplate/";
private static $paramTemplateFile = "ParamTemplateList.xml";
private static $paramTemplateGenerateDir = "generateTemplateParams";
private static $dataDir = "data/";
private static $compilationDir = "compilation/";
private static $storedRequestDir = "REQ/";
private static $requestDir = "RES/";
private static $sharedDir = "shared_data/";
private static $sharedTreeFile = "SharedObjectTree.xml";
private static $ttDir = "TT/";
private static $wsDir = "WS/";
private static $downloadTmp = "DOWNLOAD.TEMP/";
private static $jobsDir = "JOBS/";
private static $localBaseDir = "DATA/";
private static $aliasesFile = "Alias.xml";
private static $wsInfoFile = "WS_info.json";
private static $processMgrFile = "processManager.xml";
private static $migrationBackupDir = "MIGRATION_BACKUP/";
private static $jobsMgrFile = "jobs.xml";
private static $userParamMgrFile = "WsParams.xml";
private static $userRequestMgrFile = "Request.xml";
private static $localTreeFile = "LocalParams.xml";
private static $userName;
private static $userHost;
public static $remoteDataDir = "RemoteData/";
public static function setUserName($userName)
{
self::$userName = $userName;
}
public static function getUserName()
{
return self::$userName;
}
public static function setUserHost($userHost)
{
self::$userHost = $userHost;
}
public static function getUserHost()
{
return self::$userHost;
}
public static function getDataDir()
{
return IHM_SRC_DIR."/".self::$dataDir.'/';
}
public static function getRelativeResultPath()
{
$userPath = self::$dataDir."/".self::$userName.'/'.self::$requestDir;
return $userPath;
}
public static function getUserPath()
{
$userPath = self::getDataDir().self::$userName.'/';
if (!is_dir($userPath))
mkdir($userPath);
return $userPath;
}
public static function getUserWSInfoFilePath()
{
return self::getUserPath().self::$wsInfoFile;
}
public static function getProcessManagerFilePath()
{
return self::getDataDir().self::$processMgrFile;
}
public static function getMigrationBackupPath($version)
{
$backupPath = self::getDataDir().self::$migrationBackupDir;
if (!is_dir($backupPath))
mkdir($backupPath);
$backupPath .= ("".$version."/");
if (!is_dir($backupPath))
mkdir($backupPath);
$backupPath .= (self::$userName.'/');
if (!is_dir($backupPath))
mkdir($backupPath);
return $backupPath;
}
public static function getGenericDataPath()
{
return IHM_SRC_DIR."/".self::$genericDataDir."/";
}
public static function getConstantsFilePath()
{
return self::getGenericDataPath().self::$functionsDir.self::$constantsFile;
}
public static function getFunctionsFilePath()
{
return self::getGenericDataPath().self::$functionsDir.self::$functionsFile;
}
public static function getFunctionsArgsListFilePath()
{
return self::getGenericDataPath().self::$functionsDir.self::$functionsArgsListFile;
}
public static function getParamTemplateFilePath($fileName)
{
return self::getGenericDataPath().self::$paramTemplateDir.$fileName.".xml";
}
public static function getTemplateParamGeneratePath()
{
return self::getUserPath().self::$paramTemplateGenerateDir;
}
public static function getDownloadTmpPath()
{
return self::getUserPath().self::$downloadTmp;
}
public static function getParamTemplateListFilePath()
{
return self::getGenericDataPath().self::$paramTemplateDir.self::$paramTemplateFile;
}
public static function getUserParamManagerFilePath()
{
return self::getUserWSPath().self::$userParamMgrFile;
}
public static function getUserRequestManagerFilePath()
{
return self::getUserWSPath().self::$userRequestMgrFile;
}
public static function getUserDerivedParamFilePath($paramId)
{
return self::getUserWSPath().$paramId.".xml";
}
public static function getUserUploadedParamFilePath($paramId)
{
return self::getUserWSPath().$paramId.".xml";
}
public static function getLocalParamDBPath()
{
return PARAMS_LOCALDB_DIR;
}
public static function getLocalParamInfoPath()
{
return PARAMS_LOCALINFO_DIR;
}
public static function getSharedPath()
{
return IHM_SRC_DIR.'/'.self::$sharedDir;
}
public static function getSharedTreeFilePath()
{
return self::getSharedPath().self::$sharedTreeFile;
}
public static function getUserTTPath()
{
return self::getUserPath().self::$ttDir;
}
public static function getUserWSPath()
{
return self::getUserPath().self::$wsDir;
}
public static function getUserJobsPath()
{
$jobsPath = self::getUserPath().self::$jobsDir;
if (!is_dir($jobsPath))
mkdir($jobsPath,0755);
return $jobsPath;
}
public static function getUserJobsFile()
{
return self::getUserJobsPath().self::$jobsMgrFile;
}
public static function getUserAliasesFilePath()
{
return self::getUserWSPath().self::$aliasesFile;
}
public static function getUserLocalTreePath()
{
return self::getUserWSPath().self::$localTreeFile;
}
public static function getCompilationPath()
{
$compilationPath = self::getUserPath().self::$compilationDir;
if (!is_dir($compilationPath))
{
if (mkdir($compilationPath))
{
mkdir($compilationPath."src/");
mkdir($compilationPath."lib/");
}
}
return $compilationPath;
}
public static function getLocalBasePath()
{
$localBasePath = self::getUserPath().self::$localBaseDir;
if (!is_dir($localBasePath))
mkdir($localBasePath);
return $localBasePath;
}
public static function getRemoteParamsFile()
{
$remoteBasePath = self::getUserPath().self::$wsDir;
return $remoteBasePath.'RemoteParams.xml';
}
public static function getRequestPath()
{
$requestPath = self::getUserPath().self::$requestDir;
if (!is_dir($requestPath))
mkdir($requestPath);
return $requestPath;
}
public static function getStoredRequestPath()
{
$storedRequestPath = self::getUserPath().self::$storedRequestDir;
if (!is_dir($storedRequestPath))
mkdir($storedRequestPath);
return $storedRequestPath;
}
public static function getRemoteDataPath()
{
$remoteDataPath = self::getGenericDataPath().self::$remoteDataDir;
return $remoteDataPath;
}
}
?>