Commit 87a28122e2fc549dd9497f44a3092974dad20641

Authored by Elena.Budnik
1 parent e8ff4ba7

create app.user.name field in app.properties

src/Request/Config/KernelConfigClass.php
... ... @@ -34,7 +34,7 @@ class KernelConfigClass
34 34 private static $userLibDir = "lib/";
35 35  
36 36 private static $datasetInfoDir = "DataSetInfo/";
37   - private static $instrumentInfoDir= "InstrumentInfo/";
  37 + private static $instrumentInfoDir= "InstrumentInfo/";
38 38 private static $missionInfoDir = "MissionInfo/";
39 39  
40 40 private static $localInclude = "/opt/local/include/";
... ... @@ -45,9 +45,10 @@ class KernelConfigClass
45 45  
46 46 private static $defaultGapThreshold = "5";
47 47  
48   -
49   - private static $userHost = "";
50   -
  48 +
  49 + private static $userHost = "";
  50 + private static $userName = "";
  51 +
51 52 private static $kernelAbout = "Created by CDPP/AMDA(c)";
52 53 private static $kernelAcknow = "CDPP/AMDA Team";
53 54  
... ... @@ -64,12 +65,17 @@ class KernelConfigClass
64 65 "Parameters"
65 66 );
66 67  
67   -
68   - public static function setUserHost($userHost)
69   - {
70   - self::$userHost = $userHost;
71   - }
72   -
  68 +
  69 + public static function setUserHost($userHost)
  70 + {
  71 + self::$userHost = $userHost;
  72 + }
  73 +
  74 + public static function setUserName($user)
  75 + {
  76 + self::$userName = $user;
  77 + }
  78 +
73 79 public static function getRequestParamsPath($working_dir)
74 80 {
75 81 $paramsPath = $working_dir.self::$requestParamsDir;
... ... @@ -90,24 +96,24 @@ class KernelConfigClass
90 96 return NEWKERNEL_XSD_DIR.self::$xsdRequestDir.'all.xsd';
91 97 }
92 98  
93   - public static function getXSDParamInfoFilePath()
94   - {
95   - return NEWKERNEL_XSD_DIR.self::$xsdInfoDir.'paramInfo.xsd';
  99 + public static function getXSDParamInfoFilePath()
  100 + {
  101 + return NEWKERNEL_XSD_DIR.self::$xsdInfoDir.'paramInfo.xsd';
96 102 }
97 103  
98   - public static function getXSDDatasetInfoFilePath()
99   - {
100   - return NEWKERNEL_XSD_DIR.self::$xsdInfoDir.'dataSetInfo.xsd';
  104 + public static function getXSDDatasetInfoFilePath()
  105 + {
  106 + return NEWKERNEL_XSD_DIR.self::$xsdInfoDir.'dataSetInfo.xsd';
101 107 }
102 108  
103   - public static function getXSDInstrumentInfoFilePath()
104   - {
105   - return NEWKERNEL_XSD_DIR.self::$xsdInfoDir.'instrumentInfo.xsd';
  109 + public static function getXSDInstrumentInfoFilePath()
  110 + {
  111 + return NEWKERNEL_XSD_DIR.self::$xsdInfoDir.'instrumentInfo.xsd';
106 112 }
107 113  
108   - public static function getXSDMissionInfoFilePath()
109   - {
110   - return NEWKERNEL_XSD_DIR.self::$xsdInfoDir.'missionInfo.xsd';
  114 + public static function getXSDMissionInfoFilePath()
  115 + {
  116 + return NEWKERNEL_XSD_DIR.self::$xsdInfoDir.'missionInfo.xsd';
111 117 }
112 118  
113 119 public static function getXSDLocalBaseFilePath()
... ... @@ -126,14 +132,14 @@ class KernelConfigClass
126 132 return NEWKERNEL_INFO_DIR.self::$datasetInfoDir;
127 133 }
128 134  
129   - public static function getInstrumentInfoPath()
130   - {
131   - return NEWKERNEL_INFO_DIR.self::$instrumentInfoDir;
  135 + public static function getInstrumentInfoPath()
  136 + {
  137 + return NEWKERNEL_INFO_DIR.self::$instrumentInfoDir;
132 138 }
133 139  
134   - public static function getMissionInfoPath()
135   - {
136   - return NEWKERNEL_INFO_DIR.self::$missionInfoDir;
  140 + public static function getMissionInfoPath()
  141 + {
  142 + return NEWKERNEL_INFO_DIR.self::$missionInfoDir;
137 143 }
138 144  
139 145 public static function getKernelBinPath()
... ... @@ -168,9 +174,9 @@ class KernelConfigClass
168 174  
169 175 $appProperties["app.paramInfo.xsd"] = self::getXSDParamInfoFilePath();
170 176 $appProperties["app.dataSetInfo.path"] = self::getDatasetInfoPath();
171   - $appProperties["app.dataSetInfo.xsd"] = self::getXSDDatasetInfoFilePath();
  177 + $appProperties["app.dataSetInfo.xsd"] = self::getXSDDatasetInfoFilePath();
172 178 $appProperties["app.instrumentInfo.path"] = self::getInstrumentInfoPath();
173   - $appProperties["app.instrumentInfo.xsd"] = self::getXSDInstrumentInfoFilePath();
  179 + $appProperties["app.instrumentInfo.xsd"] = self::getXSDInstrumentInfoFilePath();
174 180 $appProperties["app.missionInfo.path"] = self::getMissionInfoPath();
175 181 $appProperties["app.missionInfo.xsd"] = self::getXSDMissionInfoFilePath();
176 182  
... ... @@ -198,11 +204,13 @@ class KernelConfigClass
198 204 $appProperties["app.plot.configfile"] = INTEGRATION_SRC_DIR.'../config/'.self::$plotConfigFile;
199 205  
200 206 $appProperties["app.param.gapthreshold"] = self::$defaultGapThreshold;
201   -
202   - if (self::$userHost != "")
203   - $appProperties["app.user.host"] = self::$userHost;
204   -
205 207  
  208 + if (self::$userHost != "")
  209 + $appProperties["app.user.host"] = self::$userHost;
  210 +
  211 + if (self::$userName != "")
  212 + $appProperties["app.user.name"] = self::$userName;
  213 +
206 214 $fp = fopen($working_dir.self::$propFile, 'w');
207 215 foreach ($appProperties as $key => $value)
208 216 fwrite($fp, $key."=".$value.PHP_EOL);
... ... @@ -215,7 +223,7 @@ class KernelConfigClass
215 223 $amdaPropertiesArray["acknowledgement"] = self::$kernelAcknow;
216 224  
217 225 $fp = fopen($working_dir.self::$amdaPropFile, 'w');
218   - foreach ($amdaPropertiesArray as $key => $value)
  226 + foreach ($amdaPropertiesArray as $key => $value)
219 227 fwrite($fp, $key."=".$value.PHP_EOL);
220 228 fclose($fp);
221 229 }
... ...
src/Request/RequestAbstractClass.php
... ... @@ -12,9 +12,10 @@ abstract class RequestAbstractClass
12 12 /*
13 13 * @brief Constructor
14 14 */
15   - function __construct($userHost)
  15 + function __construct($user, $userHost)
16 16 {
17 17 KernelConfigClass::setUserHost($userHost);
  18 + KernelConfigClass::setUserName($user);
18 19 }
19 20  
20 21 /*
... ...
src/RequestManager.php
... ... @@ -107,24 +107,24 @@ Class RequestManagerClass
107 107 /*
108 108 * @brief Create the request instance in relation with the function type
109 109 */
110   - private function createRequest($userHost, $function)
  110 + private function createRequest($user, $userHost, $function)
111 111 {
112 112 switch ($function)
113 113 {
114 114 case FunctionTypeEnumClass::PARAMS :
115 115 case FunctionTypeEnumClass::PARAMSGEN :
116 116 case FunctionTypeEnumClass::ACTION :
117   - return new ParamsRequestClass($userHost);
  117 + return new ParamsRequestClass($user, $userHost);
118 118 case FunctionTypeEnumClass::PROCESSDELETE :
119 119 case FunctionTypeEnumClass::PROCESSRUNNINGINFO :
120 120 case FunctionTypeEnumClass::PROCESSGETINFO :
121 121 case FunctionTypeEnumClass::PROCESSCLEAN :
122   - return new ProcessRequestClass($userHost);
  122 + return new ProcessRequestClass($user, $userHost);
123 123 case FunctionTypeEnumClass::TTMERGE :
124 124 case FunctionTypeEnumClass::TTUNION :
125   - return new TTRequestClass($userHost);
  125 + return new TTRequestClass($user, $userHost);
126 126 case FunctionTypeEnumClass::PARAMINFO :
127   - return new ParamInfoRequestClass($userHost);
  127 + return new ParamInfoRequestClass($user, $userHost);
128 128 default :
129 129 throw new Exception('Request '.$function.' not implemented.');
130 130 }
... ... @@ -158,7 +158,7 @@ Class RequestManagerClass
158 158 $inputdata = $inputOutput->getInputData($input,$function);
159 159  
160 160 //create an instance of the RequestClass to run the request
161   - $request = $this->createRequest($userHost, $function);
  161 + $request = $this->createRequest($user, $userHost, $function);
162 162  
163 163 if (is_array($inputdata))
164 164 {
... ...