Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephane Crozat
hdoc
Commits
7e026ffb
Commit
7e026ffb
authored
Jan 05, 2017
by
Gregory
Browse files
link scar to ELK stack
parent
48e18fcb
Changes
18
Hide whitespace changes
Inline
Side-by-side
hdoc_to_elasticSearch/hdoc_to_elasticsearch.ant
View file @
7e026ffb
<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}/${
hdocFil
eName}/content.xml" out="${outputPath}/${
hdocFil
eName}.json" style="xsl/content_extractor.xsl"/>
<xslt in="${tmpHdoc}/${
fileToPars
eName}/content.xml" out="${outputPath}/${
fileToPars
eName}.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="
json
Files">
<target name="clean" depends="
targetAll
Files">
<echo message="Clean files" />
<!-- -->
<delete includeemptydirs="true" verbose="true">
...
...
hdoc_to_elasticSearch/lib/ant-contrib.jar
→
hdoc_to_elasticSearch/lib/ant-contrib
-0.3
.jar
View file @
7e026ffb
File moved
hdoc_to_elasticSearch/logstash/input/.gitkeep
0 → 100644
View file @
7e026ffb
hdoc_to_elasticSearch/sample/result.hdoc
0 → 100644
View file @
7e026ffb
File added
hdoc_to_elasticSearch/
input
/sample.hdoc
→
hdoc_to_elasticSearch/
sample
/sample.hdoc
View file @
7e026ffb
File moved
hdoc_to_elasticSearch/sample/sample01.hdoc
0 → 100644
View file @
7e026ffb
File added
hdoc_to_elasticSearch/sample/sample02.hdoc
0 → 100644
View file @
7e026ffb
File added
opale_to_elasticSearch/build.properties
0 → 100644
View file @
7e026ffb
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
opale_to_elasticSearch/lib/ant-contrib-0.3.jar
0 → 100644
View file @
7e026ffb
File added
opale_to_elasticSearch/lib/ant-launcher.jar
0 → 100644
View file @
7e026ffb
File added
opale_to_elasticSearch/lib/ant.jar
0 → 100644
View file @
7e026ffb
File added
opale_to_elasticSearch/lib/saxon9he.jar
0 → 100644
View file @
7e026ffb
File added
opale_to_elasticSearch/logstash/input/.gitkeep
0 → 100644
View file @
7e026ffb
opale_to_elasticSearch/logstash/input/es-1_2017-1-4.scar.json
0 → 100644
View file @
7e026ffb
{
"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
opale_to_elasticSearch/opale_to_elasticsearch.ant
0 → 100644
View file @
7e026ffb
<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>
opale_to_elasticSearch/run.bat
0 → 100644
View file @
7e026ffb
@echo
off
set
lib
=
lib
set
ant
=
opale_to_elasticsearch
.ant
set
antparam
=
-Dprogram
.param
=
%
1
set
scJarList
=
%lib%
\
*
java
.exe
-classpath
"
%scJarList%
"
-Xmx
150
m
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%
opale_to_elasticSearch/run.sh
0 → 100644
View file @
7e026ffb
#!/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
opale_to_elasticSearch/sample/es-1_2017-1-4.scar
0 → 100644
View file @
7e026ffb
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment