openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmar...@apache.org
Subject svn commit: r1722954 [1/2] - in /openoffice/devtools/lazybones-templates: ./ branches/ tags/ trunk/ trunk/.gradle/ trunk/.gradle/2.7/ trunk/.gradle/2.7/taskArtifacts/ trunk/gradle/ trunk/gradle/wrapper/ trunk/templates/ trunk/templates/aoo-client/ trun...
Date Mon, 04 Jan 2016 19:58:09 GMT
Author: cmarcum
Date: Mon Jan  4 19:58:09 2016
New Revision: 1722954

URL: http://svn.apache.org/viewvc?rev=1722954&view=rev
Log:
#i126770# initial import of lazybones-templates project

Added:
    openoffice/devtools/lazybones-templates/
    openoffice/devtools/lazybones-templates/branches/
    openoffice/devtools/lazybones-templates/tags/
    openoffice/devtools/lazybones-templates/trunk/
    openoffice/devtools/lazybones-templates/trunk/.gradle/
    openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/
    openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/
    openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/cache.properties   (with props)
    openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/cache.properties.lock   (with props)
    openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/fileHashes.bin   (with props)
    openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/fileSnapshots.bin   (with props)
    openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/outputFileStates.bin   (with props)
    openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/taskArtifacts.bin   (with props)
    openoffice/devtools/lazybones-templates/trunk/README.md
    openoffice/devtools/lazybones-templates/trunk/build.gradle
    openoffice/devtools/lazybones-templates/trunk/gradle/
    openoffice/devtools/lazybones-templates/trunk/gradle/wrapper/
    openoffice/devtools/lazybones-templates/trunk/gradle/wrapper/gradle-wrapper.jar   (with props)
    openoffice/devtools/lazybones-templates/trunk/gradle/wrapper/gradle-wrapper.properties   (with props)
    openoffice/devtools/lazybones-templates/trunk/gradlew   (with props)
    openoffice/devtools/lazybones-templates/trunk/gradlew.bat   (with props)
    openoffice/devtools/lazybones-templates/trunk/templates/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/README.md
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/VERSION
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/build.gradle
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/gradle.properties   (with props)
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/lazybones.groovy
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/GroovyUnoClient.groovy
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/org/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/org/openoffice/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/org/openoffice/guno/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/org/openoffice/guno/SpreadsheetDocHelper.groovy
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/star/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/star/lib/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/star/lib/loader/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/star/lib/loader/InstallationFinder.java   (with props)
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/star/lib/loader/Loader.java   (with props)
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/star/lib/loader/WinRegKey.java   (with props)
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/star/lib/loader/WinRegKeyException.java   (with props)
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/resources/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/resources/META-INF/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/resources/META-INF/LICENSE   (with props)
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/resources/META-INF/NOTICE   (with props)
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/resources/win/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/resources/win/unowinreg.dll   (with props)
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/test/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/test/groovy/
    openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/test/groovy/.retain

Added: openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/cache.properties
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/cache.properties?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/cache.properties (added)
+++ openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/cache.properties Mon Jan  4 19:58:09 2016
@@ -0,0 +1 @@
+#Sun Jan 03 08:13:48 EST 2016

Propchange: openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/cache.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/cache.properties.lock
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/cache.properties.lock?rev=1722954&view=auto
==============================================================================
Binary file - no diff available.

Propchange: openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/cache.properties.lock
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/fileHashes.bin
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/fileHashes.bin?rev=1722954&view=auto
==============================================================================
Binary file - no diff available.

Propchange: openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/fileHashes.bin
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/fileSnapshots.bin
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/fileSnapshots.bin?rev=1722954&view=auto
==============================================================================
Binary file - no diff available.

Propchange: openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/fileSnapshots.bin
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/outputFileStates.bin
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/outputFileStates.bin?rev=1722954&view=auto
==============================================================================
Binary file - no diff available.

Propchange: openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/outputFileStates.bin
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/taskArtifacts.bin
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/taskArtifacts.bin?rev=1722954&view=auto
==============================================================================
Binary file - no diff available.

Propchange: openoffice/devtools/lazybones-templates/trunk/.gradle/2.7/taskArtifacts/taskArtifacts.bin
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: openoffice/devtools/lazybones-templates/trunk/README.md
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/README.md?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/README.md (added)
+++ openoffice/devtools/lazybones-templates/trunk/README.md Mon Jan  4 19:58:09 2016
@@ -0,0 +1,24 @@
+Lazybones template project
+--------------------------
+
+You have just created a simple project for managing your own Lazybones project
+templates. You get a build file (`build.gradle`) and a directory for putting
+your templates in (`templates`).
+
+To get started, simply create new directories under the `templates` directory
+and put the source of the different project templates into them. You can then
+package and install the templates locally with the command:
+
+    ./gradlew installAllTemplates
+
+You'll then be able to use Lazybones to create new projects from these templates.
+If you then want to distribute them, you will need to set up a Bintray account,
+populate the `repositoryUrl`, `repositoryUsername` and `repositoryApiKey` settings
+in `build.gradle`, add new Bintray packages in the repository via the Bintray
+UI, and finally publish the templates with
+
+    ./gradlew publishAllTemplates
+
+You can find out more about creating templates on [the GitHub wiki][1].
+
+[1]: https://github.com/pledbrook/lazybones/wiki/Template-developers-guide

Added: openoffice/devtools/lazybones-templates/trunk/build.gradle
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/build.gradle?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/build.gradle (added)
+++ openoffice/devtools/lazybones-templates/trunk/build.gradle Mon Jan  4 19:58:09 2016
@@ -0,0 +1,29 @@
+buildscript {
+    repositories {
+        maven {
+            url "http://dl.bintray.com/pledbrook/plugins"
+        }
+    }
+
+    dependencies {
+        classpath "uk.co.cacoethes:lazybones-gradle:1.2.1"
+    }
+}
+
+apply plugin: "uk.co.cacoethes.lazybones-templates"
+
+lazybones {
+    repositoryName = "<account>/<templates-repo>"
+
+    // It's best to pull this information from a gradle.properties file in the
+    // root directory. For example, gradle.properties could contain:
+    //
+    //     bintrayUsername=dilbert
+    //     bintrayApiKey=kdshfiu2htr082hg0h2ghkhsdafkh
+    //
+    // You could then set the following properties to `project.bintrayUsername`
+    // and `project.bintrayApiKey` respectively.
+    repositoryUsername = "your_bintray_username"
+    repositoryApiKey = "your_bintray_api_key"
+}
+

Added: openoffice/devtools/lazybones-templates/trunk/gradle/wrapper/gradle-wrapper.jar
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/gradle/wrapper/gradle-wrapper.jar?rev=1722954&view=auto
==============================================================================
Binary file - no diff available.

Propchange: openoffice/devtools/lazybones-templates/trunk/gradle/wrapper/gradle-wrapper.jar
------------------------------------------------------------------------------
    svn:mime-type = application/zip

Added: openoffice/devtools/lazybones-templates/trunk/gradle/wrapper/gradle-wrapper.properties
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/gradle/wrapper/gradle-wrapper.properties?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/gradle/wrapper/gradle-wrapper.properties (added)
+++ openoffice/devtools/lazybones-templates/trunk/gradle/wrapper/gradle-wrapper.properties Mon Jan  4 19:58:09 2016
@@ -0,0 +1,6 @@
+#Sat Aug 23 08:12:12 BST 2014
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip

Propchange: openoffice/devtools/lazybones-templates/trunk/gradle/wrapper/gradle-wrapper.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openoffice/devtools/lazybones-templates/trunk/gradlew
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/gradlew?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/gradlew (added)
+++ openoffice/devtools/lazybones-templates/trunk/gradlew Mon Jan  4 19:58:09 2016
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+    echo "$*"
+}
+
+die ( ) {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+    JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

Propchange: openoffice/devtools/lazybones-templates/trunk/gradlew
------------------------------------------------------------------------------
    svn:executable = 

Added: openoffice/devtools/lazybones-templates/trunk/gradlew.bat
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/gradlew.bat?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/gradlew.bat (added)
+++ openoffice/devtools/lazybones-templates/trunk/gradlew.bat Mon Jan  4 19:58:09 2016
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

Propchange: openoffice/devtools/lazybones-templates/trunk/gradlew.bat
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/README.md
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/README.md?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/README.md (added)
+++ openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/README.md Mon Jan  4 19:58:09 2016
@@ -0,0 +1,74 @@
+Apache OpenOffice Client Application project template
+-----------------------------------------------------
+
+You have just created a basic Apache OpenOffice Client application. 
+There is a standard project structure for source code and tests.
+Simply add your source files to `src/main/<groovy or java>`, your test cases 
+to `src/test/<groovy or java>` and then you will be able to build your project 
+with `gradle jar` and run with `gradle runJar`.
+
+In this project you get:
+
+* A Gradle build file
+* A standard project structure:
+
+   <proj>
+      |
+      +- src
+           |
+           +- main
+           |     |
+           |     +- groovy
+           |     |     |
+           |     |     +- <your-package>
+           |     |     |    |
+           |     |     |    +- <your-class>.groovy
+           |     |     |          
+           |     |     |          
+           |     |     |
+           |     |     +- org
+           |     |          |
+           |     |          +- openoffice
+           |     |                |
+           |     |                +- guno
+           |     |                      |
+           |     |                      +- SpreadsheetDocHelper.groovy
+           |     |      
+           |     +- java
+           |     |     |
+           |     |     +- com
+           |     |          |
+           |     |          +- sun
+           |     |               |
+           |     |               +- lib
+           |     |                    |
+           |     |                    +- loader
+           |     |                          |
+           |     |                          +- InstallationFinder.java
+           |     |                          |
+           |     |                          +- Loader.java
+           |     |                          |
+           |     |                          +- WinRegKey.java
+           |     |                          |
+           |     |                          +- WinRegKeyException.java
+           |     |
+           |     +- resources
+           |           |                           
+           |           +- META-INF
+           |           |     |
+           |           |     +- LICENSE
+           |           |     |
+           |           |     +- NOTICE
+           |           |
+           |           +- win
+           |                |
+           |                +- unowinreg.dll
+           |
+           +- test
+                |
+                +- groovy
+ 
+You need to edit the build.gradle file for the location of the GroovyUnoExtension 
+jar file and also add any additional dependencies if needed.
+
+

Added: openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/VERSION
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/VERSION?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/VERSION (added)
+++ openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/VERSION Mon Jan  4 19:58:09 2016
@@ -0,0 +1,2 @@
+0.1.0
+

Added: openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/build.gradle
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/build.gradle?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/build.gradle (added)
+++ openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/build.gradle Mon Jan  4 19:58:09 2016
@@ -0,0 +1,60 @@
+apply plugin: "groovy"
+apply plugin: "application"
+
+group "${project_group}"
+version "${project_version}"
+
+repositories {
+    mavenCentral()
+
+}
+
+
+
+dependencies {
+    compile 'org.codehaus.groovy:groovy-all:2.4.5'
+    compile "org.openoffice:juh:4.1.2"
+    compile "org.openoffice:ridl:4.1.2"
+    compile "org.openoffice:unoil:4.1.2"
+    compile "org.openoffice:jurt:4.1.2"
+    // use local extension jar until available from maven repo
+    compile files('../GroovyUnoExtension/build/libs/GroovyUnoExtension-0.0.1.jar')
+    testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
+
+}
+
+
+mainClassName = "com.sun.star.lib.loader.Loader"
+
+
+task copyLibs(type: Copy) {
+    into buildDir.toString() + "/libs/lib"
+    from findJar('groovy-all')
+    // additional froms
+    from findJar('GroovyUnoExtension')
+} 
+
+// returns a file list from configurations.runtime that start with prefix
+def findJar(prefix) { 
+    println "findJar filter = " + prefix
+    configurations.runtime.filter { it.name.startsWith(prefix) } 
+}
+
+jar {
+    manifest {
+        attributes('Main-Class': 'com.sun.star.lib.loader.Loader')
+        attributes('Class-Path': 'lib/groovy-all-2.4.5.jar lib/GroovyUnoExtension-0.0.1.jar') // use spaces between additional jars. use one string.
+        attributes('Application-Class': '${project_package}.${project_class_name}', 'com/sun/star/lib/loader/Loader.class')
+    }
+    
+    dependsOn 'copyLibs'
+}
+
+// executes 'java -jar 
+task runJar(dependsOn:jar) << {
+    javaexec { main="-jar"; args jar.archivePath } 
+}
+
+// make sure we always clean first
+compileJava.dependsOn clean
+

Added: openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/gradle.properties
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/gradle.properties?rev=1722954&view=auto
==============================================================================
    (empty)

Propchange: openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/gradle.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/lazybones.groovy
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/lazybones.groovy?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/lazybones.groovy (added)
+++ openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/lazybones.groovy Mon Jan  4 19:58:09 2016
@@ -0,0 +1,56 @@
+import uk.co.cacoethes.util.NameType
+import org.apache.commons.io.FileUtils
+
+Map props = [:]
+if (projectDir.name =~ /\-/) {
+    props.project_class_name = transformText(projectDir.name, from: NameType.HYPHENATED, to: NameType.CAMEL_CASE)
+} else {
+    props.project_class_name = transformText(projectDir.name, from: NameType.PROPERTY, to: NameType.CAMEL_CASE)
+}
+props.project_name = transformText(props.project_class_name, from: NameType.CAMEL_CASE, to: NameType.HYPHENATED)
+
+props.project_group = ask("Define value for 'group' [org.example]: ", "org.example", "group")
+props.project_name = ask("Define value for 'artifactId' [" + props.project_name + "]: ", props.project_name , "artifactId")
+props.project_version = ask("Define value for 'version' [0.1.0]: ", "0.1.0", "version")
+props.project_package = ask("Define value for 'package' [" + props.project_group + "]: ", props.project_group, "package")
+props.project_class_name = ask("Define value for 'className' [" + props.project_class_name + "]: ", props.project_class_name, "className").capitalize()
+props.project_property_name = transformText(props.project_class_name, from: NameType.CAMEL_CASE, to: NameType.PROPERTY)
+props.project_capitalized_name = props.project_property_name.capitalize()
+String packagePath = props.project_package.replace('.' as char, '/' as char)
+
+// props.buildDir = '$buildDir'
+// props.prefix = '$prefix'
+// props.it = 'it'
+
+processTemplates 'build.gradle', props
+processTemplates 'settings.gradle', props
+processTemplates 'gradle.properties', props
+processTemplates 'src/main/groovy/*.groovy', props
+processTemplates 'src/test/groovy/*.groovy', props
+
+File mainSources = new File(projectDir, 'src/main/groovy')
+File testSources = new File(projectDir, 'src/test/groovy')
+
+File mainSourcesPath = new File(mainSources, packagePath)
+mainSourcesPath.mkdirs()
+File testSourcesPath = new File(testSources, packagePath)
+testSourcesPath.mkdirs()
+
+def renameFile = { File from, String path ->
+    if (from.file) {
+        File to = new File(path)
+        to.parentFile.mkdirs()
+        FileUtils.moveFile(from, to)
+    }
+}
+
+mainSources.eachFile { File file ->
+    renameFile(file, mainSourcesPath.absolutePath + '/' + file.name)
+}
+testSources.eachFile { File file ->
+    renameFile(file, testSourcesPath.absolutePath + '/' + props.project_capitalized_name + file.name)
+}
+
+renameFile(new File(mainSourcesPath, 'GroovyUnoClient.groovy'), mainSourcesPath.absolutePath + '/' + props.project_class_name + ".groovy")
+
+

Added: openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/GroovyUnoClient.groovy
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/GroovyUnoClient.groovy?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/GroovyUnoClient.groovy (added)
+++ openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/GroovyUnoClient.groovy Mon Jan  4 19:58:09 2016
@@ -0,0 +1,149 @@
+/*
+ * ************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ ************************************************************
+ */
+/*
+ * ${project_class_name}.groovy
+ *
+ * Created on 2015.12.05 - 08:01:43
+ *
+ */
+package ${project_package}
+
+import com.sun.star.beans.PropertyValue as PV
+import com.sun.star.beans.XPropertySet
+import com.sun.star.uno.XComponentContext
+import com.sun.star.comp.helper.Bootstrap
+import com.sun.star.container.XEnumeration
+import com.sun.star.container.XEnumerationAccess
+import com.sun.star.frame.XComponentLoader
+import com.sun.star.frame.XController
+import com.sun.star.frame.XModel
+import com.sun.star.lang.XComponent
+import com.sun.star.lang.XMultiComponentFactory
+import com.sun.star.sheet.CellFlags
+import com.sun.star.sheet.XCellAddressable
+import com.sun.star.sheet.XCellRangesQuery
+import com.sun.star.sheet.XSheetCellRangeContainer
+import com.sun.star.sheet.XSheetCellRanges
+import com.sun.star.sheet.XSpreadsheet
+import com.sun.star.sheet.XSpreadsheetDocument
+import com.sun.star.sheet.XSpreadsheetView
+import com.sun.star.sheet.XSpreadsheets
+import com.sun.star.table.XCell
+import com.sun.star.uno.UnoRuntime
+
+import org.openoffice.guno.SpreadsheetDocHelper
+
+/**
+ *
+ * @author Carl Marcum
+ */
+class ${project_class_name} {
+
+    /**
+     * Creates a new instance of GroovyUnoClient
+     */
+    public ${project_class_name}() {
+    }
+
+    /**
+     * @param args the command line arguments
+     */
+    static void main(String[] args) {
+        try {
+
+            SpreadsheetDocHelper sdHelper = new SpreadsheetDocHelper()
+
+            XSpreadsheetDocument xSpreadsheetDocument = sdHelper.getDocument()
+
+            XSpreadsheets xSpreadsheets = xSpreadsheetDocument.getSheets()
+            xSpreadsheets.insertNewByName("MySheet", (short)0)
+            
+            com.sun.star.uno.Type elemType = xSpreadsheets.getElementType()
+            println(elemType.getTypeName())
+
+            XSpreadsheet xSpreadsheet = xSpreadsheetDocument.getSheetByName("MySheet")
+ 
+            XCell xCell = xSpreadsheet.getCellByPosition(0, 0)
+            xCell.value = 21
+            xCell = xSpreadsheet.getCellByPosition(0, 1)
+            xCell.value = 21
+            xCell = xSpreadsheet.getCellByPosition(0, 2)
+            
+            // looks like property access but calls setFormula
+            xCell.formula = "=sum(A1:A2)"
+
+            // looks like property access but calls setCellStyle
+            xCell.cellStyle = "Result"
+            
+            // example for use of enum types
+            xCell.vertJustify = com.sun.star.table.CellVertJustify.TOP
+            // xCell.vertJustify = 1 // also works
+
+            XSpreadsheetView xSpreadsheetView = sdHelper.getSpreadsheetView()
+
+            xSpreadsheetView.setActiveSheet(xSpreadsheet)
+
+            // *********************************************************
+            // example for getting cell ranges
+            XSheetCellRanges formulaCells = xSpreadsheet.getCellRanges(CellFlags.FORMULA)
+            
+            // example for using a closure to iterate through list of cells
+            XCell[] cellList = formulaCells.cellList
+            cellList.each() {println("Formula cell in column " + it.address.Column  + 
+                ", row " + it.address.Row + " contains " + it.formula)
+            }
+
+            // Create a new cell range container
+            XSheetCellRangeContainer xRangeCont = xSpreadsheetDocument.rangeContainer
+         
+            // query addresses of all cells containing anything
+            XSheetCellRanges xCellRanges = xSpreadsheet.getCellRanges(1023)
+            
+            println("Cells containing anything: " + xCellRanges.rangeAddressesAsString)
+            
+            // add xCellRanges to xRangeCont
+            xRangeCont.addRangeAddresses(xCellRanges.rangeAddresses, false)
+
+            // Get the list of cells from a range container and 
+            // use a closure to iterate through the list
+            XCell[] cellList2 = xRangeCont.cellList
+            print("All filled cells: ")
+            cellList2.each() {println("Formula cell in column " + it.address.Column  + 
+                ", row " + it.address.Row + " contains " + it.formula)
+            }
+
+
+        }
+        catch (Exception e){
+            e.printStackTrace()
+        }
+        finally {
+            System.exit( 0 )
+        }
+    }
+    
+
+    
+
+
+}

Added: openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/org/openoffice/guno/SpreadsheetDocHelper.groovy
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/org/openoffice/guno/SpreadsheetDocHelper.groovy?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/org/openoffice/guno/SpreadsheetDocHelper.groovy (added)
+++ openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/groovy/org/openoffice/guno/SpreadsheetDocHelper.groovy Mon Jan  4 19:58:09 2016
@@ -0,0 +1,436 @@
+/*
+ * *************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+// based on SpreadsheetDocHelper.java provide with SDK examples
+// added getModel
+
+package org.openoffice.guno
+
+import com.sun.star.comp.servicemanager.ServiceManager
+import com.sun.star.container.XIndexAccess
+import com.sun.star.container.XNamed
+import com.sun.star.beans.XPropertySet
+import com.sun.star.bridge.XUnoUrlResolver
+import com.sun.star.uno.XNamingService
+import com.sun.star.frame.XDesktop
+import com.sun.star.frame.XModel
+import com.sun.star.frame.XComponentLoader
+import com.sun.star.frame.XController
+import com.sun.star.lang.XMultiServiceFactory
+import com.sun.star.sheet.XCellAddressable
+import com.sun.star.sheet.XCellRangeAddressable
+import com.sun.star.sheet.XSheetCellRange
+import com.sun.star.sheet.XSpreadsheet
+import com.sun.star.sheet.XSpreadsheetDocument
+import com.sun.star.sheet.XSpreadsheetView
+import com.sun.star.sheet.XSpreadsheets
+import com.sun.star.table.BorderLine
+import com.sun.star.table.CellAddress
+import com.sun.star.table.CellRangeAddress
+import com.sun.star.table.TableBorder
+import com.sun.star.table.XCell
+import com.sun.star.table.XCellRange
+import com.sun.star.lang.XComponent
+import com.sun.star.lang.XMultiComponentFactory
+
+import com.sun.star.uno.UnoRuntime
+import com.sun.star.uno.XComponentContext
+import com.sun.star.uno.RuntimeException
+
+
+/** This is a helper class for the spreadsheet and table samples.
+It connects to a running office and creates a spreadsheet document.
+Additionally it contains various helper functions.
+ */
+class SpreadsheetDocHelper {
+
+    private final String  msDataSheetName  = "Data"
+
+    private XComponentContext  mxRemoteContext
+    private XMultiComponentFactory  mxRemoteServiceManager
+    //    private com.sun.star.lang.XMultiServiceFactory  mxMSFactory
+    private XSpreadsheetDocument mxDocument
+    
+    //added
+    XComponent xComponent
+
+
+
+    SpreadsheetDocHelper( String[] args ) {
+        
+        // Connect to a running office and get the service manager
+        connect()
+
+        // Create a new spreadsheet document
+        try
+        {
+            mxDocument = initDocument()
+        }
+        catch (Exception ex)
+        {
+            System.err.println( "Couldn't create document: " + ex )
+            System.err.println( "Error: Couldn't create Document\nException Message = "
+                + ex.getMessage())
+            ex.printStackTrace()
+            System.exit( 1 )
+        }
+    }
+
+    // __  helper methods  ____________________________________________
+
+    /** Returns the service manager of the connected office.
+    @return  XMultiComponentFactory interface of the service manager. */
+    XMultiComponentFactory getServiceManager() {
+        return mxRemoteServiceManager
+    }
+
+    /** Returns the component context of the connected office
+    @return  XComponentContext interface of the context. */
+    XComponentContext getContext() {
+        return mxRemoteContext
+    }
+
+    /** Returns the whole spreadsheet document.
+    @return  XSpreadsheetDocument interface of the document. */
+    XSpreadsheetDocument getDocument() {
+        return mxDocument
+    }
+    
+    // added
+    // loads a component specified by an URL into the specified new or existing frame. 
+    /** Returns the component.
+    @return  XComponent interface of the document. */
+    XComponent getComponent() {
+        
+        return xComponent
+    }
+
+    /** Returns the spreadsheet with the specified index (0-based).
+    @param nIndex  The index of the sheet.
+    @return  XSpreadsheet interface of the sheet. */
+    XSpreadsheet getSpreadsheet( int nIndex ) {
+        // Collection of sheets
+        XSpreadsheets xSheets = mxDocument.getSheets()
+        XSpreadsheet xSheet = null
+        try {
+            XIndexAccess xSheetsIA = UnoRuntime.queryInterface(
+                XIndexAccess.class, xSheets )
+            xSheet = UnoRuntime.queryInterface(
+                XSpreadsheet.class, xSheetsIA.getByIndex(nIndex))
+        } catch (Exception ex) {
+            System.err.println( "Error: caught exception in getSpreadsheet()!\nException Message = "
+                + ex.getMessage())
+            ex.printStackTrace()
+        }
+        return xSheet
+    }
+
+    /** Inserts a new empty spreadsheet with the specified name.
+    @param aName  The name of the new sheet.
+    @param nIndex  The insertion index.
+    @return  The XSpreadsheet interface of the new sheet. */
+    XSpreadsheet insertSpreadsheet(
+        String aName, short nIndex ) {
+        // Collection of sheets
+        XSpreadsheets xSheets = mxDocument.getSheets()
+        XSpreadsheet xSheet = null
+        try {
+            xSheets.insertNewByName( aName, nIndex )
+            xSheet = UnoRuntime.queryInterface(XSpreadsheet.class,
+                xSheets.getByName( aName ))
+        } catch (Exception ex) {
+            System.err.println( "Error: caught exception in insertSpreadsheet()!\nException Message = "
+                + ex.getMessage())
+            ex.printStackTrace()
+        }
+        return xSheet
+    }
+
+    XModel getModel() {
+        
+        XModel xModel = null
+        // println xComponent
+        try {
+            xModel = UnoRuntime.queryInterface(XModel.class, xComponent)
+            
+        } catch(Exception e){            
+            System.err.println(" Exception " + e)
+            e.printStackTrace(System.err)
+        }        
+            
+        return xModel
+    }
+    
+    XSpreadsheetView getSpreadsheetView() {
+        XController xSpreadsheetController = this.getModel().getCurrentController()
+        XSpreadsheetView xSpreadsheetView = UnoRuntime.queryInterface(XSpreadsheetView.class,
+            xSpreadsheetController)
+        return xSpreadsheetView
+    }
+    
+    
+    // ________________________________________________________________
+    // Methods to fill values into cells.
+
+    /** Writes a double value into a spreadsheet.
+    @param xSheet  The XSpreadsheet interface of the spreadsheet.
+    @param aCellName  The address of the cell (or a named range).
+    @param fValue  The value to write into the cell. */
+    void setValue(
+        XSpreadsheet xSheet, String aCellName,
+        double fValue ) throws RuntimeException, Exception {
+        xSheet.getCellRangeByName( aCellName ).getCellByPosition( 0, 0 ).setValue( fValue )
+    }
+
+    /** Writes a formula into a spreadsheet.
+    @param xSheet  The XSpreadsheet interface of the spreadsheet.
+    @param aCellName  The address of the cell (or a named range).
+    @param aFormula  The formula to write into the cell. */
+    void setFormula(
+        com.sun.star.sheet.XSpreadsheet xSheet,
+        String aCellName,
+        String aFormula ) throws RuntimeException, Exception {
+        xSheet.getCellRangeByName( aCellName ).getCellByPosition( 0, 0 ).setFormula( aFormula )
+    }
+
+    /** Writes a date with standard date format into a spreadsheet.
+    @param xSheet  The XSpreadsheet interface of the spreadsheet.
+    @param aCellName  The address of the cell (or a named range).
+    @param nDay  The day of the date.
+    @param nMonth  The month of the date.
+    @param nYear  The year of the date. */
+    void setDate(
+        XSpreadsheet xSheet, String aCellName,
+        int nDay, int nMonth, int nYear ) throws RuntimeException, Exception {
+        // Set the date value.
+        com.sun.star.table.XCell xCell = xSheet.getCellRangeByName( aCellName ).getCellByPosition( 0, 0 )
+        String aDateStr = nMonth + "/" + nDay + "/" + nYear
+        xCell.setFormula( aDateStr )
+
+        // Set standard date format.
+        com.sun.star.util.XNumberFormatsSupplier xFormatsSupplier = UnoRuntime.queryInterface(
+            com.sun.star.util.XNumberFormatsSupplier.class, getDocument() )
+        com.sun.star.util.XNumberFormatTypes xFormatTypes = UnoRuntime.queryInterface(
+            com.sun.star.util.XNumberFormatTypes.class, xFormatsSupplier.getNumberFormats() )
+        int nFormat = xFormatTypes.getStandardFormat(
+            com.sun.star.util.NumberFormat.DATE, new com.sun.star.lang.Locale() )
+
+        XPropertySet xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xCell )
+        xPropSet.setPropertyValue( "NumberFormat", new Integer( nFormat ) )
+    }
+
+    /** Draws a colored border around the range and writes the headline in the
+    first cell.
+    @param xSheet  The XSpreadsheet interface of the spreadsheet.
+    @param aRange  The address of the cell range (or a named range).
+    @param aHeadline  The headline text. */
+    void prepareRange(XSpreadsheet xSheet,
+        String aRange, String aHeadline ) throws RuntimeException, Exception {
+        XPropertySet xPropSet = null
+        XCellRange xCellRange = null
+
+        // draw border
+        xCellRange = xSheet.getCellRangeByName( aRange )
+        xPropSet = UnoRuntime.queryInterface(XPropertySet.class, xCellRange )
+        BorderLine aLine = new BorderLine()
+        aLine.Color = 0x99CCFF
+        aLine.InnerLineWidth = aLine.LineDistance = 0
+        aLine.OuterLineWidth = 100
+        TableBorder aBorder = new TableBorder()
+        aBorder.TopLine = aBorder.BottomLine = aBorder.LeftLine = aBorder.RightLine = aLine
+        aBorder.IsTopLineValid = aBorder.IsBottomLineValid = true
+        aBorder.IsLeftLineValid = aBorder.IsRightLineValid = true
+        xPropSet.setPropertyValue( "TableBorder", aBorder )
+
+        // draw headline
+        XCellRangeAddressable xAddr = UnoRuntime.queryInterface(
+            XCellRangeAddressable.class, xCellRange )
+        CellRangeAddress aAddr = xAddr.getRangeAddress();
+
+        xCellRange = xSheet.getCellRangeByPosition(
+            aAddr.StartColumn, aAddr.StartRow, aAddr.EndColumn, aAddr.StartRow )
+        xPropSet = UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, xCellRange )
+        xPropSet.setPropertyValue( "CellBackColor", new Integer( 0x99CCFF ) )
+        // write headline
+        XCell xCell = xCellRange.getCellByPosition( 0, 0 )
+        xCell.setFormula( aHeadline )
+        xPropSet = (com.sun.star.beans.XPropertySet)
+        UnoRuntime.queryInterface(XPropertySet.class, xCell )
+        xPropSet.setPropertyValue( "CharColor", new Integer( 0x003399 ) )
+        xPropSet.setPropertyValue( "CharWeight", new Float( com.sun.star.awt.FontWeight.BOLD ) )
+    }
+    
+    /** Inserts a cell range address into a cell range container and prints a message.
+    @param xContainer The com.sun.star.sheet.XSheetCellRangeContainer interface of the container.
+    @param nSheet Index of sheet of the range.
+    @param nStartCol Index of first column of the range.
+    @param nStartRow Index of first row of the range.
+    @param nEndCol Index of last column of the range.
+    @param nEndRow Index of last row of the range.
+    @param bMerge Determines whether the new range should be merged with the existing ranges.
+     */
+    static void insertRange(
+        com.sun.star.sheet.XSheetCellRangeContainer xContainer,
+        int nSheet, int nStartCol, int nStartRow, int nEndCol, int nEndRow,
+        boolean bMerge) throws RuntimeException, Exception {
+        com.sun.star.table.CellRangeAddress aAddress = new com.sun.star.table.CellRangeAddress();
+        aAddress.Sheet = (short)nSheet;
+        aAddress.StartColumn = nStartCol;
+        aAddress.StartRow = nStartRow;
+        aAddress.EndColumn = nEndCol;
+        aAddress.EndRow = nEndRow;
+        xContainer.addRangeAddress(aAddress, bMerge);
+        System.out.println(
+         "Inserting " + (bMerge ? " with" : "without") + " merge,"
+            + " result list: " + xContainer.getRangeAddressesAsString());
+    }
+
+    // ________________________________________________________________
+    // Methods to create cell addresses and range addresses.
+
+    /** Creates a com.sun.star.table.CellAddress and initializes it
+    with the given range.
+    @param xSheet  The XSpreadsheet interface of the spreadsheet.
+    @param aCell  The address of the cell (or a named cell). */
+    CellAddress createCellAddress(
+        XSpreadsheet xSheet,
+        String aCell ) throws RuntimeException, Exception {
+        XCellAddressable xAddr = UnoRuntime.queryInterface(XCellAddressable.class,
+            xSheet.getCellRangeByName( aCell ).getCellByPosition( 0, 0 ) )
+        return xAddr.getCellAddress()
+    }
+
+    /** Creates a com.sun.star.table.CellRangeAddress and initializes
+    it with the given range.
+    @param xSheet  The XSpreadsheet interface of the spreadsheet.
+    @param aRange  The address of the cell range (or a named range). */
+    CellRangeAddress createCellRangeAddress(
+        XSpreadsheet xSheet, String aRange ) {
+        
+        XCellRangeAddressable xAddr = UnoRuntime.queryInterface(XCellRangeAddressable.class,
+            xSheet.getCellRangeByName( aRange ) )
+        return xAddr.getRangeAddress()
+    }
+
+    // ________________________________________________________________
+    // Methods to convert cell addresses and range addresses to strings.
+
+    /** Returns the text address of the cell.
+    @param nColumn  The column index.
+    @param nRow  The row index.
+    @return  A string containing the cell address. */
+    String getCellAddressString( int nColumn, int nRow ) {
+        String aStr = ""
+        if (nColumn > 25) {
+            aStr += ('A' + nColumn / 26 - 1) // removed char cast
+        } 
+        aStr += ('A' + nColumn % 26)
+        aStr += (nRow + 1)
+        return aStr
+    }
+
+    /** Returns the text address of the cell range.
+    @param aCellRange  The cell range address.
+    @return  A string containing the cell range address. */
+    String getCellRangeAddressString(
+        CellRangeAddress aCellRange ) {
+        return getCellAddressString( aCellRange.StartColumn, aCellRange.StartRow )
+        + ":"
+        + getCellAddressString( aCellRange.EndColumn, aCellRange.EndRow )
+    }
+
+    /** Returns the text address of the cell range.
+    @param xCellRange  The XSheetCellRange interface of the cell range.
+    @param bWithSheet  true = Include sheet name.
+    @return  A string containing the cell range address. */
+    String getCellRangeAddressString(XSheetCellRange xCellRange, boolean bWithSheet ) {
+        String aStr = ""
+        if (bWithSheet) {
+            XSpreadsheet xSheet = xCellRange.getSpreadsheet()
+            XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xSheet )
+            aStr += xNamed.getName() + "."
+        }
+        XCellRangeAddressable xAddr = UnoRuntime.queryInterface(
+            XCellRangeAddressable.class, xCellRange )
+        aStr += getCellRangeAddressString( xAddr.getRangeAddress() )
+        return aStr
+    }
+
+    /** Returns a list of addresses of all cell ranges contained in the collection.
+    @param xRangesIA  The XIndexAccess interface of the collection.
+    @return  A string containing the cell range address list. */
+    String getCellRangeListString(
+        XIndexAccess xRangesIA ) throws RuntimeException, Exception {
+        String aStr = ""
+        int nCount = xRangesIA.getCount()
+        for (int nIndex = 0; nIndex < nCount; ++nIndex) {
+            if (nIndex > 0)
+            aStr += " "
+            Object aRangeObj = xRangesIA.getByIndex( nIndex )
+            XSheetCellRange xCellRange = (XSheetCellRange)
+            UnoRuntime.queryInterface(XSheetCellRange.class, aRangeObj)
+            aStr += getCellRangeAddressString( xCellRange, false )
+        }
+        return aStr
+    }
+
+
+    // Connect to a running office that is accepting connections.
+    private void connect() {
+        if (mxRemoteContext == null && mxRemoteServiceManager == null) {
+            try {
+                // First step: get the remote office component context
+                mxRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap()
+                System.out.println("Connected to a running office ...")
+                    
+                mxRemoteServiceManager = mxRemoteContext.getServiceManager()
+            } catch( Exception e) {
+                System.err.println("ERROR: can't get a component context from a running office ...")
+                e.printStackTrace()
+                System.exit(1)
+            }            
+        }
+    }
+
+    /** Creates an empty spreadsheet document.
+    @return  The XSpreadsheetDocument interface of the document. */
+    private XSpreadsheetDocument initDocument()
+    throws RuntimeException, Exception {
+        XComponentLoader aLoader = UnoRuntime.queryInterface(
+            XComponentLoader.class,
+            mxRemoteServiceManager.createInstanceWithContext(
+                    "com.sun.star.frame.Desktop", mxRemoteContext))
+
+        // changed to use class var xComponent
+        xComponent = aLoader.loadComponentFromURL(
+            "private:factory/scalc", "_default", 0, new com.sun.star.beans.PropertyValue[0] )
+        
+        XSpreadsheetDocument xSpreadsheetDocument = UnoRuntime.queryInterface(
+            XSpreadsheetDocument.class, xComponent )
+
+        return xSpreadsheetDocument
+    }
+
+
+}
+
+

Added: openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/star/lib/loader/InstallationFinder.java
URL: http://svn.apache.org/viewvc/openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/star/lib/loader/InstallationFinder.java?rev=1722954&view=auto
==============================================================================
--- openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/star/lib/loader/InstallationFinder.java (added)
+++ openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/star/lib/loader/InstallationFinder.java Mon Jan  4 19:58:09 2016
@@ -0,0 +1,595 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+
+package com.sun.star.lib.loader;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+/**
+ * This class finds a UNO installation on the system.
+ *
+ * <p>A UNO installation can be specified by the user by either setting the
+ * com.sun.star.lib.loader.unopath system property or by setting the
+ * UNO_PATH environment variable to the program directory of a UNO
+ * installation.
+ * Note, that Java 1.3.1 and Java 1.4 don't support environment variables
+ * (System.getenv() throws java.lang.Error) and therefore setting the UNO_PATH
+ * enviroment variable won't work with those Java versions.
+ * If no UNO installation is specified by the user, the default installation
+ * on the system will be returned.</p>
+ *   
+ * <p>On the Windows platform the default installation is read from the Windows
+ * Registry.</p>
+ *   
+ * <p>On the Unix/Linux platforms the default installation is found from the
+ * PATH environment variable. Note, that for Java 1.3.1 and Java 1.4 the
+ * default installation is found by using the 'which' command, because
+ * environment variables are not supported with those Java versions.
+ * Both methods require that the 'soffice' executable or a symbolic
+ * link is in one of the directories listed in the PATH environment variable.
+ * For older versions than OOo 2.0 the above described methods may fail.
+ * In this case the default installation is taken from the .sversionrc file in
+ * the user's home directory. Note, that the .sversionrc file will be omitted
+ * for OOo 2.0</p>
+ */
+final class InstallationFinder {
+
+    private static final String SYSPROP_NAME =
+        "com.sun.star.lib.loader.unopath";
+    private static final String ENVVAR_NAME = "UNO_PATH";
+    private static final String SOFFICE = "soffice"; // Unix/Linux only
+    
+    private InstallationFinder() {} // do not instantiate
+    
+    /**
+     * Gets the path of a UNO installation.
+     *                                 
+     * @return the installation path or <code>null</code>, if no installation
+     *         was specified or found, or if an error occured     
+     */    
+    public static String getPath() {
+        
+        String path = null;
+        
+        // get the installation path from the Java system property
+        // com.sun.star.lib.loader.unopath
+        // (all platforms)
+        path = getPathFromProperty( SYSPROP_NAME );
+        if ( path == null ) {
+            // get the installation path from the UNO_PATH environment variable
+            // (all platforms, not working for Java 1.3.1 and Java 1.4)
+            path = getPathFromEnvVar( ENVVAR_NAME );
+            if ( path == null ) {
+                String osname = null;
+                try {
+                    osname = System.getProperty( "os.name" );
+                } catch ( SecurityException e ) {
+                    // if a SecurityException was thrown,
+                    // return <code>null</code>
+                    return null;
+                }
+                if ( osname != null ) {
+                    if ( osname.startsWith( "Windows" ) ) {
+                        // get the installation path from the Windows Registry
+                        // (Windows platform only)
+                        path = getPathFromWindowsRegistry();
+                    } else {
+                        // get the installation path from the PATH environment
+                        // variable (Unix/Linux platforms only, not working for
+                        // Java 1.3.1 and Java 1.4)
+                        path = getPathFromPathEnvVar();
+                        if ( path == null ) {
+                            // get the installation path from the 'which'
+                            // command (Unix/Linux platforms only)
+                            path = getPathFromWhich();
+                            if ( path == null ) {                   
+                                // get the installation path from the
+                                // .sversionrc file (Unix/Linux platforms only,
+                                // for older versions than OOo 2.0)
+                                path = getPathFromSVersionFile();
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        
+        return path;
+    }
+    
+    /**
+     * Gets the installation path from a Java system property.
+     *
+     * <p>This method is called on all platforms.
+     * The Java system property can be passed into the application by using
+     * the -D flag, e.g.
+     * java -D<property name>=<installation path> -jar application.jar.</p>
+     *                          
+     * @return the installation path or <code>null</code>, if no installation
+     *         was specified in the Java system property or if an error occured
+     */    
+    private static String getPathFromProperty( String prop ) {
+
+        String path = null;
+        
+        try {
+            path = System.getProperty( prop );
+        } catch ( SecurityException e ) {
+            // if a SecurityException was thrown, return <code>null</code>
+        }
+
+        return path;        
+    }
+
+    /**
+     * Gets the installation path from an environment variable.
+     *   
+     * <p>This method is called on all platforms.
+     * Note, that in Java 1.3.1 and Java 1.4 System.getenv() throws 
+     * java.lang.Error and therefore this method returns null for those 
+     * Java versions.</p>
+     *
+     * @return the installation path or <code>null</code>, if no installation
+     *         was specified in the environment variable or if an error occured
+     */
+    private static String getPathFromEnvVar( String var ) {        
+
+        String path = null;
+        
+        try {
+            path = System.getenv( var );            
+        } catch ( SecurityException e ) {
+            // if a SecurityException was thrown, return <code>null</code>
+        } catch ( java.lang.Error err ) {
+            // System.getenv() throws java.lang.Error in Java 1.3.1 and 
+            // Java 1.4
+        }
+        
+        return path;
+    }
+    
+    /**
+     * Gets the installation path from the Windows Registry.
+     *
+     * <p>This method is called on the Windows platform only.</p>
+     *   
+     * @return the installation path or <code>null</code>, if no installation
+     *         was found or if an error occured     
+     */    
+    private static String getPathFromWindowsRegistry() {
+
+        final String SUBKEYNAME = "Software\\OpenOffice\\UNO\\InstallPath";
+        final String SUBKEYNAME64 = "Software\\Wow6432Node\\OpenOffice\\UNO\\InstallPath";
+
+        String path = null;
+        
+        try {
+            // read the key's default value from HKEY_CURRENT_USER
+            WinRegKey key = new WinRegKey( "HKEY_CURRENT_USER", SUBKEYNAME );
+            path = key.getStringValue( "" ); // default            
+        } catch ( WinRegKeyException e ) {
+            try {
+                // read the key's default value from HKEY_LOCAL_MACHINE
+                WinRegKey key = new WinRegKey( "HKEY_LOCAL_USER",
+                                               SUBKEYNAME64 );
+                path = key.getStringValue( "" ); // default                
+            } catch ( WinRegKeyException e64 ) {
+                try {
+                    // read the key's default value from HKEY_LOCAL_MACHINE
+                    WinRegKey key = new WinRegKey( "HKEY_LOCAL_MACHINE",
+                                                   SUBKEYNAME );
+                    path = key.getStringValue( "" ); // default                
+                } catch ( WinRegKeyException we ) {
+                    try {
+                        // read the key's default value from HKEY_LOCAL_MACHINE
+                        WinRegKey key = new WinRegKey( "HKEY_LOCAL_MACHINE",
+                                                       SUBKEYNAME64 );
+                        path = key.getStringValue( "" ); // default                
+                    } catch ( WinRegKeyException we64 ) {
+                        System.err.println( "com.sun.star.lib.loader." +
+                                            "InstallationFinder::getPathFromWindowsRegistry: " +
+                                            "reading key from Windows Registry failed: " + we64 );
+                    } 
+                } 
+            }
+        }
+        
+        return path;        
+    }
+
+    /**
+     * Gets the installation path from the PATH environment variable.
+     *
+     * <p>This method is called on Unix/Linux platforms only.
+     * An installation is found, if the executable 'soffice' or a symbolic link
+     * is in one of the directories listed in the PATH environment variable.
+     * Note, that in Java 1.3.1 and Java 1.4 System.getenv() throws
+     * java.lang.Error and therefore this method returns null for those
+     * Java versions.</p>
+     *
+     * @return the installation path or <code>null</code>, if no installation
+     *         was found or if an error occured
+     */
+    private static String getPathFromPathEnvVar() {
+
+        final String PATH_ENVVAR_NAME = "PATH";
+        
+        String path = null;
+        String str = null;
+        
+        try {
+            str = System.getenv( PATH_ENVVAR_NAME );
+        } catch ( SecurityException e ) {
+            // if a SecurityException was thrown, return <code>null</code>
+            return null;
+        } catch ( java.lang.Error err ) {
+            // System.getenv() throws java.lang.Error in Java 1.3.1 and 
+            // Java 1.4
+            return null;
+        }
+
+        if ( str != null ) {
+            StringTokenizer tokens = new StringTokenizer(
+                str, File.pathSeparator );
+            while ( tokens.hasMoreTokens() ) {
+                File file = new File( tokens.nextToken(), SOFFICE );
+                try {
+                    if ( file.exists() ) {
+                        try {                   
+                            // resolve symlink
+                            path = file.getCanonicalFile().getParent();
+                            if ( path != null )
+                                break;
+                        } catch ( IOException e ) {
+                            // if an I/O exception is thrown, ignore this
+                            // path entry and try the next one
+                            System.err.println( "com.sun.star.lib.loader." +
+                                "InstallationFinder::getPathFromEnvVar: " +
+                                "bad path: " + e );
+                        }  
+                    }
+                } catch ( SecurityException e ) {
+                    // if a SecurityException was thrown, ignore this path
+                    // entry and try the next one
+                }
+            }
+        }
+        
+        return path;
+    }
+    
+    /**
+     * Gets the installation path from the 'which' command on Unix/Linux
+     * platforms.
+     *
+     * <p>This method is called on Unix/Linux platforms only.
+     * An installation is found, if the executable 'soffice' or a symbolic link
+     * is in one of the directories listed in the PATH environment variable.</p>
+     *   
+     * @return the installation path or <code>null</code>, if no installation
+     *         was found or if an error occured
+     */    
+    private static String getPathFromWhich() {
+
+        final String WHICH = "which";
+        
+        String path = null;
+        
+        // start the which process
+        String[] cmdArray = new String[2];
+        cmdArray[0] = WHICH;
+        cmdArray[1] = SOFFICE;
+        Process proc = null;
+        Runtime rt = Runtime.getRuntime();
+        try {
+            proc = rt.exec( cmdArray );
+        } catch ( SecurityException e ) {
+            return null;
+        } catch ( IOException e ) {
+            // if an I/O exception is thrown, return <code>null</null>
+            System.err.println( "com.sun.star.lib.loader." +
+                "InstallationFinder::getPathFromWhich: " +
+                "which command failed: " + e );
+            return null;
+        }
+            
+        // empty standard error stream in a seperate thread
+        StreamGobbler gobbler = new StreamGobbler( proc.getErrorStream() );
+        gobbler.start();
+            
+        // read the which output from standard input stream
+        BufferedReader br = new BufferedReader(
+            new InputStreamReader( proc.getInputStream() ) );
+        String line = null;        
+        try {
+            while ( ( line = br.readLine() ) != null ) {
+                if ( path == null ) {
+                    // get the path from the which output
+                    int index = line.lastIndexOf( SOFFICE );
+                    if ( index != -1 ) {
+                        int end = index + SOFFICE.length();
+                        for ( int i = 0; i <= index; i++ ) {
+                            File file = new File( line.substring( i, end ) );
+                            try {
+                                if ( file.exists() ) {
+                                    // resolve symlink
+                                    path = file.getCanonicalFile().getParent();
+                                    if ( path != null )
+                                        break;
+                                }
+                            } catch ( SecurityException e ) {
+                                return null;
+                            }
+                        }
+                    }
+                }
+            }
+        } catch ( IOException e ) {
+            // if an I/O exception is thrown, return <code>null</null>
+            System.err.println( "com.sun.star.lib.loader." +
+                                "InstallationFinder::getPathFromWhich: " +
+                                "reading which command output failed: " + e );
+            return null;
+        } finally {
+            if ( br != null ) {
+                try {                            
+                    br.close();
+                } catch ( IOException e ) {
+                    // closing standard input stream failed, ignore
+                }   
+            }
+        }        
+            
+        try {
+            // wait until the which process has terminated
+            proc.waitFor();
+        } catch ( InterruptedException e ) {
+            // the current thread was interrupted by another thread,
+            // kill the which process
+            proc.destroy();            
+            // set the interrupted status
+            Thread.currentThread().interrupt();                
+        }
+            
+        return path;
+    }
+    
+    /**
+     * Gets the installation path from the .sverionrc file in the user's home
+     * directory.
+     *
+     * <p>This method is called on Unix/Linux platforms only.
+     * The .sversionrc file is written during setup and will be omitted for
+     * OOo 2.0.</p>
+     *
+     * @return the installation path or <code>null</code>, if no installation
+     *         was found or if an error occured     
+     */
+    private static String getPathFromSVersionFile() {
+
+        final String SVERSION = ".sversionrc"; // Unix/Linux only
+        final String VERSIONS = "[Versions]";
+        
+        String path = null;
+        
+        try {        
+            File fSVersion = new File(
+                System.getProperty( "user.home" ) ,SVERSION );
+            if ( fSVersion.exists() ) {
+                Vector lines = new Vector();
+                BufferedReader br = null;
+                try {
+                    br = new BufferedReader( new InputStreamReader(
+                        new FileInputStream( fSVersion ), "UTF-8" ) );
+                    String line = null;                
+                    while ( ( line = br.readLine() ) != null &&
+                            ( line.equals( VERSIONS ) ) != true ) {
+                        // read lines until [Versions] is found
+                    }
+                    while ( ( line = br.readLine() ) != null &&
+                            line.length() != 0 ) {
+                        if ( !line.startsWith( ";" ) )
+                            lines.add( line );
+                    }
+                } catch ( IOException e ) {
+                    // if an I/O exception is thrown, try to analyze the lines
+                    // read so far
+                    System.err.println( "com.sun.star.lib.loader." +
+                        "InstallationFinder::getPathFromSVersionFile: " +
+                        "reading .sversionrc file failed: " + e );
+                } finally {
+                    if ( br != null ) {
+                        try {                            
+                            br.close();
+                        } catch ( IOException e ) {
+                            // closing .sversionrc failed, ignore
+                        }   
+                    }
+                }            
+                for ( int i = lines.size() - 1; i >= 0; i-- ) {
+                    StringTokenizer tokens = new StringTokenizer(
+                        (String)lines.elementAt( i ), "=" );
+                    if ( tokens.countTokens() != 2 )
+                        continue;                
+                    String key = tokens.nextToken();
+                    String url = tokens.nextToken();
+                    path = getCanonicalPathFromFileURL( url );                
+                    if ( path != null )
+                        break;                
+                }            
+            }            
+        } catch ( SecurityException e ) {
+            return null;
+        }        
+        
+        return path;
+    }
+    
+    /**
+     * Translates an OOo-internal absolute file URL reference (encoded using
+     * UTF-8) into a Java canonical pathname.
+     *
+     * @param oooUrl any URL reference; any fragment part is ignored
+     *
+     * @return if the given URL is a valid absolute, local (that is, the host
+     * part is empty or equal to "localhost", ignoring case) file URL, it is
+     * converted into an absolute canonical pathname; otherwise,
+     * <code>null</code> is returned
+     */
+    private static String getCanonicalPathFromFileURL( String oooUrl ) {
+        
+        String prefix = "file://";
+        if (oooUrl.length() < prefix.length()
+            || !oooUrl.substring(0, prefix.length()).toLowerCase().equals(
+                prefix))
+        {
+            return null;
+        }        
+        StringBuffer buf = new StringBuffer(prefix);
+        int n = oooUrl.indexOf('/', prefix.length());
+        if (n < 0) {
+            n = oooUrl.length();
+        }
+        String host = oooUrl.substring(prefix.length(), n);
+        if (host.length() != 0 && !host.toLowerCase().equals("localhost")) {
+            return null;
+        }
+        buf.append(host);
+        if (n == oooUrl.length()) {
+            buf.append('/');
+        } else {
+        loop:
+            while (n < oooUrl.length()) {
+                buf.append('/');
+                ++n;
+                int n2 = oooUrl.indexOf('/', n);
+                if (n2 < 0) {
+                    n2 = oooUrl.length();
+                }
+                while (n < n2) {
+                    char c = oooUrl.charAt(n);
+                    switch (c) {
+                    case '%':
+                        byte[] bytes = new byte[(n2 - n) / 3];
+                        int len = 0;
+                        while (oooUrl.length() - n > 2
+                               && oooUrl.charAt(n) == '%')
+                        {
+                            int d1 = Character.digit(oooUrl.charAt(n + 1), 16);
+                            int d2 = Character.digit(oooUrl.charAt(n + 2), 16);
+                            if (d1 < 0 || d2 < 0) {
+                                break;
+                            }
+                            int d = 16 * d1 + d2;
+                            if (d == '/') {
+                                return null;
+                            }
+                            bytes[len++] = (byte) d;
+                            n += 3;
+                        }
+                        String s;
+                        try {
+                            s = new String(bytes, 0, len, "UTF-8");
+                        } catch (UnsupportedEncodingException e) {
+                            return null;
+                        }
+                        buf.append(s);
+                        break;
+
+                    case '#':
+                        break loop;
+
+                    default:
+                        buf.append(c);
+                        ++n;
+                        break;
+                    }
+                }
+            }
+        }
+        URL url;
+        try {
+            url = new URL(buf.toString());
+        } catch (MalformedURLException e) {
+            return null;
+        }
+        String path = url.getFile();
+        String fragment = url.getRef();
+        if (fragment != null) {
+            path += '#' + fragment;
+        }
+        String ret = null;
+        File file = new File( path, SOFFICE );
+        try {
+            if ( file.isAbsolute() && file.exists() ) {
+                try {
+                    // resolve symlink
+                    ret = file.getCanonicalFile().getParent();
+                } catch ( IOException e ) {
+                    return null;
+                }     
+            }
+        } catch ( SecurityException e ) {
+            return null;
+        }
+        
+        return ret;
+    }
+
+    /**
+       This class is used for emptying any stream which is passed into it in
+       a separate thread.
+     */
+    private static final class StreamGobbler extends Thread {
+
+        InputStream m_istream;
+
+        StreamGobbler( InputStream istream ) {
+            m_istream = istream;
+        }
+
+        public void run() {
+            try {
+                BufferedReader br = new BufferedReader(
+                    new InputStreamReader( m_istream ) );
+                // read from input stream
+                while ( br.readLine() != null ) {
+                    // don't handle line content
+                }
+                br.close();
+            } catch ( IOException e ) {
+                // stop reading from input stream
+            }
+        }
+    }
+}

Propchange: openoffice/devtools/lazybones-templates/trunk/templates/aoo-client/src/main/java/com/sun/star/lib/loader/InstallationFinder.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message