summaryrefslogtreecommitdiffstats
path: root/site/trunk/site-publish/das-java-developer-guide.html
blob: 19c8b06790e546dd433db27ba75c19570c2867b0 (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
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
<!--

    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 : DAS Java 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=45092">
						<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="das-overview.html" title="DAS Overview">DAS Overview</A>&nbsp;&gt;&nbsp;<A href="das-java.html" title="DAS Java">DAS Java</A>&nbsp;&gt;&nbsp;<A href="das-java-documentation-menu.html" title="DAS Java Documentation Menu">DAS Java Documentation Menu</A>&nbsp;&gt;&nbsp;<A href="" title="DAS Java Developer Guide">DAS Java 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">
								<TABLE class="sectionMacro" 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="das-java-get-involved.html" title="DAS Java Get Involved">Get Involved</A><BR>
<A href="das-java-found-a-bug.html" title="DAS 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>DAS Java</B></DIV><DIV class="panelContent" style="background-color: #ECF4D1;">
<P><A href="das-java.html" title="DAS Java">DAS Java Home</A><BR>
<A href="das-java-faq.html" title="DAS Java - FAQ">FAQ</A><BR>
<A href="das-java-releases.html" title="DAS Java Releases">Downloads</A><BR>
<A href="das-java-documentation-menu.html" title="DAS Java Documentation Menu">Documentation</A><BR>
<A href="https://svn.apache.org/repos/asf/tuscany/java/das/" class="external-link" rel="nofollow">Source Code</A></P>
</DIV></DIV></TD>
<TD class="confluenceTd" valign="top" width="85%">

<H3><A name="DASJavaDeveloperGuide-HowtogetinvolvedindevelopmentofJavaRDBDAS%3F"></A>How to get involved in development of Java RDB DAS?</H3>
<P>This document is the development guideline for RDB DAS Java project. </P>
<UL>
	<LI>General Guide</LI>
	<LI>Getting Source code</LI>
	<LI>Setting up your development environment</LI>
	<LI>Importing DAS code and samples into your Development IDE</LI>
	<LI>Coding Guidelines</LI>
	<LI>Testing</LI>
	<LI>Maven Build Structure</LI>
	<LI>Reporting Issues and Providing patches</LI>
</UL>


<H3><A name="DASJavaDeveloperGuide-GeneralGuide"></A>General Guide</H3>
<P>Welcome to the Tuscany RDB DAS 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 RDB DAS sub-project aims to provide enterprise-grade Data Access Service to help SOA applications using SDO have data updates with Database Data Source at backend.</LI>
	<LI>Java RDB DAS provides feedback to Tuscany SDO  and Spec as it evolves.</LI>
	<LI>The Java RDB DAS  provides flexibility in accessing data with explicit CRUD as well as using SDO  DataObjects.</LI>
	<LI>The Java RDB DAS 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="DASJavaDeveloperGuide-GettingSourcecode"></A>Getting Source code</H3>
<P>The Java RDB DAS project Subversion repository is located at <A href="https://svn.apache.org/repos/asf/incubator/tuscany/java/das" class="external-link" rel="nofollow">https://svn.apache.org/repos/asf/incubator/tuscany/java/das</A> .<BR>
The repository can also be viewed online at <A href="http://svn.apache.org/viewvc/incubator/tuscany/java/das" class="external-link" rel="nofollow">http://svn.apache.org/viewvc/incubator/tuscany/java/das</A> <BR>
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>

<H3><A name="DASJavaDeveloperGuide-CheckingoutcodefromSubversion"></A>Checking out code from Subversion</H3>
<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="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE> svn checkout http://svn.apache.org/repos/asf/incubator/tuscany/java/das </PRE>
</DIV></DIV>

<H3><A name="DASJavaDeveloperGuide-CommittingChangestoSubversion"></A>Committing Changes to Subversion</H3>
<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.<BR>
Once your password is set, you can use a command like this to commit:</P>

<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE> svn commit </PRE>
</DIV></DIV>

<P>If Subversion can't figure out your username, you can tell it explicitly:</P>

<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE> svn --username &lt;name&gt; 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="DASJavaDeveloperGuide-SettingupyourDevelopmentEnvironment"></A>Setting up your Development Environment</H3>

<P><B>Prerequisites</B></P>

<P>Java RDB DAS requires the following:</P>
<UL>
	<LI>JDK 5.0+ (J2SE 1.5.0+)</LI>
	<LI>Apache Maven (2.0.4+)</LI>
	<LI>Subversion (1.2+)</LI>
</UL>


<H3><A name="DASJavaDeveloperGuide-Buildtreestructure"></A>Build tree structure</H3>

<P>The build tree is designed to facilitate modular development and releases. Maven modules are grouped by how they are released under a hierarchy. Java RDB DAS currently have the below module hierarchy :</P>

<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>-java
 |-- das
     |-- distribution         DAS distributions
     |-- rdb                	 DAS Core Source
     |-- samples              DAS Web, J2SE Sample Applications
</PRE>
</DIV></DIV>

<P>The individual modules can be built separately or build with top-down build.</P>

<P><B>top-down build (recommended approach)</B></P>

<P>Check out all of the java source code.</P>

<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>svn checkout http://svn.apache.org/repos/asf/incubator/tuscany/java </PRE>
</DIV></DIV>

<P>Building the RDB DAS source code is simple</P>

<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>cd java/das
mvn
</PRE>
</DIV></DIV>

<P>It should work irrespective of whether you have an empty Maven local repository. This assumes that maven is able to retrieve a SNAPSHOT version of SDO (and of course the rest of software that RDB DAS depends on) as we do not build anything other than RDB DAS here.</P>

<P>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.<BR>
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="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE> mvn -o  </PRE>
</DIV></DIV>

<H3><A name="DASJavaDeveloperGuide-ImportingRDBDASintoyourDevelopmentIDE"></A>Importing RDB DAS into your Development IDE</H3>

<P><B>Using Eclipse</B></P>

<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="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE> mvn -Declipse.workspace=[path-to-eclipse-workspace] eclipse:add-maven-rep </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="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>cd java/das
mvn -Peclipse eclipse:eclipse
</PRE>
</DIV></DIV>

<P>Now, launch your Eclipse IDE, select File-&gt;Import-&gt;Existing projects into Workplace, and then select the base DAS directory (e.g java/das) and then press Finish, this should import all DAS core and Samples into your Eclipse Workspace.</P>

<H3><A name="DASJavaDeveloperGuide-CodingGuidelines"></A>Coding Guidelines</H3>
<P>There are a few simple guidelines when developing for JAVA DAS:</P>
<UL>
	<LI>Formatting standards are defined by the .checkstyle and .pmd configurations in the source repository. Please be sure to check code is formatted properly before doing a checkin (see below). If you are unfamiliar with Checkstyle or PMD, please see <A href="http://checkstyle.sourceforge.net/" class="external-link" rel="nofollow">http://checkstyle.sourceforge.net/</A>  and <A href="http://pmd.sourceforge.net/" class="external-link" rel="nofollow">http://pmd.sourceforge.net/</A> . Consistent formatting makes it easier for others to follow and allows diffs to work properly.</LI>
	<LI>Always include the Apache License Headers on all files and the following version tag:
<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE> @version $Rev$ $Date$ </PRE>
</DIV></DIV></LI>
	<LI>Please attempt to accompany code with at least unit tests or verify it by existing tests before submitting a patch or checking in.</LI>
	<LI>Do not checkin IDE-specific resources such as project files.</LI>
	<LI>Prior to check-in, perform a clean build and run the complete battery of unit tests for the current module from the command line with Checkstyle enabled, as in:</LI>
</UL>


<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
<PRE>mvn clean
mvn -o -Psourcecheck
</PRE>
</DIV></DIV>

<UL>
	<LI>Please do not perform a checkin using an IDE as doing so is frequently problematic.</LI>
	<LI>Include a descriptive log message for checkins, for example &quot;fixed such and such problem&quot;.</LI>
</UL>


<P><B>Naming conventions to increase consistency</B><BR>
<B>Folder Names:</B> Please use all lowercases and dashes in folder names (like in the jar names)</P>
<UL>
	<LI>Maven artifact id = tuscany-&lt;folder name&gt;</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. </P>

<H3><A name="DASJavaDeveloperGuide-Testing"></A>Testing</H3>
<P>All commits are expected to be accompanied by unit test and integration tests when appropriate. Unit tests should verify specific behavior relating to a single class or small set of related classes; integration tests verify code paths across subsystems. Testcases should be documented and clearly indicate what they verify. Also, avoid things that may cause side-effects when possible such as access of external resources.<BR>
Tuscany uses plain junit test cases to perform unit and integration testing. Web Samples use htmlunit Test cases to verify the expected behavior.  <BR>
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="DASJavaDeveloperGuide-MavenBuildStructure"></A>Maven Build Structure</H3>
<P>We use the term Module to refer to the leaf of maven tree.</P>
<UL>
	<LI>das/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.das</LI>
	<LI>Version of our modules will be specified once in java/das/pom.xml, child poms don't need specify a version as they get it from their parent</LI>
	<LI>pom names begin Apache Tuscany DAS</LI>
	<LI>Eclipse projects are generated for all built modules using mvn -Peclipse eclipse:eclipse</LI>
</UL>


<H3><A name="DASJavaDeveloperGuide-Reportingissuesandprovidingpatches"></A>Reporting issues and providing patches</H3>

<P><B>Issue Tracking</B></P>

<P>Tuscany bug reports are handled via a <A href="https://issues.apache.org/jira/browse/TUSCANY" class="external-link" rel="nofollow">JIRA</A>  issues list. Please use this list to report any bugs and track their status.</P>

<P><B>Reporting an Issue</B></P>

<P>Please search JIRA to see if the problem has already been reported. If it has not, please create a new JIRA issue. To help developers quickly resolve an issue, include as much information with your report as possible such as your platform, version numbers, error logs, configuration, steps to reproduce the problem, etc. Also, if possible, please include a testcase that demonstrates the problem. <BR>
Thanks for working with us to improve Apache Tuscany.</P>

<P><B>Submitting a Patch</B></P>

<P>To submit a patch, create an issue in JIRA that describes the problem and attach your patch file. Please include detailed steps to reproduce the problem in the issue description. Providing test cases in the patch will help us verify and apply it quicker. To create a patch, follow the steps below:</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 testcases where possible</LI>
	<LI>Generate the patch using svn diff File &gt; patchfile</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<BR>
Once you have submitted the patch it will be picked up for review.</LI>
</UL>


</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&nbsp;&nbsp;</BR>
                        Apache Tuscany and the Apache Tuscany project logo are trademarks of The Apache Software Foundation.
		</DIV>
		<!-- footer macro end -->

    </BODY>
</HTML>