public final class ExecutionDescriptor extends Object
ExecutionService.
Thread safety of this class depends on type of objects passed to its configuration methods. If these objects are immutable, resulting descriptor is immutable as well. It these objects are thread safe, resulting descriptor is thread safe as well.
ExecutionService| Modifier and Type | Class and Description |
|---|---|
static interface |
ExecutionDescriptor.InputProcessorFactory
Deprecated.
|
static interface |
ExecutionDescriptor.InputProcessorFactory2
Factory creating the input processor.
|
static interface |
ExecutionDescriptor.LineConvertorFactory
Factory creating the line convertor.
|
static interface |
ExecutionDescriptor.RerunCallback
Provides a callback to be invoked when rerun action is invoked.
|
static interface |
ExecutionDescriptor.RerunCondition
Represents the possibility of reruning the action.
|
| Constructor and Description |
|---|
ExecutionDescriptor()
Creates the new descriptor.
|
| Modifier and Type | Method and Description |
|---|---|
ExecutionDescriptor |
charset(Charset charset)
Returns a descriptor with configured charset.
|
ExecutionDescriptor |
controllable(boolean controllable)
Returns a descriptor with configured controllable flag.
|
ExecutionDescriptor |
errConvertorFactory(ExecutionDescriptor.LineConvertorFactory convertorFactory)
Returns a descriptor with configured factory for convertor for standard
error output.
|
ExecutionDescriptor |
errLineBased(boolean errLineBased)
Returns a descriptor with configured flag indicating line based standard
error output.
|
ExecutionDescriptor |
errProcessorFactory(ExecutionDescriptor.InputProcessorFactory errProcessorFactory)
|
ExecutionDescriptor |
errProcessorFactory(ExecutionDescriptor.InputProcessorFactory2 errProcessorFactory)
Returns a descriptor with configured factory for standard error output
processor.
|
ExecutionDescriptor |
frontWindow(boolean frontWindow)
Returns a descriptor with configured front window flag.
|
ExecutionDescriptor |
frontWindowOnError(boolean frontWindowOnError)
Returns a descriptor with configured front window on error flag.
|
ExecutionDescriptor |
inputOutput(InputOutput io)
Returns a descriptor with configured custom io.
|
ExecutionDescriptor |
inputVisible(boolean inputVisible)
Returns a descriptor with configured input visible flag.
|
ExecutionDescriptor |
noReset(boolean noReset)
Returns a descriptor with configured no reset flag.
|
ExecutionDescriptor |
optionsPath(String optionsPath)
Returns a descriptor with configured options path.
|
ExecutionDescriptor |
outConvertorFactory(ExecutionDescriptor.LineConvertorFactory convertorFactory)
Returns a descriptor with configured factory for convertor for standard
output.
|
ExecutionDescriptor |
outLineBased(boolean outLineBased)
Returns a descriptor with configured flag indicating line based standard
output.
|
ExecutionDescriptor |
outProcessorFactory(ExecutionDescriptor.InputProcessorFactory outProcessorFactory)
|
ExecutionDescriptor |
outProcessorFactory(ExecutionDescriptor.InputProcessorFactory2 outProcessorFactory)
Returns a descriptor with configured factory for standard output
processor.
|
ExecutionDescriptor |
postExecution(java.util.function.Consumer<Integer> postExecution)
Returns a descriptor with configured post execution runnable.
|
ExecutionDescriptor |
postExecution(Runnable postExecution)
Returns a descriptor with configured post execution runnable.
|
ExecutionDescriptor |
preExecution(Runnable preExecution)
Returns a descriptor with configured pre execution runnable.
|
ExecutionDescriptor |
rerunCallback(ExecutionDescriptor.RerunCallback rerunCallback)
Returns a descriptor with configured rerun callback.
|
ExecutionDescriptor |
rerunCondition(ExecutionDescriptor.RerunCondition rerunCondition)
Returns a descriptor with configured rerun condition.
|
ExecutionDescriptor |
showProgress(boolean showProgress)
Returns a descriptor with configured show progress flag.
|
ExecutionDescriptor |
showSuspended(boolean showSuspended)
Returns a descriptor with configured show suspend flag.
|
public ExecutionDescriptor()
null or false.@NonNull @CheckReturnValue public ExecutionDescriptor inputOutput(@NullAllowed InputOutput io)
null it means that client is fine with infrustructure
provided io (visible as tab in output pane).
If configured value is not null values configured via
methods ExecutionDescriptor.controllable(boolean), ExecutionDescriptor.rerunCondition(RerunCondition)
and #getOptionsPath() are ignored by ExecutionService.
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
io - custom input output, null allowed@NonNull @CheckReturnValue public ExecutionDescriptor controllable(boolean controllable)
true the control buttons (rerun, stop) will be available
io tab created by ExecutionService.
Note that this property has no meaning when custom io is used
(see ExecutionDescriptor.inputOutput(org.openide.windows.InputOutput)).
The default (not configured) value is false.
All other properties of the returned descriptor are inherited from
this.
controllable - controllable flag@NonNull @CheckReturnValue public ExecutionDescriptor frontWindow(boolean frontWindow)
true the io tab will be selected before the execution
invoked by ExecutionService.run().
The default (not configured) value is false.
All other properties of the returned descriptor are inherited from
this.
frontWindow - front window flag@NonNull @CheckReturnValue public ExecutionDescriptor inputVisible(boolean inputVisible)
true the input from user will be allowed.
The default (not configured) value is false.
All other properties of the returned descriptor are inherited from
this.
inputVisible - input visible flag@NonNull @CheckReturnValue public ExecutionDescriptor showProgress(boolean showProgress)
true the progress bar will be visible.
The default (not configured) value is false.
All other properties of the returned descriptor are inherited from
this.
showProgress - show progress flag@NonNull @CheckReturnValue public ExecutionDescriptor showSuspended(boolean showSuspended)
true the progress bar will be suspended to just
"running" message.
The default (not configured) value is false.
All other properties of the returned descriptor are inherited from
this.
showSuspended - show suspended flag@NonNull @CheckReturnValue public ExecutionDescriptor noReset(boolean noReset)
true the output window won't be cleared before
the execution. Valid only for custom InputOutput configured via
ExecutionDescriptor.inputOutput(org.openide.windows.InputOutput), ignored in all
other cases.
The default (not configured) value is false.
All other properties of the returned descriptor are inherited from
this.
noReset - no reset flag@NonNull @CheckReturnValue public ExecutionDescriptor outLineBased(boolean outLineBased)
true the default printing
processor will always wait for the whole line before converting and
printing it.outLineBased - line based flagExecutionDescriptor.outProcessorFactory(org.netbeans.api.extexecution.ExecutionDescriptor.InputProcessorFactory)@NonNull @CheckReturnValue public ExecutionDescriptor errLineBased(boolean errLineBased)
true the default
printing processor will always wait for the whole line before
converting and printing it.errLineBased - line based flagExecutionDescriptor.errProcessorFactory(org.netbeans.api.extexecution.ExecutionDescriptor.InputProcessorFactory)@NonNull @CheckReturnValue public ExecutionDescriptor frontWindowOnError(boolean frontWindowOnError)
true and the process will return nonzero
exit value the output window will be moved to front on execution finish.
The default (not configured) value is false.
All other properties of the returned descriptor are inherited from
this.
frontWindowOnError - front window on error flag@Deprecated @NonNull @CheckReturnValue public ExecutionDescriptor outProcessorFactory(@NullAllowed ExecutionDescriptor.InputProcessorFactory outProcessorFactory)
ExecutionDescriptor.outProcessorFactory(org.netbeans.api.extexecution.ExecutionDescriptor.InputProcessorFactory2)ExecutionService to create
additional processor for standard output.
Note that ExecutionService automatically uses
the printing processor created by
InputProcessors.printing(org.openide.windows.OutputWriter, org.netbeans.api.extexecution.print.LineConvertor, boolean)
or
LineProcessors.printing(org.openide.windows.OutputWriter, org.netbeans.api.extexecution.print.LineConvertor, boolean)
(in case ExecutionDescriptor.outLineBased(boolean) is configured to true)
if there is no configured factory.
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
outProcessorFactory - factory for standard output processor,
null allowed@NonNull @CheckReturnValue public ExecutionDescriptor outProcessorFactory(@NullAllowed ExecutionDescriptor.InputProcessorFactory2 outProcessorFactory)
ExecutionService to create
additional processor for standard output. The configured value will
be ignored if you previously configured processor via deprecated
ExecutionDescriptor.outProcessorFactory(org.netbeans.api.extexecution.ExecutionDescriptor.InputProcessorFactory).
Note that ExecutionService automatically uses
the printing processor created by
InputProcessors.printing(org.openide.windows.OutputWriter, org.netbeans.api.extexecution.print.LineConvertor, boolean)
or
LineProcessors.printing(org.openide.windows.OutputWriter, org.netbeans.api.extexecution.print.LineConvertor, boolean)
(in case ExecutionDescriptor.outLineBased(boolean) is configured to true)
if there is no configured factory.
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
outProcessorFactory - factory for standard output processor,
null allowed@Deprecated @NonNull @CheckReturnValue public ExecutionDescriptor errProcessorFactory(@NullAllowed ExecutionDescriptor.InputProcessorFactory errProcessorFactory)
ExecutionDescriptor.errProcessorFactory(org.netbeans.api.extexecution.ExecutionDescriptor.InputProcessorFactory2)ExecutionService to create
additional processor for standard error output.
Note that ExecutionService automatically uses
the printing processor created by
InputProcessors.printing(org.openide.windows.OutputWriter, org.netbeans.api.extexecution.print.LineConvertor, boolean)
or
LineProcessors.printing(org.openide.windows.OutputWriter, org.netbeans.api.extexecution.print.LineConvertor, boolean)
(in case ExecutionDescriptor.errLineBased(boolean) is configured to true)
if there is no configured factory.
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
errProcessorFactory - factory for standard error output processor,
null allowed@NonNull @CheckReturnValue public ExecutionDescriptor errProcessorFactory(@NullAllowed ExecutionDescriptor.InputProcessorFactory2 errProcessorFactory)
ExecutionService to create
additional processor for standard error output. The configured value will
be ignored if you previously configured processor via deprecated
ExecutionDescriptor.errProcessorFactory(org.netbeans.api.extexecution.ExecutionDescriptor.InputProcessorFactory).
Note that ExecutionService automatically uses
the printing processor created by
InputProcessors.printing(org.openide.windows.OutputWriter, org.netbeans.api.extexecution.print.LineConvertor, boolean)
or
LineProcessors.printing(org.openide.windows.OutputWriter, org.netbeans.api.extexecution.print.LineConvertor, boolean)
(in case ExecutionDescriptor.errLineBased(boolean) is configured to true)
if there is no configured factory.
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
errProcessorFactory - factory for standard error output processor,
null allowed@NonNull @CheckReturnValue public ExecutionDescriptor outConvertorFactory(@NullAllowed ExecutionDescriptor.LineConvertorFactory convertorFactory)
ExecutionService to create
convertor to use with processor printing the standard output.
Note that ExecutionService always uses the printing processor
for the standard output. Convertor created by the returned factory will
be passed to this default printing processor. See
ExecutionDescriptor.outProcessorFactory(org.netbeans.api.extexecution.ExecutionDescriptor.InputProcessorFactory) too.
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
convertorFactory - factory for convertor for standard output,
null allowed@NonNull @CheckReturnValue public ExecutionDescriptor errConvertorFactory(@NullAllowed ExecutionDescriptor.LineConvertorFactory convertorFactory)
ExecutionService to create
convertor to use with processor printing the standard error output.
Note that ExecutionService always uses the printing processor
for the standard error output. Convertor created by the returned
factory will be passed to this default printing processor. See
ExecutionDescriptor.errProcessorFactory(org.netbeans.api.extexecution.ExecutionDescriptor.InputProcessorFactory) too.
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
convertorFactory - factory for convertor for standard error output,
null allowed@NonNull @CheckReturnValue public ExecutionDescriptor preExecution(@NullAllowed Runnable preExecution)
ExecutionService.run()).
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
preExecution - pre execution runnable, null allowed@NonNull @CheckReturnValue public ExecutionDescriptor postExecution(@NullAllowed Runnable postExecution)
ExecutionService.run()).
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
postExecution - post execution runnable, null allowed@NonNull @CheckReturnValue public ExecutionDescriptor postExecution(@NullAllowed java.util.function.Consumer<Integer> postExecution)
ExecutionService.run()).
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
postExecution - post execution callback that receives exit code of the
execution, null allowed@NonNull @CheckReturnValue public ExecutionDescriptor rerunCondition(@NullAllowed ExecutionDescriptor.RerunCondition rerunCondition)
ExecutionService to control the possibility of the
rerun action.
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
rerunCondition - rerun condition, null allowedExecutionDescriptor.rerunCallback(org.netbeans.api.extexecution.ExecutionDescriptor.RerunCallback)@NonNull @CheckReturnValue public ExecutionDescriptor rerunCallback(@NullAllowed ExecutionDescriptor.RerunCallback rerunCallback)
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
rerunCallback - rerun callback, null allowedExecutionDescriptor.rerunCondition(org.netbeans.api.extexecution.ExecutionDescriptor.RerunCondition)@NonNull @CheckReturnValue public ExecutionDescriptor optionsPath(@NullAllowed String optionsPath)
null the ExecutionService will
display the button in the output tab displaying the proper options
when pressed. For this to work there has to be
a OptionOpenHandler in the system. Otherwise the options button
won't be displayed.
Note that this property has no meaning when custom io is used
(see ExecutionDescriptor.inputOutput(org.openide.windows.InputOutput)).
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
optionsPath - options path, null allowedOptionOpenHandler@NonNull @CheckReturnValue public ExecutionDescriptor charset(@NullAllowed Charset charset)
null the ExecutionService will
use the given charset to decode the process streams. When
null the platform default will be used.
Note that in the most common scenario of execution of OS native process you shouldn't need to set the charset. The platform default (which is the default used) is just the right choice.
The default (not configured) value is null.
All other properties of the returned descriptor are inherited from
this.
charset - charset, null allowed