docs: protected int runProgram(String[] args) {
          // If no args, dump usage and exit.
          if (args == null || args.length == 0) {
              stdout.println(getScriptUsage());
              return 0;
          }
  
          String action = args[0];
          String actionTarget = args.length >= 2 ? args[1] : "";
          if (action == null || action.isEmpty() || action.toLowerCase().equals("help")) {
              if (actionTarget.isEmpty() || "help".equalsIgnoreCase(actionTarget)) {
                  stdout.println(getScriptUsage());
                  stdout.println(getActions());
                  return 0;
              } else if ("generate".equalsIgnoreCase(actionTarget)) {
                  stderr.println(getMessage("generate.help"));
                  return 0;
              } else {
                  stderr.println(getMessage("action.unrecognized", actionTarget));
                  stdout.println(getScriptUsage());
                  return RC_INVALID_OPTION;
              }
          }
  
          // Make sure we were provided a valid action. If not print help and return invalid
          if ("generate".equalsIgnoreCase(action) == false) {
              stderr.println(getMessage("action.unrecognized", action));
              stdout.println(getScriptUsage());
              return RC_INVALID_OPTION;
          }
  
          String userDir = getUserDir();
          // The server name should be the second argument.  Go find the server.  If we can't find the server, print the help text.
          String serverName = actionTarget;
          File serverDirectory = new File(userDir + File.separator + "servers" + File.separator + serverName);
          if (serverName.isEmpty() || (serverDirectory.exists() == false) || (serverDirectory.isDirectory() == false)) {
              stderr.println(getMessage("server.not.found", serverName, serverDirectory.getAbsolutePath()));
              stdout.println(getScriptUsage());
              return RC_SERVER_NOT_FOUND;
          }
  
          // Check the output dir.. If the value isn't the same as the value the server is using we won't find the logs directory
          File logsDir = new File(getOutputDir(serverName) + serverName + File.separator + "logs");
          if (!logsDir.exists()) {
              stderr.println(getMessage("server.output.logs.dir.not.found", serverName, logsDir.getAbsolutePath()));
              return RC_SERVER_OUTPUT_NOT_FOUND;
          }
  
          // The file containing the local connector URL is always in the
          // server's output directory.  Note that the output directory may be
          // different than the user directory, where the server config is.
          File jmxLocalConnectorUrlFile = new File(getOutputDir(serverName) + serverName + File.separator + "logs"
                                                   + File.separator + "state" + File.separator
                                                   + "/com.ibm.ws.jmx.local.address");
          if (jmxLocalConnectorUrlFile.exists() == false) {
              stderr.println(getMessage("local.connector.not.found", serverName));
              return RC_LOCAL_CONNECTOR_URL_NOT_FOUND;
          }
  
          JMXConnector connector = null;
  
          try {
              BufferedReader br = new BufferedReader(new FileReader(jmxLocalConnectorUrlFile));
              String urlString = br.readLine();
              br.close();
  
              if (urlString == null) {
                  stderr.println(getMessage("local.connector.url.empty", serverName));
                  return RC_UNEXPECTED_ERROR;
              }
              JMXServiceURL url = new JMXServiceURL(urlString);
              connector = JMXConnectorFactory.connect(url);
  
              MBeanServerConnection con = connector.getMBeanServerConnection();
  
              // Look up the DDL generation MBean
              ObjectName name = new ObjectName(DDLGenerationMBean.OBJECT_NAME);
              Set<ObjectInstance> objects = con.queryMBeans(name, null);
              if ((objects != null) && (objects.size() > 0)) {
                  Iterator<ObjectInstance> i = objects.iterator();
                  ObjectInstance o = i.next();
                  ObjectName instanceName = o.getObjectName();
                  @SuppressWarnings("unchecked")
                  Map<String, Serializable> generateResults = (Map<String, Serializable>) con.invoke(instanceName, "generateDDL", new Object[] {}, new String[] {});
  
                  // Check the results from the operation.
                  if (generateResults == null) {
                      stderr.println(getMessage("mbean.null.result"));
                      return RC_MBEAN_INVALID_RESULT;
                  }
  
                  if (generateResults.containsKey(DDLGenerationMBean.SUCCESS)) {
                      Boolean success = (Boolean) generateResults.get(DDLGenerationMBean.SUCCESS);
                      if ((success == null) || (success.booleanValue() == false)) {
                          stderr.println(getMessage("mbean.bad.result"));
                          return RC_MBEAN_INVALID_RESULT;
                      }
                  } else {
                      stderr.println(getMessage("mbean.missing.result"));
                      return RC_MBEAN_INVALID_RESULT;
                  }
  
                  String outputDirectory = null;
                  if (generateResults.containsKey(DDLGenerationMBean.OUTPUT_DIRECTORY)) {
                      outputDirectory = (String) generateResults.get(DDLGenerationMBean.OUTPUT_DIRECTORY);
                      if ((outputDirectory == null) || (outputDirectory.length() <= 0)) {
                          stderr.println(getMessage("mbean.missing.output.dir"));
                          return RC_MBEAN_INVALID_RESULT;
                      } else {
                          stdout.println(getMessage("mbean.output.dir", outputDirectory));
  
                          if (generateResults.containsKey(DDLGenerationMBean.FILE_COUNT)) {
                              Integer fileCount = (Integer) generateResults.get(DDLGenerationMBean.FILE_COUNT);
                              if ((fileCount != null) && (fileCount.intValue() == 0)) {
                                  stdout.println(getMessage("no.output.generated", serverName));
                              }
                          }
                      }
                  } else {
                      stderr.println(getMessage("mbean.missing.output.dir"));
                      return RC_MBEAN_INVALID_RESULT;
                  }
              } else {
                  stderr.println(getMessage("mbean.not.found", serverName));
                  return RC_MBEAN_NOT_FOUND;
              }
          } catch (Throwable t) {
              stderr.println(getMessage("exception.catch", t.toString()));
              t.printStackTrace(stderr);
              return RC_UNEXPECTED_ERROR;
          } finally {
              if (connector != null) {
                  try {
                      connector.close();
                      connector = null;
                  } catch (Throwable t) {
                      /* Nothing... */
                  }
              }
          }
  
          return 0;
      }