Commits

Eric Joel Toguem Fonkoua committed 07335f2

  • Participants

Comments (0)

Files changed (639)

+.classpath
+.settings
+.project
+target
+test-output/
+*.ipr
+*.iml
+*.iws
+*.scala_dependencies
+deploy
+deploy.zip
+*.log
+.idea
+
+# Database.com SDK for Java
+
+For more information on how to use the Java SDK, please read our documentation at http://forcedotcom.github.com/java-sdk/force-sdk-overview
+
+## How to build
+
+The Database.com SDK is built using [Maven](http://maven.apache.org/) version 2.2.1.  Make sure you have the correct version of Maven installed on your system before attempting to build.
+
+Run the following maven command to build from source without running any tests
+
+    mvn clean install -DskipTests
+
+Run the following maven command to build from source and run only unit tests
+
+    mvn clean install
+
+In addition to unit tests, there are functional and integration tests located in the javasdk-test submodule.  Before running the functional and integration tests, you'll need to supply test org credentials in the properties file javasdk-test/qa-utils/src/main/resources/force-sdk-test.properties
+
+Run the following maven commands to compile and run all tests (unit, functional and integration)
+
+    mvn clean install -DskipTests -DincludeTestModules
+    mvn clean verify -DincludeTestModules
+
+You can run specific test suites by changing your working directory to a test submodule directory, such as javasdk-test/force-jpa-test/ , and then running the following maven command
+
+    mvn verify
+
+Keep in mind that you still must run <code>mvn clean install -DskipTests -DincludeTestModules</code> from the root directory of the project before running any tests in the javasdk-test submodules, otherwise tests may fail.

File ReleaseNotes.md

+# Release Notes 22.0.7-BETA
+
+## Upgrading to this Version
+
+## Bug Fixes
+
+- Fix JPA entity resolution so that it will find annotated entities in dependency jar files automatically

File build-tools/pom.xml

+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <parent>
+    <groupId>com.force.sdk</groupId>
+    <artifactId>force-sdk</artifactId>
+    <version>22.0.7-BETA</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>com.force.sdk</groupId>
+  <artifactId>force-build-tools</artifactId>
+  <name>force-build-tools</name>
+  
+</project>

File build-tools/scripts/dev-init.sh

+#!/bin/sh
+#
+# Copyright (c) 2011, salesforce.com, inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are permitted provided
+# that the following conditions are met:
+#
+#    Redistributions of source code must retain the above copyright notice, this list of conditions and the
+#    following disclaimer.
+#
+#    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+#    the following disclaimer in the documentation and/or other materials provided with the distribution.
+#
+#    Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
+#    promote products derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+# Install pre-commit hook
+echo "Installing pre-commit hook..."
+cp build-tools/scripts/pre-commit.sh .git/hooks
+mv .git/hooks/pre-commit.sh .git/hooks/pre-commit
+chmod +x .git/hooks/pre-commit
+echo "Installed."
+
+# Mark test org properties file as writable
+TEST_ORG_PROPERTIES_FILE=javasdk-test/qa-utils/src/main/resources/force-sdk-test.properties
+echo
+echo "Marking test org properties file as writable..."
+git update-index --assume-unchanged $TEST_ORG_PROPERTIES_FILE
+echo "Marked."
+
+# Enable git flow
+# Check if git flow configuration already exists
+GITFLOW_CONFIG=$(grep gitflow .git/config)
+if [ -z "$GITFLOW_CONFIG" ]; then
+  echo
+  echo "Enabling git flow..."
+  git checkout master
+  git checkout develop
+  if command -v git-flow &>/dev/null; then
+    git flow init
+    echo "git flow enabled."
+  else
+    echo "**git flow not installed. Please install and initialize."
+  fi
+fi
+
+# Setup test org
+echo
+read -p "Would you like to interactively link to a test org [y/N]? " answer
+if [[ "$answer" == "y" || "$answer" == "Y" ]]; then
+  echo
+  ENDPOINT_DEFAULT=$(grep ^endpoint= $TEST_ORG_PROPERTIES_FILE | cut -d '=' -f2)
+  read -p "On which server is your test org located (e.g. login.salesforce.com) [$ENDPOINT_DEFAULT]? " endpoint
+  if [ -z "$endpoint" ]; then
+    endpoint=$ENDPOINT_DEFAULT
+  fi
+
+  ENDPOINT_PROTOCOL_DEFAULT=$(grep ^endpoint\.protocol= $TEST_ORG_PROPERTIES_FILE | cut -d '=' -f2)
+  if [ -z "$ENDPOINT_PROTOCOL_DEFAULT" ]; then
+    ENDPOINT_PROTOCOL_DEFAULT=https
+  fi
+  read -p "What protocol should we use to connect to that server [$ENDPOINT_PROTOCOL_DEFAULT]? " endpoint_protocol
+  if [ -z "$endpoint_protocol" ]; then
+    endpoint_protocol=$ENDPOINT_PROTOCOL_DEFAULT
+  fi
+
+  FORCE_API_VERSION_DEFAULT=$(grep ^force\.apiVersion= $TEST_ORG_PROPERTIES_FILE | cut -d '=' -f2)
+  if [ -z "$FORCE_API_VERSION_DEFAULT" ]; then
+    FORCE_API_VERSION_DEFAULT=$(grep \<force.version.min\>.*\<\/force.version.min\> pom.xml | grep -E -o [0-9]+.[0-9]+)
+  fi
+  read -p "Which Force.com API version would you like to test against [$FORCE_API_VERSION_DEFAULT]? " force_apiVersion
+  if [ -z "$force_apiVersion" ]; then
+    force_apiVersion=$FORCE_API_VERSION_DEFAULT
+  fi
+
+  echo
+  echo "Please provide the username and password for the test org."
+  USER_DEFAULT=$(grep ^user= $TEST_ORG_PROPERTIES_FILE | cut -d '=' -f2)
+  read -p "Username [$USER_DEFAULT]: " user
+  if [ -z "$user" ]; then
+    user=$USER_DEFAULT
+  fi
+
+  read -s -p "Password: " password
+  echo
+  read -s -p "Retype password: " retype_password
+  echo
+
+  password_tries=1
+  while [[ "$password" != "$retype_password" &&  $password_tries < 3 ]]; do
+    echo
+    echo "Failed to match passwords. Please try again."
+
+    read -s -p "Password: " password
+    echo
+    read -s -p "Retype password: " retype_password
+    echo
+
+    let "password_tries += 1"
+  done
+
+  if [ "$password" != "$retype_password" ]; then
+    echo
+    echo "**Exceeded number of password tries. Please add password to $TEST_ORG_PROPERTIES_FILE"
+    password=
+  fi
+
+  echo
+  read -p "Please provide your api security token: " force_apiToken
+
+  echo
+  echo "Developer Edition Force.com orgs can carry a namespace. These can be created under Setup > Create > Packages."
+  echo "If the test org has a Force.com namespace, please enter it below. If no namespace exists or has been created, then simple hit [ENTER]."
+  FORCE_NAMESPACE_DEFAULT=$(grep ^force\.namespace= $TEST_ORG_PROPERTIES_FILE | cut -d '=' -f2)
+  read -p "Force.com namespace [$FORCE_NAMESPACE_DEFAULT]: " force_namespace
+  if [ -z "$force_namespace" ]; then
+    force_namespace=$FORCE_NAMESPACE_DEFAULT
+  fi
+
+  echo
+  echo "For certain tests to run, it is required to create an OAuth Consumer in the test org."
+  echo "Please create a record under Setup > Develop > Remote Access."
+  echo "**The callback URL *must* be: http://localhost:8888/force-app/_auth"
+  echo "**This option *must* be selected: No user approval required for users in this organization"
+  echo
+  echo "Once created, please enter the key and secret below."
+  FORCE_TEST_OAUTH_KEY_DEFAULT=$(grep ^force\.test\.oauth\.key= $TEST_ORG_PROPERTIES_FILE | cut -d '=' -f2)
+  read -p "OAuth key [$FORCE_TEST_OAUTH_KEY_DEFAULT]: " force_test_oauth_key
+  if [ -z "$force_test_oauth_key" ]; then
+    force_test_oauth_key=$FORCE_TEST_OAUTH_KEY_DEFAULT
+  fi
+
+  FORCE_TEST_OAUTH_SECRET_DEFAULT=$(grep ^force\.test\.oauth\.secret= $TEST_ORG_PROPERTIES_FILE | cut -d '=' -f2)
+  read -p "OAuth secret [$FORCE_TEST_OAUTH_SECRET_DEFAULT]: " force_test_oauth_secret
+  if [ -z "$force_test_oauth_secret" ]; then
+    force_test_oauth_secret=$FORCE_TEST_OAUTH_SECRET_DEFAULT
+  fi
+
+  sed -i s/^endpoint=.*/endpoint=$endpoint/g $TEST_ORG_PROPERTIES_FILE
+  sed -i s/^endpoint.protocol=.*/endpoint.protocol=$endpoint_protocol/g $TEST_ORG_PROPERTIES_FILE
+  sed -i s/^force.apiVersion=.*/force.apiVersion=$force_apiVersion/g $TEST_ORG_PROPERTIES_FILE
+  sed -i s/^user=.*/user=$user/g $TEST_ORG_PROPERTIES_FILE
+  sed -i s/^password=.*/password=$password/g $TEST_ORG_PROPERTIES_FILE
+  sed -i s/^api.security.token=.*/api.security.token=$force_apiToken/g $TEST_ORG_PROPERTIES_FILE
+  sed -i s/^force.namespace=.*/force.namespace=$force_namespace/g $TEST_ORG_PROPERTIES_FILE
+  sed -i s/^force.test.oauth.key=.*/force.test.oauth.key=$force_test_oauth_key/g $TEST_ORG_PROPERTIES_FILE
+  sed -i s/^force.test.oauth.secret=.*/force.test.oauth.secret=$force_test_oauth_secret/g $TEST_ORG_PROPERTIES_FILE
+  
+  echo
+  echo "Values written to $TEST_ORG_PROPERTIES_FILE"
+fi
+

File build-tools/scripts/doc-deploy.sh

+#!/bin/sh
+#
+# Copyright (c) 2011, salesforce.com, inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are permitted provided
+# that the following conditions are met:
+#
+#    Redistributions of source code must retain the above copyright notice, this list of conditions and the
+#    following disclaimer.
+#
+#    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+#    the following disclaimer in the documentation and/or other materials provided with the distribution.
+#
+#    Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
+#    promote products derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+if test $# -lt 3; then
+    echo usage: $0 docSiteLocation workindDir gitRepo commitMessage
+    echo example: deployDocs.sh /var/www/site /home/myDir git@github.com:user/repo.git "'my commit message'"
+    exit
+fi
+DOCLOCATION=$1
+WORKDIR=$2
+GITREPO=$3
+COMMITMSG=$4
+rm -r -f $WORKDIR/*
+rm -r -f $WORKDIR/.git*
+cd $WORKDIR
+git clone $GITREPO .
+git checkout gh-pages
+rm -r -f $WORKDIR/*
+cp -r $DOCLOCATION/* $WORKDIR
+git add .
+git commit -m "$COMMITMSG"
+git push origin gh-pages:gh-pages

File build-tools/scripts/pre-commit.sh

+#!/bin/sh
+#
+# Copyright (c) 2011, salesforce.com, inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification, are permitted provided
+# that the following conditions are met:
+#
+#    Redistributions of source code must retain the above copyright notice, this list of conditions and the
+#    following disclaimer.
+#
+#    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+#    the following disclaimer in the documentation and/or other materials provided with the distribution.
+#
+#    Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
+#    promote products derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+BRANCH_CHECK_STR=`git branch -a | grep "* master"`
+
+LEN=$(echo ${#BRANCH_CHECK_STR})
+
+if [ $LEN -gt 0 ]; then
+	echo "Commits not allowed on master branch"
+	exit 1
+fi
+

File build-tools/src/main/resources/checkstyle/force-sdk-checks.xml

+<?xml version="1.0"?>
+<!--
+
+    Copyright (c) 2011, salesforce.com, inc.
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without modification, are permitted provided
+    that the following conditions are met:
+
+       Redistributions of source code must retain the above copyright notice, this list of conditions and the
+       following disclaimer.
+
+       Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+       the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+       Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
+       promote products derived from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+    TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+    POSSIBILITY OF SUCH DAMAGE.
+
+-->
+
+<!DOCTYPE module PUBLIC
+    "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+    "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!--
+
+  Checkstyle configuration that checks coding conventions for the Force.com SDK.
+  
+  These conventions are mostly based on the sun coding conventions from:
+
+    - the Java Language Specification at
+      http://java.sun.com/docs/books/jls/second_edition/html/index.html
+
+    - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+
+    - the Javadoc guidelines at
+      http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+
+    - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+
+    - some best practices
+
+-->
+
+<module name="Checker">
+
+    <!-- Set the default severity level to WARNING -->
+    <property name="severity" value="warning"/>
+    
+    <!-- Load the suppressions in force-sdk-suppressions.xml -->
+    <module name="SuppressionFilter">
+      <property name="file" value="${checkstyle.suppressions.file}"/>
+    </module>
+    
+    <!-- Checks that each Java package has a Javadoc file used for commenting. -->
+    <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage       
+    TODO: Should we require Javadoc on Packages?
+    <module name="JavadocPackage">
+      <property name="allowLegacy" value="true"/>
+    </module>
+    -->
+
+    <!-- Checks whether files end with a new line.                        -->
+    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
+    <module name="NewlineAtEndOfFile"/>
+
+    <!-- Checks that property files contain the same keys.         -->
+    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+    <module name="Translation"/>
+
+    <module name="FileLength"/>
+
+    <!-- Following interprets the header file as regular expressions. -->
+    <!-- <module name="RegexpHeader"/>                                -->
+
+    <module name="FileTabCharacter">
+        <property name="eachLine" value="true"/>
+    </module>
+
+    <module name="TreeWalker">
+
+        <module name="RegexpSinglelineJava">
+          <!-- Check against trailing whitespace in Java code -->
+          <property name="format" value="[\S]+\s+$"/>
+          <property name="message" value="Line has trailing spaces."/>
+          <property name="ignoreComments" value="true"/>
+        </module>
+
+        <module name="FileContentsHolder"/>
+
+        <!-- Checks for Javadoc comments.                     -->
+        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+        <module name="JavadocMethod">
+          <property name="severity" value="error"/>
+          <property name="scope" value="public"/>
+          <!-- Allows Javadoc on undeclared RuntimeExceptions -->
+          <property name="allowUndeclaredRTE" value="true"/>
+          <property name="allowMissingPropertyJavadoc" value="true"/>
+        </module>
+        <module name="JavadocType">
+          <property name="id" value="typeJavadocExists"/>
+          <property name="severity" value="error"/>
+          <property name="scope" value="public"/>
+        </module>
+        <module name="JavadocType">
+          <property name="id" value="fullNameAuthor"/>
+          <!-- severity=warning -->
+          <property name="authorFormat" value="[A-Z][\S]+\s[A-Z][\S]+"/>
+          <message key="type.tagFormat" value="@author must be a full name (checked pattern ''{1}'')"/>
+        </module>
+        <module name="JavadocVariable">
+          <property name="severity" value="error"/>
+          <property name="scope" value="public"/>
+        </module>
+        <module name="JavadocStyle"/>
+
+        <!-- Checks for Naming Conventions.                  -->
+        <!-- See http://checkstyle.sf.net/config_naming.html -->
+        <module name="ConstantName"/>
+        <module name="LocalFinalVariableName"/>
+        <module name="LocalVariableName"/>
+        <module name="MemberName"/>
+        <module name="MethodName"/>
+        <module name="PackageName"/>
+        <module name="ParameterName"/>
+        <module name="StaticVariableName"/>
+        <module name="TypeName"/>
+
+        <!-- Checks for imports                              -->
+        <!-- See http://checkstyle.sf.net/config_import.html -->
+        <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
+        <module name="RedundantImport"/>
+        <module name="UnusedImports"/>
+
+        <!-- Checks for Size Violations.                    -->
+        <!-- See http://checkstyle.sf.net/config_sizes.html -->
+        <module name="LineLength">
+          <property name="max" value="130"/>
+        </module>
+        <module name="MethodLength">
+          <property name="max" value="200"/>
+        </module>
+        <module name="ParameterNumber">
+          <property name="max" value="13"/>
+        </module>
+
+        <!-- Checks for whitespace                               -->
+        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
+        <module name="EmptyForIteratorPad"/>
+        <module name="MethodParamPad"/>
+        <module name="NoWhitespaceAfter">
+          <!-- No ARRAY_INIT -->
+          <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
+        </module>
+        <module name="NoWhitespaceBefore">
+          <property name="allowLineBreaks" value="true"/>
+        </module>
+        <module name="OperatorWrap"/>
+        <module name="ParenPad"/>
+        <module name="TypecastParenPad"/>
+        <module name="WhitespaceAfter"/>
+        <module name="WhitespaceAround"/>
+
+        <!-- Modifier Checks                                    -->
+        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+        <module name="ModifierOrder"/>
+        <module name="RedundantModifier"/>
+
+        <!-- Checks for blocks. You know, those {}'s         -->
+        <!-- See http://checkstyle.sf.net/config_blocks.html -->
+        <module name="AvoidNestedBlocks"/>
+        <module name="EmptyBlock">
+          <property name="option" value="text"/>
+        </module>
+        <module name="LeftCurly"/>
+        <module name="NeedBraces">
+          <property name="tokens" value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE"/>
+        </module>
+        <module name="RightCurly"/>
+
+        <!-- Checks for common coding problems               -->
+        <!-- See http://checkstyle.sf.net/config_coding.html -->
+        <module name="DoubleCheckedLocking"/>
+        <module name="EmptyStatement"/>
+        <module name="EqualsHashCode"/>
+        <module name="HiddenField">
+          <property name="ignoreConstructorParameter" value="true"/>
+          <property name="ignoreSetter" value="true"/>
+        </module>
+        <module name="IllegalInstantiation"/>
+        <module name="MissingSwitchDefault"/>
+        <module name="RedundantThrows">
+          <property name="allowUnchecked" value="true"/>
+        </module>
+        <module name="SimplifyBooleanExpression"/>
+        <module name="SimplifyBooleanReturn"/>
+
+        <!-- Checks for class design                         -->
+        <!-- See http://checkstyle.sf.net/config_design.html -->
+        <module name="FinalClass"/>
+        <module name="HideUtilityClassConstructor"/>
+        <module name="VisibilityModifier">
+          <property name="packageAllowed" value="true"/>
+          <property name="protectedAllowed" value="true"/>
+        </module>
+
+        <!-- Miscellaneous other checks.                   -->
+        <!-- See http://checkstyle.sf.net/config_misc.html -->
+        <module name="ArrayTypeStyle"/>
+        <module name="TodoComment">
+          <property name="severity" value="info"/>
+        </module>
+        <module name="UpperEll"/>
+
+    </module>
+
+    <module name="SuppressionCommentFilter"/>
+
+</module>

File build-tools/src/main/resources/checkstyle/force-sdk-suppressions.xml

+<?xml version="1.0"?>
+<!--
+
+    Copyright (c) 2011, salesforce.com, inc.
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without modification, are permitted provided
+    that the following conditions are met:
+
+       Redistributions of source code must retain the above copyright notice, this list of conditions and the
+       following disclaimer.
+
+       Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+       the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+       Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
+       promote products derived from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+    TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+    POSSIBILITY OF SUCH DAMAGE.
+
+-->
+
+<!DOCTYPE suppressions PUBLIC
+    "-//Puppy Crawl//DTD Suppressions 1.1//EN"
+    "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
+    
+<!--
+
+  Checkstyle checks to suppress for the Force.com SDK.
+  
+  See Checkstyle documentation at:
+  http://checkstyle.sourceforge.net/config.html
+
+-->
+<suppressions>
+    <!-- Do not require method and variable Javadoc in test classes -->
+    <suppress checks="JavadocMethod" files="Test.java"/>
+    <suppress checks="JavadocMethod" files="[/\\]test[/\\]"/>
+    <suppress checks="JavadocVariable" files="Test.java"/>
+    <suppress checks="JavadocVariable" files="[/\\]test[/\\]"/>
+    
+    <!-- Allow public class members in test classes -->
+    <suppress checks="VisibilityModifier" files="Test.java"/>
+    <suppress checks="VisibilityModifier" files="[/\\]test[/\\]"/>
+    
+    <!-- Hidden fields are OK for the Builder pattern in CodeGenerator -->
+    <suppress checks="HiddenField" files="CodeGenerator.java"
+              lines="140-1000"/>
+</suppressions>

File build-tools/src/main/resources/license/header.txt

+Copyright (c) 2011, salesforce.com, inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided
+that the following conditions are met:
+
+   Redistributions of source code must retain the above copyright notice, this list of conditions and the
+   following disclaimer.
+
+   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+   the following disclaimer in the documentation and/or other materials provided with the distribution.
+  
+   Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
+   promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.

File build-tools/src/main/resources/license/stringtemplatedefinition.xml

+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright (c) 2011, salesforce.com, inc.
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without modification, are permitted provided
+    that the following conditions are met:
+
+       Redistributions of source code must retain the above copyright notice, this list of conditions and the
+       following disclaimer.
+
+       Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+       the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+       Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
+       promote products derived from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+    WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+    TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+    POSSIBILITY OF SUCH DAMAGE.
+
+-->
+
+<additionalHeaders>
+    <stringtemplate_style>
+        <firstLine>$!EOL</firstLine>
+        <beforeEachLine>    </beforeEachLine>
+        <endLine>EOL!$</endLine>
+        <firstLineDetectionPattern>\$!$</firstLineDetectionPattern>
+        <lastLineDetectionPattern>!\$$</lastLineDetectionPattern>
+        <allowBlankLines>true</allowBlankLines>
+        <isMultiline>true</isMultiline>
+    </stringtemplate_style>
+</additionalHeaders>

File codegen/pom.xml

+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <parent>
+    <groupId>com.force.sdk</groupId>
+    <artifactId>force-sdk</artifactId>
+    <version>22.0.7-BETA</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>com.force.sdk</groupId>
+  <artifactId>force-codegen</artifactId>
+  <name>force-codegen</name>
+
+  <properties>
+    <stringtemplate.version>3.2</stringtemplate.version>
+  </properties>
+
+  <build>
+    <plugins>
+
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+      </plugin>
+
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>findbugs-maven-plugin</artifactId>
+        <configuration>
+          <!-- Use Findbugs exclude filter from test resources -->
+          <excludeFilterFile>${project.build.testOutputDirectory}/findbugs-exclude.xml</excludeFilterFile>
+        </configuration>
+      </plugin>
+      
+    </plugins>
+  </build>
+
+
+  <dependencies>
+    <dependency>
+      <groupId>com.force.api</groupId>
+      <artifactId>force-partner-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.force.api</groupId>
+      <artifactId>force-wsc</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.force.sdk</groupId>
+      <artifactId>force-jpa</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.google.collections</groupId>
+      <artifactId>google-collections</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.google.inject</groupId>
+      <artifactId>guice</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.googlecode.jmockit</groupId>
+      <artifactId>jmockit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.antlr</groupId>
+      <artifactId>stringtemplate</artifactId>
+      <version>${stringtemplate.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jpa_2.0_spec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+</project>

File codegen/src/main/java/com/force/sdk/codegen/AbstractCodeGenerator.java

+/**
+ * Copyright (c) 2011, salesforce.com, inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *    Redistributions of source code must retain the above copyright notice, this list of conditions and the
+ *    following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+ *    the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ *    Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
+ *    promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.force.sdk.codegen;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import com.force.sdk.codegen.filter.FieldFilter;
+import com.force.sdk.codegen.filter.ObjectFilter;
+import com.force.sdk.codegen.injector.TemplateInjector;
+import com.force.sdk.codegen.template.Template;
+import com.force.sdk.codegen.writer.WriterProvider;
+import com.sforce.soap.partner.DescribeGlobalSObjectResult;
+import com.sforce.soap.partner.DescribeSObjectResult;
+import com.sforce.soap.partner.GetUserInfoResult;
+import com.sforce.soap.partner.PartnerConnection;
+import com.sforce.ws.ConnectionException;
+
+/**
+ * Abstract Code Generator.
+ * <p>
+ * The generator will load up all Force.com schema object (SObject) information 
+ * for a given Force.com store (organization). It then filters and selects
+ * the data that is necessary for code generation and writes
+ * this to a {@code Template}.
+ * <p>
+ * Notice that code generation is analogous to MVC (well, at
+ * least the MV parts): 
+ * <p>
+ * <ol>
+ *   <li>
+ *    Model = {@code ObjectFilter}, {@code FieldFilter}. This provides the data that will
+ *    be used in the template.
+ *    </li>
+ *    <li>
+ *    View = {@code Template}.  This represents the physical layout of
+ *    the code being generated.
+ *    </li>
+ *    <li>
+ *    A {@code WriterProvider} provides Java {@code Writer}s to the {@code CodeGenerator}
+ *    to tell it where to write the generated code. 
+ *    </li>
+ * </ol>
+ *
+ * @author Tim Kral
+ */
+public abstract class AbstractCodeGenerator implements CodeGenerator {
+    
+    private static final int MAX_BATCH_DESCRIBE_SIZE = 100;
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public final int generateCode(PartnerConnection conn, File destDir) throws ConnectionException, IOException {
+        
+        // Get all known SObjects in the organization
+        List<String> allOrgObjectNames = new ArrayList<String>();
+        for (DescribeGlobalSObjectResult dgsr : conn.describeGlobal().getSobjects()) {
+            allOrgObjectNames.add(dgsr.getName());
+        }
+        
+        // Describe all known SObjects in the organization.  Batch by the appropriate size.
+        // TODO: Is this ok to read entirely into memory?
+        List<DescribeSObjectResult> allOrgObjects = new ArrayList<DescribeSObjectResult>();
+        for (int i = 0; i < allOrgObjectNames.size(); i += MAX_BATCH_DESCRIBE_SIZE) {
+            // Ensure that our range only goes to the end of the allOrgObjectNames array
+            int endIndex = i + MAX_BATCH_DESCRIBE_SIZE;
+            if (endIndex > allOrgObjectNames.size()) endIndex = allOrgObjectNames.size();
+            
+            List<String> objectNameBatch = allOrgObjectNames.subList(i, endIndex);
+            DescribeSObjectResult[] dsrs =
+                conn.describeSObjects(objectNameBatch.toArray(new String[objectNameBatch.size()]));
+            
+            allOrgObjects.addAll(Arrays.<DescribeSObjectResult>asList(dsrs));
+        }
+        
+        // Get the user information
+        GetUserInfoResult userInfo = conn.getUserInfo();
+        
+        ObjectFilter objectFilter = getObjectFilter();
+        assert objectFilter != null;
+        
+        FieldFilter fieldFilter = getFieldFilter();
+        assert fieldFilter != null;
+        
+        Template template = getTemplate();
+        assert template != null;
+        
+        TemplateInjector templateInjector = getTemplateInjector();
+        assert templateInjector != null;
+        
+        WriterProvider writerProvider = getWriterProvider(destDir);
+        assert writerProvider != null;
+        
+        // Write filtered data to the template
+        int numGeneratedCode = 0;
+        
+        for (DescribeSObjectResult dsr : objectFilter.filter(allOrgObjects)) {
+            // Before we write a new source file, make sure the template is reset
+            template.reset();
+            
+            // Inject the data into the template 
+            templateInjector.inject(userInfo, dsr, fieldFilter.filter(dsr), template);
+            
+            Writer writer = null;
+            try {
+                writer = writerProvider.getWriter(userInfo, dsr);
+                template.write(writer);
+                numGeneratedCode++;
+            } finally {
+                if (writer != null) writer.close();
+            }
+        }
+        
+        return numGeneratedCode;
+    }
+    
+    protected abstract ObjectFilter getObjectFilter();
+    protected abstract FieldFilter getFieldFilter();
+
+    protected abstract Template getTemplate();
+    protected abstract TemplateInjector getTemplateInjector();
+    protected abstract WriterProvider getWriterProvider(File destDir);
+    
+}

File codegen/src/main/java/com/force/sdk/codegen/CodeGenerator.java

+/**
+ * Copyright (c) 2011, salesforce.com, inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ *    Redistributions of source code must retain the above copyright notice, this list of conditions and the
+ *    following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+ *    the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ *    Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
+ *    promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.force.sdk.codegen;
+
+import java.io.File;
+import java.io.IOException;
+
+import com.sforce.soap.partner.PartnerConnection;