diff options
Diffstat (limited to 'integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java')
-rw-r--r-- | integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java index a678319f..eee3a9ef 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * Integrity Monitor * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 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. @@ -20,22 +20,19 @@ package org.onap.policy.common.im; -import java.util.Observable; -import java.util.Observer; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/* +/* * This is implementing the Observer interface to make it specific for * state management. - * - * It saves the StateManagement object and a String message that is - * passed in when notifyObservers is called by the Observable - * host class. - * - * It provides an abstract method for handling the state change - * so this class must be overwritten and made concrete for the - * Observer who is monitoring the state changes. + * + * It saves the StateManagement object and a String message that is + * passed in when notifyObservers is called by the Observable + * host class. + * + * It provides an abstract method for handling the state change + * so this class must be overwritten and made concrete for the + * Observer who is monitoring the state changes. */ @@ -46,19 +43,23 @@ import org.slf4j.LoggerFactory; * StateManagement class. * */ -public class StateChangeNotifier implements Observer { +public class StateChangeNotifier { private static final Logger logger = LoggerFactory.getLogger(StateChangeNotifier.class); // The observable class StateManagement stateManagement; // A string argument passed by the observable class when - // Observable:notifyObservers(Object arg) is called + // StateManagement:notifyObservers(String changed) is called String message; - @Override - public void update(Observable observable, Object arg) { - this.stateManagement = (StateManagement) observable; - this.message = (String) arg; + /** + * Invoked to indicate that something observed by this notifier has changed. + * @param observable item that has changed + * @param changed message indicating what change was made + */ + public void update(StateManagement observable, String changed) { + this.stateManagement = observable; + this.message = changed; handleStateChange(); } |