<!-- <questionid="arch-overall"when="init"> Describetheoverallarchitecture. <hint> WhatwillbeAPIfor <ahref="http://openide.netbeans.org/tutorial/api-design.html#design.apiandspi"> clientsandwhatsupportAPI</a>? Whatpartswillbepluggable? Howwillplug-insberegistered?Pleaseuse<code><apitype="export"/></code> todescribeyourgeneralAPIsandspecifytheir <ahref="http://openide.netbeans.org/tutorial/api-design.html#category-private"> stabilitycategories</a>. Ifpossiblepleaseprovidesimplediagrams. </hint> </question>
-->
<answer id="arch-overall">
<p>
<i>This API origins in External Execution API and contains set of basic
features with minimal dependencies.</i> For the better integration with
the IDE check also original External Execution API.
</p>
<p>
<b>To see the simplest usage of this API to handle external process see
documentation of
<a href="@TOP@org/netbeans/api/extexecution/base/BaseExecutionService.html">BaseExecutionService</a></b>
</p>
<p>
The External Execution Base module provides the
<api group="java" name="ExternalExecutionBaseAPI"type="export" category="stable"url="@TOP@org/netbeans/api/extexecution/base/package-summary.html"/>
that contains support for execution of external processes. There is also
abstraction of process builder and support class for extended process handling.
</p>
<p>
Another exported API
<api group="java" name="ExternalExecutionBaseInputAPI"type="export" category="stable"url="@TOP@org/netbeans/api/extexecution/base/input/package-summary.html"/>
define interfaces for input processing (character or line based) and provides
common implementations of these with factory methods.
</p>
<p>
The SPI
<api group="java" name="ExternalExecutionBaseSPI"type="export" category="stable"url="@TOP@org/netbeans/spi/extexecution/base/package-summary.html"/>
allows different implementations of process builder and defined interface
for extended process handling support.
</p>
</answer>
<!-- <questionid="arch-quality"when="init"> Howwillthe<ahref="http://www.netbeans.org/community/guidelines/q-evangelism.html">quality</a> ofyourcodebetestedand howarefutureregressionsgoingtobeprevented? <hint> Whatkindoftestingdo youwanttouse?Howmuchfunctionality,inwhichareas, shouldbecoveredbythetests?Howyoufindoutthatyour projectwassuccessful? </hint> </question>
-->
<answer id="arch-quality">
<p>
Most of the API functionality is covered by unit tests. Same applies to
future enhancements.
</p>
</answer>
<!-- <questionid="arch-time"when="init"> Whatarethetimeestimatesofthework? <hint> Pleaseexpressyourestimatesofhowlongthedesign,implementation, stabilizationarelikelytolast.Howmanypeoplewillbeneededto implementthisandwhatistheexpectedmilestonebywhichtheworkshouldbe ready? </hint> </question>
-->
<answer id="arch-time">
<p>
Written and functional. Compatible changes can occur in future.
</p>
</answer>
<!-- <questionid="arch-usecases"when="init"> <hint> Contentofthisanswerwillbedisplayedaspartofpageat http://www.netbeans.org/download/dev/javadoc/usecases.html Youcanusetags<usecasename="name>regularhtmldescription</usecase> andifyouwanttouseanURLyoucanprefixifwith@TOP@tobegin attherootofyourjavadoc </hint> Describethemain<ahref="http://openide.netbeans.org/tutorial/api-design.html#usecase"> usecases</a>ofthenewAPI.Whowilluseitunder whatcircumstances?Whatkindofcodewouldtypicallyneedtobewritten tousethemodule? </question>
-->
<answer id="arch-usecases">
<usecase id="execute-process" name="Execution of an external process">
<p>
Client needs to execute an external process and handle process streams.
</p>
<p>
In order to achieve this client creates the
<a href="@TOP@org/netbeans/api/extexecution/base/BaseExecutionDescriptor.html">BaseExecutionDescriptor</a>.
Via this object client configures all the client integration parameters of
the execution. As a next step client creates the
<a href="@TOP@org/netbeans/api/extexecution/base/BaseExecutionService.html">BaseExecutionService</a>
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.
</p>
<p>
The creation of the external process is supported by
<a href="@TOP@org/netbeans/api/extexecution/base/ProcessBuilder.html">ProcessBuilder</a>
to make things easier.
</p>
</usecase>
<usecase id="handle-input" name="Processing the input">
<p>
Client needs to process character data coming from stream, file or other
source.
</p>
<p>
To abstract the source of the data client must implement
<a href="@TOP@org/netbeans/api/extexecution/base/input/InputReader.html">InputReader</a>.
To abstract the data processing client must implement
<a href="@TOP@org/netbeans/api/extexecution/base/input/InputProcessor.html">InputProcessor</a> or
<a href="@TOP@org/netbeans/api/extexecution/base/input/LineProcessor.html">LineProcessor</a>.
For all three interfaces there are prepared common implementations (and bridge
from character based to line based processing) at these three factory classes:
</p>
<ul>
<li><a href="@TOP@org/netbeans/api/extexecution/base/input/InputReaders.html">InputReaders</a></li>
<li><a href="@TOP@org/netbeans/api/extexecution/base/input/InputProcessors.html">InputProcessors</a></li>
<li><a href="@TOP@org/netbeans/api/extexecution/base/input/LineProcessors.html">LineProcessors</a></li>
</ul>
<p>
Once the data source and processing objects are prepared client creates
<a href="@TOP@org/netbeans/api/extexecution/base/input/InputReaderTask.html">InputReaderTask</a>.
Factory methods of the <a href="@TOP@org/netbeans/api/extexecution/base/input/InputReaderTask.html">InputReaderTask</a>
can create either common task exiting on interruption or cancellation
or draining task which is trying to drain out all available data before exiting.
</p>
</usecase>
<usecase id="process-builder" name="Custom process builder">
<p>
Third party wants to implement custom process builder to provide
additional functionality, such as remote execution.
</p>
<p>
In order to do so it will implement
<a href="@TOP@org/netbeans/spi/extexecution/base/ProcessBuilderImplementation.html">
ProcessBuilderImplementation</a> and pass
<a href="@TOP@org/netbeans/api/extexecution/base/ProcessBuilder.html">
ProcessBuilder</a> to its clients. The API instances are created with
help of
<a href="@TOP@org/netbeans/spi/extexecution/base/ProcessBuilderFactory.html">ProcessBuilderFactory</a>.
</p>
</usecase>
<usecase id="destroy-process" name="Destroying a process">
<p>
Client wants to destroy the process, trying to kill whole process tree.
Method
<a href="@TOP@org/netbeans/api/extexecution/base/Processes.html#killTree(java.lang.Process,java.util.Map)">
Processes.killTree(java.lang.Process process, Map<String,String> environment)</a>
is designed for that. It will use a
<a href="@TOP@org/netbeans/spi/extexecution/base/ProcessesImplementation.html">ProcessesImplementation</a>
registered in default lookup to do so.
</p>
</usecase>
</answer>
<!-- <questionid="arch-what"when="init"> Whatisthisprojectgoodfor? <hint> Pleaseprovidehereafewlinesdescribingtheproject, whatproblemitshouldsolve,providelinkstodocumentation, specifications,etc. </hint> </question>
-->
<answer id="arch-what">
<p>
Provides common APIs to execute external process and to handle its
streams and process the output. Input/line processing can be used
as separate part.
</p>
</answer>
<!-- <questionid="compat-deprecation"when="init"> Howtheintroductionofyourprojectinfluencesfunctionality providedbypreviousversionoftheproduct? <hint> Ifyouareplanningtodeprecate/remove/changeanyexistingAPIs, listthemhereaccompaniedwiththereasonexplainingwhyyou aredoingso. </hint> </question>
-->
<answer id="compat-deprecation">
<p>
The module languages.execution should be removed as it provides not well
stabilized subset of the same functionality.
</p>
</answer>
<!-- <questionid="exec-process"when="impl"> Doyouexecuteanexternalprocessfromyourmodule?Howdoyouensure thattheresultisthesameondifferentplatforms?Doyouparseoutput? Doyoudependonresultcode? <hint> Ifyoufeedaninput,parsetheoutputpleasedeclarethatasanAPI. </hint> </question>
-->
<answer id="exec-process">
<p>
Yes. The API provides support to do so. The result code, input and
output stream content does not define API as this is forwarded to the client
of this module.
</p>
</answer>
<!-- <questionid="exec-threading"when="init"> Whatthreadingmodels,ifany,doesyourmoduleadhereto?Howthe projectbehaveswithrespecttothreading? <hint> IsyourAPIthreadsafe?Canitbeaccessedfromanythreadsor justfromsomededicatedones?AnyspecialrelationtoAWTand itsEventDispatchthread?Also ifyourmodulecallsforeignAPIswhichhaveaspecificthreadingmodel, indicatehowyoucomplywiththerequirementsformultithreadedaccess (synchronization,mutexes,etc.)applicabletothoseAPIs. IfyourmoduledefinesanyAPIs,orhascomplexinternalstructures thatmightbeusedfrommultiplethreads,declarehowyouprotect dataagainstconcurrentaccess,raceconditions,deadlocks,etc., andwhethersuchrulesareenforcedbyruntimewarnings,errors,assertions,etc. Examples:aclassmightbenon-thread-safe(likeJavaCollections);might befullythread-safe(internallocking);mightrequireaccessthroughamutex (andmayormaynotautomaticallyacquirethatmutexonbehalfofaclientmethod); mightbeabletorunonlyintheeventqueue;etc. Alsodescribewhenanyeventsarefired:synchronously,asynchronously,etc. Ideas:<ahref="http://core.netbeans.org/proposals/threading/index.html#recommendations">ThreadingRecommendations</a>(inprogress) </hint> </question>
-->
<answer id="exec-threading">
<p>
Each class and factory method defines the thread safety of the class.
If this is missing by accident method can be called from any thread.
</p>
</answer>
<!-- <questionid="perf-exit"when="final"> Doesyourmodulerunanycodeonexit? </question>
-->
<answer id="perf-exit">
<p>
On JVM shutdown module tries to terminate any running process executed
through the API.
</p>
</answer>
<!-- <questionid="perf-limit"when="init"> Arethereanyhard-codedorpracticallimitsinthenumberorsizeof elementsyourcodecanhandle? <hint> Mostofalgorithmshaveincreasingmemoryandspeedcomplexity withrespecttosizeofdatatheyoperateon.Whatisthecritical partofyourprojectthatcanbeseenasabottleneckwith respecttospeedorrequiredmemory?Whatarethepractical sizesofdatayoutestedyourprojectwith?Whatisyourestimate ofpotentialsizeofdatathatwouldcausevisibleperformance problems?Istheresomekindofchecktodetectsuchsituation andprevent"hard"crashes-forexampletheCloneableEditorSupport checksforsizeofafiletobeopenedineditor andifitislargerthan1Mbitshowsadialoggivingthe usertherighttodecide-e.g.tocancelorcommitsuicide. </hint> </question>
-->
<answer id="perf-limit">
<p>
Any spawned process needs 4 threads (the worst case). One as the process
handler, one for the standard input, one for the standard output and one for
the standard error output. The minimal number of threads to handle a process
is 2 (process handler and standard output handler - standard error output
is redirected to the output, no thread for the standard input).
</p>
<p>
Typically the client should not run more than 10 external processes
concurrently.
</p>
</answer>
<!-- <questionid="perf-mem"when="final"> Howmuchmemorydoesyourcomponentconsume?Estimate witharelationtothenumberofwindows,etc. </question>
-->
<answer id="perf-mem">
<p>
The small amount of the memory is consumed by caching data structures like
available output tabs and currently executed processes.
</p>
</answer>
<!-- <questionid="perf-scale"when="init"> Whichexternalcriteriainfluencetheperformanceofyour program(sizeoffileineditor,numberoffilesinmenu, insourcedirectory,etc.)andhowwellyourcodescales? <hint> Pleaseincludesomeestimates,thereareothermoredetailed questionstoanswerinlaterphasesofimplementation. </hint> </question>
-->
<answer id="perf-scale">
<p>
Number of threads depending on number of spawned processes (n) increases
lineary (4n the worst case, 2n the best case).
</p>
</answer>
<!-- <questionid="perf-spi"when="init"> Howtheperformanceofthepluggedincodewillbeenforced? <hint> Ifyouallowforeigncodetobepluggedintoyourownmodule,how doyouenforcethatitwillbehavecorrectlyandquicklyandwillnot negativelyinfluencetheperformanceofyourownmodule? </hint> </question>
-->
<answer id="perf-spi">
<p>
No enforcement. SPI code may be used to terminate whole process tree.
</p>
</answer>
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.