<!-- <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>The major parts of this API has been refactored to External Execution Base API
in version1.43.</i> This API is now to be used in situations where the base
support is not sufficient such as when you need progress and output window
integration.
</p>
<p>
<b>To see the simplest usage of this API to handle external process
including input and output integration see documentation of
<a href="@TOP@org/netbeans/api/extexecution/ExecutionService.html">ExecutionService</a></b>
</p>
<p>
The External Execution module provides the
<api group="java" name="ExternalExecutionAPI"type="export" category="stable"url="@TOP@org/netbeans/api/extexecution/package-summary.html"/>
that contains support for execution of external processes in the IDE. It also
provide support class for the actual creation of the external process
and support for destroying the process tree.
<span style="text-decoration:line-through;">There is also abstraction of
process builder.</span> The builder is now deprecated and replaced by one in
External Execution Base API.
</p>
<p>
<span style="text-decoration:line-through;">Another exported API
<api group="java" name="ExternalExecutionInputAPI"type="export" category="stable"url="@TOP@org/netbeans/api/extexecution/input/package-summary.html"/>
define interfaces for input processing (character or line based)
and provides common implementations of these with factory methods.</span>
This API is now deprecated in favor of External Execution Base API.
</p>
<p>
Natural extension to input processing API is printing API
<api group="java" name="ExternalExecutionInputPrintingAPI"type="export" category="stable"url="@TOP@org/netbeans/api/extexecution/print/package-summary.html"/>
that defines interfaces transforming lines to lines printed to
<code>org.openide.windows.OutputWriter</code>. API provides common implementations too
and provides processor for <code>org.openide.windows.OutputWriter</code> printing.
</p>
<p>
<span style="text-decoration:line-through;">The SPI
<api group="java" name="ExternalExecutionSPI"type="export" category="stable"url="@TOP@org/netbeans/spi/extexecution/package-summary.html"/>
allows different implementations of process builder.</span>
This API is now deprecated in favor of External Execution Base API.
</p>
<p>
<span style="text-decoration:line-through;">There is also SPI allowing to
register support for destroying the process tree
<api group="java" name="ExternalExecutionDestroySPI"type="export" category="stable"url="@TOP@org/netbeans/spi/extexecution/destroy/package-summary.html"/>.</span>
This API is now deprecated in favor of <code>org.netbeans.spi.extexecution.base.ProcessesImplementation</code>
from External Execution Base API.
</p>
<p>
The <api group="java" name="ExternalExecutionOpenSPI"type="export" category="stable"url="@TOP@org/netbeans/spi/extexecution/open/package-summary.html"/>
allows implementation module to determine particular way of file or HTTP URL opening in predefined covertors. It also makes options dialog opening
pluggable.
</p>
<p>
There is also API to provide additional startup arguments to interested
clients such as projects and servers
<api group="java" name="ExternalExecutionStartupAPI"type="export" category="stable"url="@TOP@org/netbeans/api/extexecution/startup/package-summary.html"/>.
Th corresponding SPI for plugins which need to provide such additional arguments
is also available as
<api group="java" name="ExternalExecutionStartupSPI"type="export" category="stable"url="@TOP@org/netbeans/spi/extexecution/startup/package-summary.html"/>.
</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 and display the output in the output tab.
</p>
<p>
In order to achieve this client creates the
<a href="@TOP@org/netbeans/api/extexecution/ExecutionDescriptor.html">ExecutionDescriptor</a>.
Via this object client configures all the UI behaviour of the subsequent
execution. As a next step client creates the
<a href="@TOP@org/netbeans/api/extexecution/ExecutionService.html">ExecutionService</a>
itself and calls run to execute the job. Run can be called multiple times.
The output and input streams are presented in output tab. Additional
processing and printing conversion 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/ExternalProcessBuilder.html">ExternalProcessBuilder</a>
to make things easier.
</p>
</usecase>
<usecase id="handle-input" name="Processing the input">
<p>
<span style="text-decoration:line-through;">Client needs to process character
data coming from stream, file or other source.</span> This usecase should
be solved by External Execution Base API.
</p>
<p>
To abstract the source of the data client must implement
<a href="@TOP@org/netbeans/api/extexecution/input/InputReader.html">InputReader</a>.
To abstract the data processing client must implement
<a href="@TOP@org/netbeans/api/extexecution/input/InputProcessor.html">InputProcessor</a> or
<a href="@TOP@org/netbeans/api/extexecution/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/input/InputReaders.html">InputReaders</a></li>
<li><a href="@TOP@org/netbeans/api/extexecution/input/InputProcessors.html">InputProcessors</a></li>
<li><a href="@TOP@org/netbeans/api/extexecution/input/LineProcessors.html">LineProcessors</a></li>
</ul>
<p>
To configure additional functionality specific to <code>org.openide.windows.OutputWriter</code>
see the next usecase.
</p>
<p>
Once the data source and processing objects are prepared client creates
<a href="@TOP@org/netbeans/api/extexecution/input/InputReaderTask.html">InputReaderTask</a>.
Factory methods of the <a href="@TOP@org/netbeans/api/extexecution/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="print-input" name="Printing the input">
<p>
Client intends to process input lines and print them to <code>org.openide.windows.OutputWriter</code>.
In addition printed lines should be transformed (converted) somehow
and enriched by line listeners.
</p>
<p>
The both default printing processors provide factory method accepting
<a href="@TOP@org/netbeans/api/extexecution/print/LineConvertor.html">LineConvertor</a>.
Namely
<a href="@TOP@org/netbeans/api/extexecution/print/InputProcessors.html#printing(org.openide.windows.OutputWriter,org.netbeans.api.extexecution.print.LineConvertor,boolean)">
InputProcessors.printing(org.openide.windows.OutputWriter out, LineConvertor convertor, boolean resetEnabled)</a>
and
<a href="@TOP@org/netbeans/api/extexecution/print/LineProcessors.html#printing(org.openide.windows.OutputWriter,org.netbeans.api.extexecution.print.LineConvertor,boolean)">
LineProcessors.printing(org.openide.windows.OutputWriter out, LineConvertor convertor, boolean resetEnabled)</a>.
Convertor is then used to convert received lines to printed ones.
Common convertors (file, http) are provided in factory class
<a href="@TOP@org/netbeans/api/extexecution/print/LineConvertors.html">LineConvertors</a>.
</p>
</usecase>
<usecase id="process-builder" name="Custom process builder">
<p>
<span style="text-decoration:line-through;">Third party wants to implement custom process builder to provide
additional functionality, such as remote execution.</span>
This usecase should be solved by External Execution Base API.
</p>
<p>
In order to do so it will implement
<a href="@TOP@org/netbeans/spi/extexecution/ProcessBuilderImplementation.html">
ProcessBuilderImplementation</a> and pass
<a href="@TOP@org/netbeans/api/extexecution/ProcessBuilder.html">
ProcessBuilder</a> to its clients. The API instances are created with
help of
<a href="@TOP@org/netbeans/spi/extexecution/ProcessBuilderFactory.html">ProcessBuilderFactory</a>.
</p>
</usecase>
<usecase id="destroy-process" name="Destroying a process">
<p>
<span style="text-decoration:line-through;">Client wants to destroy the process, trying to kill whole process tree.</span>
This usecase should be solved by External Execution Base API.
Method
<a href="@TOP@org/netbeans/api/extexecution/ExternalProcessSupport.html#destroy(java.lang.Process,java.util.Map)">
ExternalProcessSupport.destroy(java.lang.Process process, Map<String,String> env)</a>
is designed for that. It will use a
<a href="@TOP@org/netbeans/spi/extexecution/destroy/ProcessDestroyPerformer.html">ProcessDestroyPerformer</a>
registered in default lookup to do so.
</p>
</usecase>
<usecase id="startup-extender" name="Extending startup environment">
<p>
The third party plugin may want to be able provide additional arguments
for the process startup in a standardized way. In order to do so it will
register a implementation of
<a href="@TOP@org/netbeans/spi/extexecution/startup/StartupExtenderImplementation.html">StartupExtenderImplementation</a>
to the layer folder StartupExtender. The annotation
<a href="@TOP@org/netbeans/spi/extexecution/startup/StartupExtenderImplementation.Registration.html">StartupExtenderImplementation.Registration</a>
can be used for that.
</p>
<p>
The clients (for exmaple project or server) may query the extenders via the
API class
<a href="@TOP@org/netbeans/api/extexecution/startup/StartupExtender.html">StartupExtender</a>
and use the additional arguments for the process.
</p>
</usecase>
<usecase id="pluggable-open" name="Making certain open actions pluggable">
<p>
Some default
<a href="@TOP@org/netbeans/api/extexecution/print/LineConvertor.html">LineConvertor</a>s
returned by
<a href="@TOP@org/netbeans/api/extexecution/print/LineConvertors.html">LineConvertor</a>
needs to open file or URL. A bit special case is also options dialog opening
required by
<a href="@TOP@org/netbeans/api/extexecution/ExecutionService.html">ExecutionService</a>
to open options dialog specified by
<a href="@TOP@org/netbeans/api/extexecution/ExecutionDescriptor.html">ExecutionDescriptor</a>.
To cover this three usecases in a pluggable way while keeping dependencies
minimal there are three corresponding SPI classes one may implement.
So there is
<a href="@TOP@org/netbeans/spi/extexecution/open/FileOpenHandler.html">FileOpenHandler</a>
to handle file opening,
<a href="@TOP@org/netbeans/spi/extexecution/open/HttpOpenHandler.html">HttpOpenHandler</a>
to deal with HTTP URLs and
<a href="@TOP@org/netbeans/spi/extexecution/open/OptionOpenHandler.html">OptionOpenHandler</a>
to open proper options dialog.
</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 in the IDE to handle its
streams and present the output to the user. 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="lookup-lookup"when="init"> Doesyourmoduleuse<code>org.openide.util.Lookup</code> oranysimilartechnologytofindanycomponentstocommunicatewith?Whichones? <hint> NetBeansisbuildaroundagenericregistryofservicescalled lookup.Itispreferabletouseitforregistrationanddiscovery ifpossible.See <ahref="http://www.netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/lookup/doc-files/index.html"> TheSolutiontoComunicationBetweenComponents </a>.Ifyoudonotplantouselookupandinsistusage ofothersolution,thenpleasedescribewhyitisnotworkingfor you. <br/> Whenfillingthefinalversionofyourarchdocument,please describetheinterfacesyouaresearchingfor,where aredefined,whetheryouaresearchingforjustoneormoreofthem, iftheorderisimportant,etc.Alsoclassifythestabilityofsuch APIcontract.Use<apigroup=&lookup&/>tag,so yourinformationgetslistedinthesummarypageofyourjavadoc. </hint> </question>
-->
<answer id="lookup-lookup">
<p>
<a href="@TOP@org/netbeans/api/extexecution/ExternalProcessSupport.html">ExternalProcessSupport</a>
and processes created by
<a href="@TOP@org/netbeans/api/extexecution/ExternalProcessBuilder.html">ExternalProcessBuilder</a>
are trying to lookup
<a href="@TOP@org/netbeans/spi/extexecution/destroy/ProcessDestroyPerformer.html">ProcessDestroyPerformer</a>
as a tool for killing the whole process tree.
</p>
<p>
Implementations of <a href="@TOP@org/netbeans/spi/extexecution/open/FileOpenHandler.html">FileOpenHandler</a>
and <a href="@TOP@org/netbeans/spi/extexecution/open/HttpOpenHandler.html">HttpOpenHandler</a>
are looked up to provide support for file and url opening by default line
convertors created by <a href="@TOP@org/netbeans/api/extexecution/print/LineConvertors.html">LineConvertors</a>.
</p>
<p>
Implementation of <a href="@TOP@org/netbeans/spi/extexecution/open/OptionOpenHandler.html">OptionOpenHandler</a>
is looked up to provide support for options opening from output window
when configured by <a href="@TOP@org/netbeans/api/extexecution/ExecutionDescriptor.html">ExecutionDescriptor</a>.
</p>
<p>
The <a href="@TOP@org/netbeans/spi/extexecution/startup/StartupExtenderImplementation.html">StartupExtenderImplementation</a>s
at path <code>StartupExtender</code> are looked up when the API
<a href="@TOP@org/netbeans/api/extexecution/startup/StartupExtender.html">StartupExtender</a>
needs to know all such extenders.
</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 IDE 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.