1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
|
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE- 2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<!-- generateKeywords macro -->
<META name="description" content="Apache Tuscany">
<META name="keywords" content="apache, apache tuscany, tuscany, service, services, fabric, soa, service oriented architecture, sca, service component architecture, das, sdo, csa, ruby, opensource">
<!-- generateKeywords macro end -->
<LINK type="text/css" rel="stylesheet" href="http://tuscany.apache.org/stylesheets/default.css">
<LINK rel="SHORTCUT ICON" href="https://cwiki.apache.org/confluence/display/TUSCANY/$images/favicon.ico">
<TITLE>Apache Tuscany : SCA Java Development Guide</TITLE>
<META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
<BODY onload="init()">
<!-- topNav macro -->
<TABLE valign="top" border="0" cellspacing="0" cellpadding="0" width="100%" background="http://tuscany.apache.org/images/TuscanyLogoNEW_Text_120px_bg.jpg">
<TR>
<TD valing="top" align="left">
<A href="https://cwiki.apache.org/confluence/pages/viewpage.action?spaceKey=TUSCANY&title=$siteroot"><IMG src="http://tuscany.apache.org/images/TuscanyLogoNEW_Text_120px_bg.jpg" height="91" width="25" border="0"></A>
</TD>
<TD>
<A href="http://tuscany.apache.org/"><IMG src="http://tuscany.apache.org/images/TuscanyLogo.jpg" border="0"></A>
</TD>
<TD width="100%">
</TD>
<!-- Adds the edit page link to the top banner-->
<TD valign="bottom">
<DIV style="padding: 2px 10px; margin: 0px;">
<A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=47570">
<IMG src="http://tuscany.apache.org/images/notep_16.gif" height="16" width="16" border="0" align="absmiddle" title="Edit Page"></A>
</DIV>
</TD>
</TR>
</TABLE>
<!-- topNav macro end -->
<!-- breadCrumbs macro -->
<TABLE border="0" cellpadding="2" cellspacing="0" width="100%">
<TR class="topBar">
<TD align="left" valign="middle" class="topBarDiv" nowrap="true" width="100%">
<A href="home.html" title="Apache Tuscany">Apache Tuscany</A> > <A href="home.html" title="Home">Home</A> > <A href="sca-overview.html" title="SCA Overview">SCA Overview</A> > <A href="sca-java.html" title="SCA Java">SCA Java</A> > <A href="java-sca-documentation-menu.html" title="Java SCA Documentation Menu">Java SCA Documentation Menu</A> > <A href="" title="SCA Java Development Guide">SCA Java Development Guide</A>
</TD>
<TD align="right" valign="middle" class="topBarDiv" align="left" nowrap="true">
<A href="http://mail-archives.apache.org/mod_mbox/tuscany-user">User List</A> | <A href="http://mail-archives.apache.org/mod_mbox/tuscany-dev">Dev List</A> | <A href="http://issues.apache.org/jira/browse/Tuscany">Issue Tracker</A>
</TD>
</TR>
</TABLE>
<!-- breadCrumbs macro end -->
<TABLE border="0" cellpadding="0" width="100%" bgcolor="#FFFFFF">
<TR>
<TD align="left" valign="top">
<!-- pageContent macro -->
<DIV id="PageContent">
<DIV class="pagecontent">
<DIV class="wiki-content">
<TABLE class="sectionMacroWithBorder" border="0" cellpadding="5" cellspacing="0" width="100%"><TBODY><TR>
<TD class="confluenceTd" valign="top" width="15%">
<DIV class="panel" style="background-color: #ECF4D1;border-color: #C3CDA1;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #C3CDA1;background-color: #C3CDA1;"><B>General</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="home.html" title="Home">Home</A><BR>
<A href="http://www.apache.org/licenses/LICENSE-2.0.html" class="external-link" rel="nofollow">License </A><BR>
<A href="sca-java-get-involved.html" title="SCA Java Get Involved">Get Involved</A><BR>
<A href="sca-java-found-a-bug.html" title="SCA Java Found A Bug">Found a Bug?</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>SCA Java</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="sca-java.html" title="SCA Java">SCA Java Home</A><BR>
<A href="tuscany-dashboard.html" title="Tuscany Dashboard">SCA Dashboard</A><BR>
<A href="java-sca-tools.html" title="Java SCA Tools">Tools </A><BR>
<A href="tuscany-sca-java-faq.html" title="Tuscany SCA Java - FAQ">FAQ</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>SCA Java 1.x</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="sca-java-releases.html" title="SCA Java Releases">Downloads</A><BR>
<A href="java-sca-documentation-menu.html" title="Java SCA Documentation Menu">Documentation</A><BR>
<A href="https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/" class="external-link" rel="nofollow">1.x Source Code</A><BR>
<A href="http://tinyurl.com/8rlxd3" class="external-link" rel="nofollow">Roadmap</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>SCA Java 2.x</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="sca-java-2x-releases.html" title="SCA Java 2.x Releases">Downloads</A><BR>
<A href="http://tuscany.apache.org/documentation-2x/" class="external-link" rel="nofollow">Documentation</A><BR>
<A href="https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/" class="external-link" rel="nofollow">2.x Source Code</A><BR>
<A href="http://tinyurl.com/8rlxd3" class="external-link" rel="nofollow">Roadmap</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>Documentation</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="sca-java-user-guide.html" title="SCA Java User Guide">User Guide</A><BR>
<A href="sca-java-architecture-guide.html" title="SCA Java Architecture Guide">Architecture Guide</A><BR>
<A href="" title="SCA Java Development Guide">Developer Guide</A><BR>
<A href="sca-java-extension-development-guide.html" title="SCA Java Extension Development Guide">Extension Developer Guide</A></P>
</DIV></DIV>
<DIV class="panel" style="background-color: #ECF4D1;border-color: #b4b4b5;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #b4b4b5;background-color: #C3CDA1;"><B>Resources</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="tuscany-sca-java-faq.html" title="Tuscany SCA Java - FAQ">FAQ</A><BR>
<A href="https://svn.apache.org/repos/asf/incubator/tuscany/java/sca" class="external-link" rel="nofollow">Source Code</A></P>
</DIV></DIV>
</TD>
<TD class="confluenceTd" valign="top" width="85%">
<DIV class="panel" style="background-color: #ECF4D1;border-color: #C3CDA1;border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #C3CDA1;background-color: #C3CDA1;"><B>How to get involved in development of Java SCA?</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P>This document is the development guideline for SCA Java project.</P>
<UL>
<LI><A href="#SCAJavaDevelopmentGuide-GeneralGuide">General Guide</A></LI>
<LI><A href="#SCAJavaDevelopmentGuide-GettingSource">Getting Source code</A></LI>
<LI><A href="#SCAJavaDevelopmentGuide-Setup">Setting up your development environment</A></LI>
<LI><A href="#SCAJavaDevelopmentGuide-Distributions">Building the binary and source distributions</A></LI>
<LI><A href="#SCAJavaDevelopmentGuide-IDE">Importing SCA modules into your Development IDE</A></LI>
<LI><A href="#SCAJavaDevelopmentGuide-CodePath">Understanding SCA Code Path</A></LI>
<LI><A href="#SCAJavaDevelopmentGuide-CodingGuidelines">Coding Guidelines</A></LI>
<LI><A href="#SCAJavaDevelopmentGuide-Testing">Testing</A></LI>
<LI><A href="#SCAJavaDevelopmentGuide-MavenBuildStructure">Maven Build Structure</A></LI>
<LI><A href="#SCAJavaDevelopmentGuide-Providingpatches">Reporting Issues and Providing patches</A></LI>
<LI><B>Development Hints</B>
<UL>
<LI><A href="#SCAJavaDevelopmentGuide-WebappinEclipse">Generating Eclipse WTP Web Projects for Webapp samples</A></LI>
<LI><A href="#SCAJavaDevelopmentGuide-Ant">Generating Dependencies for Ant in Samples</A></LI>
</UL>
</LI>
<LI><A href="#SCAJavaDevelopmentGuide-ReleaseChecklist">How to do a release of Tuscany? </A></LI>
<LI><A href="http://cwiki.apache.org/confluence/display/TUSCANY/Logging,%20Tracing,%20and%20Timing%20in%20Tuscany" class="external-link" rel="nofollow">Logging, Tracing, and Timing in Tuscany</A></LI>
</UL>
<P><BR class="atl-forced-newline">
</P>
</DIV></DIV>
<H3><A name="SCAJavaDevelopmentGuide-GeneralGuide"></A><A name="SCAJavaDevelopmentGuide-GeneralGuide"></A> General Guide</H3>
<P>Welcome to the Tuscany SCA Java subproject project. We look forward to your participation and try to help you get on board. Feel free to ask your questions on the mailing list.</P>
<P>Here are some general guidelines we use in this project.</P>
<UL>
<LI>Java SCA sub-project aims to provide enterprise-grade service infrastructure based on SCA.</LI>
<LI>Tuscany SCA is not just a reference implementation. We encourage innovation based on the tenets of SCA. A lot of work we do provides feedback to the specifications.</LI>
<LI>The Java SCA infrastructure should provide flexibility and choice. It should not dictate programming models but support many.</LI>
<LI>The Java SCA infrastructure is very modularized and is designed to be highly extensible so users can customize it to fit their needs.</LI>
</UL>
<H3><A name="SCAJavaDevelopmentGuide-Prerequisites"></A><A name="SCAJavaDevelopmentGuide-Prerequisites"></A> Prerequisites</H3>
<P>Java SCA requires the following:</P>
<UL>
<LI><A href="http://java.sun.com/j2se/1.5.0" class="external-link" rel="nofollow">JDK 5.0+ (J2SE 1.5.0+)</A></LI>
<LI><A href="http://maven.apache.org/" class="external-link" rel="nofollow">Apache Maven (2.0.7+)</A></LI>
<LI><A href="http://subversion.tigris.org/" class="external-link" rel="nofollow">Subversion (1.2+)</A> or <A href="http://tortoisesvn.tigris.org/" class="external-link" rel="nofollow">TortoiseSVN (1.4.x+)</A></LI>
</UL>
<H3><A name="SCAJavaDevelopmentGuide-GettingSourcecode"></A><A name="SCAJavaDevelopmentGuide-GettingSource"></A> Getting Source code</H3>
<P>The Java SCA project Subversion repository is located at <A href="https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/" class="external-link" rel="nofollow">https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/</A>.<BR>
The repository can also be viewed online at <A href="http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/" class="external-link" rel="nofollow">http://svn.apache.org/viewvc/tuscany/sca-java-1.x/trunk/</A></P>
<P>Anyone can check code out of Subversion. You only need to specify a username and password in order to update the Subversion repository, and only Tuscany committers have the permissions to do so.</P>
<H4><A name="SCAJavaDevelopmentGuide-CheckingoutcodefromSubversion"></A>Checking out code from Subversion</H4>
<P>Use the command as follows (note that it uses http scheme so if you're a committer change it to https):</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
svn checkout http:<SPAN class="code-comment">//svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/ sca-java-1.x</SPAN>
</PRE>
</DIV></DIV>
<H4><A name="SCAJavaDevelopmentGuide-CommittingChangestoSubversion"></A>Committing Changes to Subversion</H4>
<P>Any Tuscany committer should have a shell account on svn.apache.org. Before you can commit, you'll need to set a Subversion password for yourself. To do that, log in to svn.apache.org and run the command svnpasswd.</P>
<P>Tuscany committers should configure these properties in the svn per-user config. On Unix-like systems, this area appears as a directory named .subversion in the user's home directory. On Win32 systems, Subversion creates a folder named Subversion, typically inside the Application Data area of the user's profile directory (C:\Documents and Settings\<user name>\Application Data\Subversion, which, by the way, is usually a hidden directory). </P>
<P>Please make sure the following properties are set in the "config" file:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
[miscellany]
...
enable-auto-props = yes
[auto-props]
### The format of the entries is:
### file-name-pattern = propname[=value][;propname[=value]...]
### The file-name-pattern can contain wildcards (such as '*' and
### '?'). All entries which match will be applied to the file.
### Note that auto-props functionality must be enabled, which
### is typically done by setting the 'enable-auto-props' option.
*.c = svn:eol-style=<SPAN class="code-keyword">native</SPAN>
*.cpp = svn:eol-style=<SPAN class="code-keyword">native</SPAN>
*.h = svn:eol-style=<SPAN class="code-keyword">native</SPAN>
*.dsp = svn:eol-style=CRLF
*.dsw = svn:eol-style=CRLF
*.sh = svn:eol-style=<SPAN class="code-keyword">native</SPAN>;svn:executable
*.txt = svn:eol-style=<SPAN class="code-keyword">native</SPAN>
*.png = svn:mime-type=image/png
*.jpg = svn:mime-type=image/jpeg
Makefile = svn:eol-style=<SPAN class="code-keyword">native</SPAN>
*.java = svn:eol-style=<SPAN class="code-keyword">native</SPAN>;svn:keywords=Rev Date
*.xml = svn:eol-style=<SPAN class="code-keyword">native</SPAN>;svn:keywords=Rev Date
*.xsd = svn:eol-style=<SPAN class="code-keyword">native</SPAN>;svn:keywords=Rev Date
*.html = svn:eol-style=<SPAN class="code-keyword">native</SPAN>;svn:keywords=Rev Date
*.properties = svn:eol-style=<SPAN class="code-keyword">native</SPAN>;svn:keywords=Rev Date
*.jelly = svn:eol-style=<SPAN class="code-keyword">native</SPAN>;svn:keywords=Rev Date
*.ipr = svn:eol-style=<SPAN class="code-keyword">native</SPAN>
*.iml = svn:eol-style=<SPAN class="code-keyword">native</SPAN>
</PRE>
</DIV></DIV>
<P>Once your password is set, you can use a command like this to commit:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
svn commit
</PRE>
</DIV></DIV>
<P>If Subversion can't figure out your username, you can tell it explicitly:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
svn --username <name> commit
</PRE>
</DIV></DIV>
<P>Subversion will prompt you for a password, and once you've entered it, it will remember it for you. Note this is the password you configured with svnpasswd not your shell or other password.</P>
<H3><A name="SCAJavaDevelopmentGuide-SettingupyourDevelopmentEnvironment"></A><A name="SCAJavaDevelopmentGuide-Setup"></A> Setting up your Development Environment</H3>
<H4><A name="SCAJavaDevelopmentGuide-Buildtreestructure"></A>Build tree structure</H4>
<P>The build tree is designed to facilitate modular development and releases. Maven modules are grouped by how they are released under an hierarchy. Java SCA currently have the below module hierarchy :</P>
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>-java
|-- sca
|-- demos SCA demo applications
|-- distribution SCA distributions
|-- itest SCA Integration Tests
|-- modules SCA Implementation Modules (core, runtimes, contribution, extensions, etc)
|-- samples SCA Sample Applications
|-- tools SCA Tools (Eclipse plugins, wsdl2java, java2wsdl, etc)
|-- tutorial SCA Tutorial
</PRE>
</DIV></DIV>
<P>The individual modules can be built separately or build with top-down build.</P>
<H4><A name="SCAJavaDevelopmentGuide-topdownbuild%28recommendedapproach%29"></A>top-down build (recommended approach)</H4>
<P>Check out all of the java source code.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
svn checkout http:<SPAN class="code-comment">//svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/ sca-java-1.x</SPAN>
</PRE>
</DIV></DIV>
<P>Building the SCA source code is simple</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd sca-java-1.x
mvn
</PRE>
</DIV></DIV>
<P>It should work even if you start with an empty Maven local repository, and it should always work, however when you are building for Tuscany for the first time there are a lot of dependencies which must be downloaded so the first build can take a long time and it may fail with problems retrieving the dependencies. </P>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/lightbulb_on.gif" height="16" width="16" align="absmiddle" alt="" border="0"> There can be occasional problems downloading artifacts from remote Maven repositories so if mvn fails with network related sounding messages sometimes just trying again can fix the problem.</P>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/lightbulb_on.gif" height="16" width="16" align="absmiddle" alt="" border="0"> The trunk code sometimes has SNAPSHOT dependencies which can get out of date in your local repository so if you see odd build failures try updating the SNAPSHOT jars with:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
mvn -U
</PRE>
</DIV></DIV>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/lightbulb_on.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Once you have done a top-down build, and your local maven repository is populated, you can start using the maven off line option to speed up the build process</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
mvn -o
</PRE>
</DIV></DIV>
<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>The SCA build consumes a good amount of memory, in case you are seeing issues during the build, set a MAVEN_OPTS environment variable to allocate more memory for the build process.
<P> Windows : SET MAVEN_OPTS=-Xmx512m<BR>
Unix : export MAVEN_OPTS=-Xmx512m</P></TD></TR></TABLE></DIV>
<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>The "trunk" is always in very active development, and sometimes you might experience issues trying to build some modules, in that case you can tell maven to continue building other modules
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
mvn -fae clean install
</PRE>
</DIV></DIV>
<P>or either skip all unit tests</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
mvn -fae -Dmaven.test.skip=<SPAN class="code-keyword">true</SPAN> clean install
</PRE>
</DIV></DIV>
<P>or run tests, but do not stop building if one of the tests fails</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
mvn -fn clean install
</PRE>
</DIV></DIV></TD></TR></TABLE></DIV>
<H4><A name="SCAJavaDevelopmentGuide-Buildingthebinaryandsourcedistributions"></A><A name="SCAJavaDevelopmentGuide-Distributions"></A> Building the binary and source distributions</H4>
<P>The binary and source distribution release artifacts are created by running maven in the distribution folder, for example:</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd sca-java-1.x/distribution
mvn clean install -o
</PRE>
</DIV></DIV>
<P>The distribution artifacts can then be found in the folder named "target" within the distribution folder. </P>
<H3><A name="SCAJavaDevelopmentGuide-ImportingSCAmodulesintoyourDevelopmentIDE"></A><A name="SCAJavaDevelopmentGuide-IDE"></A>Importing SCA modules into your Development IDE</H3>
<H4><A name="SCAJavaDevelopmentGuide-UsingEclipse"></A>Using Eclipse</H4>
<P>If this is the first time you are using your workspace with maven m2 local repository, you will need to tell your Eclipse workspace the location of the directory, and you can do this with the following command :</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
mvn -Declipse.workspace=[path-to-eclipse-workspace] eclipse:add-maven-repo
</PRE>
</DIV></DIV>
<P>In order to generate the necessary project files to import the SCA modules to Eclipse, you can use the maven eclipse plugin</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
cd sca-java-1.x
mvn eclipse:eclipse
</PRE>
</DIV></DIV>
<P>Now, launch your Eclipse IDE, select File->Import->Existing projects into Workplace, and then select the base SCA directory (e.g java/sca) and then press Finish, this should import all SCA modules into your Eclipse Workspace.</P>
<P>There are some Tuscany Eclipse code templates available:<BR>
<A href="https://svn.apache.org/repos/asf/tuscany/java/etc/tuscany-eclipse-codestyle.xml" class="external-link" rel="nofollow">Eclipse Style Formatter </A><BR>
<A href="https://svn.apache.org/repos/asf/tuscany/java/etc/tuscany-eclipse-codetemplates.xml" class="external-link" rel="nofollow">Eclipse Templates </A></P>
<H3><A name="SCAJavaDevelopmentGuide-UnderstandingSCAcodepath"></A><A name="SCAJavaDevelopmentGuide-CodePath"></A> Understanding SCA code path</H3>
<P>Here is a walk through of <A href="sca-java-get-started-with-coding.html" title="SCA Java Get Started with Coding">key methods/functions</A> which help you get started with SCA Java development.</P>
<H3><A name="SCAJavaDevelopmentGuide-CodingGuidelines"></A><A name="SCAJavaDevelopmentGuide-CodingGuidelines"></A> Coding Guidelines</H3>
<P>There are a few simple guidelines when developing for JAVA SCA:</P>
<UL>
<LI>The basic coding style used is the described at <A href="http://java.sun.com/docs/codeconv/" class="external-link" rel="nofollow">Sun Java coding standards</A> but the main thing is to be consistent with the existing code you're updating, so for example, if you're updating a method that uses the braces on the same line style don't add code with the hanging braces style.</LI>
</UL>
<UL>
<LI>Always include the Apache License Headers on all files (both source code files and resource files such as xml documents)</LI>
</UL>
<UL>
<LI>Include a descriptive log message for checkins, for example "fixed such and such problem".</LI>
</UL>
<P>Some other useful suggestions:</P>
<DIV class="panel" style="border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>Clean Code</B></DIV><DIV class="panelContent">
<UL class="alternate" type="square">
<LI>use correct visibility, private, default, public, avoid protected</LI>
<LI>make methods static if not using object state</LI>
<LI>make sure javadoc is in sync or remove that javadoc</LI>
<LI>no javadoc on overridden methods</LI>
<LI>test cases in same package to avoid having to over-open access to methods</LI>
<LI>don't create artificial dependencies by using constants from another module</LI>
<LI>don't extend/implement a 'constant' interface</LI>
<LI>avoid creating another private layer over a public interface/spi</LI>
<LI>remove old code, don't leave it commented out, very confusing</LI>
<LI>use functional programming names for functions that convert an object</LI>
<LI>add javadoc to private methods</LI>
<LI>review class javadoc and make sure it's accurate</LI>
<LI>inline methods used only once, or make them clean static functions</LI>
<LI>put utility methods in a Util class with package visibility</LI>
<LI>use static imports</LI>
<LI>use scoped variables</LI>
<LI>no stars in OSGi exports</LI>
<LI>correct use of generics, see the effective Java book</LI>
</UL>
</DIV></DIV>
<DIV class="panel" style="border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>Unit/Integration Tests</B></DIV><DIV class="panelContent">
<UL class="alternate" type="square">
<LI>put comments in test cases</LI>
<LI>review test cases and make sure they're included in the build</LI>
<LI>use junit 4 only, check correct use of @BeforeClass or @Before</LI>
<LI>use static imports for assert statements</LI>
</UL>
</DIV></DIV>
<DIV class="panel" style="border-style: solid;border-width: 1px;"><DIV class="panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>Formatting</B></DIV><DIV class="panelContent">
<UL class="alternate" type="square">
<LI>use Tuscany eclipse code style/formatter</LI>
<LI>no tabs</LI>
<LI>no excessive line wrapping</LI>
</UL>
</DIV></DIV>
<P>While Tuscany does not yet have an official style or template, here are some templates that folks have been using and have been checked into the build which are stored at <A href="https://svn.apache.org/repos/asf/tuscany/java/etc/" class="external-link" rel="nofollow">https://svn.apache.org/repos/asf/tuscany/java/etc/</A></P>
<H4><A name="SCAJavaDevelopmentGuide-Namingconventionstoincreaseconsistency"></A>Naming conventions to increase consistency</H4>
<P><B>Folder Names:</B> Please use all lowercases and dashes in folder names (like in the jar names)</P>
<UL class="alternate" type="square">
<LI>Maven artifact id = tuscany-<folder name></LI>
</UL>
<P><B>Package names:</B> Package names within modules should include the module name so that source code can be located in the source tree easily. So, for example, java/sca/module/implementation-java would be in package structure org.apache.tuscany.implementation.java.*</P>
<H3><A name="SCAJavaDevelopmentGuide-Testing"></A><A name="SCAJavaDevelopmentGuide-Testing"></A> Testing</H3>
<P>Tuscany uses plain junit test cases to perform unit and integration testing, below is an example that can also be used as a template for writing new test cases; it demonstrates how to bootstrap the Tuscany SCA runtime in your test case, and because they are based on junit, you can run it from your IDE of choice or from Maven.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
/**
* Description of your test <SPAN class="code-keyword">case</SPAN> and necessary details you find necessary
*/
<SPAN class="code-keyword">public</SPAN> class YourTestCase <SPAN class="code-keyword">extends</SPAN> TestCase {
<SPAN class="code-keyword">private</SPAN> SCADomain domain;
<SPAN class="code-keyword">private</SPAN> YourService service;
@Override
<SPAN class="code-keyword">protected</SPAN> void setUp() <SPAN class="code-keyword">throws</SPAN> Exception {
domain = SCADomain.newInstance(<SPAN class="code-quote">"YourTest.composite"</SPAN>);
service = domain.getService(YourService.class, <SPAN class="code-quote">"serviceName"</SPAN>);
}
@Override
<SPAN class="code-keyword">protected</SPAN> void tearDown() <SPAN class="code-keyword">throws</SPAN> Exception {
domain.close();
}
...
}
</PRE>
</DIV></DIV>
<P><IMG class="emoticon" src="https://cwiki.apache.org/confluence/images/icons/emoticons/lightbulb_on.gif" height="16" width="16" align="absmiddle" alt="" border="0"> Note that we use surefire maven plugin to run the unit and integration tests, and in most cases, they are configured to match a **/*TestCase.java file name pattern. Because of this, if your test case has a different file name pattern, you might execute it from your IDE of choice, but the maven build won't execute the test.</P>
<H3><A name="SCAJavaDevelopmentGuide-MavenBuildStructure"></A><A name="SCAJavaDevelopmentGuide-MavenBuildStructure"></A> Maven Build Structure</H3>
<P><EM>We use the term Module to refer to the leaf of maven tree.</EM></P>
<UL>
<LI>sca/pom.xml's parent will be pom/parent/pom.xml</LI>
<LI>Other poms will use the pom from the parent folder as parent pom</LI>
<LI>Group id: org.apache.tuscany.sca</LI>
<LI>Version of our modules will be specified once in java/sca/pom.xml, child poms don't need specify a version as they get it from their parent</LI>
<LI>pom names begin Apache Tuscany SCA</LI>
<LI>Eclipse projects are generated for all built modules using mvn -Peclipse eclipse:eclipse</LI>
</UL>
<H4><A name="SCAJavaDevelopmentGuide-Addinganewmoduleandnotreadytointegrate%3F"></A>Adding a new module and not ready to integrate?</H4>
<P>'work-in-progress' modules can be worked on in the same source tree and yet not break the top-down build. You can do this by not listing your module(s) in java/sca/modules/pom.xml.</P>
<H3><A name="SCAJavaDevelopmentGuide-Reportingissuesandprovidingpatches"></A><A name="SCAJavaDevelopmentGuide-Providingpatches"></A> Reporting issues and providing patches</H3>
<H3><A name="SCAJavaDevelopmentGuide-ReportinganIssueorAskingForNewFeatures"></A>Reporting an Issue or Asking For New Features</H3>
<P><B>Please use Apache<A href="http://issues.apache.org/jira/browse/Tuscany" class="external-link" rel="nofollow">JIRA</A> system to report bugs or request new features.</B> First time users need to create a login.</P>
<P>Search the existing JIRAs to see if what you want to create is already there. If not, create a new one. Make sure JIRAs are categorized correctly using JIRA categories and are created under the correct component area. Please include as much information as possible in your JIRA to help resolve the issue quicker. This can include version of the software used, platforms running on, steps to reproduce, test case, details of your requirement or even a patch if you have one. </P>
<H3><A name="SCAJavaDevelopmentGuide-SubmittingaPatch"></A>Submitting a Patch</H3>
<P>Please follow the steps below to create a patch. It will be reviewed and committed by a committer in the project.</P>
<UL>
<LI>Perform a full build with all tests enabled for the module the fix is for. Specific build procedures vary by sub-project.</LI>
<LI>Confirm that the problem is fixed and include a test case where possible to help the person who is applying the patch to verify the fix.</LI>
<LI>Generate the patch using <TT>svn diff File > patchfile</TT></LI>
<LI>Try to give your patch files meaningful names, including the JIRA number</LI>
<LI>Add your patch file as an attachment to the associated JIRA issue
<UL>
<LI>Clicking on the 'Patch Available' box in the screen where the patch is being submitted will help identify available patches quicker.</LI>
</UL>
</LI>
</UL>
<H3><A name="SCAJavaDevelopmentGuide-HowdoIgetmyJIRAsintoarelease%3F"></A>How do I get my JIRAs into a release?</H3>
<P>You can always propose a release and drive the release with the content that you want. Another way to get a JIRA into a release is by providing a patch or working with other community members (volunteers) to help you get the problem fixed. You can also help by providing test cases.</P>
<P>Each release is managed by a release manager. Make sure that the Release Manager is aware of why a fix to a JIRA is important to your business. In general, the best attempt is made to include as many JIRAs as possible depending on the level of community help. The voting mechanism in the JIRA system can be used to raise the importance of a JIRA to the attention of the release manager. Adding comments in the JIRA would help the release manager understand why a JIRA is important to include in a given release. </P>
<H3><A name="SCAJavaDevelopmentGuide-Howisareleasedone%3F"></A>How is a release done?</H3>
<P>Anyone can volunteer to be a release manager and drive a release. Based on Apache guidelines, a release requires at least three PMC +1 votes and more +1s than -1s. A release can not be vetoed so a -1 does not block a release. The steps for how to create a Tuscany release are documented <A href="http://tuscany.apache.org/making-releases.html" class="external-link" rel="nofollow">here </A></P>
<P></P>
<H2><A name="SCAJavaDevelopmentGuide-DevelopmentHints"></A>Development Hints</H2>
<H3><A name="SCAJavaDevelopmentGuide-GeneratingEclipseWTPWebProjectsforWebappsamples"></A><A name="SCAJavaDevelopmentGuide-WebappinEclipse"></A> Generating Eclipse WTP Web Projects for Webapp samples</H3>
<P>If you're using Eclipse WTP and want to get WTP Web Projects generated<BR>
for our Webapp samples you can simply pass a -Dwtpversion=1.5 option to<BR>
the usual mvn eclipse:eclipse command, like this:<BR>
mvn -Dwtpversion=1.5 -Peclipse eclipse:eclipse</P>
<P>The magic -Dwtpversion=1.5 option will add the WTP Web project nature to<BR>
all the Eclipse projects with <packaging>war</packaging> in their Maven<BR>
pom.xml. You'll then be able to add these projects to a WTP Tomcat or<BR>
Geronimo Server configuration, to publish and run them straight from<BR>
your Eclipse workspace.</P>
<P>h3:<A name="SCAJavaDevelopmentGuide-Ant"></A> Generating Dependencies for Ant in Samples</P>
<P>Figuring out the package dependency to include in Ant build.xml can be a pain. Here is a quick<BR>
script which works in Linux environment for war files.</P>
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
jar tvf sample-feed-aggregator-webapp.war | grep .jar | awk '{ printf <SPAN class="code-quote">"%s\n"</SPAN>, $8 }' |
sed -e <SPAN class="code-quote">"s/WEB-INF\/lib\<SPAN class="code-comment">///"</SPAN> | awk '{ printf <SPAN class="code-quote">"<include name=\"</SPAN>%s\<SPAN class="code-quote">"/>\n"</SPAN>, $1 }' | grep -v tuscany</SPAN>
</PRE>
</DIV></DIV>
<H2><A name="SCAJavaDevelopmentGuide-HowtodoareleaseofTuscany%3F"></A><A name="SCAJavaDevelopmentGuide-ReleaseChecklist"></A> How to do a release of Tuscany?</H2>
<P>Here is the <A href="making-releases.html" title="Making releases">Checklist for doing a Tuscany SCA Java release </A>.</P>
</TD></TR></TBODY></TABLE>
</DIV>
</DIV>
</DIV>
<!-- pageContent macro end -->
</TD>
</TR>
</TABLE>
<!-- footer macro -->
<SCRIPT src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</SCRIPT>
<SCRIPT type="text/javascript">
_uacct = "UA-1174707-5";
urchinTracker();
</SCRIPT>
<A href="http://www.statcounter.com/" target="_blank"><IMG src="http://c26.statcounter.com/counter.php?sc_project=2619156&java=0&security=94bd7e7d&invisible=0" alt="website stats" border="0"></A>
<DIV class="footer">
Copyright � 2003-2012, The Apache Software Foundation </BR>
Apache Tuscany and the Apache Tuscany project logo are trademarks of The Apache Software Foundation.
</DIV>
<!-- footer macro end -->
</BODY>
</HTML>
|