Przeglądaj źródła

przyklad dla Bzyka do komponentu do monitorowania kondycji maszyny, na ktorej stoi serwer - ktory bylby widoczny w API i zwracal XMLa

a.binder 9 lat temu
rodzic
commit
d61fec9673

+ 74 - 0
SE/schema/ant-url_action/procesy5_status/build.xml

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." name="procesy5_status" default="procesy5_status" >
+  
+  <description>TODO do kontroli kondycji systemu komunikacja - do podlaczenia pod API aby mozna było po tym requestowac</description>
+  
+    <property name="temp" value="temp_procesy5_status"/>
+    
+    <property name="storage_free.xml" value="${temp}/storage_free.xml" />
+    <property name="procesy5_status.xml"  value="${temp}/procesy5_status.xml"/>
+    
+    <!--<tempfile property="storage_free"  deleteonexit="false" destdir="${temp}"/>-->
+  
+    
+    <property name="build_procesy5_status.xsl" value="build_procesy5_status.xsl"/>
+  
+  
+  <target name="create_dirs">
+      <mkdir dir="${temp}"/>
+  </target>
+  
+  
+  <target name="storage_free" depends="create_dirs">
+        
+        
+      <exec executable="df" outputproperty="storage_free" >
+          <arg line=" -a /"/>
+      </exec>
+          
+      
+      <!--<echo file="${storage_free}"> Testowa zawartosc do zapisania</echo>-->
+      
+      
+      <!--<loadfile srcfile="${storage_free}" property="loadfile"/>-->
+      
+      <echoxml file="${storage_free.xml}">
+          <storage_free.xml>${storage_free}</storage_free.xml>
+      </echoxml>
+      
+      <!--<loadfile srcfile="${storage_free.xml}" property="loadfile.xml"/>-->
+      
+      <echo> storage_free ${loadfile} 
+                xml:
+                ${storage_free}}
+        
+      </echo>
+      
+  </target>
+  
+  
+  
+  <target name="procesy5_status" depends="storage_free" description="sprawdzenie kondycji systemu">
+      
+      
+      <xslt basedir="./"
+          style="${build_procesy5_status.xsl}"
+          destdir="./"
+          out="${procesy5_status.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/initialTemplate" value="build_procesy5_status" />
+          </factory>
+          <param name="temp"
+              expression="${temp}"/>
+          <classpath location="/opt/local/share/java/saxon9he.jar"/>
+      </xslt>
+      
+      
+      
+      <echo> RAPORT Z DZIALANIA </echo>
+      
+      
+      
+  </target>
+</project>

+ 67 - 0
SE/schema/ant-url_action/procesy5_status/build_procesy5_status.xsl

@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:raport="procesy5_raport"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:param name="temp" required="yes"/>
+    
+    
+    <xsl:variable name="raport:df_correct">
+        <hd0 raport:free="100"/>
+    </xsl:variable>
+    
+    
+    
+    <xsl:template name="build_procesy5_status">
+        <xsl:message>#13 odpalam templ </xsl:message>
+        <xsl:variable name="collection" select="collection(concat($temp,'/?select*.xml'))"/>
+        
+        <xsl:apply-templates select="$collection"/>
+        
+    </xsl:template>
+    
+    
+    <xsl:template match="storage_free.xml">
+        <storage_free.xml>
+            <xsl:apply-templates mode="df_output"/>
+            
+        </storage_free.xml>
+        
+    </xsl:template>
+    
+    
+    
+    
+    
+    <xsl:template match="*|text()" mode="df_output">
+        <xsl:variable name="df_output">
+            <df_output>
+                <xsl:for-each select="tokenize(normalize-space(.),' ')">
+                <el><xsl:attribute name="pos" select="position()"/>
+                    <xsl:value-of select="."/></el>
+            </xsl:for-each>
+            </df_output>
+        </xsl:variable>
+        
+        <raport:df>
+            <hd0>
+                <xsl:attribute name="raport:free" select="$df_output//el[@pos='17']"/>
+                <xsl:if test="number($raport:df_correct/hd0/@raport:free) &gt; number($df_output//el[@pos='17'])  ">
+                    <xsl:attribute name="error" select="'blad za malo'"/>
+                </xsl:if>
+            </hd0>
+        </raport:df>
+        <!--<xsl:copy-of select="$df_output"/>-->
+    </xsl:template>
+    
+    
+    
+    
+    
+    
+</xsl:stylesheet>