Skip to content

Commit

Permalink
Better handling of the join command
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Conrad committed Apr 1, 2010
1 parent 0a17832 commit 757d9bb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
Expand Up @@ -48,13 +48,18 @@ object NorbertClusterClientMain {
if (nodes.length > 0) println(nodes.mkString("\n")) else println("The cluster has no nodes")

case "join" =>
if (args.length < 4) {
println("Error: Invalid syntax: join nodeId url partition1 partition2...")
} else {
val nodeId :: url :: partitions = args
cluster.addNode(nodeId.toInt, url, partitions.map(_.toInt).toArray)
println("Joined Norbert cluster")
args match {
case nodeId :: url :: Nil =>
cluster.addNode(nodeId.toInt, url)
println("Joined Norbert cluster")

case nodeId :: url :: partitions =>
cluster.addNode(nodeId.toInt, url, partitions.map(_.toInt).toArray)
println("Joined Norbert cluster")

case _ => println("Error: Invalid syntax: join nodeId url partition1 partition2...")
}
println("Joined Norbert cluster")

case "leave" =>
if (args.length < 1) {
Expand Down
Expand Up @@ -68,13 +68,18 @@ object NorbertNetworkClientMain {
if (nodes.length > 0) println(nodes.mkString("\n")) else println("The cluster has no nodes")

case "join" =>
if (args.length < 4) {
println("Error: Invalid syntax: join nodeId url partition1 partition2...")
} else {
val nodeId :: url :: partitions = args
cc.addNode(nodeId.toInt, url, partitions.map(_.toInt).toArray)
println("Joined Norbert cluster")
args match {
case nodeId :: url :: Nil =>
cc.addNode(nodeId.toInt, url)
println("Joined Norbert cluster")

case nodeId :: url :: partitions =>
cc.addNode(nodeId.toInt, url, partitions.map(_.toInt).toArray)
println("Joined Norbert cluster")

case _ => println("Error: Invalid syntax: join nodeId url partition1 partition2...")
}
println("Joined Norbert cluster")

case "leave" =>
if (args.length < 1) {
Expand Down

0 comments on commit 757d9bb

Please sign in to comment.