2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.policy.brmsInterface;
23 import org.openecomp.policy.api.NotificationScheme;
24 import org.openecomp.policy.api.PolicyEngine;
26 //import org.apache.log4j.Logger;
28 //import org.apache.commons.logging.Log;
29 //import org.apache.commons.logging.LogFactory;
31 import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
32 import org.openecomp.policy.common.logging.flexlogger.Logger;
34 import org.openecomp.policy.xacml.api.XACMLErrorConstants;
38 * BRMSGateway: This application acts as the Gateway interface between the PDP XACML and PDP Drools.
39 * The listens for BRMS based policies and pushes them to the specified Policy Repository, from where the PDP Drools reads the Rule Jar.
43 public class BRMSGateway {
45 private static final Logger logger = FlexLogger.getLogger(BRMSGateway.class);
46 private static final String configFile = "config.properties";
48 private static PolicyEngine policyEngine = null;
50 public static void main(String[] args) throws Exception{
51 // Initialize Handler.
52 logger.info("Initializing BRMS Handler");
53 BRMSHandler bRMSHandler = null;
55 bRMSHandler = new BRMSHandler(configFile);
56 }catch(NullPointerException e){
57 logger.error("Check your property file: " + e.getMessage());
61 // Set Handler with Auto Notification and initialize policyEngine
63 logger.info("Initializing policyEngine with Auto Notifications");
64 policyEngine= new PolicyEngine(configFile,NotificationScheme.AUTO_ALL_NOTIFICATIONS, bRMSHandler);
66 logger.error(XACMLErrorConstants.ERROR_UNKNOWN+"Error while Initializing Policy Engine " + e.getMessage());
70 Runnable runnable = new Runnable(){
75 } catch (InterruptedException e) {
76 logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR+"Thread Exception " + e.getMessage());
81 Thread thread = new Thread(runnable);
85 public static PolicyEngine getPolicyEngine(){