net.sf.eBusx.monitor.MonitoredObjectReply Maven / Gradle / Ivy
//
// 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
//
// The Initial Developer of the Original Code is Charles W. Rapp.
// Portions created by Charles W. Rapp are
// Copyright 2012, 2013, 2016. Charles W. Rapp
// All Rights Reserved.
//
package net.sf.eBusx.monitor;
import java.io.Serializable;
import java.util.Arrays;
import net.sf.eBus.messages.EFieldInfo;
import net.sf.eBus.messages.EReplyMessage;
import static net.sf.eBus.messages.EReplyMessage.ReplyStatus;
/**
* Returns the currently registered monitored objects within the
* eBus virtual machine, specified as an array of
* {@link MonitorId}s. This message is sent in reply to a
* {@link MonitoredObjectRequest} with the subject
* {@link Monitor#MONITOR_REQUEST}.
*
* @see MonitoredObjectRequest
*
* @author Charles Rapp
*/
@EFieldInfo(fields={"instances"})
public final class MonitoredObjectReply
extends EReplyMessage
implements Serializable
{
//---------------------------------------------------------------
// Member methods.
//
//-----------------------------------------------------------
// Constructors.
//
/**
* Creates a new MonitoredObjectReply instance for the
* given monitored objects.
* @param subject the request subject.
* @param ids monitored object identifiers.
*/
public MonitoredObjectReply(final String subject,
final MonitorId[] ids)
{
this (subject,
System.currentTimeMillis(),
ReplyStatus.OK_FINAL,
null,
ids);
} // end of MonitoredObjectReply(MonitorId[])
/**
* Creates a monitored object reply from the deserialized
* header and monitor identifiers.
* @param subject the request subject.
* @param timestamp the message timestamp.
* @param status the reply status.
* @param reason the reply reason.
* @param ids the currently registered monitor identifiers.
*/
public MonitoredObjectReply(final String subject,
final long timestamp,
final ReplyStatus status,
final String reason,
final MonitorId[] ids)
{
super (subject, timestamp, status, reason);
instances = Arrays.copyOf(ids, ids.length);
} // end of MonitoredObjectReply(...)
//
// end of Constructors.
//-----------------------------------------------------------
//-----------------------------------------------------------
// Object Method Overrides.
//
@Override
public boolean equals(final Object o)
{
return (super.equals(o));
} // end of equals(Object)
@Override
public int hashCode()
{
return (super.hashCode());
} // end of hashCode()
//
// end of Object Method Overrides.
//-----------------------------------------------------------
//---------------------------------------------------------------
// Member data.
//
/**
* The currently registered monitor objects.
*/
public final MonitorId[] instances;
//-----------------------------------------------------------
// Constants.
//
/**
* Serialization version identifier.
*/
private static final long serialVersionUID = 0x060100L;
} // end of class MonitoredObjectReply
© 2015 - 2025 Weber Informatics LLC | Privacy Policy