diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/AbsoluteLocationConstraint.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/AbsoluteLocationConstraint.java
deleted file mode 100644
index bbd4b4f..0000000
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/AbsoluteLocationConstraint.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2009-2010 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.api.constraints;
-
-public class AbsoluteLocationConstraint extends LocationConstraint {
-    private static final long serialVersionUID = 1L;
-
-    private String nodeId;
-
-    public AbsoluteLocationConstraint() {
-    }
-
-    public AbsoluteLocationConstraint(String nodeId) {
-        this.nodeId = nodeId;
-    }
-
-    @Override
-    public LocationConstraintType getConstraintType() {
-        return LocationConstraintType.ABSOLUTE;
-    }
-
-    public String getLocationId() {
-        return nodeId;
-    }
-
-    public void setLocationId(String nodeId) {
-        this.nodeId = nodeId;
-    }
-
-    public String toString() {
-        return getConstraintType() + ":" + nodeId;
-    }
-}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/ChoiceLocationConstraint.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/ChoiceLocationConstraint.java
deleted file mode 100644
index e07341b..0000000
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/ChoiceLocationConstraint.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2009-2010 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.api.constraints;
-
-import java.util.Arrays;
-
-public class ChoiceLocationConstraint extends LocationConstraint {
-    private static final long serialVersionUID = 1L;
-
-    private LocationConstraint[] choices;
-
-    public ChoiceLocationConstraint(LocationConstraint... choices) {
-        this.choices = choices;
-    }
-
-    public LocationConstraint[] getChoices() {
-        return choices;
-    }
-
-    @Override
-    public String toString() {
-        return "choice(" + Arrays.deepToString(choices) + ")";
-    }
-
-    @Override
-    public LocationConstraintType getConstraintType() {
-        return LocationConstraintType.CHOICE;
-    }
-}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/ExplicitPartitionConstraint.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/ExplicitPartitionConstraint.java
deleted file mode 100644
index 16b7b24..0000000
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/ExplicitPartitionConstraint.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2009-2010 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.api.constraints;
-
-import java.util.Arrays;
-
-public class ExplicitPartitionConstraint extends PartitionConstraint {
-    private static final long serialVersionUID = 1L;
-
-    private final LocationConstraint[] locationConstraints;
-
-    public ExplicitPartitionConstraint(LocationConstraint[] locationConstraints) {
-        this.locationConstraints = locationConstraints;
-    }
-
-    public LocationConstraint[] getLocationConstraints() {
-        return locationConstraints;
-    }
-
-    @Override
-    public String toString() {
-        return Arrays.deepToString(locationConstraints);
-    }
-
-    @Override
-    public PartitionConstraintType getPartitionConstraintType() {
-        return PartitionConstraintType.EXPLICIT;
-    }
-}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/IConstraintExpressionAcceptor.java
similarity index 70%
copy from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
copy to hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/IConstraintExpressionAcceptor.java
index 75edf2b..7e74814 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/IConstraintExpressionAcceptor.java
@@ -12,10 +12,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc.web.handlers.util;
+package edu.uci.ics.hyracks.api.constraints;
 
-import org.json.JSONObject;
+import edu.uci.ics.hyracks.api.constraints.expressions.ConstraintExpression;
 
-public interface IJSONOutputFunction {
-    public JSONObject invoke(String[] arguments) throws Exception;
+public interface IConstraintExpressionAcceptor {
+    public void addConstraintExpression(ConstraintExpression constraintExpression);
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/LocationConstraint.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/LocationConstraint.java
deleted file mode 100644
index 1228b90..0000000
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/LocationConstraint.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2009-2010 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.api.constraints;
-
-import java.io.Serializable;
-
-public abstract class LocationConstraint implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    public enum LocationConstraintType {
-        ABSOLUTE,
-        CHOICE
-    }
-
-    public abstract LocationConstraintType getConstraintType();
-}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/PartitionConstraint.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/PartitionConstraint.java
deleted file mode 100644
index 82a6f7b..0000000
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/PartitionConstraint.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2009-2010 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.api.constraints;
-
-import java.io.Serializable;
-
-public abstract class PartitionConstraint implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    public abstract PartitionConstraintType getPartitionConstraintType();
-
-    public enum PartitionConstraintType {
-        EXPLICIT,
-        COUNT
-    }
-}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/PartitionConstraintHelper.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/PartitionConstraintHelper.java
new file mode 100644
index 0000000..309fca1
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/PartitionConstraintHelper.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.api.constraints;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import edu.uci.ics.hyracks.api.constraints.expressions.BelongsToExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.ConstantExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.ConstraintExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.EnumeratedCollectionExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.PartitionCountExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.PartitionLocationExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.RelationalExpression;
+import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
+import edu.uci.ics.hyracks.api.job.JobSpecification;
+
+public class PartitionConstraintHelper {
+    public static void addPartitionCountConstraint(JobSpecification spec, IOperatorDescriptor op, int count) {
+        spec.addUserConstraint(new RelationalExpression(new PartitionCountExpression(op.getOperatorId()),
+                new ConstantExpression(count), RelationalExpression.Operator.EQUAL));
+    }
+
+    public static void addLocationChoiceConstraint(JobSpecification spec, IOperatorDescriptor op, String[][] choices) {
+        addPartitionCountConstraint(spec, op, choices.length);
+        for (int i = 0; i < choices.length; ++i) {
+            String[] choice = choices[i];
+            List<ConstraintExpression> choiceExprs = new ArrayList<ConstraintExpression>();
+            for (String c : choice) {
+                choiceExprs.add(new ConstantExpression(c));
+            }
+            spec.addUserConstraint(new BelongsToExpression(new PartitionLocationExpression(op.getOperatorId(), i),
+                    new EnumeratedCollectionExpression(choiceExprs)));
+        }
+    }
+
+    public static void addAbsoluteLocationConstraint(JobSpecification spec, IOperatorDescriptor op, String... locations) {
+        addPartitionCountConstraint(spec, op, locations.length);
+        for (int i = 0; i < locations.length; ++i) {
+            List<ConstraintExpression> choiceExprs = new ArrayList<ConstraintExpression>();
+            choiceExprs.add(new ConstantExpression(locations[i]));
+            spec.addUserConstraint(new BelongsToExpression(new PartitionLocationExpression(op.getOperatorId(), i),
+                    new EnumeratedCollectionExpression(choiceExprs)));
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/PartitionCountConstraint.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/PartitionCountConstraint.java
deleted file mode 100644
index f4fdf67..0000000
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/PartitionCountConstraint.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2009-2010 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.api.constraints;
-
-public class PartitionCountConstraint extends PartitionConstraint {
-    private static final long serialVersionUID = 1L;
-
-    private final int count;
-
-    public PartitionCountConstraint(int count) {
-        this.count = count;
-    }
-
-    public int getCount() {
-        return count;
-    }
-
-    @Override
-    public PartitionConstraintType getPartitionConstraintType() {
-        return PartitionConstraintType.COUNT;
-    }
-
-    @Override
-    public String toString() {
-        return "count(" + count + ")";
-    }
-}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/BelongsToExpression.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/BelongsToExpression.java
new file mode 100644
index 0000000..c307e3e
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/BelongsToExpression.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.api.constraints.expressions;
+
+import java.util.Collection;
+
+public final class BelongsToExpression extends ConstraintExpression {
+    private static final long serialVersionUID = 1L;
+
+    private final ConstraintExpression itemExpression;
+
+    private final ConstraintExpression setExpression;
+
+    public BelongsToExpression(ConstraintExpression itemExpression, ConstraintExpression setExpression) {
+        this.itemExpression = itemExpression;
+        this.setExpression = setExpression;
+    }
+
+    @Override
+    public ExpressionTag getTag() {
+        return ExpressionTag.BELONGS_TO;
+    }
+
+    public ConstraintExpression getItemExpression() {
+        return itemExpression;
+    }
+
+    public ConstraintExpression getSetExpression() {
+        return setExpression;
+    }
+
+    @Override
+    public void getChildren(Collection<ConstraintExpression> children) {
+        children.add(itemExpression);
+        children.add(setExpression);
+    }
+
+    @Override
+    protected void toString(StringBuilder buffer) {
+        buffer.append(getTag()).append('(');
+        itemExpression.toString(buffer);
+        buffer.append(", ");
+        setExpression.toString(buffer);
+        buffer.append(')');
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/ConstantExpression.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/ConstantExpression.java
new file mode 100644
index 0000000..6e10911
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/ConstantExpression.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.api.constraints.expressions;
+
+import java.util.Collection;
+
+public class ConstantExpression extends ConstraintExpression {
+    private static final long serialVersionUID = 1L;
+
+    private final Object value;
+
+    public ConstantExpression(Object value) {
+        this.value = value;
+    }
+
+    @Override
+    public ExpressionTag getTag() {
+        return ExpressionTag.CONSTANT;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    @Override
+    public void getChildren(Collection<ConstraintExpression> children) {
+    }
+
+    @Override
+    protected void toString(StringBuilder buffer) {
+        buffer.append(getTag()).append('[').append(value).append(':').append(value.getClass().getName()).append(']');
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/ConstraintExpression.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/ConstraintExpression.java
new file mode 100644
index 0000000..afd5051
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/ConstraintExpression.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.api.constraints.expressions;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+public abstract class ConstraintExpression implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    public enum ExpressionTag {
+        CONSTANT,
+        PARTITION_COUNT,
+        RESOURCE_SUM,
+        PARTITION_LOCATION,
+        ENUMERATED_SET,
+        BELONGS_TO,
+        RELATIONAL,
+    }
+
+    public abstract ExpressionTag getTag();
+
+    public abstract void getChildren(Collection<ConstraintExpression> children);
+
+    @Override
+    public final String toString() {
+        StringBuilder buffer = new StringBuilder();
+        toString(buffer);
+        return buffer.toString();
+    }
+
+    protected abstract void toString(StringBuilder buffer);
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/EnumeratedCollectionExpression.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/EnumeratedCollectionExpression.java
new file mode 100644
index 0000000..d0ce706
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/EnumeratedCollectionExpression.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.api.constraints.expressions;
+
+import java.util.Collection;
+
+public class EnumeratedCollectionExpression extends ConstraintExpression {
+    private static final long serialVersionUID = 1L;
+
+    private final Collection<ConstraintExpression> enumeration;
+
+    public EnumeratedCollectionExpression(Collection<ConstraintExpression> enumeration) {
+        this.enumeration = enumeration;
+    }
+
+    @Override
+    public ExpressionTag getTag() {
+        return ExpressionTag.ENUMERATED_SET;
+    }
+
+    public Collection<ConstraintExpression> getMembers() {
+        return enumeration;
+    }
+
+    @Override
+    public void getChildren(Collection<ConstraintExpression> children) {
+        children.addAll(enumeration);
+    }
+
+    @Override
+    protected void toString(StringBuilder buffer) {
+        buffer.append(getTag()).append('(');
+        boolean first = true;
+        for (ConstraintExpression ce : enumeration) {
+            if (!first) {
+                buffer.append(", ");
+            }
+            first = false;
+            ce.toString(buffer);
+        }
+        buffer.append(')');
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/PartitionCountExpression.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/PartitionCountExpression.java
new file mode 100644
index 0000000..c538ff7
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/PartitionCountExpression.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.api.constraints.expressions;
+
+import java.util.Collection;
+
+import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
+
+public final class PartitionCountExpression extends ConstraintExpression {
+    private static final long serialVersionUID = 1L;
+
+    private final OperatorDescriptorId opId;
+
+    public PartitionCountExpression(OperatorDescriptorId opId) {
+        this.opId = opId;
+    }
+
+    @Override
+    public ExpressionTag getTag() {
+        return ExpressionTag.PARTITION_COUNT;
+    }
+
+    public OperatorDescriptorId getOperatorDescriptorId() {
+        return opId;
+    }
+
+    @Override
+    public void getChildren(Collection<ConstraintExpression> children) {
+    }
+
+    @Override
+    protected void toString(StringBuilder buffer) {
+        buffer.append(getTag()).append('(').append(opId.toString()).append(')');
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/PartitionLocationExpression.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/PartitionLocationExpression.java
new file mode 100644
index 0000000..50e4e47
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/PartitionLocationExpression.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.api.constraints.expressions;
+
+import java.util.Collection;
+
+import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
+
+public final class PartitionLocationExpression extends ConstraintExpression {
+    private static final long serialVersionUID = 1L;
+
+    private final OperatorDescriptorId opId;
+    private final int partition;
+
+    public PartitionLocationExpression(OperatorDescriptorId opId, int partition) {
+        this.opId = opId;
+        this.partition = partition;
+    }
+
+    @Override
+    public ExpressionTag getTag() {
+        return ExpressionTag.PARTITION_LOCATION;
+    }
+
+    public OperatorDescriptorId getOperatorDescriptorId() {
+        return opId;
+    }
+
+    public int getPartition() {
+        return partition;
+    }
+
+    @Override
+    public void getChildren(Collection<ConstraintExpression> children) {
+    }
+
+    @Override
+    protected void toString(StringBuilder buffer) {
+        buffer.append(getTag()).append('(').append(opId.toString()).append(", ").append(partition).append(')');
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/RelationalExpression.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/RelationalExpression.java
new file mode 100644
index 0000000..d90bce9
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/RelationalExpression.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.api.constraints.expressions;
+
+import java.util.Collection;
+
+public class RelationalExpression extends ConstraintExpression {
+    private static final long serialVersionUID = 1L;
+
+    public enum Operator {
+        EQUAL,
+        NOT_EQUAL,
+        LESS,
+        LESS_EQUAL,
+        GREATER,
+        GREATER_EQUAL
+    }
+
+    private final ConstraintExpression left;
+    private final ConstraintExpression right;
+    private final Operator op;
+
+    public RelationalExpression(ConstraintExpression left, ConstraintExpression right, Operator op) {
+        this.left = left;
+        this.right = right;
+        this.op = op;
+    }
+
+    @Override
+    public ExpressionTag getTag() {
+        return ExpressionTag.RELATIONAL;
+    }
+
+    public ConstraintExpression getLeft() {
+        return left;
+    }
+
+    public ConstraintExpression getRight() {
+        return right;
+    }
+
+    public Operator getOperator() {
+        return op;
+    }
+
+    @Override
+    public void getChildren(Collection<ConstraintExpression> children) {
+        children.add(left);
+        children.add(right);
+    }
+
+    @Override
+    protected void toString(StringBuilder buffer) {
+        buffer.append(getTag()).append('(').append(op).append(", ");
+        left.toString(buffer);
+        buffer.append(", ");
+        right.toString(buffer);
+        buffer.append(')');
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/ResourceSumExpression.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/ResourceSumExpression.java
new file mode 100644
index 0000000..3fbdd08
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/constraints/expressions/ResourceSumExpression.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.api.constraints.expressions;
+
+import java.util.Collection;
+
+import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
+
+public final class ResourceSumExpression extends ConstraintExpression {
+    private static final long serialVersionUID = 1L;
+
+    private final OperatorDescriptorId opId;
+
+    private final String resourceName;
+
+    public ResourceSumExpression(OperatorDescriptorId opId, String resourceName) {
+        this.opId = opId;
+        this.resourceName = resourceName;
+    }
+
+    @Override
+    public ExpressionTag getTag() {
+        return ExpressionTag.RESOURCE_SUM;
+    }
+
+    public OperatorDescriptorId getOperatorDescriptorId() {
+        return opId;
+    }
+
+    public String getResourceName() {
+        return resourceName;
+    }
+
+    @Override
+    public void getChildren(Collection<ConstraintExpression> children) {
+    }
+
+    @Override
+    protected void toString(StringBuilder buffer) {
+        buffer.append(getTag()).append('(').append(opId.toString()).append(", ").append(resourceName).append(')');
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/control/CCConfig.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/control/CCConfig.java
index 7cdaee1..4d9b5a0 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/control/CCConfig.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/control/CCConfig.java
@@ -32,6 +32,6 @@
     @Option(name = "-profile-dump-period", usage = "Sets the time duration between two profile dumps from each node controller in milliseconds. 0 to disable. (default: 0)")
     public int profileDumpPeriod = 0;
 
-    @Option(name = "-use-jol", usage = "Forces Hyracks to use the JOL based scheduler (default: false)")
-    public boolean useJOL = false;
+    @Option(name = "-default-max-job-attempts", usage = "Sets the default number of job attempts allowed if not specified in the job specification. (default: 5)")
+    public int defaultMaxJobAttempts = 5;
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/control/IClusterController.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/control/IClusterController.java
index f577db2..9023cee 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/control/IClusterController.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/control/IClusterController.java
@@ -15,20 +15,23 @@
 package edu.uci.ics.hyracks.api.control;
 
 import java.rmi.Remote;
-import java.util.Map;
+import java.util.List;
 import java.util.UUID;
 
+import edu.uci.ics.hyracks.api.job.profiling.om.JobProfile;
+import edu.uci.ics.hyracks.api.job.profiling.om.StageletProfile;
+
 public interface IClusterController extends Remote {
     public NodeParameters registerNode(INodeController nodeController) throws Exception;
 
     public void unregisterNode(INodeController nodeController) throws Exception;
 
-    public void notifyStageletComplete(UUID jobId, UUID stageId, int attempt, String nodeId,
-            Map<String, Long> statistics) throws Exception;
+    public void notifyStageletComplete(UUID jobId, UUID stageId, int attempt, String nodeId, StageletProfile statistics)
+            throws Exception;
 
     public void notifyStageletFailure(UUID jobId, UUID stageId, int attempt, String nodeId) throws Exception;
 
     public void nodeHeartbeat(String id) throws Exception;
 
-    public void reportProfile(String id, Map<UUID, Map<String, Long>> counterDump) throws Exception;
+    public void reportProfile(String id, List<JobProfile> profiles) throws Exception;
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/control/INodeController.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/control/INodeController.java
index 1842959..d0269fc 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/control/INodeController.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/control/INodeController.java
@@ -32,16 +32,16 @@
     public NodeCapability getNodeCapability() throws Exception;
 
     public Map<PortInstanceId, Endpoint> initializeJobletPhase1(String appName, UUID jobId, int attempt, byte[] plan,
-            UUID stageId, Map<ActivityNodeId, Set<Integer>> tasks, Map<OperatorDescriptorId, Set<Integer>> opPartitions)
+            UUID stageId, Map<ActivityNodeId, Set<Integer>> tasks, Map<OperatorDescriptorId, Integer> opNumPartitions)
             throws Exception;
 
     public void initializeJobletPhase2(String appName, UUID jobId, byte[] plan, UUID stageId,
-            Map<ActivityNodeId, Set<Integer>> tasks, Map<OperatorDescriptorId, Set<Integer>> opPartitions,
+            Map<ActivityNodeId, Set<Integer>> tasks, Map<OperatorDescriptorId, Integer> opNumPartitions,
             Map<PortInstanceId, Endpoint> globalPortMap) throws Exception;
 
     public void commitJobletInitialization(UUID jobId, UUID stageId) throws Exception;
 
-    public void abortJoblet(UUID jobId, UUID stageId) throws Exception;
+    public void abortJoblet(UUID jobId, int attempt) throws Exception;
 
     public void cleanUpJob(UUID jobId) throws Exception;
 
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/IConnectorDescriptor.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/IConnectorDescriptor.java
index 63bed19..362306a 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/IConnectorDescriptor.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/IConnectorDescriptor.java
@@ -22,9 +22,11 @@
 import edu.uci.ics.hyracks.api.comm.IConnectionDemultiplexer;
 import edu.uci.ics.hyracks.api.comm.IFrameReader;
 import edu.uci.ics.hyracks.api.comm.IFrameWriter;
+import edu.uci.ics.hyracks.api.constraints.IConstraintExpressionAcceptor;
 import edu.uci.ics.hyracks.api.context.IHyracksStageletContext;
 import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.api.job.JobPlan;
 
 /**
  * Connector that connects operators in a Job.
@@ -84,6 +86,16 @@
             throws HyracksDataException;
 
     /**
+     * Contribute any scheduling constraints imposed by this connector
+     * 
+     * @param constraintAcceptor
+     *            - Constraint Acceptor
+     * @param plan
+     *            - Job Plan
+     */
+    public void contributeSchedulingConstraints(IConstraintExpressionAcceptor constraintAcceptor, JobPlan plan);
+
+    /**
      * Translate this connector descriptor to JSON.
      * 
      * @return
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/IOperatorDescriptor.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/IOperatorDescriptor.java
index ad51370..e58ac99 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/IOperatorDescriptor.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/IOperatorDescriptor.java
@@ -19,8 +19,9 @@
 import org.json.JSONException;
 import org.json.JSONObject;
 
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.IConstraintExpressionAcceptor;
 import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
+import edu.uci.ics.hyracks.api.job.JobPlan;
 
 /**
  * Descriptor for operators in Hyracks.
@@ -50,21 +51,6 @@
     public int getOutputArity();
 
     /**
-     * Returns the partition constraint requested for scheduling this operator. This value is set as part of Job creation by the client.
-     * 
-     * @return the partition constraint.
-     */
-    public PartitionConstraint getPartitionConstraint();
-
-    /**
-     * Sets the partition constraint.
-     * 
-     * @param partitionConstraint
-     *            - partition constraint.
-     */
-    public void setPartitionConstraint(PartitionConstraint partitionConstraint);
-
-    /**
      * Gets the output record descriptor
      * 
      * @return Array of RecordDescriptor, one per output.
@@ -80,6 +66,16 @@
     public void contributeTaskGraph(IActivityGraphBuilder builder);
 
     /**
+     * Contributes any scheduling constraints imposed by this operator.
+     * 
+     * @param constraintAcceptor
+     *            - Constraint Acceptor
+     * @param plan
+     *            - Job Plan
+     */
+    public void contributeSchedulingConstraints(IConstraintExpressionAcceptor constraintAcceptor, JobPlan plan);
+
+    /**
      * Translates this operator descriptor to JSON.
      */
     public JSONObject toJSON() throws JSONException;
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobPlan.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobPlan.java
index 5d8ef1d..13da402 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobPlan.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobPlan.java
@@ -21,18 +21,21 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.UUID;
 
 import edu.uci.ics.hyracks.api.dataflow.ActivityNodeId;
 import edu.uci.ics.hyracks.api.dataflow.IActivityNode;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
 import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
-import edu.uci.ics.hyracks.api.job.JobFlag;
-import edu.uci.ics.hyracks.api.job.JobSpecification;
 
 public class JobPlan implements Serializable {
     private static final long serialVersionUID = 1L;
 
+    private final String appName;
+
+    private final UUID jobId;
+
     private final JobSpecification jobSpec;
 
     private final EnumSet<JobFlag> jobFlags;
@@ -53,9 +56,9 @@
 
     private final Map<OperatorDescriptorId, List<ActivityNodeId>> operatorOutputMap;
 
-    private JobStage endStage;
-
-    public JobPlan(JobSpecification jobSpec, EnumSet<JobFlag> jobFlags) {
+    public JobPlan(String appName, UUID jobId, JobSpecification jobSpec, EnumSet<JobFlag> jobFlags) {
+        this.appName = appName;
+        this.jobId = jobId;
         this.jobSpec = jobSpec;
         this.jobFlags = jobFlags;
         activityNodes = new HashMap<ActivityNodeId, IActivityNode>();
@@ -68,6 +71,14 @@
         operatorOutputMap = new HashMap<OperatorDescriptorId, List<ActivityNodeId>>();
     }
 
+    public String getApplicationName() {
+        return appName;
+    }
+
+    public UUID getJobId() {
+        return jobId;
+    }
+
     public JobSpecification getJobSpecification() {
         return jobSpec;
     }
@@ -108,14 +119,6 @@
         return operatorOutputMap;
     }
 
-    public void setEndStage(JobStage endStage) {
-        this.endStage = endStage;
-    }
-
-    public JobStage getEndStage() {
-        return endStage;
-    }
-
     public List<IConnectorDescriptor> getTaskInputs(ActivityNodeId hanId) {
         List<Integer> inputIndexes = taskInputMap.get(hanId);
         if (inputIndexes == null) {
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobSpecification.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobSpecification.java
index fce9c22..59072f8 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobSpecification.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobSpecification.java
@@ -17,13 +17,16 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
+import edu.uci.ics.hyracks.api.constraints.expressions.ConstraintExpression;
 import edu.uci.ics.hyracks.api.dataflow.ConnectorDescriptorId;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
@@ -48,6 +51,10 @@
 
     private final Map<String, Serializable> properties;
 
+    private final Set<ConstraintExpression> userConstraints;
+
+    private int maxAttempts;
+
     public JobSpecification() {
         roots = new ArrayList<OperatorDescriptorId>();
         opMap = new HashMap<OperatorDescriptorId, IOperatorDescriptor>();
@@ -56,6 +63,7 @@
         opOutputMap = new HashMap<OperatorDescriptorId, List<IConnectorDescriptor>>();
         connectorOpMap = new HashMap<ConnectorDescriptorId, Pair<Pair<IOperatorDescriptor, Integer>, Pair<IOperatorDescriptor, Integer>>>();
         properties = new HashMap<String, Serializable>();
+        userConstraints = new HashSet<ConstraintExpression>();
     }
 
     public void addRoot(IOperatorDescriptor op) {
@@ -71,11 +79,11 @@
                         new Pair<IOperatorDescriptor, Integer>(producerOp, producerPort),
                         new Pair<IOperatorDescriptor, Integer>(consumerOp, consumerPort)));
     }
-    
+
     public void setProperty(String name, Serializable value) {
         properties.put(name, value);
     }
-    
+
     public Serializable getProperty(String name) {
         return properties.get(name);
     }
@@ -165,6 +173,22 @@
         return roots;
     }
 
+    public void setMaxAttempts(int maxAttempts) {
+        this.maxAttempts = maxAttempts;
+    }
+
+    public int getMaxAttempts() {
+        return maxAttempts;
+    }
+
+    public void addUserConstraint(ConstraintExpression constraint) {
+        userConstraints.add(constraint);
+    }
+
+    public Set<ConstraintExpression> getUserConstraints() {
+        return userConstraints;
+    }
+
     private <K, V> void insertIntoIndexedMap(Map<K, List<V>> map, K key, int index, V value) {
         List<V> vList = map.get(key);
         if (vList == null) {
@@ -180,8 +204,6 @@
 
         for (Map.Entry<OperatorDescriptorId, IOperatorDescriptor> e : opMap.entrySet()) {
             buffer.append(e.getKey().getId()).append(" : ").append(e.getValue().toString()).append("\n");
-            IOperatorDescriptor op = e.getValue();
-            buffer.append("   Partition Constraint: ").append(op.getPartitionConstraint()).append("\n");
             List<IConnectorDescriptor> inputs = opInputMap.get(e.getKey());
             if (inputs != null && !inputs.isEmpty()) {
                 buffer.append("   Inputs:\n");
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobStatus.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobStatus.java
index 977f41a..aa6fb68 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobStatus.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobStatus.java
@@ -18,4 +18,5 @@
     INITIALIZED,
     RUNNING,
     TERMINATED,
+    FAILURE,
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/counters/ICounterContext.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/counters/ICounterContext.java
index 2992757..4be02d7 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/counters/ICounterContext.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/counters/ICounterContext.java
@@ -21,13 +21,6 @@
  */
 public interface ICounterContext {
     /**
-     * Returns the fully-qualified context name
-     * 
-     * @return fully-qualified context name.
-     */
-    public String getContextName();
-
-    /**
      * Get a counter with the specified name.
      * 
      * @param name
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/om/AbstractProfile.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/om/AbstractProfile.java
new file mode 100644
index 0000000..6ef57a6
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/om/AbstractProfile.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.api.job.profiling.om;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public abstract class AbstractProfile implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    protected final Map<String, Long> counters;
+
+    public AbstractProfile() {
+        counters = new HashMap<String, Long>();
+    }
+
+    public Map<String, Long> getCounters() {
+        return counters;
+    }
+
+    public abstract JSONObject toJSON() throws JSONException;
+
+    protected void populateCounters(JSONObject jo) throws JSONException {
+        for (Map.Entry<String, Long> e : counters.entrySet()) {
+            JSONObject jpe = new JSONObject();
+            jpe.put("name", e.getKey());
+            jpe.put("value", e.getValue());
+            jo.accumulate("counters", jpe);
+        }
+    }
+
+    protected void merge(AbstractProfile profile) {
+        counters.putAll(profile.counters);
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/om/JobProfile.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/om/JobProfile.java
new file mode 100644
index 0000000..53ad0ad
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/om/JobProfile.java
@@ -0,0 +1,62 @@
+package edu.uci.ics.hyracks.api.job.profiling.om;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class JobProfile extends AbstractProfile {
+    private static final long serialVersionUID = 1L;
+
+    private final UUID jobId;
+
+    private final int attempt;
+
+    private final Map<String, JobletProfile> jobletProfiles;
+
+    public JobProfile(UUID jobId, int attempt) {
+        this.jobId = jobId;
+        this.attempt = attempt;
+        jobletProfiles = new HashMap<String, JobletProfile>();
+    }
+
+    public UUID getJobId() {
+        return jobId;
+    }
+
+    public int getAttempt() {
+        return attempt;
+    }
+
+    public Map<String, JobletProfile> getJobletProfiles() {
+        return jobletProfiles;
+    }
+
+    @Override
+    public JSONObject toJSON() throws JSONException {
+        JSONObject json = new JSONObject();
+
+        json.put("type", "job-profile");
+        json.put("job-id", jobId.toString());
+        json.put("attempt", attempt);
+        populateCounters(json);
+        for (JobletProfile p : jobletProfiles.values()) {
+            json.accumulate("joblets", p.toJSON());
+        }
+
+        return json;
+    }
+
+    public void merge(JobProfile other) {
+        super.merge(this);
+        for (JobletProfile jp : other.jobletProfiles.values()) {
+            if (jobletProfiles.containsKey(jp.getNodeId())) {
+                jobletProfiles.get(jp.getNodeId()).merge(jp);
+            } else {
+                jobletProfiles.put(jp.getNodeId(), jp);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/om/JobletProfile.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/om/JobletProfile.java
new file mode 100644
index 0000000..66a203c
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/om/JobletProfile.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.api.job.profiling.om;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class JobletProfile extends AbstractProfile {
+    private static final long serialVersionUID = 1L;
+
+    private final String nodeId;
+
+    private final Map<UUID, StageletProfile> stageletProfiles;
+
+    public JobletProfile(String nodeId) {
+        this.nodeId = nodeId;
+        stageletProfiles = new HashMap<UUID, StageletProfile>();
+    }
+
+    public String getNodeId() {
+        return nodeId;
+    }
+
+    public Map<UUID, StageletProfile> getStageletProfiles() {
+        return stageletProfiles;
+    }
+
+    @Override
+    public JSONObject toJSON() throws JSONException {
+        JSONObject json = new JSONObject();
+
+        json.put("type", "joblet-profile");
+        json.put("node-id", nodeId.toString());
+        populateCounters(json);
+        for (StageletProfile p : stageletProfiles.values()) {
+            json.accumulate("stagelets", p.toJSON());
+        }
+
+        return json;
+    }
+
+    public void merge(JobletProfile jp) {
+        super.merge(this);
+        for (StageletProfile sp : jp.stageletProfiles.values()) {
+            if (stageletProfiles.containsKey(sp.getStageId())) {
+                stageletProfiles.get(sp.getStageId()).merge(sp);
+            } else {
+                stageletProfiles.put(sp.getStageId(), sp);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/StageProgress.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/om/StageletProfile.java
similarity index 60%
rename from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/StageProgress.java
rename to hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/om/StageletProfile.java
index 102a011..cb43f66 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/StageProgress.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/profiling/om/StageletProfile.java
@@ -12,35 +12,34 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc;
+package edu.uci.ics.hyracks.api.job.profiling.om;
 
-import java.util.HashSet;
-import java.util.Set;
 import java.util.UUID;
 
-public class StageProgress {
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class StageletProfile extends AbstractProfile {
+    private static final long serialVersionUID = 1L;
+
     private final UUID stageId;
 
-    private final Set<String> pendingNodes;
-
-    public StageProgress(UUID stageId) {
+    public StageletProfile(UUID stageId) {
         this.stageId = stageId;
-        pendingNodes = new HashSet<String>();
     }
 
     public UUID getStageId() {
         return stageId;
     }
 
-    public void addPendingNodes(Set<String> nodes) {
-        pendingNodes.addAll(nodes);
-    }
+    @Override
+    public JSONObject toJSON() throws JSONException {
+        JSONObject json = new JSONObject();
 
-    public void markNodeComplete(String nodeId) {
-        pendingNodes.remove(nodeId);
-    }
+        json.put("type", "joblet-profile");
+        json.put("stage-id", stageId.toString());
+        populateCounters(json);
 
-    public boolean stageComplete() {
-        return pendingNodes.isEmpty();
+        return json;
     }
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/pom.xml b/hyracks/hyracks-control-cc/pom.xml
index e639a1f..9af88b1 100644
--- a/hyracks/hyracks-control-cc/pom.xml
+++ b/hyracks/hyracks-control-cc/pom.xml
@@ -32,13 +32,6 @@
   		<scope>compile</scope>
   	</dependency>
   	<dependency>
-  		<groupId>jol</groupId>
-  		<artifactId>jol</artifactId>
-  		<version>1.0.0</version>
-  		<type>jar</type>
-  		<scope>compile</scope>
-  	</dependency>
-  	<dependency>
   		<groupId>org.eclipse.jetty</groupId>
   		<artifactId>jetty-server</artifactId>
   		<version>8.0.0.M1</version>
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java
index f577c97..a4aa482 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java
@@ -14,72 +14,56 @@
  */
 package edu.uci.ics.hyracks.control.cc;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
 import java.rmi.registry.LocateRegistry;
 import java.rmi.registry.Registry;
-import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.Timer;
 import java.util.TimerTask;
 import java.util.UUID;
-import java.util.Vector;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
-import java.util.concurrent.Semaphore;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import jol.core.Runtime;
-import jol.core.Runtime.DebugLevel;
-
-import org.apache.commons.io.IOUtils;
-import org.eclipse.jetty.http.HttpMethods;
-import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.handler.AbstractHandler;
-import org.eclipse.jetty.server.handler.ContextHandler;
-import org.json.JSONObject;
-
 import edu.uci.ics.hyracks.api.client.ClusterControllerInfo;
 import edu.uci.ics.hyracks.api.client.IHyracksClientInterface;
-import edu.uci.ics.hyracks.api.comm.Endpoint;
 import edu.uci.ics.hyracks.api.control.CCConfig;
 import edu.uci.ics.hyracks.api.control.IClusterController;
 import edu.uci.ics.hyracks.api.control.INodeController;
 import edu.uci.ics.hyracks.api.control.NodeParameters;
-import edu.uci.ics.hyracks.api.dataflow.ActivityNodeId;
-import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
-import edu.uci.ics.hyracks.api.dataflow.PortInstanceId;
 import edu.uci.ics.hyracks.api.exceptions.HyracksException;
 import edu.uci.ics.hyracks.api.job.JobFlag;
-import edu.uci.ics.hyracks.api.job.JobPlan;
-import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.api.job.JobStatus;
-import edu.uci.ics.hyracks.api.util.JavaSerializationUtils;
+import edu.uci.ics.hyracks.api.job.profiling.om.JobProfile;
+import edu.uci.ics.hyracks.api.job.profiling.om.StageletProfile;
 import edu.uci.ics.hyracks.control.cc.application.CCApplicationContext;
+import edu.uci.ics.hyracks.control.cc.job.IJobStatusConditionVariable;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.ApplicationDestroyEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.ApplicationStartEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.GetJobStatusConditionVariableEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.GetJobStatusEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.JobCreateEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.JobStartEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.NodeHeartbeatEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.RegisterNodeEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.RemoveDeadNodesEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.ReportProfilesEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.StageletCompleteEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.StageletFailureEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.UnregisterNodeEvent;
+import edu.uci.ics.hyracks.control.cc.jobqueue.FutureValue;
+import edu.uci.ics.hyracks.control.cc.jobqueue.JobQueue;
+import edu.uci.ics.hyracks.control.cc.scheduler.IScheduler;
+import edu.uci.ics.hyracks.control.cc.scheduler.naive.NaiveScheduler;
 import edu.uci.ics.hyracks.control.cc.web.WebServer;
-import edu.uci.ics.hyracks.control.cc.web.handlers.util.IJSONOutputFunction;
-import edu.uci.ics.hyracks.control.cc.web.handlers.util.JSONOutputRequestHandler;
-import edu.uci.ics.hyracks.control.cc.web.handlers.util.RoutingHandler;
 import edu.uci.ics.hyracks.control.common.AbstractRemoteService;
-import edu.uci.ics.hyracks.control.common.application.ApplicationContext;
 import edu.uci.ics.hyracks.control.common.context.ServerContext;
 
 public class ClusterControllerService extends AbstractRemoteService implements IClusterController,
@@ -96,32 +80,31 @@
 
     private final ServerContext serverCtx;
 
-    private WebServer webServer;
+    private final WebServer webServer;
 
     private ClusterControllerInfo info;
 
-    private final IJobManager jobManager;
+    private final Map<UUID, JobRun> runMap;
+
+    private final JobQueue jobQueue;
+
+    private final IScheduler scheduler;
 
     private final Executor taskExecutor;
 
     private final Timer timer;
 
-    private Runtime jolRuntime;
-
     public ClusterControllerService(CCConfig ccConfig) throws Exception {
         this.ccConfig = ccConfig;
         nodeRegistry = new LinkedHashMap<String, NodeControllerState>();
         applications = new Hashtable<String, CCApplicationContext>();
         serverCtx = new ServerContext(ServerContext.ServerType.CLUSTER_CONTROLLER, new File(
                 ClusterControllerService.class.getName()));
-        Set<DebugLevel> jolDebugLevel = LOGGER.isLoggable(Level.FINE) ? Runtime.DEBUG_ALL : new HashSet<DebugLevel>();
-        jolRuntime = (Runtime) Runtime.create(jolDebugLevel, System.err);
-        jobManager = new JOLJobManagerImpl(this, jolRuntime);
         taskExecutor = Executors.newCachedThreadPool();
-        webServer = new WebServer();
-        webServer.addHandler(getAdminConsoleHandler());
-        webServer.addHandler(getApplicationInstallationHandler());
-        webServer.addHandler(getRestAPIHandler());
+        webServer = new WebServer(this);
+        runMap = new HashMap<UUID, JobRun>();
+        jobQueue = new JobQueue();
+        scheduler = new NaiveScheduler(this);
         this.timer = new Timer(true);
     }
 
@@ -146,35 +129,49 @@
         LOGGER.log(Level.INFO, "Stopped ClusterControllerService");
     }
 
-    @Override
-    public UUID createJob(String appName, byte[] jobSpec, EnumSet<JobFlag> jobFlags) throws Exception {
-        CCApplicationContext appCtx = getApplicationContext(appName);
-        if (appCtx == null) {
-            throw new HyracksException("No application with id " + appName + " found");
-        }
-        UUID jobId = UUID.randomUUID();
-        JobSpecification specification = appCtx.createJobSpecification(jobId, jobSpec);
-        jobManager.createJob(jobId, appName, specification, jobFlags);
-        appCtx.notifyJobCreation(jobId, specification);
-        return jobId;
+    public Map<String, CCApplicationContext> getApplicationMap() {
+        return applications;
     }
 
-    public synchronized CCApplicationContext getApplicationContext(String appName) {
-        return applications.get(appName);
+    public Map<UUID, JobRun> getRunMap() {
+        return runMap;
+    }
+
+    public JobQueue getJobQueue() {
+        return jobQueue;
+    }
+
+    public IScheduler getScheduler() {
+        return scheduler;
+    }
+
+    public Executor getExecutor() {
+        return taskExecutor;
+    }
+
+    public Map<String, NodeControllerState> getNodeMap() {
+        return nodeRegistry;
+    }
+
+    public CCConfig getConfig() {
+        return ccConfig;
+    }
+
+    @Override
+    public UUID createJob(String appName, byte[] jobSpec, EnumSet<JobFlag> jobFlags) throws Exception {
+        UUID jobId = UUID.randomUUID();
+        JobCreateEvent jce = new JobCreateEvent(this, jobId, appName, jobSpec, jobFlags);
+        jobQueue.schedule(jce);
+        jce.sync();
+        return jobId;
     }
 
     @Override
     public NodeParameters registerNode(INodeController nodeController) throws Exception {
         String id = nodeController.getId();
         NodeControllerState state = new NodeControllerState(nodeController);
-        synchronized (this) {
-            if (nodeRegistry.containsKey(id)) {
-                throw new Exception("Node with this name already registered.");
-            }
-            nodeRegistry.put(id, state);
-        }
+        jobQueue.scheduleAndSync(new RegisterNodeEvent(this, id, state));
         nodeController.notifyRegistration(this);
-        jobManager.registerNode(id);
         LOGGER.log(Level.INFO, "Registered INodeController: id = " + id);
         NodeParameters params = new NodeParameters();
         params.setClusterControllerInfo(info);
@@ -186,188 +183,49 @@
     @Override
     public void unregisterNode(INodeController nodeController) throws Exception {
         String id = nodeController.getId();
-        synchronized (this) {
-            nodeRegistry.remove(id);
-        }
+        jobQueue.scheduleAndSync(new UnregisterNodeEvent(this, id));
         LOGGER.log(Level.INFO, "Unregistered INodeController");
     }
 
-    public synchronized NodeControllerState lookupNode(String id) throws Exception {
-        return nodeRegistry.get(id);
-    }
-
-    public Executor getExecutor() {
-        return taskExecutor;
-    }
-
-    public synchronized void notifyJobComplete(final UUID jobId) {
-        for (final NodeControllerState ns : nodeRegistry.values()) {
-            taskExecutor.execute(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        ns.getNodeController().cleanUpJob(jobId);
-                    } catch (Exception e) {
-                    }
-                }
-            });
-        }
-    }
-
     @Override
-    public void notifyStageletComplete(UUID jobId, UUID stageId, int attempt, String nodeId,
-            Map<String, Long> statistics) throws Exception {
-        jobManager.notifyStageletComplete(jobId, stageId, attempt, nodeId, statistics);
+    public void notifyStageletComplete(UUID jobId, UUID stageId, int attempt, String nodeId, StageletProfile statistics)
+            throws Exception {
+        StageletCompleteEvent sce = new StageletCompleteEvent(this, jobId, stageId, attempt, nodeId);
+        jobQueue.schedule(sce);
     }
 
     @Override
     public void notifyStageletFailure(UUID jobId, UUID stageId, int attempt, String nodeId) throws Exception {
-        jobManager.notifyStageletFailure(jobId, stageId, attempt, nodeId);
+        StageletFailureEvent sfe = new StageletFailureEvent(this, jobId, stageId, attempt, nodeId);
+        jobQueue.schedule(sfe);
     }
 
     @Override
     public JobStatus getJobStatus(UUID jobId) throws Exception {
-        return jobManager.getJobStatus(jobId);
+        GetJobStatusEvent gse = new GetJobStatusEvent(this, jobId);
+        jobQueue.scheduleAndSync(gse);
+        return gse.getStatus();
     }
 
     @Override
     public void start(UUID jobId) throws Exception {
-        jobManager.start(jobId);
+        JobStartEvent jse = new JobStartEvent(this, jobId);
+        jobQueue.scheduleAndSync(jse);
     }
 
     @Override
     public void waitForCompletion(UUID jobId) throws Exception {
-        jobManager.waitForCompletion(jobId);
+        GetJobStatusConditionVariableEvent e = new GetJobStatusConditionVariableEvent(this, jobId);
+        jobQueue.scheduleAndSync(e);
+        IJobStatusConditionVariable var = e.getConditionVariable();
+        if (var != null) {
+            var.waitForCompletion();
+        }
     }
 
     @Override
-    public void reportProfile(String id, Map<UUID, Map<String, Long>> counterDump) throws Exception {
-        if (LOGGER.isLoggable(Level.INFO)) {
-            LOGGER.info("Profile: " + id + ": " + counterDump);
-        }
-        jobManager.reportProfile(id, counterDump);
-    }
-
-    private Handler getRestAPIHandler() {
-        ContextHandler handler = new ContextHandler("/state");
-        RoutingHandler rh = new RoutingHandler();
-        rh.addHandler("jobs", new JSONOutputRequestHandler(new IJSONOutputFunction() {
-            @Override
-            public JSONObject invoke(String[] arguments) throws Exception {
-                JSONObject result = new JSONObject();
-                switch (arguments.length) {
-                    case 1:
-                        if (!"".equals(arguments[0])) {
-                            break;
-                        }
-                    case 0:
-                        result.put("result", jobManager.getQueryInterface().getAllJobSummaries());
-                        break;
-
-                    case 2:
-                        UUID jobId = UUID.fromString(arguments[0]);
-
-                        if ("spec".equalsIgnoreCase(arguments[1])) {
-                            result.put("result", jobManager.getQueryInterface().getJobSpecification(jobId));
-                        } else if ("profile".equalsIgnoreCase(arguments[1])) {
-                            result.put("result", jobManager.getQueryInterface().getJobProfile(jobId));
-                        }
-                }
-                return result;
-            }
-        }));
-        handler.setHandler(rh);
-        return handler;
-    }
-
-    private Handler getAdminConsoleHandler() {
-        ContextHandler handler = new ContextHandler("/admin");
-        handler.setHandler(new AbstractHandler() {
-            @Override
-            public void handle(String target, Request baseRequest, HttpServletRequest request,
-                    HttpServletResponse response) throws IOException, ServletException {
-                if (!"/".equals(target)) {
-                    return;
-                }
-                response.setContentType("text/html;charset=utf-8");
-                response.setStatus(HttpServletResponse.SC_OK);
-                baseRequest.setHandled(true);
-                PrintWriter writer = response.getWriter();
-                writer.println("<html><head><title>Hyracks Admin Console</title></head><body>");
-                writer.println("<h1>Hyracks Admin Console</h1>");
-                writer.println("<h2>Node Controllers</h2>");
-                writer.println("<table><tr><td>Node Id</td><td>Host</td></tr>");
-                synchronized (ClusterControllerService.this) {
-                    for (Map.Entry<String, NodeControllerState> e : nodeRegistry.entrySet()) {
-                        try {
-                            writer.print("<tr><td>");
-                            writer.print(e.getKey());
-                            writer.print("</td><td>");
-                            writer.print(e.getValue().getLastHeartbeatDuration());
-                            writer.print("</td></tr>");
-                        } catch (Exception ex) {
-                        }
-                    }
-                }
-                writer.println("</table>");
-                writer.println("</body></html>");
-                writer.flush();
-            }
-        });
-        return handler;
-    }
-
-    private Handler getApplicationInstallationHandler() {
-        ContextHandler handler = new ContextHandler("/applications");
-        handler.setHandler(new AbstractHandler() {
-            @Override
-            public void handle(String target, Request baseRequest, HttpServletRequest request,
-                    HttpServletResponse response) throws IOException, ServletException {
-                try {
-                    while (target.startsWith("/")) {
-                        target = target.substring(1);
-                    }
-                    while (target.endsWith("/")) {
-                        target = target.substring(0, target.length() - 1);
-                    }
-                    String[] parts = target.split("/");
-                    if (parts.length != 1) {
-                        return;
-                    }
-                    String appName = parts[0];
-                    ApplicationContext appCtx;
-                    appCtx = getApplicationContext(appName);
-                    if (appCtx != null) {
-                        if (HttpMethods.PUT.equals(request.getMethod())) {
-                            OutputStream os = appCtx.getHarOutputStream();
-                            try {
-                                IOUtils.copyLarge(request.getInputStream(), os);
-                            } finally {
-                                os.close();
-                            }
-                        } else if (HttpMethods.GET.equals(request.getMethod())) {
-                            if (!appCtx.containsHar()) {
-                                response.setStatus(HttpServletResponse.SC_NOT_FOUND);
-                            } else {
-                                InputStream is = appCtx.getHarInputStream();
-                                response.setContentType("application/octet-stream");
-                                response.setStatus(HttpServletResponse.SC_OK);
-                                try {
-                                    IOUtils.copyLarge(is, response.getOutputStream());
-                                } finally {
-                                    is.close();
-                                }
-                            }
-                        }
-                        baseRequest.setHandled(true);
-                    }
-                } catch (IOException e) {
-                    e.printStackTrace();
-                    throw e;
-                }
-            }
-        });
-        return handler;
+    public void reportProfile(String id, List<JobProfile> profiles) throws Exception {
+        jobQueue.schedule(new ReportProfilesEvent(this, profiles));
     }
 
     @Override
@@ -375,15 +233,7 @@
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("Heartbeat from: " + id);
         }
-        NodeControllerState ns = nodeRegistry.get(id);
-        if (ns != null) {
-            ns.notifyHeartbeat();
-        }
-    }
-
-    private void killNode(String nodeId) throws Exception {
-        nodeRegistry.remove(nodeId);
-        jobManager.notifyNodeFailure(nodeId);
+        jobQueue.schedule(new NodeHeartbeatEvent(this, id));
     }
 
     @Override
@@ -399,44 +249,16 @@
 
     @Override
     public void destroyApplication(String appName) throws Exception {
-        ApplicationContext appCtx = applications.remove(appName);
-        if (appCtx != null) {
-            synchronized (this) {
-                for (NodeControllerState ncs : nodeRegistry.values()) {
-                    ncs.getNodeController().destroyApplication(appName);
-                }
-            }
-            appCtx.deinitialize();
-        }
+        FutureValue fv = new FutureValue();
+        jobQueue.schedule(new ApplicationDestroyEvent(this, appName, fv));
+        fv.get();
     }
 
     @Override
     public void startApplication(final String appName) throws Exception {
-        ApplicationContext appCtx = getApplicationContext(appName);
-        appCtx.initializeClassPath();
-        appCtx.initialize();
-        final byte[] serializedDistributedState = JavaSerializationUtils.serialize(appCtx.getDestributedState());
-        final boolean deployHar = appCtx.containsHar();
-        RemoteOp<Void>[] ops;
-        synchronized (this) {
-            List<RemoteOp<Void>> opList = new ArrayList<RemoteOp<Void>>();
-            for (final String nodeId : nodeRegistry.keySet()) {
-                opList.add(new RemoteOp<Void>() {
-                    @Override
-                    public String getNodeId() {
-                        return nodeId;
-                    }
-
-                    @Override
-                    public Void execute(INodeController node) throws Exception {
-                        node.createApplication(appName, deployHar, serializedDistributedState);
-                        return null;
-                    }
-                });
-            }
-            ops = opList.toArray(new RemoteOp[opList.size()]);
-        }
-        runRemote(ops, null);
+        FutureValue fv = new FutureValue();
+        jobQueue.schedule(new ApplicationStartEvent(this, appName, fv));
+        fv.get();
     }
 
     @Override
@@ -447,282 +269,7 @@
     private class DeadNodeSweeper extends TimerTask {
         @Override
         public void run() {
-            Set<String> deadNodes = new HashSet<String>();
-            synchronized (ClusterControllerService.this) {
-                for (Map.Entry<String, NodeControllerState> e : nodeRegistry.entrySet()) {
-                    NodeControllerState state = e.getValue();
-                    if (state.incrementLastHeartbeatDuration() >= ccConfig.maxHeartbeatLapsePeriods) {
-                        deadNodes.add(e.getKey());
-                    }
-                }
-                for (String deadNode : deadNodes) {
-                    try {
-                        if (LOGGER.isLoggable(Level.INFO)) {
-                            LOGGER.info("Killing node: " + deadNode);
-                        }
-                        killNode(deadNode);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-            }
-        }
-    }
-
-    interface RemoteOp<T> {
-        public String getNodeId();
-
-        public T execute(INodeController node) throws Exception;
-    }
-
-    interface Accumulator<T, R> {
-        public void accumulate(T o);
-
-        public R getResult();
-    }
-
-    <T, R> R runRemote(final RemoteOp<T>[] remoteOps, final Accumulator<T, R> accumulator) throws Exception {
-        final Semaphore installComplete = new Semaphore(remoteOps.length);
-        final List<Exception> errors = new Vector<Exception>();
-        for (final RemoteOp<T> remoteOp : remoteOps) {
-            NodeControllerState nodeState = lookupNode(remoteOp.getNodeId());
-            final INodeController node = nodeState.getNodeController();
-
-            installComplete.acquire();
-            Runnable remoteRunner = new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        T t = remoteOp.execute(node);
-                        if (accumulator != null) {
-                            synchronized (accumulator) {
-                                accumulator.accumulate(t);
-                            }
-                        }
-                    } catch (Exception e) {
-                        errors.add(e);
-                    } finally {
-                        installComplete.release();
-                    }
-                }
-            };
-
-            getExecutor().execute(remoteRunner);
-        }
-        installComplete.acquire(remoteOps.length);
-        if (!errors.isEmpty()) {
-            throw errors.get(0);
-        }
-        return accumulator == null ? null : accumulator.getResult();
-    }
-
-    private static byte[] serialize(Object o) throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream oos = new ObjectOutputStream(baos);
-        oos.writeObject(o);
-        return baos.toByteArray();
-    }
-
-    static class Phase1Installer implements RemoteOp<Map<PortInstanceId, Endpoint>> {
-        private String nodeId;
-        private UUID jobId;
-        private String appName;
-        private JobPlan plan;
-        private UUID stageId;
-        private int attempt;
-        private Map<ActivityNodeId, Set<Integer>> tasks;
-        private Map<OperatorDescriptorId, Set<Integer>> opPartitions;
-
-        public Phase1Installer(String nodeId, UUID jobId, String appName, JobPlan plan, UUID stageId, int attempt,
-                Map<ActivityNodeId, Set<Integer>> tasks, Map<OperatorDescriptorId, Set<Integer>> opPartitions) {
-            this.nodeId = nodeId;
-            this.jobId = jobId;
-            this.appName = appName;
-            this.plan = plan;
-            this.stageId = stageId;
-            this.attempt = attempt;
-            this.tasks = tasks;
-            this.opPartitions = opPartitions;
-        }
-
-        @Override
-        public Map<PortInstanceId, Endpoint> execute(INodeController node) throws Exception {
-            return node.initializeJobletPhase1(appName, jobId, attempt, serialize(plan), stageId, tasks, opPartitions);
-        }
-
-        @Override
-        public String toString() {
-            return jobId + " Distribution Phase 1";
-        }
-
-        @Override
-        public String getNodeId() {
-            return nodeId;
-        }
-    }
-
-    static class Phase2Installer implements RemoteOp<Void> {
-        private String nodeId;
-        private UUID jobId;
-        private String appName;
-        private JobPlan plan;
-        private UUID stageId;
-        private Map<ActivityNodeId, Set<Integer>> tasks;
-        private Map<OperatorDescriptorId, Set<Integer>> opPartitions;
-        private Map<PortInstanceId, Endpoint> globalPortMap;
-
-        public Phase2Installer(String nodeId, UUID jobId, String appName, JobPlan plan, UUID stageId,
-                Map<ActivityNodeId, Set<Integer>> tasks, Map<OperatorDescriptorId, Set<Integer>> opPartitions,
-                Map<PortInstanceId, Endpoint> globalPortMap) {
-            this.nodeId = nodeId;
-            this.jobId = jobId;
-            this.appName = appName;
-            this.plan = plan;
-            this.stageId = stageId;
-            this.tasks = tasks;
-            this.opPartitions = opPartitions;
-            this.globalPortMap = globalPortMap;
-        }
-
-        @Override
-        public Void execute(INodeController node) throws Exception {
-            node.initializeJobletPhase2(appName, jobId, serialize(plan), stageId, tasks, opPartitions, globalPortMap);
-            return null;
-        }
-
-        @Override
-        public String toString() {
-            return jobId + " Distribution Phase 2";
-        }
-
-        @Override
-        public String getNodeId() {
-            return nodeId;
-        }
-    }
-
-    static class Phase3Installer implements RemoteOp<Void> {
-        private String nodeId;
-        private UUID jobId;
-        private UUID stageId;
-
-        public Phase3Installer(String nodeId, UUID jobId, UUID stageId) {
-            this.nodeId = nodeId;
-            this.jobId = jobId;
-            this.stageId = stageId;
-        }
-
-        @Override
-        public Void execute(INodeController node) throws Exception {
-            node.commitJobletInitialization(jobId, stageId);
-            return null;
-        }
-
-        @Override
-        public String toString() {
-            return jobId + " Distribution Phase 3";
-        }
-
-        @Override
-        public String getNodeId() {
-            return nodeId;
-        }
-    }
-
-    static class StageStarter implements RemoteOp<Void> {
-        private String nodeId;
-        private UUID jobId;
-        private UUID stageId;
-
-        public StageStarter(String nodeId, UUID jobId, UUID stageId) {
-            this.nodeId = nodeId;
-            this.jobId = jobId;
-            this.stageId = stageId;
-        }
-
-        @Override
-        public Void execute(INodeController node) throws Exception {
-            node.startStage(jobId, stageId);
-            return null;
-        }
-
-        @Override
-        public String toString() {
-            return jobId + " Started Stage: " + stageId;
-        }
-
-        @Override
-        public String getNodeId() {
-            return nodeId;
-        }
-    }
-
-    static class JobletAborter implements RemoteOp<Void> {
-        private String nodeId;
-        private UUID jobId;
-        private UUID stageId;
-
-        public JobletAborter(String nodeId, UUID jobId, UUID stageId, int attempt) {
-            this.nodeId = nodeId;
-            this.jobId = jobId;
-            this.stageId = stageId;
-        }
-
-        @Override
-        public Void execute(INodeController node) throws Exception {
-            node.abortJoblet(jobId, stageId);
-            return null;
-        }
-
-        @Override
-        public String toString() {
-            return jobId + " Aborting";
-        }
-
-        @Override
-        public String getNodeId() {
-            return nodeId;
-        }
-    }
-
-    static class JobCompleteNotifier implements RemoteOp<Void> {
-        private String nodeId;
-        private UUID jobId;
-
-        public JobCompleteNotifier(String nodeId, UUID jobId) {
-            this.nodeId = nodeId;
-            this.jobId = jobId;
-        }
-
-        @Override
-        public Void execute(INodeController node) throws Exception {
-            node.cleanUpJob(jobId);
-            return null;
-        }
-
-        @Override
-        public String toString() {
-            return jobId + " Cleaning Up";
-        }
-
-        @Override
-        public String getNodeId() {
-            return nodeId;
-        }
-    }
-
-    static class PortMapMergingAccumulator implements
-            Accumulator<Map<PortInstanceId, Endpoint>, Map<PortInstanceId, Endpoint>> {
-        Map<PortInstanceId, Endpoint> portMap = new HashMap<PortInstanceId, Endpoint>();
-
-        @Override
-        public void accumulate(Map<PortInstanceId, Endpoint> o) {
-            portMap.putAll(o);
-        }
-
-        @Override
-        public Map<PortInstanceId, Endpoint> getResult() {
-            return portMap;
+            jobQueue.schedule(new RemoveDeadNodesEvent(ClusterControllerService.this));
         }
     }
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JOLJobManagerImpl.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JOLJobManagerImpl.java
deleted file mode 100644
index 2eabaf1..0000000
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JOLJobManagerImpl.java
+++ /dev/null
@@ -1,1181 +0,0 @@
-/*
- * Copyright 2009-2010 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.control.cc;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.logging.Logger;
-
-import jol.core.Runtime;
-import jol.types.basic.BasicTupleSet;
-import jol.types.basic.Tuple;
-import jol.types.basic.TupleSet;
-import jol.types.exception.BadKeyException;
-import jol.types.exception.UpdateException;
-import jol.types.table.BasicTable;
-import jol.types.table.EventTable;
-import jol.types.table.Function;
-import jol.types.table.Key;
-import jol.types.table.TableName;
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-
-import edu.uci.ics.hyracks.api.comm.Endpoint;
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ChoiceLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionCountConstraint;
-import edu.uci.ics.hyracks.api.dataflow.ActivityNodeId;
-import edu.uci.ics.hyracks.api.dataflow.ConnectorDescriptorId;
-import edu.uci.ics.hyracks.api.dataflow.Direction;
-import edu.uci.ics.hyracks.api.dataflow.IActivityGraphBuilder;
-import edu.uci.ics.hyracks.api.dataflow.IActivityNode;
-import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
-import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
-import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
-import edu.uci.ics.hyracks.api.dataflow.PortInstanceId;
-import edu.uci.ics.hyracks.api.job.JobFlag;
-import edu.uci.ics.hyracks.api.job.JobPlan;
-import edu.uci.ics.hyracks.api.job.JobSpecification;
-import edu.uci.ics.hyracks.api.job.JobStatus;
-import edu.uci.ics.hyracks.control.cc.application.CCApplicationContext;
-
-public class JOLJobManagerImpl implements IJobManager {
-    private static final Logger LOGGER = Logger.getLogger(JOLJobManagerImpl.class.getName());
-
-    public static final String JOL_SCOPE = "hyrackscc";
-
-    private static final String SCHEDULER_OLG_FILE = "edu/uci/ics/hyracks/control/cc/scheduler.olg";
-
-    private final Runtime jolRuntime;
-
-    private final LinkedBlockingQueue<Runnable> jobQueue;
-
-    private final JobTable jobTable;
-
-    private final JobQueueThread jobQueueThread;
-
-    private final OperatorDescriptorTable odTable;
-
-    private final OperatorLocationTable olTable;
-
-    private final OperatorCloneCountTable ocTable;
-
-    private final ConnectorDescriptorTable cdTable;
-
-    private final ActivityNodeTable anTable;
-
-    private final ActivityConnectionTable acTable;
-
-    private final ActivityBlockedTable abTable;
-
-    private final JobStartTable jobStartTable;
-
-    private final JobCleanUpTable jobCleanUpTable;
-
-    private final JobCleanUpCompleteTable jobCleanUpCompleteTable;
-
-    private final StartMessageTable startMessageTable;
-
-    private final StageletCompleteTable stageletCompleteTable;
-
-    private final StageletFailureTable stageletFailureTable;
-
-    private final AvailableNodesTable availableNodesTable;
-
-    private final RankedAvailableNodesTable rankedAvailableNodesTable;
-
-    private final FailedNodesTable failedNodesTable;
-
-    private final AbortMessageTable abortMessageTable;
-
-    private final AbortNotifyTable abortNotifyTable;
-
-    private final ExpandPartitionCountConstraintTableFunction expandPartitionCountConstraintFunction;
-
-    private final ProfileUpdateTable puTable;
-
-    private final List<String> rankedAvailableNodes;
-
-    private final IJobManagerQueryInterface qi;
-
-    public JOLJobManagerImpl(final ClusterControllerService ccs, final Runtime jolRuntime) throws Exception {
-        this.jolRuntime = jolRuntime;
-        jobQueue = new LinkedBlockingQueue<Runnable>();
-        jobQueueThread = new JobQueueThread();
-        jobQueueThread.start();
-
-        this.jobTable = new JobTable(jolRuntime);
-        this.odTable = new OperatorDescriptorTable(jolRuntime);
-        this.olTable = new OperatorLocationTable(jolRuntime);
-        this.ocTable = new OperatorCloneCountTable(jolRuntime);
-        this.cdTable = new ConnectorDescriptorTable(jolRuntime);
-        this.anTable = new ActivityNodeTable(jolRuntime);
-        this.acTable = new ActivityConnectionTable(jolRuntime);
-        this.abTable = new ActivityBlockedTable(jolRuntime);
-        this.jobStartTable = new JobStartTable();
-        this.jobCleanUpTable = new JobCleanUpTable(jolRuntime);
-        this.jobCleanUpCompleteTable = new JobCleanUpCompleteTable();
-        this.startMessageTable = new StartMessageTable(jolRuntime);
-        this.stageletCompleteTable = new StageletCompleteTable(jolRuntime);
-        this.stageletFailureTable = new StageletFailureTable(jolRuntime);
-        this.availableNodesTable = new AvailableNodesTable(jolRuntime);
-        this.rankedAvailableNodesTable = new RankedAvailableNodesTable(jolRuntime);
-        this.failedNodesTable = new FailedNodesTable(jolRuntime);
-        this.abortMessageTable = new AbortMessageTable(jolRuntime);
-        this.abortNotifyTable = new AbortNotifyTable(jolRuntime);
-        this.expandPartitionCountConstraintFunction = new ExpandPartitionCountConstraintTableFunction();
-        this.puTable = new ProfileUpdateTable();
-        this.rankedAvailableNodes = new ArrayList<String>();
-
-        jolRuntime.catalog().register(jobTable);
-        jolRuntime.catalog().register(odTable);
-        jolRuntime.catalog().register(olTable);
-        jolRuntime.catalog().register(ocTable);
-        jolRuntime.catalog().register(cdTable);
-        jolRuntime.catalog().register(anTable);
-        jolRuntime.catalog().register(acTable);
-        jolRuntime.catalog().register(abTable);
-        jolRuntime.catalog().register(jobStartTable);
-        jolRuntime.catalog().register(jobCleanUpTable);
-        jolRuntime.catalog().register(jobCleanUpCompleteTable);
-        jolRuntime.catalog().register(startMessageTable);
-        jolRuntime.catalog().register(stageletCompleteTable);
-        jolRuntime.catalog().register(stageletFailureTable);
-        jolRuntime.catalog().register(availableNodesTable);
-        jolRuntime.catalog().register(rankedAvailableNodesTable);
-        jolRuntime.catalog().register(failedNodesTable);
-        jolRuntime.catalog().register(abortMessageTable);
-        jolRuntime.catalog().register(abortNotifyTable);
-        jolRuntime.catalog().register(expandPartitionCountConstraintFunction);
-        jolRuntime.catalog().register(puTable);
-
-        jobTable.register(new JobTable.Callback() {
-            @Override
-            public void deletion(TupleSet arg0) {
-                jobTable.notifyAll();
-            }
-
-            @Override
-            public void insertion(TupleSet arg0) {
-                jobTable.notifyAll();
-            }
-        });
-
-        startMessageTable.register(new StartMessageTable.Callback() {
-            @Override
-            public void deletion(TupleSet tuples) {
-
-            }
-
-            @SuppressWarnings("unchecked")
-            @Override
-            public void insertion(TupleSet tuples) {
-                for (final Tuple t : tuples) {
-                    jobQueue.add(new Runnable() {
-                        @Override
-                        public void run() {
-                            try {
-                                Object[] data = t.toArray();
-                                UUID jobId = (UUID) data[0];
-                                UUID stageId = (UUID) data[1];
-                                Integer attempt = (Integer) data[2];
-                                String appName = (String) data[3];
-                                JobPlan plan = (JobPlan) data[4];
-                                Set<List> ts = (Set<List>) data[5];
-                                Map<OperatorDescriptorId, Set<Integer>> opPartitions = new HashMap<OperatorDescriptorId, Set<Integer>>();
-                                for (List t2 : ts) {
-                                    Object[] t2Data = t2.toArray();
-                                    Set<List> activityInfoSet = (Set<List>) t2Data[1];
-                                    for (List l : activityInfoSet) {
-                                        Object[] lData = l.toArray();
-                                        ActivityNodeId aid = (ActivityNodeId) lData[0];
-                                        Set<Integer> opParts = opPartitions.get(aid.getOperatorDescriptorId());
-                                        if (opParts == null) {
-                                            opParts = new HashSet<Integer>();
-                                            opPartitions.put(aid.getOperatorDescriptorId(), opParts);
-                                        }
-                                        opParts.add((Integer) lData[1]);
-                                    }
-                                }
-                                ClusterControllerService.Phase1Installer[] p1is = new ClusterControllerService.Phase1Installer[ts
-                                        .size()];
-                                int i = 0;
-                                for (List t2 : ts) {
-                                    Object[] t2Data = t2.toArray();
-                                    Map<ActivityNodeId, Set<Integer>> tasks = new HashMap<ActivityNodeId, Set<Integer>>();
-                                    Set<List> activityInfoSet = (Set<List>) t2Data[1];
-                                    for (List l : activityInfoSet) {
-                                        Object[] lData = l.toArray();
-                                        ActivityNodeId aid = (ActivityNodeId) lData[0];
-                                        Set<Integer> aParts = tasks.get(aid);
-                                        if (aParts == null) {
-                                            aParts = new HashSet<Integer>();
-                                            tasks.put(aid, aParts);
-                                        }
-                                        aParts.add((Integer) lData[1]);
-                                    }
-                                    p1is[i++] = new ClusterControllerService.Phase1Installer((String) t2Data[0], jobId,
-                                            appName, plan, stageId, attempt, tasks, opPartitions);
-                                }
-                                LOGGER.info("Stage start - Phase 1");
-                                Map<PortInstanceId, Endpoint> globalPortMap = ccs.runRemote(p1is,
-                                        new ClusterControllerService.PortMapMergingAccumulator());
-
-                                ClusterControllerService.Phase2Installer[] p2is = new ClusterControllerService.Phase2Installer[ts
-                                        .size()];
-                                ClusterControllerService.Phase3Installer[] p3is = new ClusterControllerService.Phase3Installer[ts
-                                        .size()];
-                                ClusterControllerService.StageStarter[] ss = new ClusterControllerService.StageStarter[ts
-                                        .size()];
-                                i = 0;
-                                for (List t2 : ts) {
-                                    Object[] t2Data = t2.toArray();
-                                    Map<ActivityNodeId, Set<Integer>> tasks = new HashMap<ActivityNodeId, Set<Integer>>();
-                                    Set<List> activityInfoSet = (Set<List>) t2Data[1];
-                                    for (List l : activityInfoSet) {
-                                        Object[] lData = l.toArray();
-                                        ActivityNodeId aid = (ActivityNodeId) lData[0];
-                                        Set<Integer> aParts = tasks.get(aid);
-                                        if (aParts == null) {
-                                            aParts = new HashSet<Integer>();
-                                            tasks.put(aid, aParts);
-                                        }
-                                        aParts.add((Integer) lData[1]);
-                                    }
-                                    p2is[i] = new ClusterControllerService.Phase2Installer((String) t2Data[0], jobId,
-                                            appName, plan, stageId, tasks, opPartitions, globalPortMap);
-                                    p3is[i] = new ClusterControllerService.Phase3Installer((String) t2Data[0], jobId,
-                                            stageId);
-                                    ss[i] = new ClusterControllerService.StageStarter((String) t2Data[0], jobId,
-                                            stageId);
-                                    ++i;
-                                }
-                                LOGGER.info("Stage start - Phase 2");
-                                ccs.runRemote(p2is, null);
-                                LOGGER.info("Stage start - Phase 3");
-                                ccs.runRemote(p3is, null);
-                                LOGGER.info("Stage start");
-                                ccs.runRemote(ss, null);
-                                LOGGER.info("Stage started");
-                            } catch (Exception e) {
-                            }
-                        }
-                    });
-                }
-            }
-        });
-
-        jobCleanUpTable.register(new JobCleanUpTable.Callback() {
-            @Override
-            public void deletion(TupleSet tuples) {
-            }
-
-            @SuppressWarnings("unchecked")
-            @Override
-            public void insertion(TupleSet tuples) {
-                for (final Tuple t : tuples) {
-                    jobQueue.add(new Runnable() {
-                        @Override
-                        public void run() {
-                            try {
-                                Object[] data = t.toArray();
-                                UUID jobId = (UUID) data[0];
-                                String appName = (String) data[1];
-                                Set<String> ts = (Set<String>) data[2];
-                                ClusterControllerService.JobCompleteNotifier[] jcns = new ClusterControllerService.JobCompleteNotifier[ts
-                                        .size()];
-                                int i = 0;
-                                for (String n : ts) {
-                                    jcns[i++] = new ClusterControllerService.JobCompleteNotifier(n, jobId);
-                                }
-                                try {
-                                    ccs.runRemote(jcns, null);
-                                } finally {
-                                    BasicTupleSet jccTuples = new BasicTupleSet(JobCleanUpCompleteTable
-                                            .createTuple(jobId));
-                                    jolRuntime.schedule(JOL_SCOPE, JobCleanUpCompleteTable.TABLE_NAME, jccTuples, null);
-                                    jolRuntime.evaluate();
-                                }
-                                CCApplicationContext appCtx = ccs.getApplicationContext(appName);
-                                if (appCtx != null) {
-                                    appCtx.notifyJobFinish(jobId);
-                                }
-                            } catch (Exception e) {
-                            }
-                        }
-                    });
-                }
-            }
-        });
-
-        abortMessageTable.register(new AbortMessageTable.Callback() {
-            @Override
-            public void deletion(TupleSet tuples) {
-
-            }
-
-            @SuppressWarnings("unchecked")
-            @Override
-            public void insertion(TupleSet tuples) {
-                for (final Tuple t : tuples) {
-                    jobQueue.add(new Runnable() {
-                        @Override
-                        public void run() {
-                            try {
-                                Object[] data = t.toArray();
-                                UUID jobId = (UUID) data[0];
-                                UUID stageId = (UUID) data[1];
-                                Integer attempt = (Integer) data[2];
-                                Set<List> ts = (Set<List>) data[4];
-                                ClusterControllerService.JobletAborter[] jas = new ClusterControllerService.JobletAborter[ts
-                                        .size()];
-                                int i = 0;
-                                BasicTupleSet notificationTuples = new BasicTupleSet();
-                                for (List t2 : ts) {
-                                    Object[] t2Data = t2.toArray();
-                                    String nodeId = (String) t2Data[0];
-                                    jas[i++] = new ClusterControllerService.JobletAborter(nodeId, jobId, stageId,
-                                            attempt);
-                                    notificationTuples.add(AbortNotifyTable
-                                            .createTuple(jobId, stageId, nodeId, attempt));
-                                }
-                                try {
-                                    ccs.runRemote(jas, null);
-                                } finally {
-                                    jolRuntime.schedule(JOL_SCOPE, AbortNotifyTable.TABLE_NAME, notificationTuples,
-                                            null);
-                                    jolRuntime.evaluate();
-                                }
-                            } catch (Exception e) {
-                            }
-                        }
-                    });
-                }
-            }
-        });
-
-        jolRuntime.install(JOL_SCOPE, ClassLoader.getSystemResource(SCHEDULER_OLG_FILE));
-        jolRuntime.evaluate();
-
-        qi = new QueryInterfaceImpl();
-    }
-
-    @Override
-    public void createJob(final UUID jobId, String appName, JobSpecification jobSpec, EnumSet<JobFlag> jobFlags)
-            throws Exception {
-        final JobPlanBuilder builder = new JobPlanBuilder();
-        builder.init(jobSpec, jobFlags);
-
-        final BasicTupleSet anTuples = new BasicTupleSet();
-        final BasicTupleSet acTuples = new BasicTupleSet();
-        final BasicTupleSet abTuples = new BasicTupleSet();
-        IActivityGraphBuilder gBuilder = new IActivityGraphBuilder() {
-            @Override
-            public void addTask(IActivityNode task) {
-                anTuples.add(ActivityNodeTable.createTuple(jobId, task));
-                builder.addTask(task);
-            }
-
-            @Override
-            public void addTargetEdge(int operatorOutputIndex, IActivityNode task, int taskOutputIndex) {
-                acTuples.add(ActivityConnectionTable.createTuple(jobId, task, Direction.OUTPUT, operatorOutputIndex,
-                        taskOutputIndex));
-                builder.addTargetEdge(operatorOutputIndex, task, taskOutputIndex);
-            }
-
-            @Override
-            public void addSourceEdge(int operatorInputIndex, IActivityNode task, int taskInputIndex) {
-                acTuples.add(ActivityConnectionTable.createTuple(jobId, task, Direction.INPUT, operatorInputIndex,
-                        taskInputIndex));
-                builder.addSourceEdge(operatorInputIndex, task, taskInputIndex);
-            }
-
-            @Override
-            public void addBlockingEdge(IActivityNode blocker, IActivityNode blocked) {
-                abTuples.add(ActivityBlockedTable.createTuple(jobId, blocker, blocked));
-                builder.addBlockingEdge(blocker, blocked);
-            }
-        };
-
-        BasicTupleSet odTuples = new BasicTupleSet();
-        BasicTupleSet olTuples = new BasicTupleSet();
-        BasicTupleSet ocTuples = new BasicTupleSet();
-        for (Map.Entry<OperatorDescriptorId, IOperatorDescriptor> e : jobSpec.getOperatorMap().entrySet()) {
-            IOperatorDescriptor od = e.getValue();
-            int nPartitions = addPartitionConstraintTuples(jobId, od, olTuples, ocTuples);
-            odTuples.add(OperatorDescriptorTable.createTuple(jobId, nPartitions, od));
-            od.contributeTaskGraph(gBuilder);
-        }
-
-        BasicTupleSet cdTuples = new BasicTupleSet();
-        for (Map.Entry<ConnectorDescriptorId, IConnectorDescriptor> e : jobSpec.getConnectorMap().entrySet()) {
-            cdTuples.add(ConnectorDescriptorTable.createTuple(jobId, jobSpec, e.getValue()));
-        }
-
-        BasicTupleSet jobTuples = new BasicTupleSet(JobTable.createInitialJobTuple(jobId, appName, jobSpec,
-                builder.getPlan()));
-
-        jolRuntime.schedule(JOL_SCOPE, JobTable.TABLE_NAME, jobTuples, null);
-        jolRuntime.schedule(JOL_SCOPE, OperatorDescriptorTable.TABLE_NAME, odTuples, null);
-        jolRuntime.schedule(JOL_SCOPE, OperatorLocationTable.TABLE_NAME, olTuples, null);
-        jolRuntime.schedule(JOL_SCOPE, OperatorCloneCountTable.TABLE_NAME, ocTuples, null);
-        jolRuntime.schedule(JOL_SCOPE, ConnectorDescriptorTable.TABLE_NAME, cdTuples, null);
-        jolRuntime.schedule(JOL_SCOPE, ActivityNodeTable.TABLE_NAME, anTuples, null);
-        jolRuntime.schedule(JOL_SCOPE, ActivityConnectionTable.TABLE_NAME, acTuples, null);
-        jolRuntime.schedule(JOL_SCOPE, ActivityBlockedTable.TABLE_NAME, abTuples, null);
-
-        jolRuntime.evaluate();
-    }
-
-    private int addPartitionConstraintTuples(UUID jobId, IOperatorDescriptor od, BasicTupleSet olTuples,
-            BasicTupleSet ocTuples) {
-        PartitionConstraint pc = od.getPartitionConstraint();
-
-        switch (pc.getPartitionConstraintType()) {
-            case COUNT:
-                int count = ((PartitionCountConstraint) pc).getCount();
-                ocTuples.add(OperatorCloneCountTable.createTuple(jobId, od.getOperatorId(), count));
-                return count;
-
-            case EXPLICIT:
-                LocationConstraint[] locationConstraints = ((ExplicitPartitionConstraint) pc).getLocationConstraints();
-                for (int i = 0; i < locationConstraints.length; ++i) {
-                    addLocationConstraintTuple(olTuples, jobId, od.getOperatorId(), i, locationConstraints[i], 0);
-                }
-                return locationConstraints.length;
-        }
-        throw new IllegalArgumentException();
-    }
-
-    private void addLocationConstraintTuple(BasicTupleSet olTuples, UUID jobId, OperatorDescriptorId opId, int i,
-            LocationConstraint locationConstraint, int benefit) {
-        switch (locationConstraint.getConstraintType()) {
-            case ABSOLUTE:
-                String nodeId = ((AbsoluteLocationConstraint) locationConstraint).getLocationId();
-                olTuples.add(OperatorLocationTable.createTuple(jobId, opId, nodeId, i, benefit));
-                break;
-
-            case CHOICE:
-                int index = 0;
-                for (LocationConstraint lc : ((ChoiceLocationConstraint) locationConstraint).getChoices()) {
-                    addLocationConstraintTuple(olTuples, jobId, opId, i, lc, benefit - index);
-                    index++;
-                }
-        }
-    }
-
-    @Override
-    public void reportProfile(String id, Map<UUID, Map<String, Long>> counterDump) throws Exception {
-        BasicTupleSet puTuples = new BasicTupleSet();
-        for (Map.Entry<UUID, Map<String, Long>> e : counterDump.entrySet()) {
-            puTuples.add(ProfileUpdateTable.createTuple(e.getKey(), id, e.getValue()));
-        }
-        jolRuntime.schedule(JOL_SCOPE, ProfileUpdateTable.TABLE_NAME, puTuples, null);
-    }
-
-    @Override
-    public JobStatus getJobStatus(UUID jobId) {
-        synchronized (jobTable) {
-            try {
-                Tuple jobTuple = jobTable.lookupJob(jobId);
-                if (jobTuple == null) {
-                    return null;
-                }
-                return (JobStatus) jobTuple.value(JobTable.JOBSTATUS_FIELD_INDEX);
-            } catch (BadKeyException e) {
-                throw new RuntimeException(e);
-            }
-        }
-    }
-
-    @Override
-    public synchronized void notifyNodeFailure(String nodeId) throws Exception {
-        int len = rankedAvailableNodes.size();
-        int delIndex = -1;
-        for (int i = 0; i < len; ++i) {
-            if (nodeId.equals(rankedAvailableNodes.get(i))) {
-                delIndex = i;
-                break;
-            }
-        }
-        if (delIndex < 0) {
-            return;
-        }
-        BasicTupleSet delRANTuples = new BasicTupleSet();
-        delRANTuples.add(RankedAvailableNodesTable.createTuple(nodeId, delIndex));
-
-        BasicTupleSet insRANTuples = new BasicTupleSet();
-        for (int i = delIndex + 1; i < len; ++i) {
-            insRANTuples.add(RankedAvailableNodesTable.createTuple(rankedAvailableNodes.get(i), i - 1));
-        }
-
-        rankedAvailableNodes.remove(delIndex);
-
-        jolRuntime.schedule(JOL_SCOPE, RankedAvailableNodesTable.TABLE_NAME, insRANTuples, delRANTuples);
-
-        BasicTupleSet unavailableTuples = new BasicTupleSet(AvailableNodesTable.createTuple(nodeId));
-
-        jolRuntime.schedule(JOL_SCOPE, AvailableNodesTable.TABLE_NAME, null, unavailableTuples);
-
-        jolRuntime.evaluate();
-
-        BasicTupleSet failedTuples = new BasicTupleSet(FailedNodesTable.createTuple(nodeId));
-
-        jolRuntime.schedule(JOL_SCOPE, FailedNodesTable.TABLE_NAME, failedTuples, null);
-
-        jolRuntime.evaluate();
-    }
-
-    @Override
-    public synchronized void notifyStageletComplete(UUID jobId, UUID stageId, int attempt, String nodeId,
-            Map<String, Long> statistics) throws Exception {
-        BasicTupleSet scTuples = new BasicTupleSet();
-        scTuples.add(StageletCompleteTable.createTuple(jobId, stageId, nodeId, attempt, statistics));
-
-        jolRuntime.schedule(JOL_SCOPE, StageletCompleteTable.TABLE_NAME, scTuples, null);
-
-        jolRuntime.evaluate();
-    }
-
-    @Override
-    public synchronized void notifyStageletFailure(UUID jobId, UUID stageId, int attempt, String nodeId)
-            throws Exception {
-        BasicTupleSet sfTuples = new BasicTupleSet();
-        sfTuples.add(StageletFailureTable.createTuple(jobId, stageId, nodeId, attempt));
-
-        jolRuntime.schedule(JOL_SCOPE, StageletFailureTable.TABLE_NAME, sfTuples, null);
-
-        jolRuntime.evaluate();
-    }
-
-    @Override
-    public void start(UUID jobId) throws Exception {
-        BasicTupleSet jsTuples = new BasicTupleSet();
-        jsTuples.add(JobStartTable.createTuple(jobId, System.currentTimeMillis()));
-
-        jolRuntime.schedule(JOL_SCOPE, JobStartTable.TABLE_NAME, jsTuples, null);
-
-        jolRuntime.evaluate();
-    }
-
-    @Override
-    public synchronized void registerNode(String nodeId) throws Exception {
-        rankedAvailableNodes.add(nodeId);
-        BasicTupleSet insRANTuples = new BasicTupleSet();
-        insRANTuples.add(RankedAvailableNodesTable.createTuple(nodeId, rankedAvailableNodes.size() - 1));
-
-        jolRuntime.schedule(JOL_SCOPE, RankedAvailableNodesTable.TABLE_NAME, insRANTuples, null);
-
-        BasicTupleSet availableTuples = new BasicTupleSet(AvailableNodesTable.createTuple(nodeId));
-
-        jolRuntime.schedule(JOL_SCOPE, AvailableNodesTable.TABLE_NAME, availableTuples, null);
-
-        jolRuntime.evaluate();
-
-        BasicTupleSet unfailedTuples = new BasicTupleSet(FailedNodesTable.createTuple(nodeId));
-
-        jolRuntime.schedule(JOL_SCOPE, FailedNodesTable.TABLE_NAME, null, unfailedTuples);
-
-        jolRuntime.evaluate();
-    }
-
-    @Override
-    public void waitForCompletion(UUID jobId) throws Exception {
-        synchronized (jobTable) {
-            Tuple jobTuple = null;
-            while ((jobTuple = jobTable.lookupJob(jobId)) != null
-                    && jobTuple.value(JobTable.JOBSTATUS_FIELD_INDEX) != JobStatus.TERMINATED) {
-                jobTable.wait();
-            }
-        }
-    }
-
-    @Override
-    public IJobManagerQueryInterface getQueryInterface() {
-        return qi;
-    }
-
-    public void visitJobs(ITupleProcessor processor) throws Exception {
-        for (Tuple t : jobTable.tuples()) {
-            processor.process(t);
-        }
-    }
-
-    public void visitJob(UUID jobId, ITupleProcessor processor) throws Exception {
-        Tuple job = jobTable.lookupJob(jobId);
-        if (job != null) {
-            processor.process(job);
-        }
-    }
-
-    /*
-     * declare(job, keys(0), {JobId, Status, JobSpec, JobPlan})
-     */
-    private static class JobTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "job");
-
-        private static Key PRIMARY_KEY = new Key(0);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, String.class, JobStatus.class,
-                JobSpecification.class, JobPlan.class, Map.class };
-
-        public static final int JOBID_FIELD_INDEX = 0;
-        public static final int APPNAME_FIELD_INDEX = 1;
-        public static final int JOBSTATUS_FIELD_INDEX = 2;
-        public static final int JOBSPEC_FIELD_INDEX = 3;
-        public static final int JOBPLAN_FIELD_INDEX = 4;
-        public static final int STATISTICS_FIELD_INDEX = 5;
-
-        public JobTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        @SuppressWarnings("unchecked")
-        static Tuple createInitialJobTuple(UUID jobId, String appName, JobSpecification jobSpec, JobPlan plan) {
-            return new Tuple(jobId, appName, JobStatus.INITIALIZED, jobSpec, plan, new HashMap());
-        }
-
-        Tuple lookupJob(UUID jobId) throws BadKeyException {
-            TupleSet set = primary().lookupByKey(jobId);
-            if (set.isEmpty()) {
-                return null;
-            }
-            return (Tuple) set.toArray()[0];
-        }
-    }
-
-    /*
-     * declare(operatordescriptor, keys(0, 1), {JobId, ODId, OperatorDescriptor})
-     */
-    private static class OperatorDescriptorTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "operatordescriptor");
-
-        private static Key PRIMARY_KEY = new Key(0, 1);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, OperatorDescriptorId.class, Integer.class,
-                IOperatorDescriptor.class };
-
-        public OperatorDescriptorTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        static Tuple createTuple(UUID jobId, int nPartitions, IOperatorDescriptor od) {
-            return new Tuple(jobId, od.getOperatorId(), nPartitions, od);
-        }
-    }
-
-    /*
-     * declare(operatorlocation, keys(0, 1), {JobId, ODId, NodeId})
-     */
-    private static class OperatorLocationTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "operatorlocation");
-
-        private static Key PRIMARY_KEY = new Key();
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, OperatorDescriptorId.class, String.class,
-                Integer.class, Integer.class };
-
-        public OperatorLocationTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        static Tuple createTuple(UUID jobId, OperatorDescriptorId opId, String nodeId, int partition, int benefit) {
-            return new Tuple(jobId, opId, nodeId, partition, benefit);
-        }
-    }
-
-    /*
-     * declare(operatorclonecount, keys(0, 1), {JobId, ODId, Count})
-     */
-    private static class OperatorCloneCountTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "operatorclonecount");
-
-        private static Key PRIMARY_KEY = new Key();
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, OperatorDescriptorId.class, Integer.class };
-
-        public OperatorCloneCountTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        static Tuple createTuple(UUID jobId, OperatorDescriptorId opId, int cloneCount) {
-            return new Tuple(jobId, opId, cloneCount);
-        }
-    }
-
-    /*
-     * declare(connectordescriptor, keys(0, 1), {JobId, CDId, SrcODId, SrcPort, DestODId, DestPort, ConnectorDescriptor})
-     */
-    private static class ConnectorDescriptorTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "connectordescriptor");
-
-        private static Key PRIMARY_KEY = new Key(0, 1);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, ConnectorDescriptorId.class,
-                OperatorDescriptorId.class, Integer.class, OperatorDescriptorId.class, Integer.class,
-                IConnectorDescriptor.class };
-
-        public ConnectorDescriptorTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        static Tuple createTuple(UUID jobId, JobSpecification jobSpec, IConnectorDescriptor conn) {
-            IOperatorDescriptor srcOD = jobSpec.getProducer(conn);
-            int srcPort = jobSpec.getProducerOutputIndex(conn);
-            IOperatorDescriptor destOD = jobSpec.getConsumer(conn);
-            int destPort = jobSpec.getConsumerInputIndex(conn);
-            Tuple cdTuple = new Tuple(jobId, conn.getConnectorId(), srcOD.getOperatorId(), srcPort,
-                    destOD.getOperatorId(), destPort, conn);
-            return cdTuple;
-        }
-    }
-
-    /*
-     * declare(activitynode, keys(0, 1, 2), {JobId, OperatorId, ActivityId, ActivityNode})
-     */
-    private static class ActivityNodeTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "activitynode");
-
-        private static Key PRIMARY_KEY = new Key(0, 1, 2);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, OperatorDescriptorId.class,
-                ActivityNodeId.class, IActivityNode.class };
-
-        public ActivityNodeTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        static Tuple createTuple(UUID jobId, IActivityNode aNode) {
-            return new Tuple(jobId, aNode.getActivityNodeId().getOperatorDescriptorId(), aNode.getActivityNodeId(),
-                    aNode);
-        }
-    }
-
-    /*
-     * declare(activityconnection, keys(0, 1, 2, 3), {JobId, OperatorId, Integer, Direction, ActivityNodeId, Integer})
-     */
-    private static class ActivityConnectionTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "activityconnection");
-
-        private static Key PRIMARY_KEY = new Key(0, 1, 2, 3);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, OperatorDescriptorId.class, Integer.class,
-                Direction.class, ActivityNodeId.class, Integer.class };
-
-        public ActivityConnectionTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        static Tuple createTuple(UUID jobId, IActivityNode aNode, Direction direction, int odPort, int activityPort) {
-            return new Tuple(jobId, aNode.getActivityNodeId().getOperatorDescriptorId(), odPort, direction,
-                    aNode.getActivityNodeId(), activityPort);
-        }
-    }
-
-    /*
-     * declare(activityblocked, keys(0, 1, 2, 3), {JobId, OperatorId, BlockerActivityId, BlockedActivityId})
-     */
-    private static class ActivityBlockedTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "activityblocked");
-
-        private static Key PRIMARY_KEY = new Key(0, 1, 2, 3, 4);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, OperatorDescriptorId.class,
-                ActivityNodeId.class, OperatorDescriptorId.class, ActivityNodeId.class };
-
-        public ActivityBlockedTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        static Tuple createTuple(UUID jobId, IActivityNode blocker, IActivityNode blocked) {
-            ActivityNodeId blockerANId = blocker.getActivityNodeId();
-            OperatorDescriptorId blockerODId = blockerANId.getOperatorDescriptorId();
-            ActivityNodeId blockedANId = blocked.getActivityNodeId();
-            OperatorDescriptorId blockedODId = blockedANId.getOperatorDescriptorId();
-            return new Tuple(jobId, blockerODId, blockerANId, blockedODId, blockedANId);
-        }
-    }
-
-    /*
-     * declare(jobstart, keys(0), {JobId, SubmitTime})
-     */
-    private static class JobStartTable extends EventTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "jobstart");
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, Long.class };
-
-        public JobStartTable() {
-            super(TABLE_NAME, SCHEMA);
-        }
-
-        static Tuple createTuple(UUID jobId, long submitTime) {
-            return new Tuple(jobId, submitTime);
-        }
-    }
-
-    /*
-     * declare(startmessage, keys(0, 1), {JobId, StageId, JobPlan, TupleSet})
-     */
-    private static class StartMessageTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "startmessage");
-
-        private static Key PRIMARY_KEY = new Key(0, 1, 2);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, UUID.class, Integer.class, String.class,
-                JobPlan.class, Set.class };
-
-        public StartMessageTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-    }
-
-    /*
-     * declare(jobcleanup, keys(0), {JobId, Set<NodeId>})
-     */
-    private static class JobCleanUpTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "jobcleanup");
-
-        private static Key PRIMARY_KEY = new Key(0);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, String.class, Set.class };
-
-        public JobCleanUpTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-    }
-
-    /*
-     * declare(jobcleanupcomplete, keys(0), {JobId})
-     */
-    private static class JobCleanUpCompleteTable extends EventTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "jobcleanupcomplete");
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class };
-
-        public JobCleanUpCompleteTable() {
-            super(TABLE_NAME, SCHEMA);
-        }
-
-        public static Tuple createTuple(UUID jobId) {
-            return new Tuple(jobId);
-        }
-    }
-
-    /*
-     * declare(stageletcomplete, keys(0, 1, 2, 3), {JobId, StageId, NodeId, Attempt})
-     */
-    private static class StageletCompleteTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "stageletcomplete");
-
-        private static Key PRIMARY_KEY = new Key(0, 1, 2, 3);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, UUID.class, String.class, Integer.class,
-                Map.class };
-
-        public StageletCompleteTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        public static Tuple createTuple(UUID jobId, UUID stageId, String nodeId, int attempt,
-                Map<String, Long> statistics) {
-            return new Tuple(jobId, stageId, nodeId, attempt, statistics);
-        }
-    }
-
-    /*
-     * declare(stageletfailure, keys(0, 1, 2, 3), {JobId, StageId, NodeId, Attempt})
-     */
-    private static class StageletFailureTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "stageletfailure");
-
-        private static Key PRIMARY_KEY = new Key(0, 1, 2, 3);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, UUID.class, String.class, Integer.class };
-
-        public StageletFailureTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        public static Tuple createTuple(UUID jobId, UUID stageId, String nodeId, int attempt) {
-            return new Tuple(jobId, stageId, nodeId, attempt);
-        }
-    }
-
-    /*
-     * declare(availablenodes, keys(0), {NodeId})
-     */
-    private static class AvailableNodesTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "availablenodes");
-
-        private static Key PRIMARY_KEY = new Key(0);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { String.class };
-
-        public AvailableNodesTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        public static Tuple createTuple(String nodeId) {
-            return new Tuple(nodeId);
-        }
-    }
-
-    /*
-     * declare(rankedavailablenodes, keys(0), {NodeId, Integer})
-     */
-    private static class RankedAvailableNodesTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "rankedavailablenodes");
-
-        private static Key PRIMARY_KEY = new Key(0);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { String.class, Integer.class };
-
-        public RankedAvailableNodesTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        public static Tuple createTuple(String nodeId, int rank) {
-            return new Tuple(nodeId, rank);
-        }
-    }
-
-    /*
-     * declare(failednodes, keys(0), {NodeId})
-     */
-    private static class FailedNodesTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "failednodes");
-
-        private static Key PRIMARY_KEY = new Key(0);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { String.class };
-
-        public FailedNodesTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        public static Tuple createTuple(String nodeId) {
-            return new Tuple(nodeId);
-        }
-    }
-
-    /*
-     * declare(abortmessage, keys(0, 1), {JobId, StageId, Attempt, JobPlan, TupleSet})
-     */
-    private static class AbortMessageTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "abortmessage");
-
-        private static Key PRIMARY_KEY = new Key(0, 1, 2);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, UUID.class, Integer.class, JobPlan.class,
-                Set.class };
-
-        public AbortMessageTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-    }
-
-    /*
-     * declare(abortnotify, keys(0, 1, 2, 3), {JobId, StageId, NodeId, Attempt, StageletStatistics})
-     */
-    private static class AbortNotifyTable extends BasicTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "abortnotify");
-
-        private static Key PRIMARY_KEY = new Key(0, 1, 2, 3);
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, UUID.class, String.class, Integer.class };
-
-        public AbortNotifyTable(Runtime context) {
-            super(context, TABLE_NAME, PRIMARY_KEY, SCHEMA);
-        }
-
-        public static Tuple createTuple(UUID jobId, UUID stageId, String nodeId, int attempt) {
-            return new Tuple(jobId, stageId, nodeId, attempt);
-        }
-    }
-
-    private static class ExpandPartitionCountConstraintTableFunction extends Function {
-        private static final String TABLE_NAME = "expandpartitioncountconstraint";
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, OperatorDescriptorId.class, Integer.class,
-                Integer.class };
-
-        public static final int JOBID_FIELD_INDEX = 0;
-        public static final int ODID_FIELD_INDEX = 1;
-        public static final int NPARTITIONS_FIELD_INDEX = 2;
-        public static final int ORDINAL_FIELD_INDEX = 3;
-
-        public ExpandPartitionCountConstraintTableFunction() {
-            super(TABLE_NAME, SCHEMA);
-        }
-
-        @Override
-        public TupleSet insert(TupleSet tuples, TupleSet conflicts) throws UpdateException {
-            TupleSet result = new BasicTupleSet();
-            int counter = 0;
-            for (Tuple t : tuples) {
-                int nPartitions = (Integer) t.value(NPARTITIONS_FIELD_INDEX);
-                for (int i = 0; i < nPartitions; ++i) {
-                    result.add(new Tuple(t.value(JOBID_FIELD_INDEX), t.value(ODID_FIELD_INDEX), i, counter++));
-                }
-            }
-            return result;
-        }
-    }
-
-    /*
-     * declare(profileupdate, keys(0, 1), {JobId, NodeId, Map})
-     */
-    private static class ProfileUpdateTable extends EventTable {
-        private static TableName TABLE_NAME = new TableName(JOL_SCOPE, "profileupdate");
-
-        @SuppressWarnings("unchecked")
-        private static final Class[] SCHEMA = new Class[] { UUID.class, String.class, Map.class };
-
-        public ProfileUpdateTable() {
-            super(TABLE_NAME, SCHEMA);
-        }
-
-        public static Tuple createTuple(UUID jobId, String nodeId, Map<String, Long> statistics) {
-            return new Tuple(jobId, nodeId, statistics);
-        }
-    }
-
-    private class JobQueueThread extends Thread {
-        public JobQueueThread() {
-            setDaemon(true);
-        }
-
-        public void run() {
-            Runnable r;
-            while (true) {
-                try {
-                    r = jobQueue.take();
-                } catch (InterruptedException e) {
-                    continue;
-                }
-                try {
-                    r.run();
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-    }
-
-    public interface ITupleProcessor {
-        public void process(Tuple t) throws Exception;
-    }
-
-    private class QueryInterfaceImpl implements IJobManagerQueryInterface {
-        @Override
-        public JSONArray getAllJobSummaries() throws Exception {
-            final JSONArray jobs = new JSONArray();
-            JOLJobManagerImpl.ITupleProcessor tp = new JOLJobManagerImpl.ITupleProcessor() {
-                @Override
-                public void process(Tuple t) throws Exception {
-                    JSONObject jo = new JSONObject();
-                    jo.put("type", "job-summary");
-                    jo.put("id", t.value(JobTable.JOBID_FIELD_INDEX).toString());
-                    jo.put("status", t.value(JobTable.JOBSTATUS_FIELD_INDEX).toString());
-                    jobs.put(jo);
-                }
-            };
-            visitJobs(tp);
-            return jobs;
-        }
-
-        @Override
-        public JSONObject getJobSpecification(UUID jobId) throws Exception {
-            final JSONArray jobs = new JSONArray();
-            JOLJobManagerImpl.ITupleProcessor tp = new JOLJobManagerImpl.ITupleProcessor() {
-                @Override
-                public void process(Tuple t) throws Exception {
-                    JobSpecification js = (JobSpecification) t.value(JobTable.JOBSPEC_FIELD_INDEX);
-                    jobs.put(js.toJSON());
-                }
-            };
-            visitJob(jobId, tp);
-            return (JSONObject) (jobs.length() == 0 ? new JSONObject() : jobs.get(0));
-        }
-
-        @Override
-        public JSONObject getJobPlan(UUID jobId) throws Exception {
-            final JSONArray jobs = new JSONArray();
-            JOLJobManagerImpl.ITupleProcessor tp = new JOLJobManagerImpl.ITupleProcessor() {
-                @Override
-                public void process(Tuple t) throws Exception {
-                }
-            };
-            visitJob(jobId, tp);
-            return (JSONObject) (jobs.length() == 0 ? new JSONObject() : jobs.get(0));
-        }
-
-        @Override
-        public JSONObject getJobProfile(UUID jobId) throws Exception {
-            final JSONArray jobs = new JSONArray();
-            JOLJobManagerImpl.ITupleProcessor tp = new JOLJobManagerImpl.ITupleProcessor() {
-                @Override
-                public void process(Tuple t) throws Exception {
-                    JSONObject jo = new JSONObject();
-                    jo.put("type", "profile");
-                    jo.put("id", t.value(JobTable.JOBID_FIELD_INDEX).toString());
-                    Map<String, Long> profile = (Map<String, Long>) t.value(JobTable.STATISTICS_FIELD_INDEX);
-                    if (profile != null) {
-                        for (Map.Entry<String, Long> e : profile.entrySet()) {
-                            JSONObject jpe = new JSONObject();
-                            jpe.put("name", e.getKey());
-                            jpe.put("value", e.getValue());
-                            jo.accumulate("counters", jpe);
-                        }
-                    }
-                    jobs.put(jo);
-                }
-            };
-            visitJob(jobId, tp);
-            return (JSONObject) (jobs.length() == 0 ? new JSONObject() : jobs.get(0));
-        }
-    }
-}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/NodeControllerState.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/NodeControllerState.java
index a638c09..e69281b 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/NodeControllerState.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/NodeControllerState.java
@@ -1,29 +1,40 @@
 package edu.uci.ics.hyracks.control.cc;
 
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
 import edu.uci.ics.hyracks.api.control.INodeController;
 
 public class NodeControllerState {
     private final INodeController nodeController;
 
+    private final Set<UUID> activeJobIds;
+
     private int lastHeartbeatDuration;
 
     public NodeControllerState(INodeController nodeController) {
         this.nodeController = nodeController;
+        activeJobIds = new HashSet<UUID>();
     }
 
-    void notifyHeartbeat() {
+    public void notifyHeartbeat() {
         lastHeartbeatDuration = 0;
     }
 
-    int incrementLastHeartbeatDuration() {
+    public int incrementLastHeartbeatDuration() {
         return lastHeartbeatDuration++;
     }
 
-    int getLastHeartbeatDuration() {
+    public int getLastHeartbeatDuration() {
         return lastHeartbeatDuration;
     }
 
     public INodeController getNodeController() {
         return nodeController;
     }
+
+    public Set<UUID> getActiveJobIds() {
+        return activeJobIds;
+    }
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/IConnectorDescriptorVisitor.java
similarity index 68%
copy from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
copy to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/IConnectorDescriptorVisitor.java
index 75edf2b..1c8446f 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/IConnectorDescriptorVisitor.java
@@ -12,10 +12,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc.web.handlers.util;
+package edu.uci.ics.hyracks.control.cc.job;
 
-import org.json.JSONObject;
+import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
+import edu.uci.ics.hyracks.api.exceptions.HyracksException;
 
-public interface IJSONOutputFunction {
-    public JSONObject invoke(String[] arguments) throws Exception;
+public interface IConnectorDescriptorVisitor {
+    public void visit(IConnectorDescriptor conn) throws HyracksException;
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/IJobStatusConditionVariable.java
similarity index 76%
copy from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
copy to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/IJobStatusConditionVariable.java
index 75edf2b..57ee9b0 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/IJobStatusConditionVariable.java
@@ -12,10 +12,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc.web.handlers.util;
+package edu.uci.ics.hyracks.control.cc.job;
 
-import org.json.JSONObject;
-
-public interface IJSONOutputFunction {
-    public JSONObject invoke(String[] arguments) throws Exception;
+public interface IJobStatusConditionVariable {
+    public void waitForCompletion() throws Exception;
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/IOperatorDescriptorVisitor.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/IOperatorDescriptorVisitor.java
index 65d8771..840faef 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/IOperatorDescriptorVisitor.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/IOperatorDescriptorVisitor.java
@@ -15,7 +15,8 @@
 package edu.uci.ics.hyracks.control.cc.job;
 
 import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
+import edu.uci.ics.hyracks.api.exceptions.HyracksException;
 
 public interface IOperatorDescriptorVisitor {
-    public void visit(IOperatorDescriptor op) throws Exception;
+    public void visit(IOperatorDescriptor op) throws HyracksException;
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobAttempt.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobAttempt.java
new file mode 100644
index 0000000..284c92f
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobAttempt.java
@@ -0,0 +1,130 @@
+package edu.uci.ics.hyracks.control.cc.job;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.job.JobPlan;
+import edu.uci.ics.hyracks.api.job.profiling.om.JobProfile;
+import edu.uci.ics.hyracks.control.cc.scheduler.IJobAttemptSchedulerState;
+import edu.uci.ics.hyracks.control.cc.scheduler.IScheduler;
+
+public class JobAttempt {
+    private final JobRun jobRun;
+
+    private final JobPlan plan;
+
+    private final int attempt;
+
+    private final JobStage endStage;
+
+    private final JobProfile profile;
+
+    private final Map<UUID, JobStage> stageMap;
+
+    private final Map<UUID, JobStageAttempt> stageAttemptMap;
+
+    private final Set<UUID> pendingStages;
+
+    private final Set<UUID> completedStages;
+
+    private final Set<UUID> inProgressStages;
+
+    private final Set<String> participatingNodeIds;
+
+    private final IJobAttemptSchedulerState schedulerState;
+
+    public JobAttempt(JobRun jobRun, JobPlan plan, int attempt, IScheduler scheduler) {
+        this.jobRun = jobRun;
+        this.plan = plan;
+        this.attempt = attempt;
+        this.endStage = new JobPlanner().createStageDAG(plan);
+        stageMap = new HashMap<UUID, JobStage>();
+        stageAttemptMap = new HashMap<UUID, JobStageAttempt>();
+        completedStages = new HashSet<UUID>();
+        inProgressStages = new HashSet<UUID>();
+        profile = new JobProfile(plan.getJobId(), attempt);
+        populateJobStageMap(stageMap, endStage);
+        pendingStages = new HashSet<UUID>(stageMap.keySet());
+        participatingNodeIds = new HashSet<String>();
+        schedulerState = scheduler.createJobAttemptState(this);
+    }
+
+    private static void populateJobStageMap(Map<UUID, JobStage> stageMap, JobStage stage) {
+        stageMap.put(stage.getId(), stage);
+        for (JobStage s : stage.getDependencies()) {
+            populateJobStageMap(stageMap, s);
+        }
+    }
+
+    public JobRun getJobRun() {
+        return jobRun;
+    }
+
+    public JobPlan getPlan() {
+        return plan;
+    }
+
+    public int getAttempt() {
+        return attempt;
+    }
+
+    public JobStage getEndStage() {
+        return endStage;
+    }
+
+    public void findRunnableStages(Set<JobStage> runnableStages) {
+        findRunnableStages(runnableStages, endStage);
+    }
+
+    private void findRunnableStages(Set<JobStage> runnableStages, JobStage stage) {
+        if (completedStages.contains(stage.getId()) || inProgressStages.contains(stage.getId())
+                || runnableStages.contains(stage)) {
+            return;
+        }
+        boolean runnable = true;
+        for (JobStage s : stage.getDependencies()) {
+            if (!completedStages.contains(s.getId())) {
+                runnable = false;
+                findRunnableStages(runnableStages, s);
+            }
+        }
+        if (runnable) {
+            runnableStages.add(stage);
+        }
+    }
+
+    public Set<UUID> getPendingStageIds() {
+        return pendingStages;
+    }
+
+    public Set<UUID> getInProgressStageIds() {
+        return inProgressStages;
+    }
+
+    public Set<UUID> getCompletedStageIds() {
+        return completedStages;
+    }
+
+    public Map<UUID, JobStage> getStageMap() {
+        return stageMap;
+    }
+
+    public Map<UUID, JobStageAttempt> getStageAttemptMap() {
+        return stageAttemptMap;
+    }
+
+    public Set<String> getParticipatingNodeIds() {
+        return participatingNodeIds;
+    }
+
+    public JobProfile getJobProfile() {
+        return profile;
+    }
+
+    public IJobAttemptSchedulerState getSchedulerState() {
+        return schedulerState;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanBuilder.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobPlanBuilder.java
similarity index 84%
rename from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanBuilder.java
rename to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobPlanBuilder.java
index d5056d3..bafa7e5 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanBuilder.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobPlanBuilder.java
@@ -1,4 +1,4 @@
-package edu.uci.ics.hyracks.control.cc;
+package edu.uci.ics.hyracks.control.cc.job;
 
 import java.util.ArrayList;
 import java.util.EnumSet;
@@ -6,6 +6,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.UUID;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -30,22 +31,22 @@
     public void addSourceEdge(int operatorInputIndex, IActivityNode task, int taskInputIndex) {
         if (LOGGER.isLoggable(Level.FINEST)) {
             LOGGER.finest("Adding source edge: " + task.getOwner().getOperatorId() + ":" + operatorInputIndex + " -> "
-                + task.getActivityNodeId() + ":" + taskInputIndex);
+                    + task.getActivityNodeId() + ":" + taskInputIndex);
         }
         insertIntoIndexedMap(plan.getTaskInputMap(), task.getActivityNodeId(), taskInputIndex, operatorInputIndex);
-        insertIntoIndexedMap(plan.getOperatorInputMap(), task.getOwner().getOperatorId(), operatorInputIndex, task
-            .getActivityNodeId());
+        insertIntoIndexedMap(plan.getOperatorInputMap(), task.getOwner().getOperatorId(), operatorInputIndex,
+                task.getActivityNodeId());
     }
 
     @Override
     public void addTargetEdge(int operatorOutputIndex, IActivityNode task, int taskOutputIndex) {
         if (LOGGER.isLoggable(Level.FINEST)) {
             LOGGER.finest("Adding target edge: " + task.getOwner().getOperatorId() + ":" + operatorOutputIndex + " -> "
-                + task.getActivityNodeId() + ":" + taskOutputIndex);
+                    + task.getActivityNodeId() + ":" + taskOutputIndex);
         }
         insertIntoIndexedMap(plan.getTaskOutputMap(), task.getActivityNodeId(), taskOutputIndex, operatorOutputIndex);
-        insertIntoIndexedMap(plan.getOperatorOutputMap(), task.getOwner().getOperatorId(), operatorOutputIndex, task
-            .getActivityNodeId());
+        insertIntoIndexedMap(plan.getOperatorOutputMap(), task.getOwner().getOperatorId(), operatorOutputIndex,
+                task.getActivityNodeId());
     }
 
     @Override
@@ -70,8 +71,8 @@
         }
     }
 
-    public void init(JobSpecification jobSpec, EnumSet<JobFlag> jobFlags) {
-        plan = new JobPlan(jobSpec, jobFlags);
+    public void init(String appName, UUID jobId, JobSpecification jobSpec, EnumSet<JobFlag> jobFlags) {
+        plan = new JobPlan(appName, jobId, jobSpec, jobFlags);
     }
 
     private <K, V> void insertIntoIndexedMap(Map<K, List<V>> map, K key, int index, V value) {
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanner.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobPlanner.java
similarity index 86%
rename from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanner.java
rename to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobPlanner.java
index af3b77f..900e5eee 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanner.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobPlanner.java
@@ -12,9 +12,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc;
+package edu.uci.ics.hyracks.control.cc.job;
 
-import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -28,13 +27,9 @@
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
-import edu.uci.ics.hyracks.api.job.JobFlag;
 import edu.uci.ics.hyracks.api.job.JobPlan;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
-import edu.uci.ics.hyracks.api.job.JobStage;
 import edu.uci.ics.hyracks.api.util.Pair;
-import edu.uci.ics.hyracks.control.cc.job.IOperatorDescriptorVisitor;
-import edu.uci.ics.hyracks.control.cc.job.PlanUtils;
 
 public class JobPlanner {
     private static final Logger LOGGER = Logger.getLogger(JobPlanner.class.getName());
@@ -73,7 +68,7 @@
         return null;
     }
 
-    private JobStage inferStages(JobPlan plan) throws Exception {
+    private JobStage inferStages(JobPlan plan) {
         JobSpecification spec = plan.getJobSpecification();
 
         /*
@@ -131,7 +126,7 @@
     }
 
     private void merge(Map<ActivityNodeId, JobStage> eqSetMap, Set<JobStage> eqSets, ActivityNodeId t1,
-        ActivityNodeId t2) {
+            ActivityNodeId t2) {
         JobStage stage1 = eqSetMap.get(t1);
         Set<ActivityNodeId> s1 = stage1.getTasks();
         JobStage stage2 = eqSetMap.get(t2);
@@ -151,19 +146,8 @@
         }
     }
 
-    public JobPlan plan(JobSpecification jobSpec, EnumSet<JobFlag> jobFlags) throws Exception {
-        final JobPlanBuilder builder = new JobPlanBuilder();
-        builder.init(jobSpec, jobFlags);
-        PlanUtils.visit(jobSpec, new IOperatorDescriptorVisitor() {
-            @Override
-            public void visit(IOperatorDescriptor op) throws Exception {
-                op.contributeTaskGraph(builder);
-            }
-        });
-        JobPlan plan = builder.getPlan();
-        JobStage endStage = inferStages(plan);
-        plan.setEndStage(endStage);
-
-        return plan;
+    public JobStage createStageDAG(JobPlan jag) {
+        JobStage endStage = inferStages(jag);
+        return endStage;
     }
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobRun.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobRun.java
new file mode 100644
index 0000000..5766288
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobRun.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import edu.uci.ics.hyracks.api.constraints.expressions.ConstraintExpression;
+import edu.uci.ics.hyracks.api.job.JobPlan;
+import edu.uci.ics.hyracks.api.job.JobStatus;
+import edu.uci.ics.hyracks.control.cc.scheduler.IScheduler;
+
+public class JobRun implements IJobStatusConditionVariable {
+    private final JobPlan plan;
+    private final List<JobAttempt> attempts;
+    private JobStatus status;
+    private Set<ConstraintExpression> constraints;
+
+    public JobRun(JobPlan plan, Set<ConstraintExpression> constraints) {
+        this.plan = plan;
+        attempts = new ArrayList<JobAttempt>();
+        this.constraints = constraints;
+    }
+
+    public JobPlan getJobPlan() {
+        return plan;
+    }
+
+    public synchronized void setStatus(JobStatus status) {
+        this.status = status;
+        notifyAll();
+    }
+
+    public JobStatus getStatus() {
+        return status;
+    }
+
+    public List<JobAttempt> getAttempts() {
+        return attempts;
+    }
+
+    public Set<ConstraintExpression> getConstraints() {
+        return constraints;
+    }
+
+    public JobAttempt createAttempt(IScheduler scheduler) {
+        int attemptNumber = attempts.size();
+        JobAttempt attempt = new JobAttempt(this, plan, attemptNumber, scheduler);
+        attempts.add(attempt);
+        return attempt;
+    }
+
+    @Override
+    public synchronized void waitForCompletion() throws Exception {
+        while (status != JobStatus.TERMINATED && status != JobStatus.FAILURE) {
+            wait();
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobStage.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobStage.java
similarity index 97%
rename from hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobStage.java
rename to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobStage.java
index 41187f1..8e4013d 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/job/JobStage.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobStage.java
@@ -12,7 +12,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.api.job;
+package edu.uci.ics.hyracks.control.cc.job;
 
 import java.io.Serializable;
 import java.util.HashSet;
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobStageAttempt.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobStageAttempt.java
new file mode 100644
index 0000000..61db770
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/JobStageAttempt.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import edu.uci.ics.hyracks.api.dataflow.ActivityNodeId;
+import edu.uci.ics.hyracks.control.cc.scheduler.ISchedule;
+
+public class JobStageAttempt {
+    private final JobStage stage;
+
+    private final JobAttempt jobAttempt;
+
+    private final Set<String> participatingNodes;
+
+    private final Set<String> completedNodes;
+
+    private ISchedule schedule;
+
+    public JobStageAttempt(JobStage stage, JobAttempt jobAttempt) {
+        this.stage = stage;
+        this.jobAttempt = jobAttempt;
+        participatingNodes = new HashSet<String>();
+        completedNodes = new HashSet<String>();
+    }
+
+    public JobStage getJobStage() {
+        return stage;
+    }
+
+    public JobAttempt getJobAttempt() {
+        return jobAttempt;
+    }
+
+    public void setSchedule(ISchedule schedule) {
+        this.schedule = schedule;
+        for (ActivityNodeId aid : stage.getTasks()) {
+            String[] partitions = schedule.getPartitions(aid);
+            for (String nid : partitions) {
+                participatingNodes.add(nid);
+            }
+        }
+    }
+
+    public ISchedule getSchedule() {
+        return schedule;
+    }
+
+    public Set<String> getParticipatingNodes() {
+        return participatingNodes;
+    }
+
+    public Set<String> getCompletedNodes() {
+        return completedNodes;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/PlanUtils.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/PlanUtils.java
index 274ffdb..754094a 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/PlanUtils.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/PlanUtils.java
@@ -17,12 +17,14 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
+import edu.uci.ics.hyracks.api.exceptions.HyracksException;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 
 public class PlanUtils {
-    public static void visit(JobSpecification spec, IOperatorDescriptorVisitor visitor) throws Exception {
+    public static void visit(JobSpecification spec, IOperatorDescriptorVisitor visitor) throws HyracksException {
         Set<OperatorDescriptorId> seen = new HashSet<OperatorDescriptorId>();
         for (IOperatorDescriptor op : spec.getOperatorMap().values()) {
             visitOperator(visitor, seen, op);
@@ -30,10 +32,16 @@
     }
 
     private static void visitOperator(IOperatorDescriptorVisitor visitor, Set<OperatorDescriptorId> seen,
-            IOperatorDescriptor op) throws Exception {
+            IOperatorDescriptor op) throws HyracksException {
         if (!seen.contains(op)) {
             visitor.visit(op);
         }
         seen.add(op.getOperatorId());
     }
+
+    public static void visit(JobSpecification spec, IConnectorDescriptorVisitor visitor) throws HyracksException {
+        for (IConnectorDescriptor c : spec.getConnectorMap().values()) {
+            visitor.visit(c);
+        }
+    }
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/IJobManager.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/IJobManager.java
similarity index 96%
rename from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/IJobManager.java
rename to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/IJobManager.java
index 88076c9..ef87c4f 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/IJobManager.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/IJobManager.java
@@ -12,7 +12,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc;
+package edu.uci.ics.hyracks.control.cc.job.manager;
 
 import java.util.EnumSet;
 import java.util.Map;
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/IJobManagerQueryInterface.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/IJobManagerQueryInterface.java
similarity index 87%
rename from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/IJobManagerQueryInterface.java
rename to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/IJobManagerQueryInterface.java
index 221fc10..fbdf941 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/IJobManagerQueryInterface.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/IJobManagerQueryInterface.java
@@ -12,7 +12,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc;
+package edu.uci.ics.hyracks.control.cc.job.manager;
 
 import java.util.UUID;
 
@@ -26,5 +26,5 @@
 
     public JSONObject getJobPlan(UUID jobId) throws Exception;
 
-    public JSONObject getJobProfile(UUID jobId) throws Exception;
+    public JSONObject getJobProfile(UUID jobId, int attempt) throws Exception;
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/JobLifecycleHelper.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/JobLifecycleHelper.java
new file mode 100644
index 0000000..be42e22
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/JobLifecycleHelper.java
@@ -0,0 +1,27 @@
+package edu.uci.ics.hyracks.control.cc.job.manager;
+
+import java.util.Set;
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.JobAttemptStartEvent;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteRunner;
+import edu.uci.ics.hyracks.control.cc.remote.ops.JobletAborter;
+
+public class JobLifecycleHelper {
+    public static void abortJob(ClusterControllerService ccs, UUID jobId, int attempt, Set<String> targetNodes) {
+        if (!targetNodes.isEmpty()) {
+            JobletAborter[] jas = new JobletAborter[targetNodes.size()];
+            int i = 0;
+            for (String nodeId : targetNodes) {
+                jas[i++] = new JobletAborter(nodeId, jobId, attempt);
+            }
+            try {
+                RemoteRunner.runRemote(ccs, jas, null);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        ccs.getJobQueue().schedule(new JobAttemptStartEvent(ccs, jobId));
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/ApplicationDestroyEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/ApplicationDestroyEvent.java
new file mode 100644
index 0000000..69c244a
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/ApplicationDestroyEvent.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import edu.uci.ics.hyracks.api.exceptions.HyracksException;
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.jobqueue.FutureValue;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteOp;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteRunner;
+import edu.uci.ics.hyracks.control.cc.remote.ops.ApplicationDestroyer;
+import edu.uci.ics.hyracks.control.common.application.ApplicationContext;
+
+public class ApplicationDestroyEvent implements Runnable {
+    private final ClusterControllerService ccs;
+    private final String appName;
+    private FutureValue fv;
+
+    public ApplicationDestroyEvent(ClusterControllerService ccs, String appName, FutureValue fv) {
+        this.ccs = ccs;
+        this.appName = appName;
+        this.fv = fv;
+    }
+
+    @Override
+    public void run() {
+        final ApplicationContext appCtx = ccs.getApplicationMap().remove(appName);
+        if (appCtx == null) {
+            fv.setException(new HyracksException("No application with name: " + appName));
+            return;
+        }
+        List<RemoteOp<Void>> opList = new ArrayList<RemoteOp<Void>>();
+        for (final String nodeId : ccs.getNodeMap().keySet()) {
+            opList.add(new ApplicationDestroyer(nodeId, appName));
+        }
+        final RemoteOp[] ops = opList.toArray(new RemoteOp[opList.size()]);
+        ccs.getExecutor().execute(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    RemoteRunner.runRemote(ccs, ops, null);
+                } catch (Exception e) {
+                    fv.setException(e);
+                    return;
+                }
+                ccs.getJobQueue().schedule(new Runnable() {
+                    @Override
+                    public void run() {
+                        try {
+                            appCtx.deinitialize();
+                        } catch (Exception e) {
+                            fv.setException(e);
+                        }
+                        fv.setValue(null);
+                    }
+                });
+            }
+        });
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/ApplicationStartEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/ApplicationStartEvent.java
new file mode 100644
index 0000000..9f4ad8f
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/ApplicationStartEvent.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import edu.uci.ics.hyracks.api.exceptions.HyracksException;
+import edu.uci.ics.hyracks.api.util.JavaSerializationUtils;
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.jobqueue.FutureValue;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteOp;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteRunner;
+import edu.uci.ics.hyracks.control.cc.remote.ops.ApplicationStarter;
+import edu.uci.ics.hyracks.control.common.application.ApplicationContext;
+
+public class ApplicationStartEvent implements Runnable {
+    private final ClusterControllerService ccs;
+    private final String appName;
+    private final FutureValue fv;
+
+    public ApplicationStartEvent(ClusterControllerService ccs, String appName, FutureValue fv) {
+        this.ccs = ccs;
+        this.appName = appName;
+        this.fv = fv;
+    }
+
+    @Override
+    public void run() {
+        ApplicationContext appCtx = ccs.getApplicationMap().get(appName);
+        if (appCtx == null) {
+            fv.setException(new HyracksException("No application with name: " + appName));
+            return;
+        }
+        try {
+            appCtx.initializeClassPath();
+            appCtx.initialize();
+            final byte[] distributedState = JavaSerializationUtils.serialize(appCtx.getDestributedState());
+            final boolean deployHar = appCtx.containsHar();
+            List<RemoteOp<Void>> opList = new ArrayList<RemoteOp<Void>>();
+            for (final String nodeId : ccs.getNodeMap().keySet()) {
+                opList.add(new ApplicationStarter(nodeId, appName, deployHar, distributedState));
+            }
+            final RemoteOp[] ops = opList.toArray(new RemoteOp[opList.size()]);
+            ccs.getExecutor().execute(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        RemoteRunner.runRemote(ccs, ops, null);
+                        fv.setValue(null);
+                    } catch (Exception e) {
+                        fv.setException(e);
+                    }
+                }
+            });
+        } catch (Exception e) {
+            fv.setException(e);
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobProfileJSONEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobProfileJSONEvent.java
new file mode 100644
index 0000000..dc397ef
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobProfileJSONEvent.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.json.JSONObject;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.JobAttempt;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+
+public class GetJobProfileJSONEvent extends SynchronizableRunnable {
+    private final ClusterControllerService ccs;
+    private final UUID jobId;
+    private final int attempt;
+    private JSONObject profile;
+
+    public GetJobProfileJSONEvent(ClusterControllerService ccs, UUID jobId, int attempt) {
+        this.ccs = ccs;
+        this.jobId = jobId;
+        this.attempt = attempt;
+    }
+
+    @Override
+    protected void doRun() throws Exception {
+        JobRun run = ccs.getRunMap().get(jobId);
+        profile = new JSONObject();
+        if (run == null) {
+            return;
+        }
+        List<JobAttempt> attempts = run.getAttempts();
+        if (attempts.size() <= attempt) {
+            return;
+        }
+        JobAttempt ja = attempts.get(attempt);
+        profile = ja.getJobProfile().toJSON();
+    }
+
+    public JSONObject getProfile() {
+        return profile;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobSpecificationJSONEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobSpecificationJSONEvent.java
new file mode 100644
index 0000000..6248925
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobSpecificationJSONEvent.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.UUID;
+
+import org.json.JSONObject;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+
+public class GetJobSpecificationJSONEvent extends SynchronizableRunnable {
+    private final ClusterControllerService ccs;
+    private final UUID jobId;
+    private JSONObject spec;
+
+    public GetJobSpecificationJSONEvent(ClusterControllerService ccs, UUID jobId) {
+        this.ccs = ccs;
+        this.jobId = jobId;
+    }
+
+    @Override
+    protected void doRun() throws Exception {
+        JobRun run = ccs.getRunMap().get(jobId);
+        if (run == null) {
+            spec = new JSONObject();
+            return;
+        }
+        spec = run.getJobPlan().getJobSpecification().toJSON();
+    }
+
+    public JSONObject getSpecification() {
+        return spec;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobStatusConditionVariableEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobStatusConditionVariableEvent.java
new file mode 100644
index 0000000..c80974a
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobStatusConditionVariableEvent.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.IJobStatusConditionVariable;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+
+public class GetJobStatusConditionVariableEvent extends SynchronizableRunnable {
+    private final ClusterControllerService ccs;
+    private final UUID jobId;
+    private IJobStatusConditionVariable cVar;
+
+    public GetJobStatusConditionVariableEvent(ClusterControllerService ccs, UUID jobId) {
+        this.ccs = ccs;
+        this.jobId = jobId;
+    }
+
+    @Override
+    protected void doRun() throws Exception {
+        cVar = ccs.getRunMap().get(jobId);
+    }
+
+    public IJobStatusConditionVariable getConditionVariable() {
+        return cVar;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobStatusEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobStatusEvent.java
new file mode 100644
index 0000000..9b15e5c
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobStatusEvent.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.job.JobStatus;
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+
+public class GetJobStatusEvent extends SynchronizableRunnable {
+    private final ClusterControllerService ccs;
+    private final UUID jobId;
+    private JobStatus status;
+
+    public GetJobStatusEvent(ClusterControllerService ccs, UUID jobId) {
+        this.ccs = ccs;
+        this.jobId = jobId;
+    }
+
+    @Override
+    protected void doRun() throws Exception {
+        JobRun run = ccs.getRunMap().get(jobId);
+        status = run == null ? null : run.getStatus();
+    }
+
+    public JobStatus getStatus() {
+        return status;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobSummariesJSONEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobSummariesJSONEvent.java
new file mode 100644
index 0000000..74851e5
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetJobSummariesJSONEvent.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+
+public class GetJobSummariesJSONEvent extends SynchronizableRunnable {
+    private final ClusterControllerService ccs;
+    private JSONArray summaries;
+
+    public GetJobSummariesJSONEvent(ClusterControllerService ccs) {
+        this.ccs = ccs;
+    }
+
+    @Override
+    protected void doRun() throws Exception {
+        summaries = new JSONArray();
+        for (JobRun run : ccs.getRunMap().values()) {
+            JSONObject jo = new JSONObject();
+            jo.put("type", "job-summary");
+            jo.put("id", run.getJobPlan().getJobId().toString());
+            jo.put("attempts", run.getAttempts().size());
+            jo.put("status", run.getStatus().toString());
+            summaries.put(jo);
+        }
+    }
+
+    public JSONArray getSummaries() {
+        return summaries;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetNodeEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetNodeEvent.java
new file mode 100644
index 0000000..7554e62
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/GetNodeEvent.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.NodeControllerState;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+
+public class GetNodeEvent extends SynchronizableRunnable {
+    private final ClusterControllerService ccs;
+    private final String nodeId;
+    private NodeControllerState state;
+
+    public GetNodeEvent(ClusterControllerService ccs, String nodeId) {
+        this.ccs = ccs;
+        this.nodeId = nodeId;
+    }
+
+    @Override
+    protected void doRun() throws Exception {
+        state = ccs.getNodeMap().get(nodeId);
+    }
+
+    public NodeControllerState getNodeState() {
+        return state;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobAbortEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobAbortEvent.java
new file mode 100644
index 0000000..9a0eff1
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobAbortEvent.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.NodeControllerState;
+import edu.uci.ics.hyracks.control.cc.job.JobAttempt;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+import edu.uci.ics.hyracks.control.cc.job.manager.JobLifecycleHelper;
+
+public class JobAbortEvent implements Runnable {
+    private final ClusterControllerService ccs;
+
+    private final UUID jobId;
+
+    private final int attempt;
+
+    public JobAbortEvent(ClusterControllerService ccs, UUID jobId, int attempt) {
+        this.ccs = ccs;
+        this.jobId = jobId;
+        this.attempt = attempt;
+    }
+
+    @Override
+    public void run() {
+        Map<String, NodeControllerState> nodeMap = ccs.getNodeMap();
+        Map<UUID, JobRun> runMap = ccs.getRunMap();
+        final JobRun run = runMap.get(jobId);
+        final Set<String> targetNodes = new HashSet<String>();
+        if (run != null) {
+            List<JobAttempt> jas = run.getAttempts();
+            JobAttempt ja = jas.get(attempt);
+            for (String runningNodeId : ja.getParticipatingNodeIds()) {
+                if (nodeMap.containsKey(runningNodeId)) {
+                    targetNodes.add(runningNodeId);
+                    nodeMap.get(runningNodeId).getActiveJobIds().remove(jobId);
+                }
+            }
+        }
+
+        ccs.getExecutor().execute(new Runnable() {
+            @Override
+            public void run() {
+                JobLifecycleHelper.abortJob(ccs, jobId, attempt, targetNodes);
+            }
+        });
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobAttemptStartEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobAttemptStartEvent.java
new file mode 100644
index 0000000..7dc6496
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobAttemptStartEvent.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.job.JobStatus;
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.JobAttempt;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+
+public class JobAttemptStartEvent implements Runnable {
+    private ClusterControllerService ccs;
+    private UUID jobId;
+
+    public JobAttemptStartEvent(ClusterControllerService ccs, UUID jobId) {
+        this.ccs = ccs;
+        this.jobId = jobId;
+    }
+
+    @Override
+    public void run() {
+        JobRun run = ccs.getRunMap().get(jobId);
+        int maxAttempts = run.getJobPlan().getJobSpecification().getMaxAttempts();
+        if (maxAttempts == 0) {
+            maxAttempts = ccs.getConfig().defaultMaxJobAttempts;
+        }
+        if (run.getAttempts().size() > maxAttempts) {
+            run.setStatus(JobStatus.FAILURE);
+            return;
+        }
+        JobAttempt attempt = run.createAttempt(ccs.getScheduler());
+        new ScheduleRunnableStagesEvent(ccs, jobId, attempt.getAttempt()).run();
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobCleanupEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobCleanupEvent.java
new file mode 100644
index 0000000..c4ed077
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobCleanupEvent.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.exceptions.HyracksException;
+import edu.uci.ics.hyracks.api.job.JobStatus;
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.NodeControllerState;
+import edu.uci.ics.hyracks.control.cc.application.CCApplicationContext;
+import edu.uci.ics.hyracks.control.cc.job.JobAttempt;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteRunner;
+import edu.uci.ics.hyracks.control.cc.remote.ops.JobCompleteNotifier;
+
+public class JobCleanupEvent implements Runnable {
+    private ClusterControllerService ccs;
+    private UUID jobId;
+    private int attempt;
+    private JobStatus status;
+
+    public JobCleanupEvent(ClusterControllerService ccs, UUID jobId, int attempt, JobStatus status) {
+        this.ccs = ccs;
+        this.jobId = jobId;
+        this.attempt = attempt;
+        this.status = status;
+    }
+
+    @Override
+    public void run() {
+        final JobRun run = ccs.getRunMap().get(jobId);
+        final JobAttempt ja = run.getAttempts().get(attempt);
+        Set<String> targetNodes = ja.getParticipatingNodeIds();
+        final JobCompleteNotifier[] jcns = new JobCompleteNotifier[targetNodes.size()];
+        int i = 0;
+        for (String n : targetNodes) {
+            jcns[i++] = new JobCompleteNotifier(n, jobId);
+        }
+        ccs.getExecutor().execute(new Runnable() {
+            @Override
+            public void run() {
+                if (jcns.length > 0) {
+                    try {
+                        RemoteRunner.runRemote(ccs, jcns, null);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+                ccs.getJobQueue().schedule(new Runnable() {
+                    @Override
+                    public void run() {
+                        CCApplicationContext appCtx = ccs.getApplicationMap().get(ja.getPlan().getApplicationName());
+                        if (appCtx != null) {
+                            try {
+                                appCtx.notifyJobFinish(jobId);
+                            } catch (HyracksException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                        Map<String, NodeControllerState> nodeMap = ccs.getNodeMap();
+                        for (String nodeId : ja.getParticipatingNodeIds()) {
+                            NodeControllerState state = nodeMap.get(nodeId);
+                            state.getActiveJobIds().remove(jobId);
+                        }
+                        run.setStatus(status);
+                    }
+                });
+            }
+        });
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobCreateEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobCreateEvent.java
new file mode 100644
index 0000000..3b03d25
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobCreateEvent.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.constraints.IConstraintExpressionAcceptor;
+import edu.uci.ics.hyracks.api.constraints.expressions.ConstraintExpression;
+import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
+import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
+import edu.uci.ics.hyracks.api.exceptions.HyracksException;
+import edu.uci.ics.hyracks.api.job.JobFlag;
+import edu.uci.ics.hyracks.api.job.JobPlan;
+import edu.uci.ics.hyracks.api.job.JobSpecification;
+import edu.uci.ics.hyracks.api.job.JobStatus;
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.application.CCApplicationContext;
+import edu.uci.ics.hyracks.control.cc.job.IConnectorDescriptorVisitor;
+import edu.uci.ics.hyracks.control.cc.job.IOperatorDescriptorVisitor;
+import edu.uci.ics.hyracks.control.cc.job.JobPlanBuilder;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+import edu.uci.ics.hyracks.control.cc.job.PlanUtils;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+
+public class JobCreateEvent extends SynchronizableRunnable {
+    private final ClusterControllerService ccs;
+    private final byte[] jobSpec;
+    private final EnumSet<JobFlag> jobFlags;
+    private final UUID jobId;
+    private final String appName;
+
+    public JobCreateEvent(ClusterControllerService ccs, UUID jobId, String appName, byte[] jobSpec,
+            EnumSet<JobFlag> jobFlags) {
+        this.jobId = jobId;
+        this.ccs = ccs;
+        this.jobSpec = jobSpec;
+        this.jobFlags = jobFlags;
+        this.appName = appName;
+    }
+
+    @Override
+    protected void doRun() throws Exception {
+        CCApplicationContext appCtx = ccs.getApplicationMap().get(appName);
+        if (appCtx == null) {
+            throw new HyracksException("No application with id " + appName + " found");
+        }
+        JobSpecification spec = appCtx.createJobSpecification(jobId, jobSpec);
+        JobRun run = plan(jobId, spec, jobFlags);
+        run.setStatus(JobStatus.INITIALIZED);
+
+        ccs.getRunMap().put(jobId, run);
+        appCtx.notifyJobCreation(jobId, spec);
+    }
+
+    public UUID getJobId() {
+        return jobId;
+    }
+
+    private JobRun plan(UUID jobId, JobSpecification jobSpec, EnumSet<JobFlag> jobFlags) throws Exception {
+        final JobPlanBuilder builder = new JobPlanBuilder();
+        builder.init(appName, jobId, jobSpec, jobFlags);
+        PlanUtils.visit(jobSpec, new IOperatorDescriptorVisitor() {
+            @Override
+            public void visit(IOperatorDescriptor op) {
+                op.contributeTaskGraph(builder);
+            }
+        });
+        final JobPlan plan = builder.getPlan();
+
+        final Set<ConstraintExpression> contributedConstraints = new HashSet<ConstraintExpression>();
+        final IConstraintExpressionAcceptor acceptor = new IConstraintExpressionAcceptor() {
+            @Override
+            public void addConstraintExpression(ConstraintExpression constraintExpression) {
+                contributedConstraints.add(constraintExpression);
+            }
+        };
+        PlanUtils.visit(jobSpec, new IOperatorDescriptorVisitor() {
+            @Override
+            public void visit(IOperatorDescriptor op) {
+                op.contributeSchedulingConstraints(acceptor, plan);
+            }
+        });
+        PlanUtils.visit(jobSpec, new IConnectorDescriptorVisitor() {
+            @Override
+            public void visit(IConnectorDescriptor conn) {
+                conn.contributeSchedulingConstraints(acceptor, plan);
+            }
+        });
+        contributedConstraints.addAll(jobSpec.getUserConstraints());
+
+        JobRun run = new JobRun(plan, contributedConstraints);
+
+        return run;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobStartEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobStartEvent.java
new file mode 100644
index 0000000..742885e
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/JobStartEvent.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.job.JobStatus;
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+
+public class JobStartEvent extends SynchronizableRunnable {
+    private final ClusterControllerService ccs;
+    private final UUID jobId;
+
+    public JobStartEvent(ClusterControllerService ccs, UUID jobId) {
+        this.ccs = ccs;
+        this.jobId = jobId;
+    }
+
+    @Override
+    protected void doRun() throws Exception {
+        JobRun run = ccs.getRunMap().get(jobId);
+        if (run == null) {
+            throw new Exception("Unable to find job with id = " + jobId);
+        }
+        if (run.getStatus() != JobStatus.INITIALIZED) {
+            throw new Exception("Job already started");
+        }
+        run.setStatus(JobStatus.RUNNING);
+
+        new JobAttemptStartEvent(ccs, jobId).run();
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/NodeHeartbeatEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/NodeHeartbeatEvent.java
new file mode 100644
index 0000000..348d703
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/NodeHeartbeatEvent.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.Map;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.NodeControllerState;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+
+public class NodeHeartbeatEvent extends SynchronizableRunnable {
+    private final ClusterControllerService ccs;
+    private final String nodeId;
+
+    public NodeHeartbeatEvent(ClusterControllerService ccs, String nodeId) {
+        this.ccs = ccs;
+        this.nodeId = nodeId;
+    }
+
+    @Override
+    protected void doRun() throws Exception {
+        Map<String, NodeControllerState> nodeMap = ccs.getNodeMap();
+        NodeControllerState state = nodeMap.get(nodeId);
+        if (state != null) {
+            state.notifyHeartbeat();
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/RegisterNodeEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/RegisterNodeEvent.java
new file mode 100644
index 0000000..0754dc1
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/RegisterNodeEvent.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.Map;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.NodeControllerState;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+
+public class RegisterNodeEvent extends SynchronizableRunnable {
+    private final ClusterControllerService ccs;
+    private final String nodeId;
+    private final NodeControllerState state;
+
+    public RegisterNodeEvent(ClusterControllerService ccs, String nodeId, NodeControllerState state) {
+        this.ccs = ccs;
+        this.nodeId = nodeId;
+        this.state = state;
+    }
+
+    @Override
+    protected void doRun() throws Exception {
+        Map<String, NodeControllerState> nodeMap = ccs.getNodeMap();
+        if (nodeMap.containsKey(nodeId)) {
+            throw new Exception("Node with this name already registered.");
+        }
+        nodeMap.put(nodeId, state);
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/RemoveDeadNodesEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/RemoveDeadNodesEvent.java
new file mode 100644
index 0000000..38fb7ae
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/RemoveDeadNodesEvent.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.logging.Logger;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.NodeControllerState;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+
+public class RemoveDeadNodesEvent implements Runnable {
+    private static Logger LOGGER = Logger.getLogger(RemoveDeadNodesEvent.class.getName());
+
+    private final ClusterControllerService ccs;
+
+    public RemoveDeadNodesEvent(ClusterControllerService ccs) {
+        this.ccs = ccs;
+    }
+
+    @Override
+    public void run() {
+        Set<String> deadNodes = new HashSet<String>();
+        Map<String, NodeControllerState> nodeMap = ccs.getNodeMap();
+        for (Map.Entry<String, NodeControllerState> e : nodeMap.entrySet()) {
+            NodeControllerState state = e.getValue();
+            if (state.incrementLastHeartbeatDuration() >= ccs.getConfig().maxHeartbeatLapsePeriods) {
+                deadNodes.add(e.getKey());
+                LOGGER.info(e.getKey() + " considered dead");
+            }
+        }
+        for (String deadNode : deadNodes) {
+            NodeControllerState state = nodeMap.remove(deadNode);
+            for (final UUID jid : state.getActiveJobIds()) {
+                JobRun run = ccs.getRunMap().get(jid);
+                int lastAttempt = run.getAttempts().size() - 1;
+                LOGGER.info("Aborting: " + jid);
+                ccs.getJobQueue().schedule(new JobAbortEvent(ccs, jid, lastAttempt));
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/ReportProfilesEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/ReportProfilesEvent.java
new file mode 100644
index 0000000..21c16c8
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/ReportProfilesEvent.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.job.profiling.om.JobProfile;
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.JobAttempt;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+
+public class ReportProfilesEvent implements Runnable {
+    private final ClusterControllerService ccs;
+    private final List<JobProfile> profiles;
+
+    public ReportProfilesEvent(ClusterControllerService ccs, List<JobProfile> profiles) {
+        this.ccs = ccs;
+        this.profiles = profiles;
+    }
+
+    @Override
+    public void run() {
+        Map<UUID, JobRun> runMap = ccs.getRunMap();
+        for (JobProfile profile : profiles) {
+            JobRun run = runMap.get(profile.getJobId());
+            if (run != null) {
+                JobAttempt ja = run.getAttempts().get(profile.getAttempt());
+                ja.getJobProfile().merge(profile);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/ScheduleRunnableStagesEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/ScheduleRunnableStagesEvent.java
new file mode 100644
index 0000000..ba1c711
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/ScheduleRunnableStagesEvent.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.logging.Logger;
+
+import edu.uci.ics.hyracks.api.comm.Endpoint;
+import edu.uci.ics.hyracks.api.dataflow.ActivityNodeId;
+import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
+import edu.uci.ics.hyracks.api.dataflow.PortInstanceId;
+import edu.uci.ics.hyracks.api.exceptions.HyracksException;
+import edu.uci.ics.hyracks.api.job.JobPlan;
+import edu.uci.ics.hyracks.api.job.JobStatus;
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.JobAttempt;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+import edu.uci.ics.hyracks.control.cc.job.JobStage;
+import edu.uci.ics.hyracks.control.cc.job.JobStageAttempt;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteRunner;
+import edu.uci.ics.hyracks.control.cc.remote.ops.Phase1Installer;
+import edu.uci.ics.hyracks.control.cc.remote.ops.Phase2Installer;
+import edu.uci.ics.hyracks.control.cc.remote.ops.Phase3Installer;
+import edu.uci.ics.hyracks.control.cc.remote.ops.PortMapMergingAccumulator;
+import edu.uci.ics.hyracks.control.cc.remote.ops.StageStarter;
+import edu.uci.ics.hyracks.control.cc.scheduler.ISchedule;
+
+public class ScheduleRunnableStagesEvent implements Runnable {
+    private static final Logger LOGGER = Logger.getLogger(ScheduleRunnableStagesEvent.class.getName());
+
+    private ClusterControllerService ccs;
+    private UUID jobId;
+    private int attempt;
+
+    public ScheduleRunnableStagesEvent(ClusterControllerService ccs, UUID jobId, int attempt) {
+        this.ccs = ccs;
+        this.jobId = jobId;
+        this.attempt = attempt;
+    }
+
+    @Override
+    public void run() {
+        JobRun run = ccs.getRunMap().get(jobId);
+        JobAttempt ja = run.getAttempts().get(attempt);
+        Set<UUID> pendingStages = ja.getPendingStageIds();
+        Set<UUID> scheduledStages = ja.getInProgressStageIds();
+
+        LOGGER.info(jobId + ":" + attempt + ":Pending stages: " + pendingStages + " Scheduled stages: "
+                + scheduledStages);
+        if (pendingStages.size() == 1 && scheduledStages.isEmpty()) {
+            LOGGER.info(jobId + ":" + attempt + ":No more runnable stages");
+            ccs.getJobQueue().schedule(new JobCleanupEvent(ccs, jobId, attempt, JobStatus.TERMINATED));
+            return;
+        }
+
+        Map<UUID, JobStageAttempt> stageAttemptMap = ja.getStageAttemptMap();
+
+        Set<JobStage> runnableStages = new HashSet<JobStage>();
+        ja.findRunnableStages(runnableStages);
+        LOGGER.info(jobId + ":" + attempt + ": Found " + runnableStages.size() + " runnable stages");
+
+        Set<JobStageAttempt> runnableStageAttempts = new HashSet<JobStageAttempt>();
+        for (JobStage rs : runnableStages) {
+            UUID stageId = rs.getId();
+            LOGGER.info("Runnable Stage: " + jobId + ":" + rs.getId());
+            pendingStages.remove(stageId);
+            scheduledStages.add(stageId);
+            JobStageAttempt jsa = new JobStageAttempt(rs, ja);
+            stageAttemptMap.put(stageId, jsa);
+            runnableStageAttempts.add(jsa);
+        }
+
+        try {
+            ccs.getScheduler().schedule(runnableStageAttempts);
+        } catch (HyracksException e) {
+            e.printStackTrace();
+            ccs.getJobQueue().schedule(new JobAbortEvent(ccs, jobId, attempt));
+            return;
+        }
+
+        final JobPlan plan = run.getJobPlan();
+        for (final JobStageAttempt jsa : runnableStageAttempts) {
+            ISchedule schedule = jsa.getSchedule();
+            final Map<OperatorDescriptorId, Integer> partCountMap = new HashMap<OperatorDescriptorId, Integer>();
+            final Map<String, Map<ActivityNodeId, Set<Integer>>> targetMap = new HashMap<String, Map<ActivityNodeId, Set<Integer>>>();
+            for (ActivityNodeId aid : jsa.getJobStage().getTasks()) {
+                String[] locations = schedule.getPartitions(aid);
+                partCountMap.put(aid.getOperatorDescriptorId(), locations.length);
+                int nLoc = locations.length;
+                for (int i = 0; i < nLoc; ++i) {
+                    Map<ActivityNodeId, Set<Integer>> target = targetMap.get(locations[i]);
+                    if (target == null) {
+                        target = new HashMap<ActivityNodeId, Set<Integer>>();
+                        targetMap.put(locations[i], target);
+                    }
+                    Set<Integer> partIdxs = target.get(aid);
+                    if (partIdxs == null) {
+                        partIdxs = new HashSet<Integer>();
+                        target.put(aid, partIdxs);
+                    }
+                    partIdxs.add(i);
+                }
+            }
+
+            Set<String> participatingNodeIds = ja.getParticipatingNodeIds();
+            for (String nid : targetMap.keySet()) {
+                ccs.getNodeMap().get(nid).getActiveJobIds().add(jobId);
+                participatingNodeIds.add(nid);
+            }
+
+            ccs.getExecutor().execute(new Runnable() {
+                @Override
+                public void run() {
+                    Phase1Installer p1is[] = new Phase1Installer[targetMap.size()];
+                    int i = 0;
+                    for (String nid : targetMap.keySet()) {
+                        p1is[i] = new Phase1Installer(nid, plan.getJobId(), plan.getApplicationName(), plan, jsa
+                                .getJobStage().getId(), jsa.getJobAttempt().getAttempt(), targetMap.get(nid),
+                                partCountMap);
+                        ++i;
+                    }
+                    LOGGER.info("Stage start - Phase 1");
+                    try {
+                        Map<PortInstanceId, Endpoint> globalPortMap = RemoteRunner.runRemote(ccs, p1is,
+                                new PortMapMergingAccumulator());
+
+                        Phase2Installer[] p2is = new Phase2Installer[targetMap.size()];
+                        Phase3Installer[] p3is = new Phase3Installer[targetMap.size()];
+                        StageStarter[] ss = new StageStarter[targetMap.size()];
+
+                        i = 0;
+                        for (String nid : targetMap.keySet()) {
+                            p2is[i] = new Phase2Installer(nid, plan.getJobId(), plan.getApplicationName(), plan, jsa
+                                    .getJobStage().getId(), targetMap.get(nid), partCountMap, globalPortMap);
+                            p3is[i] = new Phase3Installer(nid, plan.getJobId(), jsa.getJobStage().getId());
+                            ss[i] = new StageStarter(nid, plan.getJobId(), jsa.getJobStage().getId());
+                            ++i;
+                        }
+                        LOGGER.info("Stage start - Phase 2");
+                        RemoteRunner.runRemote(ccs, p2is, null);
+                        LOGGER.info("Stage start - Phase 3");
+                        RemoteRunner.runRemote(ccs, p3is, null);
+                        LOGGER.info("Stage start");
+                        RemoteRunner.runRemote(ccs, ss, null);
+                        LOGGER.info("Stage started");
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            });
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/StageletCompleteEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/StageletCompleteEvent.java
new file mode 100644
index 0000000..8f07d09
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/StageletCompleteEvent.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.Set;
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.JobAttempt;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+import edu.uci.ics.hyracks.control.cc.job.JobStageAttempt;
+
+public class StageletCompleteEvent implements Runnable {
+    private final ClusterControllerService ccs;
+    private final UUID jobId;
+    private final UUID stageId;
+    private final int attempt;
+    private final String nodeId;
+
+    public StageletCompleteEvent(ClusterControllerService ccs, UUID jobId, UUID stageId, int attempt, String nodeId) {
+        this.ccs = ccs;
+        this.jobId = jobId;
+        this.stageId = stageId;
+        this.attempt = attempt;
+        this.nodeId = nodeId;
+    }
+
+    @Override
+    public void run() {
+        JobRun run = ccs.getRunMap().get(jobId);
+        JobAttempt jobAttempt = run.getAttempts().get(attempt);
+        JobStageAttempt jsAttempt = jobAttempt.getStageAttemptMap().get(stageId);
+
+        Set<String> participatingNodes = jsAttempt.getParticipatingNodes();
+        Set<String> completedNodes = jsAttempt.getCompletedNodes();
+        completedNodes.add(nodeId);
+
+        if (completedNodes.containsAll(participatingNodes)) {
+            Set<UUID> completedStageIds = jobAttempt.getCompletedStageIds();
+            completedStageIds.add(stageId);
+
+            Set<UUID> inProgressStageIds = jobAttempt.getInProgressStageIds();
+            inProgressStageIds.remove(stageId);
+
+            ccs.getJobQueue().schedule(new ScheduleRunnableStagesEvent(ccs, jobId, attempt));
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "StageletCompleteEvent[" + jobId + ":" + stageId + ":" + attempt + ":" + nodeId + "]";
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/StageletFailureEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/StageletFailureEvent.java
new file mode 100644
index 0000000..34dbeb4
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/StageletFailureEvent.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.NodeControllerState;
+import edu.uci.ics.hyracks.control.cc.job.JobAttempt;
+import edu.uci.ics.hyracks.control.cc.job.JobRun;
+import edu.uci.ics.hyracks.control.cc.job.manager.JobLifecycleHelper;
+
+public class StageletFailureEvent implements Runnable {
+    private final ClusterControllerService ccs;
+    private final UUID jobId;
+    private final UUID stageId;
+    private final int attempt;
+    private final String nodeId;
+
+    public StageletFailureEvent(ClusterControllerService ccs, UUID jobId, UUID stageId, int attempt, String nodeId) {
+        this.ccs = ccs;
+        this.jobId = jobId;
+        this.stageId = stageId;
+        this.attempt = attempt;
+        this.nodeId = nodeId;
+    }
+
+    @Override
+    public void run() {
+        final JobRun run = ccs.getRunMap().get(jobId);
+        List<JobAttempt> attempts = run.getAttempts();
+        JobAttempt ja = attempts.get(attempt);
+        final Set<String> targetNodes = new HashSet<String>(ja.getParticipatingNodeIds());
+        Map<String, NodeControllerState> nodeMap = new HashMap<String, NodeControllerState>();
+        for (String nodeId : targetNodes) {
+            nodeMap.get(nodeId).getActiveJobIds().remove(jobId);
+        }
+        ccs.getExecutor().execute(new Runnable() {
+            @Override
+            public void run() {
+                JobLifecycleHelper.abortJob(ccs, jobId, attempt, targetNodes);
+            }
+        });
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/UnregisterNodeEvent.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/UnregisterNodeEvent.java
new file mode 100644
index 0000000..fc1ba03
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/manager/events/UnregisterNodeEvent.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.job.manager.events;
+
+import java.util.Map;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.NodeControllerState;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+
+public class UnregisterNodeEvent extends SynchronizableRunnable {
+    private final ClusterControllerService ccs;
+    private final String nodeId;
+
+    public UnregisterNodeEvent(ClusterControllerService ccs, String nodeId) {
+        this.ccs = ccs;
+        this.nodeId = nodeId;
+    }
+
+    @Override
+    protected void doRun() throws Exception {
+        Map<String, NodeControllerState> nodeMap = ccs.getNodeMap();
+        nodeMap.remove(nodeId);
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/jobqueue/FutureValue.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/jobqueue/FutureValue.java
new file mode 100644
index 0000000..25378c6
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/jobqueue/FutureValue.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.jobqueue;
+
+public class FutureValue {
+    private boolean done;
+
+    private Object value;
+
+    private Exception e;
+
+    public FutureValue() {
+        done = false;
+        value = null;
+        e = null;
+    }
+
+    public synchronized void setValue(Object value) {
+        done = true;
+        this.value = value;
+        e = null;
+        notifyAll();
+    }
+
+    public synchronized void setException(Exception e) {
+        done = true;
+        this.e = e;
+        value = null;
+        notifyAll();
+    }
+
+    public synchronized void reset() {
+        done = false;
+        value = null;
+        e = null;
+        notifyAll();
+    }
+
+    public synchronized Object get() throws Exception {
+        while (!done) {
+            wait();
+        }
+        if (e != null) {
+            throw e;
+        }
+        return value;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/jobqueue/JobQueue.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/jobqueue/JobQueue.java
new file mode 100644
index 0000000..f533ad0
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/jobqueue/JobQueue.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.jobqueue;
+
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.logging.Logger;
+
+public class JobQueue {
+    private static final Logger LOGGER = Logger.getLogger(JobQueue.class.getName());
+
+    private final LinkedBlockingQueue<Runnable> queue;
+    private final JobThread thread;
+
+    public JobQueue() {
+        queue = new LinkedBlockingQueue<Runnable>();
+        thread = new JobThread();
+        thread.start();
+    }
+
+    public void schedule(Runnable runnable) {
+        LOGGER.info("Scheduling: " + runnable);
+        queue.offer(runnable);
+    }
+
+    public void scheduleAndSync(SynchronizableRunnable sRunnable) throws Exception {
+        schedule(sRunnable);
+        sRunnable.sync();
+    }
+
+    private class JobThread extends Thread {
+        JobThread() {
+            setDaemon(true);
+        }
+
+        @Override
+        public void run() {
+            Runnable r;
+            while (true) {
+                try {
+                    r = queue.take();
+                } catch (InterruptedException e) {
+                    continue;
+                }
+                try {
+                    r.run();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/jobqueue/SynchronizableRunnable.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/jobqueue/SynchronizableRunnable.java
new file mode 100644
index 0000000..53315b7
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/jobqueue/SynchronizableRunnable.java
@@ -0,0 +1,41 @@
+package edu.uci.ics.hyracks.control.cc.jobqueue;
+
+public abstract class SynchronizableRunnable implements Runnable {
+    private boolean done;
+
+    private Exception e;
+
+    protected abstract void doRun() throws Exception;
+
+    public void init() {
+        done = false;
+        e = null;
+    }
+
+    @Override
+    public final void run() {
+        try {
+            doRun();
+        } catch (Exception e) {
+            this.e = e;
+        } finally {
+            synchronized (this) {
+                done = true;
+                notifyAll();
+            }
+        }
+    }
+
+    public final synchronized void sync() throws Exception {
+        while (!done) {
+            try {
+                wait();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+        if (e != null) {
+            throw e;
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/Accumulator.java
similarity index 76%
copy from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
copy to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/Accumulator.java
index 75edf2b..c728b0b 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/Accumulator.java
@@ -12,10 +12,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc.web.handlers.util;
+package edu.uci.ics.hyracks.control.cc.remote;
 
-import org.json.JSONObject;
+public interface Accumulator<T, R> {
+    public void accumulate(T o);
 
-public interface IJSONOutputFunction {
-    public JSONObject invoke(String[] arguments) throws Exception;
+    public R getResult();
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/RemoteOp.java
similarity index 73%
copy from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
copy to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/RemoteOp.java
index 75edf2b..c0a35cb 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/RemoteOp.java
@@ -12,10 +12,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc.web.handlers.util;
+package edu.uci.ics.hyracks.control.cc.remote;
 
-import org.json.JSONObject;
+import edu.uci.ics.hyracks.api.control.INodeController;
 
-public interface IJSONOutputFunction {
-    public JSONObject invoke(String[] arguments) throws Exception;
+public interface RemoteOp<T> {
+    public String getNodeId();
+
+    public T execute(INodeController node) throws Exception;
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/RemoteRunner.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/RemoteRunner.java
new file mode 100644
index 0000000..9bd4375
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/RemoteRunner.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.remote;
+
+import java.util.List;
+import java.util.Vector;
+import java.util.concurrent.Semaphore;
+
+import edu.uci.ics.hyracks.api.control.INodeController;
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.NodeControllerState;
+
+public class RemoteRunner {
+    public static <T, R> R runRemote(ClusterControllerService ccs, final RemoteOp<T>[] remoteOps,
+            final Accumulator<T, R> accumulator) throws Exception {
+        final Semaphore installComplete = new Semaphore(remoteOps.length);
+        final List<Exception> errors = new Vector<Exception>();
+        for (final RemoteOp<T> remoteOp : remoteOps) {
+            NodeControllerState nodeState = ccs.getNodeMap().get(remoteOp.getNodeId());
+            final INodeController node = nodeState.getNodeController();
+
+            installComplete.acquire();
+            Runnable remoteRunner = new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        T t = remoteOp.execute(node);
+                        if (accumulator != null) {
+                            synchronized (accumulator) {
+                                accumulator.accumulate(t);
+                            }
+                        }
+                    } catch (Exception e) {
+                        errors.add(e);
+                    } finally {
+                        installComplete.release();
+                    }
+                }
+            };
+
+            ccs.getExecutor().execute(remoteRunner);
+        }
+        installComplete.acquire(remoteOps.length);
+        if (!errors.isEmpty()) {
+            throw errors.get(0);
+        }
+        return accumulator == null ? null : accumulator.getResult();
+    }
+}
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/ApplicationDestroyer.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/ApplicationDestroyer.java
new file mode 100644
index 0000000..f8ca6af
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/ApplicationDestroyer.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.remote.ops;
+
+import edu.uci.ics.hyracks.api.control.INodeController;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteOp;
+
+public class ApplicationDestroyer implements RemoteOp<Void> {
+    private String nodeId;
+    private String appName;
+
+    public ApplicationDestroyer(String nodeId, String appName) {
+        this.nodeId = nodeId;
+        this.appName = appName;
+    }
+
+    @Override
+    public String getNodeId() {
+        return nodeId;
+    }
+
+    @Override
+    public Void execute(INodeController node) throws Exception {
+        node.destroyApplication(appName);
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return "Destroyed application: " + appName;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/ApplicationStarter.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/ApplicationStarter.java
new file mode 100644
index 0000000..af61249
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/ApplicationStarter.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.remote.ops;
+
+import edu.uci.ics.hyracks.api.control.INodeController;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteOp;
+
+public class ApplicationStarter implements RemoteOp<Void> {
+    private String nodeId;
+    private String appName;
+    private boolean deployHar;
+    private byte[] distributedState;
+
+    public ApplicationStarter(String nodeId, String appName, boolean deployHar, byte[] distributedState) {
+        this.nodeId = nodeId;
+        this.appName = appName;
+        this.deployHar = deployHar;
+        this.distributedState = distributedState;
+    }
+
+    @Override
+    public String getNodeId() {
+        return nodeId;
+    }
+
+    @Override
+    public Void execute(INodeController node) throws Exception {
+        node.createApplication(appName, deployHar, distributedState);
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return "Started application: " + appName;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/JobCompleteNotifier.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/JobCompleteNotifier.java
new file mode 100644
index 0000000..81a8610
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/JobCompleteNotifier.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.remote.ops;
+
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.control.INodeController;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteOp;
+
+public class JobCompleteNotifier implements RemoteOp<Void> {
+    private String nodeId;
+    private UUID jobId;
+
+    public JobCompleteNotifier(String nodeId, UUID jobId) {
+        this.nodeId = nodeId;
+        this.jobId = jobId;
+    }
+
+    @Override
+    public Void execute(INodeController node) throws Exception {
+        node.cleanUpJob(jobId);
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return jobId + " Cleaning Up";
+    }
+
+    @Override
+    public String getNodeId() {
+        return nodeId;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/JobletAborter.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/JobletAborter.java
new file mode 100644
index 0000000..b50aa8e
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/JobletAborter.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.remote.ops;
+
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.control.INodeController;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteOp;
+
+public class JobletAborter implements RemoteOp<Void> {
+    private String nodeId;
+    private UUID jobId;
+    private int attempt;
+
+    public JobletAborter(String nodeId, UUID jobId, int attempt) {
+        this.nodeId = nodeId;
+        this.jobId = jobId;
+        this.attempt = attempt;
+    }
+
+    @Override
+    public Void execute(INodeController node) throws Exception {
+        node.abortJoblet(jobId, attempt);
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return jobId + " Aborting";
+    }
+
+    @Override
+    public String getNodeId() {
+        return nodeId;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/Phase1Installer.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/Phase1Installer.java
new file mode 100644
index 0000000..2fe67ac
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/Phase1Installer.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.remote.ops;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.comm.Endpoint;
+import edu.uci.ics.hyracks.api.control.INodeController;
+import edu.uci.ics.hyracks.api.dataflow.ActivityNodeId;
+import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
+import edu.uci.ics.hyracks.api.dataflow.PortInstanceId;
+import edu.uci.ics.hyracks.api.job.JobPlan;
+import edu.uci.ics.hyracks.api.util.JavaSerializationUtils;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteOp;
+
+public class Phase1Installer implements RemoteOp<Map<PortInstanceId, Endpoint>> {
+    private String nodeId;
+    private UUID jobId;
+    private String appName;
+    private JobPlan plan;
+    private UUID stageId;
+    private int attempt;
+    private Map<ActivityNodeId, Set<Integer>> tasks;
+    private Map<OperatorDescriptorId, Integer> opNumPartitions;
+
+    public Phase1Installer(String nodeId, UUID jobId, String appName, JobPlan plan, UUID stageId, int attempt,
+            Map<ActivityNodeId, Set<Integer>> tasks, Map<OperatorDescriptorId, Integer> opNumPartitions) {
+        this.nodeId = nodeId;
+        this.jobId = jobId;
+        this.appName = appName;
+        this.plan = plan;
+        this.stageId = stageId;
+        this.attempt = attempt;
+        this.tasks = tasks;
+        this.opNumPartitions = opNumPartitions;
+    }
+
+    @Override
+    public Map<PortInstanceId, Endpoint> execute(INodeController node) throws Exception {
+        return node.initializeJobletPhase1(appName, jobId, attempt, JavaSerializationUtils.serialize(plan), stageId,
+                tasks, opNumPartitions);
+    }
+
+    @Override
+    public String toString() {
+        return jobId + " Distribution Phase 1";
+    }
+
+    @Override
+    public String getNodeId() {
+        return nodeId;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/Phase2Installer.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/Phase2Installer.java
new file mode 100644
index 0000000..99d7c9f
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/Phase2Installer.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.remote.ops;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.comm.Endpoint;
+import edu.uci.ics.hyracks.api.control.INodeController;
+import edu.uci.ics.hyracks.api.dataflow.ActivityNodeId;
+import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
+import edu.uci.ics.hyracks.api.dataflow.PortInstanceId;
+import edu.uci.ics.hyracks.api.job.JobPlan;
+import edu.uci.ics.hyracks.api.util.JavaSerializationUtils;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteOp;
+
+public class Phase2Installer implements RemoteOp<Void> {
+    private String nodeId;
+    private UUID jobId;
+    private String appName;
+    private JobPlan plan;
+    private UUID stageId;
+    private Map<ActivityNodeId, Set<Integer>> tasks;
+    private Map<OperatorDescriptorId, Integer> opNumPartitions;
+    private Map<PortInstanceId, Endpoint> globalPortMap;
+
+    public Phase2Installer(String nodeId, UUID jobId, String appName, JobPlan plan, UUID stageId,
+            Map<ActivityNodeId, Set<Integer>> tasks, Map<OperatorDescriptorId, Integer> opNumPartitions,
+            Map<PortInstanceId, Endpoint> globalPortMap) {
+        this.nodeId = nodeId;
+        this.jobId = jobId;
+        this.appName = appName;
+        this.plan = plan;
+        this.stageId = stageId;
+        this.tasks = tasks;
+        this.opNumPartitions = opNumPartitions;
+        this.globalPortMap = globalPortMap;
+    }
+
+    @Override
+    public Void execute(INodeController node) throws Exception {
+        node.initializeJobletPhase2(appName, jobId, JavaSerializationUtils.serialize(plan), stageId, tasks,
+                opNumPartitions, globalPortMap);
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return jobId + " Distribution Phase 2";
+    }
+
+    @Override
+    public String getNodeId() {
+        return nodeId;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/Phase3Installer.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/Phase3Installer.java
new file mode 100644
index 0000000..02f9aa1
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/Phase3Installer.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.remote.ops;
+
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.control.INodeController;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteOp;
+
+public class Phase3Installer implements RemoteOp<Void> {
+    private String nodeId;
+    private UUID jobId;
+    private UUID stageId;
+
+    public Phase3Installer(String nodeId, UUID jobId, UUID stageId) {
+        this.nodeId = nodeId;
+        this.jobId = jobId;
+        this.stageId = stageId;
+    }
+
+    @Override
+    public Void execute(INodeController node) throws Exception {
+        node.commitJobletInitialization(jobId, stageId);
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return jobId + " Distribution Phase 3";
+    }
+
+    @Override
+    public String getNodeId() {
+        return nodeId;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/PortMapMergingAccumulator.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/PortMapMergingAccumulator.java
new file mode 100644
index 0000000..8cffd08
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/PortMapMergingAccumulator.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.remote.ops;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import edu.uci.ics.hyracks.api.comm.Endpoint;
+import edu.uci.ics.hyracks.api.dataflow.PortInstanceId;
+import edu.uci.ics.hyracks.control.cc.remote.Accumulator;
+
+public class PortMapMergingAccumulator implements
+        Accumulator<Map<PortInstanceId, Endpoint>, Map<PortInstanceId, Endpoint>> {
+    Map<PortInstanceId, Endpoint> portMap = new HashMap<PortInstanceId, Endpoint>();
+
+    @Override
+    public void accumulate(Map<PortInstanceId, Endpoint> o) {
+        portMap.putAll(o);
+    }
+
+    @Override
+    public Map<PortInstanceId, Endpoint> getResult() {
+        return portMap;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/StageStarter.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/StageStarter.java
new file mode 100644
index 0000000..d62254b
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/remote/ops/StageStarter.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.remote.ops;
+
+import java.util.UUID;
+
+import edu.uci.ics.hyracks.api.control.INodeController;
+import edu.uci.ics.hyracks.control.cc.remote.RemoteOp;
+
+public class StageStarter implements RemoteOp<Void> {
+    private String nodeId;
+    private UUID jobId;
+    private UUID stageId;
+
+    public StageStarter(String nodeId, UUID jobId, UUID stageId) {
+        this.nodeId = nodeId;
+        this.jobId = jobId;
+        this.stageId = stageId;
+    }
+
+    @Override
+    public Void execute(INodeController node) throws Exception {
+        node.startStage(jobId, stageId);
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return jobId + " Started Stage: " + stageId;
+    }
+
+    @Override
+    public String getNodeId() {
+        return nodeId;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/scheduler/IJobAttemptSchedulerState.java
similarity index 76%
copy from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
copy to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/scheduler/IJobAttemptSchedulerState.java
index 75edf2b..f8fcb89 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/scheduler/IJobAttemptSchedulerState.java
@@ -12,10 +12,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc.web.handlers.util;
+package edu.uci.ics.hyracks.control.cc.scheduler;
 
-import org.json.JSONObject;
-
-public interface IJSONOutputFunction {
-    public JSONObject invoke(String[] arguments) throws Exception;
+public interface IJobAttemptSchedulerState {
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/scheduler/ISchedule.java
similarity index 76%
copy from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
copy to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/scheduler/ISchedule.java
index 75edf2b..2906ba6 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/scheduler/ISchedule.java
@@ -12,10 +12,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc.web.handlers.util;
+package edu.uci.ics.hyracks.control.cc.scheduler;
 
-import org.json.JSONObject;
+import edu.uci.ics.hyracks.api.dataflow.ActivityNodeId;
 
-public interface IJSONOutputFunction {
-    public JSONObject invoke(String[] arguments) throws Exception;
+public interface ISchedule {
+    public String[] getPartitions(ActivityNodeId aid);
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/scheduler/IScheduler.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/scheduler/IScheduler.java
new file mode 100644
index 0000000..3893a2d
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/scheduler/IScheduler.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.scheduler;
+
+import java.util.Set;
+
+import edu.uci.ics.hyracks.api.exceptions.HyracksException;
+import edu.uci.ics.hyracks.control.cc.job.JobAttempt;
+import edu.uci.ics.hyracks.control.cc.job.JobStageAttempt;
+
+public interface IScheduler {
+    public IJobAttemptSchedulerState createJobAttemptState(JobAttempt ja);
+
+    public void schedule(Set<JobStageAttempt> runnableStageAttempts) throws HyracksException;
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/scheduler/naive/NaiveScheduler.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/scheduler/naive/NaiveScheduler.java
new file mode 100644
index 0000000..f40e8cd
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/scheduler/naive/NaiveScheduler.java
@@ -0,0 +1,212 @@
+package edu.uci.ics.hyracks.control.cc.scheduler.naive;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import edu.uci.ics.hyracks.api.constraints.expressions.BelongsToExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.ConstantExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.ConstraintExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.ConstraintExpression.ExpressionTag;
+import edu.uci.ics.hyracks.api.constraints.expressions.EnumeratedCollectionExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.PartitionCountExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.PartitionLocationExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.RelationalExpression;
+import edu.uci.ics.hyracks.api.dataflow.ActivityNodeId;
+import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
+import edu.uci.ics.hyracks.api.exceptions.HyracksException;
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.JobAttempt;
+import edu.uci.ics.hyracks.control.cc.job.JobStageAttempt;
+import edu.uci.ics.hyracks.control.cc.scheduler.IJobAttemptSchedulerState;
+import edu.uci.ics.hyracks.control.cc.scheduler.ISchedule;
+import edu.uci.ics.hyracks.control.cc.scheduler.IScheduler;
+
+public class NaiveScheduler implements IScheduler {
+    private static final Logger LOGGER = Logger.getLogger(NaiveScheduler.class.getName());
+
+    private final ClusterControllerService ccs;
+
+    public NaiveScheduler(ClusterControllerService ccs) {
+        this.ccs = ccs;
+    }
+
+    @Override
+    public IJobAttemptSchedulerState createJobAttemptState(JobAttempt ja) {
+        return new JobAttemptState(ja.getJobRun().getConstraints());
+    }
+
+    @Override
+    public void schedule(Set<JobStageAttempt> runnableStageAttempts) throws HyracksException {
+        for (JobStageAttempt jsa : runnableStageAttempts) {
+            Set<OperatorDescriptorId> operators = new HashSet<OperatorDescriptorId>();
+            for (ActivityNodeId aid : jsa.getJobStage().getTasks()) {
+                operators.add(aid.getOperatorDescriptorId());
+            }
+            jsa.setSchedule(computeSchedule(jsa, operators));
+        }
+    }
+
+    private ISchedule computeSchedule(JobStageAttempt jsa, Set<OperatorDescriptorId> operators) throws HyracksException {
+        Set<String> nodeSet = ccs.getNodeMap().keySet();
+        if (nodeSet.isEmpty()) {
+            throw new HyracksException("0 usable nodes found");
+        }
+        String[] liveNodes = ccs.getNodeMap().keySet().toArray(new String[nodeSet.size()]);
+        JobAttempt ja = jsa.getJobAttempt();
+        final JobAttemptState jas = (JobAttemptState) ja.getSchedulerState();
+
+        List<PartitionLocationExpression> rrAssignment = new ArrayList<PartitionLocationExpression>();
+
+        for (OperatorDescriptorId oid : operators) {
+            String[] opParts = null;
+            if (!jas.allocations.containsKey(oid)) {
+                Set<ConstraintExpression> opConstraints = jas.opConstraints.get(oid);
+                System.err.println("Constraints: " + opConstraints);
+                for (ConstraintExpression ce : opConstraints) {
+                    int nParts = getNumPartitions(oid, ce);
+                    if (nParts != -1) {
+                        opParts = new String[nParts];
+                        break;
+                    }
+                }
+                if (opParts == null) {
+                    throw new HyracksException("Unable to satisfy constraints for operator : " + oid);
+                }
+                jas.allocations.put(oid, opParts);
+                BitSet unassignedPartsIds = new BitSet(opParts.length);
+                unassignedPartsIds.set(0, opParts.length);
+                for (ConstraintExpression ce : opConstraints) {
+                    if (ce.getTag() == ConstraintExpression.ExpressionTag.BELONGS_TO) {
+                        BelongsToExpression bE = (BelongsToExpression) ce;
+                        if (bE.getItemExpression().getTag() == ConstraintExpression.ExpressionTag.PARTITION_LOCATION) {
+                            PartitionLocationExpression plE = (PartitionLocationExpression) bE.getItemExpression();
+                            if (plE.getOperatorDescriptorId().equals(oid)) {
+                                int part = plE.getPartition();
+                                if (bE.getSetExpression().getTag() == ConstraintExpression.ExpressionTag.ENUMERATED_SET) {
+                                    EnumeratedCollectionExpression ecE = (EnumeratedCollectionExpression) bE
+                                            .getSetExpression();
+                                    for (ConstraintExpression value : ecE.getMembers()) {
+                                        if (value.getTag() == ConstraintExpression.ExpressionTag.CONSTANT) {
+                                            ConstantExpression nodeConst = (ConstantExpression) value;
+                                            String nodeId = (String) nodeConst.getValue();
+                                            if (nodeSet.contains(nodeId)) {
+                                                opParts[part] = nodeId;
+                                                unassignedPartsIds.clear(part);
+                                                LOGGER.info("Assigned: " + oid + ":" + part + ": " + nodeId);
+                                                break;
+                                            }
+                                        }
+                                    }
+                                }
+                                if (unassignedPartsIds.get(part)) {
+                                    throw new HyracksException("Unsatisfiable constraint for operator: " + oid);
+                                }
+                            }
+                        }
+                    }
+                }
+
+                if (!unassignedPartsIds.isEmpty()) {
+                    // Do round robin assignment.
+                    for (int i = unassignedPartsIds.nextSetBit(0); i >= 0; i = unassignedPartsIds.nextSetBit(i + 1)) {
+                        rrAssignment.add(new PartitionLocationExpression(oid, i));
+                    }
+                }
+            }
+        }
+        int n = rrAssignment.size();
+        for (int i = 0; i < n; ++i) {
+            PartitionLocationExpression plE = rrAssignment.get(i);
+            String[] opParts = jas.allocations.get(plE.getOperatorDescriptorId());
+            String node = liveNodes[i % liveNodes.length];
+            LOGGER.info("Assigned: " + plE.getOperatorDescriptorId() + ":" + plE.getPartition() + ": " + node);
+            opParts[plE.getPartition()] = node;
+        }
+        return new ISchedule() {
+            @Override
+            public String[] getPartitions(ActivityNodeId aid) {
+                return jas.allocations.get(aid.getOperatorDescriptorId());
+            }
+        };
+    }
+
+    private int getNumPartitions(OperatorDescriptorId oid, ConstraintExpression ce) {
+        System.err.println(ce);
+        if (ce.getTag() == ExpressionTag.RELATIONAL) {
+            RelationalExpression re = (RelationalExpression) ce;
+            if (re.getOperator() == RelationalExpression.Operator.EQUAL) {
+                System.err.println("Left: " + re.getLeft());
+                System.err.println("Right: " + re.getRight());
+                if (re.getLeft().getTag() == ConstraintExpression.ExpressionTag.PARTITION_COUNT) {
+                    return getNumPartitions(oid, (PartitionCountExpression) re.getLeft(), re.getRight());
+                } else if (re.getRight().getTag() == ConstraintExpression.ExpressionTag.PARTITION_COUNT) {
+                    return getNumPartitions(oid, (PartitionCountExpression) re.getRight(), re.getLeft());
+                }
+            }
+        }
+        return -1;
+    }
+
+    private int getNumPartitions(OperatorDescriptorId oid, PartitionCountExpression pce, ConstraintExpression ce) {
+        if (pce.getOperatorDescriptorId().equals(oid)) {
+            if (ce.getTag() == ConstraintExpression.ExpressionTag.CONSTANT) {
+                ConstantExpression constExpr = (ConstantExpression) ce;
+                Integer n = (Integer) constExpr.getValue();
+                return n.intValue();
+            }
+        }
+        return -1;
+    }
+
+    private static class JobAttemptState implements IJobAttemptSchedulerState {
+        final Map<OperatorDescriptorId, String[]> allocations;
+        final Map<OperatorDescriptorId, Set<ConstraintExpression>> opConstraints;
+
+        public JobAttemptState(Set<ConstraintExpression> constraints) {
+            allocations = new HashMap<OperatorDescriptorId, String[]>();
+            opConstraints = new HashMap<OperatorDescriptorId, Set<ConstraintExpression>>();
+            List<ConstraintExpression> ceList = new ArrayList<ConstraintExpression>();
+            for (ConstraintExpression ce : constraints) {
+                ceList.clear();
+                ceList.add(ce);
+                getAllConstraints(ceList);
+                for (ConstraintExpression ce2 : ceList) {
+                    switch (ce2.getTag()) {
+                        case PARTITION_COUNT:
+                            addToOpConstraints(opConstraints,
+                                    ((PartitionCountExpression) ce2).getOperatorDescriptorId(), ce);
+                            break;
+
+                        case PARTITION_LOCATION:
+                            addToOpConstraints(opConstraints,
+                                    ((PartitionLocationExpression) ce2).getOperatorDescriptorId(), ce);
+                            break;
+                    }
+                }
+            }
+        }
+
+        private static void addToOpConstraints(Map<OperatorDescriptorId, Set<ConstraintExpression>> opc,
+                OperatorDescriptorId opId, ConstraintExpression ce) {
+            Set<ConstraintExpression> opSet = opc.get(opId);
+            if (opSet == null) {
+                opSet = new HashSet<ConstraintExpression>();
+                opc.put(opId, opSet);
+            }
+            opSet.add(ce);
+        }
+
+        private static void getAllConstraints(List<ConstraintExpression> ceList) {
+            for (int i = 0; i < ceList.size(); ++i) {
+                ConstraintExpression cE = ceList.get(i);
+                cE.getChildren(ceList);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/AdminConsoleHandler.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/AdminConsoleHandler.java
new file mode 100644
index 0000000..1a26e60
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/AdminConsoleHandler.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.web;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.handler.AbstractHandler;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.NodeControllerState;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+
+public class AdminConsoleHandler extends AbstractHandler {
+    private ClusterControllerService ccs;
+
+    public AdminConsoleHandler(ClusterControllerService ccs) {
+        this.ccs = ccs;
+    }
+
+    @Override
+    public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
+            throws IOException, ServletException {
+        if (!"/".equals(target)) {
+            return;
+        }
+        response.setContentType("text/html;charset=utf-8");
+        response.setStatus(HttpServletResponse.SC_OK);
+        baseRequest.setHandled(true);
+        final PrintWriter writer = response.getWriter();
+        writer.println("<html><head><title>Hyracks Admin Console</title></head><body>");
+        writer.println("<h1>Hyracks Admin Console</h1>");
+        writer.println("<h2>Node Controllers</h2>");
+        writer.println("<table><tr><td>Node Id</td><td>Host</td></tr>");
+        try {
+            ccs.getJobQueue().scheduleAndSync(new SynchronizableRunnable() {
+                @Override
+                protected void doRun() throws Exception {
+                    for (Map.Entry<String, NodeControllerState> e : ccs.getNodeMap().entrySet()) {
+                        try {
+                            writer.print("<tr><td>");
+                            writer.print(e.getKey());
+                            writer.print("</td><td>");
+                            writer.print(e.getValue().getLastHeartbeatDuration());
+                            writer.print("</td></tr>");
+                        } catch (Exception ex) {
+                        }
+                    }
+                }
+            });
+        } catch (Exception e) {
+            throw new IOException(e);
+        }
+        writer.println("</table>");
+        writer.println("</body></html>");
+        writer.flush();
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/ApplicationInstallationHandler.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/ApplicationInstallationHandler.java
new file mode 100644
index 0000000..65c156c
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/ApplicationInstallationHandler.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.web;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.io.IOUtils;
+import org.eclipse.jetty.http.HttpMethods;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.handler.AbstractHandler;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.jobqueue.SynchronizableRunnable;
+import edu.uci.ics.hyracks.control.common.application.ApplicationContext;
+
+public class ApplicationInstallationHandler extends AbstractHandler {
+    private ClusterControllerService ccs;
+
+    public ApplicationInstallationHandler(ClusterControllerService ccs) {
+        this.ccs = ccs;
+    }
+
+    @Override
+    public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
+            throws IOException, ServletException {
+        try {
+            while (target.startsWith("/")) {
+                target = target.substring(1);
+            }
+            while (target.endsWith("/")) {
+                target = target.substring(0, target.length() - 1);
+            }
+            String[] parts = target.split("/");
+            if (parts.length != 1) {
+                return;
+            }
+            final String appName = parts[0];
+            if (HttpMethods.PUT.equals(request.getMethod())) {
+                class OutputStreamGetter extends SynchronizableRunnable {
+                    private OutputStream os;
+
+                    @Override
+                    protected void doRun() throws Exception {
+                        ApplicationContext appCtx;
+                        appCtx = ccs.getApplicationMap().get(appName);
+                        if (appCtx != null) {
+                            os = appCtx.getHarOutputStream();
+                        }
+                    }
+                }
+                OutputStreamGetter r = new OutputStreamGetter();
+                try {
+                    ccs.getJobQueue().scheduleAndSync(r);
+                } catch (Exception e) {
+                    throw new IOException(e);
+                }
+                try {
+                    IOUtils.copyLarge(request.getInputStream(), r.os);
+                } finally {
+                    r.os.close();
+                }
+            } else if (HttpMethods.GET.equals(request.getMethod())) {
+                class InputStreamGetter extends SynchronizableRunnable {
+                    private InputStream is;
+
+                    @Override
+                    protected void doRun() throws Exception {
+                        ApplicationContext appCtx;
+                        appCtx = ccs.getApplicationMap().get(appName);
+                        if (appCtx != null && appCtx.containsHar()) {
+                            is = appCtx.getHarInputStream();
+                        }
+                    }
+                }
+                InputStreamGetter r = new InputStreamGetter();
+                try {
+                    ccs.getJobQueue().scheduleAndSync(r);
+                } catch (Exception e) {
+                    throw new IOException(e);
+                }
+                if (r.is == null) {
+                    response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+                } else {
+                    response.setContentType("application/octet-stream");
+                    response.setStatus(HttpServletResponse.SC_OK);
+                    try {
+                        IOUtils.copyLarge(r.is, response.getOutputStream());
+                    } finally {
+                        r.is.close();
+                    }
+                }
+            }
+            baseRequest.setHandled(true);
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw e;
+        }
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/RESTAPIFunction.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/RESTAPIFunction.java
new file mode 100644
index 0000000..716dfcb
--- /dev/null
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/RESTAPIFunction.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.control.cc.web;
+
+import java.util.UUID;
+
+import org.json.JSONObject;
+
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.GetJobProfileJSONEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.GetJobSpecificationJSONEvent;
+import edu.uci.ics.hyracks.control.cc.job.manager.events.GetJobSummariesJSONEvent;
+import edu.uci.ics.hyracks.control.cc.web.util.IJSONOutputFunction;
+
+public class RESTAPIFunction implements IJSONOutputFunction {
+    private ClusterControllerService ccs;
+
+    public RESTAPIFunction(ClusterControllerService ccs) {
+        this.ccs = ccs;
+    }
+
+    @Override
+    public JSONObject invoke(String[] arguments) throws Exception {
+        JSONObject result = new JSONObject();
+        switch (arguments.length) {
+            case 1:
+                if (!"".equals(arguments[0])) {
+                    break;
+                }
+            case 0: {
+                GetJobSummariesJSONEvent gjse = new GetJobSummariesJSONEvent(ccs);
+                ccs.getJobQueue().scheduleAndSync(gjse);
+                result.put("result", gjse.getSummaries());
+                break;
+            }
+
+            case 2: {
+                UUID jobId = UUID.fromString(arguments[0]);
+
+                if ("spec".equalsIgnoreCase(arguments[1])) {
+                    GetJobSpecificationJSONEvent gjse = new GetJobSpecificationJSONEvent(ccs, jobId);
+                    ccs.getJobQueue().scheduleAndSync(gjse);
+                    result.put("result", gjse.getSpecification());
+                }
+                break;
+            }
+
+            case 3: {
+                UUID jobId = UUID.fromString(arguments[0]);
+                int attempt = Integer.parseInt(arguments[1]);
+
+                if ("profile".equalsIgnoreCase(arguments[2])) {
+                    GetJobProfileJSONEvent gjpe = new GetJobProfileJSONEvent(ccs, jobId, attempt);
+                    ccs.getJobQueue().scheduleAndSync(gjpe);
+                    result.put("result", gjpe.getProfile());
+                }
+                break;
+            }
+        }
+        return result;
+    }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/WebServer.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/WebServer.java
index 12dfe21..806a14e 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/WebServer.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/WebServer.java
@@ -17,16 +17,23 @@
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Handler;
 import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.ContextHandler;
 import org.eclipse.jetty.server.handler.ContextHandlerCollection;
 import org.eclipse.jetty.server.handler.HandlerCollection;
 import org.eclipse.jetty.server.nio.SelectChannelConnector;
 
+import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
+import edu.uci.ics.hyracks.control.cc.web.util.JSONOutputRequestHandler;
+import edu.uci.ics.hyracks.control.cc.web.util.RoutingHandler;
+
 public class WebServer {
+    private final ClusterControllerService ccs;
     private final Server server;
     private final SelectChannelConnector connector;
     private final HandlerCollection handlerCollection;
 
-    public WebServer() throws Exception {
+    public WebServer(ClusterControllerService ccs) throws Exception {
+        this.ccs = ccs;
         server = new Server();
 
         connector = new SelectChannelConnector();
@@ -35,6 +42,23 @@
 
         handlerCollection = new ContextHandlerCollection();
         server.setHandler(handlerCollection);
+        addHandlers();
+    }
+
+    private void addHandlers() {
+        ContextHandler handler = new ContextHandler("/state");
+        RoutingHandler rh = new RoutingHandler();
+        rh.addHandler("jobs", new JSONOutputRequestHandler(new RESTAPIFunction(ccs)));
+        handler.setHandler(rh);
+        addHandler(handler);
+
+        handler = new ContextHandler("/admin");
+        handler.setHandler(new AdminConsoleHandler(ccs));
+        addHandler(handler);
+
+        handler = new ContextHandler("/applications");
+        handler.setHandler(new ApplicationInstallationHandler(ccs));
+        addHandler(handler);
     }
 
     public void setPort(int port) {
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/util/IJSONOutputFunction.java
similarity index 92%
rename from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
rename to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/util/IJSONOutputFunction.java
index 75edf2b..f3582fb 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/IJSONOutputFunction.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/util/IJSONOutputFunction.java
@@ -12,7 +12,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc.web.handlers.util;
+package edu.uci.ics.hyracks.control.cc.web.util;
 
 import org.json.JSONObject;
 
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/JSONOutputRequestHandler.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/util/JSONOutputRequestHandler.java
similarity index 96%
rename from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/JSONOutputRequestHandler.java
rename to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/util/JSONOutputRequestHandler.java
index c6b8d9c..1cc4dcf 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/JSONOutputRequestHandler.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/util/JSONOutputRequestHandler.java
@@ -12,7 +12,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc.web.handlers.util;
+package edu.uci.ics.hyracks.control.cc.web.util;
 
 import java.io.IOException;
 
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/RoutingHandler.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/util/RoutingHandler.java
similarity index 97%
rename from hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/RoutingHandler.java
rename to hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/util/RoutingHandler.java
index 6afaf2a..21b5143 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/handlers/util/RoutingHandler.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/util/RoutingHandler.java
@@ -12,7 +12,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.cc.web.handlers.util;
+package edu.uci.ics.hyracks.control.cc.web.util;
 
 import java.io.IOException;
 import java.util.HashMap;
diff --git a/hyracks/hyracks-control-cc/src/main/resources/edu/uci/ics/hyracks/control/cc/scheduler.olg b/hyracks/hyracks-control-cc/src/main/resources/edu/uci/ics/hyracks/control/cc/scheduler.olg
deleted file mode 100644
index 8174098..0000000
--- a/hyracks/hyracks-control-cc/src/main/resources/edu/uci/ics/hyracks/control/cc/scheduler.olg
+++ /dev/null
@@ -1,337 +0,0 @@
-program hyrackscc;
-
-import java.util.UUID;
-import java.util.Set;
-import java.util.Map;
-import java.util.HashMap;
-
-import jol.types.basic.Tuple;
-import jol.types.basic.TupleSet;
-
-import edu.uci.ics.hyracks.api.dataflow.ActivityNodeId;
-import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
-import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
-import edu.uci.ics.hyracks.api.dataflow.ConnectorDescriptorId;
-import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
-import edu.uci.ics.hyracks.api.job.JobStatus;
-import edu.uci.ics.hyracks.api.job.JobPlan;
-
-watch(job, a);
-watch(job, i);
-watch(job, d);
-
-define(activitystage_temp, keys(), {UUID, OperatorDescriptorId, ActivityNodeId, Integer});
-
-activitystage_INITIAL activitystage_temp(JobId, OperatorId, ActivityId, 0) :-
-    activitynode(JobId, OperatorId, ActivityId, _);
-
-activitystage_BLOCKED activitystage_temp(JobId, OperatorId2, ActivityId2, StageNumber) :-
-/* use activitystage_temp#insert() to trigger only on insert */
-    activitystage_temp(JobId, OperatorId1, ActivityId1, StageNumber1),
-    activitystage_temp(JobId, OperatorId2, ActivityId2, StageNumber2),
-    activityblocked(JobId, OperatorId1, ActivityId1, OperatorId2, ActivityId2),
-    StageNumber2 <= StageNumber1
-    {
-        StageNumber := StageNumber1 + 1;
-    };
-
-activitystage_PIPELINED_1 activitystage_temp(JobId, OperatorId2, ActivityId2, StageNumber) :-
-    activitystage_temp(JobId, OperatorId1, ActivityId1, StageNumber1),
-    activitystage_temp(JobId, OperatorId2, ActivityId2, StageNumber2),
-    activityconnection(JobId, OperatorId1, Operator1Port, edu.uci.ics.hyracks.api.dataflow.Direction.OUTPUT, ActivityId1, _),
-    activityconnection(JobId, OperatorId2, Operator2Port, edu.uci.ics.hyracks.api.dataflow.Direction.INPUT, ActivityId2, _),
-    connectordescriptor(JobId, _, OperatorId1, Operator1Port, OperatorId2, Operator2Port, _),
-    StageNumber1 != StageNumber2
-    {
-        StageNumber := java.lang.Math.max(StageNumber1, StageNumber2);
-    };
-
-activitystage_PIPELINED_2 activitystage_temp(JobId, OperatorId1, ActivityId1, StageNumber) :-
-    activitystage_temp(JobId, OperatorId1, ActivityId1, StageNumber1),
-    activitystage_temp(JobId, OperatorId2, ActivityId2, StageNumber2),
-    activityconnection(JobId, OperatorId1, Operator1Port, edu.uci.ics.hyracks.api.dataflow.Direction.OUTPUT, ActivityId1, _),
-    activityconnection(JobId, OperatorId2, Operator2Port, edu.uci.ics.hyracks.api.dataflow.Direction.INPUT, ActivityId2, _),
-    connectordescriptor(JobId, _, OperatorId1, Operator1Port, OperatorId2, Operator2Port, _),
-    StageNumber1 != StageNumber2
-    {
-        StageNumber := java.lang.Math.max(StageNumber1, StageNumber2);
-    };
-
-watch(activitystage_temp, a);
-
-watch(activityconnection, a);
-watch(activityblocked, a);
-watch(operatordescriptor, a);
-watch(connectordescriptor, a);
-
-watch(activitystage, a);
-watch(activitystage, i);
-watch(activitystage, d);
-
-define(activitystage, keys(0, 1, 2), {UUID, OperatorDescriptorId, ActivityNodeId, Integer});
-
-activitystage(JobId, OperatorId, ActivityId, max<StageNumber>) :-
-    activitystage_temp(JobId, OperatorId, ActivityId, StageNumber);
-
-define(jobstage, keys(0, 1), {UUID, Integer, UUID});
-
-jobstage(JobId, StageNumber, StageId) :-
-    activitystage(JobId, _, _, StageNumber)
-    {
-        StageId := java.util.UUID.randomUUID();
-    };
-
-watch(jobstage, a);
-
-define(jobattempt, keys(), {UUID, Integer});
-
-jobattempt(JobId, 0) :-
-    job(JobId, _, edu.uci.ics.hyracks.api.job.JobStatus.INITIALIZED, _, _, _),
-    jobstart(JobId, _);
-
-jobattempt(JobId, NextAttempt) :-
-    jobattempt(JobId, Attempt),
-    stagestart(JobId, _, Attempt),
-    abortcomplete(JobId, _, Attempt)
-    {
-        NextAttempt := Attempt + 1;
-    };
-
-job(JobId, AppName, Status, JobSpec, JobPlan, Stats) :-
-    job(JobId, AppName, Status, JobSpec, JobPlan, Stats),
-    profileupdate(JobId, _, JobletStats)
-    {
-        Stats.putAll(JobletStats);
-    };
-
-define(stagestart, keys(), {UUID, Integer, Integer});
-define(stagefinish, keys(0, 1, 2), {UUID, Integer, Integer, Map});
-
-watch(jobstart, i);
-
-stagestart_INITIAL stagestart(JobId, 0, Attempt) :-
-    jobattempt#insert(JobId, Attempt);
-
-update_job_status_RUNNING job(JobId, AppName, edu.uci.ics.hyracks.api.job.JobStatus.RUNNING, JobSpec, JobPlan, Stats) :-
-    job(JobId, AppName, edu.uci.ics.hyracks.api.job.JobStatus.INITIALIZED, JobSpec, JobPlan, Stats),
-    jobstart(JobId, _);
-
-stagestart_NEXT stagestart(JobId, NextStageNumber, Attempt) :-
-    stagestart(JobId, StageNumber, Attempt),
-    stagefinish#insert(StageId, StageNumber, Attempt, _)
-    {
-        NextStageNumber := StageNumber + 1;
-    };
-
-watch(stagestart, a);
-watch(stagestart, d);
-
-define(operatorlocationcandidates, keys(), {UUID, OperatorDescriptorId, String, Integer, Integer});
-
-operatorlocationcandidates(JobId, OperatorId, NodeId, Partition, Benefit) :-
-    operatorlocation(JobId, OperatorId, NodeId, Partition, Benefit),
-    availablenodes(NodeId);
-
-watch(availablenodes, a);
-watch(availablenodes, i);
-watch(availablenodes, d);
-
-define(availablenodecount, keys(0), {Integer, Integer});
-
-watch(availablenodecount, a);
-watch(availablenodecount, i);
-watch(availablenodecount, d);
-
-/* Try not using a 0 key -- Tyson feels that should work! */
-availablenodecount(0, count<NodeId>) :-
-    availablenodes(NodeId);
-
-watch(rankedavailablenodes, a);
-watch(rankedavailablenodes, i);
-watch(rankedavailablenodes, d);
-
-watch(operatorlocationcandidates, a);
-watch(operatorlocationcandidates, i);
-watch(operatorlocationcandidates, d);
-
-define(maxoperatorlocationbenefit, keys(0, 1, 2), {UUID, OperatorDescriptorId, Integer, Integer});
-
-maxoperatorlocationbenefit(JobId, OperatorId, Partition, max<Benefit>) :-
-    operatorlocationcandidates(JobId, OperatorId, _, Partition, Benefit);
-
-watch(maxoperatorlocationbenefit, a);
-watch(maxoperatorlocationbenefit, i);
-watch(maxoperatorlocationbenefit, d);
-
-define(attemptoperatorlocationdecision, keys(0, 1, 3, 4), {UUID, OperatorDescriptorId, String, Integer, Integer});
-
-watch(attemptoperatorlocationdecision, a);
-watch(attemptoperatorlocationdecision, i);
-watch(attemptoperatorlocationdecision, d);
-
-attemptoperatorlocationdecision(JobId, OperatorId, NodeId, Partition, Attempt) :-
-    jobattempt#insert(JobId, Attempt),
-    operatorlocationcandidates(JobId, OperatorId, NodeId, Partition, Benefit),
-    maxoperatorlocationbenefit(JobId, OperatorId, Partition, Benefit);
-
-attemptoperatorlocationdecision(JobId, OperatorId, NodeId, Partition, Attempt) :-
-    jobattempt#insert(JobId, Attempt),
-    operatorclonecountexpansiontotalorder(JobId, OperatorId, Partition, CloneRank),
-    rankedavailablenodes(NodeId, NodeRank),
-    availablenodecount(_, NodeCount),
-    NodeRank == CloneRank % NodeCount;
-
-define(operatorclonecount_temp, keys(), {UUID, OperatorDescriptorId, Integer, Integer});
-
-operatorclonecount_temp(JobId, OperatorId, NPartitions, 0) :-
-    operatorclonecount(JobId, OperatorId, NPartitions);
-
-define(operatorclonecountexpansiontotalorder, keys(0, 1, 2), {UUID, OperatorDescriptorId, Integer, Integer});
-
-operatorclonecountexpansiontotalorder(JobId, OperatorId, Partition, Rank) :-
-    expandpartitioncountconstraint(operatorclonecount_temp(JobId, OperatorId, Partition, Rank));
-
-watch(operatorclonecountexpansiontotalorder, a);
-watch(operatorclonecountexpansiontotalorder, i);
-watch(operatorclonecountexpansiontotalorder, d);
-
-watch(operatorclonecount, a);
-watch(operatorclonecount, i);
-watch(operatorclonecount, d);
-
-define(activitystart, keys(), {UUID, OperatorDescriptorId, ActivityNodeId, Integer, Integer, UUID, String, Integer});
-
-activitystart(JobId, OperatorId, ActivityId, StageNumber, Attempt, StageId, NodeId, Partition) :-
-    stagestart#insert(JobId, StageNumber, Attempt),
-    operatordescriptor(JobId, OperatorId, _, _),
-    activitystage(JobId, OperatorId, ActivityId, StageNumber),
-    jobstage(JobId, StageNumber, StageId),
-    attemptoperatorlocationdecision(JobId, OperatorId, NodeId, Partition, Attempt);
-
-watch(activitystart, a);
-
-define(stageletstart, keys(0, 1, 4, 5), {UUID, UUID, String, JobPlan, String, Integer, Set});
-
-stageletstart(JobId, StageId, AppName, JobPlan, NodeId, Attempt, set<ActivityInfo>) :-
-    activitystart#insert(JobId, _, ActivityId, StageNumber, Attempt, StageId, NodeId, Partition),
-    job(JobId, AppName, edu.uci.ics.hyracks.api.job.JobStatus.RUNNING, _, JobPlan, _)
-    {
-        ActivityInfo := [ActivityId, Partition];
-    };
-
-watch(stageletstart, a);
-watch(stageletstart, i);
-
-define(startmessage_agg, keys(0, 1, 2), {UUID, UUID, Integer, String, JobPlan, Set});
-
-startmessage_agg(JobId, StageId, Attempt, AppName, JobPlan, set<Tuple>) :-
-    stageletstart#insert(JobId, StageId, AppName, JobPlan, NodeId, Attempt, ActivityInfoSet),
-    availablenodes(NodeId),
-    ActivityInfoSet.size() != 0
-    {
-        Tuple := [NodeId, ActivityInfoSet];
-    };
-
-startmessage(JobId, StageId, Attempt, AppName, JobPlan, TSet) :-
-    startmessage_agg(JobId, StageId, Attempt, AppName, JobPlan, TSet);
-
-watch(startmessage, a);
-watch(startmessage, i);
-
-define(stageletabort, keys(0, 1, 3, 4), {UUID, UUID, JobPlan, String, Integer, Set});
-
-stageletabort(JobId, StageId, JobPlan, NodeId, Attempt, ActivityIdSet) :-
-    stageletfailure(JobId, StageId, NodeId, Attempt),
-    stageletstart(JobId, StageId, _, JobPlan, NodeId, Attempt, ActivityIdSet);
-
-stageletabort(JobId, StageId, JobPlan, NodeIdOther, Attempt, ActivityIdSet) :-
-    stageletstart(JobId, StageId, _, JobPlan, NodeId, Attempt, _),
-    stageletstart(JobId, StageId, _, _, NodeIdOther, Attempt, ActivityIdSet),
-    failednodes#insert(NodeId),
-    notin stageletcomplete(JobId, StageId, NodeId, Attempt, _);
-
-watch(stageletabort, a);
-watch(stageletabort, i);
-watch(stageletabort, d);
-
-define(stageabort, keys(0, 1, 2), {UUID, UUID, Integer, Set});
-
-stageabort(JobId, StageId, Attempt, set<NodeId>) :-
-    stageletabort#insert(JobId, StageId, _, NodeId, Attempt, _);
-
-define(abortmessage_agg, keys(0, 1, 2), {UUID, UUID, Integer, JobPlan, Set});
-
-abortmessage_agg(JobId, StageId, Attempt, JobPlan, set<Tuple>) :-
-    stageletabort#insert(JobId, StageId, JobPlan, NodeId, Attempt, ActivityIdSet),
-    availablenodes(NodeId)
-    {
-        Tuple := [NodeId, ActivityIdSet];
-    };
-
-abortmessage(JobId, StageId, Attempt, JobPlan, TSet) :-
-    abortmessage_agg(JobId, StageId, Attempt, JobPlan, TSet),
-    TSet.size() != 0;
-
-watch(abortmessage, a);
-watch(abortmessage, i);
-
-define(stageletabortcomplete, keys(), {UUID, UUID, String, Integer});
-
-stageletabortcomplete(JobId, StageId, NodeId, Attempt) :-
-    abortnotify(JobId, StageId, NodeId, Attempt);
-
-stageletabortcomplete(JobId, StageId, NodeId, Attempt) :-
-    stageletabort(JobId, StageId, _, NodeId, Attempt, _),
-    notin availablenodes(NodeId);
-
-define(stageletabortcomplete_agg, keys(0, 1, 2), {UUID, UUID, Integer, Set});
-
-stageletabortcomplete_agg(JobId, StageId, Attempt, set<NodeId>) :-
-    stageletabortcomplete(JobId, StageId, NodeId, Attempt);
-
-define(abortcomplete, keys(), {UUID, UUID, Integer});
-
-abortcomplete(JobId, StageId, Attempt) :-
-    stageletabortcomplete_agg(JobId, StageId, Attempt, NodeIdSet1),
-    stageabort(JobId, StageId, Attempt, NodeIdSet2),
-    NodeIdSet1.size() == NodeIdSet2.size();
-
-define(stageletcompletecount, keys(0, 1, 2), {UUID, UUID, Integer, Integer});
-
-stageletcompletecount(JobId, StageId, Attempt, count<NodeId>) :-
-    stageletcomplete(JobId, StageId, NodeId, Attempt, _);
-
-define(stageletcomplete_agg, keys(0, 1, 2), {UUID, UUID, Integer, Map});
-
-stageletcomplete_agg(JobId, StageId, Attempt, generic<(new HashMap()).putAll(Statistics)>) :-
-    stageletcomplete(JobId, StageId, NodeId, Attempt, Statistics);
-
-stagefinish(JobId, StageNumber, Attempt, SMap) :-
-    startmessage_agg(JobId, StageId, Attempt, _, _, TSet),
-    stageletcompletecount(JobId, StageId, Attempt, Count),
-    stageletcomplete_agg(JobId, StageId, Attempt, SMap),
-    jobstage(JobId, StageNumber, StageId),
-    TSet.size() == Count;
-
-update_job_status_TERMINATED job(JobId, AppName, edu.uci.ics.hyracks.api.job.JobStatus.TERMINATED, JobSpec, JobPlan, NewStats) :-
-    job(JobId, AppName, edu.uci.ics.hyracks.api.job.JobStatus.RUNNING, JobSpec, JobPlan, Stats),
-    stagestart#insert(JobId, StageNumber, Attempt),
-    stagefinish(JobId, _, Attempt, SMap),
-    notin jobstage(JobId, StageNumber)
-    {
-        NewStats := new HashMap();
-        NewStats.putAll(Stats);
-        NewStats.putAll(SMap);
-    };
-
-define(jobcleanup_agg, {UUID, String, Set});
-
-jobcleanup_agg(JobId, AppName, set<NodeId>) :-
-    stagestart#insert(JobId, StageNumber, Attempt),
-    stagefinish(JobId, _, Attempt, _),
-    attemptoperatorlocationdecision(JobId, _, NodeId, _, Attempt),
-    job(JobId, AppName, _, _, _, _),
-    notin jobstage(JobId, StageNumber);
-
-jobcleanup(JobId, AppName, NodeIdSet) :-
-    jobcleanup_agg(JobId, AppName, NodeIdSet);
diff --git a/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/Joblet.java b/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/Joblet.java
index d7b2e5d..6cc7450 100644
--- a/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/Joblet.java
+++ b/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/Joblet.java
@@ -16,9 +16,7 @@
 
 import java.nio.ByteBuffer;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Map;
-import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.Executor;
 
@@ -31,14 +29,17 @@
 import edu.uci.ics.hyracks.api.io.IIOManager;
 import edu.uci.ics.hyracks.api.io.IWorkspaceFileFactory;
 import edu.uci.ics.hyracks.api.job.IOperatorEnvironment;
+import edu.uci.ics.hyracks.api.job.profiling.counters.ICounter;
 import edu.uci.ics.hyracks.api.job.profiling.counters.ICounterContext;
+import edu.uci.ics.hyracks.api.job.profiling.om.JobletProfile;
+import edu.uci.ics.hyracks.api.job.profiling.om.StageletProfile;
 import edu.uci.ics.hyracks.api.resources.IDeallocatable;
+import edu.uci.ics.hyracks.control.common.job.profiling.counters.Counter;
 import edu.uci.ics.hyracks.control.nc.io.IOManager;
 import edu.uci.ics.hyracks.control.nc.io.ManagedWorkspaceFileFactory;
-import edu.uci.ics.hyracks.control.nc.job.profiling.CounterContext;
 import edu.uci.ics.hyracks.control.nc.resources.DefaultDeallocatableRegistry;
 
-public class Joblet implements IHyracksJobletContext {
+public class Joblet implements IHyracksJobletContext, ICounterContext {
     private static final long serialVersionUID = 1L;
 
     private final NodeControllerService nodeController;
@@ -53,7 +54,7 @@
 
     private final Map<OperatorDescriptorId, Map<Integer, IOperatorEnvironment>> envMap;
 
-    private final ICounterContext counterContext;
+    private final Map<String, Counter> counterMap;
 
     private final DefaultDeallocatableRegistry deallocatableRegistry;
 
@@ -66,7 +67,7 @@
         this.attempt = attempt;
         stageletMap = new HashMap<UUID, Stagelet>();
         envMap = new HashMap<OperatorDescriptorId, Map<Integer, IOperatorEnvironment>>();
-        counterContext = new CounterContext(getJobId() + "." + nodeController.getId());
+        counterMap = new HashMap<String, Counter>();
         deallocatableRegistry = new DefaultDeallocatableRegistry();
         fileFactory = new ManagedWorkspaceFileFactory(this, (IOManager) appCtx.getRootContext().getIOManager());
     }
@@ -117,8 +118,7 @@
         return nodeController.getExecutor();
     }
 
-    public synchronized void notifyStageletComplete(UUID stageId, int attempt, Map<String, Long> stats)
-            throws Exception {
+    public synchronized void notifyStageletComplete(UUID stageId, int attempt, StageletProfile stats) throws Exception {
         stageletMap.remove(stageId);
         nodeController.notifyStageComplete(jobId, stageId, attempt, stats);
     }
@@ -132,19 +132,15 @@
         return nodeController;
     }
 
-    public void dumpProfile(Map<String, Long> counterDump) {
-        Set<UUID> stageIds;
-        synchronized (this) {
-            stageIds = new HashSet<UUID>(stageletMap.keySet());
+    public synchronized void dumpProfile(JobletProfile jProfile) {
+        Map<String, Long> counters = jProfile.getCounters();
+        for (Map.Entry<String, Counter> e : counterMap.entrySet()) {
+            counters.put(e.getKey(), e.getValue().get());
         }
-        for (UUID stageId : stageIds) {
-            Stagelet si;
-            synchronized (this) {
-                si = stageletMap.get(stageId);
-            }
-            if (si != null) {
-                si.dumpProfile(counterDump);
-            }
+        for (Stagelet si : stageletMap.values()) {
+            StageletProfile sProfile = new StageletProfile(si.getStageId());
+            si.dumpProfile(sProfile);
+            jProfile.getStageletProfiles().put(si.getStageId(), sProfile);
         }
     }
 
@@ -160,7 +156,7 @@
 
     @Override
     public ICounterContext getCounterContext() {
-        return counterContext;
+        return this;
     }
 
     @Override
@@ -191,4 +187,18 @@
     public FileReference createWorkspaceFile(String prefix) throws HyracksDataException {
         return fileFactory.createWorkspaceFile(prefix);
     }
+
+    public Map<UUID, Stagelet> getStageletMap() {
+        return stageletMap;
+    }
+
+    @Override
+    public synchronized ICounter getCounter(String name, boolean create) {
+        Counter counter = counterMap.get(name);
+        if (counter == null && create) {
+            counter = new Counter(name);
+            counterMap.put(name, counter);
+        }
+        return counter;
+    }
 }
\ No newline at end of file
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 19c8ed8..2702386 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
@@ -25,7 +25,6 @@
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
@@ -78,6 +77,9 @@
 import edu.uci.ics.hyracks.api.job.JobPlan;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.api.job.profiling.counters.ICounter;
+import edu.uci.ics.hyracks.api.job.profiling.om.JobProfile;
+import edu.uci.ics.hyracks.api.job.profiling.om.JobletProfile;
+import edu.uci.ics.hyracks.api.job.profiling.om.StageletProfile;
 import edu.uci.ics.hyracks.control.common.AbstractRemoteService;
 import edu.uci.ics.hyracks.control.common.application.ApplicationContext;
 import edu.uci.ics.hyracks.control.common.context.ServerContext;
@@ -210,7 +212,7 @@
     @Override
     public Map<PortInstanceId, Endpoint> initializeJobletPhase1(String appName, UUID jobId, int attempt,
             byte[] planBytes, UUID stageId, Map<ActivityNodeId, Set<Integer>> tasks,
-            Map<OperatorDescriptorId, Set<Integer>> opPartitions) throws Exception {
+            Map<OperatorDescriptorId, Integer> opNumPartitions) throws Exception {
         try {
             LOGGER.log(Level.INFO, String.valueOf(jobId) + "[" + id + ":" + stageId + "]: Initializing Joblet Phase 1");
 
@@ -248,7 +250,7 @@
                 List<IConnectorDescriptor> inputs = plan.getTaskInputs(hanId);
                 for (int i : tasks.get(hanId)) {
                     IOperatorNodePushable hon = han.createPushRuntime(stagelet, joblet.getEnvironment(op, i), rdp, i,
-                            opPartitions.get(op.getOperatorId()).size());
+                            opNumPartitions.get(op.getOperatorId()));
                     OperatorRunnable or = new OperatorRunnable(stagelet, hon);
                     stagelet.setOperator(op.getOperatorId(), i, or);
                     if (inputs != null) {
@@ -272,8 +274,8 @@
                                 LOGGER.finest("Created endpoint " + piId + " -> " + endpoint);
                             }
                             portMap.put(piId, endpoint);
-                            IFrameReader reader = createReader(stagelet, conn, drlf, i, plan, stagelet, opPartitions
-                                    .get(producerOpId).size(), opPartitions.get(consumerOpId).size());
+                            IFrameReader reader = createReader(stagelet, conn, drlf, i, plan, stagelet,
+                                    opNumPartitions.get(producerOpId), opNumPartitions.get(consumerOpId));
                             or.setFrameReader(reader);
                         }
                     }
@@ -329,7 +331,7 @@
 
     @Override
     public void initializeJobletPhase2(String appName, UUID jobId, byte[] planBytes, UUID stageId,
-            Map<ActivityNodeId, Set<Integer>> tasks, Map<OperatorDescriptorId, Set<Integer>> opPartitions,
+            Map<ActivityNodeId, Set<Integer>> tasks, Map<OperatorDescriptorId, Integer> opNumPartitions,
             final Map<PortInstanceId, Endpoint> globalPortMap) throws Exception {
         try {
             LOGGER.log(Level.INFO, String.valueOf(jobId) + "[" + id + ":" + stageId + "]: Initializing Joblet Phase 2");
@@ -374,8 +376,8 @@
                                 }
                             };
                             or.setFrameWriter(j, conn.createSendSideWriter(stagelet, plan.getJobSpecification()
-                                    .getConnectorRecordDescriptor(conn), edwFactory, i, opPartitions.get(producerOpId)
-                                    .size(), opPartitions.get(consumerOpId).size()), spec
+                                    .getConnectorRecordDescriptor(conn), edwFactory, i, opNumPartitions
+                                    .get(producerOpId), opNumPartitions.get(consumerOpId)), spec
                                     .getConnectorRecordDescriptor(conn));
                         }
                     }
@@ -444,7 +446,7 @@
     private synchronized Joblet getOrCreateLocalJoblet(UUID jobId, int attempt, INCApplicationContext appCtx)
             throws Exception {
         Joblet ji = jobletMap.get(jobId);
-        if (ji == null) {
+        if (ji == null || ji.getAttempt() != attempt) {
             ji = new Joblet(this, jobId, attempt, appCtx);
             jobletMap.put(jobId, ji);
         }
@@ -478,7 +480,7 @@
         }
     }
 
-    public void notifyStageComplete(UUID jobId, UUID stageId, int attempt, Map<String, Long> stats) throws Exception {
+    public void notifyStageComplete(UUID jobId, UUID stageId, int attempt, StageletProfile stats) throws Exception {
         try {
             ccs.notifyStageletComplete(jobId, stageId, attempt, id, stats);
         } catch (Exception e) {
@@ -533,24 +535,26 @@
         @Override
         public void run() {
             try {
-                Map<UUID, Map<String, Long>> counterDump = new HashMap<UUID, Map<String, Long>>();
-                Set<UUID> jobIds;
+                List<JobProfile> profiles;
                 synchronized (NodeControllerService.this) {
-                    jobIds = new HashSet<UUID>(jobletMap.keySet());
+                    profiles = new ArrayList<JobProfile>();
+                    for (Joblet ji : jobletMap.values()) {
+                        profiles.add(new JobProfile(ji.getJobId(), ji.getAttempt()));
+                    }
                 }
-                for (UUID jobId : jobIds) {
+                for (JobProfile jProfile : profiles) {
                     Joblet ji;
+                    JobletProfile jobletProfile = new JobletProfile(id);
                     synchronized (NodeControllerService.this) {
-                        ji = jobletMap.get(jobId);
+                        ji = jobletMap.get(jProfile.getJobId());
                     }
                     if (ji != null) {
-                        Map<String, Long> jobletCounterDump = new HashMap<String, Long>();
-                        ji.dumpProfile(jobletCounterDump);
-                        counterDump.put(jobId, jobletCounterDump);
+                        ji.dumpProfile(jobletProfile);
+                        jProfile.getJobletProfiles().put(id, jobletProfile);
                     }
                 }
-                if (!counterDump.isEmpty()) {
-                    cc.reportProfile(id, counterDump);
+                if (!profiles.isEmpty()) {
+                    cc.reportProfile(id, profiles);
                 }
             } catch (Exception e) {
                 e.printStackTrace();
@@ -559,14 +563,19 @@
     }
 
     @Override
-    public synchronized void abortJoblet(UUID jobId, UUID stageId) throws Exception {
+    public synchronized void abortJoblet(UUID jobId, int attempt) throws Exception {
+        if (LOGGER.isLoggable(Level.INFO)) {
+            LOGGER.info("Aborting Job: " + jobId + ":" + attempt);
+        }
         Joblet ji = jobletMap.get(jobId);
         if (ji != null) {
-            Stagelet stagelet = ji.getStagelet(stageId);
-            if (stagelet != null) {
+            if (ji.getAttempt() == attempt) {
+                jobletMap.remove(jobId);
+            }
+            for (Stagelet stagelet : ji.getStageletMap().values()) {
                 stagelet.abort();
                 stagelet.close();
-                connectionManager.abortConnections(jobId, stageId);
+                connectionManager.abortConnections(jobId, stagelet.getStageId());
             }
         }
     }
diff --git a/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/Stagelet.java b/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/Stagelet.java
index 3565445..eb283c2 100644
--- a/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/Stagelet.java
+++ b/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/Stagelet.java
@@ -21,7 +21,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.TreeMap;
 import java.util.UUID;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -35,15 +34,17 @@
 import edu.uci.ics.hyracks.api.io.FileReference;
 import edu.uci.ics.hyracks.api.io.IIOManager;
 import edu.uci.ics.hyracks.api.io.IWorkspaceFileFactory;
+import edu.uci.ics.hyracks.api.job.profiling.counters.ICounter;
 import edu.uci.ics.hyracks.api.job.profiling.counters.ICounterContext;
+import edu.uci.ics.hyracks.api.job.profiling.om.StageletProfile;
 import edu.uci.ics.hyracks.api.resources.IDeallocatable;
+import edu.uci.ics.hyracks.control.common.job.profiling.counters.Counter;
 import edu.uci.ics.hyracks.control.nc.io.IOManager;
 import edu.uci.ics.hyracks.control.nc.io.ManagedWorkspaceFileFactory;
-import edu.uci.ics.hyracks.control.nc.job.profiling.CounterContext;
 import edu.uci.ics.hyracks.control.nc.resources.DefaultDeallocatableRegistry;
 import edu.uci.ics.hyracks.control.nc.runtime.OperatorRunnable;
 
-public class Stagelet implements IHyracksStageletContext {
+public class Stagelet implements IHyracksStageletContext, ICounterContext {
     private static final long serialVersionUID = 1L;
 
     private static final Logger LOGGER = Logger.getLogger(Stagelet.class.getName());
@@ -56,7 +57,7 @@
 
     private final Map<OperatorInstanceId, OperatorRunnable> honMap;
 
-    private final CounterContext stageletCounterContext;
+    private final Map<String, Counter> counterMap;
 
     private final IWorkspaceFileFactory fileFactory;
 
@@ -77,7 +78,7 @@
         pendingOperators = new HashSet<OperatorInstanceId>();
         started = false;
         honMap = new HashMap<OperatorInstanceId, OperatorRunnable>();
-        stageletCounterContext = new CounterContext(joblet.getJobId() + "." + stageId + "." + nodeId);
+        counterMap = new HashMap<String, Counter>();
         deallocatableRegistry = new DefaultDeallocatableRegistry();
         fileFactory = new ManagedWorkspaceFileFactory(this, (IOManager) joblet.getIOManager());
     }
@@ -90,10 +91,6 @@
         return honMap;
     }
 
-    public CounterContext getStageletCounterContext() {
-        return stageletCounterContext;
-    }
-
     public void setEndpointList(List<Endpoint> endpointList) {
         this.endpointList = endpointList;
     }
@@ -143,12 +140,7 @@
                     LOGGER.log(Level.INFO, joblet.getJobId() + ":" + stageId + ":" + opIId.getOperatorId() + ":"
                             + opIId.getPartition() + "(" + hon + ")" + ": ABORTED");
                     e.printStackTrace();
-                    // DO NOT UNCOMMENT THE FOLLOWING LINE.
-                    // The failure of an operator triggers a re-attempt of the job at the CC. If the failure was non-transient,
-                    // this will lead to an infinite number of attempts since there is no upper bount yet on how many times
-                    // a job is retried.
-
-                    // notifyOperatorFailure(opIId);
+                    notifyOperatorFailure(opIId);
                 }
             }
         });
@@ -158,10 +150,10 @@
         pendingOperators.remove(opIId);
         if (pendingOperators.isEmpty()) {
             try {
-                Map<String, Long> stats = new TreeMap<String, Long>();
-                dumpProfile(stats);
+                StageletProfile sProfile = new StageletProfile(stageId);
+                dumpProfile(sProfile);
                 close();
-                joblet.notifyStageletComplete(stageId, attempt, stats);
+                joblet.notifyStageletComplete(stageId, attempt, sProfile);
             } catch (Exception e) {
                 e.printStackTrace();
             }
@@ -183,8 +175,11 @@
         }
     }
 
-    public void dumpProfile(Map<String, Long> counterDump) {
-        stageletCounterContext.dump(counterDump);
+    public synchronized void dumpProfile(StageletProfile sProfile) {
+        Map<String, Long> dumpMap = sProfile.getCounters();
+        for (Counter c : counterMap.values()) {
+            dumpMap.put(c.getName(), c.get());
+        }
     }
 
     @Override
@@ -199,7 +194,7 @@
 
     @Override
     public ICounterContext getCounterContext() {
-        return stageletCounterContext;
+        return this;
     }
 
     @Override
@@ -230,4 +225,14 @@
     public FileReference createWorkspaceFile(String prefix) throws HyracksDataException {
         return fileFactory.createWorkspaceFile(prefix);
     }
+
+    @Override
+    public ICounter getCounter(String name, boolean create) {
+        Counter counter = counterMap.get(name);
+        if (counter == null && create) {
+            counter = new Counter(name);
+            counterMap.put(name, counter);
+        }
+        return counter;
+    }
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/HadoopReadOperatorDescriptor.java b/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/HadoopReadOperatorDescriptor.java
index 4f0ae2f..915d09b 100644
--- a/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/HadoopReadOperatorDescriptor.java
+++ b/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/HadoopReadOperatorDescriptor.java
@@ -31,7 +31,7 @@
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
 import org.apache.hadoop.util.ReflectionUtils;
 
-import edu.uci.ics.hyracks.api.constraints.PartitionCountConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.context.IHyracksStageletContext;
 import edu.uci.ics.hyracks.api.dataflow.IOperatorNodePushable;
 import edu.uci.ics.hyracks.api.dataflow.value.IRecordDescriptorProvider;
@@ -74,7 +74,7 @@
         }
         recordDescriptors[0] = DatatypeHelper.createKeyValueRecordDescriptor((Class<? extends Writable>) recordReader
                 .createKey().getClass(), (Class<? extends Writable>) recordReader.createValue().getClass());
-        this.setPartitionConstraint(new PartitionCountConstraint(splits.length));
+        PartitionConstraintHelper.addPartitionCountConstraint(spec, this, splits.length);
         inputSplitsProxy = new InputSplitsProxy(jobConf, splits);
         this.inputFormatClassName = inputFormat.getClass().getName();
     }
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java
index aaae486..0eebd93 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/base/AbstractConnectorDescriptor.java
@@ -19,8 +19,10 @@
 import org.json.JSONException;
 import org.json.JSONObject;
 
+import edu.uci.ics.hyracks.api.constraints.IConstraintExpressionAcceptor;
 import edu.uci.ics.hyracks.api.dataflow.ConnectorDescriptorId;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
+import edu.uci.ics.hyracks.api.job.JobPlan;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 
 public abstract class AbstractConnectorDescriptor implements IConnectorDescriptor {
@@ -46,4 +48,9 @@
 
         return jconn;
     }
+
+    @Override
+    public void contributeSchedulingConstraints(IConstraintExpressionAcceptor constraintAcceptor, JobPlan plan) {
+        // do nothing
+    }
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java
index b8af305..7e97975 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/base/AbstractOperatorDescriptor.java
@@ -19,10 +19,11 @@
 import org.json.JSONException;
 import org.json.JSONObject;
 
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.IConstraintExpressionAcceptor;
 import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
 import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
+import edu.uci.ics.hyracks.api.job.JobPlan;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 
 public abstract class AbstractOperatorDescriptor implements IOperatorDescriptor {
@@ -30,8 +31,6 @@
 
     protected final OperatorDescriptorId odId;
 
-    protected PartitionConstraint partitionConstraint;
-
     protected String[] partitions;
 
     protected final RecordDescriptor[] recordDescriptors;
@@ -64,21 +63,16 @@
     }
 
     @Override
-    public PartitionConstraint getPartitionConstraint() {
-        return partitionConstraint;
-    }
-
-    @Override
-    public void setPartitionConstraint(PartitionConstraint partitionConstraint) {
-        this.partitionConstraint = partitionConstraint;
-    }
-
-    @Override
     public RecordDescriptor[] getOutputRecordDescriptors() {
         return recordDescriptors;
     }
 
     @Override
+    public void contributeSchedulingConstraints(IConstraintExpressionAcceptor constraintAcceptor, JobPlan plan) {
+        // do nothing
+    }
+
+    @Override
     public JSONObject toJSON() throws JSONException {
         JSONObject jop = new JSONObject();
         jop.put("type", "operator");
@@ -86,7 +80,6 @@
         jop.put("java-class", getClass().getName());
         jop.put("in-arity", getInputArity());
         jop.put("out-arity", getOutputArity());
-        jop.put("partition-constraint", String.valueOf(partitionConstraint));
         return jop;
     }
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/connectors/OneToOneConnectorDescriptor.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/connectors/OneToOneConnectorDescriptor.java
index e1154e4..a038a40 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/connectors/OneToOneConnectorDescriptor.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/connectors/OneToOneConnectorDescriptor.java
@@ -17,10 +17,15 @@
 import edu.uci.ics.hyracks.api.comm.IConnectionDemultiplexer;
 import edu.uci.ics.hyracks.api.comm.IFrameReader;
 import edu.uci.ics.hyracks.api.comm.IFrameWriter;
+import edu.uci.ics.hyracks.api.constraints.IConstraintExpressionAcceptor;
+import edu.uci.ics.hyracks.api.constraints.expressions.PartitionCountExpression;
+import edu.uci.ics.hyracks.api.constraints.expressions.RelationalExpression;
 import edu.uci.ics.hyracks.api.context.IHyracksStageletContext;
 import edu.uci.ics.hyracks.api.dataflow.IEndpointDataWriterFactory;
+import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.api.job.JobPlan;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.dataflow.common.comm.NonDeterministicFrameReader;
 import edu.uci.ics.hyracks.dataflow.std.base.AbstractConnectorDescriptor;
@@ -45,4 +50,15 @@
             throws HyracksDataException {
         return new NonDeterministicFrameReader(ctx, demux);
     }
+
+    @Override
+    public void contributeSchedulingConstraints(IConstraintExpressionAcceptor constraintAcceptor, JobPlan plan) {
+        JobSpecification jobSpec = plan.getJobSpecification();
+        IOperatorDescriptor consumer = jobSpec.getConsumer(this);
+        IOperatorDescriptor producer = jobSpec.getProducer(this);
+
+        constraintAcceptor.addConstraintExpression(new RelationalExpression(new PartitionCountExpression(consumer
+                .getOperatorId()), new PartitionCountExpression(producer.getOperatorId()),
+                RelationalExpression.Operator.EQUAL));
+    }
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/InsertPipelineExample.java b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/InsertPipelineExample.java
index 07fd5ba..b5468ad 100644
--- a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/InsertPipelineExample.java
+++ b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/InsertPipelineExample.java
@@ -22,10 +22,7 @@
 
 import edu.uci.ics.hyracks.api.client.HyracksRMIConnection;
 import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
@@ -128,9 +125,7 @@
         DataGenOperatorDescriptor dataGen = new DataGenOperatorDescriptor(spec, recDesc, options.numTuples, 2, 0,
                 100000, 10, 100);
         // run data generator on first nodecontroller given
-        PartitionConstraint dataGenConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(splitNCs[0]) });
-        dataGen.setPartitionConstraint(dataGenConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, dataGen, splitNCs[0]);
 
         IBTreeRegistryProvider btreeRegistryProvider = BTreeRegistryProvider.INSTANCE;
         IStorageManagerInterface storageManager = StorageManagerInterface.INSTANCE;
@@ -164,8 +159,7 @@
                 recDesc, storageManager, btreeRegistryProvider, primarySplitProvider, primaryInteriorFrameFactory,
                 primaryLeafFrameFactory, primaryTypeTraits, primaryComparatorFactories, primaryFieldPermutation,
                 BTreeOp.BTO_INSERT);
-        PartitionConstraint primaryInsertConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        primaryInsert.setPartitionConstraint(primaryInsertConstraint);
+        JobHelper.createPartitionConstraint(spec, primaryInsert, splitNCs);
 
         // prepare insertion into secondary index
         // tuples to be put into B-Tree shall have 2 fields
@@ -194,13 +188,11 @@
                 recDesc, storageManager, btreeRegistryProvider, secondarySplitProvider, secondaryInteriorFrameFactory,
                 secondaryLeafFrameFactory, secondaryTypeTraits, secondaryComparatorFactories,
                 secondaryFieldPermutation, BTreeOp.BTO_INSERT);
-        PartitionConstraint secondaryInsertConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        secondaryInsert.setPartitionConstraint(secondaryInsertConstraint);
+        JobHelper.createPartitionConstraint(spec, secondaryInsert, splitNCs);
 
         // end the insert pipeline at this sink operator
         NullSinkOperatorDescriptor nullSink = new NullSinkOperatorDescriptor(spec);
-        PartitionConstraint nullSinkPartitionConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        nullSink.setPartitionConstraint(nullSinkPartitionConstraint);
+        JobHelper.createPartitionConstraint(spec, nullSink, splitNCs);
 
         // distribute the records from the datagen via hashing to the bulk load
         // ops
diff --git a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/JobHelper.java b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/JobHelper.java
index af79d32..63f07f0 100644
--- a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/JobHelper.java
+++ b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/JobHelper.java
@@ -17,11 +17,10 @@
 
 import java.io.File;
 
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
+import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
 import edu.uci.ics.hyracks.api.io.FileReference;
+import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.dataflow.std.file.ConstantFileSplitProvider;
 import edu.uci.ics.hyracks.dataflow.std.file.FileSplit;
 import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
@@ -37,11 +36,7 @@
         return splitProvider;
     }
 
-    public static PartitionConstraint createPartitionConstraint(String[] splitNCs) {
-        LocationConstraint[] lConstraints = new LocationConstraint[splitNCs.length];
-        for (int i = 0; i < splitNCs.length; ++i) {
-            lConstraints[i] = new AbsoluteLocationConstraint(splitNCs[i]);
-        }
-        return new ExplicitPartitionConstraint(lConstraints);
+    public static void createPartitionConstraint(JobSpecification spec, IOperatorDescriptor op, String[] splitNCs) {
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, op, splitNCs);
     }
 }
diff --git a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexBulkLoadExample.java b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexBulkLoadExample.java
index 336efb3..204bdf5 100644
--- a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexBulkLoadExample.java
+++ b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexBulkLoadExample.java
@@ -21,10 +21,7 @@
 
 import edu.uci.ics.hyracks.api.client.HyracksRMIConnection;
 import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
@@ -125,9 +122,7 @@
         DataGenOperatorDescriptor dataGen = new DataGenOperatorDescriptor(spec, recDesc, options.numTuples, 2, 0,
                 100000, 10, 50);
         // run data generator on first nodecontroller given
-        PartitionConstraint dataGenConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(splitNCs[0]) });
-        dataGen.setPartitionConstraint(dataGenConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, dataGen, splitNCs[0]);
 
         // sort the tuples as preparation for bulk load
         // fields to sort on
@@ -137,8 +132,7 @@
         comparatorFactories[0] = IntegerBinaryComparatorFactory.INSTANCE;
         ExternalSortOperatorDescriptor sorter = new ExternalSortOperatorDescriptor(spec, options.sbSize, sortFields,
                 comparatorFactories, recDesc);
-        PartitionConstraint sorterConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        sorter.setPartitionConstraint(sorterConstraint);
+        JobHelper.createPartitionConstraint(spec, sorter, splitNCs);
 
         // tuples to be put into B-Tree shall have 4 fields
         int fieldCount = 4;
@@ -164,8 +158,7 @@
         BTreeBulkLoadOperatorDescriptor btreeBulkLoad = new BTreeBulkLoadOperatorDescriptor(spec, storageManager,
                 btreeRegistryProvider, btreeSplitProvider, interiorFrameFactory, leafFrameFactory, typeTraits,
                 comparatorFactories, fieldPermutation, 0.7f);
-        PartitionConstraint bulkLoadConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        btreeBulkLoad.setPartitionConstraint(bulkLoadConstraint);
+        JobHelper.createPartitionConstraint(spec, btreeBulkLoad, splitNCs);
 
         // distribute the records from the datagen via hashing to the bulk load
         // ops
diff --git a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexEnlistFilesExample.java b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexEnlistFilesExample.java
index fedf0bf..a7ee0dc 100644
--- a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexEnlistFilesExample.java
+++ b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexEnlistFilesExample.java
@@ -21,7 +21,6 @@
 
 import edu.uci.ics.hyracks.api.client.HyracksRMIConnection;
 import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.dataflow.value.ITypeTrait;
@@ -112,8 +111,7 @@
         BTreeFileEnlistmentOperatorDescriptor fileEnlistmentOp = new BTreeFileEnlistmentOperatorDescriptor(spec,
                 recDesc, storageManager, btreeRegistryProvider, btreeSplitProvider, interiorFrameFactory,
                 leafFrameFactory, typeTraits, comparatorFactories);
-        PartitionConstraint fileEnlistmentConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        fileEnlistmentOp.setPartitionConstraint(fileEnlistmentConstraint);
+        JobHelper.createPartitionConstraint(spec, fileEnlistmentOp, splitNCs);
 
         spec.addRoot(fileEnlistmentOp);
 
diff --git a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexSearchExample.java b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexSearchExample.java
index fe9bee2..b43efd2 100644
--- a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexSearchExample.java
+++ b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/PrimaryIndexSearchExample.java
@@ -22,7 +22,6 @@
 
 import edu.uci.ics.hyracks.api.client.HyracksRMIConnection;
 import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.dataflow.value.ITypeTrait;
@@ -137,8 +136,7 @@
 
         ConstantTupleSourceOperatorDescriptor keyProviderOp = new ConstantTupleSourceOperatorDescriptor(spec,
                 keyRecDesc, tb.getFieldEndOffsets(), tb.getByteArray(), tb.getSize());
-        PartitionConstraint keyProviderPartitionConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        keyProviderOp.setPartitionConstraint(keyProviderPartitionConstraint);
+        JobHelper.createPartitionConstraint(spec, keyProviderOp, splitNCs);
 
         int[] lowKeyFields = { 0 }; // low key is in field 0 of tuples going
                                     // into search op
@@ -149,13 +147,11 @@
         BTreeSearchOperatorDescriptor btreeSearchOp = new BTreeSearchOperatorDescriptor(spec, recDesc, storageManager,
                 btreeRegistryProvider, btreeSplitProvider, interiorFrameFactory, leafFrameFactory, typeTraits,
                 comparatorFactories, true, lowKeyFields, highKeyFields, true, true);
-        PartitionConstraint btreeSearchConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        btreeSearchOp.setPartitionConstraint(btreeSearchConstraint);
+        JobHelper.createPartitionConstraint(spec, btreeSearchOp, splitNCs);
 
         // have each node print the results of its respective B-Tree
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        printer.setPartitionConstraint(printerConstraint);
+        JobHelper.createPartitionConstraint(spec, printer, splitNCs);
 
         spec.connect(new OneToOneConnectorDescriptor(spec), keyProviderOp, 0, btreeSearchOp, 0);
 
diff --git a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/SecondaryIndexBulkLoadExample.java b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/SecondaryIndexBulkLoadExample.java
index 403e0a9..4940c2a 100644
--- a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/SecondaryIndexBulkLoadExample.java
+++ b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/SecondaryIndexBulkLoadExample.java
@@ -21,7 +21,6 @@
 
 import edu.uci.ics.hyracks.api.client.HyracksRMIConnection;
 import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.dataflow.value.ITypeTrait;
@@ -127,8 +126,7 @@
         BTreeDiskOrderScanOperatorDescriptor btreeScanOp = new BTreeDiskOrderScanOperatorDescriptor(spec, recDesc,
                 storageManager, btreeRegistryProvider, primarySplitProvider, primaryInteriorFrameFactory,
                 primaryLeafFrameFactory, primaryTypeTraits);
-        PartitionConstraint scanPartitionConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        btreeScanOp.setPartitionConstraint(scanPartitionConstraint);
+        JobHelper.createPartitionConstraint(spec, btreeScanOp, splitNCs);
 
         // sort the tuples as preparation for bulk load into secondary index
         // fields to sort on
@@ -139,8 +137,7 @@
         comparatorFactories[1] = IntegerBinaryComparatorFactory.INSTANCE;
         ExternalSortOperatorDescriptor sorter = new ExternalSortOperatorDescriptor(spec, options.sbSize, sortFields,
                 comparatorFactories, recDesc);
-        PartitionConstraint sorterConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        sorter.setPartitionConstraint(sorterConstraint);
+        JobHelper.createPartitionConstraint(spec, sorter, splitNCs);
 
         // tuples to be put into B-Tree shall have 2 fields
         int secondaryFieldCount = 2;
@@ -161,8 +158,7 @@
         BTreeBulkLoadOperatorDescriptor btreeBulkLoad = new BTreeBulkLoadOperatorDescriptor(spec, storageManager,
                 btreeRegistryProvider, btreeSplitProvider, secondaryInteriorFrameFactory, secondaryLeafFrameFactory,
                 secondaryTypeTraits, comparatorFactories, fieldPermutation, 0.7f);
-        PartitionConstraint bulkLoadConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        btreeBulkLoad.setPartitionConstraint(bulkLoadConstraint);
+        JobHelper.createPartitionConstraint(spec, btreeBulkLoad, splitNCs);
 
         // connect the ops
 
diff --git a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/SecondaryIndexSearchExample.java b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/SecondaryIndexSearchExample.java
index ba2c72f..a770f09 100644
--- a/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/SecondaryIndexSearchExample.java
+++ b/hyracks/hyracks-examples/btree-example/btreeclient/src/main/java/edu/uci/ics/hyracks/examples/btree/client/SecondaryIndexSearchExample.java
@@ -22,7 +22,6 @@
 
 import edu.uci.ics.hyracks.api.client.HyracksRMIConnection;
 import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.dataflow.value.ITypeTrait;
@@ -159,8 +158,7 @@
 
         ConstantTupleSourceOperatorDescriptor keyProviderOp = new ConstantTupleSourceOperatorDescriptor(spec,
                 keyRecDesc, tb.getFieldEndOffsets(), tb.getByteArray(), tb.getSize());
-        PartitionConstraint keyProviderPartitionConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        keyProviderOp.setPartitionConstraint(keyProviderPartitionConstraint);
+        JobHelper.createPartitionConstraint(spec, keyProviderOp, splitNCs);
 
         int[] secondaryLowKeyFields = { 0 }; // low key is in field 0 of tuples
                                              // going into secondary index
@@ -175,8 +173,7 @@
                 storageManager, btreeRegistryProvider, secondarySplitProvider, secondaryInteriorFrameFactory,
                 secondaryLeafFrameFactory, secondaryTypeTraits, comparatorFactories, true, secondaryLowKeyFields,
                 secondaryHighKeyFields, true, true);
-        PartitionConstraint secondarySearchConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        secondarySearchOp.setPartitionConstraint(secondarySearchConstraint);
+        JobHelper.createPartitionConstraint(spec, secondarySearchOp, splitNCs);
 
         // secondary index will output tuples with [UTF8String, Integer]
         // the Integer field refers to the key in the primary index of the
@@ -192,13 +189,11 @@
                 storageManager, btreeRegistryProvider, primarySplitProvider, primaryInteriorFrameFactory,
                 primaryLeafFrameFactory, primaryTypeTraits, comparatorFactories, true, primaryLowKeyFields,
                 primaryHighKeyFields, true, true);
-        PartitionConstraint primarySearchConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        primarySearchOp.setPartitionConstraint(primarySearchConstraint);
+        JobHelper.createPartitionConstraint(spec, primarySearchOp, splitNCs);
 
         // have each node print the results of its respective B-Tree
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerConstraint = JobHelper.createPartitionConstraint(splitNCs);
-        printer.setPartitionConstraint(printerConstraint);
+        JobHelper.createPartitionConstraint(spec, printer, splitNCs);
 
         spec.connect(new OneToOneConnectorDescriptor(spec), keyProviderOp, 0, secondarySearchOp, 0);
 
diff --git a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeOperatorsTest.java b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeOperatorsTest.java
index 7f2152e..33aebc1 100644
--- a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeOperatorsTest.java
+++ b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeOperatorsTest.java
@@ -20,10 +20,7 @@
 
 import org.junit.Test;
 
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -99,15 +96,11 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID);
 
         InMemorySortOperatorDescriptor sorter = new InMemorySortOperatorDescriptor(spec, new int[] { 0 },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, ordersDesc);
-        PartitionConstraint sortersPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        sorter.setPartitionConstraint(sortersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sorter, NC1_ID);
 
         // declare fields
         int fieldCount = 3;
@@ -138,9 +131,7 @@
         BTreeBulkLoadOperatorDescriptor btreeBulkLoad = new BTreeBulkLoadOperatorDescriptor(spec, storageManager,
                 btreeRegistryProvider, btreeSplitProvider, interiorFrameFactory, leafFrameFactory, typeTraits,
                 comparatorFactories, fieldPermutation, 0.7f);
-        PartitionConstraint btreePartitionConstraintA = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        btreeBulkLoad.setPartitionConstraint(btreePartitionConstraintA);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, btreeBulkLoad, NC1_ID);
 
         spec.connect(new OneToOneConnectorDescriptor(spec), ordScanner, 0, sorter, 0);
 
@@ -234,9 +225,7 @@
 
         ConstantTupleSourceOperatorDescriptor keyProviderOp = new ConstantTupleSourceOperatorDescriptor(spec,
                 keyRecDesc, tb.getFieldEndOffsets(), tb.getByteArray(), tb.getSize());
-        PartitionConstraint keyProviderPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        keyProviderOp.setPartitionConstraint(keyProviderPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, keyProviderOp, NC1_ID);
         IBTreeRegistryProvider btreeRegistryProvider = new TestBTreeRegistryProvider();
 
         RecordDescriptor recDesc = new RecordDescriptor(new ISerializerDeserializer[] {
@@ -257,14 +246,10 @@
         // bufferCacheProvider, btreeRegistryProvider, 0, "btreetest.bin",
         // interiorFrameFactory, leafFrameFactory, cmp);
 
-        PartitionConstraint btreePartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        btreeSearchOp.setPartitionConstraint(btreePartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, btreeSearchOp, NC1_ID);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         spec.connect(new OneToOneConnectorDescriptor(spec), keyProviderOp, 0, btreeSearchOp, 0);
         spec.connect(new OneToOneConnectorDescriptor(spec), btreeSearchOp, 0, printer, 0);
@@ -296,9 +281,7 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID);
 
         // we will create a primary index and 2 secondary indexes
         // first create comparators for primary index
@@ -406,9 +389,7 @@
                 ordersDesc, storageManager, btreeRegistryProvider, btreeSplitProviderA, primaryInteriorFrameFactory,
                 primaryLeafFrameFactory, primaryTypeTraits, primaryComparatorFactories, fieldPermutationA,
                 BTreeOp.BTO_INSERT);
-        PartitionConstraint insertPartitionConstraintA = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        insertOpA.setPartitionConstraint(insertPartitionConstraintA);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, insertOpA, NC1_ID);
 
         // first secondary index
         IFileSplitProvider btreeSplitProviderB = new ConstantFileSplitProvider(new FileSplit[] { new FileSplit(NC1_ID,
@@ -418,9 +399,7 @@
                 ordersDesc, storageManager, btreeRegistryProvider, btreeSplitProviderB, secondaryInteriorFrameFactory,
                 secondaryLeafFrameFactory, secondaryTypeTraits, secondaryComparatorFactories, fieldPermutationB,
                 BTreeOp.BTO_INSERT);
-        PartitionConstraint insertPartitionConstraintB = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        insertOpB.setPartitionConstraint(insertPartitionConstraintB);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, insertOpB, NC1_ID);
 
         // second secondary index
         IFileSplitProvider btreeSplitProviderC = new ConstantFileSplitProvider(new FileSplit[] { new FileSplit(NC1_ID,
@@ -430,14 +409,10 @@
                 ordersDesc, storageManager, btreeRegistryProvider, btreeSplitProviderC, secondaryInteriorFrameFactory,
                 secondaryLeafFrameFactory, secondaryTypeTraits, secondaryComparatorFactories, fieldPermutationC,
                 BTreeOp.BTO_INSERT);
-        PartitionConstraint insertPartitionConstraintC = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        insertOpC.setPartitionConstraint(insertPartitionConstraintC);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, insertOpC, NC1_ID);
 
         NullSinkOperatorDescriptor nullSink = new NullSinkOperatorDescriptor(spec);
-        PartitionConstraint nullSinkPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        nullSink.setPartitionConstraint(nullSinkPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, nullSink, NC1_ID);
 
         spec.connect(new OneToOneConnectorDescriptor(spec), ordScanner, 0, insertOpA, 0);
 
diff --git a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/AbstractIntegrationTest.java b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/AbstractIntegrationTest.java
index 858ff6c..2bb1d80 100644
--- a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/AbstractIntegrationTest.java
+++ b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/AbstractIntegrationTest.java
@@ -43,7 +43,6 @@
         CCConfig ccConfig = new CCConfig();
         ccConfig.port = 39001;
         ccConfig.profileDumpPeriod = 1000;
-        ccConfig.useJOL = true;
         cc = new ClusterControllerService(ccConfig);
         cc.start();
 
diff --git a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/CountOfCountsTest.java b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/CountOfCountsTest.java
index e5d286e..8468b54 100644
--- a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/CountOfCountsTest.java
+++ b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/CountOfCountsTest.java
@@ -18,10 +18,7 @@
 
 import org.junit.Test;
 
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
@@ -68,15 +65,11 @@
                 splitProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE }, ','),
                 desc);
-        PartitionConstraint csvPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        csvScanner.setPartitionConstraint(csvPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, csvScanner, NC1_ID);
 
         InMemorySortOperatorDescriptor sorter = new InMemorySortOperatorDescriptor(spec, new int[] { 0 },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, desc);
-        PartitionConstraint sorterPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        sorter.setPartitionConstraint(sorterPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sorter, NC1_ID);
 
         RecordDescriptor desc2 = new RecordDescriptor(new ISerializerDeserializer[] {
                 UTF8StringSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE });
@@ -86,29 +79,21 @@
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE },
                 new MultiAggregatorFactory(new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }),
                 desc2);
-        PartitionConstraint groupPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        group.setPartitionConstraint(groupPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, group, NC1_ID);
 
         InMemorySortOperatorDescriptor sorter2 = new InMemorySortOperatorDescriptor(spec, new int[] { 1 },
                 new IBinaryComparatorFactory[] { IntegerBinaryComparatorFactory.INSTANCE }, desc2);
-        PartitionConstraint sorterPartitionConstraint2 = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        sorter2.setPartitionConstraint(sorterPartitionConstraint2);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sorter2, NC1_ID);
 
         RecordDescriptor desc3 = new RecordDescriptor(new ISerializerDeserializer[] {
                 IntegerSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE });
         PreclusteredGroupOperatorDescriptor group2 = new PreclusteredGroupOperatorDescriptor(spec, new int[] { 1 },
                 new IBinaryComparatorFactory[] { IntegerBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
                         new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }), desc3);
-        PartitionConstraint groupPartitionConstraint2 = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        group2.setPartitionConstraint(groupPartitionConstraint2);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, group2, NC1_ID);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor conn1 = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(new int[] { 0 },
@@ -147,16 +132,11 @@
                 splitProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE }, ','),
                 desc);
-        PartitionConstraint csvPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        csvScanner.setPartitionConstraint(csvPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, csvScanner, NC1_ID);
 
         InMemorySortOperatorDescriptor sorter = new InMemorySortOperatorDescriptor(spec, new int[] { 0 },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, desc);
-        PartitionConstraint sorterPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID),
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        sorter.setPartitionConstraint(sorterPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sorter, NC1_ID, NC2_ID, NC1_ID, NC2_ID);
 
         RecordDescriptor desc2 = new RecordDescriptor(new ISerializerDeserializer[] {
                 UTF8StringSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE });
@@ -166,30 +146,21 @@
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE },
                 new MultiAggregatorFactory(new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }),
                 desc2);
-        PartitionConstraint groupPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID),
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        group.setPartitionConstraint(groupPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, group, NC1_ID, NC2_ID, NC1_ID, NC2_ID);
 
         InMemorySortOperatorDescriptor sorter2 = new InMemorySortOperatorDescriptor(spec, new int[] { 1 },
                 new IBinaryComparatorFactory[] { IntegerBinaryComparatorFactory.INSTANCE }, desc2);
-        PartitionConstraint sorterPartitionConstraint2 = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        sorter2.setPartitionConstraint(sorterPartitionConstraint2);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sorter2, NC1_ID, NC2_ID);
 
         RecordDescriptor desc3 = new RecordDescriptor(new ISerializerDeserializer[] {
                 IntegerSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE });
         PreclusteredGroupOperatorDescriptor group2 = new PreclusteredGroupOperatorDescriptor(spec, new int[] { 1 },
                 new IBinaryComparatorFactory[] { IntegerBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
                         new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }), desc3);
-        PartitionConstraint groupPartitionConstraint2 = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        group2.setPartitionConstraint(groupPartitionConstraint2);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, group2, NC1_ID, NC2_ID);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor conn1 = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(new int[] { 0 },
@@ -228,16 +199,11 @@
                 splitProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE }, ','),
                 desc);
-        PartitionConstraint csvPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        csvScanner.setPartitionConstraint(csvPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, csvScanner, NC1_ID);
 
         ExternalSortOperatorDescriptor sorter = new ExternalSortOperatorDescriptor(spec, 3, new int[] { 0 },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, desc);
-        PartitionConstraint sorterPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID),
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        sorter.setPartitionConstraint(sorterPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sorter, NC1_ID, NC2_ID, NC1_ID, NC2_ID);
 
         RecordDescriptor desc2 = new RecordDescriptor(new ISerializerDeserializer[] {
                 UTF8StringSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE });
@@ -247,30 +213,21 @@
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE },
                 new MultiAggregatorFactory(new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }),
                 desc2);
-        PartitionConstraint groupPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID),
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        group.setPartitionConstraint(groupPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, group, NC1_ID, NC2_ID, NC1_ID, NC2_ID);
 
         InMemorySortOperatorDescriptor sorter2 = new InMemorySortOperatorDescriptor(spec, new int[] { 1 },
                 new IBinaryComparatorFactory[] { IntegerBinaryComparatorFactory.INSTANCE }, desc2);
-        PartitionConstraint sorterPartitionConstraint2 = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        sorter2.setPartitionConstraint(sorterPartitionConstraint2);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sorter2, NC1_ID, NC2_ID);
 
         RecordDescriptor desc3 = new RecordDescriptor(new ISerializerDeserializer[] {
                 IntegerSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE });
         PreclusteredGroupOperatorDescriptor group2 = new PreclusteredGroupOperatorDescriptor(spec, new int[] { 1 },
                 new IBinaryComparatorFactory[] { IntegerBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
                         new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }), desc3);
-        PartitionConstraint groupPartitionConstraint2 = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        group2.setPartitionConstraint(groupPartitionConstraint2);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, group2, NC1_ID, NC2_ID);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor conn1 = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(new int[] { 0 },
diff --git a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/ScanPrintTest.java b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/ScanPrintTest.java
index 5ab05cc..f0974d9 100644
--- a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/ScanPrintTest.java
+++ b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/ScanPrintTest.java
@@ -18,10 +18,7 @@
 
 import org.junit.Test;
 
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -62,14 +59,10 @@
                 splitProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE }, ','),
                 desc);
-        PartitionConstraint csvPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC2_ID), new AbsoluteLocationConstraint(NC1_ID) });
-        csvScanner.setPartitionConstraint(csvPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, csvScanner, NC2_ID, NC1_ID);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC2_ID), new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC2_ID, NC1_ID);
 
         IConnectorDescriptor conn = new OneToOneConnectorDescriptor(spec);
         spec.connect(conn, csvScanner, 0, printer, 0);
@@ -98,14 +91,10 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor conn1 = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(new int[] { 0 },
@@ -136,14 +125,10 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor conn1 = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(new int[] { 0 },
diff --git a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/SortMergeTest.java b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/SortMergeTest.java
index f2b63ae..b0c33ae 100644
--- a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/SortMergeTest.java
+++ b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/SortMergeTest.java
@@ -18,10 +18,7 @@
 
 import org.junit.Test;
 
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -67,20 +64,14 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID, NC2_ID);
 
         InMemorySortOperatorDescriptor sorter = new InMemorySortOperatorDescriptor(spec, new int[] { 1 },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, ordersDesc);
-        PartitionConstraint sortersPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        sorter.setPartitionConstraint(sortersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sorter, NC1_ID, NC2_ID);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         spec.connect(new OneToOneConnectorDescriptor(spec), ordScanner, 0, sorter, 0);
 
@@ -113,21 +104,15 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID, NC2_ID);
 
         ExternalSortOperatorDescriptor sorter = new ExternalSortOperatorDescriptor(spec, 4, new int[] { 1, 0 },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE,
                         UTF8StringBinaryComparatorFactory.INSTANCE }, ordersDesc);
-        PartitionConstraint sortersPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        sorter.setPartitionConstraint(sortersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, sorter, NC1_ID, NC2_ID);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         spec.connect(new OneToOneConnectorDescriptor(spec), ordScanner, 0, sorter, 0);
 
diff --git a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/TPCHCustomerOrderHashJoinTest.java b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/TPCHCustomerOrderHashJoinTest.java
index 452b840..4958a35 100644
--- a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/TPCHCustomerOrderHashJoinTest.java
+++ b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/integration/TPCHCustomerOrderHashJoinTest.java
@@ -18,11 +18,7 @@
 
 import org.junit.Test;
 
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionCountConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
@@ -99,9 +95,7 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID);
 
         FileScanOperatorDescriptor custScanner = new FileScanOperatorDescriptor(spec, custSplitsProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE,
@@ -109,22 +103,16 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE }, '|'), custDesc);
-        PartitionConstraint custPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        custScanner.setPartitionConstraint(custPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, custScanner, NC1_ID);
 
         InMemoryHashJoinOperatorDescriptor join = new InMemoryHashJoinOperatorDescriptor(spec, new int[] { 1 },
                 new int[] { 0 }, new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, custOrderJoinDesc, 128);
-        PartitionConstraint joinPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        join.setPartitionConstraint(joinPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, join, NC1_ID);
 
         IOperatorDescriptor printer = DEBUG ? new PrinterOperatorDescriptor(spec)
                 : new NullSinkOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor ordJoinConn = new OneToOneConnectorDescriptor(spec);
         spec.connect(ordJoinConn, ordScanner, 0, join, 0);
@@ -179,9 +167,7 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID);
 
         FileScanOperatorDescriptor custScanner = new FileScanOperatorDescriptor(spec, custSplitsProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE,
@@ -189,23 +175,17 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE }, '|'), custDesc);
-        PartitionConstraint custPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        custScanner.setPartitionConstraint(custPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, custScanner, NC1_ID);
 
         GraceHashJoinOperatorDescriptor join = new GraceHashJoinOperatorDescriptor(spec, 4, 10, 200, 1.2,
                 new int[] { 1 }, new int[] { 0 },
                 new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, custOrderJoinDesc);
-        PartitionConstraint joinPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        join.setPartitionConstraint(joinPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, join, NC1_ID);
 
         IOperatorDescriptor printer = DEBUG ? new PrinterOperatorDescriptor(spec)
                 : new NullSinkOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor ordJoinConn = new OneToOneConnectorDescriptor(spec);
         spec.connect(ordJoinConn, ordScanner, 0, join, 0);
@@ -260,9 +240,7 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID);
 
         FileScanOperatorDescriptor custScanner = new FileScanOperatorDescriptor(spec, custSplitsProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE,
@@ -270,23 +248,17 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE }, '|'), custDesc);
-        PartitionConstraint custPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        custScanner.setPartitionConstraint(custPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, custScanner, NC1_ID);
 
         HybridHashJoinOperatorDescriptor join = new HybridHashJoinOperatorDescriptor(spec, 5, 20, 200, 1.2,
                 new int[] { 1 }, new int[] { 0 },
                 new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, custOrderJoinDesc);
-        PartitionConstraint joinPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        join.setPartitionConstraint(joinPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, join, NC1_ID);
 
         IOperatorDescriptor printer = DEBUG ? new PrinterOperatorDescriptor(spec)
                 : new NullSinkOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor ordJoinConn = new OneToOneConnectorDescriptor(spec);
         spec.connect(ordJoinConn, ordScanner, 0, join, 0);
@@ -343,9 +315,7 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID, NC2_ID);
 
         FileScanOperatorDescriptor custScanner = new FileScanOperatorDescriptor(spec, custSplitsProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE,
@@ -353,22 +323,16 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE }, '|'), custDesc);
-        PartitionConstraint custPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        custScanner.setPartitionConstraint(custPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, custScanner, NC1_ID, NC2_ID);
 
         InMemoryHashJoinOperatorDescriptor join = new InMemoryHashJoinOperatorDescriptor(spec, new int[] { 1 },
                 new int[] { 0 }, new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, custOrderJoinDesc, 128);
-        PartitionConstraint joinPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        join.setPartitionConstraint(joinPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, join, NC1_ID, NC2_ID);
 
         IOperatorDescriptor printer = DEBUG ? new PrinterOperatorDescriptor(spec)
                 : new NullSinkOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor ordJoinConn = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(new int[] { 1 },
@@ -429,9 +393,7 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID, NC2_ID);
 
         FileScanOperatorDescriptor custScanner = new FileScanOperatorDescriptor(spec, custSplitsProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE,
@@ -439,23 +401,17 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE }, '|'), custDesc);
-        PartitionConstraint custPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        custScanner.setPartitionConstraint(custPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, custScanner, NC1_ID, NC2_ID);
 
         GraceHashJoinOperatorDescriptor join = new GraceHashJoinOperatorDescriptor(spec, 3, 20, 100, 1.2,
                 new int[] { 1 }, new int[] { 0 },
                 new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, custOrderJoinDesc);
-        PartitionConstraint joinPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        join.setPartitionConstraint(joinPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, join, NC1_ID, NC2_ID);
 
         IOperatorDescriptor printer = DEBUG ? new PrinterOperatorDescriptor(spec)
                 : new NullSinkOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor ordJoinConn = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(new int[] { 1 },
@@ -516,9 +472,7 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID, NC2_ID);
 
         FileScanOperatorDescriptor custScanner = new FileScanOperatorDescriptor(spec, custSplitsProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE,
@@ -526,23 +480,17 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE }, '|'), custDesc);
-        PartitionConstraint custPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        custScanner.setPartitionConstraint(custPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, custScanner, NC1_ID, NC2_ID);
 
         HybridHashJoinOperatorDescriptor join = new HybridHashJoinOperatorDescriptor(spec, 3, 20, 100, 1.2,
                 new int[] { 1 }, new int[] { 0 },
                 new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, custOrderJoinDesc);
-        PartitionConstraint joinPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        join.setPartitionConstraint(joinPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, join, NC1_ID, NC2_ID);
 
         IOperatorDescriptor printer = DEBUG ? new PrinterOperatorDescriptor(spec)
                 : new NullSinkOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor ordJoinConn = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(new int[] { 1 },
@@ -603,9 +551,7 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID, NC2_ID);
 
         FileScanOperatorDescriptor custScanner = new FileScanOperatorDescriptor(spec, custSplitsProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE,
@@ -613,20 +559,16 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE }, '|'), custDesc);
-        PartitionConstraint custPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        custScanner.setPartitionConstraint(custPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, custScanner, NC1_ID, NC2_ID);
 
         InMemoryHashJoinOperatorDescriptor join = new InMemoryHashJoinOperatorDescriptor(spec, new int[] { 1 },
                 new int[] { 0 }, new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, custOrderJoinDesc, 128);
-        join.setPartitionConstraint(new PartitionCountConstraint(2));
+        PartitionConstraintHelper.addPartitionCountConstraint(spec, join, 2);
 
         IOperatorDescriptor printer = DEBUG ? new PrinterOperatorDescriptor(spec)
                 : new NullSinkOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor ordJoinConn = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(new int[] { 1 },
@@ -687,9 +629,7 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID, NC2_ID);
 
         FileScanOperatorDescriptor custScanner = new FileScanOperatorDescriptor(spec, custSplitsProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE,
@@ -697,30 +637,22 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE }, '|'), custDesc);
-        PartitionConstraint custPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        custScanner.setPartitionConstraint(custPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, custScanner, NC1_ID, NC2_ID);
 
         MaterializingOperatorDescriptor ordMat = new MaterializingOperatorDescriptor(spec, ordersDesc);
-        ordMat.setPartitionConstraint(new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) }));
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordMat, NC1_ID, NC2_ID);
 
         MaterializingOperatorDescriptor custMat = new MaterializingOperatorDescriptor(spec, custDesc);
-        custMat.setPartitionConstraint(new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) }));
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, custMat, NC1_ID, NC2_ID);
 
         InMemoryHashJoinOperatorDescriptor join = new InMemoryHashJoinOperatorDescriptor(spec, new int[] { 1 },
                 new int[] { 0 }, new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, custOrderJoinDesc, 128);
-        PartitionConstraint joinPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC1_ID), new AbsoluteLocationConstraint(NC2_ID) });
-        join.setPartitionConstraint(joinPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, join, NC1_ID, NC2_ID);
 
         IOperatorDescriptor printer = DEBUG ? new PrinterOperatorDescriptor(spec)
                 : new NullSinkOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor ordPartConn = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(new int[] { 1 },
diff --git a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/invertedindex/InvertedIndexOperatorsTest.java b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/invertedindex/InvertedIndexOperatorsTest.java
index bdf8ebb..2cfe438 100644
--- a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/invertedindex/InvertedIndexOperatorsTest.java
+++ b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/invertedindex/InvertedIndexOperatorsTest.java
@@ -4,10 +4,7 @@
 
 import org.junit.Test;
 
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
 import edu.uci.ics.hyracks.api.io.FileReference;
@@ -44,9 +41,7 @@
         FileScanOperatorDescriptor dblpTitleScanner = new FileScanOperatorDescriptor(spec, dblpTitleSplitProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { IntegerParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE }, '|'), dblpTitleRecDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        dblpTitleScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, dblpTitleScanner, NC1_ID);
 
         RecordDescriptor tokenizerRecDesc = new RecordDescriptor(new ISerializerDeserializer[] {
                 UTF8StringSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE });
@@ -55,14 +50,10 @@
         int[] projFields = { 0 };
         BinaryTokenizerOperatorDescriptor binaryTokenizer = new BinaryTokenizerOperatorDescriptor(spec,
                 tokenizerRecDesc, tokenizerFactory, tokenFields, projFields);
-        PartitionConstraint tokenizerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        binaryTokenizer.setPartitionConstraint(tokenizerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, binaryTokenizer, NC1_ID);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         spec.connect(new OneToOneConnectorDescriptor(spec), dblpTitleScanner, 0, binaryTokenizer, 0);
 
diff --git a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/spillable/ExternalAggregateTest.java b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/spillable/ExternalAggregateTest.java
index 2621049..694f183 100644
--- a/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/spillable/ExternalAggregateTest.java
+++ b/hyracks/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/spillable/ExternalAggregateTest.java
@@ -18,10 +18,7 @@
 
 import org.junit.Test;
 
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
@@ -91,9 +88,7 @@
                 splitProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE }, ','),
                 desc);
-        PartitionConstraint csvPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC2_ID), new AbsoluteLocationConstraint(NC1_ID) });
-        csvScanner.setPartitionConstraint(csvPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, csvScanner, NC2_ID, NC1_ID);
 
         int[] keys = new int[] { 0 };
         int tableSize = 8;
@@ -106,18 +101,16 @@
                 // Hash partitioner
                 new FieldHashPartitionComputerFactory(keys,
                         new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE }),
-                        // Key comparator
-                        new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE },
-                        // Aggregator factory
-                        new MultiAggregatorFactory(new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }),
-                        outputRec, // Output format
-                        tableSize // Size of the hashing table, which is used to control
-                        // the partition when hashing
+                // Key comparator
+                new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE },
+                // Aggregator factory
+                new MultiAggregatorFactory(new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }),
+                outputRec, // Output format
+                tableSize // Size of the hashing table, which is used to control
+        // the partition when hashing
         );
 
-        PartitionConstraint grouperPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC2_ID), new AbsoluteLocationConstraint(NC1_ID) });
-        grouper.setPartitionConstraint(grouperPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, grouper, NC2_ID, NC1_ID);
 
         IConnectorDescriptor conn1 = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(keys,
@@ -125,9 +118,7 @@
         spec.connect(conn1, csvScanner, 0, grouper, 0);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC2_ID), new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC2_ID, NC1_ID);
 
         IConnectorDescriptor conn2 = new OneToOneConnectorDescriptor(spec);
         spec.connect(conn2, grouper, 0, printer, 0);
@@ -161,9 +152,7 @@
                 splitProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE }, ','),
                 desc);
-        PartitionConstraint csvPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC2_ID), new AbsoluteLocationConstraint(NC1_ID) });
-        csvScanner.setPartitionConstraint(csvPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, csvScanner, NC2_ID, NC1_ID);
 
         int[] keys = new int[] { 0 };
         int tableSize = 8;
@@ -173,13 +162,11 @@
                 keys,
                 new FieldHashPartitionComputerFactory(keys,
                         new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE }),
-                        new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE },
-                        new MultiAggregatorFactory(new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }),
-                        outputRec, tableSize);
+                new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE },
+                new MultiAggregatorFactory(new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }),
+                outputRec, tableSize);
 
-        PartitionConstraint grouperPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC2_ID), new AbsoluteLocationConstraint(NC1_ID) });
-        grouper.setPartitionConstraint(grouperPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, grouper, NC2_ID, NC1_ID);
 
         IConnectorDescriptor conn1 = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(keys,
@@ -187,9 +174,7 @@
         spec.connect(conn1, csvScanner, 0, grouper, 0);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(new LocationConstraint[] {
-                new AbsoluteLocationConstraint(NC2_ID), new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC2_ID, NC1_ID);
 
         IConnectorDescriptor conn2 = new OneToOneConnectorDescriptor(spec);
         spec.connect(conn2, grouper, 0, printer, 0);
@@ -208,7 +193,7 @@
         JobSpecification spec = new JobSpecification();
 
         FileSplit[] ordersSplits = new FileSplit[] { new FileSplit(NC2_ID, new FileReference(new File(
-        "data/tpch0.001/lineitem.tbl"))) };
+                "data/tpch0.001/lineitem.tbl"))) };
         IFileSplitProvider ordersSplitsProvider = new ConstantFileSplitProvider(ordersSplits);
         RecordDescriptor ordersDesc = new RecordDescriptor(new ISerializerDeserializer[] {
                 UTF8StringSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE,
@@ -229,31 +214,23 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID);
 
         RecordDescriptor outputRec = new RecordDescriptor(new ISerializerDeserializer[] {
                 UTF8StringSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE,
                 IntegerSerializerDeserializer.INSTANCE, FloatSerializerDeserializer.INSTANCE });
 
-        PartitionConstraint csvPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(csvPartitionConstraint);
-
         int[] keys = new int[] { 0 };
         int tableSize = 8;
 
         ExternalHashGroupOperatorDescriptor grouper = new ExternalHashGroupOperatorDescriptor(spec, keys, 3, false,
                 new FieldHashPartitionComputerFactory(keys,
                         new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE }),
-                        new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE },
-                        new MultiAggregatorFactory(new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory(),
-                                new SumAggregatorFactory(4), new MinMaxAggregatorFactory(true, 5) }), outputRec, tableSize);
+                new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE },
+                new MultiAggregatorFactory(new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory(),
+                        new SumAggregatorFactory(4), new MinMaxAggregatorFactory(true, 5) }), outputRec, tableSize);
 
-        PartitionConstraint grouperPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        grouper.setPartitionConstraint(grouperPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, grouper, NC1_ID);
 
         IConnectorDescriptor conn1 = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(keys,
@@ -261,9 +238,7 @@
         spec.connect(conn1, ordScanner, 0, grouper, 0);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor conn2 = new OneToOneConnectorDescriptor(spec);
         spec.connect(conn2, grouper, 0, printer, 0);
@@ -282,7 +257,7 @@
         JobSpecification spec = new JobSpecification();
 
         FileSplit[] ordersSplits = new FileSplit[] { new FileSplit(NC2_ID, new FileReference(new File(
-        "data/tpch0.001/lineitem.tbl"))) };
+                "data/tpch0.001/lineitem.tbl"))) };
         IFileSplitProvider ordersSplitsProvider = new ConstantFileSplitProvider(ordersSplits);
         RecordDescriptor ordersDesc = new RecordDescriptor(new ISerializerDeserializer[] {
                 UTF8StringSerializerDeserializer.INSTANCE, UTF8StringSerializerDeserializer.INSTANCE,
@@ -303,19 +278,13 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID);
 
         RecordDescriptor outputRec = new RecordDescriptor(new ISerializerDeserializer[] {
                 UTF8StringSerializerDeserializer.INSTANCE, UTF8StringSerializerDeserializer.INSTANCE,
                 IntegerSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE,
                 FloatSerializerDeserializer.INSTANCE });
 
-        PartitionConstraint csvPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(csvPartitionConstraint);
-
         // Group on two fields
         int[] keys = new int[] { 0, 1 };
         int tableSize = 8;
@@ -323,15 +292,13 @@
         ExternalHashGroupOperatorDescriptor grouper = new ExternalHashGroupOperatorDescriptor(spec, keys, 3, false,
                 new FieldHashPartitionComputerFactory(keys, new IBinaryHashFunctionFactory[] {
                         UTF8StringBinaryHashFunctionFactory.INSTANCE, UTF8StringBinaryHashFunctionFactory.INSTANCE }),
-                        new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE,
-            UTF8StringBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
-                    new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory(),
-                            new SumAggregatorFactory(4), new MinMaxAggregatorFactory(true, 5) }), outputRec,
-                            tableSize);
+                new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE,
+                        UTF8StringBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
+                        new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory(),
+                                new SumAggregatorFactory(4), new MinMaxAggregatorFactory(true, 5) }), outputRec,
+                tableSize);
 
-        PartitionConstraint grouperPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        grouper.setPartitionConstraint(grouperPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, grouper, NC1_ID);
 
         IConnectorDescriptor conn1 = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(keys, new IBinaryHashFunctionFactory[] {
@@ -339,9 +306,7 @@
         spec.connect(conn1, ordScanner, 0, grouper, 0);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor conn2 = new OneToOneConnectorDescriptor(spec);
         spec.connect(conn2, grouper, 0, printer, 0);
@@ -360,7 +325,7 @@
         JobSpecification spec = new JobSpecification();
 
         FileSplit[] ordersSplits = new FileSplit[] { new FileSplit(NC2_ID, new FileReference(new File(
-        "data/tpch0.001/lineitem.tbl"))) };
+                "data/tpch0.001/lineitem.tbl"))) };
         IFileSplitProvider ordersSplitsProvider = new ConstantFileSplitProvider(ordersSplits);
         RecordDescriptor ordersDesc = new RecordDescriptor(new ISerializerDeserializer[] {
                 IntegerSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE,
@@ -381,19 +346,13 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, }, '|'), ordersDesc);
-        PartitionConstraint ordersPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(ordersPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, ordScanner, NC1_ID);
 
         RecordDescriptor outputRec = new RecordDescriptor(new ISerializerDeserializer[] {
                 IntegerSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE,
                 IntegerSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE,
                 FloatSerializerDeserializer.INSTANCE });
 
-        PartitionConstraint csvPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        ordScanner.setPartitionConstraint(csvPartitionConstraint);
-
         // Group on two fields
         int[] keys = new int[] { 0, 1 };
         int tableSize = 8;
@@ -401,15 +360,13 @@
         ExternalHashGroupOperatorDescriptor grouper = new ExternalHashGroupOperatorDescriptor(spec, keys, 3000, true,
                 new FieldHashPartitionComputerFactory(keys, new IBinaryHashFunctionFactory[] {
                         IntegerBinaryHashFunctionFactory.INSTANCE, IntegerBinaryHashFunctionFactory.INSTANCE }),
-                        new IBinaryComparatorFactory[] { IntegerBinaryComparatorFactory.INSTANCE,
-            IntegerBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
-                    new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory(),
-                            new SumAggregatorFactory(4), new MinMaxAggregatorFactory(true, 5) }), outputRec,
-                            tableSize);
+                new IBinaryComparatorFactory[] { IntegerBinaryComparatorFactory.INSTANCE,
+                        IntegerBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
+                        new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory(),
+                                new SumAggregatorFactory(4), new MinMaxAggregatorFactory(true, 5) }), outputRec,
+                tableSize);
 
-        PartitionConstraint grouperPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        grouper.setPartitionConstraint(grouperPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, grouper, NC1_ID);
 
         IConnectorDescriptor conn1 = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(keys, new IBinaryHashFunctionFactory[] {
@@ -417,9 +374,7 @@
         spec.connect(conn1, ordScanner, 0, grouper, 0);
 
         PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        PartitionConstraint printerPartitionConstraint = new ExplicitPartitionConstraint(
-                new LocationConstraint[] { new AbsoluteLocationConstraint(NC1_ID) });
-        printer.setPartitionConstraint(printerPartitionConstraint);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, printer, NC1_ID);
 
         IConnectorDescriptor conn2 = new OneToOneConnectorDescriptor(spec);
         spec.connect(conn2, grouper, 0, printer, 0);
@@ -427,4 +382,4 @@
         spec.addRoot(printer);
         runTest(spec);
     }
-}
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-examples/text-example/textclient/src/main/java/edu/uci/ics/hyracks/examples/text/client/ExternalGroupClient.java b/hyracks/hyracks-examples/text-example/textclient/src/main/java/edu/uci/ics/hyracks/examples/text/client/ExternalGroupClient.java
index f02c855..8d22bca 100644
--- a/hyracks/hyracks-examples/text-example/textclient/src/main/java/edu/uci/ics/hyracks/examples/text/client/ExternalGroupClient.java
+++ b/hyracks/hyracks-examples/text-example/textclient/src/main/java/edu/uci/ics/hyracks/examples/text/client/ExternalGroupClient.java
@@ -22,11 +22,9 @@
 
 import edu.uci.ics.hyracks.api.client.HyracksRMIConnection;
 import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
+import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
@@ -179,7 +177,7 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, }, '|'), inDesc);
 
-        fileScanner.setPartitionConstraint(createPartitionConstraint(inSplits));
+        createPartitionConstraint(spec, fileScanner, inSplits);
 
         // Output: each unique string with an integer count
         RecordDescriptor outDesc = new RecordDescriptor(new ISerializerDeserializer[] {
@@ -190,7 +188,7 @@
         // Specify the grouping key, which will be the string extracted during
         // the scan.
         int[] keys = new int[] { 0,
-                // 1
+        // 1
         };
 
         AbstractOperatorDescriptor grouper;
@@ -199,19 +197,19 @@
             case 0: // External hash group
                 grouper = new ExternalHashGroupOperatorDescriptor(spec, keys, framesLimit, false,
                         new FieldHashPartitionComputerFactory(keys, new IBinaryHashFunctionFactory[] {
-                                // IntegerBinaryHashFunctionFactory.INSTANCE,
+                        // IntegerBinaryHashFunctionFactory.INSTANCE,
                                 IntegerBinaryHashFunctionFactory.INSTANCE }), new IBinaryComparatorFactory[] {
-                    // IntegerBinaryComparatorFactory.INSTANCE,
-                    IntegerBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
-                            new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }), outDesc,
-                            htSize);
+                        // IntegerBinaryComparatorFactory.INSTANCE,
+                        IntegerBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
+                                new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }), outDesc,
+                        htSize);
 
-                grouper.setPartitionConstraint(createPartitionConstraint(outSplits));
+                createPartitionConstraint(spec, grouper, outSplits);
 
                 // Connect scanner with the grouper
                 IConnectorDescriptor scanGroupConn = new MToNHashPartitioningConnectorDescriptor(spec,
                         new FieldHashPartitionComputerFactory(keys, new IBinaryHashFunctionFactory[] {
-                                // IntegerBinaryHashFunctionFactory.INSTANCE,
+                        // IntegerBinaryHashFunctionFactory.INSTANCE,
                                 IntegerBinaryHashFunctionFactory.INSTANCE }));
                 spec.connect(scanGroupConn, fileScanner, 0, grouper, 0);
                 break;
@@ -220,21 +218,21 @@
                         new IBinaryComparatorFactory[] {
                         // IntegerBinaryComparatorFactory.INSTANCE,
                         IntegerBinaryComparatorFactory.INSTANCE }, inDesc);
-                sorter.setPartitionConstraint(createPartitionConstraint(inSplits));
+                createPartitionConstraint(spec, sorter, inSplits);
 
                 // Connect scan operator with the sorter
                 IConnectorDescriptor scanSortConn = new MToNHashPartitioningConnectorDescriptor(spec,
                         new FieldHashPartitionComputerFactory(keys, new IBinaryHashFunctionFactory[] {
-                                // IntegerBinaryHashFunctionFactory.INSTANCE,
+                        // IntegerBinaryHashFunctionFactory.INSTANCE,
                                 IntegerBinaryHashFunctionFactory.INSTANCE }));
                 spec.connect(scanSortConn, fileScanner, 0, sorter, 0);
 
                 grouper = new PreclusteredGroupOperatorDescriptor(spec, keys, new IBinaryComparatorFactory[] {
-                        // IntegerBinaryComparatorFactory.INSTANCE,
+                // IntegerBinaryComparatorFactory.INSTANCE,
                         IntegerBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
                                 new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }), outDesc);
 
-                grouper.setPartitionConstraint(createPartitionConstraint(outSplits));
+                createPartitionConstraint(spec, grouper, outSplits);
 
                 // Connect sorter with the pre-cluster
                 OneToOneConnectorDescriptor sortGroupConn = new OneToOneConnectorDescriptor(spec);
@@ -245,36 +243,36 @@
                         new IBinaryHashFunctionFactory[] {
                         // IntegerBinaryHashFunctionFactory.INSTANCE,
                         IntegerBinaryHashFunctionFactory.INSTANCE }), new IBinaryComparatorFactory[] {
-                    // IntegerBinaryComparatorFactory.INSTANCE,
-                    IntegerBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
-                            new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }), outDesc,
-                            htSize);
+                // IntegerBinaryComparatorFactory.INSTANCE,
+                        IntegerBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
+                                new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }), outDesc,
+                        htSize);
 
-                grouper.setPartitionConstraint(createPartitionConstraint(outSplits));
+                createPartitionConstraint(spec, grouper, outSplits);
 
                 // Connect scanner with the grouper
                 IConnectorDescriptor scanConn = new MToNHashPartitioningConnectorDescriptor(spec,
                         new FieldHashPartitionComputerFactory(keys, new IBinaryHashFunctionFactory[] {
-                                // IntegerBinaryHashFunctionFactory.INSTANCE,
+                        // IntegerBinaryHashFunctionFactory.INSTANCE,
                                 IntegerBinaryHashFunctionFactory.INSTANCE }));
                 spec.connect(scanConn, fileScanner, 0, grouper, 0);
                 break;
             default:
                 grouper = new ExternalHashGroupOperatorDescriptor(spec, keys, framesLimit, false,
                         new FieldHashPartitionComputerFactory(keys, new IBinaryHashFunctionFactory[] {
-                                // IntegerBinaryHashFunctionFactory.INSTANCE,
+                        // IntegerBinaryHashFunctionFactory.INSTANCE,
                                 IntegerBinaryHashFunctionFactory.INSTANCE }), new IBinaryComparatorFactory[] {
-                    // IntegerBinaryComparatorFactory.INSTANCE,
-                    IntegerBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
-                            new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }), outDesc,
-                            htSize);
+                        // IntegerBinaryComparatorFactory.INSTANCE,
+                        IntegerBinaryComparatorFactory.INSTANCE }, new MultiAggregatorFactory(
+                                new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }), outDesc,
+                        htSize);
 
-                grouper.setPartitionConstraint(createPartitionConstraint(outSplits));
+                createPartitionConstraint(spec, grouper, outSplits);
 
                 // Connect scanner with the grouper
                 IConnectorDescriptor scanGroupConnDef = new MToNHashPartitioningConnectorDescriptor(spec,
                         new FieldHashPartitionComputerFactory(keys, new IBinaryHashFunctionFactory[] {
-                                // IntegerBinaryHashFunctionFactory.INSTANCE,
+                        // IntegerBinaryHashFunctionFactory.INSTANCE,
                                 IntegerBinaryHashFunctionFactory.INSTANCE }));
                 spec.connect(scanGroupConnDef, fileScanner, 0, grouper, 0);
         }
@@ -288,7 +286,7 @@
         else
             writer = new FrameFileWriterOperatorDescriptor(spec, outSplitProvider);
 
-        writer.setPartitionConstraint(createPartitionConstraint(outSplits));
+        createPartitionConstraint(spec, writer, outSplits);
 
         IConnectorDescriptor groupOutConn = new OneToOneConnectorDescriptor(spec);
         spec.connect(groupOutConn, grouper, 0, writer, 0);
@@ -297,11 +295,11 @@
         return spec;
     }
 
-    private static PartitionConstraint createPartitionConstraint(FileSplit[] splits) {
-        LocationConstraint[] lConstraints = new LocationConstraint[splits.length];
+    private static void createPartitionConstraint(JobSpecification spec, IOperatorDescriptor op, FileSplit[] splits) {
+        String[] parts = new String[splits.length];
         for (int i = 0; i < splits.length; ++i) {
-            lConstraints[i] = new AbsoluteLocationConstraint(splits[i].getNodeName());
+            parts[i] = splits[i].getNodeName();
         }
-        return new ExplicitPartitionConstraint(lConstraints);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, op, parts);
     }
-}
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-examples/text-example/textclient/src/main/java/edu/uci/ics/hyracks/examples/text/client/WordCountMain.java b/hyracks/hyracks-examples/text-example/textclient/src/main/java/edu/uci/ics/hyracks/examples/text/client/WordCountMain.java
index 84cbd9a..4f20774d 100644
--- a/hyracks/hyracks-examples/text-example/textclient/src/main/java/edu/uci/ics/hyracks/examples/text/client/WordCountMain.java
+++ b/hyracks/hyracks-examples/text-example/textclient/src/main/java/edu/uci/ics/hyracks/examples/text/client/WordCountMain.java
@@ -22,10 +22,7 @@
 
 import edu.uci.ics.hyracks.api.client.HyracksRMIConnection;
 import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
@@ -125,7 +122,7 @@
 
         FileScanOperatorDescriptor wordScanner = new FileScanOperatorDescriptor(spec, splitsProvider,
                 new WordTupleParserFactory(), wordDesc);
-        wordScanner.setPartitionConstraint(createPartitionConstraint(inSplits));
+        createPartitionConstraint(spec, wordScanner, inSplits);
 
         RecordDescriptor groupResultDesc = new RecordDescriptor(new ISerializerDeserializer[] {
                 UTF8StringSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE });
@@ -139,7 +136,7 @@
                     new MultiAggregatorFactory(
                             new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }),
                     groupResultDesc, htSize);
-            gBy.setPartitionConstraint(createPartitionConstraint(outSplits));
+            createPartitionConstraint(spec, gBy, outSplits);
             IConnectorDescriptor scanGroupConn = new MToNHashPartitioningConnectorDescriptor(spec,
                     new FieldHashPartitionComputerFactory(keys,
                             new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE }));
@@ -150,7 +147,7 @@
                     keys, new UTF8StringNormalizedKeyComputerFactory(), cfs, wordDesc)
                     : new ExternalSortOperatorDescriptor(spec, sbSize, keys,
                             new UTF8StringNormalizedKeyComputerFactory(), cfs, wordDesc);
-            sorter.setPartitionConstraint(createPartitionConstraint(outSplits));
+            createPartitionConstraint(spec, sorter, outSplits);
 
             IConnectorDescriptor scanSortConn = new MToNHashPartitioningConnectorDescriptor(spec,
                     new FieldHashPartitionComputerFactory(keys,
@@ -162,14 +159,14 @@
                     new MultiAggregatorFactory(
                             new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }),
                     groupResultDesc);
-            gBy.setPartitionConstraint(createPartitionConstraint(outSplits));
+            createPartitionConstraint(spec, gBy, outSplits);
             OneToOneConnectorDescriptor sortGroupConn = new OneToOneConnectorDescriptor(spec);
             spec.connect(sortGroupConn, sorter, 0, gBy, 0);
         }
 
         IFileSplitProvider outSplitProvider = new ConstantFileSplitProvider(outSplits);
         FrameFileWriterOperatorDescriptor writer = new FrameFileWriterOperatorDescriptor(spec, outSplitProvider);
-        writer.setPartitionConstraint(createPartitionConstraint(outSplits));
+        createPartitionConstraint(spec, writer, outSplits);
 
         IConnectorDescriptor gbyPrinterConn = new OneToOneConnectorDescriptor(spec);
         spec.connect(gbyPrinterConn, gBy, 0, writer, 0);
@@ -178,11 +175,11 @@
         return spec;
     }
 
-    private static PartitionConstraint createPartitionConstraint(FileSplit[] splits) {
-        LocationConstraint[] lConstraints = new LocationConstraint[splits.length];
+    private static void createPartitionConstraint(JobSpecification spec, IOperatorDescriptor op, FileSplit[] splits) {
+        String[] parts = new String[splits.length];
         for (int i = 0; i < splits.length; ++i) {
-            lConstraints[i] = new AbsoluteLocationConstraint(splits[i].getNodeName());
+            parts[i] = splits[i].getNodeName();
         }
-        return new ExplicitPartitionConstraint(lConstraints);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, op, parts);
     }
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-examples/tpch-example/tpchclient/src/main/java/edu/uci/ics/hyracks/examples/tpch/client/Main.java b/hyracks/hyracks-examples/tpch-example/tpchclient/src/main/java/edu/uci/ics/hyracks/examples/tpch/client/Main.java
index e26d2a1..b1a1224 100644
--- a/hyracks/hyracks-examples/tpch-example/tpchclient/src/main/java/edu/uci/ics/hyracks/examples/tpch/client/Main.java
+++ b/hyracks/hyracks-examples/tpch-example/tpchclient/src/main/java/edu/uci/ics/hyracks/examples/tpch/client/Main.java
@@ -1,22 +1,37 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package edu.uci.ics.hyracks.examples.tpch.client;
 
 import java.io.File;
+import java.util.EnumSet;
 import java.util.UUID;
 
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.Option;
+
 import edu.uci.ics.hyracks.api.client.HyracksRMIConnection;
 import edu.uci.ics.hyracks.api.client.IHyracksClientConnection;
-import edu.uci.ics.hyracks.api.constraints.AbsoluteLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ChoiceLocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.LocationConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionCountConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
+import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
 import edu.uci.ics.hyracks.api.io.FileReference;
+import edu.uci.ics.hyracks.api.job.JobFlag;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.dataflow.common.data.comparators.UTF8StringBinaryComparatorFactory;
 import edu.uci.ics.hyracks.dataflow.common.data.hash.UTF8StringBinaryHashFunctionFactory;
@@ -34,51 +49,84 @@
 import edu.uci.ics.hyracks.dataflow.std.file.DelimitedDataTupleParserFactory;
 import edu.uci.ics.hyracks.dataflow.std.file.FileScanOperatorDescriptor;
 import edu.uci.ics.hyracks.dataflow.std.file.FileSplit;
+import edu.uci.ics.hyracks.dataflow.std.file.FrameFileWriterOperatorDescriptor;
 import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
 import edu.uci.ics.hyracks.dataflow.std.group.HashGroupOperatorDescriptor;
 import edu.uci.ics.hyracks.dataflow.std.join.InMemoryHashJoinOperatorDescriptor;
-import edu.uci.ics.hyracks.dataflow.std.misc.PrinterOperatorDescriptor;
 
 public class Main {
-    public static void main(String[] args) throws Exception {
-        String appName = args[0];
-        String host;
-        int port = 1099;
-        switch (args.length) {
-            case 3:
-                port = Integer.parseInt(args[2]);
-            case 2:
-                host = args[1];
-                break;
-            default:
-                System.err.println("One or Two arguments expected: <cchost> [<ccport>]");
-                return;
-        }
-        IHyracksClientConnection hcc = new HyracksRMIConnection(host, port);
+    private static class Options {
+        @Option(name = "-host", usage = "Hyracks Cluster Controller Host name", required = true)
+        public String host;
 
-        JobSpecification job = createJob();
+        @Option(name = "-port", usage = "Hyracks Cluster Controller Port (default: 1099)", required = false)
+        public int port = 1099;
+
+        @Option(name = "-app", usage = "Hyracks Application name", required = true)
+        public String app;
+
+        @Option(name = "-infile-customer-splits", usage = "Comma separated list of file-splits for the CUSTOMER input. A file-split is <node-name>:<path>", required = true)
+        public String inFileCustomerSplits;
+
+        @Option(name = "-infile-order-splits", usage = "Comma separated list of file-splits for the ORDER input. A file-split is <node-name>:<path>", required = true)
+        public String inFileOrderSplits;
+
+        @Option(name = "-outfile-splits", usage = "Comma separated list of file-splits for the output", required = true)
+        public String outFileSplits;
+
+        @Option(name = "-num-join-partitions", usage = "Number of Join partitions to use (default: 1)", required = false)
+        public int numJoinPartitions = 1;
+
+        @Option(name = "-profile", usage = "Enable/Disable profiling. (default: enabled)")
+        public boolean profile = true;
+    }
+
+    public static void main(String[] args) throws Exception {
+        Options options = new Options();
+        CmdLineParser parser = new CmdLineParser(options);
+        parser.parseArgument(args);
+
+        IHyracksClientConnection hcc = new HyracksRMIConnection(options.host, options.port);
+
+        JobSpecification job = createJob(parseFileSplits(options.inFileCustomerSplits),
+                parseFileSplits(options.inFileOrderSplits), parseFileSplits(options.outFileSplits),
+                options.numJoinPartitions);
 
         long start = System.currentTimeMillis();
-        UUID jobId = hcc.createJob(appName, job);
+        UUID jobId = hcc.createJob(options.app, job,
+                options.profile ? EnumSet.of(JobFlag.PROFILE_RUNTIME) : EnumSet.noneOf(JobFlag.class));
         hcc.start(jobId);
         hcc.waitForCompletion(jobId);
         long end = System.currentTimeMillis();
         System.err.println(start + " " + end + " " + (end - start));
     }
 
-    private static JobSpecification createJob() {
+    private static FileSplit[] parseFileSplits(String fileSplits) {
+        String[] splits = fileSplits.split(",");
+        FileSplit[] fSplits = new FileSplit[splits.length];
+        for (int i = 0; i < splits.length; ++i) {
+            String s = splits[i].trim();
+            int idx = s.indexOf(':');
+            if (idx < 0) {
+                throw new IllegalArgumentException("File split " + s + " not well formed");
+            }
+            fSplits[i] = new FileSplit(s.substring(0, idx), new FileReference(new File(s.substring(idx + 1))));
+        }
+        return fSplits;
+    }
+
+    private static JobSpecification createJob(FileSplit[] customerSplits, FileSplit[] orderSplits,
+            FileSplit[] resultSplits, int numJoinPartitions) {
         JobSpecification spec = new JobSpecification();
 
-        FileSplit[] custSplits = createCustomerFileSplits();
-        IFileSplitProvider custSplitsProvider = new ConstantFileSplitProvider(custSplits);
+        IFileSplitProvider custSplitsProvider = new ConstantFileSplitProvider(customerSplits);
         RecordDescriptor custDesc = new RecordDescriptor(new ISerializerDeserializer[] {
                 UTF8StringSerializerDeserializer.INSTANCE, UTF8StringSerializerDeserializer.INSTANCE,
                 UTF8StringSerializerDeserializer.INSTANCE, UTF8StringSerializerDeserializer.INSTANCE,
                 UTF8StringSerializerDeserializer.INSTANCE, UTF8StringSerializerDeserializer.INSTANCE,
                 UTF8StringSerializerDeserializer.INSTANCE, UTF8StringSerializerDeserializer.INSTANCE });
 
-        FileSplit[] ordersSplits = createOrdersFileSplits();
-        IFileSplitProvider ordersSplitsProvider = new ConstantFileSplitProvider(ordersSplits);
+        IFileSplitProvider ordersSplitsProvider = new ConstantFileSplitProvider(orderSplits);
         RecordDescriptor ordersDesc = new RecordDescriptor(new ISerializerDeserializer[] {
                 UTF8StringSerializerDeserializer.INSTANCE, UTF8StringSerializerDeserializer.INSTANCE,
                 UTF8StringSerializerDeserializer.INSTANCE, UTF8StringSerializerDeserializer.INSTANCE,
@@ -103,7 +151,7 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE }, '|'), ordersDesc);
-        ordScanner.setPartitionConstraint(createRRPartitionConstraint(2));
+        createPartitionConstraint(spec, ordScanner, orderSplits);
 
         FileScanOperatorDescriptor custScanner = new FileScanOperatorDescriptor(spec, custSplitsProvider,
                 new DelimitedDataTupleParserFactory(new IValueParserFactory[] { UTF8StringParserFactory.INSTANCE,
@@ -111,13 +159,13 @@
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE, UTF8StringParserFactory.INSTANCE,
                         UTF8StringParserFactory.INSTANCE }, '|'), custDesc);
-        custScanner.setPartitionConstraint(createRRPartitionConstraint(2));
+        createPartitionConstraint(spec, custScanner, customerSplits);
 
         InMemoryHashJoinOperatorDescriptor join = new InMemoryHashJoinOperatorDescriptor(spec, new int[] { 0 },
                 new int[] { 1 }, new IBinaryHashFunctionFactory[] { UTF8StringBinaryHashFunctionFactory.INSTANCE },
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE }, custOrderJoinDesc,
                 6000000);
-        join.setPartitionConstraint(new PartitionCountConstraint(4));
+        PartitionConstraintHelper.addPartitionCountConstraint(spec, join, numJoinPartitions);
 
         RecordDescriptor groupResultDesc = new RecordDescriptor(new ISerializerDeserializer[] {
                 UTF8StringSerializerDeserializer.INSTANCE, IntegerSerializerDeserializer.INSTANCE });
@@ -130,10 +178,11 @@
                 new IBinaryComparatorFactory[] { UTF8StringBinaryComparatorFactory.INSTANCE },
                 new MultiAggregatorFactory(new IFieldValueResultingAggregatorFactory[] { new CountAggregatorFactory() }),
                 groupResultDesc, 16);
-        gby.setPartitionConstraint(new PartitionCountConstraint(4));
+        createPartitionConstraint(spec, gby, resultSplits);
 
-        PrinterOperatorDescriptor printer = new PrinterOperatorDescriptor(spec);
-        printer.setPartitionConstraint(new PartitionCountConstraint(4));
+        IFileSplitProvider outSplitProvider = new ConstantFileSplitProvider(resultSplits);
+        FrameFileWriterOperatorDescriptor writer = new FrameFileWriterOperatorDescriptor(spec, outSplitProvider);
+        createPartitionConstraint(spec, writer, resultSplits);
 
         IConnectorDescriptor ordJoinConn = new MToNHashPartitioningConnectorDescriptor(spec,
                 new FieldHashPartitionComputerFactory(new int[] { 1 },
@@ -151,45 +200,17 @@
         spec.connect(joinGroupConn, join, 0, gby, 0);
 
         IConnectorDescriptor gbyPrinterConn = new OneToOneConnectorDescriptor(spec);
-        spec.connect(gbyPrinterConn, gby, 0, printer, 0);
+        spec.connect(gbyPrinterConn, gby, 0, writer, 0);
 
-        spec.addRoot(printer);
+        spec.addRoot(writer);
         return spec;
     }
 
-    private static FileSplit[] createOrdersFileSplits() {
-        FileSplit fss[] = new FileSplit[2];
-        for (int i = 0; i < fss.length; ++i) {
-            fss[i] = new FileSplit("foo", new FileReference(new File("data/tpch0.001/orders-part" + (i + 1) + ".tbl")));
+    private static void createPartitionConstraint(JobSpecification spec, IOperatorDescriptor op, FileSplit[] splits) {
+        String[] parts = new String[splits.length];
+        for (int i = 0; i < splits.length; ++i) {
+            parts[i] = splits[i].getNodeName();
         }
-        return fss;
-    }
-
-    private static FileSplit[] createCustomerFileSplits() {
-        FileSplit fss[] = new FileSplit[2];
-        for (int i = 0; i < fss.length; ++i) {
-            fss[i] = new FileSplit("foo",
-                    new FileReference(new File("data/tpch0.001/customer-part" + (i + 1) + ".tbl")));
-        }
-        return fss;
-    }
-
-    private static final LocationConstraint[] LCS = { new AbsoluteLocationConstraint("NC1"),
-            new AbsoluteLocationConstraint("NC2") };
-
-    private static PartitionConstraint createRRPartitionConstraint(int k) {
-        LocationConstraint[] lcs = new LocationConstraint[2];
-        for (int i = 0; i < lcs.length; ++i) {
-            lcs[i] = createRRSteppedChoiceConstraint(i, k);
-        }
-        return new ExplicitPartitionConstraint(lcs);
-    }
-
-    private static LocationConstraint createRRSteppedChoiceConstraint(int index, int choices) {
-        LocationConstraint[] lcs = new LocationConstraint[choices];
-        for (int i = 0; i < choices; ++i) {
-            lcs[i] = LCS[(index + i) % LCS.length];
-        }
-        return new ChoiceLocationConstraint(lcs);
+        PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, op, parts);
     }
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-hadoop-compat/src/main/java/edu/uci/ics/hyracks/hadoop/compat/util/HadoopAdapter.java b/hyracks/hyracks-hadoop-compat/src/main/java/edu/uci/ics/hyracks/hadoop/compat/util/HadoopAdapter.java
index 7be5938..d0df7f1 100644
--- a/hyracks/hyracks-hadoop-compat/src/main/java/edu/uci/ics/hyracks/hadoop/compat/util/HadoopAdapter.java
+++ b/hyracks/hyracks-hadoop-compat/src/main/java/edu/uci/ics/hyracks/hadoop/compat/util/HadoopAdapter.java
@@ -4,6 +4,8 @@
 import java.net.InetSocketAddress;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
 
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.hdfs.protocol.ClientProtocol;
@@ -20,11 +22,10 @@
 import org.apache.hadoop.mapreduce.JobContext;
 import org.apache.hadoop.util.ReflectionUtils;
 
-import edu.uci.ics.hyracks.api.constraints.ExplicitPartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraint;
-import edu.uci.ics.hyracks.api.constraints.PartitionCountConstraint;
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
 import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
 import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
+import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.dataflow.value.ITuplePartitionComputerFactory;
@@ -48,6 +49,7 @@
 
     public static final String FS_DEFAULT_NAME = "fs.default.name";
     private JobConf jobConf;
+    private Map<OperatorDescriptorId,Integer> operatorInstanceCount = new HashMap<OperatorDescriptorId,Integer>();
     public static final String HYRACKS_EX_SORT_FRAME_LIMIT = "HYRACKS_EX_SORT_FRAME_LIMIT"; 
     public static final int DEFAULT_EX_SORT_FRAME_LIMIT = 4096;
     public static final int DEFAULT_MAX_MAPPERS = 40;
@@ -130,22 +132,26 @@
       	InputFormat inputFormat = conf.getInputFormat();
     	return inputFormat.getSplits(conf, conf.getNumMapTasks());
     }
-    
+   
+    private void configurePartitionCountConstraint(JobSpecification spec, IOperatorDescriptor operator,int instanceCount){
+        PartitionConstraintHelper.addPartitionCountConstraint(spec, operator, instanceCount);
+        operatorInstanceCount.put(operator.getOperatorId(),instanceCount);
+    }
+
     public HadoopMapperOperatorDescriptor getMapper(JobConf conf,JobSpecification spec, IOperatorDescriptor previousOp)
             throws Exception {
         boolean selfRead = previousOp == null;
         IHadoopClassFactory classFactory = new ClasspathBasedHadoopClassFactory();
         HadoopMapperOperatorDescriptor mapOp = null;
-        PartitionConstraint constraint;
         if(selfRead) {
             Object [] splits = getInputSplits(conf,maxMappers);
             mapOp = new HadoopMapperOperatorDescriptor(spec, conf, splits,classFactory);
-            mapOp.setPartitionConstraint(new PartitionCountConstraint(splits.length));
+	    configurePartitionCountConstraint(spec,mapOp,splits.length);
             System.out.println("No of  mappers :" + splits.length);
         } else {
-            constraint = previousOp.getPartitionConstraint();
-            mapOp.setPartitionConstraint(constraint);
+	    configurePartitionCountConstraint(spec,mapOp,getInstanceCount(previousOp));
             mapOp = new HadoopMapperOperatorDescriptor(spec,conf,classFactory);
+            spec.connect(new OneToOneConnectorDescriptor(spec), previousOp, 0, mapOp, 0);
         }
         return mapOp;
     }
@@ -176,50 +182,55 @@
         return spec;
     }
 
-    private IOperatorDescriptor configureOutput(IOperatorDescriptor previousOperator, JobConf conf,
+    private IOperatorDescriptor configureOutput( IOperatorDescriptor previousOperator, JobConf conf,
             JobSpecification spec) throws Exception {
-        PartitionConstraint previousOpConstraint = previousOperator.getPartitionConstraint();
-        int noOfInputs = previousOpConstraint instanceof PartitionCountConstraint ? ((PartitionCountConstraint) previousOpConstraint)
-                .getCount()
-                : ((ExplicitPartitionConstraint) previousOpConstraint).getLocationConstraints().length;
-        int numOutputters = conf.getNumReduceTasks() != 0 ? conf.getNumReduceTasks() : noOfInputs;
+	int instanceCountPreviousOperator = operatorInstanceCount.get(previousOperator.getOperatorId());
+        int numOutputters = conf.getNumReduceTasks() != 0 ? conf.getNumReduceTasks() : instanceCountPreviousOperator;
         HadoopWriteOperatorDescriptor writer = null;
         writer = new HadoopWriteOperatorDescriptor(spec, conf, numOutputters);
-        writer.setPartitionConstraint(previousOperator.getPartitionConstraint());
+	configurePartitionCountConstraint(spec,writer,numOutputters);
         spec.connect(new OneToOneConnectorDescriptor(spec), previousOperator, 0, writer, 0);
         return writer;
     }
 
+
+    private int getInstanceCount(IOperatorDescriptor operator) {
+        return operatorInstanceCount.get(operator.getOperatorId());
+    } 
+
     private IOperatorDescriptor addCombiner(IOperatorDescriptor previousOperator, JobConf jobConf,
             JobSpecification spec) throws Exception {
         boolean useCombiner = (jobConf.getCombinerClass() != null);
         IOperatorDescriptor mapSideOutputOp = previousOperator;
         if (useCombiner) {
             System.out.println("Using Combiner:" + jobConf.getCombinerClass().getName());
-            PartitionConstraint mapperPartitionConstraint = previousOperator.getPartitionConstraint();
             IOperatorDescriptor mapSideCombineSortOp = getExternalSorter(jobConf, spec);
-            mapSideCombineSortOp.setPartitionConstraint(mapperPartitionConstraint);
+	    configurePartitionCountConstraint(spec,mapSideCombineSortOp,getInstanceCount(previousOperator));
     
             HadoopReducerOperatorDescriptor mapSideCombineReduceOp = getReducer(jobConf, spec);
-            mapSideCombineReduceOp.setPartitionConstraint(mapperPartitionConstraint);
-                  spec.connect(new OneToOneConnectorDescriptor(spec), previousOperator, 0, mapSideCombineSortOp, 0);
+	    configurePartitionCountConstraint(spec,mapSideCombineReduceOp,getInstanceCount(previousOperator));
+            spec.connect(new OneToOneConnectorDescriptor(spec), previousOperator, 0, mapSideCombineSortOp, 0);
             spec.connect(new OneToOneConnectorDescriptor(spec), mapSideCombineSortOp, 0, mapSideCombineReduceOp, 0);
             mapSideOutputOp = mapSideCombineSortOp;
         }
         return mapSideOutputOp;
     }
     
+    private int getNumReduceTasks(JobConf jobConf) {
+        int numReduceTasks = Math.min(maxReducers,jobConf.getNumReduceTasks());
+        return numReduceTasks;
+    }
+    
     private IOperatorDescriptor addReducer(IOperatorDescriptor previousOperator, JobConf jobConf,
             JobSpecification spec) throws Exception {
         IOperatorDescriptor mrOutputOperator = previousOperator;
         if (jobConf.getNumReduceTasks() != 0) {
             IOperatorDescriptor sorter = getExternalSorter(jobConf, spec);
             HadoopReducerOperatorDescriptor reducer = getReducer(jobConf, spec);
-            int numReduceTasks = Math.min(maxReducers,jobConf.getNumReduceTasks());
+            int numReduceTasks = getNumReduceTasks(jobConf);
             System.out.println("No of Reducers :" + numReduceTasks);
-            PartitionConstraint reducerPartitionConstraint = new PartitionCountConstraint(numReduceTasks);
-            sorter.setPartitionConstraint(reducerPartitionConstraint);
-            reducer.setPartitionConstraint(reducerPartitionConstraint);
+	    configurePartitionCountConstraint(spec,sorter,numReduceTasks);
+	    configurePartitionCountConstraint(spec,reducer,numReduceTasks);
     
             IConnectorDescriptor mToNConnectorDescriptor = getMtoNHashPartitioningConnector(jobConf, spec);
             spec.connect(mToNConnectorDescriptor, previousOperator, 0, sorter, 0);
diff --git a/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/job/profiling/CounterContext.java b/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/CounterContext.java
similarity index 92%
rename from hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/job/profiling/CounterContext.java
rename to hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/CounterContext.java
index 401dd57..689a5241 100644
--- a/hyracks/hyracks-control-nc/src/main/java/edu/uci/ics/hyracks/control/nc/job/profiling/CounterContext.java
+++ b/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/CounterContext.java
@@ -12,7 +12,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.hyracks.control.nc.job.profiling;
+package edu.uci.ics.hyracks.test.support;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -40,11 +40,6 @@
         return counter;
     }
 
-    @Override
-    public String getContextName() {
-        return contextName;
-    }
-
     public synchronized void dump(Map<String, Long> dumpMap) {
         for (Counter c : counterMap.values()) {
             dumpMap.put(c.getName(), c.get());
diff --git a/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestJobletContext.java b/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestJobletContext.java
index 921cb55..2fc43fc 100644
--- a/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestJobletContext.java
+++ b/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestJobletContext.java
@@ -27,7 +27,6 @@
 import edu.uci.ics.hyracks.api.resources.IDeallocatable;
 import edu.uci.ics.hyracks.control.nc.io.IOManager;
 import edu.uci.ics.hyracks.control.nc.io.ManagedWorkspaceFileFactory;
-import edu.uci.ics.hyracks.control.nc.job.profiling.CounterContext;
 
 public class TestJobletContext implements IHyracksJobletContext {
     private final INCApplicationContext appContext;
diff --git a/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestStageletContext.java b/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestStageletContext.java
index d28911b..4d31326 100644
--- a/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestStageletContext.java
+++ b/hyracks/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestStageletContext.java
@@ -27,7 +27,6 @@
 import edu.uci.ics.hyracks.api.resources.IDeallocatable;
 import edu.uci.ics.hyracks.control.nc.io.IOManager;
 import edu.uci.ics.hyracks.control.nc.io.ManagedWorkspaceFileFactory;
-import edu.uci.ics.hyracks.control.nc.job.profiling.CounterContext;
 
 public class TestStageletContext implements IHyracksStageletContext {
     private final IHyracksJobletContext jobletContext;
diff --git a/hyracks/hyracks-tests/hyracks-storage-am-btree-test/.classpath b/hyracks/hyracks-tests/hyracks-storage-am-btree-test/.classpath
index e44aa2f..f2cc5f7 100644
--- a/hyracks/hyracks-tests/hyracks-storage-am-btree-test/.classpath
+++ b/hyracks/hyracks-tests/hyracks-storage-am-btree-test/.classpath
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src/test/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="output" path="target/classes"/>
diff --git a/hyracks/hyracks-tests/hyracks-storage-am-invertedindex-test/.classpath b/hyracks/hyracks-tests/hyracks-storage-am-invertedindex-test/.classpath
index e44aa2f..f2cc5f7 100644
--- a/hyracks/hyracks-tests/hyracks-storage-am-invertedindex-test/.classpath
+++ b/hyracks/hyracks-tests/hyracks-storage-am-invertedindex-test/.classpath
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src/test/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="output" path="target/classes"/>
diff --git a/hyracks/pom.xml b/hyracks/pom.xml
index 0c31f34..684e8b7 100644
--- a/hyracks/pom.xml
+++ b/hyracks/pom.xml
@@ -60,14 +60,14 @@
     <module>hyracks-control-cc</module>
     <module>hyracks-control-nc</module>
     <module>hyracks-cli</module>
-    <module>hyracks-hadoop-compat</module>
-    <module>hyracks-server</module>
     <module>hyracks-storage-common</module>
     <module>hyracks-storage-am-btree</module>
     <module>hyracks-storage-am-invertedindex</module>
     <module>hyracks-test-support</module>
     <module>hyracks-tests</module>
+    <module>hyracks-server</module>
     <module>hyracks-examples</module>
     <module>hyracks-documentation</module>
+    <module>hyracks-hadoop-compat</module>
   </modules>
 </project>
