langtools/src/jdk.jshell/share/classes/jdk/jshell/tool/JavaShellToolBuilder.java
author weijun
Sat, 08 Jul 2017 14:09:01 +0800
changeset 45839 6df5e24443fc
parent 43770 a321bed02000
permissions -rw-r--r--
8183509: keytool should not allow multiple commands Reviewed-by: mullan, vinnie
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     1
/*
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     4
 *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    10
 *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    15
 * accompanied this code).
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    16
 *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    20
 *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    23
 * questions.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    24
 */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    25
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    26
package jdk.jshell.tool;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    27
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    28
import java.io.InputStream;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    29
import java.io.PrintStream;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    30
import java.util.Locale;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    31
import java.util.Map;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    32
import java.util.prefs.Preferences;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    33
import jdk.internal.jshell.tool.JShellToolBuilder;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    34
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    35
/**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    36
 * Interface to configure and run a Java shell tool instance. An instance of the
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    37
 * builder is created with the static {@link #builder} method. This builder can,
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    38
 * optionally, be configured with the configuration methods. All configuration
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    39
 * methods return the builder instance for use in chained initialization. All
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    40
 * configuration methods have sensible defaults which will be used if they are
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    41
 * not called.. After zero or more calls to configuration methods, the tool is
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    42
 * launched with a call to {@link #run(java.lang.String...) }.
43770
a321bed02000 8174762: JShell: @since tags missing
rfield
parents: 42843
diff changeset
    43
 *
a321bed02000 8174762: JShell: @since tags missing
rfield
parents: 42843
diff changeset
    44
 * @since 9
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    45
 */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    46
public interface JavaShellToolBuilder {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    47
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    48
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    49
     * Create a builder for launching the JDK jshell tool.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    50
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    51
     * @return a builder which can be used to configure and launch the jshell
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    52
     * tool
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    53
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    54
    static JavaShellToolBuilder builder() {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    55
        return new JShellToolBuilder();
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    56
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    57
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    58
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    59
     * Set the input channels.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    60
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    61
     * @implSpec If this method is not called, the behavior should be
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    62
     * equivalent to calling {@code in(System.in, null)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    63
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    64
     * @param cmdIn source of command input
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    65
     * @param userIn source of input for running user code, or {@code null} to
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    66
     * extract user input from cmdIn
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    67
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    68
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    69
    JavaShellToolBuilder in(InputStream cmdIn, InputStream userIn);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    70
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    71
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    72
     * Set the output channels. Same as {@code out(output, output, output)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    73
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    74
     * @implSpec If neither {@code out} method is called, the behavior should be
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    75
     * equivalent to calling {@code out(System.out)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    76
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    77
     * @param output destination of command feedback, console interaction, and
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    78
     * user code output
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    79
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    80
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    81
    JavaShellToolBuilder out(PrintStream output);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    82
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    83
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    84
     * Set the output channels.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    85
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    86
     * @implSpec If neither {@code out} method is called, the behavior should be
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    87
     * equivalent to calling {@code out(System.out, System.out, System.out)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    88
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    89
     * @param cmdOut destination of command feedback including error messages
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    90
     * for users
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    91
     * @param console destination of console interaction
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    92
     * @param userOut destination of user code output.  For example, user snippet
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    93
     * {@code System.out.println("Hello")} when executed {@code Hello} goes to
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    94
     * userOut.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    95
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    96
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    97
    JavaShellToolBuilder out(PrintStream cmdOut, PrintStream console, PrintStream userOut);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    98
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
    99
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   100
     * Set the error channels. Same as {@code err(error, error)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   101
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   102
     * @implSpec If neither {@code err} method is called, the behavior should be
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   103
     * equivalent to calling {@code err(System.err)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   104
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   105
     * @param error destination of tool errors, and
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   106
     * user code errors
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   107
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   108
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   109
    JavaShellToolBuilder err(PrintStream error);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   110
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   111
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   112
     * Set the error channels.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   113
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   114
     * @implSpec If neither {@code err} method is called, the behavior should be
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   115
     * equivalent to calling {@code err(System.err, System.err, System.err)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   116
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   117
     * @param cmdErr destination of tool start-up and fatal errors
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   118
     * @param userErr destination of user code error output.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   119
     * For example, user snippet  {@code System.err.println("Oops")}
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   120
     * when executed {@code Oops} goes to userErr.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   121
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   122
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   123
    JavaShellToolBuilder err(PrintStream cmdErr, PrintStream userErr);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   124
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   125
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   126
     * Set the storage mechanism for persistent information which includes
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   127
     * input history and retained settings.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   128
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   129
     * @implSpec If neither {@code persistence} method is called, the behavior
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   130
     * should be to use the tool's standard persistence mechanism.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   131
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   132
     * @param prefs an instance of {@link java.util.prefs.Preferences} that
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   133
     * is used to retrieve and store persistent information
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   134
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   135
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   136
    JavaShellToolBuilder persistence(Preferences prefs);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   137
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   138
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   139
     * Set the storage mechanism for persistent information which includes
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   140
     * input history and retained settings.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   141
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   142
     * @implSpec If neither {@code persistence} method is called, the behavior
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   143
     * should be to use the tool's standard persistence mechanism.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   144
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   145
     * @param prefsMap  an instance of {@link java.util.Map} that
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   146
     * is used to retrieve and store persistent information
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   147
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   148
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   149
    JavaShellToolBuilder persistence(Map<String,String> prefsMap);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   150
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   151
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   152
     * Set the source for environment variables.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   153
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   154
     * @implSpec If this method is not called, the behavior should be
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   155
     * equivalent to calling {@code env(System.getenv())}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   156
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   157
     * @param vars the Map of environment variable names to values
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   158
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   159
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   160
    JavaShellToolBuilder env(Map<String,String> vars);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   161
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   162
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   163
     * Set the locale.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   164
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   165
     * @implSpec If this method is not called, the behavior should be
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   166
     * equivalent to calling {@code locale(Locale.getDefault())}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   167
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   168
     * @param locale the locale
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   169
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   170
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   171
    JavaShellToolBuilder locale(Locale locale);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   172
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   173
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   174
     * Set to enable a command capturing prompt override.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   175
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   176
     * @implSpec If this method is not called, the behavior should be
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   177
     * equivalent to calling {@code promptCapture(false)}.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   178
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   179
     * @param capture if {@code true}, basic prompt is the {@code ENQ}
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   180
     * character and continuation prompt is the {@code ACK} character.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   181
     * If false, prompts are as set with set-up or user {@code /set} commands.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   182
     * @return the {@code JavaShellToolBuilder} instance
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   183
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   184
    JavaShellToolBuilder promptCapture(boolean capture);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   185
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   186
    /**
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   187
     * Run an instance of the Java shell tool as configured by the other methods
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   188
     * in this interface.  This call is not destructive, more than one call of
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   189
     * this method may be made from a configured builder.
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   190
     *
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   191
     * @param arguments the command-line arguments (including options), if any
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   192
     * @throws Exception an unexpected fatal exception
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   193
     */
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   194
    void run(String... arguments) throws Exception;
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents:
diff changeset
   195
}