summaryrefslogtreecommitdiffstats
path: root/integrity-monitor/src/main/java/org
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-02-16 18:11:21 -0500
committerJim Hahn <jrh3@att.com>2018-02-16 18:29:40 -0500
commit45f97b0b7735c9ac75c3f0d010b9524b47807cb8 (patch)
tree2fc61fb13e587c9f5af1a9e3b02ca512504d3631 /integrity-monitor/src/main/java/org
parent2b0b96e27b11904bb36d8f4887aa28a913727fad (diff)
Fix more generic exceptions in common
Fixed a few more generic exceptions in integrity-audit and integrity-monitor. Fixed license dates. Change-Id: Ibbc21ae5f853896e0d3e416e33b5ea2a13672f62 Issue-ID: POLICY-246 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'integrity-monitor/src/main/java/org')
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/AdministrativeStateException.java4
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/AllSeemsWellException.java4
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/ForwardProgressException.java4
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java53
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorException.java8
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorPropertiesException.java4
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StandbyStatusException.java4
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java26
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagementException.java4
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java6
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransitionException.java4
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java9
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminException.java4
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminMBean.java16
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java61
15 files changed, 117 insertions, 94 deletions
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/AdministrativeStateException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/AdministrativeStateException.java
index 31be3cea..600d8601 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/AdministrativeStateException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/AdministrativeStateException.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -20,7 +20,7 @@
package org.onap.policy.common.im;
-public class AdministrativeStateException extends Exception{
+public class AdministrativeStateException extends IntegrityMonitorException {
private static final long serialVersionUID = 1L;
public AdministrativeStateException() {
super();
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/AllSeemsWellException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/AllSeemsWellException.java
index 5878e1d1..588a4d61 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/AllSeemsWellException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/AllSeemsWellException.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -20,7 +20,7 @@
package org.onap.policy.common.im;
-public class AllSeemsWellException extends Exception {
+public class AllSeemsWellException extends IntegrityMonitorException {
/**
*
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/ForwardProgressException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/ForwardProgressException.java
index fd545cda..5825c3a0 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/ForwardProgressException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/ForwardProgressException.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -20,7 +20,7 @@
package org.onap.policy.common.im;
-public class ForwardProgressException extends Exception{
+public class ForwardProgressException extends IntegrityMonitorException {
private static final long serialVersionUID = 1L;
public ForwardProgressException() {
super();
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
index d272d1c6..880d39f5 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
@@ -197,10 +197,10 @@ public class IntegrityMonitor {
* The resource name of the resource
* @param properties
* a set of properties passed in from the resource
- * @throws Exception
+ * @throws IntegrityMonitorException
* if any errors are encountered in the constructor
*/
- protected IntegrityMonitor(String resourceName, Properties properties) throws Exception {
+ protected IntegrityMonitor(String resourceName, Properties properties) throws IntegrityMonitorException {
this(resourceName, properties, null);
}
@@ -218,11 +218,11 @@ public class IntegrityMonitor {
* a set of properties passed in from the resource
* @param queue
* queue to use to control the FPManager thread, or {@code null}
- * @throws Exception
+ * @throws IntegrityMonitorException
* if any errors are encountered in the constructor
*/
protected IntegrityMonitor(String resourceName, Properties properties, BlockingQueue<CountDownLatch> queue)
- throws Exception {
+ throws IntegrityMonitorException {
// singleton check since this constructor can be called from a child or
// sub-class
@@ -344,18 +344,23 @@ public class IntegrityMonitor {
throw e;
}
- // create instance of StateMangement class and pass emf to it
- stateManager = new StateManagement(emf, resourceName);
-
- /**
- * Initialize the state and status attributes. This will maintain any
- * Administrative state value but will set the operational state =
- * enabled, availability status = null, standby status = null. The
- * integrity monitor will set the operational state via the FPManager
- * and the owning application must set the standby status by calling
- * promote/demote on the StateManager.
- */
- stateManager.initializeState();
+ try {
+ // create instance of StateMangement class and pass emf to it
+ stateManager = new StateManagement(emf, resourceName);
+
+ /**
+ * Initialize the state and status attributes. This will maintain any
+ * Administrative state value but will set the operational state =
+ * enabled, availability status = null, standby status = null. The
+ * integrity monitor will set the operational state via the FPManager
+ * and the owning application must set the standby status by calling
+ * promote/demote on the StateManager.
+ */
+ stateManager.initializeState();
+
+ } catch(StateManagementException e) {
+ throw new IntegrityMonitorException(e);
+ }
// create management bean
try {
@@ -378,11 +383,11 @@ public class IntegrityMonitor {
* @param properties
* a set of properties passed in from the resource
* @return The new instance of IntegrityMonitor
- * @throws Exception
+ * @throws IntegrityMonitorException
* if unable to create jmx url or the constructor returns an
* exception
*/
- public static IntegrityMonitor getInstance(String resourceName, Properties properties) throws Exception {
+ public static IntegrityMonitor getInstance(String resourceName, Properties properties) throws IntegrityMonitorException {
return getInstance(resourceName, properties, null);
}
@@ -398,12 +403,12 @@ public class IntegrityMonitor {
* @param queue
* queue to use to control the FPManager thread, or {@code null}
* @return The new instance of IntegrityMonitor
- * @throws Exception
+ * @throws IntegrityMonitorException
* if unable to create jmx url or the constructor returns an
* exception
*/
protected static IntegrityMonitor getInstance(String resourceName, Properties properties,
- BlockingQueue<CountDownLatch> queue) throws Exception {
+ BlockingQueue<CountDownLatch> queue) throws IntegrityMonitorException {
synchronized (getInstanceLock) {
logger.debug("getInstance() called - resourceName= {}", resourceName);
@@ -420,7 +425,7 @@ public class IntegrityMonitor {
}
}
- public static IntegrityMonitor getInstance() throws Exception {
+ public static IntegrityMonitor getInstance() throws IntegrityMonitorException {
logger.debug("getInstance() called");
if (instance == null) {
String msg = "No IntegrityMonitor instance exists."
@@ -524,7 +529,7 @@ public class IntegrityMonitor {
* disabled, it will include the dependencyCheckErrorMsg which includes
* information about any dependency (node) which has failed.
*/
- public void evaluateSanity() throws Exception {
+ public void evaluateSanity() throws IntegrityMonitorException {
logger.debug("evaluateSanity called ....");
synchronized (evaluateSanityLock) {
@@ -1099,7 +1104,7 @@ public class IntegrityMonitor {
* throws admin state exception if resource is locked
* @throws StandbyStatusException
*/
- public void startTransaction() throws AdministrativeStateException, StandbyStatusException {
+ public void startTransaction() throws IntegrityMonitorException {
synchronized (startTransactionLock) {
// check admin state and throw exception if locked
@@ -1225,7 +1230,7 @@ public class IntegrityMonitor {
/**
* Read and validate properties
*
- * @throws Exception
+ * @throws IntegrityMonitorPropertiesException
*/
private static void validateProperties(Properties prop) throws IntegrityMonitorPropertiesException {
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorException.java
index 072af236..f01be279 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorException.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -36,4 +36,10 @@ public class IntegrityMonitorException extends Exception{
super(message, cause);
}
+ public IntegrityMonitorException(String message, Throwable cause,
+ boolean enableSuppression, boolean writableStackTrace)
+ {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorPropertiesException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorPropertiesException.java
index 24a3aeb2..0d73e8b4 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorPropertiesException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorPropertiesException.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -20,7 +20,7 @@
package org.onap.policy.common.im;
-public class IntegrityMonitorPropertiesException extends Exception{
+public class IntegrityMonitorPropertiesException extends IntegrityMonitorException {
private static final long serialVersionUID = 1L;
public IntegrityMonitorPropertiesException() {
super();
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StandbyStatusException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StandbyStatusException.java
index b871c9f5..3d27a4c6 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StandbyStatusException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StandbyStatusException.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -20,7 +20,7 @@
package org.onap.policy.common.im;
-public class StandbyStatusException extends Exception {
+public class StandbyStatusException extends IntegrityMonitorException {
/**
*
*/
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java
index ccc12d48..1d899dee 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -96,7 +96,7 @@ public class StateManagement extends Observable {
* StateManagement constructor
* @param entityManagerFactory
* @param resourceName
- * @throws Exception
+ * @throws StateManagementException
*/
public StateManagement(EntityManagerFactory entityManagerFactory, String resourceName) throws StateManagementException
{
@@ -191,7 +191,7 @@ public class StateManagement extends Observable {
/**
* lock() changes the administrative state to locked.
- * @throws Exception
+ * @throws StateManagementException
*/
public void lock() throws StateManagementException
{
@@ -237,7 +237,7 @@ public class StateManagement extends Observable {
/**
* unlock() changes the administrative state to unlocked.
- * @throws Exception
+ * @throws StateManagementException
*/
public void unlock() throws StateManagementException
{
@@ -283,7 +283,7 @@ public class StateManagement extends Observable {
/**
* enableNotFailed() removes the "failed" availability status and changes the operational
* state to enabled if no dependency is also failed.
- * @throws Exception
+ * @throws StateManagementException
*/
public void enableNotFailed() throws StateManagementException
{
@@ -329,7 +329,7 @@ public class StateManagement extends Observable {
/**
* disableFailed() changes the operational state to disabled and adds availability status of "failed"
- * @throws Exception
+ * @throws StateManagementException
*/
public void disableFailed() throws StateManagementException
{
@@ -374,7 +374,7 @@ public class StateManagement extends Observable {
/**
* This version of disableFailed is to be used to manipulate the state of a remote resource in the event
* that remote resource has failed but its state is still showing that it is viable.
- * @throws Exception
+ * @throws StateManagementException
*/
public void disableFailed(String otherResourceName) throws StateManagementException
{
@@ -426,7 +426,7 @@ public class StateManagement extends Observable {
/**
* disableDependency() changes operational state to disabled and adds availability status of "dependency"
- * @throws Exception
+ * @throws StateManagementException
*/
public void disableDependency() throws StateManagementException
{
@@ -472,7 +472,7 @@ public class StateManagement extends Observable {
/**
* enableNoDependency() removes the availability status of "dependency " and will change the
* operational state to enabled if not otherwise failed.
- * @throws Exception
+ * @throws StateManagementException
*/
public void enableNoDependency() throws StateManagementException
{
@@ -518,9 +518,9 @@ public class StateManagement extends Observable {
/**
* promote() changes the standby status to providingservice if not otherwise failed.
* @throws StandbyStatusException
- * @throws Exception
+ * @throws StateManagementException
*/
- public void promote() throws StandbyStatusException, StateManagementException
+ public void promote() throws IntegrityMonitorException
{
synchronized (SYNCLOCK){
if(logger.isDebugEnabled()){
@@ -570,7 +570,7 @@ public class StateManagement extends Observable {
/**
* demote() changes standbystatus to hotstandby or, if failed, coldstandby
- * @throws Exception
+ * @throws StateManagementException
*/
public void demote() throws StateManagementException
{
@@ -620,7 +620,7 @@ public class StateManagement extends Observable {
* this is observed by PDP-D DroolsPdpsElectionHandler when it is trying to determine which PDP-D should
* be designated as the lead.
* @param otherResourceName
- * @throws Exception
+ * @throws StateManagementException
*/
public void demote(String otherResourceName) throws StateManagementException
{
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagementException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagementException.java
index 7591c1a8..0a375b07 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagementException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagementException.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -20,7 +20,7 @@
package org.onap.policy.common.im;
-public class StateManagementException extends Exception{
+public class StateManagementException extends IntegrityMonitorException {
private static final long serialVersionUID = 1L;
public StateManagementException() {
super();
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
index a7f2d0ed..99c092d0 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -44,7 +44,7 @@ public class StateTransition {
/**
* StateTransition constructor
- * @throws Exception
+ * @throws StateTransitionException
*/
public StateTransition() throws StateTransitionException
{
@@ -72,7 +72,7 @@ public class StateTransition {
* @param standbyStatus
* @param actionName
* @return
- * @throws Exception
+ * @throws StateTransitionException
*/
public StateElement getEndingState(String adminState, String opState, String availStatus,
String standbyStatus, String actionName) throws StateTransitionException
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransitionException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransitionException.java
index 3945ddcc..74998427 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransitionException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransitionException.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -20,7 +20,7 @@
package org.onap.policy.common.im;
-public class StateTransitionException extends Exception{
+public class StateTransitionException extends IntegrityMonitorException {
private static final long serialVersionUID = 1L;
public StateTransitionException() {
super();
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java
index a18b1434..eb1d9f8b 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -36,6 +36,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.onap.policy.common.im.IntegrityMonitor;
+import org.onap.policy.common.im.IntegrityMonitorException;
import org.onap.policy.common.im.StateManagement;
/**
@@ -187,7 +188,7 @@ public class ComponentAdmin implements ComponentAdminMBean {
}
@Override
- public void test() throws Exception {
+ public void test() throws IntegrityMonitorException {
// Call evaluateSanity on IntegrityMonitor to run the test
logger.debug("test() called...");
if (integrityMonitor != null) {
@@ -201,7 +202,7 @@ public class ComponentAdmin implements ComponentAdminMBean {
}
@Override
- public void lock() throws Exception {
+ public void lock() throws IntegrityMonitorException {
logger.debug("lock() called...");
if (stateManager != null) {
stateManager.lock();
@@ -213,7 +214,7 @@ public class ComponentAdmin implements ComponentAdminMBean {
}
@Override
- public void unlock() throws Exception {
+ public void unlock() throws IntegrityMonitorException {
logger.debug("unlock() called...");
if (stateManager != null) {
stateManager.unlock();
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminException.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminException.java
index e98288eb..5ada6da0 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminException.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminException.java
@@ -20,7 +20,9 @@
package org.onap.policy.common.im.jmx;
-public class ComponentAdminException extends Exception {
+import org.onap.policy.common.im.IntegrityMonitorException;
+
+public class ComponentAdminException extends IntegrityMonitorException {
private static final long serialVersionUID = 1L;
public ComponentAdminException() {
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminMBean.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminMBean.java
index d61add59..2c011935 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminMBean.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdminMBean.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -20,6 +20,8 @@
package org.onap.policy.common.im.jmx;
+import org.onap.policy.common.im.IntegrityMonitorException;
+
/**
* Provides operations to test health, lock and unlock components.
*/
@@ -27,24 +29,24 @@ public interface ComponentAdminMBean {
/**
* Test health of component.
*
- * @throws Exception
+ * @throws IntegrityMonitorException
* if the component fails the health check
*/
- void test() throws Exception;
+ void test() throws IntegrityMonitorException;
/**
* Administratively lock component.
*
- * @throws Exception
+ * @throws IntegrityMonitorException
* if the component lock fails
*/
- void lock() throws Exception;
+ void lock() throws IntegrityMonitorException;
/**
* Administratively unlock component.
*
- * @throws Exception
+ * @throws IntegrityMonitorException
* if the component unlock fails
*/
- void unlock() throws Exception;
+ void unlock() throws IntegrityMonitorException;
}
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java
index d15fc5e7..c9a2ce80 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/JmxAgentConnection.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * 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.
@@ -35,6 +35,7 @@ import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
+import org.onap.policy.common.im.IntegrityMonitorException;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
@@ -86,35 +87,41 @@ public final class JmxAgentConnection {
/**
* Get a connection to the jmxAgent MBeanServer.
* @return the connection
- * @throws Exception on error
+ * @throws IntegrityMonitorException on error
*/
- public MBeanServerConnection getMBeanConnection() throws Exception {
- JMXServiceURL url;
- if (jmxUrl == null) {
- url = new JMXServiceURL(jmxAgentUrl(host, port));
- }
- else {
- url = new JMXServiceURL(jmxUrl);
- }
- Map<String, Object> env = new HashMap<>();
-
- connector = JMXConnectorFactory.newJMXConnector(url, env);
- connector.connect();
- connector.addConnectionNotificationListener(
- new NotificationListener() {
+ public MBeanServerConnection getMBeanConnection() throws IntegrityMonitorException {
- @Override
- public void handleNotification(
- Notification notification, Object handback) {
- if (notification.getType().equals(
- JMXConnectionNotification.FAILED)) {
- // handle disconnect
- disconnect();
- }
- }
- }, null, null);
+ try {
+ JMXServiceURL url;
+ if (jmxUrl == null) {
+ url = new JMXServiceURL(jmxAgentUrl(host, port));
+ }
+ else {
+ url = new JMXServiceURL(jmxUrl);
+ }
+ Map<String, Object> env = new HashMap<>();
+
+ connector = JMXConnectorFactory.newJMXConnector(url, env);
+ connector.connect();
+ connector.addConnectionNotificationListener(
+ new NotificationListener() {
- return connector.getMBeanServerConnection();
+ @Override
+ public void handleNotification(
+ Notification notification, Object handback) {
+ if (notification.getType().equals(
+ JMXConnectionNotification.FAILED)) {
+ // handle disconnect
+ disconnect();
+ }
+ }
+ }, null, null);
+
+ return connector.getMBeanServerConnection();
+
+ } catch (IOException e) {
+ throw new IntegrityMonitorException(e);
+ }
}
/**