X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=PolicyEngineAPI%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fapi%2FPolicyEngine.java;h=b8b077c9914233644264dcd3eb46fa78bfed917d;hb=8a4b697dc3d0a5556bdb4135dea0d43d0b4bfd0f;hp=0d224cee0fe8d1c76ae98a3c9711a31e61cb3ce1;hpb=0ca791ec99d07b563cc28949d205c29b663437c1;p=policy%2Fengine.git diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyEngine.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyEngine.java index 0d224cee0..b8b077c99 100644 --- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyEngine.java +++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyEngine.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * PolicyEngineAPI * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ package org.onap.policy.api; import java.util.Collection; import java.util.Map; +import java.util.Properties; import java.util.UUID; import javax.json.JsonObject; @@ -36,11 +37,20 @@ import org.onap.policy.std.StdPolicyEngine; * @version 2.0 */ public class PolicyEngine{ - private String propertyFilePath = null; private final StdPolicyEngine stdPolicyEngine; private NotificationScheme scheme = null; private NotificationHandler handler = null; + /** + * PolicyEngine Constructor with Properties structure + * + * @param properties the Properties structure containing the Policy engine parameters + * @throws PolicyEngineException PolicyEngine Exception + */ + public PolicyEngine(final Properties properties) throws PolicyEngineException { + this.stdPolicyEngine= new StdPolicyEngine(properties, (String)null); + } + /** * PolicyEngine Constructor with String format of propertiesFilePathname * @@ -48,22 +58,31 @@ public class PolicyEngine{ * @throws PolicyEngineException PolicyEngine Exception */ public PolicyEngine(final String propertiesFilePathname) throws PolicyEngineException { - this.propertyFilePath = propertiesFilePathname ; - this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath, (String)null); + this.stdPolicyEngine= new StdPolicyEngine(propertiesFilePathname, (String)null); } /** - * PolicyEngine Constructor with String format of propertiesFilePathname + * PolicyEngine Constructor with Properties structure * - * @param propertiesFilePathname the String format of the propertiesFilePathname + * @param properties the Properties structure containing the Policy engine parameters * @param clientKey depicts String format of Password/ Client_Key. * @throws PolicyEngineException PolicyEngine Exception */ - public PolicyEngine(final String propertiesFilePathname, final String clientKey) throws PolicyEngineException { - this.propertyFilePath = propertiesFilePathname ; - this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath, clientKey); + public PolicyEngine(final Properties properties, final String clientKey) throws PolicyEngineException { + this.stdPolicyEngine= new StdPolicyEngine(properties, clientKey); } + /** + * PolicyEngine Constructor with String format of propertiesFilePathname + * + * @param propertiesFilePathname the String format of the propertiesFilePathname + * @param clientKey depicts String format of Password/ Client_Key. + * @throws PolicyEngineException PolicyEngine Exception + */ + public PolicyEngine(final String propertiesFilePathname, final String clientKey) throws PolicyEngineException { + this.stdPolicyEngine= new StdPolicyEngine(propertiesFilePathname, clientKey); + } + /** * PolicyEngine Constructor with String format of PropertiesFilePathname and NotificationScheme * @@ -72,9 +91,8 @@ public class PolicyEngine{ * @throws PolicyEngineException PolicyEngine Exception */ public PolicyEngine(final String propertiesFilePathname, final NotificationScheme scheme) throws PolicyEngineException{ - this.propertyFilePath = propertiesFilePathname; this.scheme = scheme; - this.stdPolicyEngine = new StdPolicyEngine(this.propertyFilePath, this.scheme); + this.stdPolicyEngine = new StdPolicyEngine(propertiesFilePathname, this.scheme); } /** @@ -86,10 +104,9 @@ public class PolicyEngine{ * @throws PolicyEngineException PolicyEngine Exception */ public PolicyEngine(final String propertiesFilePathname, final NotificationScheme scheme, final NotificationHandler handler) throws PolicyEngineException { - this.propertyFilePath = propertiesFilePathname ; this.scheme = scheme; this.handler = handler; - this.stdPolicyEngine= new StdPolicyEngine(this.propertyFilePath,this.scheme,this.handler); + this.stdPolicyEngine= new StdPolicyEngine(propertiesFilePathname,this.scheme,this.handler); } /**