~juju/pyjuju/zookeeper-vendor

« back to all changes in this revision

Viewing changes to src/contrib/bookkeeper/src/java/org/apache/bookkeeper/util/Main.java

  • Committer: Gustavo Niemeyer
  • Date: 2011-05-24 20:53:37 UTC
  • Revision ID: gustavo@niemeyer.net-20110524205337-i11yow5biap5xapo
Importing stock Zookeeper 3.3.3 without jars.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.apache.bookkeeper.util;
 
2
 
 
3
/*
 
4
 * 
 
5
 * Licensed to the Apache Software Foundation (ASF) under one
 
6
 * or more contributor license agreements.  See the NOTICE file
 
7
 * distributed with this work for additional information
 
8
 * regarding copyright ownership.  The ASF licenses this file
 
9
 * to you under the Apache License, Version 2.0 (the
 
10
 * "License"); you may not use this file except in compliance
 
11
 * with the License.  You may obtain a copy of the License at
 
12
 * 
 
13
 *   http://www.apache.org/licenses/LICENSE-2.0
 
14
 * 
 
15
 * Unless required by applicable law or agreed to in writing,
 
16
 * software distributed under the License is distributed on an
 
17
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
18
 * KIND, either express or implied.  See the License for the
 
19
 * specific language governing permissions and limitations
 
20
 * under the License.
 
21
 * 
 
22
 */
 
23
 
 
24
import java.io.IOException;
 
25
 
 
26
import org.apache.bookkeeper.proto.BookieClient;
 
27
import org.apache.bookkeeper.proto.BookieServer;
 
28
 
 
29
public class Main {
 
30
 
 
31
    static void usage() {
 
32
        System.err.println("USAGE: bookeeper client|bookie");
 
33
    }
 
34
 
 
35
    /**
 
36
     * @param args
 
37
     * @throws InterruptedException
 
38
     * @throws IOException
 
39
     */
 
40
    public static void main(String[] args) throws IOException, InterruptedException {
 
41
        if (args.length < 1 || !(args[0].equals("client") || args[0].equals("bookie"))) {
 
42
            usage();
 
43
            return;
 
44
        }
 
45
        String newArgs[] = new String[args.length - 1];
 
46
        System.arraycopy(args, 1, newArgs, 0, newArgs.length);
 
47
        if (args[0].equals("bookie")) {
 
48
            BookieServer.main(newArgs);
 
49
        } else {
 
50
            BookieClient.main(newArgs);
 
51
        }
 
52
    }
 
53
 
 
54
}