Get policy in CsarInstaller
[clamp.git] / src / main / java / org / onap / clamp / policy / downloader / PolicyDownloader.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2020 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  * ===================================================================
21  *
22  */
23
24 package org.onap.clamp.policy.downloader;
25
26 import com.att.eelf.configuration.EELFLogger;
27 import com.att.eelf.configuration.EELFManager;
28
29 import org.apache.camel.CamelContext;
30 import org.onap.clamp.clds.client.DcaeInventoryServices;
31 import org.onap.clamp.clds.config.ClampProperties;
32 import org.springframework.beans.factory.annotation.Autowired;
33 import org.springframework.context.annotation.Configuration;
34 import org.springframework.context.annotation.Profile;
35
36 /**
37  * This class implements a periodic job that is done in the background to
38  * synchronize policy models available on the policy engine and the clamp
39  * database table PolicyModel.
40  */
41 @Configuration
42 @Profile("clamp-policy-controller")
43 public class PolicyDownloader {
44
45     protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeInventoryServices.class);
46     protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
47     protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
48     public static final String POLICY_RETRY_INTERVAL = "policy.retry.interval";
49     public static final String POLICY_RETRY_LIMIT = "policy.retry.limit";
50
51     private final CamelContext camelContext;
52
53     private final ClampProperties refProp;
54
55     @Autowired
56     public PolicyDownloader(CamelContext camelContext, ClampProperties refProp) {
57         this.refProp = refProp;
58         this.camelContext = camelContext;
59     }
60
61 }