Merge from ECOMP's repository
[vid.git] / vid-app-common / src / main / webapp / app / vid / scripts / services / propertyService.js
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * VID\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ============LICENSE_END=========================================================\r
19  */\r
20 \r
21 "use strict";\r
22 \r
23 var PropertyService = function($location, $http, VIDCONFIGURATION ) {\r
24 \r
25     var RE = /.*?:\/\/.*?:.*?\/(.*?)\//g;\r
26     var BASE_PATH = "vid";\r
27     var DEFAULT_AAI_BASE_URL = "/" + BASE_PATH;\r
28     var DEFAULT_ASDC_BASE_URL = "asdc";\r
29     var DEFAULT_MSO_MAX_POLLING_INTERVAL_MSEC = 60000;\r
30     var DEFAULT_MSO_MAX_POLLS = 10;\r
31     var DEFAULT_MSO_BASE_URL = "/" + BASE_PATH + "/mso";\r
32     var MSO_POLLING_INTERVAL_MSECS = "mso_polling_interval_msecs";\r
33     var MSO_MAX_POLLS = "mso_max_polls";\r
34 \r
35     var _this = this;\r
36 \r
37     _this.asdcBaseUrl = DEFAULT_ASDC_BASE_URL;\r
38     _this.aaiBaseUrl = DEFAULT_AAI_BASE_URL;\r
39     _this.msoMaxPollingIntervalMsec = DEFAULT_MSO_MAX_POLLING_INTERVAL_MSEC;\r
40     _this.msoMaxPolls = DEFAULT_MSO_MAX_POLLS;\r
41     _this.msoBaseUrl = DEFAULT_MSO_BASE_URL;\r
42 \r
43     return {\r
44         \r
45         setAaiBaseUrl : function(aaiBaseUrl) {\r
46             _this.aaiBaseUrl = aaiBaseUrl;\r
47         },\r
48         \r
49         setAsdcBaseUrl : function(asdcBaseUrl) {\r
50             _this.asdcBaseUrl = asdcBaseUrl;\r
51         },\r
52         retrieveMsoMaxPollingIntervalMsec : function() {\r
53                 _this.msoMaxPollingIntervalMsec = VIDCONFIGURATION.MSO_POLLING_INTERVAL_MSECS;\r
54             return _this.msoMaxPollingIntervalMsec;\r
55         },\r
56         getMsoMaxPollingIntervalMsec : function() {\r
57             return _this.msoMaxPollingIntervalMsec;\r
58         },\r
59         setMsoMaxPollingIntervalMsec : function(msoMaxPollingIntervalMsec) {\r
60             _this.msoMaxPollingIntervalMsec = msoMaxPollingIntervalMsec;\r
61         },\r
62         retrieveMsoMaxPolls : function() {\r
63                 _this.msoMaxPolls = VIDCONFIGURATION.MSO_MAX_POLLS;\r
64             return _this.msoMaxPolls;\r
65         },\r
66         getMsoMaxPolls : function() {\r
67             return _this.msoMaxPolls;\r
68         },\r
69         setMsoMaxPolls : function(msoMaxPolls) {\r
70             _this.msoMaxPolls = msoMaxPolls;\r
71         },\r
72         getMsoBaseUrl : function() {\r
73             return "mso";\r
74         },\r
75         setMsoBaseUrl : function(msoBaseUrl) {\r
76             _this.msoBaseUrl = msoBaseUrl;\r
77         },\r
78         getServerResponseTimeoutMsec : function() {\r
79             return VIDCONFIGURATION.SERVER_RESPONSE_TIMEOUT_MSECS;\r
80         }\r
81     };\r
82 };\r
83 \r
84 appDS2.factory("PropertyService", PropertyService);\r