diff options
author | coreyg <coreyg@13f79535-47bb-0310-9956-ffa450edef68> | 2014-11-21 09:30:19 +0000 |
---|---|---|
committer | coreyg <coreyg@13f79535-47bb-0310-9956-ffa450edef68> | 2014-11-21 09:30:19 +0000 |
commit | 200a40b332420f94992eb39a6d0ea1cf1490ffc4 (patch) | |
tree | 1c76ef1d254c7bfc91128a313d319bd60da9d01e /site/trunk/site-publish/sca-java-development-guide.html | |
parent | 85f53ab6ab4f664d63774c94b672a875c9e52b8a (diff) |
Adding tuscany's website to their svn repo for svnpubsub
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1640879 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'site/trunk/site-publish/sca-java-development-guide.html')
-rw-r--r-- | site/trunk/site-publish/sca-java-development-guide.html | 588 |
1 files changed, 588 insertions, 0 deletions
diff --git a/site/trunk/site-publish/sca-java-development-guide.html b/site/trunk/site-publish/sca-java-development-guide.html new file mode 100644 index 0000000000..96504b6988 --- /dev/null +++ b/site/trunk/site-publish/sca-java-development-guide.html @@ -0,0 +1,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> |