diff options
Diffstat (limited to 'policy-management/src/main')
-rw-r--r-- | policy-management/src/main/java/org/onap/policy/drools/system/Main.java | 17 | ||||
-rw-r--r-- | policy-management/src/main/java/org/onap/policy/drools/system/PolicyDroolsPdpRuntimeException.java | 45 |
2 files changed, 60 insertions, 2 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/Main.java b/policy-management/src/main/java/org/onap/policy/drools/system/Main.java index c53cbe9b..4f0dc39c 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/Main.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/Main.java @@ -26,6 +26,7 @@ import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.http.client.HttpClientConfigException; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; +import org.onap.policy.common.utils.resources.MessageConstants; import org.onap.policy.common.utils.security.CryptoUtils; import org.onap.policy.drools.persistence.SystemPersistenceConstants; import org.onap.policy.drools.properties.DroolsPropertyConstants; @@ -102,7 +103,10 @@ public class Main { /* 4. Create and start the controllers */ createAndStartControllers(logger, trans); + /* 5. Open the engine for dynamic configuration */ PolicyEngineConstants.getManager().open(); + + logger.info(String.format(MessageConstants.START_SUCCESS_MSG, MessageConstants.POLICY_DROOLS_PDP)); } private static void setSystemProperties() { @@ -140,6 +144,8 @@ public class Main { LoggerUtil.TRANSACTION_LOG_MARKER, "Main: {} has been partially started", PolicyEngineConstants.getManager()); + throw new PolicyDroolsPdpRuntimeException( + String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_DROOLS_PDP)); } else { trans.setStatusCode(true).transaction(); } @@ -155,6 +161,8 @@ public class Main { PolicyEngineConstants.getManager(), e.getMessage(), e); + throw new PolicyDroolsPdpRuntimeException( + String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_DROOLS_PDP), e); } catch (final Exception e) { trans .setStatusCode(false) @@ -167,7 +175,8 @@ public class Main { PolicyEngineConstants.getManager(), e.getMessage(), e); - System.exit(1); + throw new PolicyDroolsPdpRuntimeException( + String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_DROOLS_PDP), e); } return trans; } @@ -204,6 +213,8 @@ public class Main { controllerName, e.getMessage(), e); + throw new PolicyDroolsPdpRuntimeException( + String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_DROOLS_PDP), e); } catch (final LinkageError e) { trans .setStatusCode(false) @@ -216,7 +227,9 @@ public class Main { controllerName, e.getMessage(), e); + throw new PolicyDroolsPdpRuntimeException( + String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_DROOLS_PDP), e); } } } -} +}
\ No newline at end of file diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyDroolsPdpRuntimeException.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyDroolsPdpRuntimeException.java new file mode 100644 index 00000000..719a2b80 --- /dev/null +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyDroolsPdpRuntimeException.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.system; + +public class PolicyDroolsPdpRuntimeException extends RuntimeException { + private static final long serialVersionUID = -1417471704362517416L; + + /** + * Instantiates a new policy drools pdp runtime exception with a message. + * + * @param message the message + */ + public PolicyDroolsPdpRuntimeException(final String message) { + super(message); + } + + /** + * Instantiates a new policy drools pdp runtime exception with a message and a caused by exception. + * + * @param message the message + * @param exp the exception that caused this exception to be thrown + */ + public PolicyDroolsPdpRuntimeException(final String message, final Throwable exp) { + super(message, exp); + } + +}
\ No newline at end of file |