|
| 1 | +<!-- |
| 2 | + ~ Copyright 2004 - 2025 Red Hat, Inc. |
| 3 | + ~ |
| 4 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + ~ you may not use this file except in compliance with the License. |
| 6 | + ~ You may obtain a copy of the License at |
| 7 | + ~ |
| 8 | + ~ http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + ~ |
| 10 | + ~ Unless required by applicable law or agreed to in writing, software |
| 11 | + ~ distributed under the License is distributed on an "AS IS" basis, |
| 12 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + ~ See the License for the specific language governing permissions and |
| 14 | + ~ limitations under the License. |
| 15 | + --> |
| 16 | +<project name="properties" default="reveng"> |
| 17 | + |
| 18 | + <!-- Include the 'hibernatetool' task definition from the file '../common/included.xml' --> |
| 19 | + <include file="../common/included.xml"/> |
| 20 | + |
| 21 | + <target name="clean"> |
| 22 | + <!-- Delete the compiled class for 'HelloExporter.java' if it exists --> |
| 23 | + <delete file="HelloExporter.class"/> |
| 24 | + </target> |
| 25 | + |
| 26 | + <target name="compile" depends="clean"> |
| 27 | + <!-- Compile the custom exporter 'HelloExporter.java' --> |
| 28 | + <javac classpathref="classpath" srcdir="." /> |
| 29 | + </target> |
| 30 | + |
| 31 | + <target name="reveng" depends="compile"> |
| 32 | + <!-- Property to use in the propertySet case --> |
| 33 | + <property name="thingOne" value="Bar"/> |
| 34 | + <echo message="First try without any property set"/> |
| 35 | + <hibernatetool destdir="dummy"> |
| 36 | + <!-- Dummy configuration, as it is needed for any 'hibernatetool' task --> |
| 37 | + <configuration /> |
| 38 | + <!-- Custom exporter 'HelloExporter' will say 'Hello, World!' --> |
| 39 | + <hbmtemplate exporterclass="HelloExporter"/> |
| 40 | + </hibernatetool> |
| 41 | + <echo message="Now try with a property element: 'greetedOne' is set to 'Foo'"/> |
| 42 | + <hibernatetool destdir="dummy"> |
| 43 | + <!-- <property> element to be used by the HelloExporter below --> |
| 44 | + <property key="greetedOne" value="Foo"/> |
| 45 | + <!-- Dummy configuration, as it is needed for any 'hibernatetool' task --> |
| 46 | + <configuration /> |
| 47 | + <!-- Custom exporter of class 'HelloExporter' to be found on the specified classpath --> |
| 48 | + <hbmtemplate exporterclass="HelloExporter"/> |
| 49 | + </hibernatetool> |
| 50 | + <echo message="Lastly try with a propertySet element: 'greetedOne' is set to 'Bar'"/> |
| 51 | + <hibernatetool destdir="dummy"> |
| 52 | + <!-- <propertySet> element to be used by the HelloExporter below --> |
| 53 | + <!-- The property 'thingOne' defined above is mapped to 'greetedOne' and subsequently used --> |
| 54 | + <propertySet> |
| 55 | + <propertyref prefix="thing"/> |
| 56 | + <mapper type="glob" from="thing*" to="greeted*"/> |
| 57 | + </propertySet> |
| 58 | + <!-- Dummy configuration, as it is needed for any 'hibernatetool' task --> |
| 59 | + <configuration /> |
| 60 | + <!-- Custom exporter of class 'HelloExporter' to be found on the specified classpath --> |
| 61 | + <hbmtemplate exporterclass="HelloExporter"/> |
| 62 | + </hibernatetool> |
| 63 | + </target> |
| 64 | + |
| 65 | +</project> |
| 66 | + |
0 commit comments