org.bidib.wizard.api.model.event.NodeStatusEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bidibwizard-api Show documentation
Show all versions of bidibwizard-api Show documentation
jBiDiB BiDiB Wizard API POM
The newest version!
package org.bidib.wizard.api.model.event;
import org.bidib.jbidibc.messages.utils.ByteUtils;
public class NodeStatusEvent implements NodeEvent {
public enum StatusIdentifier {
InitialLoadPending, InitialLoadRegistered, InitialLoadPartiallyFinished, InitialLoadFinished;
}
private final String connectionId;
private final String nodeAddress;
private final long uniqueId;
private final StatusIdentifier statusIdentifier;
public NodeStatusEvent(String connectionId, long uniqueId, final String nodeAddress,
StatusIdentifier statusIdentifier) {
this.connectionId = connectionId;
this.uniqueId = uniqueId;
this.nodeAddress = nodeAddress;
this.statusIdentifier = statusIdentifier;
}
@Override
public String getConnectionId() {
return connectionId;
}
@Override
public long getUniqueId() {
return uniqueId;
}
/**
* @return the node address
*/
public String getNodeAddress() {
return nodeAddress;
}
/**
* @return the statusIdentifier
*/
public StatusIdentifier getStatusIdentifier() {
return statusIdentifier;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("NodeStatusEvent[");
sb.append("connectionId=").append(connectionId);
sb.append(",uniqueId=").append(ByteUtils.getUniqueIdAsString(uniqueId));
sb.append(",nodeAddress=").append(nodeAddress);
sb.append(",statusIdentifier=").append(statusIdentifier);
return sb.toString();
}
public static boolean isConfigNotLoadedStatus(StatusIdentifier statusIdentifier) {
if (StatusIdentifier.InitialLoadPending == statusIdentifier
|| StatusIdentifier.InitialLoadRegistered == statusIdentifier) {
return true;
}
return false;
}
}