ad9bf7dfa1d7bfda06a192ebad97102c14b21b6b
[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 DEFAULT_SERVER_RESPONSE_TIMEOUT_MSEC = 60000;\r
33     var MSO_POLLING_INTERVAL_MSECS = "mso_polling_interval_msecs";\r
34     var MSO_MAX_POLLS = "mso_max_polls";\r
35 \r
36     var _this = this;\r
37 \r
38     _this.asdcBaseUrl = DEFAULT_ASDC_BASE_URL;\r
39     _this.aaiBaseUrl = DEFAULT_AAI_BASE_URL;\r
40     _this.msoMaxPollingIntervalMsec = DEFAULT_MSO_MAX_POLLING_INTERVAL_MSEC;\r
41     _this.msoMaxPolls = DEFAULT_MSO_MAX_POLLS;\r
42     _this.msoBaseUrl = DEFAULT_MSO_BASE_URL;\r
43     _this.serverResponseTimeoutMsec = DEFAULT_SERVER_RESPONSE_TIMEOUT_MSEC;\r
44 \r
45     return {\r
46         \r
47         setAaiBaseUrl : function(aaiBaseUrl) {\r
48             _this.aaiBaseUrl = aaiBaseUrl;\r
49         },\r
50         \r
51         setAsdcBaseUrl : function(asdcBaseUrl) {\r
52             _this.asdcBaseUrl = asdcBaseUrl;\r
53         },\r
54         retrieveMsoMaxPollingIntervalMsec : function() {\r
55                 _this.msoMaxPollingIntervalMsec = VIDCONFIGURATION.MSO_POLLING_INTERVAL_MSECS;\r
56             return _this.msoMaxPollingIntervalMsec;\r
57         },\r
58         getMsoMaxPollingIntervalMsec : function() {\r
59             return _this.msoMaxPollingIntervalMsec;\r
60         },\r
61         setMsoMaxPollingIntervalMsec : function(msoMaxPollingIntervalMsec) {\r
62             _this.msoMaxPollingIntervalMsec = msoMaxPollingIntervalMsec;\r
63         },\r
64         retrieveMsoMaxPolls : function() {\r
65                 _this.msoMaxPolls = VIDCONFIGURATION.MSO_MAX_POLLS;\r
66             return _this.msoMaxPolls;\r
67         },\r
68         getMsoMaxPolls : function() {\r
69             return _this.msoMaxPolls;\r
70         },\r
71         setMsoMaxPolls : function(msoMaxPolls) {\r
72             _this.msoMaxPolls = msoMaxPolls;\r
73         },\r
74         getMsoBaseUrl : function() {\r
75             return "mso";\r
76         },\r
77         setMsoBaseUrl : function(msoBaseUrl) {\r
78             _this.msoBaseUrl = msoBaseUrl;\r
79         },\r
80         getServerResponseTimeoutMsec : function() {\r
81             return _this.serverResponseTimeoutMsec;\r
82         },\r
83         setServerResponseTimeoutMsec : function(serverResponseTimeoutMsec) {\r
84             _this.serverResponseTimeoutMsec = serverResponseTimeoutMsec;\r
85         }\r
86     };\r
87 }\r
88 \r
89 appDS2.factory("PropertyService", PropertyService);\r