Skip to content

Commit

Permalink
Additional fields in Node for get node status and children status. Ne…
Browse files Browse the repository at this point in the history
…ed to discuss heartbeat...
  • Loading branch information
gwilmer committed Dec 20, 2012
1 parent fed42a6 commit 7f6592c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 31 deletions.
Expand Up @@ -157,24 +157,32 @@ public final EngineList getEngineList() {
return list;
}

/**
* Provides Node information for the single engine
*
* return {@link Node}<br>
*
* <pre>
* Example xml reponse is as follows:<br><br>
* {@code
* <node>
* <name>root</name>
* <rootNode>true</rootNode>
* </node>
* }
* <br>
* Example json response is as follows:<br><br>
*
* </pre>
*/
/**
* Provides Node information for the single engine
*
* return {@link Node}<br>
*
* <pre>
* Example xml reponse is as follows:<br><br>
* {@code
* <node>
* <batchInErrorCount>0</batchInErrorCount>
* <batchToSendCount>0</batchToSendCount>
* <externalId>server01</externalId>
* <initialLoaded>true</initialLoaded>
* <lastHeartbeat>2012-12-20T09:15:00-05:00</lastHeartbeat>
* <name>server01</name>
* <registered>true</registered>
* <registrationServer>true</registrationServer>
* <reverseInitialLoaded>false</reverseInitialLoaded>
* <syncUrl>http://gwilmer-laptop:31415/sync/servers-server01</syncUrl>
* </node>
* }
* <br>
* Example json response is as follows:<br><br>
*
* </pre>
*/
@RequestMapping(value = "engine/node", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
Expand Down Expand Up @@ -663,7 +671,7 @@ private NodeList childrenImpl(ISymmetricEngine engine) {
xmlChildNode = new Node();
xmlChildNode.setName(child.getNode().getNodeId());
xmlChildNode.setExternalId(child.getNode().getExternalId());
xmlChildNode.setRootNode(false);
xmlChildNode.setRegistrationServer(false);
xmlChildNode.setSyncUrl(child.getNode().getSyncUrl());

xmlChildNode.setBatchInErrorCount(child.getNode().getBatchInErrorCount());
Expand All @@ -675,7 +683,7 @@ private NodeList childrenImpl(ISymmetricEngine engine) {
xmlChildNode.setInitialLoaded(nodeSecurity.hasInitialLoaded());
xmlChildNode.setReverseInitialLoaded(nodeSecurity.hasReverseInitialLoaded());
if (child.getNode().getCreatedAtNodeId() == null) {
xmlChildNode.setRootNode(true);
xmlChildNode.setRegistrationServer(true);
}
children.addNode(xmlChildNode);
}
Expand All @@ -700,9 +708,9 @@ private Node nodeImpl(ISymmetricEngine engine) {
xmlNode.setInitialLoaded(nodeSecurity.hasInitialLoaded());
xmlNode.setReverseInitialLoaded(nodeSecurity.hasReverseInitialLoaded());
if (modelNode.getCreatedAtNodeId() == null) {
xmlNode.setRootNode(true);
xmlNode.setRegistrationServer(true);
} else {
xmlNode.setRootNode(false);
xmlNode.setRegistrationServer(false);
}

return xmlNode;
Expand Down Expand Up @@ -740,6 +748,11 @@ private NodeStatus nodeStatusImpl(ISymmetricEngine engine) {
status.setBatchToSendCount(modelNode.getBatchToSendCount());
status.setBatchInErrorCount(modelNode.getBatchInErrorCount());
status.setDeploymentType(modelNode.getDeploymentType());
if (modelNode.getCreatedAtNodeId() == null) {
status.setRegistrationServer(true);
} else {
status.setRegistrationServer(false);
}

if (nodeHost != null && nodeHost.size() > 0) {
status.setLastHeartbeat(nodeHost.get(0).getHeartbeatTime());
Expand Down
Expand Up @@ -29,7 +29,7 @@ public class Node {

private String name;
private String externalId;
private boolean rootNode;
private boolean registrationServer;
private String syncUrl;
private int batchToSendCount;
private int batchInErrorCount;
Expand Down Expand Up @@ -86,12 +86,12 @@ public void setSyncUrl(String syncUrl) {
this.syncUrl = syncUrl;
}

public boolean isRootNode() {
return rootNode;
public boolean isRegistrationServer() {
return registrationServer;
}

public void setRootNode(boolean rootNode) {
this.rootNode = rootNode;
public void setRegistrationServer(boolean registrationServer) {
this.registrationServer = registrationServer;
}

public Node(String name) {
Expand Down
Expand Up @@ -20,9 +20,12 @@
*/
package org.jumpmind.symmetric.web.rest.model;

import org.jumpmind.symmetric.Version;
import java.util.Date;

import javax.xml.bind.annotation.XmlRootElement;

import org.jumpmind.symmetric.Version;

@XmlRootElement(name="nodestatus")
public class NodeStatus {

Expand Down Expand Up @@ -106,7 +109,7 @@ public class NodeStatus {
/**
* The last heartbeat for the given node.
*/
private String lastHeartbeat;
private Date lastHeartbeat;

/**
* The hearbeat interval for the given node.
Expand All @@ -122,11 +125,11 @@ public void setStarted(boolean started) {
this.started = started;
}

public String getLastHeartbeat() {
public Date getLastHeartbeat() {
return lastHeartbeat;
}

public void setLastHeartbeat(String lastHeartbeat) {
public void setLastHeartbeat(Date lastHeartbeat) {
this.lastHeartbeat = lastHeartbeat;
}

Expand Down

0 comments on commit 7f6592c

Please sign in to comment.