Skip navigation links
org.netbeans.modules.extexecution.base/2 1.32

External Execution Base API
Stable

See: Description

External Execution Base API 
Package Description
org.netbeans.api.extexecution.base
The API supporting execution of an external process.
org.netbeans.api.extexecution.base.input
The support API for processing the growing streams or files.
org.netbeans.spi.extexecution.base
The support SPI for creation of external processes.

This API origins in External Execution API and contains set of basic features with minimal dependencies. For the better integration with the IDE check also original External Execution API.

To see the simplest usage of this API to handle external process see documentation of BaseExecutionService

The External Execution Base module provides the ExternalExecutionBaseAPI that contains support for execution of external processes. There is also abstraction of process builder and support class for extended process handling.

Another exported API ExternalExecutionBaseInputAPI define interfaces for input processing (character or line based) and provides common implementations of these with factory methods.

The SPI ExternalExecutionBaseSPI allows different implementations of process builder and defined interface for extended process handling support.

What is New (see all changes)?

Use Cases

Execution of an external process

Client needs to execute an external process and handle process streams.

In order to achieve this client creates the BaseExecutionDescriptor. Via this object client configures all the client integration parameters of the execution. As a next step client creates the BaseExecutionService itself and calls run to execute the job. Run can be called multiple times. The output and input streams are handled by the service. Additional processing can be configured in descriptor through interfaces described in following usecases.

The creation of the external process is supported by ProcessBuilder to make things easier.

Processing the input

Client needs to process character data coming from stream, file or other source.

To abstract the source of the data client must implement InputReader. To abstract the data processing client must implement InputProcessor or LineProcessor. For all three interfaces there are prepared common implementations (and bridge from character based to line based processing) at these three factory classes:

Once the data source and processing objects are prepared client creates InputReaderTask. Factory methods of the InputReaderTask can create either common task exiting on interruption or cancellation or draining task which is trying to drain out all available data before exiting.

Custom process builder

Third party wants to implement custom process builder to provide additional functionality, such as remote execution.

In order to do so it will implement ProcessBuilderImplementation and pass ProcessBuilder to its clients. The API instances are created with help of ProcessBuilderFactory.

Destroying a process

Client wants to destroy the process, trying to kill whole process tree. Method Processes.killTree(java.lang.Process process, Map<String,String> environment) is designed for that. It will use a ProcessesImplementation registered in default lookup to do so.

Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...
Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
ExternalExecutionBaseAPIExportedStable .../extexecution/base/package-summary.html

ExternalExecutionBaseInputAPIExportedStable .../base/input/package-summary.html

ExternalExecutionBaseSPIExportedStable .../extexecution/base/package-summary.html

Implementation Details

Where are the sources for the module?

The sources for the module are in the Apache Git repositories or in the GitHub repositories.

What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?

Nothing.

Read more about the implementation in the answers to architecture questions.

Skip navigation links
org.netbeans.modules.extexecution.base/2 1.32