Blame view

src/InputOutput/IHMImpl/Config/IHMConfigClass.php 6.93 KB
22521f1c   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
<?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/";
f28f7c0e   Benjamin Renard   Add param info re...
13
	
22521f1c   Benjamin Renard   First commit
14
15
16
	private static $constantsFile  = "constants.xml";

	private static $functionsFile  = "functions.xml";
8cf39be4   Benjamin Renard   Add functions arg...
17
18

	private static $functionsArgsListFile = "functions_args_list.xml";
bf27ba04   Benjamin Renard   Add templated par...
19
	
8ade06fe   Benjamin Renard   Improve config load
20
	private static $paramTemplateDir = "LocalData/ParamTemplate/";
22521f1c   Benjamin Renard   First commit
21

bf27ba04   Benjamin Renard   Add templated par...
22
23
24
25
	private static $paramTemplateFile = "ParamTemplateList.xml";
	
	private static $paramTemplateGenerateDir = "generateTemplateParams";
	
22521f1c   Benjamin Renard   First commit
26
27
28
29
	private static $dataDir        = "data/";

	private static $compilationDir = "compilation/";

574d7ed3   Benjamin Renard   First step to aut...
30
31
	private static $storedRequestDir = "REQ/";

22521f1c   Benjamin Renard   First commit
32
33
	private static $requestDir     = "RES/";

a242857a   Benjamin Renard   Shared objects
34
35
36
	private static $sharedDir      = "shared_data/";
	
	private static $sharedTreeFile = "SharedObjectTree.xml";
22521f1c   Benjamin Renard   First commit
37
38
39
40

	private static $ttDir          = "TT/";

	private static $wsDir          = "WS/";
0b6b2080   Elena.Budnik   TT download
41
42
	
	private static $downloadTmp    = "DOWNLOAD.TEMP/";
22521f1c   Benjamin Renard   First commit
43
44

	private static $jobsDir        = "JOBS/";
944199fe   Benjamin Renard   Use table definit...
45
46
	
	private static $localBaseDir   = "DATA/";
22521f1c   Benjamin Renard   First commit
47
48
49

	private static $aliasesFile    = "Alias.xml";

574d7ed3   Benjamin Renard   First step to aut...
50
51
	private static $wsInfoFile       = "WS_info.json";

22521f1c   Benjamin Renard   First commit
52
53
	private static $processMgrFile = "processManager.xml";

8ecf8ad9   Benjamin Renard   Fix migration dir...
54
	private static $migrationBackupDir = "MIGRATION_BACKUP/";
90097c59   Benjamin Renard   Create a backup b...
55

22521f1c   Benjamin Renard   First commit
56
57
58
59
	private static $jobsMgrFile = "jobs.xml";
	
	private static $userParamMgrFile = "WsParams.xml";

574d7ed3   Benjamin Renard   First step to aut...
60
61
	private static $userRequestMgrFile  = "Request.xml";

b3343120   Benjamin Renard   Check parameters ...
62
63
	private static $localTreeFile = "LocalParams.xml";

22521f1c   Benjamin Renard   First commit
64
	private static $userName;
ffc5cb81   Elena.Budnik   temporary commit
65
66
67
	
	private static $userHost;
	
577d5c04   Elena.Budnik   IMPEX integration
68
69
	public static $remoteDataDir = "RemoteData/";
				
22521f1c   Benjamin Renard   First commit
70
71
72
73
74
75
76
77
78
	public static function setUserName($userName)
	{
		self::$userName = $userName;
	}

	public static function getUserName()
	{
		return self::$userName;
	}
ffc5cb81   Elena.Budnik   temporary commit
79
80
81
82
83
	
	public static function setUserHost($userHost)
	{
		self::$userHost = $userHost;
	}
22521f1c   Benjamin Renard   First commit
84

ffc5cb81   Elena.Budnik   temporary commit
85
86
87
88
89
	public static function getUserHost()
	{
		return self::$userHost;
	}
	
07b282f0   Elena.Budnik   interim commit
90
91
	public static function getDataDir()
	{
68de0b39   Benjamin Renard   Merge branch mast...
92
		return IHM_SRC_DIR."/".self::$dataDir.'/';
07b282f0   Elena.Budnik   interim commit
93
94
	}
	
02024d28   Elena.Budnik   getRelativeResult...
95
96
	public static function getRelativeResultPath()
	{
68de0b39   Benjamin Renard   Merge branch mast...
97
		$userPath = self::$dataDir."/".self::$userName.'/'.self::$requestDir;
02024d28   Elena.Budnik   getRelativeResult...
98
99
100
101
 
		return $userPath;
	}
	
22521f1c   Benjamin Renard   First commit
102
103
	public static function getUserPath()
	{
68de0b39   Benjamin Renard   Merge branch mast...
104
		$userPath = self::getDataDir().self::$userName.'/';
22521f1c   Benjamin Renard   First commit
105
106
107
108
109
110
111

		if (!is_dir($userPath))
			mkdir($userPath);
			
		return $userPath;
	}

574d7ed3   Benjamin Renard   First step to aut...
112
113
114
115
116
	public static function getUserWSInfoFilePath()
	{
		return self::getUserPath().self::$wsInfoFile;
	}

22521f1c   Benjamin Renard   First commit
117
118
	public static function getProcessManagerFilePath()
	{
68de0b39   Benjamin Renard   Merge branch mast...
119
		return self::getDataDir().self::$processMgrFile;
22521f1c   Benjamin Renard   First commit
120
	}
90097c59   Benjamin Renard   Create a backup b...
121
122
123
124
125
126
127
128
129
130
131
132

	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);
5b96e0e2   Benjamin Renard   Another fix for m...
133
		return $backupPath;
90097c59   Benjamin Renard   Create a backup b...
134
	}
3cdde4bf   Elena.Budnik   getDataset()
135
136
137
	
	public static function getGenericDataPath()
	{
68de0b39   Benjamin Renard   Merge branch mast...
138
		return IHM_SRC_DIR."/".self::$genericDataDir."/";
3cdde4bf   Elena.Budnik   getDataset()
139
140
	}
	
22521f1c   Benjamin Renard   First commit
141
142
	public static function getConstantsFilePath()
	{
68de0b39   Benjamin Renard   Merge branch mast...
143
		return self::getGenericDataPath().self::$functionsDir.self::$constantsFile;
22521f1c   Benjamin Renard   First commit
144
145
146
147
	}

	public static function getFunctionsFilePath()
	{
68de0b39   Benjamin Renard   Merge branch mast...
148
		return self::getGenericDataPath().self::$functionsDir.self::$functionsFile;
22521f1c   Benjamin Renard   First commit
149
	}
8cf39be4   Benjamin Renard   Add functions arg...
150
151
152
153
154

	public static function getFunctionsArgsListFilePath()
	{
		return self::getGenericDataPath().self::$functionsDir.self::$functionsArgsListFile;
	}
22521f1c   Benjamin Renard   First commit
155
	
bf27ba04   Benjamin Renard   Add templated par...
156
157
	public static function getParamTemplateFilePath($fileName)
	{
68de0b39   Benjamin Renard   Merge branch mast...
158
		return self::getGenericDataPath().self::$paramTemplateDir.$fileName.".xml";
bf27ba04   Benjamin Renard   Add templated par...
159
160
161
162
163
164
165
	}
	
	public static function getTemplateParamGeneratePath()
	{
		return self::getUserPath().self::$paramTemplateGenerateDir;
	}
	
0b6b2080   Elena.Budnik   TT download
166
167
168
169
170
	public static function getDownloadTmpPath()
	{
		return self::getUserPath().self::$downloadTmp;
	}
	
bf27ba04   Benjamin Renard   Add templated par...
171
172
	public static function getParamTemplateListFilePath()
	{
68de0b39   Benjamin Renard   Merge branch mast...
173
		return self::getGenericDataPath().self::$paramTemplateDir.self::$paramTemplateFile;
bf27ba04   Benjamin Renard   Add templated par...
174
175
	}
	
0b6b2080   Elena.Budnik   TT download
176
177
178
	public static function getUserParamManagerFilePath()
	{
		return self::getUserWSPath().self::$userParamMgrFile;
22521f1c   Benjamin Renard   First commit
179
	}
574d7ed3   Benjamin Renard   First step to aut...
180
181
182
183
184

	public static function getUserRequestManagerFilePath()
	{
		return self::getUserWSPath().self::$userRequestMgrFile;
	}
286f7924   Benjamin Renard   Derived parameter...
185
186
187
188
189
	
	public static function getUserDerivedParamFilePath($paramId)
	{
		return self::getUserWSPath().$paramId.".xml";
	}
944199fe   Benjamin Renard   Use table definit...
190
191
192
193
194
	
	public static function getUserUploadedParamFilePath($paramId)
	{
		return self::getUserWSPath().$paramId.".xml";
	}
22521f1c   Benjamin Renard   First commit
195
196
197
198
199

	public static function getLocalParamDBPath()
	{
		return PARAMS_LOCALDB_DIR;
	}
f28f7c0e   Benjamin Renard   Add param info re...
200
201
202
203
204
	
	public static function getLocalParamInfoPath()
	{
		return PARAMS_LOCALINFO_DIR;
	}
22521f1c   Benjamin Renard   First commit
205

a242857a   Benjamin Renard   Shared objects
206
207
	public static function getSharedPath()
	{
f1252b32   Benjamin Renard   Add template for ...
208
		return IHM_SRC_DIR.'/'.self::$sharedDir;
a242857a   Benjamin Renard   Shared objects
209
210
211
	}
	
	public static function getSharedTreeFilePath()
22521f1c   Benjamin Renard   First commit
212
	{
a242857a   Benjamin Renard   Shared objects
213
		return self::getSharedPath().self::$sharedTreeFile;
22521f1c   Benjamin Renard   First commit
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
	}

	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;
	}

b3343120   Benjamin Renard   Check parameters ...
247
248
249
250
251
	public static function getUserLocalTreePath()
	{
		return self::getUserWSPath().self::$localTreeFile;
	}

22521f1c   Benjamin Renard   First commit
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
	public static function getCompilationPath()
	{
		$compilationPath = self::getUserPath().self::$compilationDir;

		if (!is_dir($compilationPath))
		{
			if (mkdir($compilationPath))
			{
				mkdir($compilationPath."src/");
				mkdir($compilationPath."lib/");
			}
		}
			
		return $compilationPath;
	}

944199fe   Benjamin Renard   Use table definit...
268
269
270
271
272
273
274
275
276
277
	public static function getLocalBasePath()
	{
		$localBasePath = self::getUserPath().self::$localBaseDir;
		
		if (!is_dir($localBasePath))
			mkdir($localBasePath);
			
		return $localBasePath;
	}
	
ffc5cb81   Elena.Budnik   temporary commit
278
279
280
	public static function getRemoteParamsFile()
	{
		$remoteBasePath = self::getUserPath().self::$wsDir;
577d5c04   Elena.Budnik   IMPEX integration
281
				 			
ffc5cb81   Elena.Budnik   temporary commit
282
283
284
		return $remoteBasePath.'RemoteParams.xml';
	}
			
22521f1c   Benjamin Renard   First commit
285
286
287
288
289
290
291
292
293
	public static function getRequestPath()
	{
		$requestPath = self::getUserPath().self::$requestDir;

		if (!is_dir($requestPath))
			mkdir($requestPath);
			
		return $requestPath;
	}
574d7ed3   Benjamin Renard   First step to aut...
294
295
296
297
298
299
300
301
302
303

	public static function getStoredRequestPath()
	{
		$storedRequestPath = self::getUserPath().self::$storedRequestDir;

		if (!is_dir($storedRequestPath))
			mkdir($storedRequestPath);

		return $storedRequestPath;
	}
577d5c04   Elena.Budnik   IMPEX integration
304
305
306
	
	public static function getRemoteDataPath()
	{
68de0b39   Benjamin Renard   Merge branch mast...
307
		$remoteDataPath = self::getGenericDataPath().self::$remoteDataDir;
577d5c04   Elena.Budnik   IMPEX integration
308
309
310
311
		
		return $remoteDataPath;
	}
	
22521f1c   Benjamin Renard   First commit
312
313
314
}

?>