1
<?xml version="1.0" encoding="UTF-8"?><!-- -*- sgml-indent-step: 1 -*- -->
3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5
Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
8
The contents of this file are subject to the terms of either the GNU
9
General Public License Version 2 only ("GPL") or the Common
10
Development and Distribution License("CDDL") (collectively, the
11
"License"). You may not use this file except in compliance with the
12
License. You can obtain a copy of the License at
13
http://www.netbeans.org/cddl-gplv2.html
14
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15
specific language governing permissions and limitations under the
16
License. When distributing the software, include this License Header
17
Notice in each file and include the License file at
18
nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
19
particular file as subject to the "Classpath" exception as provided
20
by Sun in the GPL Version 2 section of the License file that
21
accompanied this code. If applicable, add the following below the
22
License Header, with the fields enclosed by brackets [] replaced by
23
your own identifying information:
24
"Portions Copyrighted [year] [name of copyright owner]"
28
The Original Software is NetBeans. The Initial Developer of the Original
29
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
30
Microsystems, Inc. All Rights Reserved.
32
If you wish your version of this file to be governed by only the CDDL
33
or only the GPL Version 2, indicate your decision by adding
34
"[Contributor] elects to include this software in this distribution
35
under the [CDDL or GPL Version 2] license." If you do not indicate a
36
single choice of license, a recipient has the option to distribute
37
your version of this file under either the CDDL, the GPL Version 2 or
38
to extend the choice of license to its licensees as provided above.
39
However, if you add GPL Version 2 code and therefore, elected the GPL
40
Version 2 license, then the option applies only if the new code is
41
made subject to such option by the copyright holder.
43
<!DOCTYPE api-answers PUBLIC "-//NetBeans//DTD Arch Answers//EN" "../../../nbbuild/antsrc/org/netbeans/nbbuild/Arch.dtd" [
44
<!ENTITY api-questions SYSTEM "../../../nbbuild/antsrc/org/netbeans/nbbuild/Arch-api-questions.xml">
48
question-version="1.25"
49
author="jlahoda@netbeans.org"
56
<question id="arch-what" when="init">
57
What is this project good for?
59
Please provide here a few lines describing the project,
60
what problem it should solve, provide links to documentation,
65
<answer id="arch-what">
66
<p>The Error Stripe shows an overview of important information of an edited source code.
67
It shows this information for the whole source code (regardless of its size).
74
<question id="arch-overall" when="init">
75
Describe the overall architecture.
78
<a href="http://openide.netbeans.org/tutorial/api-design.html#design.apiandspi">
79
clients and what support API</a>?
80
What parts will be pluggable?
81
How will plug-ins be registered? Please use <code><api type="export"/></code>
82
to describe your general APIs.
83
If possible please provide
88
<answer id="arch-overall">
90
The Error Stripe gathers the information to show from three sources:
92
<li>(A subset of) editor annotations. See
93
<api type="export" category="stable" name="TextAPI" group="java" url="@org-openide-text@/overview-summary.html">OpenIDE Text API</api>
96
<li>Up-to-date status providers. This is the
97
<api type="export" category="stable" group="java" name="ErrorStripeSPI" url="@TOP@index.html">public SPI provided by the Error Stripe.</api>
98
The Up-to-date status provides affects the "global" status view in the Error Stripe.
100
<li><api type="export" category="private" group="java" name="ErrorStripePrivateSPI">Private mark provider SPI.</api>
109
<question id="arch-quality" when="init">
110
How will the <a href="http://www.netbeans.org/community/guidelines/q-evangelism.html">quality</a>
111
of your code be tested and
112
how are future regressions going to be prevented?
114
What kind of testing do
115
you want to use? How much functionality, in which areas,
116
should be covered by the tests?
120
<answer id="arch-quality">
121
<p>The non-visual parts of the Error Stripe will be covered by the automatic unit tests. The visual parts
122
of the Error Stripe are going to be covered by a manual test specification.</p>
128
<question id="arch-time" when="init">
129
What are the time estimates of the work?
131
Please express your estimates of how long the design, implementation,
132
stabilization are likely to last. How many people will be needed to
133
implement this and what is the expected milestone by which the work should be
138
<answer id="arch-time">
139
<!-- <p>The module and its providers are basically written. Apart from time for the API review,
140
time will be necessary for global clean-up (2-3 working man-days), polishing of the look and feel
141
(7 working man-days), and stabilization (7 working man-days).</p>
142
<p>There is no expected milestone.</p>-->
143
<p>Pre-API review work is mostly done. After integration, only maintanance work is awaited,
144
for 20% of one developer's time.</p>
150
<question id="arch-usecases" when="init">
152
Content of this answer will be displayed as part of page at
153
http://www.netbeans.org/download/dev/javadoc/usecases.html
154
You can use tags <usecase name="name> regular html description </usecase>
155
and if you want to use an URL you can prefix if with @TOP@ to begin
156
at the root of your javadoc
159
Describe the main <a href="http://openide.netbeans.org/tutorial/api-design.html#usecase">
160
use cases</a> of the new API. Who will use it under
161
what circumstances? What kind of code would typically need to be written
165
<answer id="arch-usecases">
167
<usecase id="annotations-provider" name="Augment Annotations to be shown in the Error Stripe">
168
Use the <api type="export" category="stable" name="TextAPI" group="java" url="@org-openide-text@/overview-summary.html">OpenIDE Text API</api>.
171
<usecase id="up-to-date-provider" name="Provide Up-to-date Status for the Error Stripe">
173
<p>A module in the IDE has information whether data shown in the Error Stripe
174
is up-to-date or not. The Error Stripe may change the appearance according to this knowledge.
177
<p>Implement the <a href="@TOP@org/netbeans/spi/editor/errorstripe/UpToDateStatusProvider.html">UpToDateStatusProvider</a>
178
that provides up-to-date status. Be sure that it fires PropertyChangeEvent when this status is changed.</p>
180
<p>Implement the <a href="@TOP@org/netbeans/spi/editor/errorstripe/UpToDateStatusProviderFactory.html">UpToDateStatusProviderFactory</a>
181
that creates an instance of your UpToDateStatusProvider for a given JTextComponent and install it as described
182
<a href="@TOP@org/netbeans/spi/editor/errorstripe/UpToDateStatusProviderFactory.html">here</a>.</p>
186
<!-- <usecase id="registration" name="MIME Type Based Registration">
188
<p>An UpToDateStatusMarkProvider may provide information that can be applied to any editor type, or it may
189
provide infromation that applies only to a very specific type of editor.
199
<question id="compat-i18n" when="impl">
200
Is your module correctly internationalized?
202
Correct internationalization means that it obeys instructions
203
at <a href="http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/i18n-branding.html">
204
NetBeans I18N pages</a>.
208
<answer id="compat-i18n">
210
This module should be correctly internationalized.
217
<question id="compat-standards" when="init">
218
Does the module implement or define any standards? Is the
219
implementation exact or does it deviate somehow?
222
<answer id="compat-standards">
224
This module does neither define nor implement any standard.
231
<question id="compat-version" when="impl">
232
Can your module coexist with earlier and future
233
versions of itself? Can you correctly read all old settings? Will future
234
versions be able to read your current settings? Can you read
235
or politely ignore settings stored by a future version?
238
Very helpful for reading settings is to store version number
239
there, so future versions can decide whether how to read/convert
240
the settings and older versions can ignore the new ones.
244
<answer id="compat-version">
246
The module does not have any settings. The module was distributed through
247
the autoupdate and manual uninstallation may be necessary for upgrade.
254
<question id="dep-jre" when="final">
255
Which version of JRE do you need (1.2, 1.3, 1.4, etc.)?
257
It is expected that if your module runs on 1.x that it will run
258
on 1.x+1 if no, state that please. Also describe here cases where
259
you run different code on different versions of JRE and why.
263
<answer id="dep-jre">
272
<question id="dep-jrejdk" when="final">
273
Do you require the JDK or is the JRE enough?
276
<answer id="dep-jrejdk">
285
<question id="dep-nb" when="init">
286
What other NetBeans projects and modules does this one depend on?
288
If you want, describe such projects as imported APIs using
289
the <code><api name="identification" type="import or export" category="stable" url="where is the description" /></code>
295
The Error Stripe module depends on the
296
<api name="Editor" type="import" category="friend" url="@org-netbeans-modules-editor@" group="java">
297
editor API</api>. It uses this dependency to add the overview component to the editor window,
298
to use various editor utilities and to gather the information about the Annotations.
305
<question id="dep-non-nb" when="init">
306
What other projects outside NetBeans does this one depend on?
309
Some non-NetBeans projects are packaged as NetBeans modules
310
(see <a href="http://libs.netbeans.org/">libraries</a>) and
311
it is preferred to use this approach when more modules may
312
depend on such third-party library.
316
<answer id="dep-non-nb">
318
This module does not depend on any non-NetBeans projects (except the JRE).
325
<question id="dep-platform" when="init">
326
On which platforms does your module run? Does it run in the same
329
If your module is using JNI or deals with special differences of
330
OSes like filesystems, etc. please describe here what they are.
334
<answer id="dep-platform">
336
This module runs on any platform that provides the required JRE.
342
<answer id="deploy-dependencies">
349
<question id="deploy-jar" when="impl">
350
Do you deploy just module JAR file(s) or other files as well?
352
Usually a module consist of one JAR file (perhaps with Class-Path
353
extensions) and also a configuration file that enables it. If you
354
have any other files, use
355
<api group="java.io.File" name="yourname" type="export" category="friend">...</api>
356
to define the location, name and stability of your files (of course
357
changing "yourname" and "friend" to suit your needs).
359
If it uses more than one JAR, describe where they are located, how
360
they refer to each other.
361
If it consist of module JAR(s) and other files, please describe
362
what is their purpose, why other files are necessary. Please
363
make sure that installation/uninstallation leaves the system
364
in state as it was before installation.
368
<answer id="deploy-jar">
369
<p>The Error Stripe requires only standard NetBeans module files.</p>
375
<question id="deploy-nbm" when="impl">
376
Can you deploy an NBM via the Update Center?
382
<answer id="deploy-nbm">
384
The NBM can be deployed via the Update Center.
391
<question id="deploy-packages" when="init">
392
Are packages of your module made inaccessible by not declaring them
396
NetBeans module system allows restriction of access rights to
397
public classes of your module from other modules. This prevents
398
unwanted dependencies of others on your code and should be used
399
whenever possible (<a href="http://www.netbeans.org/download/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.4-public-packages">
401
</a>). If you do not restrict access to your classes you are
402
making it too easy for other people to misuse your implementation
403
details, that is why you should have good reason for not
404
restricting package access.
408
<answer id="deploy-packages">
410
The Error Stripe module provides a public package <code>org.netbeans.spi.editor.errorstripe</code>
412
<api type="export" category="stable" group="java" name="ErrorStripeSPI" url="@TOP@index.html">Error Stripe SPI</api>.
419
<question id="deploy-shared" when="final">
420
Do you need to be installed in the shared location only, or in the user directory only,
421
or can your module be installed anywhere?
423
Installation location shall not matter, if it does explain why.
424
Consider also whether <code>InstalledFileLocator</code> can help.
428
<answer id="deploy-shared">
430
This module does not depend on installation directory.
437
<question id="exec-ant-tasks" when="impl">
438
Do you define or register any ant tasks that other can use?
441
If you provide an ant task that users can use, you need to be very
442
careful about its syntax and behaviour, as it most likely forms an
443
API for end users and as there is a lot of end users, their reaction
444
when such API gets broken can be pretty strong.
448
<answer id="exec-ant-tasks">
450
This module does not define any ant tasks.
457
<question id="exec-classloader" when="impl">
458
Does your code create its own class loader(s)?
460
A bit unusual. Please explain why and what for.
464
<answer id="exec-classloader">
473
<question id="exec-component" when="impl">
474
Is execution of your code influenced by any (string) property
475
of any of your components?
478
Often <code>JComponent.getClientProperty</code>, <code>Action.getValue</code>
479
or <code>PropertyDescriptor.getValue</code>, etc. are used to influence
480
a behavior of some code. This of course forms an interface that should
481
be documented. Also if one depends on some interface that an object
482
implements (<code>component instanceof Runnable</code>) that forms an
487
<answer id="exec-component">
496
<question id="exec-introspection" when="impl">
497
Does your module use any kind of runtime type information (<code>instanceof</code>,
498
work with <code>java.lang.Class</code>, etc.)?
500
Check for cases when you have an object of type A and you also
501
expect it to (possibly) be of type B and do some special action. That
502
should be documented. The same applies on operations in meta-level
503
(Class.isInstance(...), Class.isAssignableFrom(...), etc.).
507
<answer id="exec-introspection">
509
<code>instanceof</code> is used to detect <code>BaseDocument</code> in the <code>JTextPane</code>.
516
<question id="exec-privateaccess" when="final">
517
Are you aware of any other parts of the system calling some of
518
your methods by reflection?
520
If so, describe the "contract" as an API. Likely private or friend one, but
521
still API and consider rewrite of it.
525
<answer id="exec-privateaccess">
534
<question id="exec-process" when="impl">
535
Do you execute an external process from your module? How do you ensure
536
that the result is the same on different platforms? Do you parse output?
537
Do you depend on result code?
539
If you feed an input, parse the output please declare that as an API.
543
<answer id="exec-process">
552
<question id="exec-property" when="impl">
553
Is execution of your code influenced by any environment or
554
Java system (<code>System.getProperty</code>) property?
557
If there is a property that can change the behavior of your
558
code, somebody will likely use it. You should describe what it does
559
and the <a href="http://openide.netbeans.org/tutorial/api-design.html#life">stability category</a>
560
of this API. You may use
562
<api type="export" group="property" name="id" category="private" url="http://...">
563
description of the property, where it is used, what it influence, etc.
569
<answer id="exec-property">
571
<api type="export" group="property" name="org.netbeans.modules.editor.errorstripe.AnnotationView" category="private" >
572
This property sets the logging level. See org.openide.ErrorManager.getInstance for more details.
580
<question id="exec-reflection" when="impl">
581
Does your code use Java Reflection to execute other code?
583
This usually indicates a missing or insufficient API in the other
584
part of the system. If the other side is not aware of your dependency
585
this contract can be easily broken.
589
<answer id="exec-reflection">
598
<question id="exec-threading" when="impl">
599
What threading models, if any, does your module adhere to?
601
If your module calls foreign APIs which have a specific threading model,
602
indicate how you comply with the requirements for multithreaded access
603
(synchronization, mutexes, etc.) applicable to those APIs.
604
If your module defines any APIs, or has complex internal structures
605
that might be used from multiple threads, declare how you protect
606
data against concurrent access, race conditions, deadlocks, etc.,
607
and whether such rules are enforced by runtime warnings, errors, assertions, etc.
608
Examples: a class might be non-thread-safe (like Java Collections); might
609
be fully thread-safe (internal locking); might require access through a mutex
610
(and may or may not automatically acquire that mutex on behalf of a client method);
611
might be able to run only in the event queue; etc.
612
Also describe when any events are fired: synchronously, asynchronously, etc.
613
Ideas: <a href="http://core.netbeans.org/proposals/threading/index.html#recommendations">Threading Recommendations</a> (in progress)
617
<answer id="exec-threading">
619
The Error Stripe conforms to Swing threading for interaction with Swing. It accepts changes
620
of annotations from any thread.
627
<question id="format-clipboard" when="impl">
628
Which data flavors (if any) does your code read from or insert to
629
the clipboard (by access to clipboard on means calling methods on <code>java.awt.datatransfer.Transferable</code>?
632
Often Node's deal with clipboard by usage of <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
633
Check your code for overriding these methods.
637
<answer id="format-clipboard">
639
This module does not work with clipboard.
646
<question id="format-dnd" when="impl">
647
Which protocols (if any) does your code understand during Drag & Drop?
649
Often Node's deal with clipboard by usage of <code>Node.drag, Node.getDropType</code>.
650
Check your code for overriding these methods. Btw. if they are not overridden, they
651
by default delegate to <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
655
<answer id="format-dnd">
657
The error stripe does not use Drag & Drop.
664
<question id="format-types" when="impl">
665
Which protocols and file formats (if any) does your module read or write on disk,
666
or transmit or receive over the network? Do you generate an ant build script?
667
Can it be edited and modified?
671
Files can be read and written by other programs, modules and users. If they influence
672
your behaviour, make sure you either document the format or claim that it is a private
673
api (using the <api> tag).
677
If you generate an ant build file, this is very likely going to be seen by end users and
678
they will be attempted to edit it. You should be ready for that and provide here a link
679
to documentation that you have for such purposes and also describe how you are going to
680
understand such files during next release, when you (very likely) slightly change the
686
<answer id="format-types">
688
No files are read or written.
695
<question id="lookup-lookup" when="init">
696
Does your module use <code>org.openide.util.Lookup</code>
697
or any similar technology to find any components to communicate with? Which ones?
700
Please describe the interfaces you are searching for, where
701
are defined, whether you are searching for just one or more of them,
702
if the order is important, etc. Also classify the stability of such
703
API contract. For that use <api group=&lookup& /> tag.
707
<answer id="lookup-lookup">
708
<p>The module does not use the global lookup. The module uses the lookup internally
709
to access UpToDateStatusProviderFactories.</p>
715
<question id="lookup-register" when="final">
716
Do you register anything into lookup for other code to find?
718
Do you register using layer file or using <code>META-INF/services</code>?
719
Who is supposed to find your component?
723
<answer id="lookup-register">
725
Internally, the <code>FolderLookup</code> is used to register providers of the
726
<api type="export" category="private" group="java" name="ErrorStripePrivateSPI">private mark provider SPI.</api>
733
<question id="lookup-remove" when="final">
734
Do you remove entries of other modules from lookup?
736
Why? Of course, that is possible, but it can be dangerous. Is the module
737
your are masking resource from aware of what you are doing?
741
<answer id="lookup-remove">
743
This module does not mask any Lookup entries.
750
<question id="perf-exit" when="final">
751
Does your module run any code on exit?
754
<answer id="perf-exit">
763
<question id="perf-huge_dialogs" when="final">
764
Does your module contain any dialogs or wizards with a large number of
765
GUI controls such as combo boxes, lists, trees, or text areas?
768
<answer id="perf-huge_dialogs">
777
<question id="perf-limit" when="init">
778
Are there any hard-coded or practical limits in the number or size of
779
elements your code can handle?
782
<answer id="perf-limit">
784
There are not hardcoded limits. But, the number of Marks shown in the Error Stripe should be held as low
785
as possible (while still being usefull), because the user would get confused by too many shown Marks.
786
Also the performance of the redrawing of the Error Stripe degrades rapidly when there are many marks (~1000).
793
<question id="perf-mem" when="final">
794
How much memory does your component consume? Estimate
795
with a relation to the number of windows, etc.
798
<answer id="perf-mem">
799
<p>There is one component per opened JTextComponent. If no providers are registered
801
<api type="export" category="private" group="java" name="ErrorStripePrivateSPI">private mark provider SPI</api>,
802
the memory consumption of each component should be constant.
809
<question id="perf-menus" when="final">
810
Does your module use dynamically updated context menus, or
811
context-sensitive actions with complicated and slow enablement logic?
813
If you do a lot of tricks when adding actions to regular or context menus, you can significantly
814
slow down display of the menu, even when the user is not using your action. Pay attention to
815
actions you add to the main menu bar, and to context menus of foreign nodes or components. If
816
the action is conditionally enabled, or changes its display dynamically, you need to check the
817
impact on performance. In some cases it may be more appropriate to make a simple action that is
818
always enabled but does more detailed checks in a dialog if it is actually run.
822
<answer id="perf-menus">
824
This module does not use any context menus.
831
<question id="perf-progress" when="final">
832
Does your module execute any long-running tasks?
834
<hint>Long running tasks should never block
835
AWT thread as it badly hurts the UI
836
<a href="http://performance.netbeans.org/responsiveness/issues.html">
838
Tasks like connecting over
839
network, computing huge amount of data, compilation
840
be done asynchronously (for example
841
using <code>RequestProcessor</code>), definitively it should
842
not block AWT thread.
846
<answer id="perf-progress">
855
<question id="perf-scale" when="init">
856
Which external criteria influence the performance of your
857
program (size of file in editor, number of files in menu,
858
in source directory, etc.) and how well your code scales?
860
Please include some estimates, there are other more detailed
861
questions to answer in later phases of implementation.
865
<answer id="perf-scale">
867
The performance of the Error Stripe module should depend mostly only on the number of showed
868
annotations/marks. There is also an implied dependency on the number of lines in the document through
869
variable utility methods.
876
<question id="perf-spi" when="init">
877
How the performance of the plugged in code will be enforced?
879
If you allow foreign code to be plugged into your own module, how
880
do you enforce that it will behave correctly and quickly and will not
881
negatively influence the performance of your own module?
885
<answer id="perf-spi">
886
<p>Currently, there is no way to enforce the performance of the plugged in code.</p>
892
<question id="perf-startup" when="final">
893
Does your module run any code on startup?
896
<answer id="perf-startup">
905
<question id="perf-wakeup" when="final">
906
Does any piece of your code wake up periodically and do something
907
even when the system is otherwise idle (no user interaction)?
910
<answer id="perf-wakeup">
919
<question id="resources-file" when="final">
920
Does your module use <code>java.io.File</code> directly?
923
NetBeans provide a logical wrapper over plain files called
924
<code>org.openide.filesystems.FileObject</code> that
925
provides uniform access to such resources and is the preferred
926
way that should be used. But of course there can be situations when
927
this is not suitable.
931
<answer id="resources-file">
940
<question id="resources-layer" when="final">
941
Does your module provide own layer? Does it create any files or
942
folders in it? What it is trying to communicate by that and with which
946
NetBeans allows automatic and declarative installation of resources
947
by module layers. Module register files into appropriate places
948
and other components use that information to perform their task
949
(build menu, toolbar, window layout, list of templates, set of
954
<answer id="resources-layer">
956
The module uses layers for two purposes:
958
<li>To register the sidebar component throught the
959
<api name="Editor" type="import" category="friend" group="java">Editor API</api>.
961
<li>To register providers of the <api type="export" category="private" group="java" name="ErrorStripePrivateSPI">private mark provider SPI.</api>
970
<question id="resources-mask" when="final">
971
Does your module mask/hide/override any resources provided by other modules in
975
If you mask a file provided by another module, you probably depend
976
on that and do not want the other module to (for example) change
977
the file's name. That module shall thus make that file available as an API
978
of some stability category.
982
<answer id="resources-mask">
991
<question id="resources-read" when="final">
992
Does your module read any resources from layers? For what purpose?
995
As this is some kind of intermodule dependency, it is a kind of API.
996
Please describe it and classify according to
997
<a href="http://openide.netbeans.org/tutorial/api-design.html#categories">
998
common stability categories</a>.
1002
<answer id="resources-read">
1004
The Error Stripe reads providers of the <api type="export" category="private" group="java" name="ErrorStripePrivateSPI">private mark provider SPI</api>
1012
<question id="security-grant" when="final">
1013
Does your code grant additional rights to some other code?
1014
<hint>Avoid using a class loader that adds extra
1015
permissions to loaded code unless really necessary.
1016
Also note that your API implementation
1017
can also expose unneeded permissions to enemy code by
1018
calling AccessController.doPrivileged().</hint>
1021
<answer id="security-grant">
1030
<question id="security-policy" when="final">
1031
Does your functionality require modifications to the standard policy file?
1032
<hint>Your code might pass control to third-party code not
1033
coming from trusted domains. This could be code downloaded over the
1034
network or code coming from libraries that are not bundled
1035
with NetBeans. Which permissions need to be granted to which domains?</hint>
1038
<answer id="security-policy">
1040
The module uses <code>org.netbeans.modules.editor.errorstripe</code> and
1041
<code>org.netbeans.spi.editor.errorstripe</code> and does not need any special priviledges.