Refactored into hyracks-control-cc

git-svn-id: https://hyracks.googlecode.com/svn/trunk/hyracks@52 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-control-cc/.classpath b/hyracks-control-cc/.classpath
new file mode 100644
index 0000000..88cebb7
--- /dev/null
+++ b/hyracks-control-cc/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/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"/>
+</classpath>
diff --git a/hyracks-control-cc/.project b/hyracks-control-cc/.project
new file mode 100644
index 0000000..271840b
--- /dev/null
+++ b/hyracks-control-cc/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>hyracks-control-cc</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/hyracks-control-cc/.settings/org.eclipse.jdt.core.prefs b/hyracks-control-cc/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..1b67f41
--- /dev/null
+++ b/hyracks-control-cc/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,6 @@
+#Fri Jul 30 17:52:26 PDT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/hyracks-control-cc/.settings/org.maven.ide.eclipse.prefs b/hyracks-control-cc/.settings/org.maven.ide.eclipse.prefs
new file mode 100644
index 0000000..d783847
--- /dev/null
+++ b/hyracks-control-cc/.settings/org.maven.ide.eclipse.prefs
@@ -0,0 +1,9 @@
+#Fri Jul 30 17:52:26 PDT 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
diff --git a/hyracks-control-cc/pom.xml b/hyracks-control-cc/pom.xml
new file mode 100644
index 0000000..96992af
--- /dev/null
+++ b/hyracks-control-cc/pom.xml
@@ -0,0 +1,56 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>edu.uci.ics.hyracks</groupId>
+  <artifactId>hyracks-control-cc</artifactId>
+  <version>0.1.0</version>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+  	<dependency>
+  		<groupId>edu.uci.ics.hyracks</groupId>
+  		<artifactId>hyracks-control-common</artifactId>
+  		<version>0.1.0</version>
+  		<type>jar</type>
+  		<scope>compile</scope>
+  	</dependency>
+  	<dependency>
+  		<groupId>org.eclipse.jetty</groupId>
+  		<artifactId>jetty-server</artifactId>
+  		<version>8.0.0.M0</version>
+  		<type>jar</type>
+  		<scope>compile</scope>
+  	</dependency>
+  	<dependency>
+  		<groupId>args4j</groupId>
+  		<artifactId>args4j</artifactId>
+  		<version>2.0.12</version>
+  		<type>jar</type>
+  		<scope>compile</scope>
+  	</dependency>
+  	<dependency>
+  		<groupId>org.apache.wicket</groupId>
+  		<artifactId>wicket</artifactId>
+  		<version>1.4.7</version>
+  		<type>jar</type>
+  		<scope>compile</scope>
+  	</dependency>
+  	<dependency>
+  		<groupId>jol</groupId>
+  		<artifactId>jol</artifactId>
+  		<version>1.0.0</version>
+  		<type>jar</type>
+  		<scope>compile</scope>
+  	</dependency>
+  </dependencies>
+</project>
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/CCConfig.java b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/CCConfig.java
similarity index 100%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/CCConfig.java
rename to hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/CCConfig.java
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/CCDriver.java b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/CCDriver.java
similarity index 100%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/CCDriver.java
rename to hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/CCDriver.java
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java
similarity index 99%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java
rename to hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java
index 1623bf4..2597df7 100644
--- a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java
+++ b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java
@@ -60,9 +60,10 @@
 import edu.uci.ics.hyracks.control.cc.web.WebServer;
 import edu.uci.ics.hyracks.control.common.AbstractRemoteService;
 import edu.uci.ics.hyracks.control.common.NodeParameters;
+import edu.uci.ics.hyracks.control.common.api.IClusterController;
+import edu.uci.ics.hyracks.control.common.api.INodeController;
 import edu.uci.ics.hyracks.control.common.comm.Endpoint;
 import edu.uci.ics.hyracks.control.common.job.JobPlan;
-import edu.uci.ics.hyracks.control.nc.INodeController;
 
 public class ClusterControllerService extends AbstractRemoteService implements IClusterController {
     private static final long serialVersionUID = 1L;
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/IJobManager.java b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/IJobManager.java
similarity index 100%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/IJobManager.java
rename to hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/IJobManager.java
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/JOLJobManagerImpl.java b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JOLJobManagerImpl.java
similarity index 100%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/JOLJobManagerImpl.java
rename to hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JOLJobManagerImpl.java
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanBuilder.java b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanBuilder.java
similarity index 100%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanBuilder.java
rename to hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanBuilder.java
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanner.java b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanner.java
similarity index 100%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanner.java
rename to hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/JobPlanner.java
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/NodeControllerState.java b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/NodeControllerState.java
similarity index 90%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/NodeControllerState.java
rename to hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/NodeControllerState.java
index 10bcc51..e4d611b 100644
--- a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/NodeControllerState.java
+++ b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/NodeControllerState.java
@@ -1,6 +1,6 @@
 package edu.uci.ics.hyracks.control.cc;
 
-import edu.uci.ics.hyracks.control.nc.INodeController;
+import edu.uci.ics.hyracks.control.common.api.INodeController;
 
 public class NodeControllerState {
     private final INodeController nodeController;
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/StageProgress.java b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/StageProgress.java
similarity index 100%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/StageProgress.java
rename to hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/StageProgress.java
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/job/IOperatorDescriptorVisitor.java b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/IOperatorDescriptorVisitor.java
similarity index 100%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/job/IOperatorDescriptorVisitor.java
rename to hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/IOperatorDescriptorVisitor.java
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/job/PlanUtils.java b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/PlanUtils.java
similarity index 100%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/job/PlanUtils.java
rename to hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/job/PlanUtils.java
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/web/WebServer.java b/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/WebServer.java
similarity index 100%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/web/WebServer.java
rename to hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/web/WebServer.java
diff --git a/hyracks-control-common/pom.xml b/hyracks-control-common/pom.xml
index e744b36..3573835 100644
--- a/hyracks-control-common/pom.xml
+++ b/hyracks-control-common/pom.xml
@@ -24,5 +24,12 @@
   		<type>jar</type>
   		<scope>compile</scope>
   	</dependency>
+  	<dependency>
+  		<groupId>args4j</groupId>
+  		<artifactId>args4j</artifactId>
+  		<version>2.0.12</version>
+  		<type>jar</type>
+  		<scope>compile</scope>
+  	</dependency>
   </dependencies>
 </project>
diff --git a/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/api/CCConfig.java b/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/api/CCConfig.java
new file mode 100644
index 0000000..d4106cb
--- /dev/null
+++ b/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/api/CCConfig.java
@@ -0,0 +1,34 @@
+/*
+ * 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.common.api;
+
+import org.kohsuke.args4j.Option;
+
+public class CCConfig {
+    @Option(name = "-port", usage = "Sets the port to listen for connections from node controllers (default 1099)")
+    public int port = 1099;
+
+    @Option(name = "-http-port", usage = "Sets the http port for the admin console")
+    public int httpPort;
+
+    @Option(name = "-heartbeat-period", usage = "Sets the time duration between two heartbeats from each node controller in milliseconds (default: 10000)")
+    public int heartbeatPeriod = 10000;
+
+    @Option(name = "-max-heartbeat-lapse-periods", usage = "Sets the maximum number of missed heartbeats before a node is marked as dead (default: 5)")
+    public int maxHeartbeatLapsePeriods = 5;
+
+    @Option(name = "-use-jol", usage = "Forces Hyracks to use the JOL based scheduler (default: false)")
+    public boolean useJOL = false;
+}
\ No newline at end of file
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/IClusterController.java b/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/api/IClusterController.java
similarity index 93%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/IClusterController.java
rename to hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/api/IClusterController.java
index 03ca317..3b6efdd 100644
--- a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/cc/IClusterController.java
+++ b/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/api/IClusterController.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.common.api;
 
 import java.rmi.Remote;
 import java.util.UUID;
@@ -20,7 +20,6 @@
 import edu.uci.ics.hyracks.api.client.IHyracksClientInterface;
 import edu.uci.ics.hyracks.api.job.statistics.StageletStatistics;
 import edu.uci.ics.hyracks.control.common.NodeParameters;
-import edu.uci.ics.hyracks.control.nc.INodeController;
 
 public interface IClusterController extends Remote, IHyracksClientInterface {
     public NodeParameters registerNode(INodeController nodeController) throws Exception;
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/INodeController.java b/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/api/INodeController.java
similarity index 95%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/INodeController.java
rename to hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/api/INodeController.java
index e8ea230..31e2716 100644
--- a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/INodeController.java
+++ b/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/api/INodeController.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;
+package edu.uci.ics.hyracks.control.common.api;
 
 import java.rmi.Remote;
 import java.util.Map;
@@ -22,7 +22,6 @@
 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.control.cc.IClusterController;
 import edu.uci.ics.hyracks.control.common.NodeCapability;
 import edu.uci.ics.hyracks.control.common.comm.Endpoint;
 import edu.uci.ics.hyracks.control.common.job.JobPlan;
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/NCConfig.java b/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/api/NCConfig.java
similarity index 97%
rename from hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/NCConfig.java
rename to hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/api/NCConfig.java
index 62e43ec..0037117 100644
--- a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/NCConfig.java
+++ b/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/api/NCConfig.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;
+package edu.uci.ics.hyracks.control.common.api;
 
 import java.io.Serializable;
 
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/NCDriver.java b/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/NCDriver.java
index 71206c3..af1f3dc 100644
--- a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/NCDriver.java
+++ b/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/NCDriver.java
@@ -18,6 +18,7 @@
 
 import edu.uci.ics.dcache.client.DCacheClient;
 import edu.uci.ics.dcache.client.DCacheClientConfig;
+import edu.uci.ics.hyracks.control.common.api.NCConfig;
 
 public class NCDriver {
     public static void main(String args[]) throws Exception {
diff --git a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/NodeControllerService.java b/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/NodeControllerService.java
index c2482ea..14c5339 100644
--- a/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/NodeControllerService.java
+++ b/hyracks-runtime/src/main/java/edu/uci/ics/hyracks/control/nc/NodeControllerService.java
@@ -54,10 +54,12 @@
 import edu.uci.ics.hyracks.api.job.JobFlag;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.api.job.statistics.StageletStatistics;
-import edu.uci.ics.hyracks.control.cc.IClusterController;
 import edu.uci.ics.hyracks.control.common.AbstractRemoteService;
 import edu.uci.ics.hyracks.control.common.NodeCapability;
 import edu.uci.ics.hyracks.control.common.NodeParameters;
+import edu.uci.ics.hyracks.control.common.api.IClusterController;
+import edu.uci.ics.hyracks.control.common.api.INodeController;
+import edu.uci.ics.hyracks.control.common.api.NCConfig;
 import edu.uci.ics.hyracks.control.common.comm.Endpoint;
 import edu.uci.ics.hyracks.control.common.job.JobPlan;
 import edu.uci.ics.hyracks.control.nc.comm.ConnectionManager;
diff --git a/hyracks-server/pom.xml b/hyracks-server/pom.xml
index 7179c2a..213da7f 100644
--- a/hyracks-server/pom.xml
+++ b/hyracks-server/pom.xml
@@ -89,5 +89,12 @@
   		<type>jar</type>
   		<scope>compile</scope>
   	</dependency>
+  	<dependency>
+  		<groupId>edu.uci.ics.hyracks</groupId>
+  		<artifactId>hyracks-control-cc</artifactId>
+  		<version>0.1.0</version>
+  		<type>jar</type>
+  		<scope>compile</scope>
+  	</dependency>
   </dependencies>
 </project>
diff --git a/hyracks-server/src/test/java/edu/uci/ics/hyracks/tests/integration/AbstractIntegrationTest.java b/hyracks-server/src/test/java/edu/uci/ics/hyracks/tests/integration/AbstractIntegrationTest.java
index 9050e23..6232e6c 100644
--- a/hyracks-server/src/test/java/edu/uci/ics/hyracks/tests/integration/AbstractIntegrationTest.java
+++ b/hyracks-server/src/test/java/edu/uci/ics/hyracks/tests/integration/AbstractIntegrationTest.java
@@ -26,7 +26,7 @@
 import edu.uci.ics.hyracks.api.job.JobSpecification;
 import edu.uci.ics.hyracks.control.cc.CCConfig;
 import edu.uci.ics.hyracks.control.cc.ClusterControllerService;
-import edu.uci.ics.hyracks.control.nc.NCConfig;
+import edu.uci.ics.hyracks.control.common.api.NCConfig;
 import edu.uci.ics.hyracks.control.nc.NodeControllerService;
 
 public abstract class AbstractIntegrationTest {