Browse Source

Mostly complete migration of build script to Moxie

tags/v1.2.0
James Moger 11 years ago
parent
commit
926634baac

+ 18
- 43
.classpath View File

@@ -1,43 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="tests"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="ext/junit-4.8.2.jar" sourcepath="C:/Users/James Moger/.m2/repository/junit/junit/4.8.2/junit-4.8.2-sources.jar"/>
<classpathentry kind="lib" path="ext/jcommander-1.17.jar" sourcepath="ext/jcommander-1.17-sources.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/iciql/ext/jcommander-1.17-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="ext/markdownpapers-core-1.1.0.jar" sourcepath="ext/markdownpapers-core-1.1.0-sources.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/iciql/ext/markdownpapers-core-1.1.0-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="ext/doclava-1.0.3.jar" sourcepath="ext/doclava-1.0.3-sources.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/iciql/ext/doclava-1.0.3-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="ext/slf4j-api-1.6.1.jar" sourcepath="ext/slf4j-api-1.6.1-sources.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/iciql/ext/slf4j-api-1.6.1-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="ext/derby-10.9.1.0.jar"/>
<classpathentry kind="lib" path="ext/mysql-connector-java-5.1.15.jar"/>
<classpathentry kind="lib" path="ext/postgresql-9.0-801.jdbc4.jar"/>
<classpathentry kind="lib" path="ext/commons-dbcp-1.4.jar" sourcepath="ext/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4-sources.jar"/>
<classpathentry kind="lib" path="ext/commons-pool-1.5.6.jar" sourcepath="ext/commons-pool-1.5.6-sources.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/iciql/ext/commons-pool-1.5.6-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="ext/h2-1.3.168.jar" sourcepath="ext/h2-1.3.168-sources.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/iciql/ext/h2-1.3.168-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="ext/hsqldb-2.2.8.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src" />
<classpathentry kind="src" path="tests" output="bin/test-classes" />
<classpathentry kind="lib" path="ext/jcommander-1.17.jar" sourcepath="ext/src/jcommander-1.17.jar" />
<classpathentry kind="lib" path="ext/h2-1.3.168.jar" sourcepath="ext/src/h2-1.3.168.jar" />
<classpathentry kind="lib" path="ext/hsqldb-2.2.8.jar" />
<classpathentry kind="lib" path="ext/derby-10.9.1.0.jar" />
<classpathentry kind="lib" path="ext/mysql-connector-java-5.1.15.jar" />
<classpathentry kind="lib" path="ext/postgresql-9.0-801.jdbc4.jar" sourcepath="ext/src/postgresql-9.0-801.jdbc4.jar" />
<classpathentry kind="lib" path="ext/slf4j-api-1.6.1.jar" sourcepath="ext/src/slf4j-api-1.6.1.jar" />
<classpathentry kind="lib" path="ext/commons-pool-1.5.6.jar" sourcepath="ext/src/commons-pool-1.5.6.jar" />
<classpathentry kind="lib" path="ext/commons-dbcp-1.4.jar" sourcepath="ext/src/commons-dbcp-1.4.jar" />
<classpathentry kind="lib" path="ext/junit-4.11.jar" sourcepath="ext/src/junit-4.11.jar" />
<classpathentry kind="lib" path="ext/hamcrest-core-1.3.jar" sourcepath="ext/src/hamcrest-core-1.3.jar" />
<classpathentry kind="output" path="bin/classes" />
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" />
</classpath>

+ 3
- 0
.gitmodules View File

@@ -0,0 +1,3 @@
[submodule "maven"]
path = maven
url = https://github.com/gitblit/iciql-maven.git

+ 23
- 23
.project View File

@@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>iciql</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Iciql</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>

+ 5
- 21
NOTICE View File

@@ -6,13 +6,13 @@ This is an aggregated NOTICE file for the projects included
in this distribution or linked to by this distribution.
---------------------------------------------------------------------------
google-code-prettify
Moxie Build Toolkit
---------------------------------------------------------------------------
google-code-prettify, released under the
Moxie Build Toolkit, released under the
Apache Software License, Version 2.0.
http://code.google.com/p/google-code-prettify
http://moxie.gitblit.com
---------------------------------------------------------------------------
JUnit
---------------------------------------------------------------------------
@@ -53,22 +53,6 @@ Apache Derby Database
http://db.apache.org/derby
---------------------------------------------------------------------------
MarkdownPapers
---------------------------------------------------------------------------
MarkdownPapers, released under the
Apache Software License, Version 2.0.
http://markdown.tautua.org
---------------------------------------------------------------------------
doclava
---------------------------------------------------------------------------
doclava, released under the
Apache Software License, Version 2.0.
http://code.google.com/p/doclava
---------------------------------------------------------------------------
SLF4J
---------------------------------------------------------------------------

+ 0
- 4302
api/v1.xml
File diff suppressed because it is too large
View File


+ 0
- 6184
api/v10.xml
File diff suppressed because it is too large
View File


+ 0
- 6324
api/v11.xml
File diff suppressed because it is too large
View File


+ 0
- 6364
api/v12.xml
File diff suppressed because it is too large
View File


+ 0
- 6388
api/v13.xml
File diff suppressed because it is too large
View File


+ 0
- 6552
api/v14.xml
File diff suppressed because it is too large
View File


+ 0
- 6552
api/v15.xml
File diff suppressed because it is too large
View File


+ 0
- 4423
api/v2.xml
File diff suppressed because it is too large
View File


+ 0
- 4644
api/v3.xml
File diff suppressed because it is too large
View File


+ 0
- 5692
api/v4.xml
File diff suppressed because it is too large
View File


+ 0
- 5781
api/v5.xml
File diff suppressed because it is too large
View File


+ 0
- 5874
api/v6.xml
File diff suppressed because it is too large
View File


+ 0
- 5916
api/v7.xml
File diff suppressed because it is too large
View File


+ 0
- 6178
api/v8.xml
File diff suppressed because it is too large
View File


+ 0
- 6178
api/v9.xml
File diff suppressed because it is too large
View File


+ 104
- 0
build.moxie View File

@@ -0,0 +1,104 @@
#
# Iciql project descriptor
#

# Specify minimum Moxie version required to build
requires: 0.6.2

# Project Metadata
name: Iciql
description: a model-based database access wrapper for JDBC
groupId: com.iciql
artifactId: iciql
version: 1.2.0-SNAPSHOT
inceptionYear: 2011

# Current stable release
releaseVersion: 1.1.0
releaseDate: '2012-08-20'

# Project urls
url: 'http://iciql.com'
issuesUrl: 'http://code.google.com/p/iciql/issues'
mavenUrl: 'http://gitblit.github.com/iciql/maven'

licenses:
- {
name: Apache ASL v2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
}

developers:
- {
id: james
name: James Moger
url: 'https://plus.google.com/u/0/116428776452027956920'
organization: VAS
organizationUrl: 'http://www.vas.com'
roles: developer
}

scm: {
connection: 'scm:git:git://github.com/gitblit/iciql.git'
developerConnection: 'scm:git:https://github.com/gitblit/iciql.git'
url: 'https://github.com/gitblit/iciql'
tag: HEAD
}

# Model generation tool
mainclass: com.iciql.util.GenerateModels

sourceDirectories:
- compile 'src'
- test 'tests'
- site 'docs'

resourceDirectories:
- site 'docs/resources'

# compile for Java 6 class format
tasks: {
'mx:javac' : {
source: 1.6
target: 1.6
compiler: javac1.6
encoding: UTF-8
# stop complaints about bootstrap classpath when compiling with Java 7
compilerArgs: '-Xlint:-options'
}
}

# Generate Eclipse project files.
apply: eclipse

# Copy all retrieved dependencies to the "ext" directory.
# Generated IDE settings (.classpath, etc) will use the artifacts
# from this project-relative directory. This allows the IDE settings
# to be version-controlled and shared.
dependencyDirectory: ext

# Source all dependencies from the following repositories in the specified order
repositories: central

properties: {
h2.version : 1.3.168
hsqldb.version : 2.2.8
derby.version : 10.9.1.0
mysql.version : 5.0.51b
postgresql.version : 9.0
postgresqldriver.version : 9.0-801.jdbc4
}

dependencies:
- provided 'com.beust:jcommander:1.17'
- provided 'com.h2database:h2:${h2.version}'
- provided 'org.hsqldb:hsqldb:${hsqldb.version}'
- provided 'org.apache.derby:derby:${derby.version}'
- provided 'mysql:mysql-connector-java:5.1.15'
- provided 'postgresql:postgresql:${postgresqldriver.version}'
- provided 'org.slf4j:slf4j-api:1.6.1'
- provided 'commons-pool:commons-pool:1.5.6'
- provided 'commons-dbcp:commons-dbcp:1.4'
- test 'junit'
- build 'jacoco'


+ 200
- 304
build.xml View File

@@ -1,85 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="iciql" default="buildAll" basedir=".">
<project name="iciql" default="build" xmlns:mx="antlib:org.moxie">
<!-- Google Code upload task -->
<taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask"
classpath="${basedir}/tools/ant-googlecode-0.0.3.jar" name="gcupload"/>
<!-- Project Properties -->
<property name="project.build.dir" value="${basedir}/build" />
<property name="project.site.dir" value="${basedir}/site" />
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Retrieve Moxie Toolkit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<property name="moxie.version" value="0.6.2" />
<property name="moxie.url" value="http://gitblit.github.com/moxie/maven" />
<property name="moxie.jar" value="moxie-toolkit-${moxie.version}.jar" />
<property name="moxie.dir" value="${user.home}/.moxie" />
<!-- Download Moxie from it's Maven repository to user.home -->
<get src="${moxie.url}/org/moxie/moxie-toolkit/${moxie.version}/${moxie.jar}"
dest="${moxie.dir}" skipexisting="true" verbose="true" />
<!-- Register Moxie tasks -->
<taskdef uri="antlib:org.moxie">
<classpath location="${moxie.dir}/${moxie.jar}" />
</taskdef>
<available property="hasBuildProps" file="${basedir}/build.properties"/>
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Load build.properties, if available
Initialize Moxie and setup build properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="buildprops" if="hasBuildProps">
<!-- Load publication servers, paths, and credentials -->
<loadproperties>
<file file="${basedir}/build.properties" />
</loadproperties>
</target>
<target name="prepare" description="Retrieves dependencies and sets up build properties">
<mx:init />
</target>
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Scrape the version info from code and setup the build properties
Clean
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="buildinfo" depends="buildprops">
<!-- extract iciql version number from source code -->
<loadfile property="iq.version" srcfile="${basedir}/src/com/iciql/Constants.java">
<filterchain>
<linecontains>
<contains value="public static final String VERSION = " />
</linecontains>
<striplinebreaks />
<tokenfilter>
<replacestring from="public static final String VERSION = &quot;" to="" />
<replacestring from="&quot;;" to="" />
<trim />
</tokenfilter>
</filterchain>
</loadfile>
<target name="clean" depends="prepare" description="Cleans build directory">
<!-- extract iciql version date from source code -->
<loadfile property="iq.versionDate" srcfile="${basedir}/src/com/iciql/Constants.java">
<filterchain>
<linecontains>
<contains value="public static final String VERSION_DATE = " />
</linecontains>
<striplinebreaks />
<tokenfilter>
<replacestring from="public static final String VERSION_DATE = &quot;" to="" />
<replacestring from="&quot;;" to="" />
<trim />
</tokenfilter>
</filterchain>
</loadfile>
<!-- extract iciql current api version from source code -->
<loadfile property="iq.apiCurrent" srcfile="${basedir}/src/com/iciql/Constants.java">
<filterchain>
<linecontains>
<contains value="public static final String API_CURRENT = " />
</linecontains>
<striplinebreaks />
<tokenfilter>
<replacestring from="public static final String API_CURRENT = &quot;" to="" />
<replacestring from="&quot;;" to="" />
<trim />
</tokenfilter>
</filterchain>
</loadfile>
<mx:clean />
<property name="library.jar" value="iciql-${iq.version}.jar" />
<property name="javadoc.jar" value="iciql-${iq.version}-javadoc.jar" />
<property name="sources.jar" value="iciql-${iq.version}-sources.jar" />
<property name="distribution.zip" value="iciql-${iq.version}.zip" />
</target>
@@ -88,86 +54,30 @@
Compile
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="compile" depends="buildinfo" description="Retrieves dependencies and compiles iciql from source">
<!-- Compile the build tool and execute it.
This downloads missing compile-time dependencies from Maven. -->
<target name="compile" depends="prepare" description="Compiles iciql from source">
<delete dir="${project.build.dir}" />
<mkdir dir="${project.build.dir}" />
<javac encoding="utf-8" debug="true" srcdir="${basedir}/src" destdir="${project.build.dir}">
<include name="com/iciql/build/Build.java" />
<include name="com/iciql/Constants.java" />
<include name="com/iciql/utils/Utils.java" />
<include name="com/iciql/utils/StringUtils.java" />
</javac>
<java classpath="${project.build.dir}" classname="com.iciql.build.Build" />
<mx:javac />
</target>
<!-- Compile Project -->
<path id="master-classpath">
<fileset dir="${basedir}/ext">
<include name="*.jar" />
</fileset>
</path>
<javac encoding="utf-8" debug="true" destdir="${project.build.dir}" failonerror="false">
<src path="${basedir}/src" />
<src path="${basedir}/tests" />
<classpath refid="master-classpath" />
</javac>
<copy todir="${project.build.dir}">
<fileset dir="${basedir}/src" excludes="**/*.java,**/thumbs.db" />
</copy>
<!-- Execute the test suite -->
<echo>Executing iciql ${iq.version} test suite</echo>
<echo>This will take a few minutes...</echo>
<java classpath="${project.build.dir}" classname="com.iciql.test.IciqlSuite">
<classpath refid="master-classpath" />
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TestSuite
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="testsuite" depends="compile" description="runs the benchmark test suite against all databases">
<echo/>
<echo>This will take a minute or two...</echo>
<echo/>
<mx:javac scope="test" />
<mx:run scope="test" classname="com.iciql.test.IciqlSuite">
<arg value="--dbFile" />
<arg value="${basedir}/performance_db.txt" />
<arg value="${project.outputDirectory}/performance_db.txt" />
<arg value="--sqlFile" />
<arg value="${basedir}/performance_sql.txt" />
</java>
<!-- Build Standard Javadoc -->
<delete dir="${basedir}/javadoc" />
<javadoc destdir="${basedir}/javadoc" nonavbar="true" stylesheetfile="${basedir}/docs/resources/javadoc.css">
<fileset dir="${basedir}/src" defaultexcludes="yes">
<include name="com/iciql/**/*.java"/>
<exclude name="com/iciql/build/**"/>
</fileset>
</javadoc>
<!-- Build Doclava Javadoc -->
<!-- Build API XML file -->
<delete dir="${basedir}/doclava" />
<javadoc destdir="${basedir}/doclava"
docletpath="${basedir}/ext/doclava-1.0.3.jar"
bootclasspath="${java.home}/lib/rt.jar">
<doclet name="com.google.doclava.Doclava">
<param name="-hdf"/> <param name="project.name"/> <param name="iciql"/>
<!-- versioning -->
<param name="-since"/> <param name="api/v1.xml"/> <param name="v1" />
<param name="-since"/> <param name="api/v2.xml"/> <param name="v2" />
<param name="-since"/> <param name="api/v3.xml"/> <param name="v3" />
<param name="-since"/> <param name="api/v4.xml"/> <param name="v4" />
<param name="-since"/> <param name="api/v5.xml"/> <param name="v5" />
<param name="-apiversion" value="v${iq.apiCurrent}"/>
<param name="-apixml" value="api/v${iq.apiCurrent}.xml"/>
<!-- federation -->
<param name="-federate" /><param name="JDK"/>
<param name="http://download.oracle.com/javase/6/docs/api/index.html?"/>
<param name="-federationxml"/><param name="JDK"/>
<param name="http://doclava.googlecode.com/svn/static/api/openjdk-6.xml"/>
</doclet>
<fileset dir="${basedir}/src" defaultexcludes="yes">
<include name="com/iciql/**/*.java"/>
<exclude name="com/iciql/build/**"/>
</fileset>
</javadoc>
<arg value="${project.outputDirectory}/performance_sql.txt" />
</mx:run>
</target>
@@ -178,209 +88,195 @@
-->
<target name="build" depends="compile" description="Builds iciql from source">
<echo>Building iciql binaries ${iq.version}</echo>
<!-- delete any old artifacts -->
<delete>
<fileset dir="${basedir}">
<include name="*.jar"/>
<include name="*.zip"/>
</fileset>
</delete>
<!-- library jar -->
<jar destfile="${library.jar}">
<manifest>
<attribute name="Main-Class" value="com.iciql.util.GenerateModels" />
</manifest>
<fileset dir="${project.build.dir}">
<include name="**/*" />
<exclude name="com/iciql/build/" />
<exclude name="com/iciql/test/" />
<exclude name="**/*.html" />
</fileset>
</jar>
<!-- standard javadoc jar -->
<jar destfile="${javadoc.jar}">
<fileset dir="${basedir}/javadoc">
<include name="**/*" />
</fileset>
</jar>
<!-- sources jar -->
<jar destfile="${sources.jar}">
<fileset dir="${basedir}/src">
<include name="**/*" />
<exclude name="com/iciql/build/" />
<exclude name="com/iciql/tests/" />
<exclude name="**/*.html" />
</fileset>
</jar>
<!-- zip distribution file -->
<jar destfile="${distribution.zip}">
<mx:jar packageSources="true" />
<mx:javadoc redirect="true" />
<mx:zip>
<artifact />
<artifact classifier="sources"/>
<artifact classifier="javadoc"/>
<fileset dir="${basedir}">
<include name="*.jar" />
<include name="LICENSE" />
<include name="NOTICE" />
<include name="javadoc/**/*" />
</fileset>
</jar>
</target>
</mx:zip>
<!-- Deploy the artifacts into the version-controlled repository -->
<mx:deploy basedir="${basedir}/maven" allowSnapshots="false" />
</target>
<!--
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build the iciql website
Upload artifacts to GoogleCode and the remote Maven repository
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="buildSite" depends="compile" description="Build the iciql website">
<echo>Building iciql website ${iq.version}</echo>
<!-- Build Site -->
<delete dir="${project.site.dir}" />
<mkdir dir="${project.site.dir}" />
<copy todir="${project.site.dir}">
<fileset dir="${basedir}/docs/resources">
<include name="*.png" />
<include name="*.css" />
<include name="*.js" />
</fileset>
</copy>
<!-- Copy standard javadoc -->
<mkdir dir="${project.site.dir}/javadoc" />
<copy todir="${project.site.dir}/javadoc">
<fileset dir="${basedir}/javadoc">
<include name="**/*" />
</fileset>
</copy>
<!-- Build site pages -->
<java classpath="${project.build.dir}" classname="com.iciql.build.BuildSite">
<classpath refid="master-classpath" />
<arg value="--sourceFolder" />
<arg value="${basedir}/docs" />
<arg value="--outputFolder" />
<arg value="${project.site.dir}" />
<arg value="--pageHeader" />
<arg value="${basedir}/docs/resources/site_header.html" />
<arg value="--pageFooter" />
<arg value="${basedir}/docs/resources/site_footer.html" />
<arg value="--analyticsSnippet" />
<arg value="${basedir}/docs/resources/site_analytics.html" />
<arg value="--adSnippet" />
<arg value="${basedir}/docs/resources/site_ads.html" />
<arg value="--alias" />
<arg value="index=overview" />
<arg value="--alias" />
<arg value="table_versioning=versioning" />
<arg value="--nomarkdown" />
<arg value="%BEGINCODE%:%ENDCODE%" />
<arg value="--substitute" />
<arg value="%VERSION%=${iq.version}" />
<arg value="--substitute" />
<arg value="%BUILDDATE%=${iq.versionDate}" />
<arg value="--substitute" />
<arg value="%JAR%=${library.jar}" />
<arg value="--substitute" />
<arg value="%ZIP%=${distribution.zip}" />
<arg value="--substitute" />
<arg value="&quot;%BEGINCODE%=&lt;pre class='prettyprint lang-java'&gt;&quot;" />
<arg value="--substitute" />
<arg value="%ENDCODE%=&lt;/pre&gt;" />
<target name="uploadArtifacts" depends="build">
<arg value="--regex" />
<arg value="&quot;\b(issue)(\s*[#]?|-){0,1}(\d+)\b!!!&lt;a href='http://code.google.com/p/iciql/issues/detail?id=$3'&gt;issue $3&lt;/a&gt;&quot;" />
<arg value="--load" />
<arg value="%DBPERFORMANCE%=${basedir}/performance_db.txt" />
</java>
<gcupload
username="${googlecode.user}"
password="${googlecode.password}"
projectname="iciql"
filename="${project.targetDirectory}/${project.artifactid}-${project.version}.zip"
targetfilename="${project.artifactid}-${project.version}.zip"
summary="Version ${project.version} -- library, sources, and javadoc"
labels="Featured, Type-Package, OpSys-All" />
<mx:ftp server="${ftp.server}" userid="${ftp.user}" password="${ftp.password}"
remotedir="${ftp.maven.dir}" verbose="yes" depends="yes" timediffauto="true"
preservelastmodified="true">
<fileset dir="${basedir}/maven">
<!-- exclude root files -->
<exclude name="*.md" />
<exclude name=".git*" />
</fileset>
</mx:ftp>
</target>
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build binary artifacts and site
Build the iciql website
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="buildAll" description="Build the iciql artifacts and the site" depends="build,buildSite">
<target name="buildSite" depends="build" description="Build the iciql website">
<!-- ensure we have performance data -->
<mx:if>
<not>
<available file="${project.outputDirectory}/performance_db.txt" />
</not>
<then>
<fail />
</then>
</mx:if>
<!-- Download links -->
<property name="gc.url" value="http://code.google.com/p/iciql/downloads/detail?name=" />
<mx:doc googleplusone="true" injectprettify="true" prettifyTheme="hemisu-dark"
minify="true" customless="custom.less">
<logo file="iciql_white.png" />
<favicon file="iciql-favicon.png" />
<load token="%DBPERFORMANCE%" file="${project.outputDirectory}/performance_db.txt" />
<nomarkdown startToken="%BEGINCODE%" endToken="%ENDCODE%" prettify="true" lang="java" />
<regex searchPattern="\b(issue)(\s*[#]?|-){0,1}(\d+)\b"
replacePattern="&lt;a href='${project.issuesUrl}/detail?id=$3'&gt;issue $3&lt;/a&gt;" />
<structure>
<menu name="about" pager="true" pagerPlacement="bottom" pagerLayout="justified">
<page name="overview" src="00_index.mkd" out="index.html" />
<page name="performance" src="03_performance.mkd" out="performance.html" />
<page name="jaqu comparison" src="06_jaqu_comparison.mkd" out="jaqu_comparison.html" />
</menu>
<menu name="getting started" pager="true" pagerPlacement="bottom" pagerLayout="justified">
<page name="models" src="01_model_classes.mkd" out="model_classes.html" headerLinks="true" />
<page name="versioning" src="02_table_versioning.mkd" out="table_versioning.html" headerLinks="true" />
<page name="usage" src="02_usage.mkd" out="usage.html" headerLinks="true" />
<page name="examples" src="04_examples.mkd" out="examples.html" headerLinks="true" />
<page name="tools" src="04_tools.mkd" out="tools.html" headerLinks="true" />
</menu>
<page name="building" src="05_building.mkd" out="building.html" />
<page name="javadoc" src="05_javadoc.mkd" out="javadoc.html" />
<page name="releases" src="05_releases.mkd" out="releases.html" />
<!--<page name="release notes" out="releasenotes.html">
<template src="releasecurrent.ftl" data="${basedir}/releases.moxie" />
</page>
<page out="releases.html" navbarlink="false">
<template src="releasehistory.ftl" data="${basedir}/releases.moxie" />
</page>-->
<menu name="downloads">
<link name="${project.artifactId}-${project.releaseVersion}"
src="${gc.url}${project.artifactId}-${project.releaseVersion}.zip" />
<divider />
<link name="Maven Repository" src="${project.mavenUrl}" />
</menu>
<menu name="links">
<link name="Github" src="${project.scmUrl}" />
<link name="Issues" src="${project.issuesUrl}" />
<link name="Maven Repository" src="${project.mavenUrl}" />
</menu>
<divider />
</structure>
<!-- Generate RSS and Atom feeds from the release history -->
<!--<page as="atom.xml">
<template src="atom.ftl" data="${basedir}/releases.moxie" />
</page>
<page as="rss.xml">
<template src="rss.ftl" data="${basedir}/releases.moxie" />
</page>-->
</mx:doc>
<!-- Copy standard javadoc -->
<mkdir dir="${project.siteTargetDirectory}/javadoc" />
<copy todir="${project.siteTargetDirectory}/javadoc">
<fileset dir="${project.javadocTargetDirectory}" />
</copy>
</target>
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Publish binaries to Google Code
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="publishBinaries" depends="build" description="Publish the iciql binaries to Google Code">
<echo>Uploading iciql ${iq.version} binaries</echo>
<gcupload
username="${googlecode.user}"
password="${googlecode.password}"
projectname="iciql"
filename="${distribution.zip}"
targetfilename="iciql-${iq.version}.zip"
summary="Version ${iq.version} -- library, sources, and javadoc"
labels="Featured, Type-Package, OpSys-All" />
<gcupload
username="${googlecode.user}"
password="${googlecode.password}"
projectname="iciql"
filename="${library.jar}"
targetfilename="iciql-${iq.version}.jar"
summary="Version ${iq.version} -- library"
labels="Featured, Type-Package, OpSys-All" />
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copy the built site to the gh-pages branch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="updateGhpages" depends="buildSite">
<mx:ghpages obliterate="false" />
</target>
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Publish site to hosting service
You must add ext/commons-net-1.4.0.jar to your ANT classpath.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="publishSite" depends="buildSite" description="Publish the iciql site to a webserver (requires ext/commons-net-1.4.0.jar)" >
<target name="publishSite" depends="updateGhpages" description="Publish the iciql site to a webserver" >
<echo>Uploading iciql ${iq.version} website</echo>
<echo>Uploading ${project.artifactId} ${project.version} website</echo>
<ftp server="${ftp.server}"
<mx:ftp server="${ftp.server}"
userid="${ftp.user}"
password="${ftp.password}"
remotedir="${ftp.dir}"
remotedir="${ftp.site.dir}"
passive="true"
verbose="yes">
<fileset dir="${project.site.dir}" />
</ftp>
<fileset dir="${project.siteTargetDirectory}" />
</mx:ftp>
</target>
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compile from source, publish binaries, and build & deploy site
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tag a new version and prepare for the next development cycle.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-->
<target name="publishAll" depends="publishBinaries,publishSite">
<!-- Cleanup -->
<delete dir="${project.build.dir}" />
<target name="tagRelease" depends="prepare">
<!-- release -->
<property name="dryrun" value="false" />
<mx:version stage="release" dryrun="${dryrun}" />
<!-- commit build.moxie & releases.moxie (automatic) and maven artifacts -->
<mx:commit showtitle="no">
<message>Prepare ${project.version} release</message>
<tag name="v${project.version}">
<message>${project.name} ${project.version} release</message>
</tag>
</mx:commit>
<!-- next cycle -->
<mx:version stage="snapshot" incrementNumber="minor" dryrun="${dryrun}" />
<mx:commit showtitle="no">
<message>Reset build identifiers for next development cycle</message>
</mx:commit>
</target>
</project>

+ 10
- 16
docs/00_index.mkd View File

@@ -5,7 +5,7 @@ iciql **is**...
- a model-based, database access wrapper for JDBC
- for modest database schemas and basic statement generation
- for those who want to write code, instead of SQL, using IDE completion and compile-time type-safety
- small (125KB) with no runtime dependencies
- small (200KB) with debug symbols and no runtime dependencies
- pronounced *icicle* (although it could be French: *ici ql* - here query language)
- a friendly fork of the H2 [JaQu][jaqu] project
@@ -16,7 +16,7 @@ iciql **is not**...
- designed to compete with enterprise [ORM][orm] tools like [Hibernate][hibernate] or [mybatis][mybatis]
### Example Usage
<table>
<table class="table">
<tr>
<th>iciql</th><th>sql</th>
</tr>
@@ -24,9 +24,10 @@ iciql **is not**...
<td>
%BEGINCODE%
Product p = new Product();
List&lt;Product&gt; restock = db.from(p).where(p.unitsInStock).is(0).select();
List&lt;Product&gt; all = db.executeQuery(Product.class, "select * from products");
List<Product> restock = db.from(p).where(p.unitsInStock).is(0).select();
List<Product> all = db.executeQuery(Product.class, "select * from products");
%ENDCODE%
</td><td>
<br/>
select * from products p where p.unitsInStock = 0<br/>
@@ -36,11 +37,11 @@ select * from products
</table>
### Supported Databases (Unit-Tested)
- [H2](http://h2database.com) 1.3.168
- [HSQLDB](http://hsqldb.org) 2.2.8
- [Derby](http://db.apache.org/derby) 10.9.1.0
- [MySQL](http://mysql.com) 5.0.51b
- [PostgreSQL](http://postgresql.org) 9.0
- [H2](http://h2database.com) ${h2.version}
- [HSQLDB](http://hsqldb.org) ${hsqldb.version}
- [Derby](http://db.apache.org/derby) ${derby.version}
- [MySQL](http://mysql.com) ${mysql.version}
- [PostgreSQL](http://postgresql.org) ${postgresql.version}
Support for others is possible and may only require creating a simple "dialect" class.
@@ -48,13 +49,6 @@ Support for others is possible and may only require creating a simple "dialect"
iciql requires a Java 6 Runtime Environment (JRE) or a Java 6 Development Kit (JDK).
### Current Release
**%VERSION%** ([zip](http://code.google.com/p/iciql/downloads/detail?name=%ZIP%)|[jar](http://code.google.com/p/iciql/downloads/detail?name=%JAR%)) &nbsp; *released %BUILDDATE%*
issues, binaries, & source @ [Google Code][googlecode]<br/>
sources @ [Github][github]
### License
iciql is distributed under the terms of the [Apache Software Foundation license, version 2.0][apachelicense]

+ 30
- 25
docs/01_model_classes.mkd View File

@@ -14,16 +14,18 @@ Alternatively, model classes can be automatically generated by iciql using the m
5. Triggers, views, and other advanced database features are not supported.
### Supported Data Types
<table>
---NOMARKDOWN---
<table class="table">
<tr><td colspan="3"><b>Fully Supported Types</b><br/>
can be used for all iciql expressions
</tr>
<tr><th>Object</th><th>Primitive</th><th>SQL Type</th></tr>
<tr><td>java.lang.String</td><td></td>
<td>VARCHAR *(length > 0)* or CLOB *(length == 0)*</td></tr>
<td>VARCHAR <em>(length > 0)</em> or CLOB <em>(length == 0)</em></td></tr>
<tr><td>java.lang.Boolean</td><td>boolean</td>
<td>BOOLEAN<br/><i>can only **declare and explicitly reference** one <u>primitive boolean</u> per model<br/>multiple primitives are allowed if not using where/set/on/and/or/groupBy/orderBy(boolean)</i></td></tr>
<td>BOOLEAN<br/><i>can only <b>declare and explicitly reference</b> one <u>primitive boolean</u> per model<br/>multiple primitives are allowed if not using where/set/on/and/or/groupBy/orderBy(boolean)</i></td></tr>
<tr><td>java.lang.Byte</td><td>byte</td>
<td>TINYINT</td></tr>
@@ -43,43 +45,43 @@ can be used for all iciql expressions
<tr><td>java.lang.Double</td><td>double</td>
<td>DOUBLE</td></tr>
<tr><td>java.math.BigDecimal</td><td></td>
<td>DECIMAL *(length == 0)* or DECIMAL(length,scale) *(length > 0)*</td></tr>
<tr><td>java.math.BigDecimal</td><td> </td>
<td>DECIMAL <em>(length == 0)</em> or DECIMAL(length,scale) <em>(length > 0)</em></td></tr>
<tr><td>java.sql.Date</td><td></td>
<tr><td>java.sql.Date</td><td> </td>
<td>DATE</td></tr>
<tr><td>java.sql.Time</td><td></td>
<tr><td>java.sql.Time</td><td> </td>
<td>TIME</td></tr>
<tr><td>java.sql.Timestamp</td><td></td>
<tr><td>java.sql.Timestamp</td><td> </td>
<td>TIMESTAMP</td></tr>
<tr><td>java.util.Date</td><td></td>
<tr><td>java.util.Date</td><td> </td>
<td>TIMESTAMP</td></tr>
<tr><td>java.lang.Enum.name()<br/>*default type*</td><td></td>
<td>VARCHAR *(length > 0)* or CLOB *(length == 0)*<br/>*EnumType.NAME*<br/><i>can only **declare and explicitly reference** one instance of <u>each enum type</u> per model<br/>multiple instances of an enum type within a model is allowed if not using where/set/on/and/or/groupBy/orderBy(enum)</i></td></tr>
<tr><td>java.lang.Enum.name()<br/><em>default type</em></td><td></td>
<td>VARCHAR <em>(length > 0)</em> or CLOB <em>(length == 0)</em><br/><em>EnumType.NAME</em><br/><i>can only <b>declare and explicitly reference</b> one instance of <u>each enum type</u> per model<br/>multiple instances of an enum type within a model is allowed if not using where/set/on/and/or/groupBy/orderBy(enum)</i></td></tr>
<tr><td>java.lang.Enum.ordinal()</td><td></td>
<td>INT<br/>*EnumType.ORDINAL*<br/><i>can only **declare and explicitly reference** one instance of <u>each enum type</u> per model<br/>multiple instances of an enum type within a model is allowed if not using where/set/on/and/or/groupBy/orderBy(enum)</i></td></tr>
<tr><td>java.lang.Enum.ordinal()</td><td> </td>
<td>INT<br/><em>EnumType.ORDINAL</em><br/><i>can only <b>declare and explicitly reference</b> one instance of <u>each enum type</u> per model<br/>multiple instances of an enum type within a model is allowed if not using where/set/on/and/or/groupBy/orderBy(enum)</i></td></tr>
<tr><td>java.lang.Enum implements<br/>*com.iciql.Iciql.EnumId.enumId()*</td><td></td>
<td>INT<br/>*EnumType.ENUMID*<br/><i>can only **declare and explicitly reference** one instance of <u>each enum type</u> per model<br/>multiple instances of an enum type within a model is allowed if not using where/set/on/and/or/groupBy/orderBy(enum)</i></td></tr>
<tr><td>java.lang.Enum implements<br/><em>com.iciql.Iciql.EnumId.enumId()</em></td><td> </td>
<td>INT<br/><em>EnumType.ENUMID</em><br/><i>can only <b>declare and explicitly reference</b> one instance of <u>each enum type</u> per model<br/>multiple instances of an enum type within a model is allowed if not using where/set/on/and/or/groupBy/orderBy(enum)</i></td></tr>
<tr><td colspan="3"><b>Partially Supported Types</b><br/>
can not be directly referenced in an expression</td></tr>
<tr><td>byte []</td><td></td>
<tr><td>byte []</td> <td></td>
<td>BLOB</td><tr/>
<tr><td colspan="3"><b>H2 Database Types</b><br/>
fully supported when paired with an H2 database
</td></tr>
<tr><td>java.util.UUID</td><td></td>
<td>UUID</td><tr/>
<tr><td>java.util.UUID</td><td> </td>
<td>UUID</td></tr>
</table>
---NOMARKDOWN---
**NOTE:**<br/>
The reverse lookup used for model generation, SQL type -> Java type, contains more mappings.<br/>
Please consult the `com.iciql.ModelUtils` class for details.
@@ -100,8 +102,8 @@ The recommended approach to setup a model class is to annotate the class and fie
### field mapping
- By default, **ONLY** fields annotated with *@IQColumn* are mapped.<br/>
- scope is irrelevant.<br/>
- By default, **ONLY** fields annotated with *@IQColumn* are mapped.
- scope is irrelevant.
- transient is irrelevant.
### default values
@@ -116,6 +118,7 @@ The annotated default value always takes priority over a field default value.
@IQColumn(defaultValue="'2000-01-01 00:00:00'")
Date myDate;
%ENDCODE%
2. setting a default value on the field<br/>
**NOTE:**<br/>
Primitive types have an implicit default value of *0* or *false*.
@@ -217,8 +220,8 @@ The `com.iciql.Iciql` interface specifies a single method, *defineIQ()*. In you
### field mapping
- **ALL** fields are mapped unless annotated with *@IQIgnore*.<br/>
- scope is irrelevant.<br/>
- **ALL** fields are mapped unless annotated with *@IQIgnore*.
- scope is irrelevant.
- transient is irrelevant.
### default values
@@ -236,6 +239,7 @@ public void defineIQ() {
Define.defaultValue(myDate, "'2000-01-01 00:00:00'");
}
%ENDCODE%
2. setting a default value on the field<br/>
**NOTE:**<br/>
Primitive types have an implicit default value of *0* or *false*.
@@ -274,6 +278,7 @@ public class Product implements Iciql {
}
%ENDCODE%
## POJO (Plain Old Java Object) Configuration
This approach is very similar to the *interface configuration* approach; it is the least verbose and also the least useful.
@@ -294,8 +299,8 @@ This approach would be suitable for quickly modeling an existing table where onl
### field mapping
- **ALL** fields are mapped unless annotated with *@IQIgnore*.<br/>
- scope is irrelevant.<br/>
- **ALL** fields are mapped unless annotated with *@IQIgnore*.
- scope is irrelevant.
- transient is irrelevant.
### default values

+ 1
- 1
docs/02_table_versioning.mkd View File

@@ -3,7 +3,7 @@
Iciql supports an optional, simple versioning mechanism. There are two parts to the mechanism.
1. You must supply an implementation of `com.iciql.DbUpgrader` to your `com.iciql.Db` instance.
2. One or more of your table model classes must specify the `IQVersion(version)` annotation<br>
2. One or more of your table model classes must specify the `IQVersion(version)` annotation<br/>
AND/OR<br/>
Your `com.iciql.DbUpgrader` implementation must specify the `IQVersion(version)` annotation

+ 23
- 19
docs/02_usage.mkd View File

@@ -1,6 +1,6 @@
## Usage
Aside from this brief usage guide, please consult the [examples](examples.html), the [javadoc](javadoc.html) and the [source code](https://code.google.com/p/iciql/source/browse).
Aside from this brief usage guide, please consult the [examples](examples.html), the [javadoc](javadoc.html) and the [source code](${project.scmUrl}).
### Instantiating a Db
@@ -20,7 +20,7 @@ Db db = Db.open("jdbc:h2:mem:", "sa", "sa");
db.insertAll(Product.getList());
db.insertAll(Customer.getList());
List&lt;Product&gt; restock =
List<Product> restock =
db.from(p).
where(p.unitsInStock).
is(0).orderBy(p.productId).select();
@@ -42,7 +42,7 @@ Iciql gives you compile-time type-safety, but it becomes inconvenient if your de
#### Where String Fragment Approach
This approach is a mixture of iciql and jdbc. It uses the traditional prepared statement *field=?* tokens with iciql compile-time model class type checking. There is no field token type-safety checking.
%BEGINCODE%
List&lt;Product&gt; restock = db.from(p).where("unitsInStock=? and productName like ? order by productId", 0, "Chef%").select();
List<Product> restock = db.from(p).where("unitsInStock=? and productName like ? order by productId", 0, "Chef%").select();
%ENDCODE%
#### Db.executeQuery Approaches
@@ -52,12 +52,12 @@ There may be times when the hybrid approach is still too restrictive and you'd p
2. There is no model class type checking nor field type checking.
%BEGINCODE%
List&lt;Product&gt; allProducts = db.executeQuery(Product.class, "select * from products");
List&lt;Product&gt; restock = db.executeQuery(Product.class, "select * from products where unitsInStock=?", 0);
List<Product> allProducts = db.executeQuery(Product.class, "select * from products");
List<Product> restock = db.executeQuery(Product.class, "select * from products where unitsInStock=?", 0);
// parameterized query which can be cached and re-used later
String q = db.from(p).where(p.unitsInStock).isParameter().toSQL();
List&lt;Product&gt; restock = db.executeQuery(Product.class, q, 0);
List<Product> restock = db.executeQuery(Product.class, q, 0);
%ENDCODE%
@@ -65,7 +65,7 @@ Or if you want access to the raw *ResultSet* before building your model object i
%BEGINCODE%
ResultSet rs = db.executeQuery("select * from products");
List&lt;Product&gt; allProducts = db.buildObjects(Product.class, rs);
List<Product> allProducts = db.buildObjects(Product.class, rs);
// This method ensures the creating statement is closed
JdbcUtils.closeSilently(rs, true);
%ENDCODE%
@@ -84,12 +84,12 @@ The proposed syntax is:
long count = db.from(co).
where(new Filter() { public boolean where() {
return co.id == x
&amp;&amp; co.name.equals(name)
&amp;&amp; co.value == new BigDecimal("1")
&amp;&amp; co.amount == 1L
&amp;&amp; co.birthday.before(new java.util.Date())
&amp;&amp; co.created.before(java.sql.Timestamp.valueOf("2005-05-05 05:05:05"))
&amp;&amp; co.time.before(java.sql.Time.valueOf("23:23:23"));
&& co.name.equals(name)
&& co.value == new BigDecimal("1")
&& co.amount == 1L
&& co.birthday.before(new java.util.Date())
&& co.created.before(java.sql.Timestamp.valueOf("2005-05-05 05:05:05"))
&& co.time.before(java.sql.Time.valueOf("23:23:23"));
}
}).selectCount();
%ENDCODE%
@@ -135,14 +135,14 @@ IciqlLogger.unregisterListener(custom);
Consider the following example:
%BEGINCODE%
Product p = new Product();
List&lt;Product&gt; restock = db.from(p).where(p.unitsInStock).is(0).select();
List<Product> restock = db.from(p).where(p.unitsInStock).is(0).select();
%ENDCODE%
The Product model class instance named **p** is an *alias* object. An *alias* is simply an instance of your model class that is only used to build the compile-time/runtime representation of your table.
1. *Alias* instances are **NOT** thread-safe and must not be used concurrently.
2. *Alias* instances have no other purpose than to provide a compile-time/runtime map of your table.
3. If you inspected an *alias* instance after using one you would find that it's fields have been assigned numeric values.<br/>These values are assigned from a static counter in `com.iciql.Utils.newObject()` during execution of the *db.from()* method.<p>For *Object* fields, these values are meaningless since objects are mapped by reference.<br/>For *Primitive* fields these values do matter because primitives are mapped by value. The proper alias is selected as long as the primitive variant methods are used. e.g. db.from(p).where(int).is(Integer).select()
3. If you inspected an *alias* instance after using one you would find that it's fields have been assigned numeric values.<br/>These values are assigned from a static counter in `com.iciql.Utils.newObject()` during execution of the *db.from()* method.<p/>For *Object* fields, these values are meaningless since objects are mapped by reference.<br/>For *Primitive* fields these values do matter because primitives are mapped by value. The proper alias is selected as long as the primitive variant methods are used. e.g. db.from(p).where(int).is(Integer).select()
If your statement is a query, like in the above example, iciql will generate new instances of your *alias* model class and return them as a list where each entry of the list represents a row from the JDBC `ResultSet`.
@@ -153,7 +153,7 @@ The _db.from(p)_ call reinstantiates each member field of p. Those reinstantiat
Depending on your design, you might consider using a [ThreadLocal](http://download.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html) variable if you do not want to keep instantiating *alias* instances. A utility function is included for easily creating ThreadLocal variables.
%BEGINCODE%
final ThreadLocal&lt;Product&gt; p = Utils.newThreadLocal(Product.class);
final ThreadLocal<Product> p = Utils.newThreadLocal(Product.class);
db.from(p.get()).select();
%ENDCODE%
@@ -161,7 +161,9 @@ db.from(p.get()).select();
1. Close your *Db* instances when you are done with them, this closes the underlying connection or directs the pool to "close" the connection.
2. Aliases instances are not thread-safe so DO NOT SHARE an alias!<br/>Consider using a *ThreadLocal* alias instance with the `com.iciql.Utils.newThreadLocal()` utility method.
<table>
<p/>
<table class="table">
<tr><th>Not Thread-Safe</th><th>Thread-Safe</th></tr>
<tr><td>
%BEGINCODE%
@@ -176,18 +178,20 @@ for (int i = 0; i < 5; i++) {
thread.start();
}
%ENDCODE%
</td><td>
%BEGINCODE%
final ThreadLocal&lt;Product&gt; p = Utils.newThreadLocal(Product.class);
final ThreadLocal<Product> p = Utils.newThreadLocal(Product.class);
for (int i = 0; i < 5; i++) {
Thread thread = new Thread(new Runnable() {
public void run() {
// p.get() returns a Product instance unique to this thread
// a unique p for this thread
db.from(p.get()).select();
}
}, "Thread-" + i);
thread.start();
}
%ENDCODE%
</td></tr>
</table>

+ 13
- 13
docs/04_examples.mkd View File

@@ -2,11 +2,11 @@
%BEGINCODE%
// select * from products
List&lt;Product&gt; allProducts = db.from(p).select();
List<Product> allProducts = db.from(p).select();
// select * from customers where region='WA'
Customer c = new Customer();
List&lt;Customer&gt; waCustomers = db.from(c). where(c.region).is("WA").select();
List<Customer> waCustomers = db.from(c). where(c.region).is("WA").select();
public static class ProductPrice {
public String productName;
@@ -15,7 +15,7 @@ public static class ProductPrice {
}
// select with generation of new anonymous inner class
List&lt;ProductPrice&gt; productPrices =
List<ProductPrice> productPrices =
db.from(p).
orderBy(p.productId).
select(new ProductPrice() {{
@@ -38,7 +38,7 @@ Long key = db.insertAndGetKey(singleProduct);
db.insertAll(myProducts);
// batch insertion with primary key retrieval
List&lt;Long&gt; myKeys = db.insertAllAndGetKeys(list);
List<Long> myKeys = db.insertAllAndGetKeys(list);
%ENDCODE%
## Update Statements
@@ -92,14 +92,14 @@ db.from(p).where(p.productId).atLeast(10).delete();
final Customer c = new Customer();
final Order o = new Order();
List&lt;Customer&gt; customersWithLargeOrders =
List<Customer> customersWithLargeOrders =
db.from(c).
innerJoin(o).on(c.customerId).is(o.customerId).
where(o.total).greaterThan(new BigDecimal("500.00")).
groupBy(c.customerId).select();
List&lt;CustOrder&gt; orders =
List<CustOrder> orders =
db.from(c).
innerJoin(o).on(c.customerId).is(o.customerId).
where(o.total).lessThan(new BigDecimal("500.00")).
@@ -127,7 +127,7 @@ public class ProductView {
}
final ProductView v = new ProductView();
List&lt;ProductView&gt; allProducts = db.from(v).select();
List<ProductView> allProducts = db.from(v).select();
// this version of the view model "ProductView" inherits table metadata
// from the Products class which is annotated with IQTable
@@ -145,7 +145,7 @@ public class ProductView extends Products {
}
final ProductView v = new ProductView();
List&lt;ProductView&gt; allProducts = db.from(v).select();
List<ProductView> allProducts = db.from(v).select();
// in this example we are creating a view based on a fluent query
// and using 2 levels of inheritance. IQConstraints are ignored
@@ -172,17 +172,17 @@ Dynamic queries skip all field type checking and, depending on which approach yo
%BEGINCODE%
// where fragment with object parameters
List&lt;Product&gt; restock = db.from(p).where("unitsInStock=? and productName like ? order by productId", 0, "Chef%").select();
List<Product> restock = db.from(p).where("unitsInStock=? and productName like ? order by productId", 0, "Chef%").select();
// parameterized query which can be cached and re-used later
String q = db.from(p).where(p.unitsInStock).isParameter().and(p.productName).likeParameter().orderBy(p.productId).toSQL();
List&lt;Product&gt; allProducts = db.executeQuery(Product.class, q, 0, "Chef%");
List<Product> allProducts = db.executeQuery(Product.class, q, 0, "Chef%");
// statement with binding to your model class
List&lt;Product&gt; allProducts = db.executeQuery(Product.class, "select * from products");
List<Product> allProducts = db.executeQuery(Product.class, "select * from products");
// statement with object parameters and binding to your model class
List&lt;Product&gt; restock = db.executeQuery(Product.class, "select * from products where unitsInStock=?", 0);
List<Product> restock = db.executeQuery(Product.class, "select * from products where unitsInStock=?", 0);
/**
* If you want to process the intermediate ResultSet
@@ -190,7 +190,7 @@ List&lt;Product&gt; restock = db.executeQuery(Product.class, "select * from prod
* to ensure the parent statement is closed too.
*/
ResultSet rs = db.executeQuery("select * from products");
List&lt;Product&gt; allProducts = db.buildObjects(Product.class, rs);
List<Product> allProducts = db.buildObjects(Product.class, rs);
JdbcUtils.closeSilently(rs, true);
%ENDCODE%

+ 11
- 11
docs/04_tools.mkd View File

@@ -4,16 +4,16 @@ If you do not have or do not want to annotate your existing model classes, you c
java -jar iciql.jar <parameters>
### Parameters
<table>
<tr><th>-url</th><td>JDBC url for the database</td><td>*REQUIRED*</td></tr>
<tr><th>-username</th><td>username for JDBC connection</td><td>*optional*</td></tr>
<tr><th>-password</th><td>password for JDBC connection</td><td>*optional*</td></tr>
<tr><th>-schema</th><td>the target schema for model generation</td><td>*default:* all schemas</td></tr>
<tr><th>-table</th><td>the target table for model generation</td><td>*default:* all tables</td></tr>
<tr><th>-package</th><td>the destination package name for generated models</td><td>*default:* default package</td></tr>
<tr><th>-folder</th><td>the output folder for .java files</td><td>*default:* current folder</td></tr>
<tr><th>-annotateSchema</th><td>include the schema name in the class annotations</td><td>*default:* true</td></tr>
<tr><th>-trimStrings</th><td>annotate trimStrings=true for any VARCHAR string mappings &nbsp; </td><td>*default:* false</td></tr>
<table class="table">
<tr><th>-url</th><td>JDBC url for the database</td><td><em>REQUIRED</em></td></tr>
<tr><th>-username</th><td>username for JDBC connection</td><td><em>optional</em></td></tr>
<tr><th>-password</th><td>password for JDBC connection</td><td><em>optional</em></td></tr>
<tr><th>-schema</th><td>the target schema for model generation</td><td><em>default:</em> all schemas</td></tr>
<tr><th>-table</th><td>the target table for model generation</td><td><em>default:</em> all tables</td></tr>
<tr><th>-package</th><td>the destination package name for generated models</td><td><em>default:</em> default package</td></tr>
<tr><th>-folder</th><td>the output folder for .java files</td><td><em>default:</em> current folder</td></tr>
<tr><th>-annotateSchema</th><td>include the schema name in the class annotations</td><td><em>default:</em> true</td></tr>
<tr><th>-trimStrings</th><td>annotate trimStrings=true for any VARCHAR string mappings &nbsp; </td><td><em>default:</em> false</td></tr>
</table>
## Model Validation
@@ -77,7 +77,7 @@ public class ValidateModels {
}
private void validateModel(DbInspector inspector, Object o) {
List&lt;ValidationRemark&gt; remarks = inspector.validateModel(o, false);
List<ValidationRemark> remarks = inspector.validateModel(o, false);
assertTrue("Validation remarks are null for " + o.getClass().getName(), remarks != null);
log("Validation remarks for " + o.getClass().getName());
for (ValidationRemark remark : remarks) {

+ 4
- 8
docs/05_building.mkd View File

@@ -4,26 +4,23 @@
Additionally, [eclipse-cs](http://eclipse-cs.sourceforge.net), [FindBugs](http://findbugs.sourceforge.net), and [EclEmma](http://www.eclemma.org) are recommended development tools.
### Build Dependencies (bundled)
- [google-code-prettify](http://code.google.com/p/google-code-prettify) (Apache 2.0)
### Build Dependencies (bundled in repository)
- [ant-googlecode](http://code.google.com/p/ant-googlecode) (New BSD)
### Build Dependencies (downloaded during build)
- [Moxie Build Toolkit](http://moxie.gitblit.com) (Apache 2.0)
- [H2 Database](http://h2database.com) (Eclipse Public License 1.0)
- [HSQL Database Engine](http://hsqldb.org) (BSD)
- [Apache Derby Database](http://db.apache.org/derby) (Apache 2.0)
- [MySQL Connector/J](http://dev.mysql.com/downloads/connector/j) (GPL)
- [PostgreSQL JDBC Connector](http://jdbc.postgresql.org) (BSD)
- [JUnit](http://junit.org) (Common Public License)
- [commons-net](http://commons.apache.org/net) (Apache 2.0)
- [ant-googlecode](http://code.google.com/p/ant-googlecode) (New BSD)
- [MarkdownPapers](http://markdown.tautua.org) (Apache 2.0)
- [doclava](http://code.google.com/p/doclava) (Apache 2.0)
- [SLF4J](http://www.slf4j.org) (MIT/X11)
- [Apache Commons Pool](http://commons.apache.org/pool) (Apache 2.0)
- [Apache Commons DBCP](http://commons.apache.org/dbcp) (Apache 2.0)
### Instructions
1. Clone the git repository from [GoogleCode][iciqlsrc].
1. Clone the git repository from [Github](${project.scmUrl}).
2. Import the iciql project into your Eclipse workspace.<br/>
*There will be some build errors.*
3. Using Ant, execute the `build.xml` script in the project root.<br/>
@@ -35,5 +32,4 @@ Patches welcome in any form.
Contributions must be your own original work and must licensed under the [Apache License, Version 2.0][apachelicense], the same license used by iciql.
[iciqlsrc]: https://code.google.com/p/iciql/ "iciql git repository"
[apachelicense]: http://www.apache.org/licenses/LICENSE-2.0 "Apache License, Version 2.0"

+ 1
- 1
docs/05_javadoc.mkd View File

@@ -4,4 +4,4 @@
| <a href="javadoc/deprecated-list.html" target="javadoc">deprecated</a>
| <a href="javadoc/index-all.html" target="javadoc">index</a>
</div>
<iframe name="javadoc" src="javadoc/overview-summary.html" width="100%" height="700" frameborder="0"></iframe>
<iframe name="javadoc" src="javadoc/overview-summary.html" width="100%" height="650" frameborder="0"></iframe>

+ 1
- 1
docs/05_releases.mkd View File

@@ -2,7 +2,7 @@
### Current Release
**%VERSION%** ([zip](http://code.google.com/p/iciql/downloads/detail?name=%ZIP%)|[jar](http://code.google.com/p/iciql/downloads/detail?name=%JAR%)) &nbsp; *released %BUILDDATE%*
**${project.version}**
- Fixed case-sensitivity bug on setting a compound primary key from an annotation (issue 12)
- Implemented readonly view support. (issue 8)<br/>

+ 5
- 5
docs/06_jaqu_comparison.mkd View File

@@ -3,7 +3,7 @@
This is an overview of the fundamental differences between the original JaQu project and the current featureset of iciql.
<table>
<table class="table">
<tr><th></th><th>Iciql</th><th>JaQu</th></tr>
<tr><th colspan="3">core</th></tr>
<tr><td>deployment</td><td>small, discrete library</td><td>depends on H2 database jar file</td></tr>
@@ -22,10 +22,10 @@ This is an overview of the fundamental differences between the original JaQu pro
<tr><td>enums</td><td>fully supported</td><td>--</td></tr>
<tr><td>DECIMAL(length,scale)</td><td>can specify length/precision and scale</td><td>--</td></tr>
<tr><td>BOOLEAN</td><td>flexible mapping of boolean as bool, varchar, or int</td><td>--</td></tr>
<tr><td>BLOB</td><td>partially supported *(can not be used in a WHERE clause)*</td><td>--</td></tr>
<tr><td>UUID</td><td>fully supported *(H2 only)* </td><td>--</td></tr>
<tr><td>BLOB</td><td>partially supported <em>(can not be used in a WHERE clause)</em></td><td>--</td></tr>
<tr><td>UUID</td><td>fully supported <em>(H2 only)</em> </td><td>--</td></tr>
<tr><th colspan="3">configuration</th></tr>
<tr><td>DEFAULT values</td><td>set from annotation, *default object values*, or Define.defaultValue()</td><td>set from annotations</td></tr>
<tr><td>Interface Configuration<br/>Mapped Fields</td><td>*all fields* are mapped regardless of scope<br/>fields are ignored by annotating with @IQIgnore</td><td>*all public fields* are mapped<br/>fields are ignored by reducing their scope</td></tr>
<tr><td>DEFAULT values</td><td>set from annotation, <em>default object values</em>, or Define.defaultValue()</td><td>set from annotations</td></tr>
<tr><td>Interface Configuration<br/>Mapped Fields</td><td><em>all fields</em> are mapped regardless of scope<br/>fields are ignored by annotating with @IQIgnore</td><td><em>all public fields</em> are mapped<br/>fields are ignored by reducing their scope</td></tr>
<tr><td>Index names</td><td>can be set</td><td>--</td></tr>
</table>

+ 40
- 0
docs/custom.less View File

@@ -0,0 +1,40 @@
// GLOBAL VALUES
// --------------------------------------------------
@standardGray: #ccc;
@cornflower: #abd4ff;
@white: #fff;
// Dropdown
// -------------------------
@dropdownLinkBackgroundHover: @cornflower;
// Navbar
// -------------------------
@navbarHeight: 55px;
@navbarBackground: @cornflower;
@navbarBackgroundHighlight: @cornflower;
@navbarText: @white;
@navbarLinkColor: @white;
@navbarLinkColorHover: @white;
@navbarLinkColorActive: @white;
@navbarLinkBackgroundHover: transparent;
@navbarLinkBackgroundActive: transparent;
.navbar {
.brand {
@elementHeight: 48px;
padding: 7px;
}
}
.navbar .nav > li > a {
font-size: @baseFontSize + 2;
text-shadow: 0 1px 0 #6b94df;
}
body { padding-top: @navbarHeight + 15 } /* 60px to make the container go all the way to the bottom of the topbar */
footer { margin-top: 25px; padding: 15px 0 16px; border-top: 1px solid #E5E5E5; }
a:hover { text-decoration: underline !important; }
em { color: #50a000; }

+ 0
- 157
docs/resources/iciql.css View File

@@ -1,157 +0,0 @@
/*
iciql css.
*/
html, body, table, dl, dt, dd, ol, ul, li, form, a, span, tr, th, td, div, em {
font-family: verdana, sans-serif;
font-size: 12px;
line-height: 1.35em;
margin: 0;
padding: 0;
border: 0;
outline: 0;
}
body {
width: 980px;
margin: 5px;
background-color: #ffffff;
color: #000000;
margin-right: auto;
margin-left: auto;
padding: 0px;
background: url(background.png) repeat-x scroll 0 0 #FFFFFF;
}
iframe {
margin-top:5px;
/*border: 1px solid #ccc;*/
}
pre, code, pre.prettyprint {
color: black;
font-family: monospace;
font-size:12px;
border:0px;
}
pre.prettyprint {
background-color: #fdfdfd !important;
border: 1px solid #ccc !important;
}
pre, pre.prettyprint {
margin-left: 5px;
margin-right: 5px;
}
table {
border-collapse: collapse;
empty-cells: show;
font-size: 1em;
}
td, th {
background-color: inherit;
border: 1px solid #CCCCCC;
padding: 6px 12px;
text-align: left;
vertical-align: top;
margin: 0;
}
img.inlineIcon {
padding-left: 1px;
padding-right: 1px;
}
img.overview {
float:right;
border:1px solid #CCCCCC;
}
a {
color: #0000cc;
}
a:hover, a:visited, a:active {
color: #880000;
}
span.warning {
font-weight: bold;
color: #f00000;
}
img.logo {
margin-top:-8px;
float: right;
border-width: 0px;
}
div.page_header {
height: 26px;
padding: 5px;
font-family: sans-serif;
font-weight: bold;
font-size: 200%;
color: #888;
background: transparent;
}
div.page_header span {
font-family: inherit;
font-size: inherit;
}
div.page_footer {
clear: both;
height: 17px;
color: black;
background-color: #ffffff;
padding: 5px;
border-top: 1px solid #bbb;
font-style: italic;
}
div.page_nav {
margin-top:10px;
padding: 5px;
border-radius: 3px;
background-color: #fdfdfd;
border: 1px solid #ccc;
color: #ccc;
}
div.page_nav a {
text-decoration: none;
color: blue;
}
div.page_nav a:hover {
text-decoration: underline;
}
div.page_nav em {
font-style: normal;
}
div.javadoc_nav {
text-align: center;
margin-top:0px;
padding: 5px;
border-bottom: 1px solid #ccc;
color: #ccc;
}
div.javadoc_nav a {
text-decoration: none;
color: blue;
}
div.javadoc_nav a:hover {
text-decoration: underline;
}
div.javadoc_nav em {
font-style: normal;
}

BIN
docs/resources/iciql2.png View File


BIN
docs/resources/iciql2.xcf View File


BIN
docs/resources/iciql_white.png View File


+ 0
- 67
docs/resources/markdown.css View File

@@ -1,67 +0,0 @@
/*
* Git:Blit Markdown CSS definition.
*/
div.markdown {
line-height: 1.4em;
}
div.markdown h1,
div.markdown h2,
div.markdown h3,
div.markdown h4,
div.markdown h5,
div.markdown h6 {
border: 0 none !important;
}
div.markdown h1 {
margin-top: 1em;
margin-bottom: 0.5em;
padding-bottom: 0.5em;
border-bottom: 2px solid #000080 !important;
}
div.markdown h2 {
margin-top: 1em;
margin-bottom: 0.5em;
padding-bottom: 0.5em;
border-bottom: 2px solid #000080 !important;
}
div.markdown pre {
background-color: #fdfdfd !important;
border: 1px solid #ccc !important;
border-radius: 3px;
overflow: auto;
padding: 5px;
}
div.markdown pre code {
background-color: inherit;
border: none;
padding: 0;
}
div.markdown code {
background-color: #ffffe0;
border: 1px solid orange;
border-radius: 3px;
padding: 0 0.2em;
}
div.markdown a {
text-decoration: underline;
}
div.markdown ul, div.markdown ol {
padding-left: 30px;
}
div.markdown li {
margin: 0.2em 0 0 0em; padding: 0px;
}
div.markdown em {
color: #b05000;
}

+ 0
- 1
docs/resources/prettify.css View File

@@ -1 +0,0 @@
.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec{color:#606}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}@media print{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}

+ 0
- 33
docs/resources/prettify.js View File

@@ -1,33 +0,0 @@
window.PR_SHOULD_USE_CONTINUATION=true;window.PR_TAB_WIDTH=8;window.PR_normalizedHtml=window.PR=window.prettyPrintOne=window.prettyPrint=void 0;window._pr_isIE6=function(){var y=navigator&&navigator.userAgent&&navigator.userAgent.match(/\bMSIE ([678])\./);y=y?+y[1]:false;window._pr_isIE6=function(){return y};return y};
(function(){function y(b){return b.replace(L,"&amp;").replace(M,"&lt;").replace(N,"&gt;")}function H(b,f,i){switch(b.nodeType){case 1:var o=b.tagName.toLowerCase();f.push("<",o);var l=b.attributes,n=l.length;if(n){if(i){for(var r=[],j=n;--j>=0;)r[j]=l[j];r.sort(function(q,m){return q.name<m.name?-1:q.name===m.name?0:1});l=r}for(j=0;j<n;++j){r=l[j];r.specified&&f.push(" ",r.name.toLowerCase(),'="',r.value.replace(L,"&amp;").replace(M,"&lt;").replace(N,"&gt;").replace(X,"&quot;"),'"')}}f.push(">");
for(l=b.firstChild;l;l=l.nextSibling)H(l,f,i);if(b.firstChild||!/^(?:br|link|img)$/.test(o))f.push("</",o,">");break;case 3:case 4:f.push(y(b.nodeValue));break}}function O(b){function f(c){if(c.charAt(0)!=="\\")return c.charCodeAt(0);switch(c.charAt(1)){case "b":return 8;case "t":return 9;case "n":return 10;case "v":return 11;case "f":return 12;case "r":return 13;case "u":case "x":return parseInt(c.substring(2),16)||c.charCodeAt(1);case "0":case "1":case "2":case "3":case "4":case "5":case "6":case "7":return parseInt(c.substring(1),
8);default:return c.charCodeAt(1)}}function i(c){if(c<32)return(c<16?"\\x0":"\\x")+c.toString(16);c=String.fromCharCode(c);if(c==="\\"||c==="-"||c==="["||c==="]")c="\\"+c;return c}function o(c){var d=c.substring(1,c.length-1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));c=[];for(var a=[],k=d[0]==="^",e=k?1:0,h=d.length;e<h;++e){var g=d[e];switch(g){case "\\B":case "\\b":case "\\D":case "\\d":case "\\S":case "\\s":case "\\W":case "\\w":c.push(g);
continue}g=f(g);var s;if(e+2<h&&"-"===d[e+1]){s=f(d[e+2]);e+=2}else s=g;a.push([g,s]);if(!(s<65||g>122)){s<65||g>90||a.push([Math.max(65,g)|32,Math.min(s,90)|32]);s<97||g>122||a.push([Math.max(97,g)&-33,Math.min(s,122)&-33])}}a.sort(function(v,w){return v[0]-w[0]||w[1]-v[1]});d=[];g=[NaN,NaN];for(e=0;e<a.length;++e){h=a[e];if(h[0]<=g[1]+1)g[1]=Math.max(g[1],h[1]);else d.push(g=h)}a=["["];k&&a.push("^");a.push.apply(a,c);for(e=0;e<d.length;++e){h=d[e];a.push(i(h[0]));if(h[1]>h[0]){h[1]+1>h[0]&&a.push("-");
a.push(i(h[1]))}}a.push("]");return a.join("")}function l(c){for(var d=c.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),a=d.length,k=[],e=0,h=0;e<a;++e){var g=d[e];if(g==="(")++h;else if("\\"===g.charAt(0))if((g=+g.substring(1))&&g<=h)k[g]=-1}for(e=1;e<k.length;++e)if(-1===k[e])k[e]=++n;for(h=e=0;e<a;++e){g=d[e];if(g==="("){++h;if(k[h]===undefined)d[e]="(?:"}else if("\\"===
g.charAt(0))if((g=+g.substring(1))&&g<=h)d[e]="\\"+k[h]}for(h=e=0;e<a;++e)if("^"===d[e]&&"^"!==d[e+1])d[e]="";if(c.ignoreCase&&r)for(e=0;e<a;++e){g=d[e];c=g.charAt(0);if(g.length>=2&&c==="[")d[e]=o(g);else if(c!=="\\")d[e]=g.replace(/[a-zA-Z]/g,function(s){s=s.charCodeAt(0);return"["+String.fromCharCode(s&-33,s|32)+"]"})}return d.join("")}for(var n=0,r=false,j=false,q=0,m=b.length;q<m;++q){var t=b[q];if(t.ignoreCase)j=true;else if(/[a-z]/i.test(t.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,
""))){r=true;j=false;break}}var p=[];q=0;for(m=b.length;q<m;++q){t=b[q];if(t.global||t.multiline)throw Error(""+t);p.push("(?:"+l(t)+")")}return RegExp(p.join("|"),j?"gi":"g")}function Y(b){var f=0;return function(i){for(var o=null,l=0,n=0,r=i.length;n<r;++n)switch(i.charAt(n)){case "\t":o||(o=[]);o.push(i.substring(l,n));l=b-f%b;for(f+=l;l>=0;l-=16)o.push(" ".substring(0,l));l=n+1;break;case "\n":f=0;break;default:++f}if(!o)return i;o.push(i.substring(l));return o.join("")}}function I(b,
f,i,o){if(f){b={source:f,c:b};i(b);o.push.apply(o,b.d)}}function B(b,f){var i={},o;(function(){for(var r=b.concat(f),j=[],q={},m=0,t=r.length;m<t;++m){var p=r[m],c=p[3];if(c)for(var d=c.length;--d>=0;)i[c.charAt(d)]=p;p=p[1];c=""+p;if(!q.hasOwnProperty(c)){j.push(p);q[c]=null}}j.push(/[\0-\uffff]/);o=O(j)})();var l=f.length;function n(r){for(var j=r.c,q=[j,z],m=0,t=r.source.match(o)||[],p={},c=0,d=t.length;c<d;++c){var a=t[c],k=p[a],e=void 0,h;if(typeof k==="string")h=false;else{var g=i[a.charAt(0)];
if(g){e=a.match(g[1]);k=g[0]}else{for(h=0;h<l;++h){g=f[h];if(e=a.match(g[1])){k=g[0];break}}e||(k=z)}if((h=k.length>=5&&"lang-"===k.substring(0,5))&&!(e&&typeof e[1]==="string")){h=false;k=P}h||(p[a]=k)}g=m;m+=a.length;if(h){h=e[1];var s=a.indexOf(h),v=s+h.length;if(e[2]){v=a.length-e[2].length;s=v-h.length}k=k.substring(5);I(j+g,a.substring(0,s),n,q);I(j+g+s,h,Q(k,h),q);I(j+g+v,a.substring(v),n,q)}else q.push(j+g,k)}r.d=q}return n}function x(b){var f=[],i=[];if(b.tripleQuotedStrings)f.push([A,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
null,"'\""]);else b.multiLineStrings?f.push([A,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):f.push([A,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]);b.verbatimStrings&&i.push([A,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);if(b.hashComments)if(b.cStyleComments){f.push([C,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]);i.push([A,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,
null])}else f.push([C,/^#[^\r\n]*/,null,"#"]);if(b.cStyleComments){i.push([C,/^\/\/[^\r\n]*/,null]);i.push([C,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}b.regexLiterals&&i.push(["lang-regex",RegExp("^"+Z+"(/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/)")]);b=b.keywords.replace(/^\s+|\s+$/g,"");b.length&&i.push([R,RegExp("^(?:"+b.replace(/\s+/g,"|")+")\\b"),null]);f.push([z,/^\s+/,null," \r\n\t\u00a0"]);i.push([J,/^@[a-z_$][a-z_$@0-9]*/i,null],[S,/^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/,
null],[z,/^[a-z_$][a-z_$@0-9]*/i,null],[J,/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],[E,/^.[^\s\w\.$@\'\"\`\/\#]*/,null]);return B(f,i)}function $(b){function f(D){if(D>r){if(j&&j!==q){n.push("</span>");j=null}if(!j&&q){j=q;n.push('<span class="',j,'">')}var T=y(p(i.substring(r,D))).replace(e?d:c,"$1&#160;");e=k.test(T);n.push(T.replace(a,s));r=D}}var i=b.source,o=b.g,l=b.d,n=[],r=0,j=null,q=null,m=0,t=0,p=Y(window.PR_TAB_WIDTH),c=/([\r\n ]) /g,
d=/(^| ) /gm,a=/\r\n?|\n/g,k=/[ \r\n]$/,e=true,h=window._pr_isIE6();h=h?b.b.tagName==="PRE"?h===6?"&#160;\r\n":h===7?"&#160;<br>\r":"&#160;\r":"&#160;<br />":"<br />";var g=b.b.className.match(/\blinenums\b(?::(\d+))?/),s;if(g){for(var v=[],w=0;w<10;++w)v[w]=h+'</li><li class="L'+w+'">';var F=g[1]&&g[1].length?g[1]-1:0;n.push('<ol class="linenums"><li class="L',F%10,'"');F&&n.push(' value="',F+1,'"');n.push(">");s=function(){var D=v[++F%10];return j?"</span>"+D+'<span class="'+j+'">':D}}else s=h;
for(;;)if(m<o.length?t<l.length?o[m]<=l[t]:true:false){f(o[m]);if(j){n.push("</span>");j=null}n.push(o[m+1]);m+=2}else if(t<l.length){f(l[t]);q=l[t+1];t+=2}else break;f(i.length);j&&n.push("</span>");g&&n.push("</li></ol>");b.a=n.join("")}function u(b,f){for(var i=f.length;--i>=0;){var o=f[i];if(G.hasOwnProperty(o))"console"in window&&console.warn("cannot override language handler %s",o);else G[o]=b}}function Q(b,f){b&&G.hasOwnProperty(b)||(b=/^\s*</.test(f)?"default-markup":"default-code");return G[b]}
function U(b){var f=b.f,i=b.e;b.a=f;try{var o,l=f.match(aa);f=[];var n=0,r=[];if(l)for(var j=0,q=l.length;j<q;++j){var m=l[j];if(m.length>1&&m.charAt(0)==="<"){if(!ba.test(m))if(ca.test(m)){f.push(m.substring(9,m.length-3));n+=m.length-12}else if(da.test(m)){f.push("\n");++n}else if(m.indexOf(V)>=0&&m.replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,' $1="$2$3$4"').match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/)){var t=m.match(W)[2],p=1,c;c=j+1;a:for(;c<q;++c){var d=l[c].match(W);if(d&&
d[2]===t)if(d[1]==="/"){if(--p===0)break a}else++p}if(c<q){r.push(n,l.slice(j,c+1).join(""));j=c}else r.push(n,m)}else r.push(n,m)}else{var a;p=m;var k=p.indexOf("&");if(k<0)a=p;else{for(--k;(k=p.indexOf("&#",k+1))>=0;){var e=p.indexOf(";",k);if(e>=0){var h=p.substring(k+3,e),g=10;if(h&&h.charAt(0)==="x"){h=h.substring(1);g=16}var s=parseInt(h,g);isNaN(s)||(p=p.substring(0,k)+String.fromCharCode(s)+p.substring(e+1))}}a=p.replace(ea,"<").replace(fa,">").replace(ga,"'").replace(ha,'"').replace(ia," ").replace(ja,
"&")}f.push(a);n+=a.length}}o={source:f.join(""),h:r};var v=o.source;b.source=v;b.c=0;b.g=o.h;Q(i,v)(b);$(b)}catch(w){if("console"in window)console.log(w&&w.stack?w.stack:w)}}var A="str",R="kwd",C="com",S="typ",J="lit",E="pun",z="pln",P="src",V="nocode",Z=function(){for(var b=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=",
"~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],f="(?:^^|[+-]",i=0;i<b.length;++i)f+="|"+b[i].replace(/([^=<>:&a-z])/g,"\\$1");f+=")\\s*";return f}(),L=/&/g,M=/</g,N=/>/g,X=/\"/g,ea=/&lt;/g,fa=/&gt;/g,ga=/&apos;/g,ha=/&quot;/g,ja=/&amp;/g,ia=/&nbsp;/g,ka=/[\r\n]/g,K=null,aa=RegExp("[^<]+|<!--[\\s\\S]*?--\>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|</?[a-zA-Z](?:[^>\"']|'[^']*'|\"[^\"]*\")*>|<","g"),ba=/^<\!--/,ca=/^<!\[CDATA\[/,da=/^<br\b/i,W=/^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/,
la=x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename using virtual wchar_t where break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params partial readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof debugger eval export function get null set undefined var with Infinity NaN caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END break continue do else for if return while case done elif esac eval fi function in local set then until ",
hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true}),G={};u(la,["default-code"]);u(B([],[[z,/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],[C,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[E,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup",
"htm","html","mxml","xhtml","xml","xsl"]);u(B([[z,/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[E,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],
["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);u(B([],[["atv",/^[\s\S]+/]]),["uq.val"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename using virtual wchar_t where ",
hashComments:true,cStyleComments:true}),["c","cc","cpp","cxx","cyc","m"]);u(x({keywords:"null true false"}),["json"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params partial readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ",
hashComments:true,cStyleComments:true,verbatimStrings:true}),["cs"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ",
cStyleComments:true}),["java"]);u(x({keywords:"break continue do else for if return while case done elif esac eval fi function in local set then until ",hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);u(x({keywords:"break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);
u(x({keywords:"caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);u(x({keywords:"break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ",hashComments:true,
multiLineStrings:true,regexLiterals:true}),["rb"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof debugger eval export function get null set undefined var with Infinity NaN ",cStyleComments:true,regexLiterals:true}),["js"]);u(B([],[[A,/^[\s\S]+/]]),
["regex"]);window.PR_normalizedHtml=H;window.prettyPrintOne=function(b,f){var i={f:b,e:f};U(i);return i.a};window.prettyPrint=function(b){function f(){for(var t=window.PR_SHOULD_USE_CONTINUATION?j.now()+250:Infinity;q<o.length&&j.now()<t;q++){var p=o[q];if(p.className&&p.className.indexOf("prettyprint")>=0){var c=p.className.match(/\blang-(\w+)\b/);if(c)c=c[1];for(var d=false,a=p.parentNode;a;a=a.parentNode)if((a.tagName==="pre"||a.tagName==="code"||a.tagName==="xmp")&&a.className&&a.className.indexOf("prettyprint")>=
0){d=true;break}if(!d){a=p;if(null===K){d=document.createElement("PRE");d.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));K=!/</.test(d.innerHTML)}if(K){d=a.innerHTML;if("XMP"===a.tagName)d=y(d);else{a=a;if("PRE"===a.tagName)a=true;else if(ka.test(d)){var k="";if(a.currentStyle)k=a.currentStyle.whiteSpace;else if(window.getComputedStyle)k=window.getComputedStyle(a,null).whiteSpace;a=!k||k==="pre"}else a=true;a||(d=d.replace(/(<br\s*\/?>)[\r\n]+/g,"$1").replace(/(?:[\r\n]+[ \t]*)+/g,
" "))}d=d}else{d=[];for(a=a.firstChild;a;a=a.nextSibling)H(a,d);d=d.join("")}d=d.replace(/(?:\r\n?|\n)$/,"");m={f:d,e:c,b:p};U(m);if(p=m.a){c=m.b;if("XMP"===c.tagName){d=document.createElement("PRE");for(a=0;a<c.attributes.length;++a){k=c.attributes[a];if(k.specified)if(k.name.toLowerCase()==="class")d.className=k.value;else d.setAttribute(k.name,k.value)}d.innerHTML=p;c.parentNode.replaceChild(d,c)}else c.innerHTML=p}}}}if(q<o.length)setTimeout(f,250);else b&&b()}for(var i=[document.getElementsByTagName("pre"),
document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],o=[],l=0;l<i.length;++l)for(var n=0,r=i[l].length;n<r;++n)o.push(i[l][n]);i=null;var j=Date;j.now||(j={now:function(){return(new Date).getTime()}});var q=0,m;f()};window.PR={combinePrefixPatterns:O,createSimpleLexer:B,registerLangHandler:u,sourceDecorator:x,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:C,PR_DECLARATION:"dec",PR_KEYWORD:R,PR_LITERAL:J,PR_NOCODE:V,PR_PLAIN:z,PR_PUNCTUATION:E,PR_SOURCE:P,PR_STRING:A,
PR_TAG:"tag",PR_TYPE:S}})()

+ 0
- 7
docs/resources/site_footer.html View File

@@ -1,7 +0,0 @@
</div>
<div style="margin-top:10px" class="page_footer">
<div style="float:right;">{0}</div>
The content of this page is licensed under the <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution 3.0 License</a>.
</div>
</body>
</html>

+ 0
- 32
docs/resources/site_header.html View File

@@ -1,32 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>iciql</title>
<link rel="stylesheet" type="text/css" href="./iciql.css"/>
<link rel="stylesheet" type="text/css" href="./markdown.css"/>
<link rel="shortcut icon" type="image/png" href="./iciql-favicon.png" />
<meta name="ROBOTS" content="INDEX">
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="java sql query jaqu" />
<script type="text/javascript" src="prettify.js"></script>
<link href="prettify.css" type="text/css" rel="stylesheet" />
<!-- Place this tag in your head or just before your close body tag -->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<!-- ANALYTICS -->
</head>
<body style="width:900px" onload="prettyPrint()">
<a href="http://github.com/iciql><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://d3nwyuy0nl342s.cloudfront.net/img/30f550e0d38ceb6ef5b81500c64d970b7fb0f028/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub"></a>
<div class="page_header">
<a title="iciql homepage" href="http://iciql.com/">
<img src="./iciql.png" width="76" height="48" alt="iciql" class="logo"/>
</a>
<span style="color:black;">{0}</span>
<!-- Google Plus One -->
<g:plusone></g:plusone>
</div>
<div class="page_nav">{1}</div>
<div class="markdown">

+ 1
- 0
maven

@@ -0,0 +1 @@
Subproject commit e5fedcee910250c4b13bd6df46a6931c80a6a534

+ 0
- 262
src/com/iciql/build/Build.java View File

@@ -1,262 +0,0 @@
/*
* Copyright 2011 James Moger.
*
* Licensed 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.
*/
package com.iciql.build;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import com.iciql.util.StringUtils;
/**
* The Build class downloads runtime and compile-time jar files from the Apache
* Maven repositories.
*
* Its important that this class have minimal compile dependencies since its
* called very early in the build script.
*
*/
public class Build {
/**
* BuildTypes
*/
public static enum BuildType {
RUNTIME, COMPILETIME;
}
public static void main(String... args) {
runtime();
compiletime();
}
public static void runtime() {
}
public static void compiletime() {
downloadFromApache(MavenObject.H2, BuildType.RUNTIME);
downloadFromApache(MavenObject.H2, BuildType.COMPILETIME);
downloadFromApache(MavenObject.HSQLDB, BuildType.RUNTIME);
downloadFromApache(MavenObject.DERBY, BuildType.RUNTIME);
downloadFromApache(MavenObject.MYSQL, BuildType.RUNTIME);
downloadFromApache(MavenObject.POSTGRESQL, BuildType.RUNTIME);
downloadFromApache(MavenObject.JCOMMANDER, BuildType.RUNTIME);
downloadFromApache(MavenObject.JCOMMANDER, BuildType.COMPILETIME);
downloadFromApache(MavenObject.MARKDOWNPAPERS, BuildType.RUNTIME);
downloadFromApache(MavenObject.MARKDOWNPAPERS, BuildType.COMPILETIME);
downloadFromApache(MavenObject.JUNIT, BuildType.RUNTIME);
downloadFromApache(MavenObject.DOCLAVA, BuildType.RUNTIME);
downloadFromApache(MavenObject.DOCLAVA, BuildType.COMPILETIME);
downloadFromApache(MavenObject.SLF4JAPI, BuildType.RUNTIME);
downloadFromApache(MavenObject.SLF4JAPI, BuildType.COMPILETIME);
downloadFromApache(MavenObject.COMMONSPOOL, BuildType.RUNTIME);
downloadFromApache(MavenObject.COMMONSPOOL, BuildType.COMPILETIME);
downloadFromApache(MavenObject.COMMONSDBCP, BuildType.RUNTIME);
downloadFromApache(MavenObject.COMMONSDBCP, BuildType.COMPILETIME);
// needed for site publishing
downloadFromApache(MavenObject.COMMONSNET, BuildType.RUNTIME);
}
/**
* Download a file from the official Apache Maven repository.
*
* @param mo
* the maven object to download.
* @return
*/
private static List<File> downloadFromApache(MavenObject mo, BuildType type) {
return downloadFromMaven("http://repo1.maven.org/maven2/", mo, type);
}
/**
* Download a file from a Maven repository.
*
* @param mo
* the maven object to download.
* @return
*/
private static List<File> downloadFromMaven(String mavenRoot, MavenObject mo, BuildType type) {
List<File> downloads = new ArrayList<File>();
String[] jars = { "" };
if (BuildType.RUNTIME.equals(type)) {
jars = new String[] { "" };
} else if (BuildType.COMPILETIME.equals(type)) {
jars = new String[] { "-sources", "-javadoc" };
}
for (String jar : jars) {
File targetFile = mo.getLocalFile("ext", jar);
if (targetFile.exists()) {
downloads.add(targetFile);
continue;
}
String expectedSHA1 = mo.getSHA1(jar);
if (expectedSHA1 == null) {
// skip this jar
continue;
}
String mavenURL = mavenRoot + mo.getRepositoryPath(jar);
if (!targetFile.getAbsoluteFile().getParentFile().exists()) {
boolean success = targetFile.getAbsoluteFile().getParentFile().mkdirs();
if (!success) {
throw new RuntimeException("Failed to create destination folder structure!");
}
}
ByteArrayOutputStream buff = new ByteArrayOutputStream();
try {
URL url = new URL(mavenURL);
InputStream in = new BufferedInputStream(url.openStream());
byte[] buffer = new byte[4096];
System.out.println("d/l: " + targetFile.getName());
while (true) {
int len = in.read(buffer);
if (len < 0) {
break;
}
buff.write(buffer, 0, len);
}
in.close();
} catch (IOException e) {
throw new RuntimeException("Error downloading " + mavenURL + " to " + targetFile, e);
}
byte[] data = buff.toByteArray();
String calculatedSHA1 = StringUtils.calculateSHA1(data);
System.out.println();
if (expectedSHA1.length() == 0) {
System.out.println("sha: " + calculatedSHA1);
System.out.println();
} else {
if (!calculatedSHA1.equals(expectedSHA1)) {
throw new RuntimeException("SHA1 checksum mismatch; got: " + calculatedSHA1);
}
}
try {
RandomAccessFile ra = new RandomAccessFile(targetFile, "rw");
ra.write(data);
ra.setLength(data.length);
ra.close();
} catch (IOException e) {
throw new RuntimeException("Error writing to file " + targetFile, e);
}
downloads.add(targetFile);
}
return downloads;
}
/**
* Class that describes a retrievable Maven object.
*/
private static class MavenObject {
public static final MavenObject JCOMMANDER = new MavenObject("com/beust", "jcommander", "1.17",
"219a3540f3b27d7cc3b1d91d6ea046cd8723290e", "0bb50eec177acf0e94d58e0cf07262fe5164331d",
"c7adc475ca40c288c93054e0f4fe58f3a98c0cb5");
public static final MavenObject H2 = new MavenObject("com/h2database", "h2", "1.3.168",
"eb32936a239d95220f5b2d2973a7b17372f98b54", "61da28f8c48d07c099fc78d72c6152b84d89b4ca",
"724ff8347553919e703a369a856713a8e7ef4fac");
public static final MavenObject HSQLDB = new MavenObject("org/hsqldb", "hsqldb", "2.2.8",
"8231a3ff71ba5889f9e2d01ce13503cbdd4038e9", "", "");
public static final MavenObject DERBY = new MavenObject("org/apache/derby", "derby", "10.9.1.0",
"4538cf5564ab3c262eec65c55fdb13965625589c", "", "");
public static final MavenObject MYSQL = new MavenObject("mysql", "mysql-connector-java", "5.1.15",
"0fbc80454d27cc65f3addfa516707e9f8e60c3eb", "", "");
public static final MavenObject POSTGRESQL = new MavenObject("postgresql", "postgresql", "9.0-801.jdbc4",
"153f2f92a786f12fc111d0111f709012df87c808", "", "");
public static final MavenObject JUNIT = new MavenObject("junit", "junit", "4.8.2",
"c94f54227b08100974c36170dcb53329435fe5ad", "", "");
public static final MavenObject MARKDOWNPAPERS = new MavenObject("org/tautua/markdownpapers",
"markdownpapers-core", "1.1.0", "b879b4720fa642d3c490ab559af132daaa16dbb4",
"d98c53939815be2777d5a56dcdc3bbc9ddb468fa", "4c09d2d3073e85b973572292af00bd69681df76b");
public static final MavenObject COMMONSNET = new MavenObject("commons-net", "commons-net", "1.4.0",
"eb47e8cad2dd7f92fd7e77df1d1529cae87361f7", "", "");
public static final MavenObject DOCLAVA = new MavenObject("com/google/doclava", "doclava", "1.0.3",
"5a1e05977fd36480b0cf314410440f88e3a0049e", "6e314df1733455d66b98b56014363172773d0905",
"1c1aa631b235439356e6e5803319caca80aaaa88");
public static final MavenObject SLF4JAPI = new MavenObject("org/slf4j", "slf4j-api", "1.6.1",
"6f3b8a24bf970f17289b234284c94f43eb42f0e4", "46a386136c901748e6a3af67ebde6c22bc6b4524",
"e223571d77769cdafde59040da235842f3326453");
public static final MavenObject COMMONSPOOL = new MavenObject("commons-pool", "commons-pool", "1.5.6",
"16390e2d74df4ab08c06a85d42a74a951dc93ad7", "bbfb73ed3c341d9738c64da8157910b967f878d6",
"d72204023b30cd9fecb64829586472f3c6806005");
public static final MavenObject COMMONSDBCP = new MavenObject("commons-dbcp", "commons-dbcp", "1.4",
"30be73c965cc990b153a100aaaaafcf239f82d39", "9b076ff231434d5403be6599a1347019b12c0def",
"098bf7c8d5b026f6e3969259a36e813ac37432b3");
public final String group;
public final String artifact;
public final String version;
public final String librarySHA1;
public final String sourcesSHA1;
public final String javadocSHA1;
private MavenObject(String group, String artifact, String version, String librarySHA1,
String sourcesSHA1, String javadocSHA1) {
this.group = group;
this.artifact = artifact;
this.version = version;
this.librarySHA1 = librarySHA1;
this.sourcesSHA1 = sourcesSHA1;
this.javadocSHA1 = javadocSHA1;
}
private String getRepositoryPath(String jar) {
return group + "/" + artifact + "/" + version + "/" + artifact + "-" + version + jar + ".jar";
}
private File getLocalFile(String basePath, String jar) {
return new File(basePath, artifact + "-" + version + jar + ".jar");
}
private String getSHA1(String jar) {
if (jar.equals("")) {
return librarySHA1;
} else if (jar.equals("-sources")) {
return sourcesSHA1;
} else if (jar.equals("-javadoc")) {
return javadocSHA1;
}
return librarySHA1;
}
@Override
public String toString() {
return group;
}
}
}

+ 0
- 338
src/com/iciql/build/BuildSite.java View File

@@ -1,338 +0,0 @@
/*
* Copyright 2011 James Moger.
*
* Licensed 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.
*/
package com.iciql.build;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.text.MessageFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import org.tautua.markdownpapers.Markdown;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.ParameterException;
import com.beust.jcommander.Parameters;
import com.iciql.Constants;
import com.iciql.util.StringUtils;
/**
* Builds the web site or deployment documentation from Markdown source files.
*
* All Markdown source files must have the .mkd extension.
*
* Natural string sort order of the Markdown source filenames is the order of
* page links. "##_" prefixes are used to control the sort order.
*
* @author James Moger
*
*/
public class BuildSite {
public static void main(String... args) {
Params params = new Params();
JCommander jc = new JCommander(params);
try {
jc.parse(args);
} catch (ParameterException t) {
usage(jc, t);
}
File sourceFolder = new File(params.sourceFolder);
File destinationFolder = new File(params.outputFolder);
File[] markdownFiles = sourceFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".mkd");
}
});
Arrays.sort(markdownFiles);
Map<String, String> aliasMap = new HashMap<String, String>();
for (String alias : params.aliases) {
String[] values = alias.split("=");
aliasMap.put(values[0], values[1]);
}
System.out.println(MessageFormat.format("Generating site from {0} Markdown Docs in {1} ",
markdownFiles.length, sourceFolder.getAbsolutePath()));
String linkPattern = "<a href=''{0}''>{1}</a>";
StringBuilder sb = new StringBuilder();
for (File file : markdownFiles) {
String documentName = getDocumentName(file);
if (!params.skips.contains(documentName)) {
String displayName = documentName;
if (aliasMap.containsKey(documentName)) {
displayName = aliasMap.get(documentName);
} else {
displayName = displayName.replace('_', ' ');
}
String fileName = documentName + ".html";
sb.append(MessageFormat.format(linkPattern, fileName, displayName));
sb.append(" | ");
}
}
sb.setLength(sb.length() - 3);
sb.trimToSize();
String htmlHeader = readContent(new File(params.pageHeader), "\n");
String htmlAdSnippet = null;
if (!StringUtils.isNullOrEmpty(params.adSnippet)) {
File snippet = new File(params.adSnippet);
if (snippet.exists()) {
htmlAdSnippet = readContent(snippet, "\n");
}
}
String htmlFooter = readContent(new File(params.pageFooter), "\n");
String links = sb.toString();
String header = MessageFormat.format(htmlHeader, Constants.NAME, links);
if (!StringUtils.isNullOrEmpty(params.analyticsSnippet)) {
File snippet = new File(params.analyticsSnippet);
if (snippet.exists()) {
String htmlSnippet = readContent(snippet, "\n");
header = header.replace("<!-- ANALYTICS -->", htmlSnippet);
}
}
final String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
final String footer = MessageFormat.format(htmlFooter, "generated " + date);
for (File file : markdownFiles) {
try {
String documentName = getDocumentName(file);
if (!params.skips.contains(documentName)) {
String fileName = documentName + ".html";
System.out.println(MessageFormat.format(" {0} => {1}", file.getName(), fileName));
String rawContent = readContent(file, "\n");
String markdownContent = rawContent;
Map<String, List<String>> nomarkdownMap = new HashMap<String, List<String>>();
// extract sections marked as no-markdown
int nmd = 0;
for (String token : params.nomarkdown) {
StringBuilder strippedContent = new StringBuilder();
String nomarkdownKey = "%NOMARKDOWN" + nmd + "%";
String[] kv = token.split(":", 2);
String beginToken = kv[0];
String endToken = kv[1];
// strip nomarkdown chunks from markdown and cache them
List<String> chunks = new Vector<String>();
int beginCode = 0;
int endCode = 0;
while ((beginCode = markdownContent.indexOf(beginToken, endCode)) > -1) {
if (endCode == 0) {
strippedContent.append(markdownContent.substring(0, beginCode));
} else {
strippedContent.append(markdownContent.substring(endCode, beginCode));
}
strippedContent.append(nomarkdownKey);
endCode = markdownContent.indexOf(endToken, beginCode);
chunks.add(markdownContent.substring(beginCode, endCode));
nomarkdownMap.put(nomarkdownKey, chunks);
}
// get remainder of text
if (endCode < markdownContent.length()) {
strippedContent.append(markdownContent.substring(endCode,
markdownContent.length()));
}
markdownContent = strippedContent.toString();
nmd++;
}
// transform markdown to html
String content = transformMarkdown(new StringReader(markdownContent.toString()));
// reinsert nomarkdown chunks
for (Map.Entry<String, List<String>> nomarkdown : nomarkdownMap.entrySet()) {
for (String chunk : nomarkdown.getValue()) {
content = content.replaceFirst(nomarkdown.getKey(), chunk);
}
}
// perform specified substitutions
for (String token : params.substitutions) {
String[] kv = token.split("=", 2);
content = content.replace(kv[0], kv[1]);
}
for (String token : params.regex) {
String[] kv = token.split("!!!", 2);
content = content.replaceAll(kv[0], kv[1]);
}
for (String alias : params.loads) {
String[] kv = alias.split("=", 2);
String loadedContent = StringUtils.readContent(new File(kv[1]), "\n");
loadedContent = StringUtils.escapeForHtml(loadedContent, false);
loadedContent = StringUtils.breakLinesForHtml(loadedContent);
content = content.replace(kv[0], loadedContent);
}
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(new File(
destinationFolder, fileName)), Charset.forName("UTF-8"));
writer.write(header);
if (!StringUtils.isNullOrEmpty(htmlAdSnippet)) {
writer.write(htmlAdSnippet);
}
writer.write(content);
writer.write(footer);
writer.close();
}
} catch (Throwable t) {
System.err.println("Failed to transform " + file.getName());
t.printStackTrace();
}
}
}
private static String getDocumentName(File file) {
String displayName = file.getName().substring(0, file.getName().lastIndexOf('.')).toLowerCase();
int underscore = displayName.indexOf('_') + 1;
if (underscore > -1) {
// trim leading ##_ which is to control display order
return displayName.substring(underscore);
}
return displayName;
}
/**
* Returns the string content of the specified file.
*
* @param file
* @param lineEnding
* @return the string content of the file
*/
private static String readContent(File file, String lineEnding) {
StringBuilder sb = new StringBuilder();
try {
InputStreamReader is = new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"));
BufferedReader reader = new BufferedReader(is);
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line);
if (lineEnding != null) {
sb.append(lineEnding);
}
}
reader.close();
} catch (Throwable t) {
System.err.println("Failed to read content of " + file.getAbsolutePath());
t.printStackTrace();
}
return sb.toString();
}
private static String transformMarkdown(Reader markdownReader) throws ParseException {
// Read raw markdown content and transform it to html
StringWriter writer = new StringWriter();
try {
Markdown md = new Markdown();
md.transform(markdownReader, writer);
return writer.toString().trim();
} catch (org.tautua.markdownpapers.parser.ParseException p) {
throw new java.text.ParseException(p.getMessage(), 0);
} finally {
try {
markdownReader.close();
} catch (IOException e) {
// IGNORE
}
try {
writer.close();
} catch (IOException e) {
// IGNORE
}
}
}
private static void usage(JCommander jc, ParameterException t) {
System.out.println(Constants.NAME + " v" + Constants.VERSION);
System.out.println();
if (t != null) {
System.out.println(t.getMessage());
System.out.println();
}
if (jc != null) {
jc.usage();
}
System.exit(0);
}
/**
* Command-line parameters for BuildSite utility.
*/
@Parameters(separators = " ")
private static class Params {
@Parameter(names = { "--sourceFolder" }, description = "Markdown Source Folder", required = true)
public String sourceFolder;
@Parameter(names = { "--outputFolder" }, description = "HTML Ouptut Folder", required = true)
public String outputFolder;
@Parameter(names = { "--pageHeader" }, description = "Page Header HTML Snippet", required = true)
public String pageHeader;
@Parameter(names = { "--pageFooter" }, description = "Page Footer HTML Snippet", required = true)
public String pageFooter;
@Parameter(names = { "--adSnippet" }, description = "Ad HTML Snippet", required = false)
public String adSnippet;
@Parameter(names = { "--analyticsSnippet" }, description = "Analytics HTML Snippet", required = false)
public String analyticsSnippet;
@Parameter(names = { "--skip" }, description = "Filename to skip", required = false)
public List<String> skips = new ArrayList<String>();
@Parameter(names = { "--alias" }, description = "Filename=Linkname aliases", required = false)
public List<String> aliases = new ArrayList<String>();
@Parameter(names = { "--substitute" }, description = "%TOKEN%=value", required = false)
public List<String> substitutions = new ArrayList<String>();
@Parameter(names = { "--load" }, description = "%TOKEN%=filename", required = false)
public List<String> loads = new ArrayList<String>();
@Parameter(names = { "--nomarkdown" }, description = "%STARTTOKEN%:%ENDTOKEN%", required = false)
public List<String> nomarkdown = new ArrayList<String>();
@Parameter(names = { "--regex" }, description = "searchPattern!!!replacePattern", required = false)
public List<String> regex = new ArrayList<String>();
}
}

Loading…
Cancel
Save