Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

How to Contribute To Hama

Getting the source code

First of all, you need the Hama source code. The official location for Hama is the Apache SVN repository; Git is also supported, and useful if you want to make lots of local changes -and keep those changes under some form or private or public revision control.

SVN access

Get the source code on your local drive using SVN. Most development is done on the TRUNKDownload the latest stable Hama source release from http://www.apache.org/dyn/closer.cgi/hama and extract the files. You can get the latest source code using:

No Format
svngit checkoutclone https://svngitbox.apache.org/repos/asf/incubator/hama/trunk hama-trunk

Git access

...

/hama.git

...


Eclipse Project File Generation

...

Now run the following commands:

No Format
% mvn install -Phadoop1 -Dhadoop.version=1.2.0
or 
% mvn clean install -Phadoop2 -Dhadoop.version=2.0.3-alpha

mvn eclipse:eclipse

You can now import the projects into your eclipse workspace via:

...

  • All public classes and methods should have informative Javadoc comments.
  • Code should be formatted according to hama-code-formatter hama-code-formatter fallbacklink
  • Contributions should pass existing unit tests.
  • New unit tests should be provided to demonstrate bugs and fixes.

...

  • Please

...

  • resolve all warnings according to "Eclipse Warning Levels" below
No Format

> cd hama-trunk
> mvn install
or
> mvn --projects core,examples install

# build website
> mvn site

After a while, if you see

No Format

BUILD SUCCESSFUL

all is OK.

Creating a patch

Check to see what files you have modified with:

No Format
svn stat  % git status

Add any new files with:

No Format
svn  % git add src/.../MyNewClass.javaany_files_you_created_modified_or_deleted

In order to create a patch, type (from the root directory of hama):

No Format
svn  % git diff --cached > /tmp/HAMA-321131.patch

Submitting a pull request to GitHub

The Hama apache repository is cloned at the GitHub https://github.com/apache/hama, which is connected to the JIRA issue manager. First, you need to create a GitHub account. Then, you need to fork the Hama master by pushing the fork button on the Hama master. Let say that your GitHub username is xxxxx. You should always bring your local fork up-to-date using the following git commands:

No Format

# clone your local fork (NOT the Hama master)
git clone https://github.com/xxxxx/hama.git current
cd current
# pull all recent changes from the Hama master
git pull https://github.com/apache/hama.git master
# bring the local fork up-to-date
git push origin master

Wiki Markup
Lets say that you want to create a pull request for the HAMA issue \[HAMA-1234\] ...issue-title.... You need to create a new branch of your local fork, say named HAMA-1234

No Format

# create a new branch inside your directory 'current'
git checkout -b HAMA-1234
# ... do some changes to the files ...
# store changes in the branch
git push origin HAMA-1234
# commit changes to the branch
git commit -a -m '[HAMA-1234] ...issue-title...'
Then go to your GitHub HAMA page and do a Pull Request. Use the same title [HAMA-1234] ...issue-title....
This will report all modifications done on Hama sources on your local disk and save them into the HAMA-321.patch file. Read the patch file. Make sure it includes ONLY the modifications required to fix a single issue.

Stay involved

Contributors should join the Hama mailing lists. In particular, the commit list (to see changes as they are made), the dev list (to join discussions of changes) and the user list (to help others).

...

  • Variables should be meaningful so that they are easily understood by other developers. For instance, the declaration of 'String serverName' would be better than 'String str'.
  • Indentation is 2 spaces, not 4.
  • Argument checks for NullPointerException, IlleagalArgumentException, etc.

Eclipse Warning Levels

We expect that you turn on following warnings in eclipse:
(can be found in the project preferences or global preferences under Java/Compiler/"Errors/Warnings")

No Format

From top to bottom:

Non-static access to static member (WARNING)
Indirect access to static member (WARNING)
Method with a constructor name (WARNING)
Parameter assignment (WARNING)
Method can be static (WARNING) 

Serializable class without serialID (WARNING)
Assignment has no effect (WARNING)
finally does not complete normally (WARNING)
Using a char array in string concat (WARNING)
hidden catch block (WARNING)
Inexact type match for varags argument (WARNING)
Nullpointer access (WARNING)
Compare identical values (WARNING)
class overrides equals but not hashcode (WARNING)
dead code (WARNING)

Type parameter hides another type (WARNING)
Method does not override package visible method (WARNING)
interface method conflicts with protected object method (WARNING)

Deprecated API (WARNING) // can be neglected by using annotations if not other possible though 
Forbidden references (ERROR)
Discouraged references (WARNING)

Value of local variable is not used (WARNING) // please delete it if never read
Unused import (WARNING) // please format and organize imports before making a patch (in eclipse CTRL+SHIFT+F and CTRL+O)
Unused private member (WARNING) // remove if never used
Unnecessary cast or instanceof operation (WARNING)
Unused break or continue label (WARNING)

Unchecked generic type operation (WARNING)
Usage of raw types (WARNING) // sometimes can not be avoided, can be neglected via annotation
Generic type parameter declared with a final type bound (WARNING)

Missing override annotation (WARNING)
Annotation is used as super interface (WARNING)
Unhandled token in SuppressWarnings (WARNING)

See also