duke@1: /* ohair@554: * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: * duke@1: * This code is free software; you can redistribute it and/or modify it duke@1: * under the terms of the GNU General Public License version 2 only, as ohair@554: * published by the Free Software Foundation. Oracle designates this duke@1: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle in the LICENSE file that accompanied this code. duke@1: * duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: * version 2 for more details (a copy is included in the LICENSE file that duke@1: * accompanied this code). duke@1: * duke@1: * You should have received a copy of the GNU General Public License version duke@1: * 2 along with this work; if not, write to the Free Software Foundation, duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. duke@1: */ duke@1: duke@1: package com.sun.tools.javadoc; duke@1: duke@1: import java.io.PrintWriter; duke@1: duke@1: /** duke@1: * Provides external entry points (tool and programmatic) duke@1: * for the javadoc program. duke@1: * duke@1: * @since 1.4 duke@1: */ duke@1: public class Main { duke@1: duke@1: /** duke@1: * Constructor should never be called. duke@1: */ duke@1: private Main() { duke@1: } duke@1: duke@1: /** duke@1: * Command line interface. duke@1: * @param args The command line parameters. duke@1: */ jjg@127: public static void main(String... args) { duke@1: System.exit(execute(args)); duke@1: } duke@1: duke@1: /** duke@1: * Programmatic interface. duke@1: * @param args The command line parameters. duke@1: * @return The return code. duke@1: */ jjg@127: public static int execute(String... args) { duke@1: Start jdoc = new Start(); duke@1: return jdoc.begin(args); duke@1: } duke@1: duke@1: /** duke@1: * Programmatic interface. jjg@129: * @param args The command line parameters. jjg@129: * @param docletParentClassLoader The parent class loader used when jjg@129: * creating the doclet classloader. If null, the class loader used jjg@129: * to instantiate doclets will be created without specifying a parent jjg@129: * class loader. jjg@129: * @return The return code. jjg@129: * @since 1.7 jjg@129: */ jjg@129: public static int execute(ClassLoader docletParentClassLoader, String... args) { jjg@129: Start jdoc = new Start(docletParentClassLoader); jjg@129: return jdoc.begin(args); jjg@129: } jjg@129: jjg@129: /** jjg@129: * Programmatic interface. duke@1: * @param programName Name of the program (for error messages). duke@1: * @param args The command line parameters. duke@1: * @return The return code. duke@1: */ jjg@127: public static int execute(String programName, String... args) { duke@1: Start jdoc = new Start(programName); duke@1: return jdoc.begin(args); duke@1: } duke@1: duke@1: /** duke@1: * Programmatic interface. duke@1: * @param programName Name of the program (for error messages). jjg@129: * @param args The command line parameters. jjg@129: * @param docletParentClassLoader The parent class loader used when jjg@129: * creating the doclet classloader. If null, the class loader used jjg@129: * to instantiate doclets will be created without specifying a parent jjg@129: * class loader. jjg@129: * @return The return code. jjg@129: * @since 1.7 jjg@129: */ jjg@129: public static int execute(String programName, ClassLoader docletParentClassLoader, String... args) { jjg@129: Start jdoc = new Start(programName, docletParentClassLoader); jjg@129: return jdoc.begin(args); jjg@129: } jjg@129: jjg@129: /** jjg@129: * Programmatic interface. jjg@129: * @param programName Name of the program (for error messages). duke@1: * @param defaultDocletClassName Fully qualified class name. duke@1: * @param args The command line parameters. duke@1: * @return The return code. duke@1: */ duke@1: public static int execute(String programName, duke@1: String defaultDocletClassName, jjg@127: String... args) { duke@1: Start jdoc = new Start(programName, defaultDocletClassName); duke@1: return jdoc.begin(args); duke@1: } duke@1: duke@1: /** duke@1: * Programmatic interface. duke@1: * @param programName Name of the program (for error messages). jjg@129: * @param defaultDocletClassName Fully qualified class name. jjg@129: * @param docletParentClassLoader The parent class loader used when jjg@129: * creating the doclet classloader. If null, the class loader used jjg@129: * to instantiate doclets will be created without specifying a parent jjg@129: * class loader. jjg@129: * @param args The command line parameters. jjg@129: * @return The return code. jjg@129: * @since 1.7 jjg@129: */ jjg@129: public static int execute(String programName, jjg@129: String defaultDocletClassName, jjg@129: ClassLoader docletParentClassLoader, jjg@129: String... args) { jjg@129: Start jdoc = new Start(programName, defaultDocletClassName, docletParentClassLoader); jjg@129: return jdoc.begin(args); jjg@129: } jjg@129: jjg@129: /** jjg@129: * Programmatic interface. jjg@129: * @param programName Name of the program (for error messages). duke@1: * @param errWriter PrintWriter to receive error messages. duke@1: * @param warnWriter PrintWriter to receive error messages. duke@1: * @param noticeWriter PrintWriter to receive error messages. duke@1: * @param defaultDocletClassName Fully qualified class name. duke@1: * @param args The command line parameters. duke@1: * @return The return code. duke@1: */ duke@1: public static int execute(String programName, duke@1: PrintWriter errWriter, duke@1: PrintWriter warnWriter, duke@1: PrintWriter noticeWriter, duke@1: String defaultDocletClassName, jjg@127: String... args) { duke@1: Start jdoc = new Start(programName, duke@1: errWriter, warnWriter, noticeWriter, duke@1: defaultDocletClassName); duke@1: return jdoc.begin(args); duke@1: } jjg@129: jjg@129: /** jjg@129: * Programmatic interface. jjg@129: * @param programName Name of the program (for error messages). jjg@129: * @param errWriter PrintWriter to receive error messages. jjg@129: * @param warnWriter PrintWriter to receive error messages. jjg@129: * @param noticeWriter PrintWriter to receive error messages. jjg@129: * @param defaultDocletClassName Fully qualified class name. jjg@129: * @param docletParentClassLoader The parent class loader used when jjg@129: * creating the doclet classloader. If null, the class loader used jjg@129: * to instantiate doclets will be created without specifying a parent jjg@129: * class loader. jjg@129: * @param args The command line parameters. jjg@129: * @return The return code. jjg@129: * @since 1.7 jjg@129: */ jjg@129: public static int execute(String programName, jjg@129: PrintWriter errWriter, jjg@129: PrintWriter warnWriter, jjg@129: PrintWriter noticeWriter, jjg@129: String defaultDocletClassName, jjg@129: ClassLoader docletParentClassLoader, jjg@129: String... args) { jjg@129: Start jdoc = new Start(programName, jjg@129: errWriter, warnWriter, noticeWriter, jjg@129: defaultDocletClassName, jjg@129: docletParentClassLoader); jjg@129: return jdoc.begin(args); jjg@129: } duke@1: }