Commit 7e026ffb authored by Gregory's avatar Gregory

link scar to ELK stack

parent 48e18fcb
<project name="hdoc_to_elasticsearch" default="clean">
<!-- Use contribant -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="lib/ant-contrib-0.3.jar"/>
</classpath>
</taskdef>
<property file="build.properties"/>
<target name="unzipSource">
<target name="jsonFiles">
<echo message="Conversion begin" />
<path id="hdocDirPath">
<fileset dir="${inputPath}" id="hdocFile">
<include name="*.hdoc"/>
</fileset>
</path>
<property name="hdocFile" refId="hdocDirPath"/>
<basename property="hdocFileName" file="${hdocFile}" suffix=".hdoc"/>
<echo>Entry file : ${hdocFileName}</echo>
<echo>Entry file : ${fileToParse}</echo>
<!-- create subdirectory for each file -->
<mkdir dir="${tmpHdoc}/${hdocFileName}"/>
<!--unzips the hdoc to be converted into the previously created directory-->
<unzip dest="${tmpHdoc}/${hdocFileName}">
<fileset dir="${inputPath}" id="hdocFile">
<include name="${hdocFileName}.hdoc"/>
<mkdir dir="${tmpHdoc}" />
<basename property="fileToParseName" file="${inputPath}/${fileToParse}" suffix=".hdoc" />
<mkdir dir="${tmpHdoc}/${fileToParseName}"/>
<!--unzips the hdoc to be converted into the previously created directory -->
<unzip dest="${tmpHdoc}/${fileToParseName}">
<fileset dir="${inputPath}">
<include name="${fileToParseName}.hdoc"/>
</fileset>
</unzip>
</target>
<target name="jsonFiles" depends="unzipSource">
<echo message="JSON File creation" />
<xslt in="${tmpHdoc}/${hdocFileName}/content.xml" out="${outputPath}/${hdocFileName}.json" style="xsl/content_extractor.xsl"/>
<xslt in="${tmpHdoc}/${fileToParseName}/content.xml" out="${outputPath}/${fileToParseName}.json" style="xsl/content_extractor.xsl"/>
</target>
<!-- Parcours la liste des fichiers pour les transformer -->
<target name="targetAllFiles">
<delete>
<fileset dir="${outputPath}">
<include name="*.json"/>
</fileset>
</delete>
<foreach target="jsonFiles" param="fileToParse">
<fileset dir="${inputPath}">
<include name="*.hdoc"/>
</fileset>
</foreach>
</target>
<!-- Clear tmp files -->
<target name="clean" depends="jsonFiles">
<target name="clean" depends="targetAllFiles">
<echo message="Clean files" />
<!-- -->
<delete includeemptydirs="true" verbose="true">
......
libdir=${basedir}/lib
xsldir=${basedir}/xsl
inputPath=${basedir}/input
outputPath=${basedir}/logstash/input
inputOpaleToHdoc=../opale_to_hdoc/input
outputOpaleToHdoc=../opale_to_hdoc/output
inputHdocToElasticSearch=../hdoc_to_elasticSearch/input
outputHdocToElasticSearch=../hdoc_to_elasticSearch/output
\ No newline at end of file
{
"title" : "Elasticsearch - Indexation et recherches simples",
"keywords" : [
"REST",
"Elasticsearch",
"Filtre",
"Aggrégation"
],
"rights" : "by-sa",
"author" : "Robin Jolliet, 2016 (Contributions : Stéphane Crozat, les étudiants de l'UTC)"
}
\ No newline at end of file
<project name="hdoc_to_elasticsearch" default="clean">
<!-- -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="lib/ant-contrib-0.3.jar"/>
</classpath>
</taskdef>
<property file="build.properties"/>
<!-- Parcours la liste des fichiers pour les transformer -->
<target name="targetAllFiles">
<delete>
<fileset dir="${outputPath}">
<include name="*.json"/>
</fileset>
</delete>
<!-- Copy files in opale_to_hdoc input dir -->
<copy todir="${inputOpaleToHdoc}">
<fileset dir="${inputPath}"/>
</copy>
<!-- Use ant transo opale_to_hdoc -->
<ant antfile="../opale_to_hdoc/opale_to_hdoc.ant" inheritAll="false"/>
<!-- Copy files in hdoc_to_elasticSearch input dir -->
<copy todir="${inputHdocToElasticSearch}">
<fileset dir="${outputOpaleToHdoc}"/>
</copy>
<!-- Use ant transo opale_to_hdoc -->
<ant antfile="../hdoc_to_elasticSearch/hdoc_to_elasticsearch.ant" inheritAll="false"/>
<copy todir="${outputPath}" >
<fileset dir="${outputHdocToElasticSearch}"/>
</copy>
</target>
<!-- Clear tmp files -->
<target name="clean" depends="targetAllFiles">
<echo message="Clean files" />
<!-- -->
<delete includeemptydirs="true" verbose="true">
<fileset dir="${inputOpaleToHdoc}">
<include name="*.scar"/>
</fileset>
</delete>
<delete includeemptydirs="true" verbose="true">
<fileset dir="${outputOpaleToHdoc}">
<include name="*.hdoc"/>
</fileset>
</delete>
<delete includeemptydirs="true" verbose="true">
<fileset dir="${inputHdocToElasticSearch}">
<include name="*.hdoc"/>
</fileset>
</delete>
<delete includeemptydirs="true" verbose="true">
<fileset dir="${outputHdocToElasticSearch}">
<include name="*.json"/>
</fileset>
</delete>
<echo message="Clean end" />
</target>
</project>
@echo off
set lib=lib
set ant=opale_to_elasticsearch.ant
set antparam=-Dprogram.param=%1
set scJarList=%lib%\*
java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
pause
REM start /MIN java.exe -classpath "%scJarList%" -Xmx150m org.apache.tools.ant.Main -buildfile %ant% %antparam%
#!/bin/sh
lib="lib"
ant="opale_to_elasticsearch.ant"
antparam="-Dprogram.param=$1"
#Recherche de java et controle que se soit une version SUN
vJavaCmd="java"
xCheckJava () {
vInputVarName=\$"$1"
vInputVarVal=`eval "expr \"$vInputVarName\" "`
if [ -z "$vInputVarVal" ];then
eval "$1=false"
return
fi
vSunJavaFound=`$vInputVarVal -version 2>&1 | grep -Eo -m 1 "(HotSpot)|(OpenJDK)"`
if [ "$vSunJavaFound" != "HotSpot" ] && [ "$vSunJavaFound" != "OpenJDK" ] ; then
eval "$1=false"
return
fi
}
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
vJavaCmd="$JAVA_HOME/bin/java"
xCheckJava vJavaCmd
if [ "$vJavaCmd" = "false" ]; then
echo "ERREUR: JRE de SUN introuvable. Veuillez déclarer la variable d'environnement JAVA_HOME."
exit 1
fi
fi
#Lancer la commande
scJarList="$lib/*"
$vJavaCmd -classpath "$scJarList:" -Xmx150m org.apache.tools.ant.Main -buildfile $ant $antparam
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment