a.binder 8 lat temu
rodzic
commit
940b8276a3

+ 234 - 30
SE/build_SE.xml

@@ -1,14 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project basedir="schema" name="procesy5_root_build" default="save_build_properties">
+<project basedir="schema"
+    xmlns:p5build_SE="http://biuro.biall-net.pl/build_SE.xsd"
+    name="p5build_SE" default="save_build_properties">
   <description>
       for main purposes to provide properties for another builds eg: dita-ot
   </description>
     
     <!-- main properties controlled by licence -->
+    <!-- @2018 property correct structure -->
+    <include file="public_html/build_SE_basedir/build.p5build_SE.PRODUCT.xml"/>
+    <include file="public_html/build_SE_basedir/build.p5build_SE.SYSTEM.xml" as="SYSTEM"/>
+    <!--<property name="p5build_SE.PRODUCT.name" value="p5build_SE"/>
+        <property name="p5build_SE.PRODUCT.vendor-domain" value="pl.procesy5"/>
+        <property name="p5build_SE.PRODUCT.name.PROCESY5.basedir" value="${basedir}/build_SE_basedir"/>
+        <property name="p5build_SE.PRODUCT.name.PROCESY5.temp" value="${p5build_SE.PRODUCT.name.PROCESY5.basedir}/temp"/>-->
+    <!-- EOF @2018 property correct structure -->
     
     <property name="SERVER_ADDRESS" value="biuro.biall-net.pl"/> <!-- to be set in licence file and to be generated -->
     
     
+    
     <property name="TargetNamespaceBindings" value="https://biuro.biall-net.pl"/> <!-- default https://biuro.biall-net.pl for API working in this domain -->
     <property name="TargetNamespaceBindingsApi" value="${TargetNamespaceBindings}/wfs"/>
     <property name="TargetNamespaceBindingsApiUrl" value="${TargetNamespaceBindingsApi}/wfs-data.php"/>
@@ -20,40 +31,211 @@
     
     
     
+    
+    
     <!-- this built own properties -->
-    <property name="build_SE.xml" location="${basedir}/../build_SE.xml"/>
-    <property name="build_SE_basedir" location="${basedir}/build_SE_basedir"/> <!-- to keep files there some temp etc -->
-    <property name="build_SE_basedir.temp" location="${build_SE_basedir}/temp"/>
-    <property name="build_SE.properties" location="${build_SE_basedir}/build_SE.properties"/>
-    <property name="build_SE.properties.xml" location="${build_SE.properties}.xml"/>
-    
-    <property name="procesy5_config.folders.xsl" location="${build_SE_basedir}/procesy5_config.folders.xsl"/>
-    <property name="procesy5_config.default_db.xsl" location="${build_SE_basedir}/procesy5_config.default_db.xsl"/>
+    <property name="build_SE.xml" value="${basedir}/../build_SE.xml"/>
+    <property name="build_SE_basedir" value="${basedir}/build_SE_basedir"/> <!-- to keep files there some temp etc -->
+    <property name="build_SE_basedir.temp" value="${build_SE_basedir}/temp"/>
+    <property name="build_SE.properties" value="${build_SE_basedir}/.build_SE.properties"/>
+    <property name="build_SE.properties.xml" value="${build_SE.properties}.xml"/>
+    
+    <property name="procesy5_config.folders.xsl" value="${build_SE_basedir}/procesy5_config.folders.xsl"/>
+    <property name="procesy5_config.default_db.xsl" value="${build_SE_basedir}/procesy5_config.default_db.xsl"/>
+    <property name="procesy5_config.default_db.properties.xml" value="${build_SE_basedir}/.procesy5_config.default_db.properties.xml"/>
+    <property name="procesy5_config.default_db.properties" value="${build_SE_basedir}/.procesy5_config.default_db.properties"/>
+    
+    <property name="default_db_targetNamespace_detect_string" value="default_db/table/"/> <!-- intended to be in ${basedir}/table ? -->
+    <property name="zasob_id_db_targetNamespace_detect_string" value="https://biuro.biall-net.pl/api/"/> <!-- example targetNamespace="https://biuro.biall-net.pl/api/17666/" -->
     <!-- components -->
-    <property name="procesy5_config.default_db.properties.xml" location="${build_SE_basedir}/.procesy5_config.default_db.properties.xml"/>
-    <property name="dita-ot-toolkit" location="${basedir}/../stuff/dita-ot-2.3.3"/>
-    <property name="procesy5_config" location="${basedir}/../config"/>
-        <!--<property name="procesy5_config.folders" location="${procesy5_config}/.cnf-\-folders.ini.php"/>-->
-        <property name="procesy5_config.folders.server" location="${procesy5_config}/.cnf--folders-${SERVER_ADDRESS}.ini.php"/>
-        <property name="procesy5_config.default_db.server" location="${procesy5_config}/.cnf--default_db-${SERVER_ADDRESS}.ini.php"/>
-    <property name="procesy5_config.folders.properties.xml" location="${build_SE_basedir}/.procesy5_config.folders.properties.xml"/>
+    <property name="dita-ot-toolkit" value="${basedir}/../stuff/dita-ot-2.3.3"/>
+    <property name="procesy5_config" value="${basedir}/../config"/>
+    <property name="bin.launchctl" value="/bin/launchctl"/>
+        <!--<property name="procesy5_config.folders" value="${procesy5_config}/.cnf-\-folders.ini.php"/>-->
+        <property name="procesy5_config.folders.server" value="${procesy5_config}/.cnf--folders-${SERVER_ADDRESS}.ini.php"/>
+        <property name="procesy5_config.default_db.server" value="${procesy5_config}/.cnf--default_db-${SERVER_ADDRESS}.ini.php"/>
+    <property name="procesy5_config.folders.properties.xml" value="${build_SE_basedir}/.procesy5_config.folders.properties.xml"/>
   
-    <!-- TODO in build_resource_ant.xml <property name="dita.dir" location="/Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/dita"/>-->
+    <!-- TODO in build_resource_ant.xml <property name="dita.dir" value="/Library/Server/Web/Data/Sites/Default/SE/stuff/dita-ot-2.3.3/bin/dita"/>-->
     
     <!-- TODO config/licence/to handle params to SYNC with xmlschema and WPS_Functions -->
   
-    <property name="bootstrap.php" location="${basedir}/../se-lib/bootstrap.php"/> <!-- used in php scripts to execute  as root require("/Library/Server/Web/Data/Sites/SE-producition-git/SE/se-lib/bootstrap.php"); -->
-  
+    <property name="bootstrap.php" value="${basedir}/../se-lib/bootstrap.php"/> <!-- used in php scripts to execute  as root require("/Library/Server/Web/Data/Sites/SE-producition-git/SE/se-lib/bootstrap.php"); -->
+    
    <!-- task to maintain properties -->
+    
+    
+    
+    <include file="public_html/build_SE_basedir/build_SE.fail_if_user_is_not_root.xml"  as="uid"/>
+    <include file="public_html/build_SE_basedir/build_SE.check_OS.xml"  as="check_OS"/>
+    <target name="p5build_SE:LaunchDaemons.test" description="To detect if system is capable of LaunchDaemons like OSX Server - TODO to better check it universally">
+        <condition property="p5build_SE.LaunchDaemons.test" taskname="p5build_SE:OSX_SERVER.cond">
+            <and>
+                <available file="/Library/LaunchDaemons/" />
+                <available file="${bin.launchctl}" />
+            </and>
+        </condition>
+        <echo>#61 $os.name= ${os.name} $p5build_SE.LaunchDaemons = ${p5build_SE.LaunchDaemons} to insstall psuis:addToLaunchctl </echo>
+    </target>
+    
+    <target name="p5build_SE:OSX_SERVER.cond" depends="p5build_SE:LaunchDaemons.test,p5build_SE:OSX_SERVER.ok,p5build_SE:OSX_SERVER.fail" description="to detect if it is osx server and get its properties"/>
+        
+    
+    
+    <target name="p5build_SE:OSX_SERVER.ok" if="p5build_SE.LaunchDaemons.test" description="to detect if it is osx server and get its properties">
+        <property name="p5build_SE.LaunchDaemons" value="/Library/LaunchDaemons/"/>
+    </target>
+    <target name="p5build_SE:OSX_SERVER.fail" unless="p5build_SE.LaunchDaemons.test" description="to detect if it is osx server and get its properties">
+        <echo>#72 THIS IS NOT p5build_SE:OSX_SERVER ! </echo>
+    </target>
+  
+    <target name="p5build_SE:OSX_SERVER:launchctl.load.plist">
+        <input addproperty="OSX_SERVER.plistFile"/>
+        <input addproperty="addToLaunchctl.plistFile.installed.touch_if_ok" id="addToLaunchctl.plistFile.installed.touch_if_ok"/>
+       
+        <!--<local name="OSX_SERVER.launchctl.load.error"/>-->
+        <echo>#87 z psuis.addToLaunchctl.plistFile.installed = ${psuis.addToLaunchctl.plistFile.installed}</echo>
+        <exec executable="${bin.launchctl}" outputproperty="OSX_SERVER.launchctl.load.error" failifexecutionfails="false">
+            <arg line="load ${OSX_SERVER.plistFile}"/>
+        </exec>
+        <echo> #94 check for errors: ${OSX_SERVER.launchctl.load.error} </echo>
+        <antcall target="p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.cond">
+            <param name="OSX_SERVER.launchctl.load.error" value="${OSX_SERVER.launchctl.load.error}"/>
+            <param name="OSX_SERVER.plistFile" value="${OSX_SERVER.plistFile}"/>
+            <param name="addToLaunchctl.plistFile.installed.touch_if_ok" value="${addToLaunchctl.plistFile.installed.touch_if_ok}"/>
+            <param name="addToLaunchctl.plistFile.installed.touch_if_ok.2" value="${addToLaunchctl.plistFile.installed.touch_if_ok}"/>
+        </antcall>
+    </target>
+    
+    <target name="p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.cond" depends="p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.test,p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.ok,p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.fail,p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.ok_first_time">
+        <input addproperty="OSX_SERVER.launchctl.load.error"/>
+        <input addproperty="OSX_SERVER.plistFile"/>
+        <!--<input addproperty="addToLaunchctl.plistFile.installed.touch_if_ok"/>-->
+        <!--<antcall target="p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.test">
+            <param name="OSX_SERVER.launchctl.load.error" value="${OSX_SERVER.launchctl.load.error}"/>
+            <param name="OSX_SERVER.plistFile" value="${OSX_SERVER.plistFile}"/>
+        </antcall>
+        <antcall target="p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.ok">
+            <param name="OSX_SERVER.plistFile" value="${OSX_SERVER.plistFile}"/>
+            <param name="OSX_SERVER.plistFile" value="${OSX_SERVER.plistFile}"/>
+        </antcall>
+        <antcall target="p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.fail">
+            <param name="OSX_SERVER.plistFile" value="${OSX_SERVER.plistFile}"/>
+            <param name="OSX_SERVER.launchctl.load.error" value="${OSX_SERVER.launchctl.load.error}"/>
+            <param name="OSX_SERVER.plistFile" value="${OSX_SERVER.plistFile}"/>
+        </antcall>
+        <antcall target="p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.ok_first_time">
+            <param name="OSX_SERVER.plistFile" value="${OSX_SERVER.plistFile}"/>
+            <param name="OSX_SERVER.launchctl.load.error" value="${OSX_SERVER.launchctl.load.error}"/>
+            <param name="OSX_SERVER.plistFile" value="${OSX_SERVER.plistFile}"/>
+        </antcall>-->
+    </target>
+    
+    <target name="p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.test">
+        <!--<input addproperty="addToLaunchctl.plistFile.installed.touch_if_ok"/>-->
+        <echo>#124 
+            addToLaunchctl.plistFile.installed.touch_if_ok = ${addToLaunchctl.plistFile.installed.touch_if_ok}
+            testing error OSX_SERVER.launchctl.load.error =  ${OSX_SERVER.launchctl.load.error}
+        </echo>
+        <condition property="p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.test" taskname="p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.cond">
+            <contains  string="${OSX_SERVER.launchctl.load.error}" substring="service already loaded"/>
+        </condition>
+        <condition property="p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.ok_first_time" taskname="p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.cond">
+            <equals  arg2="${OSX_SERVER.launchctl.load.error}" arg1=""/>
+        </condition>
+        <condition property="p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.ok_next_time" taskname="p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.cond">
+            <or>
+                <equals  arg2="${OSX_SERVER.launchctl.load.error}" arg1=""/>
+                <contains  string="${OSX_SERVER.launchctl.load.error}" substring="service already loaded"/>
+            </or>
+        </condition>
+    </target>
+    
+    <target name="p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.ok" if="p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.test">
+        <input addproperty="OSX_SERVER.plistFile"/>
+        <!--<input addproperty="addToLaunchctl.plistFile.installed.touch_if_ok"/>-->
+        <exec executable="${bin.launchctl}" outputproperty="OSX_SERVER.launchctl.load.error">
+            <arg line="unload ${OSX_SERVER.plistFile}"/>
+        </exec>
+        <exec executable="${bin.launchctl}" outputproperty="OSX_SERVER.launchctl.load.error">
+            <arg line="load ${OSX_SERVER.plistFile}"/>
+        </exec>
+        <echo>
+            #142
+            OSX_SERVER.plistFile = ${OSX_SERVER.plistFile}
+            {addToLaunchctl.plistFile.installed.touch_if_ok} = ${addToLaunchctl.plistFile.installed.touch_if_ok}
+           
+        </echo>
+        <touch file="${addToLaunchctl.plistFile.installed.touch_if_ok}"/>
+        <chmod file="${addToLaunchctl.plistFile.installed.touch_if_ok}" perm="777"/>
+    </target>
+    
+    <target name="p5build_SE:OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.fail" unless="p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.ok_next_time" >
+        <input addproperty="OSX_SERVER.plistFile"/>
+        <input addproperty="OSX_SERVER.launchctl.load.error"/>
+        <!--<input addproperty="addToLaunchctl.plistFile.installed.touch_if_ok"/>-->
+        <echo>#122 There was another error than "service already loaded" and not tried to reload :
+            OSX_SERVER.plistFile = ${OSX_SERVER.plistFile}
+            OSX_SERVER.launchctl.load.error = ${OSX_SERVER.launchctl.load.error}
+            p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.test = ${p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.test}
+            p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.ok_first_time = ${p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.ok_first_time}
+            addToLaunchctl.plistFile.installed.touch_if_ok = ${addToLaunchctl.plistFile.installed.touch_if_ok}
+        </echo>
+    </target>
+    
+    <target name="p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.ok_first_time" if="p5build_SE.OSX_SERVER:launchctl.load.plist.unload_and_load_if_loaded.ok_first_time" >
+        <input addproperty="OSX_SERVER.plistFile"/>
+        <input addproperty="OSX_SERVER.launchctl.load.error"/>
+        <!--<input addproperty="addToLaunchctl.plistFile.installed.touch_if_ok"/>-->
+        <echo>#144 installed first time
+            OSX_SERVER.plistFile = ${OSX_SERVER.plistFile}
+            OSX_SERVER.launchctl.load.error = ${OSX_SERVER.launchctl.load.error}
+            {addToLaunchctl.plistFile.installed.touch_if_ok} = ${addToLaunchctl.plistFile.installed.touch_if_ok}
+        </echo>
+        <touch file="${addToLaunchctl.plistFile.installed.touch_if_ok}"/>
+        <chmod file="${addToLaunchctl.plistFile.installed.touch_if_ok}" perm="777"/>
+    </target>
+    
+    
+    
+  
+    <target name="p5build_SE.fail_if_user_is_root.check"  >
+        <property environment="env"/>
+        <condition property="p5build_SE.fail_if_user_is_root.check" taskname="p5build_SE.fail_if_user_is_root.cond">
+            <equals arg1="${env.USER}" arg2="root" />
+        </condition>
+        <echo> tested {env.USER} = ${env.USER}</echo>
+    </target>
+    <target name="p5build_SE.fail_if_user_is_root.cond" depends="p5build_SE.fail_if_user_is_root.check,p5build_SE.fail_if_user_is_root.ok,p5build_SE.fail_if_user_is_root.fail"/>
+
+    <target name="p5build_SE.fail_if_user_is_root.ok" if="p5build_SE.fail_if_user_is_root.check"  >
+        <echo> OK user is not root ;-) </echo>
+    </target>
+    
+    <target name="p5build_SE.fail_if_user_is_root.fail" unless="p5build_SE.fail_if_user_is_root.check" description="To fail command if the user is root">
+        <fail> Current user is root - which was unantended</fail>
+    </target>
+    
+    <target name="p5build_SE.fail_if_user_is_root" depends="p5build_SE.fail_if_user_is_root.cond" description="To fail command if the user is root"/>
+    
+    
   
-    <target name="save_build_properties" depends="build_SE.install_dirs,build_SE_read_procesy5_file_properties,build_SE_read_procesy5_default_db_properties">
-        <echoproperties destfile="${build_SE.properties}"/>
-        <echoproperties destfile="${build_SE.properties.xml}" format="xml"/>
+    <target name="save_build_properties" depends=" SYSTEM.build_SE.SYSTEM ,build_SE.install_dirs,build_SE_read_procesy5_file_properties,build_SE_read_procesy5_default_db_properties,p5build_SE:OSX_SERVER.cond">
+        <echo level="warning">#221 will properties to write ${build_SE.properties} and ${build_SE.properties.xml}</echo>
+        <echoproperties destfile="${p5build_SE.properties}"/>
+        <echoproperties destfile="${p5build_SE.properties.xml}" format="xml"/>
+            <chmod file="${p5build_SE.properties}" perm="777" failonerror="false"/>
+            <chmod file="${p5build_SE.properties.xml}" perm="777"/>
+        <chown file="${p5build_SE.properties}" owner="${p5build_SE.SYSTEM.local-user}" failonerror="false"/>
+        <chown file="${p5build_SE.properties.xml}" owner="${p5build_SE.SYSTEM.local-user}" failonerror="false"/>
     </target>
     
     <target name="build_SE.install_dirs">
-        <mkdir dir="${build_SE_basedir}"/>
-        <mkdir dir="${build_SE_basedir.temp}"/>
+        <echo level="verbose">#232 will make dir="${p5build_SE.basedir}"  dir="${p5build_SE.temp}" and  owner="${p5build_SE.SYSTEM.local-user}" </echo>
+        <mkdir dir="${p5build_SE.basedir}"/>
+        <mkdir dir="${p5build_SE.temp}"/>
+        <chown file="${p5build_SE.basedir}" owner="${p5build_SE.SYSTEM.local-user}" />
+        <chown file="${p5build_SE.temp}" owner="${p5build_SE.SYSTEM.local-user}"/>
     </target>
     
     
@@ -65,11 +247,11 @@
         <antcall target="build_SE_read_procesy5_file_properties_failed"/>
     </target>
     
-    <target unless="${build_SE_read_procesy5_file_properties_check}" name="build_SE_read_procesy5_file_properties_failed" description="echo inform that there is not config exists">
+    <target unless="build_SE_read_procesy5_file_properties_check" name="build_SE_read_procesy5_file_properties_failed" description="echo inform that there is not config exists">
         <echo> INFORM : propbably not installed in Procesy5 environment - not detected ${procesy5_config.folders.server} file</echo>
     </target>
     
-    <target if="${build_SE_read_procesy5_file_properties_check}" name="build_SE_read_procesy5_file_properties" depends="build_SE_read_procesy5_file_properties_check,build_SE.install_dirs" description="TO read from procesy5_config.folders and  further do another direction this in install">
+    <target if="build_SE_read_procesy5_file_properties_check" name="build_SE_read_procesy5_file_properties" depends="build_SE_read_procesy5_file_properties_check,build_SE.install_dirs" description="TO read from procesy5_config.folders and procesy5_config.folders.server further do another direction this in install">
         <!--<loadfile property="procesy5_config.folders_loadfile" srcfile="${procesy5_config.folders}"/>-->
         <loadfile property="procesy5_config.folders.server_loadfile" srcfile="${procesy5_config.folders.server}"/>
         <tempfile property="procesy5_config.folders_loadfile_xml" destdir="${build_SE_basedir.temp}" prefix="procesy5_config.folders_loadfile_xml" suffix=".xml" deleteonexit="no"/>
@@ -80,7 +262,8 @@
                 <procesy5_config.folders.server>${procesy5_config.folders.server_loadfile}</procesy5_config.folders.server>
             </procesy5_config>
         </echoxml>
-        <xslt basedir="./" style="${procesy5_config.folders.xsl}" in="${procesy5_config.folders_loadfile_xml}"  destdir="./" out="${procesy5_config.folders.properties.xml}" >
+        <chown file="${procesy5_config.folders_loadfile_xml}" owner="${p5build_SE.SYSTEM.local-user}"/>
+        <xslt basedir="./" style="${procesy5_config.folders.xsl}" in="${procesy5_config.folders_loadfile_xml}"  destdir="./" out="${procesy5_config.folders.properties.xml}" force="yes">
             <factory name="net.sf.saxon.TransformerFactoryImpl">    
                 <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
             </factory>
@@ -89,7 +272,7 @@
             <!--<param name="main_build_recurse_ant.dita" expression="${main_build_recurse_ant.dita}"/>-->
             <!--<param name="basedir" expression="${basedir}"/>-->
         </xslt>
-
+        <chown file="${procesy5_config.folders.properties.xml}" owner="${p5build_SE.SYSTEM.local-user}"/>
         <loadfile property="procesy5_config.folders.properties.xml.file" srcfile="${procesy5_config.folders.properties.xml}"/>
         <!--<echo>#60 reading $procesy5_config.folders.properties.xml ${procesy5_config.folders.properties.xml.file}
             ${procesy5_config.folders.properties.xml.file}
@@ -108,12 +291,12 @@
         <antcall target="build_SE_read_procesy5_default_db_properties_failed"/>
     </target>
     
-    <target unless="${build_SE_read_procesy5_default_db_properties_check}" name="build_SE_read_procesy5_default_db_properties_failed" description="echo inform that there is not config exists">
+    <target unless="build_SE_read_procesy5_default_db_properties_check" name="build_SE_read_procesy5_default_db_properties_failed" description="echo inform that there is not config exists">
         <echo> INFORM : propbably not installed in Procesy5 environment - not detected ${procesy5_config.default_db.server} file</echo>
     </target>
     
     
-    <target if="${build_SE_read_procesy5_default_db_properties_check}" name="build_SE_read_procesy5_default_db_properties" depends="build_SE_read_procesy5_default_db_properties_check,build_SE.install_dirs" description="TO read from procesy5_config.folders and procesy5_config.folders.server further do another direction this in install">
+    <target if="build_SE_read_procesy5_default_db_properties_check" name="build_SE_read_procesy5_default_db_properties" depends="build_SE_read_procesy5_default_db_properties_check,build_SE.install_dirs" description="TO read from procesy5_config.folders and procesy5_config.folders.server further do another direction this in install">
         <!--<loadfile property="procesy5_config.folders_loadfile" srcfile="${procesy5_config.folders}"/>-->
         <loadfile property="procesy5_config.default_db.server_loadfile" srcfile="${procesy5_config.default_db.server}"/>
         <tempfile property="procesy5_config.default_db_loadfile_xml" destdir="${build_SE_basedir.temp}" prefix="procesy5_config.default_db_loadfile_xml" suffix=".xml" deleteonexit="no"/>
@@ -129,10 +312,31 @@
                 <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
             </factory>
             <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="procesy5_config.default_db.properties" expression="${procesy5_config.default_db.properties}"/>
+            <param name="basedir" expression="${basedir}"/>
+            <!--<param name="webRootUrl" expression="${webRootUrl}" />--> 
+            <!--<param name="main_build_recurse_ant.dita" expression="${main_build_recurse_ant.dita}"/>-->
+            <!--<param name="basedir" expression="${basedir}"/>-->
+        </xslt>
+        
+        <xslt basedir="./" style="${procesy5_config.default_db.xsl}" in="${procesy5_config.default_db.properties.xml}"  destdir="./" out="${p5build_SE.build_procesy5_config.default_db.properties.xml}" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                <attribute name="http://saxon.sf.net/feature/initialMode" value="{http://biuro.biall-net.pl/build_SE.xsd}build_procesy5_config.default_db.properties.xml"/>
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="procesy5_config.default_db.properties" expression="${procesy5_config.default_db.properties}"/>
+            <param name="basedir" expression="${basedir}"/>
+            <param name="p5build_SE.build_procesy5_config.default_db.properties" expression="${p5build_SE.build_procesy5_config.default_db.properties}"/>
             <!--<param name="webRootUrl" expression="${webRootUrl}" />--> 
             <!--<param name="main_build_recurse_ant.dita" expression="${main_build_recurse_ant.dita}"/>-->
             <!--<param name="basedir" expression="${basedir}"/>-->
         </xslt>
+        <ant antfile="${p5build_SE.build_procesy5_config.default_db.properties.xml}"/>
+        <loadproperties srcfile="${p5build_SE.build_procesy5_config.default_db.properties}"></loadproperties>
+        <echo> loaded $procesy5_config.default_db.properties.xml ${procesy5_config.default_db.properties.xml}
+            and also build with properties to default database = p5build_SE.procesy5_config.default_db.server.type = ${p5build_SE.procesy5_config.default_db.server.type}
+        </echo>
         
         <loadfile property="procesy5_config.default_db.properties.xml.file" srcfile="${procesy5_config.default_db.properties.xml}"/>
         <!--<echo>#60 reading $procesy5_config.default_db.properties.xml ${procesy5_config.default_db.properties.xml.file}

+ 1 - 0
SE/schema/WPS_Functions/graph_tree_TODO_PROJ6806/build.grapht.PRODUCT.xml

@@ -24,6 +24,7 @@
     
     
     <property name="grapht.xsl" location="${grapht.basedir}/graph_tree_yed_from_wfs.xsl"/>
+    <property name="grapht.xsl.testing" location="${grapht.basedir}/grapht.xsl"/>
     <!--<property name="grapht.include.xsl.p5xsls.xml" location="${grapht.temp}/grapht.include.xsl.p5xsls.xml"/>
     <property name="grapht.include.xsl" location="${grapht.basedir}/grapht.include.xsl"/>
     <property name="grapht.include.structure.xml" location="${grapht.repository}/grapht.include.structure.xml"/>-->

+ 32 - 0
SE/schema/WPS_Functions/graph_tree_TODO_PROJ6806/build_graph_tree.xml

@@ -77,7 +77,39 @@
         
     </target>
    
+    <property name="grapht.testing.analyze_nodes.input.xml" value="/Users/a.binder/Documents/xmlschema_procesy5/src-xmlschema/public_html/WPS_Functions/get_wfs_recurse_xsl/temp/default_db__x3A__BI_audit_ENERGA_PRACOWNICY.9.api_recurse.looptest.get_wfs_recurse_xsl.out.xml.anonimize_for_devel.xml"/>
+    <property name="grapht.testing.analyze_nodes.xml" value="${grapht.repository}/grapht.testing.analyze_nodes.xml"/>
+    <property name="grapht.testing.analyze_nodes.paths.xml" value="${grapht.repository}/grapht.testing.analyze_nodes.paths.xml"/>
     
+    
+   
+    <target name="testing.analyze_nodes" description="@2018-02-05 testing analyzing nodes -  ">
+        
+         
+        <xslt basedir="${basedir}" style="${grapht.xsl.testing}" in="${grapht.testing.analyze_nodes.input.xml}"   out="${grapht.testing.analyze_nodes.xml}"  force="true" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                <attribute name="http://saxon.sf.net/feature/initialMode" value="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/graph_tree/graph_tree.xsd}analyze_nodes"/>
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="debug.filter" expression="(9177)|(9)"/><!-- |(3012062) -->
+        </xslt>
+        
+    </target>
+
+    <!-- depends="testing.analyze_nodes" -->
+    <target name="testing.analyze_nodes.paths" depends="testing.analyze_nodes" description="@2018-02-05 testing analyzing nodes - to calculate all paths by testing.analyze_nodes">
+        
+        <xslt basedir="${basedir}" style="${grapht.xsl.testing}" in="${grapht.testing.analyze_nodes.xml}"   out="${grapht.testing.analyze_nodes.paths.xml}"  force="true" >
+            <factory name="net.sf.saxon.TransformerFactoryImpl">    
+                <attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
+                <attribute name="http://saxon.sf.net/feature/initialMode" value="{http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/graph_tree/graph_tree.xsd}analyze_nodes.paths"/>
+            </factory>
+            <classpath location="/opt/local/share/java/saxon9he.jar"/>
+            <param name="debug.filter" expression="(9177)|(9)|(3012062)"/>
+        </xslt>
+        
+    </target>
 
 
   

+ 2 - 2
SE/schema/WPS_Functions/graph_tree_TODO_PROJ6806/graph_tree_yed_from_wfs.xsl

@@ -19,8 +19,8 @@
     <xsl:param name="graph_title" select="'Arkadiusz Binder/RIP Graficzna prezentacja wybranych par raportu dla podanych KRS 2017-08-09'"/>
     <xsl:param name="graph_desc" select="'Uwaga - limit 10 umow'"/>
     
-    <xsl:param name="bypass_nodes_string" select="'(.*BI_audit_ENERGA_PRACOWNICY.*)|(.*XXXXBI_audit_MSIG_nameXXXX.*)|(BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row)|(.*taxpayer.*)'"/>
-    <xsl:param name="not_bypass_nodes_string" select="'xxxBI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object'"/>
+    <xsl:param name="bypass_nodes_string" select="'(.*xxxxBI_audit_ENERGA_PRACOWNICYxxx.*)|(.*XXXXBI_audit_MSIG_nameXXXX.*)|(xxxxBI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_objectxxxx)|(.*taxpayer.*)'"/>
+    <xsl:param name="not_bypass_nodes_string" select="'xxxBI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_objectxxxx'"/>
     
     <xsl:param name="debug" select="0"/>
     

+ 155 - 16
SE/schema/WPS_Functions/graph_tree_TODO_PROJ6806/grapht.xsl

@@ -9,6 +9,19 @@
     xmlns:gml="http://www.opengis.net/gml"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     xmlns:p5="https://biuro.biall-net.pl/wfs"
+    xmlns:default_db__x3A__BI_audit_ENERGA_PRACOWNICY="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_PRACOWNICY"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row"
+    xmlns:default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object="https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object"
+    xmlns:default_db__x3A__BI_audit_taxpayer="https://biuro.biall-net.pl/wfs/default_db/BI_audit_taxpayer"
+    xmlns:default_db__x3A__TERYT_adresy="https://biuro.biall-net.pl/wfs/default_db/TERYT_adresy"
+    xmlns:default_db__x3A__BI_audit_KRS="https://biuro.biall-net.pl/wfs/default_db/BI_audit_KRS"
+    xmlns:default_db__x3A__BI_audit_KRS_person="https://biuro.biall-net.pl/wfs/default_db/BI_audit_KRS_person"
+    xmlns:default_db__x3A__BI_audit_KRS_company="https://biuro.biall-net.pl/wfs/default_db/BI_audit_KRS_company"
+    xmlns:default_db__x3A__BI_audit_MSIG="https://biuro.biall-net.pl/wfs/default_db/BI_audit_MSIG"
+    xmlns:default_db__x3A__BI_audit_MSIG_person="https://biuro.biall-net.pl/wfs/default_db/BI_audit_MSIG_person"
+    xmlns:default_db__x3A__BI_audit_MSIG_company="https://biuro.biall-net.pl/wfs/default_db/BI_audit_MSIG_company"
+    xmlns:default_db__x3A__BI_audit_MSIG_name="https://biuro.biall-net.pl/wfs/default_db/BI_audit_MSIG_name"
     version="2.0">
     
     <xsl:output indent="yes"/>
@@ -16,6 +29,27 @@
     
     <xsl:template match="get_wfs_recurse_xsl:context.PRIMARYKEY|get_wfs_recurse_xsl:nodes" mode="#all"/>
     
+    <xsl:param name="debug.filter" select="'(9177)|(9177)'"/>
+    
+    <!-- 
+    założenia:
+    
+     - graf ma max głębokość $maxDeepth - 
+     - w zależności od $maxDeepth, tyle razy się powiązuje rekursywnie wszystkie @xlinki, aby wyliczyć długości ścieżek do wszystkich węzłów.
+     - wyzwolenie liczenia powiązań do wszystkich ścieżek wyzwalamy od jakiegos poziomu do szczytu $currentStartDeepth, 
+       tyle razy dokladamy rekursywnie @xlink, aby osiągnąć $maxDeepth ($toTraverseDeept = $maxDeepth - $currentStartDeepth)
+     - todo kierunkowe relacje na razie ignorujemy (@backReffed), do rozwazenia implementacji w obliczeniach aby nie liczyc sciezek, 
+       dotyczących relacji przebiegajacych przez backreffy - pytanie w jakich jest to zaleznosciach - do przeanalizowania
+     - szukamy zawsze listy elementow, dla każdego elementu:
+       -  w górę
+       -  w dół
+     - @grapht:ancestor.path.len = dlugosc pomiedzy parentem i dzieckiem =  $grapht:parent.ancestor.count - $grapht:ancestor.count w elemencie grapht:analyze_nodes.tree.ancestors
+     
+     - drugie przetworzenie umożliwi znalezienie tras pomiedzy elementami suma z gory + kawalek do gory - bierzemy ktory krótszy
+     
+       
+    
+    -->
     
     <!-- 
         
@@ -91,30 +125,62 @@
     
     <xsl:template match="wfs:FeatureCollection" mode="grapht:analyze_nodes">
         <grapht:analyze_nodes>
-            <xsl:for-each-group select=".//*[*|@xlink:href]" group-by="name()">
+            <xsl:for-each-group select=".//*[(*|@xlink:href) ]" group-by="name()">
                 <xsl:copy copy-namespaces="no">
                     <xsl:attribute name="grapht:count" select="count(current-group())"/>
                     <xsl:attribute name="grapht:count.xlink" select="count(current-group()[@xlink:href])"/>
-                    <grapht:analyze_nodes.xlink.rebuild_tree_inputs>
-                        <xsl:for-each select=" current-group()[@xlink:href]" > <!-- -group  group-by="@fid" -->
-                            <xsl:sort select="count(ancestor::node())"/>
-                            <xsl:copy copy-namespaces="no">
-                                <xsl:copy-of select="@*"/>
-                                <xsl:variable name="grapht.fid" select="wfs:fid(@xlink:href)"/>
-                                <xsl:attribute name="grapht.fid" select="$grapht.fid"/>
-                                <xsl:attribute name="grapht:ancestor.count" select="count(ancestor::node())"/>
-                                <xsl:apply-templates mode="grapht:analyze_nodes.xlink.rebuild_tree" select="root()//*[*[@fid= $grapht.fid ]]"> <!-- and * -->
-                                    <xsl:with-param name="fid" select="$grapht.fid"/>
-                                    <xsl:with-param name="root.node" select="root()"/>
-                                </xsl:apply-templates>
-                            </xsl:copy>
-                        </xsl:for-each>
-                    </grapht:analyze_nodes.xlink.rebuild_tree_inputs>
+                    
+                    <grapht:analyze_fid>
+                        <xsl:for-each-group select="current-group()[  matches(@p5:primaryKey,$debug.filter) ]" group-by="@fid">
+                                <xsl:for-each select="current-group()">
+                                        <grapht:analyze_nodes.tree>
+                                            <xsl:attribute name="fid" select="@fid"/>
+                                            <!--<xsl:copy copy-namespaces="no">-->
+                                            <!--<xsl:attribute name="fid" select="@fid"/>-->
+                                                <grapht:analyze_nodes.tree.ancestors>
+                                                    <xsl:attribute name="grapht:parent.ancestor.count" select="count(ancestor::*)"/>
+                                                    <xsl:apply-templates mode="grapht:analyze_nodes.tree.ancestors" select="ancestor::*[*|@xlink:href]">
+                                                        <xsl:with-param name="grapht:parent.ancestor.count" select="count(ancestor::*)"/>
+                                                    </xsl:apply-templates>
+                                                </grapht:analyze_nodes.tree.ancestors>
+                                                <grapht:analyze_nodes.xlink.rebuild_tree_inputs>
+                                                    <xsl:for-each select=" current-group()[@xlink:href  and matches(@p5:primaryKey,$debug.filter) ]" > <!-- -group  group-by="@fid" -->
+                                                        <xsl:sort select="count(ancestor::node())"/>
+                                                        <xsl:copy copy-namespaces="no">
+                                                            <xsl:copy-of select="@*"/>
+                                                            <xsl:variable name="grapht.fid" select="wfs:fid(@xlink:href)"/>
+                                                            <xsl:attribute name="grapht.fid" select="$grapht.fid"/>
+                                                            <xsl:attribute name="grapht:ancestor.count" select="count(ancestor::node())"/>
+                                                            <xsl:apply-templates mode="grapht:analyze_nodes.xlink.rebuild_tree" select="root()//*[*[@fid= $grapht.fid ]]"> <!-- and * -->
+                                                                <xsl:with-param name="fid" select="$grapht.fid"/>
+                                                                <xsl:with-param name="root.node" select="root()"/>
+                                                            </xsl:apply-templates>
+                                                        </xsl:copy>
+                                                    </xsl:for-each>
+                                                </grapht:analyze_nodes.xlink.rebuild_tree_inputs>
+                                            <!--</xsl:copy>-->
+                                        </grapht:analyze_nodes.tree>
+                                </xsl:for-each>
+                            </xsl:for-each-group>
+                    </grapht:analyze_fid>
                 </xsl:copy>
             </xsl:for-each-group>
         </grapht:analyze_nodes>
     </xsl:template>
     
+    <xsl:template match="*" mode="grapht:analyze_nodes.tree.ancestors">
+        <xsl:param name="grapht:parent.ancestor.count" required="yes"/>
+        <xsl:copy copy-namespaces="no">
+            <xsl:copy-of select="@*"/>
+            <xsl:attribute name="grapht:ancestor.count" select="count(ancestor::*)"/>
+            <xsl:attribute name="grapht:ancestor.path.len" select="$grapht:parent.ancestor.count - count(ancestor::*)"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    
+    <xsl:template match="*[not(@fid or @xlink:href)]" mode="grapht:analyze_nodes.tree.ancestors"/>
+        
+    
     
     <xsl:template match="*" mode="grapht:analyze_nodes.xlink.rebuild_tree">
         <xsl:param name="fid" required="yes"/>
@@ -128,4 +194,77 @@
     </xsl:template>
     
     
+    
+    
+    <xsl:template match="grapht:analyze_nodes" mode="grapht:analyze_nodes.paths">
+        <grapht:analyze_nodes.paths>
+            <xsl:apply-templates mode="grapht:analyze_nodes.paths"/>
+        </grapht:analyze_nodes.paths>
+    </xsl:template>
+    
+    <xsl:template match="*" mode="grapht:analyze_nodes.paths">
+        <xsl:copy copy-namespaces="no">
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates mode="grapht:analyze_nodes.paths"/>
+        </xsl:copy>
+    </xsl:template>
+    
+    <xsl:template match="grapht:analyze_fid" mode="grapht:analyze_nodes.paths">
+        <!-- szukam unkalnych parentow jakie mam, z najkrotsza sciezka
+        , a potem szukam dla nich jakie oni maja dzieci unikalne, najkrotsze sciezki
+        -->
+        <xsl:copy copy-namespaces="no">
+            <xsl:copy-of select="@*"/>
+            <xsl:for-each-group select="grapht:analyze_nodes.tree" group-by="@fid">
+                <xsl:variable name="current.parent.fid" select="@fid"/>
+                <xsl:copy copy-namespaces="no">
+                    <xsl:copy-of select="@*"/>
+                    <grapht:analyze_nodes.tree.ancestors>
+                        <xsl:for-each-group select="current-group()/grapht:analyze_nodes.tree.ancestors/*" group-by="@fid">
+                            <xsl:sort select="@fid"/><!-- grapht:ancestor.path.len -->
+                            <xsl:copy copy-namespaces="no">
+                                <xsl:copy-of select="@*"/>
+                                <grapht:analyze_nodes.tree.ancestors.paths.to_childs>
+                                    <xsl:for-each select="current-group()">
+                                        <xsl:copy copy-namespaces="no">
+                                            <xsl:copy-of select="@*"/>
+                                            <grapht:analyze_nodes.tree.ancestors.paths.to_childs.childs>
+                                                <xsl:attribute name="debug">#223 dla znalezionych ojcow, szukam innych dzieci </xsl:attribute>
+                                                <xsl:for-each select="root()//grapht:analyze_fid/grapht:analyze_nodes.tree[not(@fid=$current.parent.fid)]/grapht:analyze_nodes.tree.ancestors/*[@fid= current()/@fid]">
+                                                <xsl:copy copy-namespaces="no">
+                                                <xsl:copy-of select="@*"/>
+                                                        <!--<xsl:for-each select="ancestor::*">
+                                                            <ancestor>
+                                                                <xsl:copy copy-namespaces="no">
+                                                                    <xsl:copy-of select="@*"/>
+                                                                </xsl:copy>
+                                                            </ancestor>
+                                                        </xsl:for-each>-->
+                                                </xsl:copy>
+                                            </xsl:for-each>
+                                            </grapht:analyze_nodes.tree.ancestors.paths.to_childs.childs>
+                                        </xsl:copy>
+                                    </xsl:for-each>
+                                </grapht:analyze_nodes.tree.ancestors.paths.to_childs>
+                            </xsl:copy>
+                        </xsl:for-each-group>
+                    </grapht:analyze_nodes.tree.ancestors>
+                </xsl:copy>
+            </xsl:for-each-group>
+        </xsl:copy>
+    </xsl:template>
+    
+    
+    <!--<xsl:template match="*" mode="grapht:analyze_nodes.paths.analyze_fid">
+        <xsl:copy copy-namespaces="no">
+            <xsl:copy-of select="@*"/>
+            <!-\- szukam unkalnych parentow jakie mam, z najkrotsza sciezka
+                , a potem szukam dla nich jakie oni maja dzieci unikalne, najkrotsze sciezki
+            -\->
+            <xsl:for-each-group select=""></xsl:for-each-group>
+            
+        </xsl:copy>
+    </xsl:template>-->
+    
+    
 </xsl:stylesheet>