duke@1: /* xdono@117: * Copyright 1997-2008 Sun Microsystems, Inc. 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 duke@1: * published by the Free Software Foundation. Sun designates this duke@1: * particular file as subject to the "Classpath" exception as provided duke@1: * by Sun 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: * duke@1: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@1: * CA 95054 USA or visit www.sun.com if you need additional information or duke@1: * have any questions. duke@1: */ duke@1: duke@1: package com.sun.tools.doclets.internal.toolkit; duke@1: duke@1: import com.sun.tools.doclets.internal.toolkit.taglets.*; duke@1: import com.sun.tools.doclets.internal.toolkit.util.*; duke@1: import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory; duke@1: import com.sun.javadoc.*; duke@1: import java.util.*; duke@1: import java.io.*; duke@1: duke@1: /** duke@1: * Configure the output based on the options. Doclets should sub-class duke@1: * Configuration, to configure and add their own options. This class contains duke@1: * all user options which are supported by the 1.1 doclet and the standard duke@1: * doclet. duke@1: * duke@1: * This code is not part of an API. duke@1: * It is implementation that is subject to change. duke@1: * Do not use it as an API duke@1: * duke@1: * @author Robert Field. duke@1: * @author Atul Dambalkar. duke@1: * @author Jamie Ho duke@1: */ duke@1: public abstract class Configuration { duke@1: duke@1: /** duke@1: * The factory for builders. duke@1: */ duke@1: protected BuilderFactory builderFactory; duke@1: duke@1: /** duke@1: * The taglet manager. duke@1: */ duke@1: public TagletManager tagletManager; duke@1: duke@1: /** duke@1: * The path to the builder XML input file. duke@1: */ duke@1: public String builderXMLPath; duke@1: duke@1: /** duke@1: * The default path to the builder XML. duke@1: */ duke@1: private static final String DEFAULT_BUILDER_XML = "resources/doclet.xml"; duke@1: duke@1: /** duke@1: * The path to Taglets duke@1: */ duke@1: public String tagletpath = ""; duke@1: duke@1: /** duke@1: * This is true if option "-serialwarn" is used. Defualt value is false to duke@1: * supress excessive warnings about serial tag. duke@1: */ duke@1: public boolean serialwarn = false; duke@1: duke@1: /** duke@1: * The specified amount of space between tab stops. duke@1: */ duke@1: public int sourcetab = DocletConstants.DEFAULT_TAB_STOP_LENGTH; duke@1: duke@1: /** duke@1: * True if we should generate browsable sources. duke@1: */ duke@1: public boolean linksource = false; duke@1: duke@1: /** duke@1: * True if command line option "-nosince" is used. Default value is duke@1: * false. duke@1: */ duke@1: public boolean nosince = false; duke@1: duke@1: /** duke@1: * True if we should recursively copy the doc-file subdirectories duke@1: */ duke@1: public boolean copydocfilesubdirs = false; duke@1: duke@1: /** duke@1: * The META charset tag used for cross-platform viewing. duke@1: */ duke@1: public String charset = ""; duke@1: duke@1: /** duke@1: * True if user wants to add member names as meta keywords. duke@1: * Set to false because meta keywords are ignored in general duke@1: * by most Internet search engines. duke@1: */ duke@1: public boolean keywords = false; duke@1: duke@1: /** jjg@140: * The meta tag keywords instance. duke@1: */ jjg@140: public final MetaKeywords metakeywords = new MetaKeywords(this); duke@1: duke@1: /** duke@1: * The list of doc-file subdirectories to exclude duke@1: */ jjg@74: protected Set excludedDocFileDirs; duke@1: duke@1: /** duke@1: * The list of qualifiers to exclude duke@1: */ jjg@74: protected Set excludedQualifiers; duke@1: duke@1: /** duke@1: * The Root of the generated Program Structure from the Doclet API. duke@1: */ duke@1: public RootDoc root; duke@1: duke@1: /** duke@1: * Destination directory name, in which doclet will generate the entire duke@1: * documentation. Default is current directory. duke@1: */ duke@1: public String destDirName = ""; duke@1: duke@1: /** duke@1: * Destination directory name, in which doclet will copy the doc-files to. duke@1: */ duke@1: public String docFileDestDirName = ""; duke@1: duke@1: /** duke@1: * Encoding for this document. Default is default encoding for this duke@1: * platform. duke@1: */ duke@1: public String docencoding = null; duke@1: duke@1: /** duke@1: * True if user wants to suppress descriptions and tags. duke@1: */ duke@1: public boolean nocomment = false; duke@1: duke@1: /** duke@1: * Encoding for this document. Default is default encoding for this duke@1: * platform. duke@1: */ duke@1: public String encoding = null; duke@1: duke@1: /** duke@1: * Generate author specific information for all the classes if @author duke@1: * tag is used in the doc comment and if -author option is used. duke@1: * showauthor is set to true if -author option is used. duke@1: * Default is don't show author information. duke@1: */ duke@1: public boolean showauthor = false; duke@1: duke@1: /** duke@1: * Generate version specific information for the all the classes duke@1: * if @version tag is used in the doc comment and if -version option is duke@1: * used. showversion is set to true if -version option is duke@1: * used.Default is don't show version information. duke@1: */ duke@1: public boolean showversion = false; duke@1: duke@1: /** duke@1: * Sourcepath from where to read the source files. Default is classpath. duke@1: * duke@1: */ duke@1: public String sourcepath = ""; duke@1: duke@1: /** duke@1: * Don't generate deprecated API information at all, if -nodeprecated duke@1: * option is used. nodepracted is set to true if duke@1: * -nodeprecated option is used. Default is generate deprected API duke@1: * information. duke@1: */ duke@1: public boolean nodeprecated = false; duke@1: duke@1: /** duke@1: * The catalog of classes specified on the command-line duke@1: */ duke@1: public ClassDocCatalog classDocCatalog; duke@1: duke@1: /** duke@1: * Message Retriever for the doclet, to retrieve message from the resource duke@1: * file for this Configuration, which is common for 1.1 and standard duke@1: * doclets. duke@1: * duke@1: * TODO: Make this private!!! duke@1: */ duke@1: public MessageRetriever message = null; duke@1: duke@1: /** duke@1: * True if user wants to suppress time stamp in output. duke@1: * Default is false. duke@1: */ duke@1: public boolean notimestamp= false; duke@1: duke@1: /** jjg@140: * The package grouping instance. duke@1: */ jjg@140: public final Group group = new Group(this); duke@1: duke@1: /** jjg@140: * The tracker of external package links. duke@1: */ duke@1: public final Extern extern = new Extern(this); duke@1: duke@1: /** duke@1: * Return the build date for the doclet. duke@1: */ duke@1: public abstract String getDocletSpecificBuildDate(); duke@1: duke@1: /** duke@1: * This method should be defined in all those doclets(configurations), duke@1: * which want to derive themselves from this Configuration. This method duke@1: * can be used to set its own command line options. duke@1: * duke@1: * @param options The array of option names and values. duke@1: * @throws DocletAbortException duke@1: */ duke@1: public abstract void setSpecificDocletOptions(String[][] options); duke@1: duke@1: /** duke@1: * Return the doclet specific {@link MessageRetriever} duke@1: * @return the doclet specific MessageRetriever. duke@1: */ duke@1: public abstract MessageRetriever getDocletSpecificMsg(); duke@1: duke@1: /** duke@1: * An array of the packages specified on the command-line merged duke@1: * with the array of packages that contain the classes specified on the duke@1: * command-line. The array is sorted. duke@1: */ duke@1: public PackageDoc[] packages; duke@1: duke@1: /** duke@1: * Constructor. Constructs the message retriever with resource file. duke@1: */ duke@1: public Configuration() { duke@1: message = duke@1: new MessageRetriever(this, duke@1: "com.sun.tools.doclets.internal.toolkit.resources.doclets"); jjg@74: excludedDocFileDirs = new HashSet(); jjg@74: excludedQualifiers = new HashSet(); duke@1: } duke@1: duke@1: /** duke@1: * Return the builder factory for this doclet. duke@1: * duke@1: * @return the builder factory for this doclet. duke@1: */ duke@1: public BuilderFactory getBuilderFactory() { duke@1: if (builderFactory == null) { duke@1: builderFactory = new BuilderFactory(this); duke@1: } duke@1: return builderFactory; duke@1: } duke@1: duke@1: /** duke@1: * This method should be defined in all those doclets duke@1: * which want to inherit from this Configuration. This method duke@1: * should return the number of arguments to the command line duke@1: * option (including the option name). For example, duke@1: * -notimestamp is a single-argument option, so this method would duke@1: * return 1. duke@1: * duke@1: * @param option Command line option under consideration. duke@1: * @return number of arguments to option (including the duke@1: * option name). Zero return means option not known. duke@1: * Negative value means error occurred. duke@1: */ duke@1: public int optionLength(String option) { duke@1: option = option.toLowerCase(); duke@1: if (option.equals("-author") || duke@1: option.equals("-docfilessubdirs") || duke@1: option.equals("-keywords") || duke@1: option.equals("-linksource") || duke@1: option.equals("-nocomment") || duke@1: option.equals("-nodeprecated") || duke@1: option.equals("-nosince") || duke@1: option.equals("-notimestamp") || duke@1: option.equals("-quiet") || duke@1: option.equals("-xnodate") || duke@1: option.equals("-version")) { duke@1: return 1; duke@1: } else if (option.equals("-d") || duke@1: option.equals("-docencoding") || duke@1: option.equals("-encoding") || duke@1: option.equals("-excludedocfilessubdir") || duke@1: option.equals("-link") || duke@1: option.equals("-sourcetab") || duke@1: option.equals("-noqualifier") || duke@1: option.equals("-output") || duke@1: option.equals("-sourcepath") || duke@1: option.equals("-tag") || duke@1: option.equals("-taglet") || duke@1: option.equals("-tagletpath")) { duke@1: return 2; duke@1: } else if (option.equals("-group") || duke@1: option.equals("-linkoffline")) { duke@1: return 3; duke@1: } else { duke@1: return -1; // indicate we don't know about it duke@1: } duke@1: } duke@1: duke@1: /** duke@1: * Perform error checking on the given options. duke@1: * duke@1: * @param options the given options to check. duke@1: * @param reporter the reporter used to report errors. duke@1: */ duke@1: public abstract boolean validOptions(String options[][], duke@1: DocErrorReporter reporter); duke@1: duke@1: private void initPackageArray() { jjg@74: Set set = new HashSet(Arrays.asList(root.specifiedPackages())); duke@1: ClassDoc[] classes = root.specifiedClasses(); duke@1: for (int i = 0; i < classes.length; i++) { duke@1: set.add(classes[i].containingPackage()); duke@1: } jjg@74: ArrayList results = new ArrayList(set); duke@1: Collections.sort(results); jjg@74: packages = results.toArray(new PackageDoc[] {}); duke@1: } duke@1: duke@1: /** duke@1: * Set the command line options supported by this configuration. duke@1: * duke@1: * @param options the two dimensional array of options. duke@1: */ duke@1: public void setOptions(String[][] options) { jjg@74: LinkedHashSet customTagStrs = new LinkedHashSet(); duke@1: for (int oi = 0; oi < options.length; ++oi) { duke@1: String[] os = options[oi]; duke@1: String opt = os[0].toLowerCase(); duke@1: if (opt.equals("-d")) { duke@1: destDirName = addTrailingFileSep(os[1]); duke@1: docFileDestDirName = destDirName; duke@1: } else if (opt.equals("-docfilessubdirs")) { duke@1: copydocfilesubdirs = true; duke@1: } else if (opt.equals("-docencoding")) { duke@1: docencoding = os[1]; duke@1: } else if (opt.equals("-encoding")) { duke@1: encoding = os[1]; duke@1: } else if (opt.equals("-author")) { duke@1: showauthor = true; duke@1: } else if (opt.equals("-version")) { duke@1: showversion = true; duke@1: } else if (opt.equals("-nodeprecated")) { duke@1: nodeprecated = true; duke@1: } else if (opt.equals("-sourcepath")) { duke@1: sourcepath = os[1]; duke@1: } else if (opt.equals("-classpath") && duke@1: sourcepath.length() == 0) { duke@1: sourcepath = os[1]; duke@1: } else if (opt.equals("-excludedocfilessubdir")) { duke@1: addToSet(excludedDocFileDirs, os[1]); duke@1: } else if (opt.equals("-noqualifier")) { duke@1: addToSet(excludedQualifiers, os[1]); duke@1: } else if (opt.equals("-linksource")) { duke@1: linksource = true; duke@1: } else if (opt.equals("-sourcetab")) { duke@1: linksource = true; duke@1: try { duke@1: sourcetab = Integer.parseInt(os[1]); duke@1: } catch (NumberFormatException e) { duke@1: //Set to -1 so that warning will be printed duke@1: //to indicate what is valid argument. duke@1: sourcetab = -1; duke@1: } duke@1: if (sourcetab <= 0) { duke@1: message.warning("doclet.sourcetab_warning"); duke@1: sourcetab = DocletConstants.DEFAULT_TAB_STOP_LENGTH; duke@1: } duke@1: } else if (opt.equals("-notimestamp")) { duke@1: notimestamp = true; duke@1: } else if (opt.equals("-nocomment")) { duke@1: nocomment = true; duke@1: } else if (opt.equals("-tag") || opt.equals("-taglet")) { duke@1: customTagStrs.add(os); duke@1: } else if (opt.equals("-tagletpath")) { duke@1: tagletpath = os[1]; duke@1: } else if (opt.equals("-keywords")) { duke@1: keywords = true; duke@1: } else if (opt.equals("-serialwarn")) { duke@1: serialwarn = true; duke@1: } else if (opt.equals("-group")) { duke@1: group.checkPackageGroups(os[1], os[2]); duke@1: } else if (opt.equals("-link")) { duke@1: String url = os[1]; duke@1: extern.url(url, url, root, false); duke@1: } else if (opt.equals("-linkoffline")) { duke@1: String url = os[1]; duke@1: String pkglisturl = os[2]; duke@1: extern.url(url, pkglisturl, root, true); duke@1: } duke@1: } duke@1: if (sourcepath.length() == 0) { duke@1: sourcepath = System.getProperty("env.class.path") == null ? "" : duke@1: System.getProperty("env.class.path"); duke@1: } duke@1: if (docencoding == null) { duke@1: docencoding = encoding; duke@1: } duke@1: duke@1: classDocCatalog = new ClassDocCatalog(root.specifiedClasses()); duke@1: initTagletManager(customTagStrs); duke@1: } duke@1: duke@1: /** duke@1: * Set the command line options supported by this configuration. duke@1: * duke@1: * @throws DocletAbortException duke@1: */ duke@1: public void setOptions() { duke@1: initPackageArray(); duke@1: setOptions(root.options()); duke@1: setSpecificDocletOptions(root.options()); duke@1: } duke@1: duke@1: duke@1: /** duke@1: * Initialize the taglet manager. The strings to initialize the simple custom tags should duke@1: * be in the following format: "[tag name]:[location str]:[heading]". duke@1: * @param customTagStrs the set two dimentional arrays of strings. These arrays contain duke@1: * either -tag or -taglet arguments. duke@1: */ mcimadamore@184: private void initTagletManager(Set customTagStrs) { duke@1: tagletManager = tagletManager == null ? duke@1: new TagletManager(nosince, showversion, showauthor, message) : duke@1: tagletManager; duke@1: String[] args; mcimadamore@184: for (Iterator it = customTagStrs.iterator(); it.hasNext(); ) { mcimadamore@184: args = it.next(); duke@1: if (args[0].equals("-taglet")) { duke@1: tagletManager.addCustomTag(args[1], tagletpath); duke@1: continue; duke@1: } duke@1: String[] tokens = Util.tokenize(args[1], duke@1: TagletManager.SIMPLE_TAGLET_OPT_SEPERATOR, 3); duke@1: if (tokens.length == 1) { duke@1: String tagName = args[1]; duke@1: if (tagletManager.isKnownCustomTag(tagName)) { duke@1: //reorder a standard tag duke@1: tagletManager.addNewSimpleCustomTag(tagName, null, ""); duke@1: } else { duke@1: //Create a simple tag with the heading that has the same name as the tag. duke@1: StringBuffer heading = new StringBuffer(tagName + ":"); duke@1: heading.setCharAt(0, Character.toUpperCase(tagName.charAt(0))); duke@1: tagletManager.addNewSimpleCustomTag(tagName, heading.toString(), "a"); duke@1: } duke@1: } else if (tokens.length == 2) { duke@1: //Add simple taglet without heading, probably to excluding it in the output. duke@1: tagletManager.addNewSimpleCustomTag(tokens[0], tokens[1], ""); duke@1: } else if (tokens.length >= 3) { duke@1: tagletManager.addNewSimpleCustomTag(tokens[0], tokens[2], tokens[1]); duke@1: } else { duke@1: message.error("doclet.Error_invalid_custom_tag_argument", args[1]); duke@1: } duke@1: } duke@1: } duke@1: jjg@74: private void addToSet(Set s, String str){ duke@1: StringTokenizer st = new StringTokenizer(str, ":"); duke@1: String current; duke@1: while(st.hasMoreTokens()){ duke@1: current = st.nextToken(); duke@1: s.add(current); duke@1: } duke@1: } duke@1: duke@1: /** duke@1: * Add a traliling file separator, if not found or strip off extra trailing duke@1: * file separators if any. duke@1: * duke@1: * @param path Path under consideration. duke@1: * @return String Properly constructed path string. duke@1: */ duke@1: String addTrailingFileSep(String path) { duke@1: String fs = System.getProperty("file.separator"); duke@1: String dblfs = fs + fs; duke@1: int indexDblfs; duke@1: while ((indexDblfs = path.indexOf(dblfs)) >= 0) { duke@1: path = path.substring(0, indexDblfs) + duke@1: path.substring(indexDblfs + fs.length()); duke@1: } duke@1: if (!path.endsWith(fs)) duke@1: path += fs; duke@1: return path; duke@1: } duke@1: duke@1: /** duke@1: * This checks for the validity of the options used by the user. duke@1: * This works exactly like duke@1: * {@link com.sun.javadoc.Doclet#validOptions(String[][], duke@1: * DocErrorReporter)}. This will validate the options which are shared duke@1: * by our doclets. For example, this method will flag an error using duke@1: * the DocErrorReporter if user has used "-nohelp" and "-helpfile" option duke@1: * together. duke@1: * duke@1: * @param options options used on the command line. duke@1: * @param reporter used to report errors. duke@1: * @return true if all the options are valid. duke@1: */ duke@1: public boolean generalValidOptions(String options[][], duke@1: DocErrorReporter reporter) { duke@1: boolean docencodingfound = false; duke@1: String encoding = ""; duke@1: for (int oi = 0; oi < options.length; oi++) { duke@1: String[] os = options[oi]; duke@1: String opt = os[0].toLowerCase(); duke@1: if (opt.equals("-d")) { duke@1: String destdirname = addTrailingFileSep(os[1]); duke@1: File destDir = new File(destdirname); duke@1: if (!destDir.exists()) { duke@1: //Create the output directory (in case it doesn't exist yet) duke@1: reporter.printNotice(getText("doclet.dest_dir_create", duke@1: destdirname)); duke@1: (new File(destdirname)).mkdirs(); duke@1: } else if (!destDir.isDirectory()) { duke@1: reporter.printError(getText( duke@1: "doclet.destination_directory_not_directory_0", duke@1: destDir.getPath())); duke@1: return false; duke@1: } else if (!destDir.canWrite()) { duke@1: reporter.printError(getText( duke@1: "doclet.destination_directory_not_writable_0", duke@1: destDir.getPath())); duke@1: return false; duke@1: } duke@1: } else if (opt.equals("-docencoding")) { duke@1: docencodingfound = true; duke@1: if (!checkOutputFileEncoding(os[1], reporter)) { duke@1: return false; duke@1: } duke@1: } else if (opt.equals("-encoding")) { duke@1: encoding = os[1]; duke@1: } duke@1: } duke@1: if (!docencodingfound && encoding.length() > 0) { duke@1: if (!checkOutputFileEncoding(encoding, reporter)) { duke@1: return false; duke@1: } duke@1: } duke@1: return true; duke@1: } duke@1: duke@1: /** duke@1: * Check the validity of the given Source or Output File encoding on this duke@1: * platform. duke@1: * duke@1: * @param docencoding output file encoding. duke@1: * @param reporter used to report errors. duke@1: */ duke@1: private boolean checkOutputFileEncoding(String docencoding, duke@1: DocErrorReporter reporter) { duke@1: OutputStream ost= new ByteArrayOutputStream(); duke@1: OutputStreamWriter osw = null; duke@1: try { duke@1: osw = new OutputStreamWriter(ost, docencoding); duke@1: } catch (UnsupportedEncodingException exc) { duke@1: reporter.printError(getText("doclet.Encoding_not_supported", duke@1: docencoding)); duke@1: return false; duke@1: } finally { duke@1: try { duke@1: if (osw != null) { duke@1: osw.close(); duke@1: } duke@1: } catch (IOException exc) { duke@1: } duke@1: } duke@1: return true; duke@1: } duke@1: duke@1: /** duke@1: * Return true if the given doc-file subdirectory should be excluded and duke@1: * false otherwise. duke@1: * @param docfilesubdir the doc-files subdirectory to check. duke@1: */ duke@1: public boolean shouldExcludeDocFileDir(String docfilesubdir){ duke@1: if (excludedDocFileDirs.contains(docfilesubdir)) { duke@1: return true; duke@1: } else { duke@1: return false; duke@1: } duke@1: } duke@1: duke@1: /** duke@1: * Return true if the given qualifier should be excluded and false otherwise. duke@1: * @param qualifier the qualifier to check. duke@1: */ duke@1: public boolean shouldExcludeQualifier(String qualifier){ duke@1: if (excludedQualifiers.contains("all") || duke@1: excludedQualifiers.contains(qualifier) || duke@1: excludedQualifiers.contains(qualifier + ".*")) { duke@1: return true; duke@1: } else { duke@1: int index = -1; duke@1: while ((index = qualifier.indexOf(".", index + 1)) != -1) { duke@1: if (excludedQualifiers.contains(qualifier.substring(0, index + 1) + "*")) { duke@1: return true; duke@1: } duke@1: } duke@1: return false; duke@1: } duke@1: } duke@1: duke@1: /** duke@1: * Return the qualified name of the ClassDoc if it's qualifier is not excluded. Otherwise, duke@1: * return the unqualified ClassDoc name. duke@1: * @param cd the ClassDoc to check. duke@1: */ duke@1: public String getClassName(ClassDoc cd) { duke@1: PackageDoc pd = cd.containingPackage(); duke@1: if (pd != null && shouldExcludeQualifier(cd.containingPackage().name())) { duke@1: return cd.name(); duke@1: } else { duke@1: return cd.qualifiedName(); duke@1: } duke@1: } duke@1: duke@1: public String getText(String key) { duke@1: try { duke@1: //Check the doclet specific properties file. duke@1: return getDocletSpecificMsg().getText(key); duke@1: } catch (Exception e) { duke@1: //Check the shared properties file. duke@1: return message.getText(key); duke@1: } duke@1: } duke@1: duke@1: public String getText(String key, String a1) { duke@1: try { duke@1: //Check the doclet specific properties file. duke@1: return getDocletSpecificMsg().getText(key, a1); duke@1: } catch (Exception e) { duke@1: //Check the shared properties file. duke@1: return message.getText(key, a1); duke@1: } duke@1: } duke@1: duke@1: public String getText(String key, String a1, String a2) { duke@1: try { duke@1: //Check the doclet specific properties file. duke@1: return getDocletSpecificMsg().getText(key, a1, a2); duke@1: } catch (Exception e) { duke@1: //Check the shared properties file. duke@1: return message.getText(key, a1, a2); duke@1: } duke@1: } duke@1: duke@1: public String getText(String key, String a1, String a2, String a3) { duke@1: try { duke@1: //Check the doclet specific properties file. duke@1: return getDocletSpecificMsg().getText(key, a1, a2, a3); duke@1: } catch (Exception e) { duke@1: //Check the shared properties file. duke@1: return message.getText(key, a1, a2, a3); duke@1: } duke@1: } duke@1: duke@1: /** duke@1: * Return true if the doc element is getting documented, depending upon duke@1: * -nodeprecated option and @deprecated tag used. Return true if duke@1: * -nodeprecated is not used or @deprecated tag is not used. duke@1: */ duke@1: public boolean isGeneratedDoc(Doc doc) { duke@1: if (!nodeprecated) { duke@1: return true; duke@1: } duke@1: return (doc.tags("deprecated")).length == 0; duke@1: } duke@1: duke@1: /** duke@1: * Return the doclet specific instance of a writer factory. duke@1: * @return the {@link WriterFactory} for the doclet. duke@1: */ duke@1: public abstract WriterFactory getWriterFactory(); duke@1: duke@1: /** duke@1: * Return the input stream to the builder XML. duke@1: * duke@1: * @return the input steam to the builder XML. duke@1: * @throws FileNotFoundException when the given XML file cannot be found. duke@1: */ duke@1: public InputStream getBuilderXML() throws FileNotFoundException { duke@1: return builderXMLPath == null ? duke@1: Configuration.class.getResourceAsStream(DEFAULT_BUILDER_XML) : duke@1: new FileInputStream(new File(builderXMLPath)); duke@1: } duke@1: duke@1: /** bpatel@191: * Return the Locale for this document. bpatel@191: */ bpatel@191: public abstract Locale getLocale(); bpatel@191: bpatel@191: /** duke@1: * Return the comparator that will be used to sort member documentation. duke@1: * To no do any sorting, return null. duke@1: * duke@1: * @return the {@link java.util.Comparator} used to sort members. duke@1: */ jjg@74: public abstract Comparator getMemberComparator(); duke@1: }