Added Yasser's changes to get node id from INCApplicationContext
git-svn-id: https://hyracks.googlecode.com/svn/trunk@434 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/application/INCApplicationContext.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/application/INCApplicationContext.java
index e20fd90..eed5bb3 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/application/INCApplicationContext.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/application/INCApplicationContext.java
@@ -19,6 +19,8 @@
import edu.uci.ics.hyracks.api.context.IHyracksRootContext;
public interface INCApplicationContext extends IApplicationContext {
+ public String getNodeId();
+
public IHyracksRootContext getRootContext();
public void setDistributedState(Serializable state);
diff --git a/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/NodeControllerService.java b/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/NodeControllerService.java
index 293e626..be48ae6 100644
--- a/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/NodeControllerService.java
+++ b/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/NodeControllerService.java
@@ -587,7 +587,7 @@
if (applications.containsKey(appName)) {
throw new HyracksException("Duplicate application with name: " + appName + " being created.");
}
- appCtx = new NCApplicationContext(serverCtx, ctx, appName);
+ appCtx = new NCApplicationContext(serverCtx, ctx, appName, id);
applications.put(appName, appCtx);
}
if (deployHar) {
diff --git a/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/application/NCApplicationContext.java b/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/application/NCApplicationContext.java
index 349743b..06f4212 100644
--- a/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/application/NCApplicationContext.java
+++ b/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/application/NCApplicationContext.java
@@ -10,16 +10,23 @@
import edu.uci.ics.hyracks.control.common.context.ServerContext;
public class NCApplicationContext extends ApplicationContext implements INCApplicationContext {
+ private final String nodeId;
private final IHyracksRootContext rootCtx;
private Object appObject;
- public NCApplicationContext(ServerContext serverCtx, IHyracksRootContext rootCtx, String appName)
+ public NCApplicationContext(ServerContext serverCtx, IHyracksRootContext rootCtx, String appName, String nodeId)
throws IOException {
super(serverCtx, appName);
+ this.nodeId = nodeId;
this.rootCtx = rootCtx;
}
@Override
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ @Override
public void setDistributedState(Serializable state) {
distributedState = state;
}
diff --git a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/comm/SerializationDeserializationTest.java b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/comm/SerializationDeserializationTest.java
index 9aac876..f13a701 100644
--- a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/comm/SerializationDeserializationTest.java
+++ b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/comm/SerializationDeserializationTest.java
@@ -56,7 +56,7 @@
public SerDeserRunner(RecordDescriptor rDes) throws HyracksException {
IHyracksRootContext rootCtx = new TestRootContext(FRAME_SIZE);
- INCApplicationContext appCtx = new TestNCApplicationContext(rootCtx);
+ INCApplicationContext appCtx = new TestNCApplicationContext(rootCtx, null);
IHyracksJobletContext jobletCtx = new TestJobletContext(appCtx, UUID.randomUUID(), 0);
ctx = new TestStageletContext(jobletCtx, UUID.randomUUID());
this.rDes = rDes;
diff --git a/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestNCApplicationContext.java b/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestNCApplicationContext.java
index 0bdf919..295a428 100644
--- a/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestNCApplicationContext.java
+++ b/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestNCApplicationContext.java
@@ -20,12 +20,20 @@
import edu.uci.ics.hyracks.api.context.IHyracksRootContext;
public class TestNCApplicationContext implements INCApplicationContext {
- private IHyracksRootContext rootCtx;
+ private final IHyracksRootContext rootCtx;
+ private final String nodeId;
+
private Serializable distributedState;
private Object appObject;
- public TestNCApplicationContext(IHyracksRootContext rootCtx) {
+ public TestNCApplicationContext(IHyracksRootContext rootCtx, String nodeId) {
this.rootCtx = rootCtx;
+ this.nodeId = nodeId;
+ }
+
+ @Override
+ public String getNodeId() {
+ return nodeId;
}
@Override
diff --git a/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestUtils.java b/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestUtils.java
index 2edeaff..b17f28c 100644
--- a/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestUtils.java
+++ b/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestUtils.java
@@ -26,7 +26,7 @@
public static IHyracksStageletContext create(int frameSize) {
try {
IHyracksRootContext rootCtx = new TestRootContext(frameSize);
- INCApplicationContext appCtx = new TestNCApplicationContext(rootCtx);
+ INCApplicationContext appCtx = new TestNCApplicationContext(rootCtx, null);
IHyracksJobletContext jobletCtx = new TestJobletContext(appCtx, UUID.randomUUID(), 0);
IHyracksStageletContext stageletCtx = new TestStageletContext(jobletCtx, UUID.randomUUID());
return stageletCtx;