/******************************************************************************* * ALMA - Atacama Large Millimeter Array * Copyright (c) ESO - European Southern Observatory, 2011 * (in the framework of the ALMA collaboration). * All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *******************************************************************************/ package alma.acs.nsstatistics; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.logging.Logger; import org.omg.CosNotifyChannelAdmin.EventChannel; import org.omg.CosNotifyChannelAdmin.EventChannelFactory; import gov.sandia.CosNotification.NotificationServiceMonitorControl; import alma.acscommon.ALARM_NOTIFICATION_FACTORY_NAME; import alma.acscommon.ARCHIVE_NOTIFICATION_FACTORY_NAME; import alma.acscommon.LOGGING_NOTIFICATION_FACTORY_NAME; import alma.acscommon.NOTIFICATION_FACTORY_NAME; /** * Encapsulates a Corba notify service for use in the model and in GUI elements. *
* All equality and comparison methods are based on the simplified name.
*/
public class NotifyServiceData extends AbstractNotifyServiceElement implements Comparable
* The matching may fail even if the corba references point to the same NC object,
* see {@link org.omg.CORBA.Object#_is_equivalent(org.omg.CORBA.Object)}.
*/
public ChannelData getChannelByCorbaRef(EventChannel corbaRef) {
for (ChannelData nc : getChannels()) {
if (nc.getCorbaRef()._is_equivalent(corbaRef)) {
return nc;
}
}
return null;
}
public Listnull
if the eventGUI has never found
* this service to be reachable and thus has not obtained a correctly narrowed reference yet.
*/
public EventChannelFactory getEventChannelFactory() {
return efact;
}
public NotificationServiceMonitorControl getMc() {
return mc;
}
/**
* The notify service ref must be updated once after the notify service becomes available, after initial unreachability.
*/
public void updateEventChannelFactory(EventChannelFactory efact) {
if (this.efact == null) {
this.efact = efact;
}
else {
logger.warning("Ignoring call to 'updateEventChannelFactory' for notify service '" + getFactoryName() + "' because we already have that corba ref!");
}
}
/**
* The MC object ref must be updated when a notify service was restarted.
*/
public void updateMC(NotificationServiceMonitorControl monitorControl) {
mc = monitorControl;
}
/**
* TODO: Possibly use this information to graphically distinguish between the notify service instances
* always started by ACS, and any additional service instances.
*/
public boolean isStandardNotifyService() {
return (factoryName.equals(NOTIFICATION_FACTORY_NAME.value) ||
factoryName.equals(ALARM_NOTIFICATION_FACTORY_NAME.value) ||
factoryName.equals(ARCHIVE_NOTIFICATION_FACTORY_NAME.value) ||
factoryName.equals(LOGGING_NOTIFICATION_FACTORY_NAME.value) );
}
public boolean isReachable() {
return isReachable;
}
public void setReachable(boolean isReachable) {
this.isReachable = isReachable;
}
// public boolean isRegistered() {
// return isRegistered;
// }
//
// public void setRegistered(boolean isRegistered) {
// this.isRegistered = isRegistered;
// }
public ArrayList