Merged hyracks_dev_next -r 1287 into trunk
git-svn-id: https://hyracks.googlecode.com/svn/trunk@1288 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks/hyracks-server/.classpath b/hyracks/hyracks-server/.classpath
deleted file mode 100644
index d0bec0f..0000000
--- a/hyracks/hyracks-server/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
diff --git a/hyracks/hyracks-server/.project b/hyracks/hyracks-server/.project
deleted file mode 100644
index 8b4eef9..0000000
--- a/hyracks/hyracks-server/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>hyracks-server</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.eclipse.jdt.core.javanature</nature>
- <nature>org.maven.ide.eclipse.maven2Nature</nature>
- </natures>
-</projectDescription>
diff --git a/hyracks/hyracks-server/.settings/org.eclipse.jdt.core.prefs b/hyracks/hyracks-server/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index b61b886..0000000
--- a/hyracks/hyracks-server/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,6 +0,0 @@
-#Thu Aug 04 11:50:35 PDT 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/hyracks/hyracks-server/.settings/org.maven.ide.eclipse.prefs b/hyracks/hyracks-server/.settings/org.maven.ide.eclipse.prefs
deleted file mode 100644
index e6f9a9e..0000000
--- a/hyracks/hyracks-server/.settings/org.maven.ide.eclipse.prefs
+++ /dev/null
@@ -1,9 +0,0 @@
-#Sun Aug 29 19:38:10 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/hyracks-server/pom.xml b/hyracks/hyracks-server/pom.xml
index 338ee6b..8a81c7b 100644
--- a/hyracks/hyracks-server/pom.xml
+++ b/hyracks/hyracks-server/pom.xml
@@ -1,18 +1,24 @@
<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-server</artifactId>
- <version>0.1.9-SNAPSHOT</version>
-
<parent>
<groupId>edu.uci.ics.hyracks</groupId>
<artifactId>hyracks</artifactId>
- <version>0.1.9-SNAPSHOT</version>
+ <version>0.2.0-SNAPSHOT</version>
</parent>
<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>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<executions>
@@ -27,6 +33,10 @@
<mainClass>edu.uci.ics.hyracks.control.nc.NCDriver</mainClass>
<name>hyracksnc</name>
</program>
+ <program>
+ <mainClass>edu.uci.ics.hyracks.server.drivers.VirtualClusterDriver</mainClass>
+ <name>hyracks-virtual-cluster</name>
+ </program>
</programs>
<repositoryLayout>flat</repositoryLayout>
<repositoryName>lib</repositoryName>
@@ -61,14 +71,14 @@
<dependency>
<groupId>edu.uci.ics.hyracks</groupId>
<artifactId>hyracks-control-cc</artifactId>
- <version>0.1.9-SNAPSHOT</version>
+ <version>0.2.0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>edu.uci.ics.hyracks</groupId>
<artifactId>hyracks-control-nc</artifactId>
- <version>0.1.9-SNAPSHOT</version>
+ <version>0.2.0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
diff --git a/hyracks/hyracks-server/src/main/java/edu/uci/ics/hyracks/server/drivers/VirtualClusterDriver.java b/hyracks/hyracks-server/src/main/java/edu/uci/ics/hyracks/server/drivers/VirtualClusterDriver.java
new file mode 100644
index 0000000..8833fed
--- /dev/null
+++ b/hyracks/hyracks-server/src/main/java/edu/uci/ics/hyracks/server/drivers/VirtualClusterDriver.java
@@ -0,0 +1,78 @@
+/*
+ * 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.server.drivers;
+
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.Option;
+
+import edu.uci.ics.hyracks.control.common.controllers.CCConfig;
+import edu.uci.ics.hyracks.control.common.controllers.NCConfig;
+import edu.uci.ics.hyracks.server.process.HyracksCCProcess;
+import edu.uci.ics.hyracks.server.process.HyracksNCProcess;
+
+public class VirtualClusterDriver {
+ private static class Options {
+ @Option(name = "-n", required = false, usage = "Number of node controllers (default: 2)")
+ public int n = 2;
+
+ @Option(name = "-cc-client-net-port", required = false, usage = "CC Port (default: 1098)")
+ public int ccClientNetPort = 1098;
+
+ @Option(name = "-cc-cluster-net-port", required = false, usage = "CC Port (default: 1099)")
+ public int ccClusterNetPort = 1099;
+
+ @Option(name = "-cc-http-port", required = false, usage = "CC Port (default: 16001)")
+ public int ccHttpPort = 16001;
+ }
+
+ public static void main(String[] args) throws Exception {
+ Options options = new Options();
+ CmdLineParser cp = new CmdLineParser(options);
+ try {
+ cp.parseArgument(args);
+ } catch (Exception e) {
+ System.err.println(e.getMessage());
+ cp.printUsage(System.err);
+ return;
+ }
+
+ CCConfig ccConfig = new CCConfig();
+ ccConfig.clusterNetIpAddress = "127.0.0.1";
+ ccConfig.clusterNetPort = options.ccClusterNetPort;
+ ccConfig.clientNetIpAddress = "127.0.0.1";
+ ccConfig.clientNetPort = options.ccClientNetPort;
+ ccConfig.httpPort = options.ccHttpPort;
+ HyracksCCProcess ccp = new HyracksCCProcess(ccConfig);
+ ccp.start();
+
+ Thread.sleep(5000);
+
+ HyracksNCProcess ncps[] = new HyracksNCProcess[options.n];
+ for (int i = 0; i < options.n; ++i) {
+ NCConfig ncConfig = new NCConfig();
+ ncConfig.ccHost = "127.0.0.1";
+ ncConfig.ccPort = options.ccClusterNetPort;
+ ncConfig.clusterNetIPAddress = "127.0.0.1";
+ ncConfig.nodeId = "nc" + i;
+ ncConfig.dataIPAddress = "127.0.0.1";
+ ncps[i] = new HyracksNCProcess(ncConfig);
+ ncps[i].start();
+ }
+
+ while (true) {
+ Thread.sleep(10000);
+ }
+ }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-server/src/main/java/edu/uci/ics/hyracks/server/process/HyracksCCProcess.java b/hyracks/hyracks-server/src/main/java/edu/uci/ics/hyracks/server/process/HyracksCCProcess.java
new file mode 100644
index 0000000..cb1be95
--- /dev/null
+++ b/hyracks/hyracks-server/src/main/java/edu/uci/ics/hyracks/server/process/HyracksCCProcess.java
@@ -0,0 +1,24 @@
+package edu.uci.ics.hyracks.server.process;
+
+import java.util.List;
+
+import edu.uci.ics.hyracks.control.cc.CCDriver;
+import edu.uci.ics.hyracks.control.common.controllers.CCConfig;
+
+public class HyracksCCProcess extends HyracksServerProcess {
+ private CCConfig config;
+
+ public HyracksCCProcess(CCConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ protected void addCmdLineArgs(List<String> cList) {
+ config.toCommandLine(cList);
+ }
+
+ @Override
+ protected String getMainClassName() {
+ return CCDriver.class.getName();
+ }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-server/src/main/java/edu/uci/ics/hyracks/server/process/HyracksNCProcess.java b/hyracks/hyracks-server/src/main/java/edu/uci/ics/hyracks/server/process/HyracksNCProcess.java
new file mode 100644
index 0000000..cd110c8
--- /dev/null
+++ b/hyracks/hyracks-server/src/main/java/edu/uci/ics/hyracks/server/process/HyracksNCProcess.java
@@ -0,0 +1,24 @@
+package edu.uci.ics.hyracks.server.process;
+
+import java.util.List;
+
+import edu.uci.ics.hyracks.control.common.controllers.NCConfig;
+import edu.uci.ics.hyracks.control.nc.NCDriver;
+
+public class HyracksNCProcess extends HyracksServerProcess {
+ private NCConfig config;
+
+ public HyracksNCProcess(NCConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ protected void addCmdLineArgs(List<String> cList) {
+ config.toCommandLine(cList);
+ }
+
+ @Override
+ protected String getMainClassName() {
+ return NCDriver.class.getName();
+ }
+}
\ No newline at end of file
diff --git a/hyracks/hyracks-server/src/main/java/edu/uci/ics/hyracks/server/process/HyracksServerProcess.java b/hyracks/hyracks-server/src/main/java/edu/uci/ics/hyracks/server/process/HyracksServerProcess.java
new file mode 100644
index 0000000..6a0e45f
--- /dev/null
+++ b/hyracks/hyracks-server/src/main/java/edu/uci/ics/hyracks/server/process/HyracksServerProcess.java
@@ -0,0 +1,85 @@
+/*
+ * 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.server.process;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public abstract class HyracksServerProcess {
+ private static final Logger LOGGER = Logger.getLogger(HyracksServerProcess.class.getName());
+
+ protected Process process;
+
+ public void start() throws IOException {
+ String[] cmd = buildCommand();
+ if (LOGGER.isLoggable(Level.INFO)) {
+ LOGGER.info("Starting command: " + Arrays.toString(cmd));
+ }
+ process = Runtime.getRuntime().exec(cmd, null, null);
+ dump(process.getInputStream());
+ dump(process.getErrorStream());
+ }
+
+ private void dump(InputStream input) {
+ final int streamBufferSize = 1000;
+ final Reader in = new InputStreamReader(input);
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ char[] chars = new char[streamBufferSize];
+ int c;
+ while ((c = in.read(chars)) != -1) {
+ if (c > 0) {
+ System.out.print(String.valueOf(chars, 0, c));
+ }
+ }
+ } catch (IOException e) {
+ }
+ }
+ }).start();
+ }
+
+ private String[] buildCommand() {
+ List<String> cList = new ArrayList<String>();
+ cList.add(getJavaCommand());
+ cList.add("-Dbasedir=" + System.getProperty("basedir"));
+ cList.add("-Djava.rmi.server.hostname=127.0.0.1");
+ cList.add("-classpath");
+ cList.add(getClasspath());
+ cList.add(getMainClassName());
+ addCmdLineArgs(cList);
+ return cList.toArray(new String[cList.size()]);
+ }
+
+ protected abstract void addCmdLineArgs(List<String> cList);
+
+ protected abstract String getMainClassName();
+
+ private final String getClasspath() {
+ return System.getProperty("java.class.path");
+ }
+
+ protected final String getJavaCommand() {
+ return System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
+ }
+}
\ No newline at end of file