hdoc_to_elasticsearch.ant 1.36 KB
Newer Older
Gregory's avatar
Gregory committed
1
2
3
4
5
<project name="hdoc_to_elasticsearch" default="clean"> 
	
	<property file="build.properties"/>     
	
	<target name="unzipSource">
Gregory's avatar
Gregory committed
6
7
8
		<echo message="Conversion begin" />
		<path id="hdocDirPath">
			<fileset dir="${inputPath}" id="hdocFile">
Gregory's avatar
Gregory committed
9
10
			<include name="*.hdoc"/>
			</fileset>
Gregory's avatar
Gregory committed
11
		</path>
Gregory's avatar
Gregory committed
12
		<property name="hdocFile" refId="hdocDirPath"/> 		
Gregory's avatar
Gregory committed
13
		<basename property="hdocFileName" file="${hdocFile}" suffix=".hdoc"/>
Gregory's avatar
Gregory committed
14
15
		<echo>Entry file : ${hdocFileName}</echo>

Gregory's avatar
Gregory committed
16
		<!-- create subdirectory for each file -->
Gregory's avatar
Gregory committed
17
18
19
20
21
22
23
24
25
26
		<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"/> 			
			</fileset> 		
		</unzip> 		

	</target> 		
Gregory's avatar
Gregory committed
27
28
	
	<target name="jsonFiles" depends="unzipSource"> 
Gregory's avatar
Gregory committed
29
30
31
		<echo message="JSON File creation" /> 		
		<xslt in="${tmpHdoc}/${hdocFileName}/content.xml" out="${outputPath}/${hdocFileName}.json" style="xsl/content_extractor.xsl"/>
	</target> 			
Gregory's avatar
Gregory committed
32
	
Gregory's avatar
Gregory committed
33
34
35
36
37
38
39
40
41
42
43
44
	<!-- Clear tmp files --> 	
	<target name="clean" depends="jsonFiles">         
		<echo message="Clean files" />
		<!-- -->
		<delete includeemptydirs="true" verbose="true">
			<fileset dir="${tmpHdoc}"> </fileset>
			<dirset dir="${tmpHdoc}" includes="**/*" />
		</delete>
		<echo message="Conversion end" />
	</target> 	

</project>
Gregory's avatar
Gregory committed
45