jjg@416: /* ohair@554: * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. jjg@416: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jjg@416: * jjg@416: * This code is free software; you can redistribute it and/or modify it jjg@416: * under the terms of the GNU General Public License version 2 only, as ohair@554: * published by the Free Software Foundation. Oracle designates this jjg@416: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle in the LICENSE file that accompanied this code. jjg@416: * jjg@416: * This code is distributed in the hope that it will be useful, but WITHOUT jjg@416: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jjg@416: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jjg@416: * version 2 for more details (a copy is included in the LICENSE file that jjg@416: * accompanied this code). jjg@416: * jjg@416: * You should have received a copy of the GNU General Public License version jjg@416: * 2 along with this work; if not, write to the Free Software Foundation, jjg@416: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jjg@416: * 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. jjg@416: */ jjg@416: jjg@416: package com.sun.tools.javah; //javax.tools; jjg@416: jjg@416: import java.io.Writer; jjg@416: import java.nio.charset.Charset; jjg@416: import java.util.Locale; jjg@416: import java.util.concurrent.Callable; jjg@416: import javax.tools.DiagnosticListener; jjg@416: import javax.tools.JavaFileManager; jjg@416: import javax.tools.JavaFileObject; jjg@416: import javax.tools.OptionChecker; jjg@416: import javax.tools.StandardJavaFileManager; jjg@416: import javax.tools.Tool; jjg@416: jjg@416: /** jjg@416: * This class is intended to be put in javax.tools. jjg@416: * jjg@416: * @see DiagnosticListener jjg@416: * @see Diagnostic jjg@416: * @see JavaFileManager jjg@416: * @since 1.7 jjg@416: * jjg@416: *

This is NOT part of any API supported by Sun Microsystems. If jjg@416: * you write code that depends on this, you do so at your own risk. jjg@416: * This code and its internal interfaces are subject to change or jjg@416: * deletion without notice. jjg@416: */ jjg@416: public interface NativeHeaderTool extends Tool, OptionChecker { jjg@416: jjg@416: /** jjg@416: * Creates a future for a native header task with the given jjg@416: * components and arguments. The task might not have jjg@416: * completed as described in the NativeHeaderTask interface. jjg@416: * jjg@416: *

If a file manager is provided, it must be able to handle all jjg@416: * locations defined in {@link StandardLocation}. jjg@416: * jjg@416: * @param out a Writer for additional output from the task; jjg@416: * use {@code System.err} if {@code null} jjg@416: * @param fileManager a file manager; if {@code null} use the jjg@416: * task's standard filemanager jjg@416: * @param diagnosticListener a diagnostic listener; if {@code jjg@416: * null} use the compiler's default method for reporting jjg@416: * diagnostics jjg@416: * @param options task options, {@code null} means no options jjg@416: * @param classes class names for which native headers should be generated jjg@416: * @return an object representing the task to be done jjg@416: * @throws RuntimeException if an unrecoverable error jjg@416: * occurred in a user supplied component. The jjg@416: * {@linkplain Throwable#getCause() cause} will be the error in jjg@416: * user code. jjg@416: * @throws IllegalArgumentException if any of the given jjg@416: * compilation units are of other kind than jjg@416: * {@linkplain JavaFileObject.Kind#SOURCE source} jjg@416: */ jjg@416: NativeHeaderTask getTask(Writer out, jjg@416: JavaFileManager fileManager, jjg@416: DiagnosticListener diagnosticListener, jjg@416: Iterable options, jjg@416: Iterable classes); jjg@416: jjg@416: /** jjg@416: * Gets a new instance of the standard file manager implementation jjg@416: * for this tool. The file manager will use the given diagnostic jjg@416: * listener for producing any non-fatal diagnostics. Fatal errors jjg@416: * will be signalled with the appropriate exceptions. jjg@416: * jjg@416: *

The standard file manager will be automatically reopened if jjg@416: * it is accessed after calls to {@code flush} or {@code close}. jjg@416: * The standard file manager must be usable with other tools. jjg@416: * jjg@416: * @param diagnosticListener a diagnostic listener for non-fatal jjg@416: * diagnostics; if {@code null} use the tool's default method jjg@416: * for reporting diagnostics jjg@416: * @param locale the locale to apply when formatting diagnostics; jjg@416: * {@code null} means the {@linkplain Locale#getDefault() default locale}. jjg@416: * @param charset the character set used for decoding bytes; if jjg@416: * {@code null} use the platform default jjg@416: * @return the standard file manager jjg@416: */ jjg@416: StandardJavaFileManager getStandardFileManager( jjg@416: DiagnosticListener diagnosticListener, jjg@416: Locale locale, jjg@416: Charset charset); jjg@416: jjg@416: /** jjg@416: * Interface representing a future for a native header task. The jjg@416: * task has not yet started. To start the task, call jjg@416: * the {@linkplain #call call} method. jjg@416: * jjg@416: *

Before calling the call method, additional aspects of the jjg@416: * task can be configured, for example, by calling the jjg@416: * {@linkplain #setLocale setLocale} method. jjg@416: */ jjg@416: interface NativeHeaderTask extends Callable { jjg@416: jjg@416: /** jjg@416: * Set the locale to be applied when formatting diagnostics and jjg@416: * other localized data. jjg@416: * jjg@416: * @param locale the locale to apply; {@code null} means apply no jjg@416: * locale jjg@416: * @throws IllegalStateException if the task has started jjg@416: */ jjg@416: void setLocale(Locale locale); jjg@416: jjg@416: /** jjg@416: * Performs this native header task. The task may only jjg@416: * be performed once. Subsequent calls to this method throw jjg@416: * IllegalStateException. jjg@416: * jjg@416: * @return true if and only all the files were processed without errors; jjg@416: * false otherwise jjg@416: * jjg@416: * @throws RuntimeException if an unrecoverable error occurred jjg@416: * in a user-supplied component. The jjg@416: * {@linkplain Throwable#getCause() cause} will be the error jjg@416: * in user code. jjg@416: * @throws IllegalStateException if called more than once jjg@416: */ jjg@416: Boolean call(); jjg@416: } jjg@416: }