Added
Link Here
|
1 |
<?xml version="1.0" encoding="UTF-8"?><!-- -*- sgml-indent-step: 1 -*- --> |
2 |
<!-- |
3 |
The contents of this file are subject to the terms of the Common Development |
4 |
and Distribution License (the License). You may not use this file except in |
5 |
compliance with the License. |
6 |
|
7 |
You can obtain a copy of the License at http://www.netbeans.org/cddl.html |
8 |
or http://www.netbeans.org/cddl.txt. |
9 |
|
10 |
When distributing Covered Code, include this CDDL Header Notice in each file |
11 |
and include the License file at http://www.netbeans.org/cddl.txt. |
12 |
If applicable, add the following below the CDDL Header, with the fields |
13 |
enclosed by brackets [] replaced by your own identifying information: |
14 |
"Portions Copyrighted [year] [name of copyright owner]" |
15 |
|
16 |
The Original Software is NetBeans. The Initial Developer of the Original |
17 |
Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun |
18 |
Microsystems, Inc. All Rights Reserved. |
19 |
--> |
20 |
<!DOCTYPE api-answers PUBLIC "-//NetBeans//DTD Arch Answers//EN" "../../nbbuild/antsrc/org/netbeans/nbbuild/Arch.dtd" [ |
21 |
<!ENTITY api-questions SYSTEM "../../nbbuild/antsrc/org/netbeans/nbbuild/Arch-api-questions.xml"> |
22 |
]> |
23 |
|
24 |
<api-answers |
25 |
question-version="1.29" |
26 |
author="yourname@netbeans.org" |
27 |
> |
28 |
|
29 |
&api-questions; |
30 |
|
31 |
|
32 |
<!-- |
33 |
<question id="arch-overall" when="init"> |
34 |
Describe the overall architecture. |
35 |
<hint> |
36 |
What will be API for |
37 |
<a href="http://openide.netbeans.org/tutorial/api-design.html#design.apiandspi"> |
38 |
clients and what support API</a>? |
39 |
What parts will be pluggable? |
40 |
How will plug-ins be registered? Please use <code><api type="export"/></code> |
41 |
to describe your general APIs and specify their |
42 |
<a href="http://openide.netbeans.org/tutorial/api-design.html#category-private"> |
43 |
stability categories</a>. |
44 |
If possible please provide simple diagrams. |
45 |
</hint> |
46 |
</question> |
47 |
--> |
48 |
<answer id="arch-overall"> |
49 |
<p> |
50 |
Editor Indentation module defines |
51 |
<api name="EditorIndentationAPI" group="java" type="export" category="official"/> |
52 |
providing indentation and reformatting services to the clients. |
53 |
<br/> |
54 |
It also contains SPI allowing the modules to register language-specific |
55 |
indenters and formatters into |
56 |
<a href="@org-netbeans-modules-editor-mimelookup@/org/netbeans/api/editor/mimelookup/MimeLookup.html">MimeLookup</a> |
57 |
through XML layers. |
58 |
</p> |
59 |
</answer> |
60 |
|
61 |
|
62 |
|
63 |
<!-- |
64 |
<question id="arch-quality" when="init"> |
65 |
How will the <a href="http://www.netbeans.org/community/guidelines/q-evangelism.html">quality</a> |
66 |
of your code be tested and |
67 |
how are future regressions going to be prevented? |
68 |
<hint> |
69 |
What kind of testing do |
70 |
you want to use? How much functionality, in which areas, |
71 |
should be covered by the tests? How you find out that your |
72 |
project was successful? |
73 |
</hint> |
74 |
</question> |
75 |
--> |
76 |
<answer id="arch-quality"> |
77 |
<p> |
78 |
Unit tests are provided for checking correctness of infrastructure and delegation |
79 |
from the legacy editor actions to the new API. |
80 |
</p> |
81 |
</answer> |
82 |
|
83 |
|
84 |
|
85 |
<!-- |
86 |
<question id="arch-time" when="init"> |
87 |
What are the time estimates of the work? |
88 |
<hint> |
89 |
Please express your estimates of how long the design, implementation, |
90 |
stabilization are likely to last. How many people will be needed to |
91 |
implement this and what is the expected milestone by which the work should be |
92 |
ready? |
93 |
</hint> |
94 |
</question> |
95 |
--> |
96 |
<answer id="arch-time"> |
97 |
<p> |
98 |
Available for NetBeans 6.0. |
99 |
</p> |
100 |
</answer> |
101 |
|
102 |
|
103 |
|
104 |
<!-- |
105 |
<question id="arch-usecases" when="init"> |
106 |
<hint> |
107 |
Content of this answer will be displayed as part of page at |
108 |
http://www.netbeans.org/download/dev/javadoc/usecases.html |
109 |
You can use tags <usecase name="name> regular html description </usecase> |
110 |
and if you want to use an URL you can prefix if with @TOP@ to begin |
111 |
at the root of your javadoc |
112 |
</hint> |
113 |
|
114 |
Describe the main <a href="http://openide.netbeans.org/tutorial/api-design.html#usecase"> |
115 |
use cases</a> of the new API. Who will use it under |
116 |
what circumstances? What kind of code would typically need to be written |
117 |
to use the module? |
118 |
</question> |
119 |
--> |
120 |
<answer id="arch-usecases"> |
121 |
<h1> |
122 |
API Usecases |
123 |
</h1> |
124 |
|
125 |
<h3> |
126 |
Fix indentation of a single or multiple lines of a document. |
127 |
</h3> |
128 |
<p> |
129 |
Altghough there are formatting actions already there may be clients |
130 |
wishing to explicitly fix indentation of e.g. a newly inserted code into a Swing document. |
131 |
</p> |
132 |
<p> |
133 |
The same code is used after inserting a newline into a document. |
134 |
</p> |
135 |
The |
136 |
<a href="@org-netbeans-modules-editor-indent@/org/netbeans/api/editor/indent/Indent.html">Indent</a> |
137 |
is an entry point for performing reindentation. The following code should be used by clients: |
138 |
<pre> |
139 |
Indent indent = Indent.get(doc); |
140 |
indent.lock(); |
141 |
try { |
142 |
doc.atomicLock(); |
143 |
try { |
144 |
indent.reindent(startOffset, endOffset); |
145 |
} finally { |
146 |
doc.atomicUnlock(); |
147 |
} |
148 |
} finally { |
149 |
indent.unlock(); |
150 |
} |
151 |
</pre> |
152 |
|
153 |
<h3> |
154 |
Code beautification of a selected area of a document. |
155 |
</h3> |
156 |
<p> |
157 |
Code beautification should not only fix line indentation but it may also perform |
158 |
extra changes to code according to formatting rules. For example add newlines |
159 |
or additional whitespace or add/remove extra braces etc. |
160 |
</p> |
161 |
The |
162 |
<a href="@org-netbeans-modules-editor-indent@/org/netbeans/api/editor/indent/Reformat.html">Reformat</a> |
163 |
class should be used: |
164 |
<pre> |
165 |
Reformat reformat = Reformat.get(doc); |
166 |
reformat.lock(); |
167 |
try { |
168 |
doc.atomicLock(); |
169 |
try { |
170 |
reformat.reformat(startOffset, endOffset); |
171 |
} finally { |
172 |
doc.atomicUnlock(); |
173 |
} |
174 |
} finally { |
175 |
reformat.unlock(); |
176 |
} |
177 |
</pre> |
178 |
</answer> |
179 |
|
180 |
|
181 |
|
182 |
<!-- |
183 |
<question id="arch-what" when="init"> |
184 |
What is this project good for? |
185 |
<hint> |
186 |
Please provide here a few lines describing the project, |
187 |
what problem it should solve, provide links to documentation, |
188 |
specifications, etc. |
189 |
</hint> |
190 |
</question> |
191 |
--> |
192 |
<answer id="arch-what"> |
193 |
<p> |
194 |
Editor indentation performs reindentation and code beautification of Swing document. |
195 |
</p> |
196 |
</answer> |
197 |
|
198 |
|
199 |
|
200 |
<!-- |
201 |
<question id="arch-where" when="impl"> |
202 |
Where one can find sources for your module? |
203 |
<hint> |
204 |
Please provide link to the CVS web client at |
205 |
http://www.netbeans.org/download/source_browse.html |
206 |
or just use tag defaultanswer generate='here' |
207 |
</hint> |
208 |
</question> |
209 |
--> |
210 |
<answer id="arch-where"> |
211 |
<defaultanswer generate='here' /> |
212 |
</answer> |
213 |
|
214 |
|
215 |
|
216 |
<!-- |
217 |
<question id="compat-deprecation" when="init"> |
218 |
How the introduction of your project influences functionality |
219 |
provided by previous version of the product? |
220 |
<hint> |
221 |
If you are planning to deprecate/remove/change any existing APIs, |
222 |
list them here accompanied with the reason explaining why you |
223 |
are doing so. |
224 |
</hint> |
225 |
</question> |
226 |
--> |
227 |
<answer id="compat-deprecation"> |
228 |
<p> |
229 |
The new API should coexist with existing APIs mainly |
230 |
<a href="@org-openide-text@/org/openide/text/IndentEngine.html">IndentEngine</a> |
231 |
<a href="@org-netbeans-modules-editor-lib@/org/netbeans/editor/Formatter.html">Formatter</a> |
232 |
but in the future we would like to deprecate the mentioned APIs. |
233 |
</p> |
234 |
</answer> |
235 |
|
236 |
|
237 |
|
238 |
<!-- |
239 |
<question id="compat-i18n" when="impl"> |
240 |
Is your module correctly internationalized? |
241 |
<hint> |
242 |
Correct internationalization means that it obeys instructions |
243 |
at <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html"> |
244 |
NetBeans I18N pages</a>. |
245 |
</hint> |
246 |
</question> |
247 |
--> |
248 |
<answer id="compat-i18n"> |
249 |
<p> |
250 |
Yes. |
251 |
</p> |
252 |
</answer> |
253 |
|
254 |
|
255 |
|
256 |
<!-- |
257 |
<question id="compat-standards" when="init"> |
258 |
Does the module implement or define any standards? Is the |
259 |
implementation exact or does it deviate somehow? |
260 |
</question> |
261 |
--> |
262 |
<answer id="compat-standards"> |
263 |
<p> |
264 |
No. |
265 |
</p> |
266 |
</answer> |
267 |
|
268 |
|
269 |
|
270 |
<!-- |
271 |
<question id="compat-version" when="impl"> |
272 |
Can your module coexist with earlier and future |
273 |
versions of itself? Can you correctly read all old settings? Will future |
274 |
versions be able to read your current settings? Can you read |
275 |
or politely ignore settings stored by a future version? |
276 |
|
277 |
<hint> |
278 |
Very helpful for reading settings is to store version number |
279 |
there, so future versions can decide whether how to read/convert |
280 |
the settings and older versions can ignore the new ones. |
281 |
</hint> |
282 |
</question> |
283 |
--> |
284 |
<answer id="compat-version"> |
285 |
<p> |
286 |
Yes. |
287 |
</p> |
288 |
</answer> |
289 |
|
290 |
|
291 |
|
292 |
<!-- |
293 |
<question id="dep-jre" when="final"> |
294 |
Which version of JRE do you need (1.2, 1.3, 1.4, etc.)? |
295 |
<hint> |
296 |
It is expected that if your module runs on 1.x that it will run |
297 |
on 1.x+1 if no, state that please. Also describe here cases where |
298 |
you run different code on different versions of JRE and why. |
299 |
</hint> |
300 |
</question> |
301 |
--> |
302 |
<answer id="dep-jre"> |
303 |
<p> |
304 |
JRE 1.5. |
305 |
</p> |
306 |
</answer> |
307 |
|
308 |
|
309 |
|
310 |
<!-- |
311 |
<question id="dep-jrejdk" when="final"> |
312 |
Do you require the JDK or is the JRE enough? |
313 |
</question> |
314 |
--> |
315 |
<answer id="dep-jrejdk"> |
316 |
<p> |
317 |
JRE is enough. |
318 |
</p> |
319 |
</answer> |
320 |
|
321 |
|
322 |
|
323 |
<!-- |
324 |
<question id="dep-nb" when="init"> |
325 |
What other NetBeans projects and modules does this one depend on? |
326 |
<hint> |
327 |
Depending on other NetBeans projects influnces the ability of |
328 |
users of your work to customize their own branded version of |
329 |
NetBeans by enabling and disabling some modules. Too |
330 |
much dependencies restrict this kind of customization. If that |
331 |
is your case, then you may want to split your functionality into |
332 |
pieces of autoload, eager and regular modules which can be |
333 |
enabled independently. Usually the answer to this question |
334 |
is generated from your <code>project.xml</code> file, but |
335 |
if it is not guessed correctly, you can suppress it by |
336 |
specifying <defaultanswer generate="none"/> and |
337 |
write here your own. Please describe such projects as imported APIs using |
338 |
the <code><api name="identification" type="import or export" category="stable" url="where is the description" /></code>. |
339 |
By doing this information gets listed in the summary page of your |
340 |
javadoc. |
341 |
</hint> |
342 |
</question> |
343 |
--> |
344 |
<answer id="dep-nb"> |
345 |
<defaultanswer generate='here' /> |
346 |
</answer> |
347 |
|
348 |
|
349 |
|
350 |
<!-- |
351 |
<question id="dep-non-nb" when="init"> |
352 |
What other projects outside NetBeans does this one depend on? |
353 |
|
354 |
<hint> |
355 |
Depending on 3rd party libraries is always problematic, |
356 |
especially if they are not open source, as that complicates |
357 |
the licensing scheme of NetBeans. Please enumerate your |
358 |
external dependencies here, so it is correctly understood since |
359 |
the begining what are the legal implications of your project. |
360 |
Also please note that |
361 |
some non-NetBeans projects are packaged as NetBeans modules |
362 |
(see <a href="http://libs.netbeans.org/">libraries</a>) and |
363 |
it is preferred to use this approach when more modules may |
364 |
depend and share such third-party libraries. |
365 |
</hint> |
366 |
</question> |
367 |
--> |
368 |
<answer id="dep-non-nb"> |
369 |
<p> |
370 |
None. |
371 |
</p> |
372 |
</answer> |
373 |
|
374 |
|
375 |
|
376 |
<!-- |
377 |
<question id="dep-platform" when="init"> |
378 |
On which platforms does your module run? Does it run in the same |
379 |
way on each? |
380 |
<hint> |
381 |
If you plan any dependency on OS or any usage of native code, |
382 |
please describe why you are doing so and describe how you envision |
383 |
to enforce the portability of your code. |
384 |
Please note that there is a support for <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html#how-os-specific">OS conditionally |
385 |
enabled modules</a> which together with autoload/eager modules |
386 |
can allow you to enable to provide the best OS aware support |
387 |
on certain OSes while providing compatibility bridge on the not |
388 |
supported ones. |
389 |
Also please list the supported |
390 |
OSes/HW platforms and mentioned the lovest version of JDK required |
391 |
for your project to run on. Also state whether JRE is enough or |
392 |
you really need JDK. |
393 |
</hint> |
394 |
</question> |
395 |
--> |
396 |
<answer id="dep-platform"> |
397 |
<p> |
398 |
All platforms. |
399 |
</p> |
400 |
</answer> |
401 |
|
402 |
|
403 |
|
404 |
<!-- |
405 |
<question id="deploy-dependencies" when="final"> |
406 |
What do other modules need to do to declare a dependency on this one, |
407 |
in addition to or instead of the normal module dependency declaration |
408 |
(e.g. tokens to require)? |
409 |
<hint> |
410 |
Provide a sample of the actual lines you would add to a module manifest |
411 |
to declare a dependency, for example OpenIDE-Module-Requires: some.token. |
412 |
If other modules should not depend on this module, or should just use a |
413 |
simple regular module dependency, you can just answer "nothing". If you |
414 |
intentionally expose a semistable API to clients using implementation |
415 |
dependencies, you should mention that here (but there is no need to give |
416 |
an example of usage). |
417 |
</hint> |
418 |
</question> |
419 |
--> |
420 |
<answer id="deploy-dependencies"> |
421 |
<p> |
422 |
Nothing. |
423 |
</p> |
424 |
</answer> |
425 |
|
426 |
|
427 |
|
428 |
<!-- |
429 |
<question id="deploy-jar" when="impl"> |
430 |
Do you deploy just module JAR file(s) or other files as well? |
431 |
<hint> |
432 |
Usually a module consist of one JAR file (perhaps with Class-Path |
433 |
extensions) and also a configuration file that enables it. If you |
434 |
have any other files, use |
435 |
<api group="java.io.File" name="yourname" type="export" category="friend">...</api> |
436 |
to define the location, name and stability of your files (of course |
437 |
changing "yourname" and "friend" to suit your needs). |
438 |
|
439 |
If it uses more than one JAR, describe where they are located, how |
440 |
they refer to each other. |
441 |
If it consist of module JAR(s) and other files, please describe |
442 |
what is their purpose, why other files are necessary. Please |
443 |
make sure that installation/uninstallation leaves the system |
444 |
in state as it was before installation. |
445 |
</hint> |
446 |
</question> |
447 |
--> |
448 |
<answer id="deploy-jar"> |
449 |
<p> |
450 |
Jar only. |
451 |
</p> |
452 |
</answer> |
453 |
|
454 |
|
455 |
|
456 |
<!-- |
457 |
<question id="deploy-nbm" when="impl"> |
458 |
Can you deploy an NBM via the Update Center? |
459 |
<hint> |
460 |
If not why? |
461 |
</hint> |
462 |
</question> |
463 |
--> |
464 |
<answer id="deploy-nbm"> |
465 |
<p> |
466 |
Yes. |
467 |
</p> |
468 |
</answer> |
469 |
|
470 |
|
471 |
|
472 |
<!-- |
473 |
<question id="deploy-packages" when="init"> |
474 |
Are packages of your module made inaccessible by not declaring them |
475 |
public? |
476 |
|
477 |
<hint> |
478 |
By default NetBeans build harness treats all packages are private. |
479 |
If you export some of them - either as public or friend packages, |
480 |
you should have a reason. If the reason is described elsewhere |
481 |
in this document, you can ignore this question. |
482 |
</hint> |
483 |
</question> |
484 |
--> |
485 |
<answer id="deploy-packages"> |
486 |
<p> |
487 |
Only API and SPI packages are public. |
488 |
</p> |
489 |
</answer> |
490 |
|
491 |
|
492 |
|
493 |
<!-- |
494 |
<question id="deploy-shared" when="final"> |
495 |
Do you need to be installed in the shared location only, or in the user directory only, |
496 |
or can your module be installed anywhere? |
497 |
<hint> |
498 |
Installation location shall not matter, if it does explain why. |
499 |
Consider also whether <code>InstalledFileLocator</code> can help. |
500 |
</hint> |
501 |
</question> |
502 |
--> |
503 |
<answer id="deploy-shared"> |
504 |
<p> |
505 |
Anywhere. |
506 |
</p> |
507 |
</answer> |
508 |
|
509 |
|
510 |
|
511 |
<!-- |
512 |
<question id="exec-ant-tasks" when="impl"> |
513 |
Do you define or register any ant tasks that other can use? |
514 |
|
515 |
<hint> |
516 |
If you provide an ant task that users can use, you need to be very |
517 |
careful about its syntax and behaviour, as it most likely forms an |
518 |
API for end users and as there is a lot of end users, their reaction |
519 |
when such API gets broken can be pretty strong. |
520 |
</hint> |
521 |
</question> |
522 |
--> |
523 |
<answer id="exec-ant-tasks"> |
524 |
<p> |
525 |
No. |
526 |
</p> |
527 |
</answer> |
528 |
|
529 |
|
530 |
|
531 |
<!-- |
532 |
<question id="exec-classloader" when="impl"> |
533 |
Does your code create its own class loader(s)? |
534 |
<hint> |
535 |
A bit unusual. Please explain why and what for. |
536 |
</hint> |
537 |
</question> |
538 |
--> |
539 |
<answer id="exec-classloader"> |
540 |
<p> |
541 |
No. |
542 |
</p> |
543 |
</answer> |
544 |
|
545 |
|
546 |
|
547 |
<!-- |
548 |
<question id="exec-component" when="impl"> |
549 |
Is execution of your code influenced by any (string) property |
550 |
of any of your components? |
551 |
|
552 |
<hint> |
553 |
Often <code>JComponent.getClientProperty</code>, <code>Action.getValue</code> |
554 |
or <code>PropertyDescriptor.getValue</code>, etc. are used to influence |
555 |
a behavior of some code. This of course forms an interface that should |
556 |
be documented. Also if one depends on some interface that an object |
557 |
implements (<code>component instanceof Runnable</code>) that forms an |
558 |
API as well. |
559 |
</hint> |
560 |
</question> |
561 |
--> |
562 |
<answer id="exec-component"> |
563 |
<p> |
564 |
No. |
565 |
</p> |
566 |
</answer> |
567 |
|
568 |
|
569 |
|
570 |
<!-- |
571 |
<question id="exec-introspection" when="impl"> |
572 |
Does your module use any kind of runtime type information (<code>instanceof</code>, |
573 |
work with <code>java.lang.Class</code>, etc.)? |
574 |
<hint> |
575 |
Check for cases when you have an object of type A and you also |
576 |
expect it to (possibly) be of type B and do some special action. That |
577 |
should be documented. The same applies on operations in meta-level |
578 |
(Class.isInstance(...), Class.isAssignableFrom(...), etc.). |
579 |
</hint> |
580 |
</question> |
581 |
--> |
582 |
<answer id="exec-introspection"> |
583 |
<p> |
584 |
No. |
585 |
</p> |
586 |
</answer> |
587 |
|
588 |
|
589 |
|
590 |
<!-- |
591 |
<question id="exec-privateaccess" when="final"> |
592 |
Are you aware of any other parts of the system calling some of |
593 |
your methods by reflection? |
594 |
<hint> |
595 |
If so, describe the "contract" as an API. Likely private or friend one, but |
596 |
still API and consider rewrite of it. |
597 |
</hint> |
598 |
</question> |
599 |
--> |
600 |
<answer id="exec-privateaccess"> |
601 |
<p> |
602 |
No. |
603 |
</p> |
604 |
</answer> |
605 |
|
606 |
|
607 |
|
608 |
<!-- |
609 |
<question id="exec-process" when="impl"> |
610 |
Do you execute an external process from your module? How do you ensure |
611 |
that the result is the same on different platforms? Do you parse output? |
612 |
Do you depend on result code? |
613 |
<hint> |
614 |
If you feed an input, parse the output please declare that as an API. |
615 |
</hint> |
616 |
</question> |
617 |
--> |
618 |
<answer id="exec-process"> |
619 |
<p> |
620 |
No. |
621 |
</p> |
622 |
</answer> |
623 |
|
624 |
|
625 |
|
626 |
<!-- |
627 |
<question id="exec-property" when="impl"> |
628 |
Is execution of your code influenced by any environment or |
629 |
Java system (<code>System.getProperty</code>) property? |
630 |
On a similar note, is there something interesting that you |
631 |
pass to <code>java.util.logging.Logger</code>? Or do you observe |
632 |
what others log? |
633 |
<hint> |
634 |
If there is a property that can change the behavior of your |
635 |
code, somebody will likely use it. You should describe what it does |
636 |
and the <a href="http://openide.netbeans.org/tutorial/api-design.html#life">stability category</a> |
637 |
of this API. You may use |
638 |
<pre> |
639 |
<api type="export" group="property" name="id" category="private" url="http://..."> |
640 |
description of the property, where it is used, what it influence, etc. |
641 |
</api> |
642 |
</pre> |
643 |
</hint> |
644 |
</question> |
645 |
--> |
646 |
<answer id="exec-property"> |
647 |
<p> |
648 |
No. |
649 |
</p> |
650 |
</answer> |
651 |
|
652 |
|
653 |
|
654 |
<!-- |
655 |
<question id="exec-reflection" when="impl"> |
656 |
Does your code use Java Reflection to execute other code? |
657 |
<hint> |
658 |
This usually indicates a missing or insufficient API in the other |
659 |
part of the system. If the other side is not aware of your dependency |
660 |
this contract can be easily broken. |
661 |
</hint> |
662 |
</question> |
663 |
--> |
664 |
<answer id="exec-reflection"> |
665 |
<p> |
666 |
No. |
667 |
</p> |
668 |
</answer> |
669 |
|
670 |
|
671 |
|
672 |
<!-- |
673 |
<question id="exec-threading" when="init"> |
674 |
What threading models, if any, does your module adhere to? How the |
675 |
project behaves with respect to threading? |
676 |
<hint> |
677 |
Is your API threadsafe? Can it be accessed from any threads or |
678 |
just from some dedicated ones? Any special relation to AWT and |
679 |
its Event Dispatch thread? Also |
680 |
if your module calls foreign APIs which have a specific threading model, |
681 |
indicate how you comply with the requirements for multithreaded access |
682 |
(synchronization, mutexes, etc.) applicable to those APIs. |
683 |
If your module defines any APIs, or has complex internal structures |
684 |
that might be used from multiple threads, declare how you protect |
685 |
data against concurrent access, race conditions, deadlocks, etc., |
686 |
and whether such rules are enforced by runtime warnings, errors, assertions, etc. |
687 |
Examples: a class might be non-thread-safe (like Java Collections); might |
688 |
be fully thread-safe (internal locking); might require access through a mutex |
689 |
(and may or may not automatically acquire that mutex on behalf of a client method); |
690 |
might be able to run only in the event queue; etc. |
691 |
Also describe when any events are fired: synchronously, asynchronously, etc. |
692 |
Ideas: <a href="http://core.netbeans.org/proposals/threading/index.html#recommendations">Threading Recommendations</a> (in progress) |
693 |
</hint> |
694 |
</question> |
695 |
--> |
696 |
<answer id="exec-threading"> |
697 |
<p> |
698 |
Both reindentation and reformatting are executed synchronously in a thread that calls |
699 |
the API classes (typically AWT thread). |
700 |
</p> |
701 |
</answer> |
702 |
|
703 |
|
704 |
|
705 |
<!-- |
706 |
<question id="format-clipboard" when="impl"> |
707 |
Which data flavors (if any) does your code read from or insert to |
708 |
the clipboard (by access to clipboard on means calling methods on <code>java.awt.datatransfer.Transferable</code>? |
709 |
|
710 |
<hint> |
711 |
Often Node's deal with clipboard by usage of <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>. |
712 |
Check your code for overriding these methods. |
713 |
</hint> |
714 |
</question> |
715 |
--> |
716 |
<answer id="format-clipboard"> |
717 |
<p> |
718 |
None. |
719 |
</p> |
720 |
</answer> |
721 |
|
722 |
|
723 |
|
724 |
<!-- |
725 |
<question id="format-dnd" when="impl"> |
726 |
Which protocols (if any) does your code understand during Drag & Drop? |
727 |
<hint> |
728 |
Often Node's deal with clipboard by usage of <code>Node.drag, Node.getDropType</code>. |
729 |
Check your code for overriding these methods. Btw. if they are not overridden, they |
730 |
by default delegate to <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>. |
731 |
</hint> |
732 |
</question> |
733 |
--> |
734 |
<answer id="format-dnd"> |
735 |
<p> |
736 |
None. |
737 |
</p> |
738 |
</answer> |
739 |
|
740 |
|
741 |
|
742 |
<!-- |
743 |
<question id="format-types" when="impl"> |
744 |
Which protocols and file formats (if any) does your module read or write on disk, |
745 |
or transmit or receive over the network? Do you generate an ant build script? |
746 |
Can it be edited and modified? |
747 |
|
748 |
<hint> |
749 |
<p> |
750 |
Files can be read and written by other programs, modules and users. If they influence |
751 |
your behaviour, make sure you either document the format or claim that it is a private |
752 |
api (using the <api> tag). |
753 |
</p> |
754 |
|
755 |
<p> |
756 |
If you generate an ant build file, this is very likely going to be seen by end users and |
757 |
they will be attempted to edit it. You should be ready for that and provide here a link |
758 |
to documentation that you have for such purposes and also describe how you are going to |
759 |
understand such files during next release, when you (very likely) slightly change the |
760 |
format. |
761 |
</p> |
762 |
</hint> |
763 |
</question> |
764 |
--> |
765 |
<answer id="format-types"> |
766 |
<p> |
767 |
None. |
768 |
</p> |
769 |
</answer> |
770 |
|
771 |
|
772 |
|
773 |
<!-- |
774 |
<question id="lookup-lookup" when="init"> |
775 |
Does your module use <code>org.openide.util.Lookup</code> |
776 |
or any similar technology to find any components to communicate with? Which ones? |
777 |
|
778 |
<hint> |
779 |
NetBeans is build around a generic registry of services called |
780 |
lookup. It is preferable to use it for registration and discovery |
781 |
if possible. See |
782 |
<a href="http://www.netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/lookup/doc-files/index.html"> |
783 |
The Solution to Comunication Between Components |
784 |
</a>. If you do not plan to use lookup and insist usage |
785 |
of other solution, then please describe why it is not working for |
786 |
you. |
787 |
<br/> |
788 |
When filling the final version of your arch document, please |
789 |
describe the interfaces you are searching for, where |
790 |
are defined, whether you are searching for just one or more of them, |
791 |
if the order is important, etc. Also classify the stability of such |
792 |
API contract. Use <api group=&lookup& /> tag, so |
793 |
your information gets listed in the summary page of your javadoc. |
794 |
</hint> |
795 |
</question> |
796 |
--> |
797 |
<answer id="lookup-lookup"> |
798 |
<p> |
799 |
It uses MimeLookup to search for registered indentation and reformatting task factories. |
800 |
</p> |
801 |
</answer> |
802 |
|
803 |
|
804 |
|
805 |
<!-- |
806 |
<question id="lookup-register" when="final"> |
807 |
Do you register anything into lookup for other code to find? |
808 |
<hint> |
809 |
Do you register using layer file or using <code>META-INF/services</code>? |
810 |
Who is supposed to find your component? |
811 |
</hint> |
812 |
</question> |
813 |
--> |
814 |
<answer id="lookup-register"> |
815 |
<p> |
816 |
The module registers <code>org.netbeans.modules.editor.lib.FormatterOverride</code> |
817 |
implementation so that it gets callback-ed from Editor Library formatter's infrastructure. |
818 |
</p> |
819 |
</answer> |
820 |
|
821 |
|
822 |
|
823 |
<!-- |
824 |
<question id="lookup-remove" when="final"> |
825 |
Do you remove entries of other modules from lookup? |
826 |
<hint> |
827 |
Why? Of course, that is possible, but it can be dangerous. Is the module |
828 |
your are masking resource from aware of what you are doing? |
829 |
</hint> |
830 |
</question> |
831 |
--> |
832 |
<answer id="lookup-remove"> |
833 |
<p> |
834 |
No. |
835 |
</p> |
836 |
</answer> |
837 |
|
838 |
|
839 |
|
840 |
<!-- |
841 |
<question id="perf-exit" when="final"> |
842 |
Does your module run any code on exit? |
843 |
</question> |
844 |
--> |
845 |
<answer id="perf-exit"> |
846 |
<p> |
847 |
No. |
848 |
</p> |
849 |
</answer> |
850 |
|
851 |
|
852 |
|
853 |
<!-- |
854 |
<question id="perf-huge_dialogs" when="final"> |
855 |
Does your module contain any dialogs or wizards with a large number of |
856 |
GUI controls such as combo boxes, lists, trees, or text areas? |
857 |
</question> |
858 |
--> |
859 |
<answer id="perf-huge_dialogs"> |
860 |
<p> |
861 |
No. |
862 |
</p> |
863 |
</answer> |
864 |
|
865 |
|
866 |
|
867 |
<!-- |
868 |
<question id="perf-limit" when="init"> |
869 |
Are there any hard-coded or practical limits in the number or size of |
870 |
elements your code can handle? |
871 |
<hint> |
872 |
Most of algorithms have increasing memory and speed complexity |
873 |
with respect to size of data they operate on. What is the critical |
874 |
part of your project that can be seen as a bottleneck with |
875 |
respect to speed or required memory? What are the practical |
876 |
sizes of data you tested your project with? What is your estimate |
877 |
of potential size of data that would cause visible performance |
878 |
problems? Is there some kind of check to detect such situation |
879 |
and prevent "hard" crashes - for example the CloneableEditorSupport |
880 |
checks for size of a file to be opened in editor |
881 |
and if it is larger than 1Mb it shows a dialog giving the |
882 |
user the right to decide - e.g. to cancel or commit suicide. |
883 |
</hint> |
884 |
</question> |
885 |
--> |
886 |
<answer id="perf-limit"> |
887 |
<p> |
888 |
No. |
889 |
</p> |
890 |
</answer> |
891 |
|
892 |
|
893 |
|
894 |
<!-- |
895 |
<question id="perf-mem" when="final"> |
896 |
How much memory does your component consume? Estimate |
897 |
with a relation to the number of windows, etc. |
898 |
</question> |
899 |
--> |
900 |
<answer id="perf-mem"> |
901 |
<p> |
902 |
No significant memory consumption. Only line indent strings are reasonably cached. |
903 |
</p> |
904 |
</answer> |
905 |
|
906 |
|
907 |
|
908 |
<!-- |
909 |
<question id="perf-menus" when="final"> |
910 |
Does your module use dynamically updated context menus, or |
911 |
context-sensitive actions with complicated and slow enablement logic? |
912 |
<hint> |
913 |
If you do a lot of tricks when adding actions to regular or context menus, you can significantly |
914 |
slow down display of the menu, even when the user is not using your action. Pay attention to |
915 |
actions you add to the main menu bar, and to context menus of foreign nodes or components. If |
916 |
the action is conditionally enabled, or changes its display dynamically, you need to check the |
917 |
impact on performance. In some cases it may be more appropriate to make a simple action that is |
918 |
always enabled but does more detailed checks in a dialog if it is actually run. |
919 |
</hint> |
920 |
</question> |
921 |
--> |
922 |
<answer id="perf-menus"> |
923 |
<p> |
924 |
No. |
925 |
</p> |
926 |
</answer> |
927 |
|
928 |
|
929 |
|
930 |
<!-- |
931 |
<question id="perf-progress" when="final"> |
932 |
Does your module execute any long-running tasks? |
933 |
|
934 |
<hint>Long running tasks should never block |
935 |
AWT thread as it badly hurts the UI |
936 |
<a href="http://performance.netbeans.org/responsiveness/issues.html"> |
937 |
responsiveness</a>. |
938 |
Tasks like connecting over |
939 |
network, computing huge amount of data, compilation |
940 |
be done asynchronously (for example |
941 |
using <code>RequestProcessor</code>), definitively it should |
942 |
not block AWT thread. |
943 |
</hint> |
944 |
</question> |
945 |
--> |
946 |
<answer id="perf-progress"> |
947 |
<p> |
948 |
Reformatting or reindentation of a large block of text can be time-consuming. |
949 |
<br/> |
950 |
The API is however not tied to be called in AWT thread only so the caller may reschedule |
951 |
the processing into another thread. It should ensure that the user won't be typing |
952 |
(or otherwise modifying) the document being reformatted. |
953 |
</p> |
954 |
</answer> |
955 |
|
956 |
|
957 |
|
958 |
<!-- |
959 |
<question id="perf-scale" when="init"> |
960 |
Which external criteria influence the performance of your |
961 |
program (size of file in editor, number of files in menu, |
962 |
in source directory, etc.) and how well your code scales? |
963 |
<hint> |
964 |
Please include some estimates, there are other more detailed |
965 |
questions to answer in later phases of implementation. |
966 |
</hint> |
967 |
</question> |
968 |
--> |
969 |
<answer id="perf-scale"> |
970 |
<p> |
971 |
Size of the code block being reformatted and complexity of the reformatters. |
972 |
</p> |
973 |
</answer> |
974 |
|
975 |
|
976 |
|
977 |
<!-- |
978 |
<question id="perf-spi" when="init"> |
979 |
How the performance of the plugged in code will be enforced? |
980 |
<hint> |
981 |
If you allow foreign code to be plugged into your own module, how |
982 |
do you enforce that it will behave correctly and quickly and will not |
983 |
negatively influence the performance of your own module? |
984 |
</hint> |
985 |
</question> |
986 |
--> |
987 |
<answer id="perf-spi"> |
988 |
<p> |
989 |
The plugged in code should control its complexity. The indentation infrastructure |
990 |
may provide a logger for displaying of the time spent in the reformatting |
991 |
and reindenting tasks. |
992 |
</p> |
993 |
</answer> |
994 |
|
995 |
|
996 |
|
997 |
<!-- |
998 |
<question id="perf-startup" when="final"> |
999 |
Does your module run any code on startup? |
1000 |
</question> |
1001 |
--> |
1002 |
<answer id="perf-startup"> |
1003 |
<p> |
1004 |
No. |
1005 |
</p> |
1006 |
</answer> |
1007 |
|
1008 |
|
1009 |
|
1010 |
<!-- |
1011 |
<question id="perf-wakeup" when="final"> |
1012 |
Does any piece of your code wake up periodically and do something |
1013 |
even when the system is otherwise idle (no user interaction)? |
1014 |
</question> |
1015 |
--> |
1016 |
<answer id="perf-wakeup"> |
1017 |
<p> |
1018 |
No. |
1019 |
</p> |
1020 |
</answer> |
1021 |
|
1022 |
|
1023 |
|
1024 |
<!-- |
1025 |
<question id="resources-file" when="final"> |
1026 |
Does your module use <code>java.io.File</code> directly? |
1027 |
|
1028 |
<hint> |
1029 |
NetBeans provide a logical wrapper over plain files called |
1030 |
<code>org.openide.filesystems.FileObject</code> that |
1031 |
provides uniform access to such resources and is the preferred |
1032 |
way that should be used. But of course there can be situations when |
1033 |
this is not suitable. |
1034 |
</hint> |
1035 |
</question> |
1036 |
--> |
1037 |
<answer id="resources-file"> |
1038 |
<p> |
1039 |
No. |
1040 |
</p> |
1041 |
</answer> |
1042 |
|
1043 |
|
1044 |
|
1045 |
<!-- |
1046 |
<question id="resources-layer" when="final"> |
1047 |
Does your module provide own layer? Does it create any files or |
1048 |
folders in it? What it is trying to communicate by that and with which |
1049 |
components? |
1050 |
|
1051 |
<hint> |
1052 |
NetBeans allows automatic and declarative installation of resources |
1053 |
by module layers. Module register files into appropriate places |
1054 |
and other components use that information to perform their task |
1055 |
(build menu, toolbar, window layout, list of templates, set of |
1056 |
options, etc.). |
1057 |
</hint> |
1058 |
</question> |
1059 |
--> |
1060 |
<answer id="resources-layer"> |
1061 |
<p> |
1062 |
No. |
1063 |
</p> |
1064 |
</answer> |
1065 |
|
1066 |
|
1067 |
|
1068 |
<!-- |
1069 |
<question id="resources-mask" when="final"> |
1070 |
Does your module mask/hide/override any resources provided by other modules in |
1071 |
their layers? |
1072 |
|
1073 |
<hint> |
1074 |
If you mask a file provided by another module, you probably depend |
1075 |
on that and do not want the other module to (for example) change |
1076 |
the file's name. That module shall thus make that file available as an API |
1077 |
of some stability category. |
1078 |
</hint> |
1079 |
</question> |
1080 |
--> |
1081 |
<answer id="resources-mask"> |
1082 |
<p> |
1083 |
No. |
1084 |
</p> |
1085 |
</answer> |
1086 |
|
1087 |
|
1088 |
|
1089 |
<!-- |
1090 |
<question id="resources-preferences" when="final"> |
1091 |
Does your module uses preferences via Preferences API? Does your module use NbPreferences or |
1092 |
or regular JDK Preferences ? Does it read, write or both ? |
1093 |
Does it share preferences with other modules ? If so, then why ? |
1094 |
<hint> |
1095 |
You may use |
1096 |
<api type="export" group="preferences" |
1097 |
name="preference node name" category="private"> |
1098 |
description of individual keys, where it is used, what it |
1099 |
influences, whether the module reads/write it, etc. |
1100 |
</api> |
1101 |
Due to XML ID restrictions, rather than /org/netbeans/modules/foo give the "name" as org.netbeans.modules.foo. |
1102 |
Note that if you use NbPreferences this name will then be the same as the code name base of the module. |
1103 |
</hint> |
1104 |
</question> |
1105 |
--> |
1106 |
<answer id="resources-preferences"> |
1107 |
<p> |
1108 |
No. |
1109 |
</p> |
1110 |
</answer> |
1111 |
|
1112 |
|
1113 |
|
1114 |
<!-- |
1115 |
<question id="resources-read" when="final"> |
1116 |
Does your module read any resources from layers? For what purpose? |
1117 |
|
1118 |
<hint> |
1119 |
As this is some kind of intermodule dependency, it is a kind of API. |
1120 |
Please describe it and classify according to |
1121 |
<a href="http://openide.netbeans.org/tutorial/api-design.html#categories"> |
1122 |
common stability categories</a>. |
1123 |
</hint> |
1124 |
</question> |
1125 |
--> |
1126 |
<answer id="resources-read"> |
1127 |
<p> |
1128 |
Not directly. Only through MimeLookup. |
1129 |
</p> |
1130 |
</answer> |
1131 |
|
1132 |
|
1133 |
|
1134 |
<!-- |
1135 |
<question id="security-grant" when="final"> |
1136 |
Does your code grant additional rights to some other code? |
1137 |
<hint>Avoid using a class loader that adds extra |
1138 |
permissions to loaded code unless really necessary. |
1139 |
Also note that your API implementation |
1140 |
can also expose unneeded permissions to enemy code by |
1141 |
calling AccessController.doPrivileged().</hint> |
1142 |
</question> |
1143 |
--> |
1144 |
<answer id="security-grant"> |
1145 |
<p> |
1146 |
No. |
1147 |
</p> |
1148 |
</answer> |
1149 |
|
1150 |
|
1151 |
|
1152 |
<!-- |
1153 |
<question id="security-policy" when="final"> |
1154 |
Does your functionality require modifications to the standard policy file? |
1155 |
<hint>Your code might pass control to third-party code not |
1156 |
coming from trusted domains. This could be code downloaded over the |
1157 |
network or code coming from libraries that are not bundled |
1158 |
with NetBeans. Which permissions need to be granted to which domains?</hint> |
1159 |
</question> |
1160 |
--> |
1161 |
<answer id="security-policy"> |
1162 |
<p> |
1163 |
No. |
1164 |
</p> |
1165 |
</answer> |
1166 |
|
1167 |
</api-answers> |