accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject [08/10] git commit: Merge branch '1.5.2-SNAPSHOT' into 1.6.0-SNAPSHOT
Date Thu, 27 Mar 2014 05:07:07 GMT
Merge branch '1.5.2-SNAPSHOT' into 1.6.0-SNAPSHOT

Conflicts:
	start/src/main/java/org/apache/accumulo/start/Main.java


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a5a05523
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a5a05523
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a5a05523

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: a5a055233e5762d110a9b0b79bd87e5c6717507e
Parents: a64151e 1140d00
Author: Sean Busbey <busbey@cloudera.com>
Authored: Wed Mar 26 23:41:56 2014 -0500
Committer: Sean Busbey <busbey@cloudera.com>
Committed: Wed Mar 26 23:41:56 2014 -0500

----------------------------------------------------------------------
 start/src/main/java/org/apache/accumulo/start/Main.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/a5a05523/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --cc start/src/main/java/org/apache/accumulo/start/Main.java
index 8eadb9d,5976923..3c7da95
--- a/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/start/src/main/java/org/apache/accumulo/start/Main.java
@@@ -35,21 -32,26 +35,24 @@@ public class Main 
          printUsage();
          System.exit(1);
        }
 -      final String argsToPass[] = new String[args.length - 1];
 -      System.arraycopy(args, 1, argsToPass, 0, args.length - 1);
 -      
 +
        Thread.currentThread().setContextClassLoader(AccumuloClassLoader.getClassLoader());
 -      
 +
        Class<?> vfsClassLoader = AccumuloClassLoader.getClassLoader().loadClass("org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader");
 -      
 +
        ClassLoader cl = (ClassLoader) vfsClassLoader.getMethod("getClassLoader", new Class[]
{}).invoke(null, new Object[] {});
 -      
 +
        Class<?> runTMP = null;
 -      
 +
        Thread.currentThread().setContextClassLoader(cl);
- 
-       if (args[0].equals("master")) {
-         runTMP = cl.loadClass("org.apache.accumulo.master.Master");
+       
+       if (args[0].equals("help")){
+         printUsage();
+         System.exit(0);
+       } else if (args[0].equals("master")) {
 -        runTMP = cl.loadClass("org.apache.accumulo.server.master.Master");
++	runTMP = cl.loadClass("org.apache.accumulo.master.Master");
        } else if (args[0].equals("tserver")) {
 -        runTMP = cl.loadClass("org.apache.accumulo.server.tabletserver.TabletServer");
 +        runTMP = cl.loadClass("org.apache.accumulo.tserver.TabletServer");
        } else if (args[0].equals("shell")) {
          runTMP = cl.loadClass("org.apache.accumulo.core.util.shell.Shell");
        } else if (args[0].equals("init")) {
@@@ -172,28 -141,6 +175,28 @@@
    }
  
    private static void printUsage() {
 -    System.out.println("accumulo init | master | tserver | monitor | shell | admin | gc
| classpath | rfile-info | login-info | tracer | proxy | zookeeper | info | version | help
| <accumulo class> args");
 +    System.out
-         .println("accumulo init | master | tserver | monitor | shell | admin | gc | classpath
| rfile-info | login-info | tracer | minicluster | proxy | zookeeper | create-token | info
| version | jar <jar> [<main class>] args | <accumulo class> args");
++        .println("accumulo init | master | tserver | monitor | shell | admin | gc | classpath
| rfile-info | login-info | tracer | minicluster | proxy | zookeeper | create-token | info
| version | help | jar <jar> [<main class>] args | <accumulo class> args");
 +  }
 +
 +  // feature: will work even if main class isn't in the JAR
 +  static Class<?> loadClassFromJar(String[] args, JarFile f, ClassLoader cl) throws
IOException, ClassNotFoundException {
 +    ClassNotFoundException explicitNotFound = null;
 +    if (args.length >= 3) {
 +      try {
 +        return cl.loadClass(args[2]); // jar jar-file main-class
 +      } catch (ClassNotFoundException cnfe) {
 +        // assume this is the first argument, look for main class in JAR manifest
 +        explicitNotFound = cnfe;
 +      }
 +    }
 +    String mainClass = f.getManifest().getMainAttributes().getValue(Attributes.Name.MAIN_CLASS);
 +    if (mainClass == null) {
 +      if (explicitNotFound != null) {
 +        throw explicitNotFound;
 +      }
 +      throw new ClassNotFoundException("No main class was specified, and the JAR manifest
does not specify one");
 +    }
 +    return cl.loadClass(mainClass);
    }
  }


Mime
View raw message