This file explains the development environment and some typical usecases you will need to work with race analysis project.

IDE
---
We use Eclipse as development environment - version 3.7.x (www.eclipse.org)

Additional mandatory installations:
- Git (file versioning system)
- Maven 3.x (build system)

Configure the IDE
-----------------

1. Target Platform

After the import of all required projects from git into your eclipse workspace you need to setup the target platform.
A target platform is an Eclipse concept to define the set of java classes (from a set of jars) your compiler can use to build the sources.
We have defined a target-platform for the project which can be found inside the project "com.sap.sailing.targetplatform" in the folder 'definitions'.
There you will find 3 definitions: race-analysis-p2-ide-local, race-analysis-p2-maven-local and race-analysis-p2-maven-central
The definition 'race-analysis-p2-ide-local' is intended to be used for the IDE whereas the other definitions are used for the local and central maven build.
The target definition contains a list of URLs to different p2 repositories containing the actual bundles. The URLs can be either URLs to local or remote repositories
depending on your access to those repositories. Normally you should bind your target platform to central (remote) repositories in order to keep the content up-to-date.
In case you don't have access to specific remote repositories you can create a local copy of a p2 repository and change the URL to this local copy.

The used target platform sources are:
a) Remote p2 repositories (like http://download.eclipse.org/releases/indigo)
b) SAP Nexus repositories (like http://nexus:8081/nexus/content/...)
c) Our own p2 repository served by our central server via Apache WebServer (http://sapcoe-app01.pironet-ndh.com/p2/...)

Local maven build
-----------------
If you run a local build with maven the used target platform defintion is 'race-analysis-p2-maven-local'. The reference to this definition is defined in the pom.xml
of the /git/java folder.

The "SAP Race Analysis" Product
-------------------------------
The project com.sap.sailing.feature.p2build contains an eclipse product definition with the name "SAP Race Analysis".
This product contains a list of features defining the product.
These features are:
- com.sap.sailing.feature (contains all development bundles and it's dependencies)
- com.sap.sailing.feature.runtime (contains additional libraries only needed at runtime)

The maven/tycho build creates an deployable eclipse product based on this product defintion which is the basis for the server installation.
The resulting deployable files can be found in /bin/products/raceanalysis.product.id/<os>/<ws>/<arch>/...

Target-Platform related projects
--------------------------------
com.sap.sailing.targetplatform.base-> contains all files required to build a p2 repository for all library files defining the base target platform for the sailing project
com.sap.sailing.targetplatform -> contains the p2 repository generation scripts and the target platform definitions (.target files)

com.sap.sailing.feature -> contains the feature.xml for the race analysis project itself (required for the product build)
com.sap.sailing.feature.runtime -> contains the feature.xml for additional runtime libraries which are not required for the source build (e.g. jetty.osgi bundle) 
com.sap.sailing.feature.p2build -> contains the product defintion (.product file) for the race analysis project (required for the product build)

Typical usecases changing the target platform definition
--------------------------------------------------------

1. Adding an external open source library to the target-platform

To add a new library which can not be found in any SAP repository you need to follow some steps.
a) Check if the library is already OSGi-enabled (normally this means there is a manifest.mf in the META-INF folder of the jar file containing valid OSGi metadata.
b) In case the library is not OSGi-enabled someone has to create such a OSGI-enabled version (ask the technical lead of the project)
c) Add the library to an appropriate target folder in the project com.sap.sailing.targetplatform.base (e.g. target-base)
d) Add an corresponding entry to the corresponding feature.xml in the project com.sap.sailing.targetplatform.base
e) Rebuild the base target platform by running the script createLocalBaseP2repository.sh (com.sap.sailing.targetplatform/scripts)
f) Reload the target platform in the IDE
g) Submit the changes to the git repository

2. Adding a library from an internal SAP repository (e.g. Nexus)

3. Adding a p2 repository as new source of libraries

4. Adding a GWT library to the com.sap.sailing.gwt.ui project

a) Copy the library (the jar file) to the folder /WEB-INF/lib
b) Add the library to the bundle classpath (in the META-INF/manifest.mf file)
c) Add a build dependency for the GWT compiler to the pom.xml
d) Add the library to the central maven repository /home/trac/maven-repositories
   by using the mvn install:install -file command


Typical usecases changing the features and product definition
-------------------------------------------------------------

5. Adding a new bundle project



