You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2012/01/27 02:29:58 UTC

svn commit: r1236486 [4/43] - in /incubator/ooo/devtools/netbeansintegration: ./ build/ build/public-package-jars/ javahelp/ javahelp/org/ javahelp/org/openoffice/ javahelp/org/openoffice/extensions/ javahelp/org/openoffice/extensions/docs/ javahelp/or...

Added: incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/build-uno-impl.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/build-uno-impl.xml?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/build-uno-impl.xml (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/build-uno-impl.xml Fri Jan 27 01:29:33 2012
@@ -0,0 +1,462 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+***   AUTOMATICALLY GENERATED - DO NOT EDIT   ***
+***         EDIT ../build.xml INSTEAD         ***
+-->
+<project name="__ProjectName__uno-impl" default="netbeans" basedir="..">
+    <description>Builds, tests, and runs an UNO project.</description>
+
+    <import file="build-impl.xml"/>
+
+    <!-- ================================================================================== -->
+
+    <target name="-uno-project-init" depends="-do-init">
+        <property file="nbproject/project-uno.properties"/>
+        <property name="build.uno.version" value="__BuildUnoVersion__"/>
+      
+        <!-- set variablers from SDK and Office -->
+        <echo message="setting up UNO environment ..."/>
+        <property name="office.unopkg" value="${office.program.dir}${file.separator}unopkg"/>
+        <property name="office.soffice" value="${office.program.dir}${file.separator}soffice"/>
+        
+        <property name="sdk.idl.dir" location="${oo.sdk.dir}${file.separator}idl"/> 
+        <property name="sdk.idlc" value="${sdk.bin.dir}${file.separator}idlc"/>
+        <property name="sdk.regmerge" value="${ure.bin.dir}${file.separator}regmerge"/>
+        <property name="sdk.javamaker" value="${sdk.bin.dir}${file.separator}javamaker"/>
+
+        <dirname property="project.dir" file="build.xml"/>       
+        <property name="uno.package.name" value="${project.dir}${file.separator}${dist.dir}${file.separator}${project.name}.oxt"/>
+        <property name="src.dir.absolute" value="${project.dir}${file.separator}${src.dir}"/>
+
+        <property name="idl.out" value="${project.dir}${file.separator}${build.dir}${file.separator}idl"/>
+        <property name="idl.classes.dir" value="${project.dir}${file.separator}${build.classes.dir}"/>
+        <property name="idl.out.urd" value="${idl.out}/urd"/>
+        <property name="idl.out.rdb" value="${idl.out}/rdb"/>
+        <property name="idl.rdb.name" value="types.rdb"/>
+        <property name="idl.rdb.fullpath" value="${idl.out.rdb}/${idl.rdb.name}"/>
+        
+        <property name="images.base.dir" value="${build.dir}/img"/>
+        <property name="build.registry.dir" value="${build.dir}/cpreg"/>
+        
+        <mkdir dir="${idl.out}"/>
+        <mkdir dir="${idl.out.urd}"/>
+        <mkdir dir="${idl.out.rdb}"/>
+        <mkdir dir="${images.base.dir}"/>
+        <mkdir dir="${build.registry.dir}"/>
+
+        <condition property="oo.version.three">
+            <equals arg1="${oo.version.number}" arg2="three"/>
+        </condition>
+    </target>
+
+    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+    <!-- handle images -->
+    <target name="-uno-images-condition" description="check images" depends="-uno-project-init">
+        <available file="${images.dir}" type="dir" property="images.required"/>
+    </target>    
+    
+    <target name="images" description="copy images" depends="-uno-images-condition" if="images.required">
+        <mkdir dir="${images.base.dir}/${images.dir}"/>
+        <copy todir="${images.base.dir}/${images.dir}">
+            <fileset dir="${images.dir}"/>
+        </copy>
+    </target>    
+    
+    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+    <!-- handle xcu/xcs files with package names -->
+    
+    <target name="-uno-registryfiles-condition" description="check xcu and xcs files" depends="-uno-project-init">
+        <available file="${registry.dir}" type="dir" property="xcuxcs.required"/>
+    </target>    
+    
+    <target name="registry" description="copy registry files" depends="-uno-registryfiles-condition" if="xcuxcs.required">
+        <mkdir dir="${build.registry.dir}/${registry.dir}"/>
+        <copy todir="${build.registry.dir}/${registry.dir}">
+            <fileset dir="${registry.dir}" includes="**/*.xcu,**/*.xcs"/>
+        </copy>
+    </target>    
+    
+    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+    
+    <target name="-uno-idl-idlc-condition" description="check idlc dependencies" depends="-uno-project-init">
+        <uptodate property="idlc.notRequired" targetfile ="${build.dir}/idlc.compile">
+           <srcfiles dir= "${src.dir}" includes="**/*.idl"/>
+        </uptodate>
+    </target>    
+   
+    <!-- compile UNO idl files: execution -->
+    <target name="-uno-idl-idlc" description="Compile the IDL Conditionally" depends="-uno-idl-idlc-condition" unless="idlc.notRequired">
+        <apply executable="${sdk.idlc}" dir="${office.program.dir}" failonerror="true">
+            <env key="PATH" path="${office.tool.path}"/>
+            <env key="LD_LIBRARY_PATH" path="${office.tool.path}"/> 
+            <env key="DYLD_LIBRARY_PATH" path="${office.tool.path}"/>
+            <arg value="-C"/>
+            <arg value="-O"/>
+            <arg value="${idl.out.urd}"/>
+            <arg value="-I"/>
+            <arg value="${src.dir.absolute}"/>
+            <arg value="-I"/> 
+            <arg value="${sdk.idl.dir}"/> 
+            <fileset dir="${src.dir}" includes="**/*.idl" casesensitive="yes" id="idl.list.id"/>
+        </apply>
+        <!-- list for copying idl files in own jar -->
+        <property name="idl.file" refid="idl.list.id"/>
+        <propertyfile file="${idl.out}/idl_list.properties">
+            <entry key="idl.file.list" value="${idl.file}"/>
+        </propertyfile>
+        <replace file="${idl.out}/idl_list.properties" token=".idl" value=".class"/>
+        <replace file="${idl.out}/idl_list.properties" token=";" value=","/>
+    </target>
+
+    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+
+    <!-- merge urd files: execution -->
+    <target name="-uno-idl-regmerge" description="Merge urd Files Conditionally" depends="-uno-idl-idlc,-uno-idl-idlc-condition" unless="idlc.notRequired">
+        <!-- to only extract the new files, delete the old rdb -->
+        <delete file="${idl.rdb.fullpath}"/>        
+        <apply executable="${sdk.regmerge}" dir="${office.program.dir}" failonerror="true">
+            <env key="PATH" path="${office.tool.path}"/>
+            <env key="LD_LIBRARY_PATH" path="${office.tool.path}"/>
+            <env key="DYLD_LIBRARY_PATH" path="${office.tool.path}"/> 
+            <arg file="${idl.rdb.fullpath}"/>
+            <arg value="/UCR"/>
+            <fileset dir="${idl.out.urd}" includes="**/*.urd" casesensitive="yes"/>
+        </apply>
+    </target>
+
+    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+
+    <!-- should javamaker be executed -->
+    <target name="-uno-idl-javamaker-condition" description="check if rdb was created" depends="-uno-idl-regmerge,-uno-idl-idlc-condition">
+        <available file="${idl.rdb.name}" filepath="${idl.out.rdb}" property="javamaker.Required"/>
+    </target>
+    
+    <!-- generate Java class files from type library: execution -->
+    <target name="-uno-idl-javamaker" depends="-uno-idl-regmerge,-uno-idl-idlc-condition,-uno-idl-javamaker-condition" if="javamaker.Required" unless="idlc.notRequired">
+        <echo message="generating java class files from rdb..."/>
+        <exec executable="${sdk.javamaker}" dir="${office.program.dir}" failonerror="true">
+            <env key="PATH" path="${office.tool.path}"/>                
+            <env key="LD_LIBRARY_PATH" path="${office.tool.path}"/>
+            <env key="DYLD_LIBRARY_PATH" path="${office.tool.path}"/> 
+            <arg value="-BUCR"/>
+            <arg value="-O"/>
+            <arg value="${idl.classes.dir}"/>
+            <arg file="${idl.rdb.fullpath}"/>
+            <arg value="${oo.unotypes.rdb}"/> <!-- from ConfigurationSettings -->
+            <arg value="${oo.offapi.rdb}"/> <!-- from ConfigurationSettings -->
+        </exec>
+    </target>
+
+    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+
+    <target name="-uno-idl-result" depends="-uno-idl-javamaker">
+        <touch file="${build.dir}/idlc.compile"/>
+        <echo message="build UNO idl files finished"/>
+    </target>
+ 
+    <!-- the main target, called in recursive builds -->
+    <target name="uno-idl-compile" description="Compiles UNO idl files" depends="-uno-idl-result"/>
+
+    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->    
+
+    <target name="jar" depends="-uno-project-init,uno-idl-compile,-jar-idl-types,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-do-openoffice-manifest,-post-jar">
+        <jar basedir="${build.classes.dir}" compress="true" filesonly="true" manifest="${build.dir}/MANIFEST.MF" jarfile="${dist.jar}" excludes="**/*.xml,**/*.txt,${idl.file.list},${build.classes.excludes}"/>
+    </target>
+
+    <target name="-jar-idl-types" depends="-do-uno-types" unless="no.idl.files">
+        <mkdir dir="${dist.dir}"/>
+        <jar basedir="${build.classes.dir}" compress="true" jarfile="${dist.dir}/${idl_types.jar}" includes="${idl.file.list}">
+            <manifest>
+                <attribute name="UNO-Type-Path" value="&lt;&gt;"/>
+            </manifest>
+        </jar>
+    </target>
+
+    <target name="-do-openoffice-manifest" depends="-copy-user-manifest,-external-jars,-do-registration,-do-class-path"/>
+    
+    <!-- macro for checking manifest entries from a user manifest -->
+    <macrodef name="check-manifest-entry">
+        <attribute name="entry.name"/>
+        <attribute name="condition.property.name"/>
+        <sequential>
+            <condition property="@{condition.property.name}">
+                <and>
+                    <!-- if file does not exist, "isfileselected" is not executed -->
+                    <!-- necessary construct because available is not allowed here 
+                        but should be according to documentation -->
+                    <istrue value="${build.manifest.exists}"/>
+                    <!-- produces an error if file is not there -->
+                    <isfileselected file="${build.dir}/MANIFEST.MF">
+                        <contains text="@{entry.name}"/>
+                    </isfileselected>
+                </and>
+            </condition>
+        </sequential>
+    </macrodef>
+    
+    <!-- enter the class path with external jars, if external jars exit and the user did not enter his own -->
+    <target name="-do-class-path" depends="-external-jars,-check-class-path" unless="class.path.exists">
+        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
+            <attribute name="Class-Path" value="${external.jars}"/> 
+        </manifest>            
+    </target>
+    <target name="-check-class-path">
+        <check-manifest-entry condition.property.name="class.path.exists" entry.name="Class-Path"/>
+    </target>
+    
+    <!-- enter idl type definitions if it exists and if the user did not overwrite it -->
+    <target name="-do-uno-types" depends="-do-empty-unopath,-do-idl-unopath"/>
+    <target name="-do-idl-unopath" depends="-check-uno-types" if="own.idl.files" unless="uno.path.exists">
+        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
+            <attribute name="UNO-Type-Path" value="${idl_types.jar}"/> 
+        </manifest>            
+    </target>
+    <target name="-do-empty-unopath" depends="-check-uno-types" if="no.idl.files" unless="uno.path.exists">
+        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
+            <attribute name="UNO-Type-Path" value=""/> 
+        </manifest>            
+    </target>
+    <target name="-check-uno-types">
+        <property file="${idl.out}/idl_list.properties"/>
+        <check-manifest-entry condition.property.name="uno.path.exists" entry.name="UNO-Type-Path"/>
+        <condition property="no.idl.files">
+            <equals arg1="${idl.file.list}" arg2="" trim="true"/>
+        </condition>
+        <condition property="own.idl.files">
+            <not>
+                <istrue value="${no.idl.files}"/>
+            </not>
+        </condition>
+    </target>
+    
+    <!-- enter the registration classes unless the user did not enter his own. Do nothing when the project is old -->
+    <target name="-do-registration" depends="-do-central-registration,-check-registration-classes-name" 
+                if="new.project.registration" unless="do.no.registration">
+        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
+            <section name="${slash.registration.class}"> 
+                <attribute name="RegistrationClasses" value="${registration.classname}"/>
+            </section>
+        </manifest>
+    </target>
+    <target name="-check-registration-classes-name">
+        <check-manifest-entry condition.property.name="registration.classes.exists" entry.name="RegistrationClasses"/>
+        <condition property="do.no.registration">
+            <or>
+                <istrue value="${registration.classes.exists}"/>
+                <istrue value="${registration.class.exists}"/>
+            </or>
+        </condition>
+    </target>
+    
+    <!-- enter the registration class name unless the user did not enter his own. Do nothing when the project is old -->
+    <target name="-do-central-registration" depends="-check-registration-class-name,-do-old-project-registration" if="new.project.registration" unless="registration.class.exists">
+        <property name="regclass.properties" value="${build.dir}/regclass.properties"/>
+        <propertyfile file="${regclass.properties}">
+            <entry key="dot.registration" value="${slash.registration.class}"/>
+        </propertyfile>
+        <replace file="${regclass.properties}" token=".class" value=""/>
+        <replace file="${regclass.properties}" token="/" value="."/>
+        <property file="${regclass.properties}"/>
+        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
+            <attribute name="RegistrationClassName" value="${dot.registration}"/>
+        </manifest>
+    </target>
+    <target name="-check-registration-class-name">
+        <check-manifest-entry condition.property.name="registration.class.exists" entry.name="RegistrationClassName"/>
+    </target>
+    
+    <!-- Do the registration for older projects without a central registration class -->
+    <target name="-do-old-project-registration" depends="-check-for-old-project" if="old.project.registration" unless="registration.class.exists">
+        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
+            <attribute name="RegistrationClassName" value="${registration.classname}"/>
+        </manifest>
+    </target>
+    <target name="-check-for-old-project">
+        <!-- central registration class in project -->
+        <fileset id="registration.class.name" dir="${build.dir}/classes">
+            <patternset>
+                <include name="**/CentralRegistrationClass.class"/>
+            </patternset>
+        </fileset>
+        <property name="systemslash.registration.class" refid="registration.class.name"/>
+        <!-- make forward slash from backslash on Windows -->
+        <property name="regclass.properties" value="${build.dir}/regclass.properties"/>
+        <propertyfile file="${regclass.properties}">
+            <entry key="slash.registration.class" value="${systemslash.registration.class}"/>
+        </propertyfile>
+        <replace file="${regclass.properties}" token="\\" value="/"/>
+        <property file="${regclass.properties}"/>
+        <!-- now slash is ok -->
+        <condition property="old.project.registration">
+            <equals trim="true" arg1="${slash.registration.class}" arg2=""/>
+        </condition>
+        <condition property="new.project.registration">
+            <isfalse value="${old.project.registration}"/>
+        </condition>
+    </target>
+    
+    <!-- copy the user manifest if it exists -->
+    <target name="-copy-user-manifest" depends="-check-user-manifest" if="user.manifest.exists">
+        <copy file="manifest.mf" tofile="${build.dir}/MANIFEST.MF" overwrite="true"/>
+        <available file="${build.dir}/MANIFEST.MF" property="build.manifest.exists"/>
+    </target>
+    <target name="-check-user-manifest">
+        <available file="manifest.mf" property="user.manifest.exists"/>
+    </target>
+    
+    <!-- handle the class path for external jar files unless there is a user overwrite -->
+    <target name="-external-jars" depends="-rm-external-jars,-add-external-jars"/>
+        
+    <target name="-add-external-jars" depends="-external-jars-condition" if="do.externalJars">
+        <!-- get property external.jars for classpath from props file -->
+        <property file="${dist.dir}/${external.jar.dir}/jars.properties"/>
+    </target>
+
+    <target name="-rm-external-jars" depends="-external-jars-condition" unless="do.externalJars">
+        <!-- empty property, if no jars -->
+        <property name="external.jars" value=""/>
+    </target>
+    
+    <target name="-external-jars-condition">
+        <available file="${dist.dir}/${external.jar.dir}" type="dir" property="do.externalJars"/>
+    </target>
+    
+    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+    
+    <target name="-delete-uno-package">
+        <delete failonerror="false" file="${uno.package.name}"/>
+    </target>
+    
+    <target name="-pre-uno-package">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+
+    <target name="-license-exists">
+        <available file="${project.dir}/${licenses.dir}" type="dir" property="do.license"/>
+    </target>
+    
+    <!-- test for licenses dir is necessary because zipfileset fails if dir not there -->
+    <target name="-uno-package-with-license" depends="-license-exists" if="do.license">
+        <zip update="true" destfile="${uno.package.name}">
+            <zipfileset dir="${project.dir}/${licenses.dir}" includes="**" casesensitive="yes" prefix="${licenses.dir}"/>
+        </zip>
+    </target>
+
+    <target name="-description-exists">
+        <available file="${project.dir}/${description.dir}" type="dir" property="do.description"/>
+    </target>
+    
+    <!-- test for description dir is necessary because zipfileset fails if dir not there -->
+    <target name="-uno-package-with-description" depends="-description-exists" if="do.description">
+        <zip update="true" destfile="${uno.package.name}">
+            <zipfileset dir="${project.dir}/${description.dir}" includes="**" casesensitive="yes" prefix="${description.dir}"/>
+        </zip>
+    </target>
+
+    <target name="-help-exists">
+        <available file="${project.dir}/${help.dir}" type="dir" property="do.help"/>
+    </target>
+    
+    <!-- test for help dir is necessary because zipfileset fails if dir not there -->
+    <target name="-uno-package-with-help" depends="-help-exists" if="do.help">
+        <zip update="true" destfile="${uno.package.name}">
+            <zipfileset dir="${help.dir}" includes="${help.content.extensions}" prefix="${help.dir}"/>
+        </zip>
+    </target>    
+ 
+    <target name="-dialogs-exists">
+        <available file="${project.dir}/${dialogs.dir}" type="dir" property="do.dialogs"/>
+    </target>
+    
+    <!-- test for dialogs dir is necessary because zipfileset fails if dir not there -->
+    <target name="-uno-package-with-dialogs" depends="-dialogs-exists" if="do.dialogs">
+        <zip update="true" destfile="${uno.package.name}">
+            <zipfileset dir="${dialogs.dir}" includes="${dialog.content.extensions}" prefix="dialogs"/>
+        </zip>
+    </target>   
+    
+    <target name="-do-uno-package" description="Creates UNO extension pacakge" depends="-uno-package-with-license,-uno-package-with-help,-uno-package-with-dialogs,-uno-package-with-description">
+        <echo message="creating UNO extension package ..."/>
+        <zip update="true" destfile="${uno.package.name}">
+            <fileset dir="${src.dir}" includes="${manifest.package.extensions}" casesensitive="yes"/>
+            <fileset dir="${build.registry.dir}" casesensitive="yes"/>
+            <fileset dir="${src.dir}" includes="description.xml" casesensitive="yes"/>
+            <fileset dir="${dist.dir}" includes="**/*.jar" casesensitive="yes"/>
+            <fileset dir="${images.base.dir}" includes="**" casesensitive="yes"/>
+            <fileset dir="${idl.out.rdb}" includes="**/*.rdb" casesensitive="yes"/>
+            <zipfileset dir="${src.dir}" includes="uno-extension-manifest.xml" fullpath="META-INF/manifest.xml"/>
+        </zip>
+    </target>
+    
+    <target name="-post-uno-package">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+
+    <target name="uno-package" description="Creates UNO extension pacakge" depends="jar,images,registry,-delete-uno-package,-pre-uno-package,-do-uno-package,-post-uno-package"/>
+
+    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->    
+    
+<!--    <target name="uno-deploy" description="Deploys UNO extension package" depends="uno-package">
+        <echo message="deploying UNO extension package ..."/>
+        <echo message="${office.unopkg} gui -f ${uno.package.name}"/>
+        <echo message="${office.soffice} ${uno.package.name}"/>
+        <exec executable="${office.soffice}" dir="${office.program.dir}" failonerror="true">
+            <arg file="${uno.package.name}"/>
+        </exec>           
+    </target> -->
+    
+    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->    
+    
+    <target name="uno-run" description="Run OpenOffice.org" depends="uno-package,-run-oo"/>
+
+    <!-- subtargets for different office versions -->
+    <target name="-run-oo">
+        <echo message="${office.unopkg} gui -f ${uno.package.name}"/>
+        <exec dir="${office.program.dir}" executable="${office.unopkg}" failonerror="true">
+            <arg value="gui"/>
+            <arg value="-f"/>
+            <arg file="${uno.package.name}"/>
+        </exec>
+        <echo message="${office.soffice}"/>
+        <exec executable="${office.soffice}" dir="${office.program.dir}" failonerror="true">
+            <arg value="${office.startup.options}"/>
+        </exec>
+    </target>
+        
+    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->    
+    
+    <target name="uno-debug" description="Debugss UNO extension package in Target Office" depends="uno-package,-oo-debug"/>
+
+    <target name="-oo-debug">
+        <!-- security fail for executing this without netbeans -->
+        <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
+        <!-- start debugger and get connection address jpda.address -->
+        <nbjpdastart name="Debug Office" addressproperty="jpda.address" transport="dt_socket">
+            <classpath path="${build.classes.dir}"/>
+            <sourcepath path="${src.dir}"/>
+        </nbjpdastart>
+        <!-- register component in temporary user installation -->
+        <echo message="debugging UNO extension package ..."/>
+        <echo message="${office.unopkg} gui -f ${uno.package.name}"/>
+        <exec dir="${office.program.dir}" executable="${office.unopkg}">
+            <arg value="gui"/>
+            <arg value="-f"/>
+            <arg file="${uno.package.name}"/>
+            <env key="UserInstallation" value="${office.debug.user.directory}"/>
+        </exec>
+        <!-- start Office with debug Java and user installation -->
+        <echo message="starting the Office with ..."/>
+        <echo message="user installation: ${office.debug.user.directory}"/>
+        <echo message="debug options:     &quot;-Xdebug&quot; &quot;-Xrunjdwp:transport=dt_socket,address=${jpda.address}&quot;"/>
+        <echo message="${office.soffice}"/>
+        <exec dir="${office.program.dir}" executable="${office.soffice}" failonerror="true">
+            <arg value="-nofirststartwizard"/>
+            <arg value="${office.startup.options}"/>
+            <env key="UserInstallation" value="${office.debug.user.directory}"/>
+            <env key="JAVA_TOOL_OPTIONS" value="&quot;-Xdebug&quot; &quot;-Xrunjdwp:transport=dt_socket,address=${jpda.address}&quot;"/>
+        </exec>
+    </target>
+    
+</project>

Added: incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/genfiles.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/genfiles.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/genfiles.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/genfiles.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=2b754fcd
+build.xml.script.CRC32=0a20deac
+build.xml.stylesheet.CRC32=d5b6853a
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=2b754fcd
+nbproject/build-impl.xml.script.CRC32=27dd9569
+nbproject/build-impl.xml.stylesheet.CRC32=99b91518

Added: incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/project-uno.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/project-uno.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/project-uno.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/project-uno.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,18 @@
+uno.project.type=office.component.project
+project.name=__ProjectName__
+registration.classname=__RegistrationClass__
+external.jar.dir=lib
+idl_types.jar=__ProjectName___IDL_types.jar
+central.registration.class=__CentralRegistrationClass__
+# extensions for files that go into the .oxt package; some are also referenced in the manifest
+manifest.package.extensions=**/*.xcu,**/*.xcs,**/*.xdl,**/*.xlb,**/*.xba,**/*.properties,**/*.default
+image.extensions=**/*.png,**/*.jpg,**/*.jpeg,**/*.gif
+help.content.extensions=**/*.xhp,**/*.tree,${image.extensions}
+dialog.content.extensions=**/*.xdl,**/*.properties,**/*.default,${image.extensions}
+office.startup.options=__StartupOptions__
+images.dir=images
+registry.dir=registry
+help.dir=help
+dialogs.dir=dialogs
+licenses.dir=licenses
+description.dir=description

Added: incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/project.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/project.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/project.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/project.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,55 @@
+application.args=
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form,**/*.xcu,**/*.xcs,**/*.idl,**/*manifest.xml
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+debug.classpath=\
+    ${run.classpath}
+debug.test.classpath=\
+    ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/__ProjectName__.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+jar.compress=false
+javac.classpath=\
+    ${libs.__OfficeLibrary__.classpath}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.source=1.5
+javac.target=1.5
+javac.test.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}:\
+    ${libs.junit.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+meta.inf.dir=${src.dir}/META-INF
+platform.active=default_platform
+run.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=
+run.test.classpath=\
+    ${javac.test.classpath}:\
+    ${build.test.classes.dir}
+src.dir=src
+test.src.dir=test

Added: incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/project.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/project.xml?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/project.xml (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/nbproject/project.xml Fri Jan 27 01:29:33 2012
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.java.j2seproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
+            <name>__ProjectName__</name>
+            <minimum-ant-version>1.6.5</minimum-ant-version>
+            <source-roots>
+                <root id="src.dir"/>
+            </source-roots>
+            <test-roots>
+                <root id="test.src.dir"/>
+            </test-roots>
+        </data>
+    </configuration>
+</project>

Added: incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/src/CentralRegistrationClass.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/src/CentralRegistrationClass.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/src/CentralRegistrationClass.java (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/ComponentProject/src/CentralRegistrationClass.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,125 @@
+/*
+ * CentralRegistrationClass.java
+ *
+ * Created on __TimeStamp__
+ *
+ */
+package __UnoPackage__;
+
+import com.sun.star.lang.XSingleComponentFactory;
+import com.sun.star.registry.XRegistryKey;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.StringTokenizer;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+/**
+ *
+ * @author __UserName__
+ */
+public class CentralRegistrationClass {
+    
+    public static XSingleComponentFactory __getComponentFactory( String sImplementationName ) {
+        String regClassesList = getRegistrationClasses();
+        StringTokenizer t = new StringTokenizer(regClassesList, " ");
+        while (t.hasMoreTokens()) {
+            String className = t.nextToken();
+            if (className != null && className.length() != 0) {
+                try {
+                    Class regClass = Class.forName(className);
+                    Method writeRegInfo = regClass.getDeclaredMethod("__getComponentFactory", new Class[]{String.class});
+                    Object result = writeRegInfo.invoke(regClass, sImplementationName);
+                    if (result != null) {
+                       return (XSingleComponentFactory)result;
+                    }
+                }
+                catch (ClassNotFoundException ex) {
+                    ex.printStackTrace();
+                } catch (ClassCastException ex) {
+                    ex.printStackTrace();
+                } catch (SecurityException ex) {
+                    ex.printStackTrace();
+                } catch (NoSuchMethodException ex) {
+                    ex.printStackTrace();
+                } catch (IllegalArgumentException ex) {
+                    ex.printStackTrace();
+                } catch (InvocationTargetException ex) {
+                    ex.printStackTrace();
+                } catch (IllegalAccessException ex) {
+                    ex.printStackTrace();
+                }
+            }
+        }
+        return null;
+    }
+
+    public static boolean __writeRegistryServiceInfo( XRegistryKey xRegistryKey ) {
+        boolean bResult = true;
+        String regClassesList = getRegistrationClasses();
+        StringTokenizer t = new StringTokenizer(regClassesList, " ");
+        while (t.hasMoreTokens()) {
+            String className = t.nextToken();
+            if (className != null && className.length() != 0) {
+                try {
+                    Class regClass = Class.forName(className);
+                    Method writeRegInfo = regClass.getDeclaredMethod("__writeRegistryServiceInfo", new Class[]{XRegistryKey.class});
+                    Object result = writeRegInfo.invoke(regClass, xRegistryKey);
+                    bResult &= ((Boolean)result).booleanValue();
+                }
+                catch (ClassNotFoundException ex) {
+                    ex.printStackTrace();
+                } catch (ClassCastException ex) {
+                    ex.printStackTrace();
+                } catch (SecurityException ex) {
+                    ex.printStackTrace();
+                } catch (NoSuchMethodException ex) {
+                    ex.printStackTrace();
+                } catch (IllegalArgumentException ex) {
+                    ex.printStackTrace();
+                } catch (InvocationTargetException ex) {
+                    ex.printStackTrace();
+                } catch (IllegalAccessException ex) {
+                    ex.printStackTrace();
+                }
+            }
+        }
+        return bResult;
+    }
+
+    private static String getRegistrationClasses() {
+        CentralRegistrationClass c = new CentralRegistrationClass();
+        String name = c.getClass().getCanonicalName().replace('.', '/').concat(".class");
+        try {
+            Enumeration<URL> urlEnum = c.getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");
+            while (urlEnum.hasMoreElements()) {
+                URL url = urlEnum.nextElement();
+                String file = url.getFile();
+                JarURLConnection jarConnection =
+                    (JarURLConnection) url.openConnection();
+                Manifest mf = jarConnection.getManifest();
+
+                Attributes attrs = (Attributes) mf.getAttributes(name);
+                if ( attrs != null ) {
+                    String classes = attrs.getValue( "RegistrationClasses" );
+                    return classes;
+                }
+            }
+        } catch (IOException ex) {
+            ex.printStackTrace();
+        }
+            
+        return "";
+    }
+    
+    /** Creates a new instance of CentralRegistrationClass */
+    private CentralRegistrationClass() {
+    }
+}

Added: incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/build.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/build.xml?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/build.xml (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/build.xml Fri Jan 27 01:29:33 2012
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<project name="__UnoClientProjectName__" default="default" basedir=".">
+    <description>Builds, tests, and runs the project __UnoClientProjectName__.</description>
+
+    <import file="nbproject/build-uno-impl.xml"/>
+    <!--
+
+    There exist several targets which are by default empty and which can be 
+    used for execution of your tasks. These targets are usually executed 
+    before and after some main targets. They are: 
+
+      -pre-init:                 called before initialization of project properties
+      -post-init:                called after initialization of project properties
+      -pre-compile:              called before javac compilation
+      -post-compile:             called after javac compilation
+      -pre-compile-single:       called before javac compilation of single file
+      -post-compile-single:      called after javac compilation of single file
+      -pre-compile-test:         called before javac compilation of JUnit tests
+      -post-compile-test:        called after javac compilation of JUnit tests
+      -pre-compile-test-single:  called before javac compilation of single JUnit test
+      -post-compile-test-single: called after javac compilation of single JUunit test
+      -pre-jar:                  called before JAR building
+      -post-jar:                 called after JAR building
+      -post-clean:               called after cleaning build products
+
+    (Targets beginning with '-' are not intended to be called on their own.)
+
+    Example of inserting an obfuscator after compilation could look like this:
+
+        <target name="-post-compile">
+            <obfuscate>
+                <fileset dir="${build.classes.dir}"/>
+            </obfuscate>
+        </target>
+
+    For list of available properties check the imported 
+    nbproject/build-impl.xml file. 
+
+
+    Another way to customize the build is by overriding existing main targets.
+    The targets of interest are: 
+
+      -init-macrodef-javac:     defines macro for javac compilation
+      -init-macrodef-junit:     defines macro for junit execution
+      -init-macrodef-debug:     defines macro for class debugging
+      -init-macrodef-java:      defines macro for class execution
+      -do-jar-with-manifest:    JAR building (if you are using a manifest)
+      -do-jar-without-manifest: JAR building (if you are not using a manifest)
+      run:                      execution of project 
+      -javadoc-build:           Javadoc generation
+      test-report:              JUnit report generation
+
+    An example of overriding the target for project execution could look like this:
+
+        <target name="run" depends="__UnoClientProjectName__-impl.jar">
+            <exec dir="bin" executable="launcher.exe">
+                <arg file="${dist.jar}"/>
+            </exec>
+        </target>
+
+    Notice that the overridden target depends on the jar target and not only on 
+    the compile target as the regular run target does. Again, for a list of available 
+    properties which you can use, check the target you are overriding in the
+    nbproject/build-impl.xml file. 
+
+    -->
+        
+</project>

Added: incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/manifest.mf
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/manifest.mf?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/manifest.mf (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/manifest.mf Fri Jan 27 01:29:33 2012
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+

Added: incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/build-uno-impl.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/build-uno-impl.xml?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/build-uno-impl.xml (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/build-uno-impl.xml Fri Jan 27 01:29:33 2012
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project name="__UnoClientProjectName__-uno-impl" default="default" basedir="..">
+    <description>Builds, tests, and runs an UNO project.</description>
+
+    <import file="build-impl.xml"/>
+
+    <target name="-post-init">
+        <property file="nbproject/project-uno.properties"/>
+        <property name="build.uno.version" value="__BuildUnoVersion__"/>
+ 
+        <property name="run-sys-prop.com.sun.star.lib.loader.unopath" value="${office.program.dir}"/>
+        <property name="run-sys-prop.Application-Class" value="${uno.main.class}"/>
+    </target>
+    
+    <target name="-uno-project-init" depends="-do-init">
+        <dirname property="project.dir" file="build.xml"/>       
+
+        <fileset id="bootstrap.glue.code" dir="${oo.sdk.dir}${file.separator}classes">
+            <patternset>
+                <include name="win/unowinreg.dll"/>
+            </patternset>
+        </fileset>        
+    </target>
+       
+    <!-- jar including manifest: usr's own or a created one -->
+    <target name="jar" depends="-uno-project-init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-do-openoffice-manifest,-post-jar">
+        <jar basedir="${build.classes.dir}" manifest="${build.dir}/MANIFEST.MF" filesonly="true" compress="true" jarfile="${dist.jar}">
+            <fileset refid="bootstrap.glue.code"/>
+        </jar>
+    </target>
+
+    <!-- to goive the user a chance to set his custom values inside of the manifest, each
+         property set here checks if it does already exist inside of the user manifest -->
+    <target name="-do-openoffice-manifest" depends="-include-custom-manifest,-build-manifest,-build-filelist,-add-external-jars-to-classpath"/>
+    
+    <!-- add classpath with external jars to manifest, every jar must be prefixed with "lib/", use manifest.lst for this -->
+    <target name ="-add-external-jars-to-classpath" depends="-check-class-path" if="do.external.jars" unless="class.path.exists">
+        <pathconvert property="correct.file.list" pathsep=" ">
+            <path path="${file.list}"/>
+            <chainedmapper>
+                <flattenmapper/>
+                <globmapper from="*" to="lib/*"/>
+            </chainedmapper>
+        </pathconvert>
+        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
+            <attribute name="Class-Path" value="${correct.file.list}"/>
+        </manifest>
+    </target>
+    <target name="-check-class-path">
+        <condition property="class.path.exists">
+            <isfileselected file="${build.dir}/MANIFEST.MF">
+                <contains text="Class-Path"/>
+            </isfileselected>
+        </condition>
+    </target>
+        
+    <!-- build list for external jars: OpenOffice.org jars have to be excluded -->
+    <target name="-build-filelist">
+        <property file="nbproject/project-uno.properties"/>
+        <zipfileset id="zip.file.list" dir="${dist.dir}/lib" excludes="${exclude.office.jars}" includes="**/*.jar" casesensitive="yes"/>
+        <property name="file.list" refid="zip.file.list"/>
+        <condition property="do.external.jars">
+            <length string="${file.list}" when="greater" length="0"/>
+        </condition>
+        <delete>
+            <filelist dir="${dist.dir}/lib" files="${exclude.office.jars}"/>
+        </delete>
+    </target>
+    
+    <!-- build manifest for simple bootstrap -->
+    <target name="-build-manifest" depends="-check-application-class" unless="application.class.exists">
+        <manifest file="${build.dir}/MANIFEST.MF" mode="update">
+            <attribute name="Main-Class" value="com.sun.star.lib.loader.Loader"/>
+            <section name="com/sun/star/lib/loader/Loader.class">
+                <attribute name="Application-Class" value="${uno.main.class}"/>
+            </section>
+        </manifest>
+    </target>
+    <target name="-check-application-class">
+        <condition property="application.class.exists">
+        <isfileselected file="${build.dir}/MANIFEST.MF">
+            <contains text="Application-Class"/>
+        </isfileselected>
+        </condition>
+    </target>
+    
+    <!-- include a custom manifest from user -->
+    <target name="-include-custom-manifest" description="custom">
+        <copy file="manifest.mf" tofile="${build.dir}/MANIFEST.MF" overwrite="true" failonerror="false"/>
+    </target>
+    
+</project>

Added: incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/genfiles.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/genfiles.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/genfiles.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/genfiles.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=221cddc7
+build.xml.script.CRC32=799cf43b
+build.xml.stylesheet.CRC32=d5b6853a
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=7e7988ad
+nbproject/build-impl.xml.script.CRC32=d261391c
+nbproject/build-impl.xml.stylesheet.CRC32=99b91518

Added: incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/project-uno.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/project-uno.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/project-uno.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/project-uno.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,3 @@
+uno.project.type=office.simple.client.project
+exclude.office.jars=juh.jar jurt.jar officebean.jar ridl.jar unoil.jar
+uno.main.class=__UnoPackage__.__UnoClientMain__

Added: incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/project.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/project.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/project.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/project.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,57 @@
+application.args=
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+debug.classpath=\
+    ${run.classpath}
+debug.test.classpath=\
+    ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/__UnoClientProjectName__.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+jar.compress=false
+javac.classpath=\
+    ${libs.__OfficeLibrary__.classpath}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.source=1.5
+javac.target=1.5
+javac.test.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}:\
+    ${libs.junit.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+main.class=com.sun.star.lib.loader.Loader
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+platform.active=default_platform
+run.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=
+run.test.classpath=\
+    ${javac.test.classpath}:\
+    ${build.test.classes.dir}
+src.dir=src
+test.src.dir=test

Added: incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/project.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/project.xml?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/project.xml (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/nbproject/project.xml Fri Jan 27 01:29:33 2012
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.java.j2seproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
+            <name>__UnoClientProjectName__</name>
+            <minimum-ant-version>1.6.5</minimum-ant-version>
+            <source-roots>
+                <root id="src.dir"/>
+            </source-roots>
+            <test-roots>
+                <root id="test.src.dir"/>
+            </test-roots>
+        </data>
+    </configuration>
+</project>

Added: incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/__UnoPackagePath__/__UnoClientMain__.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/__UnoPackagePath__/__UnoClientMain__.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/__UnoPackagePath__/__UnoClientMain__.java (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/__UnoPackagePath__/__UnoClientMain__.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,42 @@
+/*
+ * __UnoClientMain__.java
+ *
+ * Created on __TimeStamp__
+ *
+ */
+
+package __UnoPackage__;
+
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.comp.helper.Bootstrap;
+
+/**
+ *
+ * @author __UserName__
+ */
+public class __UnoClientMain__ {
+    
+    /** Creates a new instance of __UnoClientMain__ */
+    public __UnoClientMain__() {
+    }
+    
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) {
+        try {
+            // get the remote office component context
+            XComponentContext xContext = Bootstrap.bootstrap();
+            if (xContext == null) {
+                System.err.println("ERROR: Could not bootstrap default Office.");
+            }
+        }
+        catch (java.lang.Exception e){
+            e.printStackTrace();
+        }
+        finally {
+            System.exit( 0 );
+        }
+    }
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/InstallationFinder.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/InstallationFinder.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/InstallationFinder.java (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/InstallationFinder.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,590 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: InstallationFinder.java,v $
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.loader;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+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.org\\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_MACHINE",
+                                               SUBKEYNAME );
+                path = key.getStringValue( "" ); // default                
+            } catch ( WinRegKeyException we ) {
+                System.err.println( "com.sun.star.lib.loader." +
+                    "InstallationFinder::getPathFromWindowsRegistry: " +
+                    "reading key from Windows Registry failed: " + we );
+            }         
+        }
+        
+        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
+            }
+        }
+    }
+}