From 5bd9ff4130799247be3be88fc02f3ce0efd014c0 Mon Sep 17 00:00:00 2001 From: Ralph Straubs Date: Fri, 21 Apr 2017 04:23:55 -0500 Subject: Batch submit -- force rebuild [ECOMPD2TD-1126 1707] Delay the start of the election handler by one more update interval to allow updatedDate to be set and recoginized by other nodes. [ECOMPD2TD-1073 1707] Remove pessimistic locks from DB access to prevent DB deadlock [US867397-policy-management-feature-api] Split original FeatureAPI into three service interfaces. These are: - the original FeatureAPI for core - PolicyControllerFeatureAPI (additional interface methods yet to come ..) - PolicyEngineFeatureAPI (additional interface methods yet to come ..) Additional extensions will be done in the future. This is to have equivalent functionality with what it is already there. [US867397-policy-management-feature-api] Split original FeatureAPI into three service interfaces. These are: - the original FeatureAPI for core - PolicyControllerFeatureAPI (additional interface methods yet to come ..) - PolicyEngineFeatureAPI (additional interface methods yet to come ..) Additional extensions will be done in the future. This is to have equivalent functionality with what it is already there. [ECOMPD2TD-1167] Avoid redundant dependencies and remove obsolete sql scripts [ECOMPD2TD-848] Fix copied from ATT droolspdp repo -- add timestamp to metric and audit logs [ECOMPD2TD-1167] update jetty version to 9.3.14 [ECOMPD2TD-1167] pull in policy-core jar as a dependency of policy-management, instead of zip file [ECOMPD2TD-1159] Add property to ignore repository audit errors The property is called 'repository.audit.ignore.errors' -- it resides in 'IntegrityMonitor.properties', and it defaults to 'true'. When true, any errors that occur in the repository audit are logged, but not reported to integrity monitor. [US867397] additional hooks for policy engine, and support operation take over by feature bypassing further feature processing [US867397] additional hooks for policy engine, and support operation take over by feature bypassing further feature processing [US867397] fix reverse return javadoc comment [ECOMPD2TD-1192] Select correct persistent session information This is a modification to 'DroolsPdpsElectionHandler.DesignatedWaiter'. When going active, the list of persistent sessions needs to come from the most recent active DroolsPDP. The most recent active DroolsPDP is tracked in a local variable 'mostRecentPrimary', and the associated list of sessions needs to be extracted just prior to going active. The problem was that the list of sessions was extracted after the current DroolsPDP was set to 'mostRecentPrimary'. [ECOMPD2TD-1073 1707] Remove pessimistic locks from DB access to prevent DB deadlock [US860546] Add workaround for missing logger in message router [US860546] add DME2 properties to PolicyProperties [US860546] add DME2 support, pending unit testing [US860546] updated unit tests for dmaap/DME2 [US860546] removed System.out.println lines from BusConsumer and BusPublisher [US860546] modifications and additions to TopicEndpoint tests [US860546] remove block to append /events to serviceName in BusConsumer, BusPublisher [US860546] removing dmaap unit tests with ATT references [ECOMPD2TD-1167] Audit release repository by default [ECOMPD2TD-000] Cherry-pick versioning fixes from 1707.39.1 release branch [ECOMPD2TD-000] Fix policy-endpoints cambriaClient version [US865296] ECOMP Policy Logging Compliance, remove redundant timestamp from metric and audit log for logging compliance [US865296] ECOMP Policy Logging Compliance, remove TargetVirtualEntity from audit log, provide name to un-used column [US865296] ECOMP Policy Logging Compliance, remove Unused from AuditLogPattern, leave the column blank means un-used. [US000000] Cleanup and performance improvements 1) Changed 'OrderedServiceImpl' to ensure that the same service instance is used in every queue. This gets around the 'ServiceLoader' behavior that generates a new instance for each interface the service implements. 2) In 'PolicySession': add adaptive poll times within Drools sessions. Instead of always polling every 5 seconds, poll frequency increases when rules fire, and decreases when they don't. At present, the poll delay ranges from 100 milliseconds to 5 seconds, but at some point, it would be nice to make this configurable. 3) In 'PolicySession': add tests for 'logger.isDebugEnabled()' in session listener methods -- this results in a significant amount of real-time savings under load. [ECOMPD2TD-1126 1707] Changes to the election handler to deal with situations (race conditions) which can affect the site choice [ECOMPD2TD-1126 1707] Clean up of site afinity logic. Minor changes and a fix of the case where all pdpd are designated or all are hot standby. [ECOMPD2TD-1126 1707] Fixed issue with election handler and got all StandbyStateManagmentTest JUnits working. [ECOMPD2TD-1126 1707] Hopefully final changes to DroolsPdpsElectionHandler and StateManagementTest. Also removed the ResiliencyTestCases since they were redundant. [ECOMPD2TD-1126 1707] Found a minor bug in the computeMostRecentPrimary algorithm which I corrected and added a JUnit to confirm. [ECOMPD2TD-1126 1707] Removed code that was commented out of election handler to improve reability. Added an explanatory note to StandbyStateManagementTest. [US869183] Convert integrity monitor test endpoint to use HttpServletServer [US869183] add swagger-maven-plugin, update swagger annotation for IM test interface [US860371] Modified existing Dmaap and Ueb code to allow for https connectivity. HTTP/HTTPS is configurable via controller.properties file [US860520] Removed extra useHttps() method call from BusConsumer class where the consumer should be using http. Also, restored pom.xml to version at time feature branch was created. [US860520] Removed TopicEndpointTest.java. Added the ability to configure use of self-signed certificates for consumer topics. Functionality cannot be added for publisher at this time. Removed useHttps parameter field from multiple .builder methods to allow for greater ability to build source/sink objects without specifying http vs https connectivity. Other code cleanup and comments [US860520] -Deleted sys.out statements used in testing from BusConsumer/BusPublisher -Moved setProps method outside of if/else stub in BusConsumer -Could not add useHttps or selfSignedCerts to toString methods in BusConsumer -Move setProperty(contenttype, app/json) call outside of if/else branch in BusPublisher -Renamed doesAllowSelfSignedCerts method to is isAllowSelfSignedCerts and moved to BusTopicBase -Moved allowSelfSignedCerts member variable to BusTopicBase class. BusTopicBase is ancestor of SingleThreadedDmapp*/SingleThreadedUeb*/SingleThreadedBus* classes therefore, it will be inherited. -This changed resulted in cascading changes to the subclasses of BusTopicbase -Default is now set to disallow self-signed certs -Added several javadoc param annotations [US869183 1707] Changes to satisfy dependencies and correct pom syntax [ECOMPD2TD-1280] move DroolsPDPIntegrityMonitor.RestManager to its own class [ECOMPD2TD-1278] Resolve duplicate dependency issues (cherry-pick from 1707.40.1) [ECOMPD2TD-1278] revert cambriaClient back to 0.0.1 [ECOMPD2TD-1278] put dmaap version back to 0.2.12 [ECOMPD2TD-1280 1707] Fix Commons-lang3 version and common-modules version Conflicts: policy-endpoints/pom.xml policy-healthcheck/pom.xml policy-persistence/pom.xml pom.xml Change-Id: I803554bc64c55d2e82a3d6ad9120757f287144fb Signed-off-by: Ralph Straubs --- .../openecomp/policy/drools/core/FeatureAPI.java | 153 --------------------- .../policy/drools/core/PolicyContainer.java | 32 ++--- .../policy/drools/core/PolicySession.java | 141 ++++++++++++++----- .../drools/core/PolicySessionFeatureAPI.java | 94 +++++++++++++ .../policy/drools/properties/PolicyProperties.java | 17 +++ 5 files changed, 222 insertions(+), 215 deletions(-) delete mode 100644 policy-core/src/main/java/org/openecomp/policy/drools/core/FeatureAPI.java create mode 100644 policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySessionFeatureAPI.java (limited to 'policy-core/src/main/java') diff --git a/policy-core/src/main/java/org/openecomp/policy/drools/core/FeatureAPI.java b/policy-core/src/main/java/org/openecomp/policy/drools/core/FeatureAPI.java deleted file mode 100644 index a14c6547..00000000 --- a/policy-core/src/main/java/org/openecomp/policy/drools/core/FeatureAPI.java +++ /dev/null @@ -1,153 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * policy-core - * ================================================================================ - * Copyright (C) 2017 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.drools.core; - -import java.util.Properties; - -import org.kie.api.runtime.KieSession; - -import org.openecomp.policy.drools.utils.OrderedService; -import org.openecomp.policy.drools.utils.OrderedServiceImpl; - -/** - * This interface provides a way to invoke optional features at various - * points in the code. At appropriate points in the - * application, the code iterates through this list, invoking these optional - * methods. Most of the methods here are notification only -- these tend to - * return a 'void' value. In other cases, such as 'activatePolicySession', - * may - */ -public interface FeatureAPI extends OrderedService -{ - /** - * 'FeatureAPI.impl.getList()' returns an ordered list of objects - * implementing the 'FeatureAPI' interface. - */ - static public OrderedServiceImpl impl = - new OrderedServiceImpl(FeatureAPI.class); - - /** - * This method is called during initialization at a point right after - * 'PolicyContainer' initialization has completed. - * - * @param args standard 'main' arguments, which are currently ignored - * @param configDir the relative directory containing configuration files - */ - public void globalInit(String args[], String configDir); - - /** - * This method is used to create a 'KieSession' as part of a - * 'PolicyContainer'. The caller of this method will iterate over the - * implementers of this interface until one returns a non-null value. - * - * @param policyContainer the 'PolicyContainer' instance containing this - * session - * @param name the name of the KieSession (which is also the name of - * the associated PolicySession) - * @param kieBaseName the name of the 'KieBase' instance containing - * this session - * @return a new KieSession, if one was created, or 'null' if not - * (this depends on the capabilities and state of the object implementing - * this interface) - */ - public KieSession activatePolicySession - (PolicyContainer policyContainer, String name, String kieBaseName); - - /** - * This method is called after 'KieSession.dispose()' is called - * - * @param policySession the 'PolicySession' object that wrapped the - * 'KieSession' - */ - public void disposeKieSession(PolicySession policySession); - - /** - * This method is called after 'KieSession.destroy()' is called - * - * @param policySession the 'PolicySession' object that wrapped the - * 'KieSession' - */ - public void destroyKieSession(PolicySession policySession); - - /** - * called before the Policy Engine is started - */ - public void beforeStartEngine() throws IllegalStateException; - - /** - * called immediately after the Policy Engine is started - */ - public void afterStartEngine(); - - /** - * called before the Policy Engine is shut down - */ - public void beforeShutdownEngine(); - - /** - * called after the Policy Engine is shut down - */ - public void afterShutdownEngine(); - - /** - * called before creating a controller with name 'name' - * - * @param name name of the the controller - * @param properties configuration properties - */ - public void beforeCreateController(String name, Properties properties); - - /** - * NOTE: temporary, should pass the Policy Controller already created - * - * called after creating a controller with name 'name' - * - * @param name name of the the controller - * @param properties configuration properties - */ - public void afterCreateController(String name); - - /** - * NOTE: temporary, should pass the Policy Controller - * - * called before starting a controller with name 'name' - * - * @param name name of the the controller - */ - public void beforeStartController(String name); - - /** - * NOTE: temporary, should pass the Policy Controller - * - * called after starting a controller with name 'name' - * - * @param name name of the the controller - */ - public void afterStartController(String name); - - /** - * NOTE: this method is probably temporary - * - * @return 'true' if persistence is enabled, and 'false' if not, or if - * this feature is not related to persistence. - */ - public boolean isPersistenceEnabled(); -} diff --git a/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicyContainer.java b/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicyContainer.java index ae7cd622..d47ed617 100644 --- a/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicyContainer.java +++ b/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicyContainer.java @@ -22,42 +22,26 @@ package org.openecomp.policy.drools.core; import java.io.IOException; import java.util.Collection; -import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; - -import org.eclipse.persistence.config.PersistenceUnitProperties; import org.kie.api.KieBase; import org.kie.api.KieServices; import org.kie.api.builder.KieScanner; import org.kie.api.builder.Message; import org.kie.api.builder.ReleaseId; import org.kie.api.builder.Results; -import org.kie.api.runtime.Environment; -import org.kie.api.runtime.EnvironmentName; import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.KieSession; -import org.kie.api.runtime.KieSessionConfiguration; - -import bitronix.tm.Configuration; -import bitronix.tm.TransactionManagerServices; -import bitronix.tm.resource.jdbc.PoolingDataSource; - -import org.openecomp.policy.common.ia.IntegrityAudit; -import org.openecomp.policy.common.ia.IntegrityAuditProperties; -import org.openecomp.policy.drools.properties.Startable; -import org.openecomp.policy.common.logging.flexlogger.FlexLogger; -import org.openecomp.policy.common.logging.flexlogger.Logger; import org.openecomp.policy.common.logging.eelf.MessageCodes; import org.openecomp.policy.common.logging.eelf.PolicyLogger; +import org.openecomp.policy.common.logging.flexlogger.FlexLogger; +import org.openecomp.policy.common.logging.flexlogger.Logger; import org.openecomp.policy.common.logging.flexlogger.PropertyUtil; +import org.openecomp.policy.drools.properties.Startable; /** * This class is a wrapper around 'KieContainer', which adds the ability @@ -296,7 +280,7 @@ public class PolicyContainer implements Startable // loop through all of the features, and give each one // a chance to create the 'KieSession' - for (FeatureAPI feature : FeatureAPI.impl.getList()) + for (PolicySessionFeatureAPI feature : PolicySessionFeatureAPI.impl.getList()) { if ((kieSession = feature.activatePolicySession (this, name, kieBaseName)) != null) @@ -453,7 +437,7 @@ public class PolicyContainer implements Startable // KLUDGE WARNING: this is a temporary workaround -- if there are // no features, we don't have persistence, and 'activate' is never // called. In this case, make sure the container is started. - if (FeatureAPI.impl.getList().size() == 0) + if (PolicySessionFeatureAPI.impl.getList().size() == 0) { start(); } @@ -606,7 +590,7 @@ public class PolicyContainer implements Startable session.getKieSession().dispose(); // notify features - for (FeatureAPI feature : FeatureAPI.impl.getList()) + for (PolicySessionFeatureAPI feature : PolicySessionFeatureAPI.impl.getList()) { feature.disposeKieSession(session); } @@ -673,7 +657,7 @@ public class PolicyContainer implements Startable session.getKieSession().destroy(); // notify features - for (FeatureAPI feature : FeatureAPI.impl.getList()) + for (PolicySessionFeatureAPI feature : PolicySessionFeatureAPI.impl.getList()) { feature.destroyKieSession(session); } @@ -766,7 +750,7 @@ public class PolicyContainer implements Startable logger.info("initlogger returned"); // invoke 'globalInit' on all of the features - for (FeatureAPI feature : FeatureAPI.impl.getList()) + for (PolicySessionFeatureAPI feature : PolicySessionFeatureAPI.impl.getList()) { feature.globalInit(args, configDir); } diff --git a/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySession.java b/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySession.java index 89341d6b..2149735a 100644 --- a/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySession.java +++ b/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySession.java @@ -20,12 +20,6 @@ package org.openecomp.policy.drools.core; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.Properties; - -import org.kie.api.runtime.KieSession; import org.kie.api.event.rule.AfterMatchFiredEvent; import org.kie.api.event.rule.AgendaEventListener; import org.kie.api.event.rule.AgendaGroupPoppedEvent; @@ -36,14 +30,14 @@ import org.kie.api.event.rule.MatchCreatedEvent; import org.kie.api.event.rule.ObjectDeletedEvent; import org.kie.api.event.rule.ObjectInsertedEvent; import org.kie.api.event.rule.ObjectUpdatedEvent; -import org.kie.api.event.rule.RuleRuntimeEventListener; import org.kie.api.event.rule.RuleFlowGroupActivatedEvent; import org.kie.api.event.rule.RuleFlowGroupDeactivatedEvent; - -import org.openecomp.policy.drools.core.jmx.PdpJmx; +import org.kie.api.event.rule.RuleRuntimeEventListener; +import org.kie.api.runtime.KieSession; +import org.openecomp.policy.common.logging.eelf.MessageCodes; import org.openecomp.policy.common.logging.flexlogger.FlexLogger; import org.openecomp.policy.common.logging.flexlogger.Logger; -import org.openecomp.policy.common.logging.eelf.MessageCodes; +import org.openecomp.policy.drools.core.jmx.PdpJmx; /** * This class is a wrapper around 'KieSession', which adds the following: @@ -145,6 +139,9 @@ public class PolicySession // We want to continue, despite any exceptions that occur // while rules are fired. boolean repeat = true; + long minSleepTime = 100; + long maxSleepTime = 5000; + long sleepTime = maxSleepTime; while (repeat) { if(this.isInterrupted()){ @@ -152,15 +149,37 @@ public class PolicySession } try { - kieSession.fireAllRules(); - + if (kieSession.fireAllRules() > 0) + { + // some rules fired -- reduce poll delay + if (sleepTime > minSleepTime) + { + sleepTime /= 2; + if (sleepTime < minSleepTime) + { + sleepTime = minSleepTime; + } + } + } + else + { + // no rules fired -- increase poll delay + if (sleepTime < maxSleepTime) + { + sleepTime *= 2; + if (sleepTime > maxSleepTime) + { + sleepTime = maxSleepTime; + } + } + } } catch (Throwable e) { logger.error(MessageCodes.EXCEPTION_ERROR, e, "startThread", "kieSession.fireUntilHalt"); } try { - Thread.sleep(5000); + Thread.sleep(sleepTime); } catch (InterruptedException e) { break; } @@ -215,8 +234,11 @@ public class PolicySession @Override public void afterMatchFired(AfterMatchFiredEvent event) { - logger.debug("afterMatchFired: " + getFullName() - + ": AgendaEventListener.afterMatchFired(" + event + ")"); + if (logger.isDebugEnabled()) + { + logger.debug("afterMatchFired: " + getFullName() + + ": AgendaEventListener.afterMatchFired(" + event + ")"); + } PdpJmx.getInstance().ruleFired(); } @@ -226,8 +248,12 @@ public class PolicySession @Override public void afterRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event) { + if (logger.isDebugEnabled()) + { logger.debug("afterRuleFlowGroupActivated: " + getFullName() - + ": AgendaEventListener.afterRuleFlowGroupActivated(" + event + ")"); + + ": AgendaEventListener.afterRuleFlowGroupActivated(" + + event + ")"); + } } /** @@ -237,8 +263,12 @@ public class PolicySession public void afterRuleFlowGroupDeactivated (RuleFlowGroupDeactivatedEvent event) { - logger.debug("afterRuleFlowGroupDeactivated: " + getFullName() - + ": AgendaEventListener.afterRuleFlowGroupDeactivated(" + event + ")"); + if (logger.isDebugEnabled()) + { + logger.debug("afterRuleFlowGroupDeactivated: " + getFullName() + + ": AgendaEventListener.afterRuleFlowGroupDeactivated(" + + event + ")"); + } } /** @@ -247,8 +277,12 @@ public class PolicySession @Override public void agendaGroupPopped(AgendaGroupPoppedEvent event) { - logger.debug("agendaGroupPopped: " + getFullName() - + ": AgendaEventListener.agendaGroupPopped(" + event + ")"); + if (logger.isDebugEnabled()) + { + logger.debug("agendaGroupPopped: " + getFullName() + + ": AgendaEventListener.agendaGroupPopped(" + + event + ")"); + } } /** @@ -257,8 +291,12 @@ public class PolicySession @Override public void agendaGroupPushed(AgendaGroupPushedEvent event) { - logger.debug("agendaGroupPushed: " + getFullName() - + ": AgendaEventListener.agendaGroupPushed(" + event + ")"); + if (logger.isDebugEnabled()) + { + logger.debug("agendaGroupPushed: " + getFullName() + + ": AgendaEventListener.agendaGroupPushed(" + + event + ")"); + } } /** @@ -267,8 +305,12 @@ public class PolicySession @Override public void beforeMatchFired(BeforeMatchFiredEvent event) { - logger.debug("beforeMatchFired: " + getFullName() - + ": AgendaEventListener.beforeMatchFired(" + event + ")"); + if (logger.isDebugEnabled()) + { + logger.debug("beforeMatchFired: " + getFullName() + + ": AgendaEventListener.beforeMatchFired(" + + event + ")"); + } } /** @@ -278,8 +320,12 @@ public class PolicySession public void beforeRuleFlowGroupActivated (RuleFlowGroupActivatedEvent event) { - logger.debug("beforeRuleFlowGroupActivated: " + getFullName() - + ": AgendaEventListener.beforeRuleFlowGroupActivated(" + event + ")"); + if (logger.isDebugEnabled()) + { + logger.debug("beforeRuleFlowGroupActivated: " + getFullName() + + ": AgendaEventListener.beforeRuleFlowGroupActivated(" + + event + ")"); + } } /** @@ -289,8 +335,12 @@ public class PolicySession public void beforeRuleFlowGroupDeactivated (RuleFlowGroupDeactivatedEvent event) { - logger.debug("beforeRuleFlowGroupDeactivated: " + getFullName() - + ": AgendaEventListener.beforeRuleFlowGroupDeactivated(" + event + ")"); + if (logger.isDebugEnabled()) + { + logger.debug("beforeRuleFlowGroupDeactivated: " + getFullName() + + ": AgendaEventListener.beforeRuleFlowGroupDeactivated(" + + event + ")"); + } } /** @@ -299,8 +349,11 @@ public class PolicySession @Override public void matchCancelled(MatchCancelledEvent event) { - logger.debug("matchCancelled: " + getFullName() - + ": AgendaEventListener.matchCancelled(" + event + ")"); + if (logger.isDebugEnabled()) + { + logger.debug("matchCancelled: " + getFullName() + + ": AgendaEventListener.matchCancelled(" + event + ")"); + } } /** @@ -309,8 +362,11 @@ public class PolicySession @Override public void matchCreated(MatchCreatedEvent event) { - logger.debug("matchCreated: " + getFullName() - + ": AgendaEventListener.matchCreated(" + event + ")"); + if (logger.isDebugEnabled()) + { + logger.debug("matchCreated: " + getFullName() + + ": AgendaEventListener.matchCreated(" + event + ")"); + } } /****************************************/ @@ -323,8 +379,11 @@ public class PolicySession @Override public void objectDeleted(ObjectDeletedEvent event) { - logger.debug("objectDeleted: " + getFullName() - + ": AgendaEventListener.objectDeleted(" + event + ")"); + if (logger.isDebugEnabled()) + { + logger.debug("objectDeleted: " + getFullName() + + ": AgendaEventListener.objectDeleted(" + event + ")"); + } } /** @@ -333,8 +392,11 @@ public class PolicySession @Override public void objectInserted(ObjectInsertedEvent event) { - logger.debug("objectInserted: " + getFullName() - + ": AgendaEventListener.objectInserted(" + event + ")"); + if (logger.isDebugEnabled()) + { + logger.debug("objectInserted: " + getFullName() + + ": AgendaEventListener.objectInserted(" + event + ")"); + } } /** @@ -343,7 +405,10 @@ public class PolicySession @Override public void objectUpdated(ObjectUpdatedEvent event) { - logger.debug("objectUpdated: " + getFullName() - + ": AgendaEventListener.objectUpdated(" + event + ")"); + if (logger.isDebugEnabled()) + { + logger.debug("objectUpdated: " + getFullName() + + ": AgendaEventListener.objectUpdated(" + event + ")"); + } } } diff --git a/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySessionFeatureAPI.java b/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySessionFeatureAPI.java new file mode 100644 index 00000000..d5057696 --- /dev/null +++ b/policy-core/src/main/java/org/openecomp/policy/drools/core/PolicySessionFeatureAPI.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * policy-core + * ================================================================================ + * Copyright (C) 2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.drools.core; + +import org.kie.api.runtime.KieSession; +import org.openecomp.policy.drools.utils.OrderedService; +import org.openecomp.policy.drools.utils.OrderedServiceImpl; + +/** + * This interface provides a way to invoke optional features at various + * points in the code. At appropriate points in the + * application, the code iterates through this list, invoking these optional + * methods. Most of the methods here are notification only -- these tend to + * return a 'void' value. In other cases, such as 'activatePolicySession', + * may + */ +public interface PolicySessionFeatureAPI extends OrderedService +{ + /** + * 'FeatureAPI.impl.getList()' returns an ordered list of objects + * implementing the 'FeatureAPI' interface. + */ + static public OrderedServiceImpl impl = + new OrderedServiceImpl(PolicySessionFeatureAPI.class); + + /** + * This method is called during initialization at a point right after + * 'PolicyContainer' initialization has completed. + * + * @param args standard 'main' arguments, which are currently ignored + * @param configDir the relative directory containing configuration files + */ + public void globalInit(String args[], String configDir); + + /** + * This method is used to create a 'KieSession' as part of a + * 'PolicyContainer'. The caller of this method will iterate over the + * implementers of this interface until one returns a non-null value. + * + * @param policyContainer the 'PolicyContainer' instance containing this + * session + * @param name the name of the KieSession (which is also the name of + * the associated PolicySession) + * @param kieBaseName the name of the 'KieBase' instance containing + * this session + * @return a new KieSession, if one was created, or 'null' if not + * (this depends on the capabilities and state of the object implementing + * this interface) + */ + public KieSession activatePolicySession + (PolicyContainer policyContainer, String name, String kieBaseName); + + /** + * This method is called after 'KieSession.dispose()' is called + * + * @param policySession the 'PolicySession' object that wrapped the + * 'KieSession' + */ + public void disposeKieSession(PolicySession policySession); + + /** + * This method is called after 'KieSession.destroy()' is called + * + * @param policySession the 'PolicySession' object that wrapped the + * 'KieSession' + */ + public void destroyKieSession(PolicySession policySession); + + /** + * NOTE: this method is probably temporary + * + * @return 'true' if persistence is enabled, and 'false' if not, or if + * this feature is not related to persistence. + */ + public boolean isPersistenceEnabled(); +} diff --git a/policy-core/src/main/java/org/openecomp/policy/drools/properties/PolicyProperties.java b/policy-core/src/main/java/org/openecomp/policy/drools/properties/PolicyProperties.java index 13580219..1274e08c 100644 --- a/policy-core/src/main/java/org/openecomp/policy/drools/properties/PolicyProperties.java +++ b/policy-core/src/main/java/org/openecomp/policy/drools/properties/PolicyProperties.java @@ -46,6 +46,8 @@ public interface PolicyProperties { public static final String PROPERTY_TOPIC_SINK_PARTITION_KEY_SUFFIX =".partitionKey"; + public static final String PROPERTY_ALLOW_SELF_SIGNED_CERTIFICATES_SUFFIX = ".selfSignedCertificates"; + /* UEB Properties */ public static final String PROPERTY_UEB_SOURCE_TOPICS = "ueb.source.topics"; @@ -56,6 +58,21 @@ public interface PolicyProperties { public static final String PROPERTY_DMAAP_SOURCE_TOPICS = "dmaap.source.topics"; public static final String PROPERTY_DMAAP_SINK_TOPICS = "dmaap.sink.topics"; + public static final String PROPERTY_DMAAP_DME2_PARTNER_SUFFIX = ".dme2.partner"; + public static final String PROPERTY_DMAAP_DME2_ROUTE_OFFER_SUFFIX = ".dme2.routeOffer"; + public static final String PROPERTY_DMAAP_DME2_ENVIRONMENT_SUFFIX = ".dme2.environment"; + public static final String PROPERTY_DMAAP_DME2_AFT_ENVIRONMENT_SUFFIX = ".dme2.aft.environment"; + public static final String PROPERTY_DMAAP_DME2_LATITUDE_SUFFIX = ".dme2.latitude"; + public static final String PROPERTY_DMAAP_DME2_LONGITUDE_SUFFIX = ".dme2.longitude"; + + public static final String PROPERTY_DMAAP_DME2_EP_READ_TIMEOUT_MS_SUFFIX = ".dme2.epReadTimeoutMs"; + public static final String PROPERTY_DMAAP_DME2_EP_CONN_TIMEOUT_SUFFIX = ".dme2.epConnTimeout"; + public static final String PROPERTY_DMAAP_DME2_ROUNDTRIP_TIMEOUT_MS_SUFFIX = ".dme2.roundtripTimeoutMs"; + public static final String PROPERTY_DMAAP_DME2_VERSION_SUFFIX = ".dme2.version"; + public static final String PROPERTY_DMAAP_DME2_SERVICE_NAME_SUFFIX = ".dme2.serviceName"; + public static final String PROPERTY_DMAAP_DME2_SUB_CONTEXT_PATH_SUFFIX = ".dme2.subContextPath"; + public static final String PROPERTY_DMAAP_DME2_SESSION_STICKINESS_REQUIRED_SUFFIX = ".dme2.sessionStickinessRequired"; + /* HTTP Server Properties */ public static final String PROPERTY_HTTP_SERVER_SERVICES = "http.server.services"; -- cgit 1.2.3-korg