public static void execute(String[] args) throws Exception {
    HiveMetaToolCommandLine cl = HiveMetaToolCommandLine.parseArguments(args);

    MetaToolObjectStore objectStore = new MetaToolObjectStore();
    objectStore.setConf(MetastoreConf.newMetastoreConf());

    MetaToolTask task = null;
    try {
      if (cl.isListFSRoot()) {
        task = new MetaToolTaskListFSRoot();
      } else if (cl.isExecuteJDOQL()) {
        task = new MetaToolTaskExecuteJDOQLQuery();
      } else if (cl.isUpdateLocation()) {
        task = new MetaToolTaskUpdateLocation();
      } else if (cl.isListExtTblLocs()) {
        task = new MetaToolTaskListExtTblLocs();
      } else if (cl.isDiffExtTblLocs()) {
        task = new MetaToolTaskDiffExtTblLocs();
      } else if (cl.isMetadataSummary()) {
        task = new MetaToolTaskMetadataSummary();
      } else {
        throw new IllegalArgumentException("No task was specified!");
      }

      task.setObjectStore(objectStore);
      task.setCommandLine(cl);
      task.execute();
    } finally {
      objectStore.shutdown();
    }
  }
This class provides Hive admins a tool. The following can be done with it:
- list the file system root
- execute JDOQL against the metastore using DataNucleus
- perform HA name node upgrade
- summarize the data in HMS
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/metatool/HiveMetaTool.java