This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 245153
Collapse All | Expand All

(-)maven.archetype/apichanges.xml (+167 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
5
Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
6
7
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8
Other names may be trademarks of their respective owners.
9
10
11
The contents of this file are subject to the terms of either the GNU
12
General Public License Version 2 only ("GPL") or the Common
13
Development and Distribution License("CDDL") (collectively, the
14
"License"). You may not use this file except in compliance with the
15
License. You can obtain a copy of the License at
16
http://www.netbeans.org/cddl-gplv2.html
17
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
18
specific language governing permissions and limitations under the
19
License.  When distributing the software, include this License Header
20
Notice in each file and include the License file at
21
nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
22
particular file as subject to the "Classpath" exception as provided
23
by Oracle in the GPL Version 2 section of the License file that
24
accompanied this code. If applicable, add the following below the
25
License Header, with the fields enclosed by brackets [] replaced by
26
your own identifying information:
27
"Portions Copyrighted [year] [name of copyright owner]"
28
29
Contributor(s):
30
31
The Original Software is NetBeans. The Initial Developer of the Original
32
Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
33
Microsystems, Inc. All Rights Reserved.
34
35
If you wish your version of this file to be governed by only the CDDL
36
or only the GPL Version 2, indicate your decision by adding
37
"[Contributor] elects to include this software in this distribution
38
under the [CDDL or GPL Version 2] license." If you do not indicate a
39
single choice of license, a recipient has the option to distribute
40
your version of this file under either the CDDL, the GPL Version 2 or
41
to extend the choice of license to its licensees as provided above.
42
However, if you add GPL Version 2 code and therefore, elected the GPL
43
Version 2 license, then the option applies only if the new code is
44
made subject to such option by the copyright holder.
45
-->
46
<?xml-stylesheet type="text/xml" href="../nbbuild/javadoctools/apichanges.xsl"?>
47
<!DOCTYPE apichanges PUBLIC "-//NetBeans//DTD API changes list 1.0//EN" "../nbbuild/javadoctools/apichanges.dtd">
48
49
<!--
50
51
INFO FOR PEOPLE ADDING CHANGES:
52
53
Check the DTD (apichanges.dtd) for details on the syntax. You do not
54
need to regenerate the HTML, as this is part of Javadoc generation; just
55
change the XML. Rough syntax of a change (several parts optional):
56
57
<change>
58
    <api name="compiler"/>
59
    <summary>Some brief description here, can use <b>XHTML</b></summary>
60
    <version major="1" minor="99"/>
61
    <date day="13" month="6" year="2001"/>
62
    <author login="jrhacker"/>
63
    <compatibility addition="yes"/>
64
    <description>
65
        The main description of the change here.
66
        Again can use full <b>XHTML</b> as needed.
67
    </description>
68
    <class package="org.openide.compiler" name="DoWhatIWantCompiler"/>
69
    <issue number="14309"/>
70
</change>
71
72
Also permitted elements: <package>, <branch>. <version> is API spec
73
version, recommended for all new changes. <compatibility> should say
74
if things were added/modified/deprecated/etc. and give all information
75
related to upgrading old code. List affected top-level classes and
76
link to issue numbers if applicable. See the DTD for more details.
77
78
Changes need not be in any particular order, they are sorted in various
79
ways by the stylesheet anyway.
80
81
Dates are assumed to mean "on the trunk". If you *also* make the same
82
change on a stabilization branch, use the <branch> tag to indicate this
83
and explain why the change was made on a branch in the <description>.
84
85
Please only change this file on the trunk! Rather: you can change it
86
on branches if you want, but these changes will be ignored; only the
87
trunk version of this file is important.
88
89
Deprecations do not count as incompatible, assuming that code using the
90
deprecated calls continues to see their documented behavior. But do
91
specify deprecation="yes" in <compatibility>.
92
93
This file is not a replacement for Javadoc: it is intended to list changes,
94
not describe the complete current behavior, for which ordinary documentation
95
is the proper place.
96
97
-->
98
99
<apichanges>
100
101
    <!-- First, a list of API names you may use: -->
102
    <apidefs>
103
        <apidef name="general">Maven Archetype</apidef>
104
        <!-- etc. -->
105
    </apidefs>
106
107
    <!-- ACTUAL CHANGES BEGIN HERE: -->
108
109
    <changes>
110
        
111
        <change id="maven.archetype.api.init">
112
           <api name="general"/>
113
           <summary>Created the public Maven Archetype api</summary>
114
           <version major="1" minor="0"/>
115
           <date day="14" month="7" year="2014"/>
116
           <author login="tstupka"/>
117
           <compatibility modification="yes" semantic="compatible"/>
118
           <description>
119
               <p>
120
                   Public API for creating New Project wizards based on the maven-archetype-plugin.
121
               </p>
122
           </description>
123
           <class package="org.netbeans.maven.archetype.api" name="Archetype"/>
124
           <class package="org.netbeans.maven.archetype.api" name="ArchetypeProvider"/>
125
           <class package="org.netbeans.maven.archetype.api" name="ArchetypeWizards"/>
126
           <class package="org.netbeans.maven.archetype.api" name="ProjectInfo"/>
127
           <issue number="245153"/>
128
        </change>
129
        
130
    </changes>
131
132
    <!-- Now the surrounding HTML text and document structure: -->
133
134
    <htmlcontents>
135
<!--
136
137
                            NO NO NO NO NO!
138
139
         ==============>    DO NOT EDIT ME!  <==============
140
141
          AUTOMATICALLY GENERATED FROM APICHANGES.XML, DO NOT EDIT
142
143
                SEE projects/projectuiapi/apichanges.xml
144
145
-->
146
    <head>
147
      <title>Change History for Maven Archetype</title>
148
      <link rel="stylesheet" href="prose.css" type="text/css"/>
149
    </head>
150
    <body>
151
152
<p class="overviewlink"><a href="overview-summary.html">Overview</a></p>
153
154
<h1>Introduction</h1>
155
156
<p>This document lists changes made to the <a href="@org-netbeans-modules-maven-archetype@/index.html">Maven Project API</a>.</p>
157
158
<!-- The actual lists of changes, as summaries and details: -->
159
      <hr/>
160
      <standard-changelists module-code-name="org.netbeans.modules.maven/1"/>
161
162
      <hr/><p>@FOOTER@</p>
163
164
    </body>
165
  </htmlcontents>
166
167
</apichanges>
(-)maven.archetype/arch.xml (+1130 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
5
Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
6
7
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8
Other names may be trademarks of their respective owners.
9
10
11
The contents of this file are subject to the terms of either the GNU
12
General Public License Version 2 only ("GPL") or the Common
13
Development and Distribution License("CDDL") (collectively, the
14
"License"). You may not use this file except in compliance with the
15
License. You can obtain a copy of the License at
16
http://www.netbeans.org/cddl-gplv2.html
17
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
18
specific language governing permissions and limitations under the
19
License.  When distributing the software, include this License Header
20
Notice in each file and include the License file at
21
nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
22
particular file as subject to the "Classpath" exception as provided
23
by Oracle in the GPL Version 2 section of the License file that
24
accompanied this code. If applicable, add the following below the
25
License Header, with the fields enclosed by brackets [] replaced by
26
your own identifying information:
27
"Portions Copyrighted [year] [name of copyright owner]"
28
29
Contributor(s):
30
31
The Original Software is NetBeans. The Initial Developer of the Original
32
Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
33
Microsystems, Inc. All Rights Reserved.
34
35
If you wish your version of this file to be governed by only the CDDL
36
or only the GPL Version 2, indicate your decision by adding
37
"[Contributor] elects to include this software in this distribution
38
under the [CDDL or GPL Version 2] license." If you do not indicate a
39
single choice of license, a recipient has the option to distribute
40
your version of this file under either the CDDL, the GPL Version 2 or
41
to extend the choice of license to its licensees as provided above.
42
However, if you add GPL Version 2 code and therefore, elected the GPL
43
Version 2 license, then the option applies only if the new code is
44
made subject to such option by the copyright holder.
45
-->
46
<!DOCTYPE api-answers PUBLIC "-//NetBeans//DTD Arch Answers//EN" "../nbbuild/antsrc/org/netbeans/nbbuild/Arch.dtd" [
47
  <!ENTITY api-questions SYSTEM "../nbbuild/antsrc/org/netbeans/nbbuild/Arch-api-questions.xml">
48
]>
49
50
<api-answers
51
  question-version="1.0"
52
  author="tstupka@netbeans.org"
53
>
54
55
  &api-questions;
56
57
58
<!--
59
        <question id="arch-overall" when="init">
60
            Describe the overall architecture.
61
            <hint>
62
            What will be API for
63
            <a href="http://openide.netbeans.org/tutorial/api-design.html#design.apiandspi">
64
                clients and what support API</a>? 
65
            What parts will be pluggable?
66
            How will plug-ins be registered? Please use <code>&lt;api type="export"/&gt;</code>
67
            to describe your general APIs.
68
            If possible please provide 
69
            simple diagrams. 
70
            </hint>
71
        </question>
72
-->
73
 <answer id="arch-overall">
74
  <ul>
75
   <li>
76
    <api group="java" name="MavenArchetypeAPI" type="export" category="devel">
77
     <p> 
78
      The Maven Archetype API provides some miscellaneous APIs related to 
79
      maven-archetype-plugin.
80
     </p>
81
    </api>
82
   </li>
83
  </ul>
84
 </answer>
85
86
<!--
87
        <question id="arch-usecases" when="init">
88
            Describe the main <a href="http://openide.netbeans.org/tutorial/api-design.html#usecase">
89
            use cases</a> of the new API. Who will use it at
90
            what circumstances and what will be the typical code to write
91
            to use the module.
92
        </question>
93
-->
94
 <answer id="arch-usecases">
95
  <p>
96
    creating of New Project wizards based on the maven-archetype-plugin.
97
  </p>
98
 </answer>
99
100
101
102
<!--
103
        <question id="resources-read" when="final">
104
            Does your module read any resources from layers? For what purpose?
105
            
106
            <hint>
107
            As this is some kind of intermodule dependency, it is a kind of API.
108
            Please describe it and classify according to 
109
            <a href="http://openide.netbeans.org/tutorial/api-design.html#categories">
110
            common stability categories</a>.
111
            </hint>
112
        </question>
113
-->
114
 <answer id="resources-read">
115
116
    <api group="layer" name="MavenArchetypes" type="export" category="official">
117
     <p>
118
       "Projects/org-netbeans-modules-maven/Archetypes" folder contains fileobjects
119
       that represent archetypes. The archetypes are defined by the following file attributes:
120
     </p>
121
       <table>
122
           <tbody>
123
               <tr><td>groupId</td><td>mandatory</td><td></td></tr>
124
               <tr><td>artifactId</td><td>mandatory</td><td></td></tr>
125
               <tr><td>version</td><td>mandatory</td><td></td></tr>
126
               <tr><td>repository</td><td>optional</td><td>url of the archetype's repository</td></tr>
127
               <tr><td>nameBundleKey</td><td>optional</td><td>key in bundle file that holds localized name</td></tr>
128
               <tr><td>descriptionBundleKey</td><td>optional</td><td>key in bundle file that holds localized description</td></tr>
129
           </tbody>
130
       </table>
131
    </api>
132
133
 </answer>
134
135
<!--
136
        <question id="exec-property" when="impl">
137
            Is execution of your code influenced by any environment or
138
            Java system (<code>System.getProperty</code>) property?
139
            On a similar note, is there something interesting that you
140
            pass to <code>java.util.logging.Logger</code>? Or do you observe
141
            what others log?
142
            <hint>
143
            If there is a property that can change the behavior of your 
144
            code, somebody will likely use it. You should describe what it does 
145
            and the <a href="http://wiki.netbeans.org/API_Stability">stability category</a>
146
            of this API. You may use
147
            <pre>
148
                &lt;api type="export" group="property" name="id" category="private" url="http://..."&gt;
149
                    description of the property, where it is used, what it influence, etc.
150
                &lt;/api&gt;            
151
            </pre>
152
            </hint>
153
        </question>
154
-->
155
 <answer id="exec-property">
156
  <p>
157
      No environment or Java System properties.
158
  </p>
159
 </answer>
160
161
162
163
164
<!--
165
        <question id="arch-quality" when="init">
166
            How will the <a href="http://www.netbeans.org/community/guidelines/q-evangelism.html" shape="rect">quality</a>
167
            of your code be tested and 
168
            how are future regressions going to be prevented?
169
            <hint>
170
            What kind of testing do
171
            you want to use? How much functionality, in which areas,
172
            should be covered by the tests? How you find out that your
173
            project was successful?
174
            </hint>
175
        </question>
176
-->
177
 <answer id="arch-quality">
178
  <p>
179
   XXX no answer for arch-quality
180
  </p>
181
 </answer>
182
183
184
185
<!--
186
        <question id="arch-time" when="init">
187
            What are the time estimates of the work?
188
            <hint>
189
            Please express your estimates of how long the design, implementation,
190
            stabilization are likely to last. How many people will be needed to
191
            implement this and what is the expected milestone by which the work should be 
192
            ready?
193
            </hint>
194
        </question>
195
-->
196
 <answer id="arch-time">
197
  <p>
198
   XXX no answer for arch-time
199
  </p>
200
 </answer>
201
202
203
204
<!--
205
        <question id="arch-what" when="init">
206
            What is this project good for?
207
            <hint>
208
            Please provide here a few lines describing the project, 
209
            what problem it should solve, provide links to documentation, 
210
            specifications, etc.
211
            </hint>
212
        </question>
213
-->
214
 <answer id="arch-what">
215
  <p>
216
   XXX no answer for arch-what
217
  </p>
218
 </answer>
219
220
221
222
<!--
223
        <question id="arch-where" when="impl">
224
            Where one can find sources for your module?
225
            <hint>
226
                Please provide link to the Hg web client at
227
                http://hg.netbeans.org/
228
                or just use tag defaultanswer generate='here'
229
            </hint>
230
        </question>
231
-->
232
 <answer id="arch-where">
233
  <defaultanswer generate='here' />
234
 </answer>
235
236
237
238
<!--
239
        <question id="compat-deprecation" when="init">
240
            How the introduction of your project influences functionality
241
            provided by previous version of the product?
242
            <hint>
243
            If you are planning to deprecate/remove/change any existing APIs,
244
            list them here accompanied with the reason explaining why you
245
            are doing so.
246
            </hint>
247
        </question>
248
-->
249
 <answer id="compat-deprecation">
250
  <p>
251
   XXX no answer for compat-deprecation
252
  </p>
253
 </answer>
254
255
256
257
<!--
258
        <question id="compat-i18n" when="impl">
259
            Is your module correctly internationalized?
260
            <hint>
261
            Correct internationalization means that it obeys instructions 
262
            at <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html" shape="rect">
263
            NetBeans I18N pages</a>.
264
            </hint>
265
        </question>
266
-->
267
 <answer id="compat-i18n">
268
  <p>
269
   XXX no answer for compat-i18n
270
  </p>
271
 </answer>
272
273
274
275
<!--
276
        <question id="compat-standards" when="init">
277
            Does the module implement or define any standards? Is the 
278
            implementation exact or does it deviate somehow?
279
        </question>
280
-->
281
 <answer id="compat-standards">
282
  <p>
283
   XXX no answer for compat-standards
284
  </p>
285
 </answer>
286
287
288
289
<!--
290
        <question id="compat-version" when="impl">
291
            Can your module coexist with earlier and future
292
            versions of itself? Can you correctly read all old settings? Will future
293
            versions be able to read your current settings? Can you read
294
            or politely ignore settings stored by a future version?
295
            
296
            <hint>
297
            Very helpful for reading settings is to store version number
298
            there, so future versions can decide whether how to read/convert
299
            the settings and older versions can ignore the new ones.
300
            </hint>
301
        </question>
302
-->
303
 <answer id="compat-version">
304
  <p>
305
   XXX no answer for compat-version
306
  </p>
307
 </answer>
308
309
310
311
<!--
312
        <question id="dep-jre" when="final">
313
            Which version of JRE do you need (1.2, 1.3, 1.4, etc.)?
314
            <hint>
315
            It is expected that if your module runs on 1.x that it will run 
316
            on 1.x+1 if no, state that please. Also describe here cases where
317
            you run different code on different versions of JRE and why.
318
            </hint>
319
        </question>
320
-->
321
 <answer id="dep-jre">
322
  <p>
323
   XXX no answer for dep-jre
324
  </p>
325
 </answer>
326
327
328
329
<!--
330
        <question id="dep-jrejdk" when="final">
331
            Do you require the JDK or is the JRE enough?
332
        </question>
333
-->
334
 <answer id="dep-jrejdk">
335
  <p>
336
   XXX no answer for dep-jrejdk
337
  </p>
338
 </answer>
339
340
341
342
<!--
343
        <question id="dep-nb" when="init">
344
            What other NetBeans projects and modules does this one depend on?
345
            <hint>
346
            Depending on other NetBeans projects influnces the ability of
347
            users of your work to customize their own branded version of
348
            NetBeans by enabling and disabling some modules. Too
349
            much dependencies restrict this kind of customization. If that
350
            is your case, then you may want to split your functionality into
351
            pieces of autoload, eager and regular modules which can be
352
            enabled independently. Usually the answer to this question
353
            is generated from your <code>project.xml</code> file, but
354
            if it is not guessed correctly, you can suppress it by
355
            specifying &lt;defaultanswer generate="none"/&gt; and
356
            write here your own. Please describe such projects as imported APIs using
357
            the <code>&lt;api name="identification" type="import or export" category="stable" url="where is the description" /&gt;</code>.
358
            By doing this information gets listed in the summary page of your
359
            javadoc.
360
            </hint>
361
        </question>
362
-->
363
 <answer id="dep-nb">
364
  <defaultanswer generate='here' />
365
 </answer>
366
367
368
369
<!--
370
        <question id="dep-non-nb" when="init">
371
            What other projects outside NetBeans does this one depend on?
372
            
373
            <hint>
374
            Depending on 3rd party libraries is always problematic,
375
            especially if they are not open source, as that complicates
376
            the licensing scheme of NetBeans. Please enumerate your
377
            external dependencies here, so it is correctly understood since
378
            the begining what are the legal implications of your project.
379
            Also please note that
380
            some non-NetBeans projects are packaged as NetBeans modules
381
            (see <a href="http://libs.netbeans.org/" shape="rect">libraries</a>) and
382
            it is preferred to use this approach when more modules may
383
            depend and share such third-party libraries.
384
            </hint>
385
        </question>
386
-->
387
 <answer id="dep-non-nb">
388
  <p>
389
   XXX no answer for dep-non-nb
390
  </p>
391
 </answer>
392
393
394
395
<!--
396
        <question id="dep-platform" when="init">
397
            On which platforms does your module run? Does it run in the same
398
            way on each?
399
            <hint>
400
            If you plan any dependency on OS or any usage of native code,
401
            please describe why you are doing so and describe how you envision
402
            to enforce the portability of your code.
403
            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" shape="rect">OS conditionally
404
            enabled modules</a> which together with autoload/eager modules
405
            can allow you to enable to provide the best OS aware support
406
            on certain OSes while providing compatibility bridge on the not
407
            supported ones.
408
            Also please list the supported
409
            OSes/HW platforms and mentioned the lovest version of JDK required
410
            for your project to run on. Also state whether JRE is enough or
411
            you really need JDK.
412
            </hint>
413
        </question>
414
-->
415
 <answer id="dep-platform">
416
  <p>
417
   XXX no answer for dep-platform
418
  </p>
419
 </answer>
420
421
422
423
<!--
424
        <question id="deploy-dependencies" when="final">
425
            What do other modules need to do to declare a dependency on this one,
426
            in addition to or instead of the normal module dependency declaration
427
            (e.g. tokens to require)?
428
            <hint>
429
                Provide a sample of the actual lines you would add to a module manifest
430
                to declare a dependency, for example OpenIDE-Module-Requires: some.token.
431
                If other modules should not depend on this module, or should just use a
432
                simple regular module dependency, you can just answer "nothing". If you
433
                intentionally expose a semistable API to clients using implementation
434
                dependencies, you should mention that here (but there is no need to give
435
                an example of usage).
436
            </hint>
437
        </question>
438
-->
439
 <answer id="deploy-dependencies">
440
  <p>
441
   No special requirements here.
442
  </p>
443
 </answer>
444
445
446
447
<!--
448
        <question id="deploy-jar" when="impl">
449
            Do you deploy just module JAR file(s) or other files as well?
450
            <hint>
451
            Usually a module consist of one JAR file (perhaps with Class-Path
452
            extensions) and also a configuration file that enables it. If you
453
            have any other files, use
454
            &lt;api group="java.io.File" name="yourname" type="export" category="friend"&gt;...&lt;/api&gt;
455
            to define the location, name and stability of your files (of course
456
            changing "yourname" and "friend" to suit your needs).
457
            
458
            If it uses more than one JAR, describe where they are located, how
459
            they refer to each other. 
460
            If it consist of module JAR(s) and other files, please describe
461
            what is their purpose, why other files are necessary. Please 
462
            make sure that installation/uninstallation leaves the system 
463
            in state as it was before installation.
464
            </hint>
465
        </question>
466
-->
467
 <answer id="deploy-jar">
468
  <p>
469
   XXX no answer for deploy-jar
470
  </p>
471
 </answer>
472
473
474
475
<!--
476
        <question id="deploy-nbm" when="impl">
477
            Can you deploy an NBM via the Update Center?
478
            <hint>
479
            If not why?
480
            </hint>
481
        </question>
482
-->
483
 <answer id="deploy-nbm">
484
  <p>
485
   XXX no answer for deploy-nbm
486
  </p>
487
 </answer>
488
489
490
491
<!--
492
        <question id="deploy-packages" when="init">
493
            Are packages of your module made inaccessible by not declaring them
494
            public?
495
            
496
            <hint>
497
            By default NetBeans build harness treats all packages are private.
498
            If you export some of them - either as public or friend packages,
499
            you should have a reason. If the reason is described elsewhere
500
            in this document, you can ignore this question.
501
            </hint>
502
        </question>
503
-->
504
 <answer id="deploy-packages">
505
  <p>
506
   XXX no answer for deploy-packages
507
  </p>
508
 </answer>
509
510
511
512
<!--
513
        <question id="deploy-shared" when="final">
514
            Do you need to be installed in the shared location only, or in the user directory only,
515
            or can your module be installed anywhere?
516
            <hint>
517
            Installation location shall not matter, if it does explain why.
518
            Consider also whether <code>InstalledFileLocator</code> can help.
519
            </hint>
520
        </question>
521
-->
522
 <answer id="deploy-shared">
523
  <p>
524
   XXX no answer for deploy-shared
525
  </p>
526
 </answer>
527
528
529
530
<!--
531
        <question id="exec-ant-tasks" when="impl">
532
            Do you define or register any ant tasks that other can use?
533
            
534
            <hint>
535
            If you provide an ant task that users can use, you need to be very
536
            careful about its syntax and behaviour, as it most likely forms an
537
	          API for end users and as there is a lot of end users, their reaction
538
            when such API gets broken can be pretty strong.
539
            </hint>
540
        </question>
541
-->
542
 <answer id="exec-ant-tasks">
543
  <p>
544
   XXX no answer for exec-ant-tasks
545
  </p>
546
 </answer>
547
548
549
550
<!--
551
        <question id="exec-classloader" when="impl">
552
            Does your code create its own class loader(s)?
553
            <hint>
554
            A bit unusual. Please explain why and what for.
555
            </hint>
556
        </question>
557
-->
558
 <answer id="exec-classloader">
559
  <p>
560
   XXX no answer for exec-classloader
561
  </p>
562
 </answer>
563
564
565
566
<!--
567
        <question id="exec-component" when="impl">
568
            Is execution of your code influenced by any (string) property
569
            of any of your components?
570
            
571
            <hint>
572
            Often <code>JComponent.getClientProperty</code>, <code>Action.getValue</code>
573
            or <code>PropertyDescriptor.getValue</code>, etc. are used to influence
574
            a behavior of some code. This of course forms an interface that should
575
            be documented. Also if one depends on some interface that an object
576
            implements (<code>component instanceof Runnable</code>) that forms an
577
            API as well.
578
            </hint>
579
        </question>
580
-->
581
 <answer id="exec-component">
582
  <p>
583
   XXX no answer for exec-component
584
  </p>
585
 </answer>
586
587
588
589
<!--
590
        <question id="exec-introspection" when="impl">
591
            Does your module use any kind of runtime type information (<code>instanceof</code>,
592
            work with <code>java.lang.Class</code>, etc.)?
593
            <hint>
594
            Check for cases when you have an object of type A and you also
595
            expect it to (possibly) be of type B and do some special action. That
596
            should be documented. The same applies on operations in meta-level
597
            (Class.isInstance(...), Class.isAssignableFrom(...), etc.).
598
            </hint>
599
        </question>
600
-->
601
 <answer id="exec-introspection">
602
  <p>
603
   XXX no answer for exec-introspection
604
  </p>
605
 </answer>
606
607
608
609
<!--
610
        <question id="exec-privateaccess" when="final">
611
            Are you aware of any other parts of the system calling some of 
612
            your methods by reflection?
613
            <hint>
614
            If so, describe the "contract" as an API. Likely private or friend one, but
615
            still API and consider rewrite of it.
616
            </hint>
617
        </question>
618
-->
619
 <answer id="exec-privateaccess">
620
  <p>
621
   XXX no answer for exec-privateaccess
622
  </p>
623
 </answer>
624
625
626
627
<!--
628
        <question id="exec-process" when="impl">
629
            Do you execute an external process from your module? How do you ensure
630
            that the result is the same on different platforms? Do you parse output?
631
            Do you depend on result code?
632
            <hint>
633
            If you feed an input, parse the output please declare that as an API.
634
            </hint>
635
        </question>
636
-->
637
 <answer id="exec-process">
638
  <p>
639
   XXX no answer for exec-process
640
  </p>
641
 </answer>
642
643
644
645
<!--
646
        <question id="exec-reflection" when="impl">
647
            Does your code use Java Reflection to execute other code?
648
            <hint>
649
            This usually indicates a missing or insufficient API in the other
650
            part of the system. If the other side is not aware of your dependency
651
            this contract can be easily broken.
652
            </hint>
653
        </question>
654
-->
655
 <answer id="exec-reflection">
656
  <p>
657
   XXX no answer for exec-reflection
658
  </p>
659
 </answer>
660
661
662
663
<!--
664
        <question id="exec-threading" when="init">
665
            What threading models, if any, does your module adhere to? How the
666
            project behaves with respect to threading?
667
            <hint>
668
                Is your API threadsafe? Can it be accessed from any threads or
669
                just from some dedicated ones? Any special relation to AWT and
670
                its Event Dispatch thread? Also
671
                if your module calls foreign APIs which have a specific threading model,
672
                indicate how you comply with the requirements for multithreaded access
673
                (synchronization, mutexes, etc.) applicable to those APIs.
674
                If your module defines any APIs, or has complex internal structures
675
                that might be used from multiple threads, declare how you protect
676
                data against concurrent access, race conditions, deadlocks, etc.,
677
                and whether such rules are enforced by runtime warnings, errors, assertions, etc.
678
                Examples: a class might be non-thread-safe (like Java Collections); might
679
                be fully thread-safe (internal locking); might require access through a mutex
680
                (and may or may not automatically acquire that mutex on behalf of a client method);
681
                might be able to run only in the event queue; etc.
682
                Also describe when any events are fired: synchronously, asynchronously, etc.
683
                Ideas: <a href="http://core.netbeans.org/proposals/threading/index.html#recommendations" shape="rect">Threading Recommendations</a> (in progress)
684
            </hint>
685
        </question>
686
-->
687
 <answer id="exec-threading">
688
  <p>
689
   XXX no answer for exec-threading
690
  </p>
691
 </answer>
692
693
694
695
<!--
696
        <question id="format-clipboard" when="impl">
697
            Which data flavors (if any) does your code read from or insert to
698
            the clipboard (by access to clipboard on means calling methods on <code>java.awt.datatransfer.Transferable</code>?
699
            
700
            <hint>
701
            Often Node's deal with clipboard by usage of <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
702
            Check your code for overriding these methods.
703
            </hint>
704
        </question>
705
-->
706
 <answer id="format-clipboard">
707
  <p>
708
   XXX no answer for format-clipboard
709
  </p>
710
 </answer>
711
712
713
714
<!--
715
        <question id="format-dnd" when="impl">
716
            Which protocols (if any) does your code understand during Drag &amp; Drop?
717
            <hint>
718
            Often Node's deal with clipboard by usage of <code>Node.drag, Node.getDropType</code>. 
719
            Check your code for overriding these methods. Btw. if they are not overridden, they
720
            by default delegate to <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
721
            </hint>
722
        </question>
723
-->
724
 <answer id="format-dnd">
725
  <p>
726
   XXX no answer for format-dnd
727
  </p>
728
 </answer>
729
730
731
732
<!--
733
        <question id="format-types" when="impl">
734
            Which protocols and file formats (if any) does your module read or write on disk,
735
            or transmit or receive over the network? Do you generate an ant build script?
736
            Can it be edited and modified? 
737
            
738
            <hint>
739
            <p>
740
            Files can be read and written by other programs, modules and users. If they influence
741
            your behaviour, make sure you either document the format or claim that it is a private
742
            api (using the &lt;api&gt; tag). 
743
            </p>
744
            
745
            <p>
746
            If you generate an ant build file, this is very likely going to be seen by end users and
747
            they will be attempted to edit it. You should be ready for that and provide here a link
748
            to documentation that you have for such purposes and also describe how you are going to
749
            understand such files during next release, when you (very likely) slightly change the 
750
            format.
751
            </p>
752
            </hint>
753
        </question>
754
-->
755
 <answer id="format-types">
756
  <p>
757
   XXX no answer for format-types
758
  </p>
759
 </answer>
760
761
762
763
<!--
764
        <question id="lookup-lookup" when="init">
765
            Does your module use <code>org.openide.util.Lookup</code>
766
            or any similar technology to find any components to communicate with? Which ones?
767
            
768
            <hint>
769
            NetBeans is build around a generic registry of services called
770
            lookup. It is preferable to use it for registration and discovery
771
            if possible. See
772
            <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/lookup/doc-files/index.html" shape="rect">
773
            The Solution to Comunication Between Components
774
            </a>. If you do not plan to use lookup and insist usage
775
            of other solution, then please describe why it is not working for
776
            you.
777
            <br/>
778
            When filling the final version of your arch document, please
779
            describe the interfaces you are searching for, where 
780
            are defined, whether you are searching for just one or more of them,
781
            if the order is important, etc. Also classify the stability of such
782
            API contract. Use &lt;api group=&amp;lookup&amp; /&gt; tag, so
783
            your information gets listed in the summary page of your javadoc.
784
            </hint>
785
        </question>
786
-->
787
 <answer id="lookup-lookup">
788
  <p>
789
   XXX no answer for lookup-lookup
790
  </p>
791
 </answer>
792
793
794
795
<!--
796
        <question id="lookup-register" when="final">
797
            Do you register anything into lookup for other code to find?
798
            <hint>
799
            Do you register using layer file or using a declarative annotation such as <code>@ServiceProvider</code>?
800
            Who is supposed to find your component?
801
            </hint>
802
        </question>
803
-->
804
 <answer id="lookup-register">
805
  <p>
806
   XXX no answer for lookup-register
807
  </p>
808
 </answer>
809
810
811
812
<!--
813
        <question id="lookup-remove" when="final">
814
            Do you remove entries of other modules from lookup?
815
            <hint>
816
            Why? Of course, that is possible, but it can be dangerous. Is the module
817
            your are masking resource from aware of what you are doing?
818
            </hint>
819
        </question>
820
-->
821
 <answer id="lookup-remove">
822
  <p>
823
   XXX no answer for lookup-remove
824
  </p>
825
 </answer>
826
827
828
829
<!--
830
        <question id="perf-exit" when="final">
831
            Does your module run any code on exit?
832
        </question>
833
-->
834
 <answer id="perf-exit">
835
  <p>
836
   XXX no answer for perf-exit
837
  </p>
838
 </answer>
839
840
841
842
<!--
843
        <question id="perf-huge_dialogs" when="final">
844
            Does your module contain any dialogs or wizards with a large number of
845
            GUI controls such as combo boxes, lists, trees, or text areas?
846
        </question>
847
-->
848
 <answer id="perf-huge_dialogs">
849
  <p>
850
   XXX no answer for perf-huge_dialogs
851
  </p>
852
 </answer>
853
854
855
856
<!--
857
        <question id="perf-limit" when="init">
858
            Are there any hard-coded or practical limits in the number or size of
859
            elements your code can handle?
860
            <hint>
861
                Most of algorithms have increasing memory and speed complexity
862
                with respect to size of data they operate on. What is the critical
863
                part of your project that can be seen as a bottleneck with
864
                respect to speed or required memory? What are the practical
865
                sizes of data you tested your project with? What is your estimate
866
                of potential size of data that would cause visible performance
867
                problems? Is there some kind of check to detect such situation
868
                and prevent "hard" crashes - for example the CloneableEditorSupport
869
                checks for size of a file to be opened in editor
870
                and if it is larger than 1Mb it shows a dialog giving the
871
                user the right to decide - e.g. to cancel or commit suicide.
872
            </hint>
873
        </question>
874
-->
875
 <answer id="perf-limit">
876
  <p>
877
   XXX no answer for perf-limit
878
  </p>
879
 </answer>
880
881
882
883
<!--
884
        <question id="perf-mem" when="final">
885
            How much memory does your component consume? Estimate
886
            with a relation to the number of windows, etc.
887
        </question>
888
-->
889
 <answer id="perf-mem">
890
  <p>
891
   XXX no answer for perf-mem
892
  </p>
893
 </answer>
894
895
896
897
<!--
898
        <question id="perf-menus" when="final">
899
            Does your module use dynamically updated context menus, or
900
            context-sensitive actions with complicated and slow enablement logic?
901
            <hint>
902
                If you do a lot of tricks when adding actions to regular or context menus, you can significantly
903
                slow down display of the menu, even when the user is not using your action. Pay attention to
904
                actions you add to the main menu bar, and to context menus of foreign nodes or components. If
905
                the action is conditionally enabled, or changes its display dynamically, you need to check the
906
                impact on performance. In some cases it may be more appropriate to make a simple action that is
907
                always enabled but does more detailed checks in a dialog if it is actually run.
908
            </hint>
909
        </question>
910
-->
911
 <answer id="perf-menus">
912
  <p>
913
   XXX no answer for perf-menus
914
  </p>
915
 </answer>
916
917
918
919
<!--
920
        <question id="perf-progress" when="final">
921
            Does your module execute any long-running tasks?
922
            
923
            <hint>Long running tasks should never block 
924
            AWT thread as it badly hurts the UI
925
            <a href="http://performance.netbeans.org/responsiveness/issues.html" shape="rect">
926
            responsiveness</a>.
927
            Tasks like connecting over
928
            network, computing huge amount of data, compilation
929
            be done asynchronously (for example
930
            using <code>RequestProcessor</code>), definitively it should 
931
            not block AWT thread.
932
            </hint>
933
        </question>
934
-->
935
 <answer id="perf-progress">
936
  <p>
937
   XXX no answer for perf-progress
938
  </p>
939
 </answer>
940
941
942
943
<!--
944
        <question id="perf-scale" when="init">
945
            Which external criteria influence the performance of your
946
            program (size of file in editor, number of files in menu, 
947
            in source directory, etc.) and how well your code scales?
948
            <hint>
949
            Please include some estimates, there are other more detailed 
950
            questions to answer in later phases of implementation. 
951
            </hint>
952
        </question>
953
-->
954
 <answer id="perf-scale">
955
  <p>
956
   XXX no answer for perf-scale
957
  </p>
958
 </answer>
959
960
961
962
<!--
963
        <question id="perf-spi" when="init">
964
            How the performance of the plugged in code will be enforced?
965
            <hint>
966
            If you allow foreign code to be plugged into your own module, how
967
            do you enforce that it will behave correctly and quickly and will not
968
            negatively influence the performance of your own module?
969
            </hint>
970
        </question>
971
-->
972
 <answer id="perf-spi">
973
  <p>
974
   XXX no answer for perf-spi
975
  </p>
976
 </answer>
977
978
979
980
<!--
981
        <question id="perf-startup" when="final">
982
            Does your module run any code on startup?
983
        </question>
984
-->
985
 <answer id="perf-startup">
986
  <p>
987
   XXX no answer for perf-startup
988
  </p>
989
 </answer>
990
991
992
993
<!--
994
        <question id="perf-wakeup" when="final">
995
            Does any piece of your code wake up periodically and do something
996
            even when the system is otherwise idle (no user interaction)?
997
        </question>
998
-->
999
 <answer id="perf-wakeup">
1000
  <p>
1001
   XXX no answer for perf-wakeup
1002
  </p>
1003
 </answer>
1004
1005
1006
1007
<!--
1008
        <question id="resources-file" when="final">
1009
            Does your module use <code>java.io.File</code> directly?
1010
            
1011
            <hint>
1012
            NetBeans provide a logical wrapper over plain files called 
1013
            <code>org.openide.filesystems.FileObject</code> that
1014
            provides uniform access to such resources and is the preferred
1015
            way that should be used. But of course there can be situations when
1016
            this is not suitable.
1017
            </hint>
1018
        </question>
1019
-->
1020
 <answer id="resources-file">
1021
  <p>
1022
   XXX no answer for resources-file
1023
  </p>
1024
 </answer>
1025
1026
1027
1028
<!--
1029
        <question id="resources-layer" when="final">
1030
            Does your module provide own layer? Does it create any files or
1031
            folders in it? What it is trying to communicate by that and with which 
1032
            components?
1033
            
1034
            <hint>
1035
            NetBeans allows automatic and declarative installation of resources 
1036
            by module layers. Module register files into appropriate places
1037
            and other components use that information to perform their task
1038
            (build menu, toolbar, window layout, list of templates, set of
1039
            options, etc.). 
1040
            </hint>
1041
        </question>
1042
-->
1043
 <answer id="resources-layer">
1044
  <p>
1045
   XXX no answer for resources-layer
1046
  </p>
1047
 </answer>
1048
1049
1050
1051
<!--
1052
        <question id="resources-mask" when="final">
1053
            Does your module mask/hide/override any resources provided by other modules in
1054
            their layers?
1055
            
1056
            <hint>
1057
            If you mask a file provided by another module, you probably depend
1058
            on that and do not want the other module to (for example) change
1059
            the file's name. That module shall thus make that file available as an API
1060
            of some stability category.
1061
            </hint>
1062
        </question>
1063
-->
1064
 <answer id="resources-mask">
1065
  <p>
1066
   XXX no answer for resources-mask
1067
  </p>
1068
 </answer>
1069
1070
1071
1072
<!--
1073
        <question id="resources-preferences" when="final">
1074
            Does your module uses preferences via Preferences API? Does your module use NbPreferences or
1075
            or regular JDK Preferences ? Does it read, write or both ? 
1076
            Does it share preferences with other modules ? If so, then why ?
1077
            <hint>
1078
                You may use
1079
                    &lt;api type="export" group="preferences"
1080
                    name="preference node name" category="private"&gt;
1081
                    description of individual keys, where it is used, what it
1082
                    influences, whether the module reads/write it, etc.
1083
                    &lt;/api&gt;
1084
                Due to XML ID restrictions, rather than /org/netbeans/modules/foo give the "name" as org.netbeans.modules.foo.
1085
                Note that if you use NbPreferences this name will then be the same as the code name base of the module.
1086
            </hint>
1087
        </question>
1088
-->
1089
 <answer id="resources-preferences">
1090
  <p>
1091
   XXX no answer for resources-preferences
1092
  </p>
1093
 </answer>
1094
1095
1096
1097
<!--
1098
        <question id="security-grant" when="final">
1099
            Does your code grant additional rights to some other code?
1100
            <hint>Avoid using a class loader that adds extra
1101
            permissions to loaded code unless really necessary.
1102
            Also note that your API implementation
1103
            can also expose unneeded permissions to enemy code by
1104
            calling AccessController.doPrivileged().</hint>
1105
        </question>
1106
-->
1107
 <answer id="security-grant">
1108
  <p>
1109
   XXX no answer for security-grant
1110
  </p>
1111
 </answer>
1112
1113
1114
1115
<!--
1116
        <question id="security-policy" when="final">
1117
            Does your functionality require modifications to the standard policy file?
1118
            <hint>Your code might pass control to third-party code not
1119
            coming from trusted domains. This could be code downloaded over the
1120
            network or code coming from libraries that are not bundled
1121
            with NetBeans. Which permissions need to be granted to which domains?</hint>
1122
        </question>
1123
-->
1124
 <answer id="security-policy">
1125
  <p>
1126
   XXX no answer for security-policy
1127
  </p>
1128
 </answer>
1129
1130
</api-answers>
(-)maven.archetype/build.xml (+50 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
5
Copyright 2010 Oracle and/or its affiliates. All rights reserved.
6
7
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8
Other names may be trademarks of their respective owners.
9
10
11
The contents of this file are subject to the terms of either the GNU
12
General Public License Version 2 only ("GPL") or the Common
13
Development and Distribution License("CDDL") (collectively, the
14
"License"). You may not use this file except in compliance with the
15
License. You can obtain a copy of the License at
16
http://www.netbeans.org/cddl-gplv2.html
17
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
18
specific language governing permissions and limitations under the
19
License.  When distributing the software, include this License Header
20
Notice in each file and include the License file at
21
nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
22
particular file as subject to the "Classpath" exception as provided
23
by Oracle in the GPL Version 2 section of the License file that
24
accompanied this code. If applicable, add the following below the
25
License Header, with the fields enclosed by brackets [] replaced by
26
your own identifying information:
27
"Portions Copyrighted [year] [name of copyright owner]"
28
29
Contributor(s):
30
31
The Original Software is NetBeans. The Initial Developer of the Original
32
Software is Sun Microsystems, Inc. Portions Copyright 2008 Sun
33
Microsystems, Inc. All Rights Reserved.
34
35
If you wish your version of this file to be governed by only the CDDL
36
or only the GPL Version 2, indicate your decision by adding
37
"[Contributor] elects to include this software in this distribution
38
under the [CDDL or GPL Version 2] license." If you do not indicate a
39
single choice of license, a recipient has the option to distribute
40
your version of this file under either the CDDL, the GPL Version 2 or
41
to extend the choice of license to its licensees as provided above.
42
However, if you add GPL Version 2 code and therefore, elected the GPL
43
Version 2 license, then the option applies only if the new code is
44
made subject to such option by the copyright holder.
45
-->
46
47
<project basedir="." default="netbeans" name="maven.archetype">
48
    <description>Builds, tests, and runs the project org.netbeans.modules.maven.archetype</description>
49
    <import file="../nbbuild/templates/projectized.xml"/>
50
</project>
(-)maven.archetype/manifest.mf (+6 lines)
Line 0 Link Here
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.maven.archetype
3
OpenIDE-Module-Specification-Version: 1.0
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/maven/archetype/Bundle.properties
5
AutoUpdate-Show-In-Client: false
6
(-)maven.archetype/nbproject/project.properties (+46 lines)
Line 0 Link Here
1
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
#
3
# Copyright 2010 Oracle and/or its affiliates. All rights reserved.
4
#
5
# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6
# Other names may be trademarks of their respective owners.
7
#
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.  Oracle designates this
19
# particular file as subject to the "Classpath" exception as provided
20
# by Oracle 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]"
25
#
26
# If you wish your version of this file to be governed by only the CDDL
27
# or only the GPL Version 2, indicate your decision by adding
28
# "[Contributor] elects to include this software in this distribution
29
# under the [CDDL or GPL Version 2] license." If you do not indicate a
30
# single choice of license, a recipient has the option to distribute
31
# your version of this file under either the CDDL, the GPL Version 2 or
32
# to extend the choice of license to its licensees as provided above.
33
# However, if you add GPL Version 2 code and therefore, elected the GPL
34
# Version 2 license, then the option applies only if the new code is
35
# made subject to such option by the copyright holder.
36
#
37
# Contributor(s):
38
#
39
# Portions Copyrighted 2008 Sun Microsystems, Inc.
40
41
javac.source=1.6
42
javac.compilerargs=-Xlint -Xlint:-serial
43
javadoc.apichanges=${basedir}/apichanges.xml
44
javadoc.arch=${basedir}/arch.xml
45
46
(-)maven.archetype/nbproject/project.xml (+180 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
5
Copyright 2010 Oracle and/or its affiliates. All rights reserved.
6
7
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8
Other names may be trademarks of their respective owners.
9
10
11
The contents of this file are subject to the terms of either the GNU
12
General Public License Version 2 only ("GPL") or the Common
13
Development and Distribution License("CDDL") (collectively, the
14
"License"). You may not use this file except in compliance with the
15
License. You can obtain a copy of the License at
16
http://www.netbeans.org/cddl-gplv2.html
17
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
18
specific language governing permissions and limitations under the
19
License.  When distributing the software, include this License Header
20
Notice in each file and include the License file at
21
nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
22
particular file as subject to the "Classpath" exception as provided
23
by Oracle in the GPL Version 2 section of the License file that
24
accompanied this code. If applicable, add the following below the
25
License Header, with the fields enclosed by brackets [] replaced by
26
your own identifying information:
27
"Portions Copyrighted [year] [name of copyright owner]"
28
29
Contributor(s):
30
31
The Original Software is NetBeans. The Initial Developer of the Original
32
Software is Sun Microsystems, Inc. Portions Copyright 2008 Sun
33
Microsystems, Inc. All Rights Reserved.
34
35
If you wish your version of this file to be governed by only the CDDL
36
or only the GPL Version 2, indicate your decision by adding
37
"[Contributor] elects to include this software in this distribution
38
under the [CDDL or GPL Version 2] license." If you do not indicate a
39
single choice of license, a recipient has the option to distribute
40
your version of this file under either the CDDL, the GPL Version 2 or
41
to extend the choice of license to its licensees as provided above.
42
However, if you add GPL Version 2 code and therefore, elected the GPL
43
Version 2 license, then the option applies only if the new code is
44
made subject to such option by the copyright holder.
45
-->
46
<project xmlns="http://www.netbeans.org/ns/project/1">
47
    <type>org.netbeans.modules.apisupport.project</type>
48
    <configuration>
49
        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
50
            <code-name-base>org.netbeans.modules.maven.archetype</code-name-base>
51
            <module-dependencies>
52
                <dependency>
53
                    <code-name-base>org.netbeans.api.annotations.common</code-name-base>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
56
                    <run-dependency>
57
                        <release-version>1</release-version>
58
                        <specification-version>1.6</specification-version>
59
                    </run-dependency>
60
                </dependency>
61
                <dependency>
62
                    <code-name-base>org.netbeans.api.progress</code-name-base>
63
                    <build-prerequisite/>
64
                    <compile-dependency/>
65
                    <run-dependency>
66
                        <release-version>1</release-version>
67
                        <specification-version>1.12</specification-version>
68
                    </run-dependency>
69
                </dependency>
70
                <dependency>
71
                    <code-name-base>org.netbeans.modules.maven.embedder</code-name-base>
72
                    <build-prerequisite/>
73
                    <compile-dependency/>
74
                    <run-dependency>
75
                        <release-version>2</release-version>
76
                        <specification-version>2.44</specification-version>
77
                    </run-dependency>
78
                </dependency>
79
                <dependency>
80
                    <code-name-base>org.netbeans.modules.maven.indexer</code-name-base>
81
                    <build-prerequisite/>
82
                    <compile-dependency/>
83
                    <run-dependency>
84
                        <release-version>2</release-version>
85
                        <specification-version>2.28</specification-version>
86
                    </run-dependency>
87
                </dependency>
88
                <dependency>
89
                    <code-name-base>org.netbeans.modules.maven.model</code-name-base>
90
                    <build-prerequisite/>
91
                    <compile-dependency/>
92
                    <run-dependency>
93
                        <release-version>1</release-version>
94
                        <specification-version>1.36</specification-version>
95
                    </run-dependency>
96
                </dependency>
97
                <dependency>
98
                    <code-name-base>org.netbeans.modules.swing.validation</code-name-base>
99
                    <build-prerequisite/>
100
                    <compile-dependency/>
101
                    <run-dependency>
102
                        <release-version>2</release-version>
103
                        <specification-version>1.16</specification-version>
104
                    </run-dependency>
105
                </dependency>
106
                <dependency>
107
                    <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
108
                    <build-prerequisite/>
109
                    <compile-dependency/>
110
                    <run-dependency>
111
                        <release-version>1</release-version>
112
                        <specification-version>1.4</specification-version>
113
                    </run-dependency>
114
                </dependency>
115
                <dependency>
116
                    <code-name-base>org.openide.dialogs</code-name-base>
117
                    <build-prerequisite/>
118
                    <compile-dependency/>
119
                    <run-dependency>
120
                        <specification-version>7.22</specification-version>
121
                    </run-dependency>
122
                </dependency>
123
                <dependency>
124
                    <code-name-base>org.openide.filesystems</code-name-base>
125
                    <build-prerequisite/>
126
                    <compile-dependency/>
127
                    <run-dependency>
128
                        <specification-version>7.49</specification-version>
129
                    </run-dependency>
130
                </dependency>
131
                <dependency>
132
                    <code-name-base>org.openide.loaders</code-name-base>
133
                    <build-prerequisite/>
134
                    <compile-dependency/>
135
                    <run-dependency>
136
                        <specification-version>7.47</specification-version>
137
                    </run-dependency>
138
                </dependency>
139
                <dependency>
140
                    <code-name-base>org.openide.util</code-name-base>
141
                    <build-prerequisite/>
142
                    <compile-dependency/>
143
                    <run-dependency>
144
                        <specification-version>8.39</specification-version>
145
                    </run-dependency>
146
                </dependency>
147
                <dependency>
148
                    <code-name-base>org.openide.util.lookup</code-name-base>
149
                    <build-prerequisite/>
150
                    <compile-dependency/>
151
                    <run-dependency>
152
                        <specification-version>8.0</specification-version>
153
                    </run-dependency>
154
                </dependency>
155
            </module-dependencies>
156
            <test-dependencies>
157
                <test-type>
158
                    <name>unit</name>
159
                    <test-dependency>
160
                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
161
                        <compile-dependency/>
162
                    </test-dependency>
163
                    <test-dependency>
164
                        <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
165
                        <recursive/>
166
                        <compile-dependency/>
167
                    </test-dependency>
168
                    <test-dependency>
169
                        <code-name-base>org.openide.util.lookup</code-name-base>
170
                        <compile-dependency/>
171
                        <test/>
172
                    </test-dependency>                
173
                </test-type>
174
            </test-dependencies>            
175
            <public-packages>
176
                <package>org.netbeans.modules.maven.archetype.api</package>
177
            </public-packages>
178
        </data>
179
    </configuration>
180
</project>
(-)maven.archetype/src/org/netbeans/modules/maven/archetype/Bundle.properties (+43 lines)
Line 0 Link Here
1
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
#
3
# Copyright 2010 Oracle and/or its affiliates. All rights reserved.
4
#
5
# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6
# Other names may be trademarks of their respective owners.
7
#
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.  Oracle designates this
19
# particular file as subject to the "Classpath" exception as provided
20
# by Oracle 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]"
25
#
26
# If you wish your version of this file to be governed by only the CDDL
27
# or only the GPL Version 2, indicate your decision by adding
28
# "[Contributor] elects to include this software in this distribution
29
# under the [CDDL or GPL Version 2] license." If you do not indicate a
30
# single choice of license, a recipient has the option to distribute
31
# your version of this file under either the CDDL, the GPL Version 2 or
32
# to extend the choice of license to its licensees as provided above.
33
# However, if you add GPL Version 2 code and therefore, elected the GPL
34
# Version 2 license, then the option applies only if the new code is
35
# made subject to such option by the copyright holder.
36
#
37
# Contributor(s):
38
#
39
# Portions Copyrighted 2008 Sun Microsystems, Inc.
40
41
OpenIDE-Module-Display-Category=Maven
42
OpenIDE-Module-Name=Maven Archetype
43
OpenIDE-Module-Long-Description=Maven archetypes related API.
(-)maven.archetype/src/org/netbeans/modules/maven/archetype/api/Archetype.java (+397 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2008 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.maven.archetype.api;
44
45
import java.io.File;
46
import java.io.IOException;
47
import java.io.InputStream;
48
import java.util.Collections;
49
import java.util.HashMap;
50
import java.util.List;
51
import java.util.Map;
52
import java.util.jar.JarFile;
53
import java.util.logging.Level;
54
import java.util.logging.Logger;
55
import java.util.zip.ZipEntry;
56
import org.apache.maven.artifact.Artifact;
57
import org.apache.maven.artifact.handler.ArtifactHandler;
58
import org.apache.maven.artifact.repository.ArtifactRepository;
59
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
60
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
61
import org.apache.maven.repository.RepositorySystem;
62
import org.netbeans.api.annotations.common.NonNull;
63
import org.netbeans.api.progress.aggregate.AggregateProgressHandle;
64
import org.netbeans.modules.maven.embedder.EmbedderFactory;
65
import org.netbeans.modules.maven.embedder.MavenEmbedder;
66
import org.netbeans.modules.maven.embedder.exec.ProgressTransferListener;
67
import org.netbeans.modules.maven.indexer.api.RepositoryInfo;
68
import org.netbeans.modules.maven.indexer.api.RepositoryPreferences;
69
import org.openide.util.Exceptions;
70
import org.openide.util.Parameters;
71
import org.openide.xml.XMLUtil;
72
import org.w3c.dom.Document;
73
import org.w3c.dom.Element;
74
import org.w3c.dom.NodeList;
75
import org.xml.sax.InputSource;
76
import org.xml.sax.SAXException;
77
78
/**
79
 * Simple model class to describe a Maven archetype. To be created by ArchetypeProvider 
80
 * implementations, consumed by the New Maven Project wizard.
81
 * 
82
 * @author mkleint
83
 * @since 1.0
84
 */
85
public final class Archetype {
86
87
    private static final Logger LOG = Logger.getLogger(Archetype.class.getName());
88
    
89
    private final String artifactId;
90
    private final String groupId;
91
    private final String version;
92
    private final String name;
93
    private final String description;
94
    private final String repository;
95
    private Artifact artifact;
96
    private Artifact pomArtifact;
97
98
    /**
99
     * C'tor 
100
     * 
101
     * @param artifactId
102
     * @param groupId
103
     * @param version 
104
     * @since 1.0
105
     */
106
    public Archetype(String artifactId, String groupId, String version) {
107
        this(artifactId, groupId, version, null, null, null);
108
    }
109
    
110
    /**
111
     * C'tor 
112
     * 
113
     * @param artifactId 
114
     * @param groupId
115
     * @param version
116
     * @param name
117
     * @param description
118
     * @param repository
119
     * @since 1.0
120
     */
121
    public Archetype(String artifactId, String groupId, String version, String name, String description, String repository) {
122
        this.artifactId = artifactId;
123
        this.groupId = groupId;
124
        this.version = version;
125
        this.name = name;
126
        this.description = description;
127
        this.repository = repository;
128
    }
129
130
    /**
131
     * Returns the artifact id.
132
     * 
133
     * @return the artifact id
134
     * @since 1.0
135
     */
136
    public String getArtifactId() {
137
        return artifactId;
138
    }
139
    
140
    /**
141
     * Returns the group id.
142
     * 
143
     * @return the group id
144
     * @since 1.0
145
     */
146
    public String getGroupId() {
147
        return groupId;
148
    }
149
    
150
    /**
151
     * Returns the version.
152
     * 
153
     * @return the version
154
     * @since 1.0
155
     */
156
    public String getVersion() {
157
        return version;
158
    }
159
    
160
    /**
161
     * Returns the name.
162
     * 
163
     * @return the name
164
     * @since 1.0
165
     */
166
    public @NonNull String getName() {
167
        // #166884
168
        if ("${project.artifactId}".equals(name)) { //NOI18N
169
            return artifactId;
170
        }
171
        if (name == null || name.trim().length() == 0) {
172
            return artifactId;
173
        }
174
        return name;
175
    }
176
    
177
    /**
178
     * Returns the description. Is an optional property.
179
     * 
180
     * @return the description or <code>null</code> if none available
181
     * @since 1.0
182
     */
183
    public String getDescription() {
184
        return description;
185
    }
186
    
187
    /**
188
     * Returns the repository. Is an optional property.
189
     *
190
     * @return the repository or <code>null</code> if none available
191
     * @since 1.0
192
     */
193
    public String getRepository() {
194
        return repository;
195
    }
196
    
197
    /**
198
     * Initially non resolved artifact, need to call resolveArtifacts() before getArtifact().getFile() can be used.
199
     * 
200
     * @return the artifact
201
     * @since 1.0
202
     */
203
    public synchronized Artifact getArtifact() {
204
        if (artifact == null) {
205
            MavenEmbedder online = EmbedderFactory.getOnlineEmbedder();
206
            artifact = online.createArtifact(
207
                    getGroupId(),
208
                    getArtifactId(),
209
                    getVersion(),
210
                    "jar", //NOI18N
211
                    "maven-archetype"); //NOI18N
212
213
            //hack to get the right extension for the right packaging without the plugin.
214
            artifact.setArtifactHandler(new ArtifactHandler() {
215
                @Override
216
                public String getExtension() {
217
                    return "jar"; //NOI18N
218
                }
219
220
                @Override
221
                public String getDirectory() {
222
                    return null;
223
                }
224
225
                @Override
226
                public String getClassifier() {
227
                    return null;
228
                }
229
230
                @Override
231
                public String getPackaging() {
232
                    return "maven-archetype"; //NOI18N
233
                }
234
235
                @Override
236
                public boolean isIncludesDependencies() {
237
                    return false;
238
                }
239
240
                @Override
241
                public String getLanguage() {
242
                    return "java"; //NOI18N
243
                }
244
245
                @Override
246
                public boolean isAddedToClasspath() {
247
                    return false;
248
                }
249
            });
250
        }
251
        return artifact;
252
    }
253
254
    /**
255
     * Initially non resolved artifact, need to call resolveArtifacts() before getArtifact().getFile() can be used.
256
     *
257
     * @return the pom artifact
258
     * @since 1.0
259
     */
260
    public synchronized Artifact getPomArtifact() {
261
        if (pomArtifact == null) {
262
            MavenEmbedder online = EmbedderFactory.getOnlineEmbedder();
263
            pomArtifact = online.createArtifact(
264
                    getGroupId(),
265
                    getArtifactId(),
266
                    getVersion(),
267
                    "pom", //NOI18N
268
                    "pom"); //NOI18N
269
        }
270
        return pomArtifact;
271
    }
272
    
273
    /**
274
     * Resolve the artifacts associated with the archetype (ideally downloads them to the local repository)
275
     * 
276
     * @param hndl a progress handle
277
     * @throws ArtifactResolutionException
278
     * @throws ArtifactNotFoundException 
279
     */
280
    public void resolveArtifacts(AggregateProgressHandle hndl) throws ArtifactResolutionException, ArtifactNotFoundException {
281
        MavenEmbedder online = EmbedderFactory.getOnlineEmbedder();
282
        
283
        List<ArtifactRepository> repos;
284
        if (getRepository() == null) {
285
            repos = Collections.<ArtifactRepository>singletonList(online.createRemoteRepository(RepositorySystem.DEFAULT_REMOTE_REPO_URL, RepositorySystem.DEFAULT_REMOTE_REPO_ID));
286
        } else {
287
           repos = Collections.<ArtifactRepository>singletonList(online.createRemoteRepository(getRepository(), "custom-repo"));//NOI18N
288
           for (RepositoryInfo info : RepositoryPreferences.getInstance().getRepositoryInfos()) {
289
                if (getRepository().equals(info.getRepositoryUrl())) {
290
                    repos = Collections.<ArtifactRepository>singletonList(online.createRemoteRepository(getRepository(), info.getId()));//NOI18N
291
                    break;
292
                }
293
            }
294
        }
295
        try {
296
            ProgressTransferListener.setAggregateHandle(hndl);
297
            
298
            hndl.start();
299
300
//TODO how to rewrite to track progress?
301
//            try {
302
//                WagonManager wagon = online.getPlexusContainer().lookup(WagonManager.class);
303
//                wagon.setDownloadMonitor(new ProgressTransferListener());
304
//            } catch (ComponentLookupException ex) {
305
//                Exceptions.printStackTrace(ex);
306
//            }
307
            online.resolve(getPomArtifact(), repos, online.getLocalRepository());
308
            online.resolve(getArtifact(), repos, online.getLocalRepository());
309
        } catch (ThreadDeath d) { // download interrupted
310
        } catch (IllegalStateException ise) { //download interrupted in dependent thread. #213812
311
            if (!(ise.getCause() instanceof ThreadDeath)) {
312
                throw ise;
313
            }
314
        } finally {
315
            ProgressTransferListener.clearAggregateHandle();
316
            hndl.finish();
317
        }
318
    } 
319
    
320
    /**
321
     * Parses the META-INF/maven/archetype-metadata.xml file within the archetype's jar
322
     * to get the additional required properties. Assumes resolveArtifacts() was called beforehand
323
     * 
324
     * @return required property name as key and default value as map value
325
     * @since 1.0
326
     */
327
    public Map<String, String> loadRequiredProperties() {
328
        HashMap<String, String> map = new HashMap<String, String>();
329
        File fil = getArtifact().getFile();
330
        assert fil != null : "requires a resolved artifact";
331
        JarFile jf = null;
332
        try {
333
            jf = new JarFile(fil);
334
            ZipEntry entry = jf.getJarEntry("META-INF/maven/archetype-metadata.xml");
335
            if (entry == null) {
336
                entry = jf.getJarEntry("META-INF/maven/archetype.xml");
337
            }
338
            if (entry != null) {
339
                InputStream in = jf.getInputStream(entry);
340
                try {
341
                    Document doc = XMLUtil.parse(new InputSource(in), false, false, XMLUtil.defaultErrorHandler(), null);
342
                    NodeList nl = doc.getElementsByTagName("requiredProperty");
343
                    for (int i = 0; i < nl.getLength(); i++) {
344
                        Element rP = (Element) nl.item(i);
345
                        Element dV = XMLUtil.findElement(rP, "defaultValue", null);
346
                        map.put(rP.getAttribute("key"), dV != null ? XMLUtil.findText(dV) : null);
347
                    }
348
                } finally {
349
                    in.close();
350
                }
351
            }
352
        } catch (IOException ex) {
353
            LOG.log(Level.INFO, ex.getMessage(), ex);
354
        } catch (SAXException ex) {
355
            LOG.log(Level.INFO, ex.getMessage(), ex);
356
        } finally {
357
            if (jf != null) {
358
                try {
359
                    jf.close();
360
                } catch (IOException ex) {
361
                    Exceptions.printStackTrace(ex);
362
                }
363
            }
364
        }
365
        return map;
366
    }
367
    
368
    
369
    @Override
370
    public int hashCode() {
371
        return getGroupId().trim().hashCode() + 13 * getArtifactId().trim().hashCode() + 23 * getVersion().trim().hashCode();
372
    }
373
    
374
    @Override
375
    public boolean equals(Object obj) {
376
        if (!(obj instanceof Archetype)) {
377
            return false;
378
        }
379
        Archetype ar1 = (Archetype)obj;
380
        boolean gr = ar1.getGroupId().trim().equals(getGroupId().trim());
381
        if (!gr) {
382
            return false;
383
        }
384
        boolean ar = ar1.getArtifactId().trim().equals(getArtifactId().trim());
385
        if (!ar) {
386
            return false;
387
        }
388
        boolean ver =  ar1.getVersion().trim().equals(getVersion().trim());
389
        return ver;
390
    }
391
392
    @Override 
393
    public String toString() {
394
        return groupId + ":" + artifactId + ":" + version;
395
    }
396
397
}
(-)maven.archetype/src/org/netbeans/modules/maven/archetype/api/ArchetypeProvider.java (+68 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2008 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.maven.archetype.api;
44
45
import java.util.List;
46
47
/**
48
 * Componentized provider of list of available archetypes.
49
 * It is used in New Maven project wizard to populate the list of available archetypes.
50
 * The providers are expected to be registered using {@link org.openide.util.lookup.ServiceProvider}.
51
 * There are 3 default implementations registered: One lists 1 basic archetype
52
 * (simple and the other lists all archetypes it find in local and remote repository indexes.
53
 * <p>For special archetypes to be visible in the UI, use {@link ArchetypeWizards#definedArchetype}.
54
 * 
55
 * @author mkleint
56
 * @since 1.0
57
 */
58
public interface ArchetypeProvider {
59
60
    /**
61
     * Returns Archetype instances known to this provider. Is called once per
62
     * New Maven Project wizard invocation.
63
     *
64
     * @return list of archetypes
65
     * @since 1.0
66
     */
67
    List<Archetype> getArchetypes();
68
}
(-)maven.archetype/src/org/netbeans/modules/maven/archetype/api/ArchetypeWizards.java (+244 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.maven.archetype.api;
44
45
import java.io.File;
46
import java.io.IOException;
47
import java.util.Map;
48
import java.util.Set;
49
import org.netbeans.api.annotations.common.NullAllowed;
50
import org.netbeans.api.templates.TemplateRegistration;
51
import org.netbeans.modules.maven.model.ModelOperation;
52
import org.netbeans.modules.maven.model.pom.POMModel;
53
import org.netbeans.validation.api.ui.ValidationGroup;
54
import org.openide.WizardDescriptor;
55
import org.openide.filesystems.FileObject;
56
import org.openide.util.Lookup;
57
58
/**
59
 * Utilities for creating New Project wizards based on maven-archetype-plugin.
60
 *
61
 * @author mkleint
62
 * @since 1.0
63
 */
64
public class ArchetypeWizards {
65
    
66
    private static final MavenArchetypeProvider wizardProvider = Lookup.getDefault().lookup(MavenArchetypeProvider.class);;
67
68
    private ArchetypeWizards() { }
69
70
    /**
71
     * Provides functionality necessary for the archetype ArchetypeWizards api.
72
     * 
73
     * <b>Note</b> that this is meant for internal use only.
74
     * 
75
     * @author Tomas Stupka
76
     * @since 1.0
77
     */
78
    public static abstract class MavenArchetypeProvider {
79
80
        /**
81
         * Run a single archetype.
82
         * 
83
         * @param projDir
84
         * @param vi
85
         * @param arch
86
         * @param additionalProperties
87
         * @param updateLastUsedProjectDir
88
         * @throws IOException 
89
         * @since 1.0
90
         * @see ArchetypeWizards#createFromArchetype(java.io.File, org.netbeans.modules.maven.archetype.api.ProjectInfo, org.netbeans.modules.maven.archetype.api.Archetype, java.util.Map, boolean) 
91
         */
92
        protected abstract void createFromArchetype(File projDir, ProjectInfo vi, Archetype arch, @NullAllowed Map<String,String> additionalProperties, boolean updateLastUsedProjectDir) throws IOException;
93
94
        /**
95
         * Opens newly created Maven projects.
96
         * 
97
         * @param dirF
98
         * @param mainProjectDir
99
         * @return
100
         * @throws IOException 
101
         * @since 1.0
102
         * @see ArchetypeWizards#openProjects(java.io.File, java.io.File) 
103
         */
104
        protected abstract Set<FileObject> openProjects(File dirF, File mainProjectDir) throws IOException;
105
106
        /**
107
         * Log new project usage.
108
         * 
109
         * @param groupId
110
         * @param artifactId
111
         * @param version 
112
         * @since 1.0
113
         * @see ArchetypeWizards#logUsage(java.lang.String, java.lang.String, java.lang.String) 
114
         */
115
        protected abstract void logUsage(String groupId, String artifactId, String version);
116
117
        /**
118
         * Adds a dependency operation.
119
         * 
120
         * @param info
121
         * @param type
122
         * @return 
123
         * @since 1.0
124
         * @see ArchetypeWizards#addDependencyOperation(org.netbeans.modules.maven.archetype.api.ProjectInfo, java.lang.String) 
125
         */
126
        protected abstract ModelOperation<POMModel> addDependencyOperation(ProjectInfo info, String type);
127
128
        /**
129
         * Creates the basic panel for a new project wizard.
130
         * 
131
         * @param vg
132
         * @param isFinish
133
         * @param archetype
134
         * @return 
135
         * @since 1.0
136
         * @see ArchetypeWizards#createBasicWizardPanel(org.netbeans.validation.api.ui.ValidationGroup, boolean, org.netbeans.modules.maven.archetype.api.Archetype) 
137
         */
138
        protected abstract WizardDescriptor.Panel<WizardDescriptor> createBasicWizardPanel(ValidationGroup vg, boolean isFinish, @NullAllowed Archetype archetype);
139
140
        /**
141
         * Wizard iterator using a predetermined archetype.
142
         * 
143
         * @param groupId
144
         * @param artifactId
145
         * @param version
146
         * @param repository
147
         * @param title
148
         * @return 
149
         * @since 1.0
150
         * @see ArchetypeWizards#createDefinedArchetype(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) 
151
         */
152
        protected abstract WizardDescriptor.InstantiatingIterator<?> createDefinedArchetype(String groupId, String artifactId, String version, @NullAllowed String repository, String title);
153
    }
154
    
155
    /**
156
     * Customary location of Maven project templates.
157
     * @since 1.0
158
     * @see TemplateRegistration#folder
159
     */
160
    public static final String TEMPLATE_FOLDER = "Project/Maven2";
161
162
    /**
163
     * Run a single archetype.
164
     * 
165
     * @param projDir the new project directory (must be normalized first!) (note: parent dir is actually passed to plugin, i.e. assumes that project name matches this basedir)
166
     * @param vi metadata for new project
167
     * @param arch the archetype to process
168
     * @param additionalProperties any additional archetype properties, or null
169
     * @param updateLastUsedProjectDir true to update last-used project directory for next wizard run
170
     * @since 1.0
171
     * @throws java.io.IOException
172
     */
173
    public static void createFromArchetype(File projDir, ProjectInfo vi, Archetype arch, @NullAllowed Map<String,String> additionalProperties, boolean updateLastUsedProjectDir) throws IOException {
174
        wizardProvider.createFromArchetype(projDir, vi, arch, additionalProperties, updateLastUsedProjectDir);
175
    }
176
177
    /**
178
     * Opens newly created Maven projects.
179
     * 
180
     * @param dirF the top-level dir to check in
181
     * @param mainProjectDir the dir containing the main project, or null
182
     * @return set of project directories
183
     * @since 1.0
184
     * @throws java.io.IOException
185
     */
186
    public static Set<FileObject> openProjects(File dirF, File mainProjectDir) throws IOException {
187
        return wizardProvider.openProjects(dirF, mainProjectDir);
188
    }
189
190
    /**
191
     * Log new project usage.
192
     * 
193
     * @param groupId
194
     * @param artifactId
195
     * @param version
196
     * @since 1.0
197
     */
198
    public static void logUsage(String groupId, String artifactId, String version) {
199
        wizardProvider.logUsage(groupId, artifactId, version);
200
    }
201
202
    /**
203
     * Adds a dependency operation.
204
     * 
205
     * @param info project info
206
     * @param type dependency type
207
     * @return an dependency operation
208
     * @since 1.0
209
     */
210
    public static ModelOperation<POMModel> addDependencyOperation(ProjectInfo info, String type) {
211
        return wizardProvider.addDependencyOperation(info, type);
212
    }
213
214
    /**
215
     * Creates the basic panel for a new project wizard.
216
     * 
217
     * @param vg validation group
218
     * @param isFinish determines whether the panel will have the finish button
219
     * @param archetype the archetype to create a project from
220
     * @return a wizard panel
221
     * @since 1.0
222
     */
223
    public static WizardDescriptor.Panel<WizardDescriptor> createBasicWizardPanel(ValidationGroup vg, boolean isFinish, @NullAllowed Archetype archetype) {
224
        return wizardProvider.createBasicWizardPanel(vg, isFinish, archetype);
225
    }
226
227
    /**
228
     * Wizard iterator using a predetermined archetype.
229
     * 
230
     * @param groupId
231
     * @param artifactId
232
     * @param version
233
     * @param repository
234
     * @param title
235
     * @return a wizard iterators
236
     * @since 1.0
237
     * @see TemplateRegistration
238
     * @see #TEMPLATE_FOLDER
239
     */
240
    public static WizardDescriptor.InstantiatingIterator<?> createDefinedArchetype(String groupId, String artifactId, String version, @NullAllowed String repository, String title) {
241
        return wizardProvider.createDefinedArchetype(groupId, artifactId, version, repository, title);
242
    }
243
244
}
(-)maven.archetype/src/org/netbeans/modules/maven/archetype/api/ProjectInfo.java (+116 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2009 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.maven.archetype.api;
44
45
import org.openide.util.Parameters;
46
47
/**
48
 * Information about one project to be created.
49
 * 
50
 * @author mkleint
51
 * @since 1.0
52
 */
53
public final class ProjectInfo {
54
    
55
    private final String groupId;
56
    private final String artifactId;
57
    private final String version;
58
    private final String packageName;
59
    
60
    /**
61
     * C'tor
62
     * 
63
     * @param groupId the group id
64
     * @param artifactId the artifact id
65
     * @param version the version 
66
     * @param packageName the package name
67
     * @since 1.0
68
     */
69
    public ProjectInfo(String groupId, String artifactId, String version, String packageName) {
70
        this.groupId = groupId;
71
        this.artifactId = artifactId;
72
        this.version = version;
73
        this.packageName = packageName;
74
    }
75
76
    /**
77
     * Returns the group id.
78
     * 
79
     * @return 
80
     * @since 1.0
81
     */
82
    public String getGroupId() {
83
        return groupId;
84
    }
85
86
    /**
87
     * Returns the artifact id.
88
     * 
89
     * @return 
90
     * @since 1.0
91
     */
92
    public String getArtifactId() {
93
        return artifactId;
94
    }
95
96
    /**
97
     * Returns the version.
98
     * 
99
     * @return 
100
     * @since 1.0
101
     */
102
    public String getVersion() {
103
        return version;
104
    }
105
106
    /**
107
     * Returns the package name.
108
     * 
109
     * @return 
110
     * @since 1.0
111
     */
112
    public String getPackageName() {
113
        return packageName;
114
    }
115
    
116
}
(-)maven.archetype/test/unit/src/org/netbeans/modules/maven/archetype/api/ArchetypeTest.java (+96 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.maven.archetype.api;
44
45
import org.netbeans.junit.NbTestCase;
46
47
public class ArchetypeTest extends NbTestCase {
48
49
    public ArchetypeTest(String n) {
50
        super(n);
51
    }
52
53
    public void testArchetype() {
54
        Archetype a = new Archetype("aid", "gid", "1.0");
55
        
56
        assertEquals("aid", a.getArtifactId());
57
        assertEquals("gid", a.getGroupId());
58
        assertEquals("1.0", a.getVersion());
59
        assertEquals("aid", a.getName());
60
        assertNull(a.getDescription());
61
        assertNull(a.getRepository());
62
        
63
        Archetype a2 = new Archetype("aid", "gid", "1.0");
64
        assertEquals(a, a2);
65
        assertEquals(a.hashCode(), a2.hashCode());
66
        
67
        a = new Archetype("aid", "gid", "1.0", "test", "test desc", "test repository");
68
        
69
        assertEquals("aid", a.getArtifactId());
70
        assertEquals("gid", a.getGroupId());
71
        assertEquals("1.0", a.getVersion());
72
        assertEquals("test", a.getName());
73
        assertEquals("test desc", a.getDescription());
74
        assertEquals("test repository", a.getRepository());
75
76
        a2 = new Archetype("aid", "gid", "1.0", "test", "test desc", "test repository");
77
        assertEquals(a, a2);
78
        assertEquals(a.hashCode(), a2.hashCode());
79
        
80
    }
81
    
82
    public void testGetName() {
83
        Archetype a = new Archetype("aid", "gid", "1.0");
84
        assertEquals("aid", a.getName());
85
        
86
        a = new Archetype("aid", "gid", "1.0", null, null, null);
87
        assertEquals("aid", a.getName());
88
        
89
        a = new Archetype("aid", "gid", "1.0", "${project.artifactId}", null, null);
90
        assertEquals("aid", a.getName());
91
92
        a = new Archetype("aid", "gid", "1.0", "test name", null, null);
93
        assertEquals("test name", a.getName());
94
    }
95
    
96
}
(-)maven.archetype/test/unit/src/org/netbeans/modules/maven/archetype/api/ArchetypeWizardTest.java (+172 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.maven.archetype.api;
44
45
import java.io.File;
46
import java.io.IOException;
47
import java.util.Arrays;
48
import java.util.HashMap;
49
import java.util.List;
50
import java.util.Map;
51
import java.util.Set;
52
import org.netbeans.junit.NbTestCase;
53
import org.netbeans.modules.maven.archetype.api.ArchetypeWizards.MavenArchetypeProvider;
54
import org.netbeans.modules.maven.model.ModelOperation;
55
import org.netbeans.modules.maven.model.pom.POMModel;
56
import org.netbeans.validation.api.Problem;
57
import org.netbeans.validation.api.ui.ValidationGroup;
58
import org.netbeans.validation.api.ui.ValidationUI;
59
import org.openide.WizardDescriptor;
60
import org.openide.filesystems.FileObject;
61
import org.openide.util.test.MockLookup;
62
63
public class ArchetypeWizardTest extends NbTestCase {
64
65
    public ArchetypeWizardTest(String n) {
66
        super(n);
67
    }
68
69
    @Override
70
    protected void setUp() throws Exception {
71
        MockLookup.setInstances(new TestMavenArchetypeProvider());
72
    }
73
74
    public void testMavenArchetypeProviderDelegate() throws IOException {
75
        
76
        ProjectInfo pi = new ProjectInfo("gid", "aid", "1.0", "package.name");
77
        String type = "jar";
78
        ArchetypeWizards.addDependencyOperation(pi, type);
79
        List<Object> l = TestMavenArchetypeProvider.calls.get("addDependencyOperation");
80
        assertNotNull(l);
81
        assertEquals(pi, l.get(0));
82
        assertEquals(type, l.get(1));
83
        
84
        Archetype a = new Archetype("aid", "gid", "1.0");
85
        ValidationGroup vg = ValidationGroup.create(new ValidationUI() {
86
            @Override public void showProblem(Problem prblm) { }
87
            @Override public void clearProblem() { }
88
        });
89
        ArchetypeWizards.createBasicWizardPanel(vg, true, a);
90
        l = TestMavenArchetypeProvider.calls.get("createBasicWizardPanel");
91
        assertNotNull(l);
92
        assertEquals(vg, l.get(0));
93
        assertEquals(true, l.get(1));
94
        assertEquals(a, l.get(2));
95
        
96
        String gid = "gid";
97
        String aid = "aid";
98
        String ver = "1.0";
99
        String repo = "repo";
100
        String title = "title";
101
        ArchetypeWizards.createDefinedArchetype(gid, aid, ver, repo, title);
102
        l = TestMavenArchetypeProvider.calls.get("createDefinedArchetype");
103
        assertNotNull(l);
104
        assertEquals(gid, l.get(0));
105
        assertEquals(aid, l.get(1));
106
        assertEquals(ver, l.get(2));
107
        assertEquals(repo, l.get(3));
108
        assertEquals(title, l.get(4));
109
        
110
        File f = getWorkDir();
111
        
112
        Map m = new HashMap();
113
        ArchetypeWizards.createFromArchetype(f, pi, a, m, true);
114
        l = TestMavenArchetypeProvider.calls.get("createFromArchetype");
115
        assertNotNull(l);
116
        assertEquals(f, l.get(0));
117
        assertEquals(pi, l.get(1));
118
        assertEquals(a, l.get(2));
119
        assertEquals(m, l.get(3));
120
        assertEquals(true, l.get(4));
121
        
122
        ArchetypeWizards.logUsage(gid, aid, ver);
123
        l = TestMavenArchetypeProvider.calls.get("logUsage");
124
        assertNotNull(l);
125
        assertEquals(gid, l.get(0));
126
        assertEquals(aid, l.get(1));
127
        assertEquals(ver, l.get(2));
128
        
129
        File f1 = new File(getWorkDir(), "f1");
130
        File f2 = new File(getWorkDir(), "f2");
131
        ArchetypeWizards.openProjects(f1, f2);
132
        l = TestMavenArchetypeProvider.calls.get("openProjects");
133
        assertNotNull(l);
134
        assertEquals(f1, l.get(0));
135
        assertEquals(f2, l.get(1));
136
    }
137
    
138
    private static class TestMavenArchetypeProvider extends MavenArchetypeProvider {
139
140
        static Map<Object, List<Object>> calls = new HashMap<Object, List<Object>>();
141
        
142
        public void createFromArchetype(File projDir, ProjectInfo vi, Archetype arch, Map<String, String> additionalProperties, boolean updateLastUsedProjectDir) throws IOException {
143
            calls.put("createFromArchetype", Arrays.asList(projDir, vi, arch, additionalProperties, updateLastUsedProjectDir));
144
        }
145
146
        @Override
147
        public Set<FileObject> openProjects(File dirF, File mainProjectDir) throws IOException {
148
            calls.put("openProjects", Arrays.asList((Object) dirF, mainProjectDir));
149
            return null;
150
        }
151
152
        public void logUsage(String groupId, String artifactId, String version) {
153
            calls.put("logUsage", Arrays.asList((Object) groupId, artifactId, version));
154
        }
155
156
        public ModelOperation<POMModel> addDependencyOperation(ProjectInfo info, String type) {
157
            calls.put("addDependencyOperation", Arrays.asList(info, type));
158
            return null;
159
        }
160
161
        public WizardDescriptor.Panel<WizardDescriptor> createBasicWizardPanel(ValidationGroup vg, boolean isFinish, Archetype archetype) {
162
            calls.put("createBasicWizardPanel", Arrays.asList(vg, isFinish, archetype));
163
            return null;
164
        }
165
166
        public WizardDescriptor.InstantiatingIterator<?> createDefinedArchetype(String groupId, String artifactId, String version, String repository, String title) {
167
            calls.put("createDefinedArchetype", Arrays.asList((Object)groupId, artifactId, version, repository, title));
168
            return null;
169
        }
170
171
    }
172
}
(-)maven.archetype/test/unit/src/org/netbeans/modules/maven/archetype/api/ProjectInfoTest.java (+62 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.maven.archetype.api;
44
45
import org.netbeans.junit.NbTestCase;
46
47
public class ProjectInfoTest extends NbTestCase {
48
49
    public ProjectInfoTest(String n) {
50
        super(n);
51
    }
52
53
    public void testProjectInfo() {
54
        ProjectInfo pi = new ProjectInfo("gid", "aid", "1.0", "package.name");
55
        assertEquals("gid", pi.getGroupId());
56
        assertEquals("aid", pi.getArtifactId());
57
        assertEquals("1.0", pi.getVersion());
58
        assertEquals("package.name", pi.getPackageName());
59
    }
60
    
61
62
}

Return to bug 245153