summaryrefslogtreecommitdiffstats
path: root/site/trunk/site-publish/java-sca-developer-guide.html
blob: 449aad8e835b282c73d722264d11e04569e7172d (plain)
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
<!--

    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 : Java SCA Developer 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%">
					&nbsp;
				</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=51313">
						<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%">
					&nbsp;<A href="home.html" title="Apache Tuscany">Apache Tuscany</A>&nbsp;&gt;&nbsp;<A href="home.html" title="Home">Home</A>&nbsp;&gt;&nbsp;<A href="menus.html" title="Menus">Menus</A>&nbsp;&gt;&nbsp;<A href="general.html" title="General">General</A>&nbsp;&gt;&nbsp;<A href="sca-general-menu.html" title="SCA General Menu">SCA General Menu</A>&nbsp;&gt;&nbsp;<A href="java-sca-menu.html" title="Java SCA Menu">Java SCA Menu</A>&nbsp;&gt;&nbsp;<A href="" title="Java SCA Developer Guide">Java SCA Developer 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>&nbsp;&nbsp;
				</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">
								<P>The Java SCA sub-project aims to provide enterprise-grade service infrastructure based on SCA. Some of our principles include: </P>

<UL>
	<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>We build runtimes that are distributed under the Apache Software License.</LI>
	<LI>We believe developing highly scalable service-based systems should be easier than it currently is.</LI>
	<LI>We believe in providing users with flexibility and choice. We do not dictate programming models but support many. Our runtimes are designed to be highly extensible so users may customize them to fit their needs.</LI>
	<LI>We provide frequent releases of our software so users can experience the newest features and have access to the latest bug fixes.</LI>
</UL>


<P>For those looking at or developing the Tuscany Java SCA source code this page provides some description of the code structure and associated conventions that are used.</P>

<H3><A name="JavaSCADeveloperGuide-GettingtheSourceSubversionAccess"></A>Getting the Source - Subversion Access</H3>

<P>The Java SCA project Subversion repository is located at <A href="https://svn.apache.org/repos/asf/incubator/tuscany/java/sca" class="external-link" rel="nofollow">https://svn.apache.org/repos/asf/incubator/tuscany/java/sca</A>.</P>

<P>The respository can also be viewed online at <A href="http://svn.apache.org/viewvc/incubator/tuscany/java/" class="external-link" rel="nofollow">http://svn.apache.org/viewvc/incubator/tuscany/java/</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>

<P><B>Checking out from Subversion</B></P>

<P>Use a command like:</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
svn checkout https:<SPAN class="code-comment">//svn.apache.org/repos/asf/incubator/tuscany/java/sca</SPAN>
</PRE>
</DIV></DIV>

<P><B>Committing Changes to Subversion</B><BR>
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>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 &lt;name&gt; commit
</PRE>
</DIV></DIV>

<P>Subversion will prompt you for a password, and once you enter it once, 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="JavaSCADeveloperGuide-GettingSetupforDevelopment"></A>Getting Setup for Development</H3>

<P><B>Prerequisites</B><BR>
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.4+)</A></LI>
	<LI><A href="http://subversion.tigris.org/" class="external-link" rel="nofollow">Subversion (1.2+)</A></LI>
</UL>


<H3><A name="JavaSCADeveloperGuide-SomeDefinitions"></A>Some Definitions</H3>

<P>Module - we use the term module to refer to a leaf of the maven build tree. I.e a directory containing source code and resources that will be compiled to a releasable artifact, e.g. a jar file. </P>

<P>...</P>

<H3><A name="JavaSCADeveloperGuide-SourceandBuildStructure"></A>Source and Build Structure</H3>
<P>Looking at the source code for <A href="http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/" class="external-link" rel="nofollow">Java SCA</A> you will see the following directory structure. </P>
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>java/
 pom/parent/pom.xml
 ...
 sca/
   pom.xml - The maven pom that builds all of the releasable Tuscany Java SCA modules

   contrib/ - A temporary direcoty that holds modules not currently being developed or targetted for a release
     ...

   doc/ - Tuscany Java SCA documentation that will be included with the release
     ...

   itest/ - Integration tests that test system performace using combinations of Tuscany Java features
     pom.xml
     ...

   modules/ - A flat direcory structure holding all of the separate modules that make up Tuscany Java SCA. 
     pom.xml
     ...

   samples/ - Tuscany Java SCA samples which show how to use the various features of the software
     build.xml &lt;-- Samples build with Ant as well as Maven - TBD
     pom.xml
     ...
</PRE>
</DIV></DIV>

<H4><A name="JavaSCADeveloperGuide-NamingConventions"></A>Naming Conventions</H4>
<UL class="alternate" type="square">
	<LI>Use all lowercases and dashes in folder names (like in the jar names)</LI>
	<LI>Maven artifact id = tuscany-&lt;folder name&gt;</LI>
	<LI>Package names within modules should include the module name so that source code can be located in the source tree easily. So, for example, the module</LI>
</UL>


<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
java/sca/module/implementation-java
</PRE>
</DIV></DIV>

<P>contains code in the package structure</P>

<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
<PRE class="code-java">
org.apache.tuscany.implementation.java.*
</PRE>
</DIV></DIV>

<H4><A name="JavaSCADeveloperGuide-ModuleLocation"></A>Module Location</H4>
<P>If people want to work on some new modules that won't be part of the<BR>
next release and are not included in the top-down build, that's fine, we can<BR>
just avoid listing these modules in java/sca/modules/pom.xml. So, they<BR>
can be there in the same source tree but they won't break the release<BR>
top-down build, and they won't have to be building at all times.</P>

<H4><A name="JavaSCADeveloperGuide-MavenBuildStructure"></A>Maven Build Structure</H4>
<UL class="alternate" type="square">
	<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 ids:<BR>
  org.apache.tuscany.sca <BR>
  org.apache.tuscany.sca.samples,<BR>
  org.apache.tuscany.sca.itest</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>


<H3><A name="JavaSCADeveloperGuide-BuildingFromTheSource"></A>Building From The Source </H3>
<P>First of all 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 https:<SPAN class="code-comment">//svn.apache.org/repos/asf/incubator/tuscany/java</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 java/sca
mvn
</PRE>
</DIV></DIV>

<P>It should work even if you start with an empty Maven local repository, and it should always work. This assumes that maven is able to retrieve a SNAPSHOT version of SDO (and of course the rest of software that SCA depends on) as we haven't built anything other than SCA here. 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>

<H3><A name="JavaSCADeveloperGuide-CodingstyleandTesting"></A>Coding style and Testing</H3>

<P>Tuscany has some basic coding standards - use spaces not tabs, keep a reasonable line length, and include enough comments in the code. Tests are good, both unit and functional testing is encouraged. When modifying existing code try to use the style already in place or if necessary reformat the whole file so the style is consistent. </P>

<P>The ASF has some requirements on the license header that should be included in most files, for details see <A href="http://www.apache.org/legal/src-headers.html" class="external-link" rel="nofollow">http://www.apache.org/legal/src-headers.html</A>.</P>

<P>In the Tuscany SVN there is a folder tuscany/java/etc which contains various templates that can be used to configure your development environment, for example, codestyle template files which can be imported into the Eclipse or IDEA IDE's. Some Tuscany modules are set up to use the Maven Checkstyle facility which may be run using the Maven -Psourcecheck option.</P>
							</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&nbsp;&nbsp;</BR>
                        Apache Tuscany and the Apache Tuscany project logo are trademarks of The Apache Software Foundation.
		</DIV>
		<!-- footer macro end -->

    </BODY>
</HTML>