Project

General

Profile

Revision 7

View differences:

trunk/src/build.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!-- You may freely edit this file. See commented blocks below for -->
3
<!-- some examples of how to customize the build. -->
4
<!-- (If you delete it and reopen the project it will be recreated.) -->
5
<!-- By default, only the Clean and Build commands use this build script. -->
6
<!-- Commands such as Run, Debug, and Test only use this build script if -->
7
<!-- the Compile on Save feature is turned off for the project. -->
8
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
9
<!-- in the project's Project Properties dialog box.-->
10
<project name="LIDAR_SOAP" default="default" basedir=".">
11
    <description>Builds, tests, and runs the project LIDAR SOAP.</description>
12
    <import file="nbproject/build-impl.xml"/>
13
    <!--
14

  
15
    There exist several targets which are by default empty and which can be 
16
    used for execution of your tasks. These targets are usually executed 
17
    before and after some main targets. They are: 
18

  
19
      -pre-init:                 called before initialization of project properties 
20
      -post-init:                called after initialization of project properties 
21
      -pre-compile:              called before javac compilation 
22
      -post-compile:             called after javac compilation 
23
      -pre-compile-single:       called before javac compilation of single file
24
      -post-compile-single:      called after javac compilation of single file
25
      -pre-compile-test:         called before javac compilation of JUnit tests
26
      -post-compile-test:        called after javac compilation of JUnit tests
27
      -pre-compile-test-single:  called before javac compilation of single JUnit test
28
      -post-compile-test-single: called after javac compilation of single JUunit test
29
      -pre-dist:                 called before archive building 
30
      -post-dist:                called after archive building 
31
      -post-clean:               called after cleaning build products 
32
      -pre-run-deploy:           called before deploying
33
      -post-run-deploy:          called after deploying
34

  
35
    Example of pluging an obfuscator after the compilation could look like 
36

  
37
        <target name="-post-compile">
38
            <obfuscate>
39
                <fileset dir="${build.classes.dir}"/>
40
            </obfuscate>
41
        </target>
42

  
43
    For list of available properties check the imported 
44
    nbproject/build-impl.xml file. 
45

  
46

  
47
    Other way how to customize the build is by overriding existing main targets.
48
    The target of interest are: 
49

  
50
      init-macrodef-javac:    defines macro for javac compilation
51
      init-macrodef-junit:   defines macro for junit execution
52
      init-macrodef-debug:    defines macro for class debugging
53
      do-dist:                archive building
54
      run:                    execution of project 
55
      javadoc-build:          javadoc generation 
56

  
57
    Example of overriding the target for project execution could look like 
58

  
59
        <target name="run" depends="<PROJNAME>-impl.jar">
60
            <exec dir="bin" executable="launcher.exe">
61
                <arg file="${dist.jar}"/>
62
            </exec>
63
        </target>
64

  
65
    Notice that overridden target depends on jar target and not only on 
66
    compile target as regular run target does. Again, for list of available 
67
    properties which you can use check the target you are overriding in 
68
    nbproject/build-impl.xml file. 
69

  
70
    -->
71
</project>
trunk/src/nbproject/project.properties
1
annotation.processing.enabled=true
2
annotation.processing.enabled.in.editor=true
3
annotation.processing.processors.list=
4
annotation.processing.run.all.processors=true
5
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
6
build.classes.dir=${build.web.dir}/WEB-INF/classes
7
build.classes.excludes=**/*.java,**/*.form
8
build.dir=build
9
build.generated.dir=${build.dir}/generated
10
build.generated.sources.dir=${build.dir}/generated-sources
11
build.test.classes.dir=${build.dir}/test/classes
12
build.test.results.dir=${build.dir}/test/results
13
build.web.dir=${build.dir}/web
14
build.web.excludes=${build.classes.excludes}
15
client.urlPart=
16
compile.jsps=false
17
conf.dir=${source.root}/conf
18
debug.classpath=${build.classes.dir}:${javac.classpath}
19
debug.test.classpath=\
20
    ${run.test.classpath}
21
display.browser=true
22
dist.dir=dist
23
dist.ear.war=${dist.dir}/${war.ear.name}
24
dist.javadoc.dir=${dist.dir}/javadoc
25
dist.war=${dist.dir}/${war.name}
26
endorsed.classpath=
27
excludes=
28
file.reference.commons-collections-3.2.1.jar=/home/cime/Documents/commons-collections-3.2.1/commons-collections-3.2.1.jar
29
file.reference.commons-configuration-1.6.jar=/home/cime/Documents/commons-configuration-1.6/commons-configuration-1.6.jar
30
file.reference.commons-lang-2.5.jar=/home/cime/Documents/commons-lang-2.5/commons-lang-2.5.jar
31
file.reference.gson-1.3.jar=lib/gson-1.3.jar
32
file.reference.gson-1.3.jar-1=/home/cime/Documents/gson-1.3.jar
33
file.reference.JPam-1.1.jar=/home/cime/Documents/JPam-1.1/JPam-1.1.jar
34
file.reference.mysql-connector-java-5.1.6-bin.jar=/home/cime/netbeans-6.9/ide/modules/ext/mysql-connector-java-5.1.6-bin.jar
35
includes=**
36
j2ee.deploy.on.save=true
37
j2ee.platform=1.5
38
j2ee.platform.classpath=${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/bin/tomcat-juli.jar
39
j2ee.server.type=Tomcat60
40
jar.compress=false
41
javac.classpath=\
42
    ${libs.hibernate-support.classpath}:\
43
    ${libs.ejb3-persistence.classpath}:\
44
    ${file.reference.mysql-connector-java-5.1.6-bin.jar}:\
45
    ${libs.metro.classpath}:\
46
    ${file.reference.gson-1.3.jar}:\
47
    ${libs.JavaComm.classpath}:\
48
    ${file.reference.JPam-1.1.jar}:\
49
    ${file.reference.commons-configuration-1.6.jar}:\
50
    ${file.reference.commons-lang-2.5.jar}:\
51
    ${file.reference.commons-collections-3.2.1.jar}:\
52
    ${file.reference.gson-1.3.jar-1}
53
# Space-separated list of extra javac options
54
javac.compilerargs=
55
javac.debug=true
56
javac.deprecation=false
57
javac.processorpath=\
58
    ${javac.classpath}
59
javac.source=1.5
60
javac.target=1.5
61
javac.test.classpath=\
62
    ${javac.classpath}:\
63
    ${build.classes.dir}:\
64
    ${libs.junit.classpath}:\
65
    ${libs.junit_4.classpath}
66
javac.test.processorpath=\
67
    ${javac.test.classpath}
68
javadoc.additionalparam=
69
javadoc.author=false
70
javadoc.encoding=${source.encoding}
71
javadoc.noindex=false
72
javadoc.nonavbar=false
73
javadoc.notree=false
74
javadoc.preview=true
75
javadoc.private=false
76
javadoc.splitindex=true
77
javadoc.use=true
78
javadoc.version=false
79
javadoc.windowtitle=
80
lib.dir=${web.docbase.dir}/WEB-INF/lib
81
persistence.xml.dir=${conf.dir}
82
platform.active=default_platform
83
resource.dir=setup
84
run.test.classpath=\
85
    ${javac.test.classpath}:\
86
    ${build.test.classes.dir}
87
# Space-separated list of JVM arguments used when running a class with a main method or a unit test
88
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value):
89
runmain.jvmargs=
90
source.encoding=UTF-8
91
source.root=src
92
src.dir=${source.root}/java
93
test.src.dir=test
94
war.content.additional=
95
war.ear.name=LIDAR_SOAP.war
96
war.name=LIDAR_SOAP.war
97
web.docbase.dir=web
98
webinf.dir=web/WEB-INF
trunk/src/nbproject/project.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://www.netbeans.org/ns/project/1">
3
    <type>org.netbeans.modules.web.project</type>
4
    <configuration>
5
        <buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1"/>
6
        <data xmlns="http://www.netbeans.org/ns/web-project/3">
7
            <name>LIDAR SOAP</name>
8
            <minimum-ant-version>1.6.5</minimum-ant-version>
9
            <web-module-libraries>
10
                <library dirs="200">
11
                    <file>${libs.hibernate-support.classpath}</file>
12
                    <path-in-war>WEB-INF/lib</path-in-war>
13
                </library>
14
                <library dirs="200">
15
                    <file>${libs.ejb3-persistence.classpath}</file>
16
                    <path-in-war>WEB-INF/lib</path-in-war>
17
                </library>
18
                <library dirs="200">
19
                    <file>${file.reference.mysql-connector-java-5.1.6-bin.jar}</file>
20
                    <path-in-war>WEB-INF/lib</path-in-war>
21
                </library>
22
                <library dirs="200">
23
                    <file>${libs.metro.classpath}</file>
24
                    <path-in-war>WEB-INF/lib</path-in-war>
25
                </library>
26
                <library dirs="200">
27
                    <file>${file.reference.gson-1.3.jar}</file>
28
                    <path-in-war>WEB-INF/lib</path-in-war>
29
                </library>
30
                <library dirs="200">
31
                    <file>${libs.JavaComm.classpath}</file>
32
                    <path-in-war>WEB-INF/lib</path-in-war>
33
                </library>
34
                <library dirs="200">
35
                    <file>${file.reference.JPam-1.1.jar}</file>
36
                    <path-in-war>WEB-INF/lib</path-in-war>
37
                </library>
38
                <library dirs="200">
39
                    <file>${file.reference.commons-configuration-1.6.jar}</file>
40
                    <path-in-war>WEB-INF/lib</path-in-war>
41
                </library>
42
                <library dirs="200">
43
                    <file>${file.reference.commons-lang-2.5.jar}</file>
44
                    <path-in-war>WEB-INF/lib</path-in-war>
45
                </library>
46
                <library dirs="200">
47
                    <file>${file.reference.commons-collections-3.2.1.jar}</file>
48
                    <path-in-war>WEB-INF/lib</path-in-war>
49
                </library>
50
                <library dirs="200">
51
                    <file>${file.reference.gson-1.3.jar-1}</file>
52
                    <path-in-war>WEB-INF/lib</path-in-war>
53
                </library>
54
            </web-module-libraries>
55
            <web-module-additional-libraries/>
56
            <source-roots>
57
                <root id="src.dir"/>
58
            </source-roots>
59
            <test-roots>
60
                <root id="test.src.dir"/>
61
            </test-roots>
62
        </data>
63
    </configuration>
64
</project>
trunk/src/nbproject/genfiles.properties
1
build.xml.data.CRC32=8d3b9fa6
2
build.xml.script.CRC32=6ef1775d
3
build.xml.stylesheet.CRC32=651128d4@1.24.1.1
4
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6
nbproject/build-impl.xml.data.CRC32=8d3b9fa6
7
nbproject/build-impl.xml.script.CRC32=6370b77c
8
nbproject/build-impl.xml.stylesheet.CRC32=8335d67d@1.24.1.1
9
nbproject/jaxws-build.xml.stylesheet.CRC32=b0a0073f
trunk/src/nbproject/jax-ws.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<jax-ws xmlns="http://www.netbeans.org/ns/jax-ws/1">
3
  <services>
4
  </services>
5
  <clients/>
6
  <jsr109>false</jsr109>
7
</jax-ws>
trunk/src/nbproject/ant-deploy.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project default="-deploy-ant" basedir=".">
3
    <target name="-init" if="deploy.ant.enabled">
4
        <property file="${deploy.ant.properties.file}"/>
5
        <tempfile property="temp.module.folder" prefix="tomcat" destdir="${java.io.tmpdir}"/>
6
        <unwar src="${deploy.ant.archive}" dest="${temp.module.folder}">
7
            <patternset includes="META-INF/context.xml"/>
8
        </unwar>
9
        <xmlproperty file="${temp.module.folder}/META-INF/context.xml"/>
10
        <delete dir="${temp.module.folder}"/>
11
    </target>
12
    <target name="-deploy-ant" if="deploy.ant.enabled" depends="-init">
13
        <echo message="Deploying ${deploy.ant.archive} to ${Context(path)}"/>
14
        <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"
15
                 classpath="${tomcat.home}/lib/catalina-ant.jar"/>
16
        <deploy url="${tomcat.url}/manager" username="${tomcat.username}"
17
                password="${tomcat.password}" path="${Context(path)}"
18
                war="${deploy.ant.archive}"/>
19
        <property name="deploy.ant.client.url" value="${tomcat.url}${Context(path)}"/>
20
    </target>
21
    <target name="-undeploy-ant" if="deploy.ant.enabled" depends="-init">
22
        <echo message="Undeploying ${Context(path)}"/>
23
        <taskdef name="undeploy"  classname="org.apache.catalina.ant.UndeployTask"
24
                classpath="${tomcat.home}/lib/catalina-ant.jar"/>
25
        <undeploy url="${tomcat.url}/manager" username="${tomcat.username}" 
26
                  password="${tomcat.password}" path="${Context(path)}"/>
27
    </target>
28
</project>
trunk/src/nbproject/build-impl.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
        *** GENERATED FROM project.xml - DO NOT EDIT  ***
4
        ***         EDIT ../build.xml INSTEAD         ***
5

  
6
        For the purpose of easier reading the script
7
        is divided into following sections:
8
        - initialization
9
        - compilation
10
        - dist
11
        - execution
12
        - debugging
13
        - javadoc
14
        - junit compilation
15
        - junit execution
16
        - junit debugging
17
        - cleanup
18

  
19
        -->
20
<project xmlns:webproject1="http://www.netbeans.org/ns/web-project/1" xmlns:webproject2="http://www.netbeans.org/ns/web-project/2" xmlns:webproject3="http://www.netbeans.org/ns/web-project/3" basedir=".." default="default" name="LIDAR_SOAP-impl">
21
    <import file="ant-deploy.xml"/>
22
    <fail message="Please build using Ant 1.7.1 or higher.">
23
        <condition>
24
            <not>
25
                <antversion atleast="1.7.1"/>
26
            </not>
27
        </condition>
28
    </fail>
29
    <target depends="dist,javadoc" description="Build whole project." name="default"/>
30
    <!--
31
                INITIALIZATION SECTION
32
            -->
33
    <target name="-pre-init">
34
        <!-- Empty placeholder for easier customization. -->
35
        <!-- You can override this target in the ../build.xml file. -->
36
    </target>
37
    <target depends="-pre-init" name="-init-private">
38
        <property file="nbproject/private/private.properties"/>
39
    </target>
40
    <target depends="-pre-init,-init-private" name="-init-user">
41
        <property file="${user.properties.file}"/>
42
        <!-- The two properties below are usually overridden -->
43
        <!-- by the active platform. Just a fallback. -->
44
        <property name="default.javac.source" value="1.4"/>
45
        <property name="default.javac.target" value="1.4"/>
46
    </target>
47
    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
48
        <property file="nbproject/project.properties"/>
49
    </target>
50
    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" if="dist.ear.dir" name="-do-ear-init"/>
51
    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
52
        <condition property="have.tests">
53
            <or>
54
                <available file="${test.src.dir}"/>
55
            </or>
56
        </condition>
57
        <condition property="have.sources">
58
            <or>
59
                <available file="${src.dir}"/>
60
            </or>
61
        </condition>
62
        <condition property="netbeans.home+have.tests">
63
            <and>
64
                <isset property="netbeans.home"/>
65
                <isset property="have.tests"/>
66
            </and>
67
        </condition>
68
        <condition property="no.javadoc.preview">
69
            <isfalse value="${javadoc.preview}"/>
70
        </condition>
71
        <property name="javac.compilerargs" value=""/>
72
        <condition property="no.deps">
73
            <and>
74
                <istrue value="${no.dependencies}"/>
75
            </and>
76
        </condition>
77
        <condition property="no.dist.ear.dir">
78
            <not>
79
                <isset property="dist.ear.dir"/>
80
            </not>
81
        </condition>
82
        <property name="build.web.excludes" value="${build.classes.excludes}"/>
83
        <condition property="do.compile.jsps">
84
            <istrue value="${compile.jsps}"/>
85
        </condition>
86
        <condition property="do.debug.server">
87
            <or>
88
                <not>
89
                    <isset property="debug.server"/>
90
                </not>
91
                <istrue value="${debug.server}"/>
92
                <and>
93
                    <not>
94
                        <istrue value="${debug.server}"/>
95
                    </not>
96
                    <not>
97
                        <istrue value="${debug.client}"/>
98
                    </not>
99
                </and>
100
            </or>
101
        </condition>
102
        <condition property="do.debug.client">
103
            <istrue value="${debug.client}"/>
104
        </condition>
105
        <condition property="do.display.browser">
106
            <istrue value="${display.browser}"/>
107
        </condition>
108
        <condition property="do.display.browser.debug">
109
            <and>
110
                <isset property="do.display.browser"/>
111
                <not>
112
                    <isset property="do.debug.client"/>
113
                </not>
114
            </and>
115
        </condition>
116
        <available file="${conf.dir}/MANIFEST.MF" property="has.custom.manifest"/>
117
        <available file="${persistence.xml.dir}/persistence.xml" property="has.persistence.xml"/>
118
        <condition property="do.war.package.with.custom.manifest">
119
            <isset property="has.custom.manifest"/>
120
        </condition>
121
        <condition property="do.war.package.without.custom.manifest">
122
            <not>
123
                <isset property="has.custom.manifest"/>
124
            </not>
125
        </condition>
126
        <condition property="do.tmp.war.package.with.custom.manifest">
127
            <and>
128
                <isset property="has.custom.manifest"/>
129
                <or>
130
                    <isfalse value="${directory.deployment.supported}"/>
131
                    <isset property="dist.ear.dir"/>
132
                </or>
133
            </and>
134
        </condition>
135
        <condition property="do.tmp.war.package.without.custom.manifest">
136
            <and>
137
                <not>
138
                    <isset property="has.custom.manifest"/>
139
                </not>
140
                <or>
141
                    <isfalse value="${directory.deployment.supported}"/>
142
                    <isset property="dist.ear.dir"/>
143
                </or>
144
            </and>
145
        </condition>
146
        <condition property="do.tmp.war.package">
147
            <or>
148
                <isfalse value="${directory.deployment.supported}"/>
149
                <isset property="dist.ear.dir"/>
150
            </or>
151
        </condition>
152
        <property name="build.meta.inf.dir" value="${build.web.dir}/META-INF"/>
153
        <condition else="" property="application.args.param" value="${application.args}">
154
            <and>
155
                <isset property="application.args"/>
156
                <not>
157
                    <equals arg1="${application.args}" arg2="" trim="true"/>
158
                </not>
159
            </and>
160
        </condition>
161
        <property name="source.encoding" value="${file.encoding}"/>
162
        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
163
            <and>
164
                <isset property="javadoc.encoding"/>
165
                <not>
166
                    <equals arg1="${javadoc.encoding}" arg2=""/>
167
                </not>
168
            </and>
169
        </condition>
170
        <property name="javadoc.encoding.used" value="${source.encoding}"/>
171
        <property name="includes" value="**"/>
172
        <property name="excludes" value=""/>
173
        <property name="runmain.jvmargs" value=""/>
174
        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
175
        <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
176
            <length length="0" string="${endorsed.classpath}" when="greater"/>
177
        </condition>
178
    </target>
179
    <target depends="init" name="-init-cos" unless="deploy.on.save">
180
        <condition property="deploy.on.save" value="true">
181
            <istrue value="${j2ee.deploy.on.save}"/>
182
        </condition>
183
    </target>
184
    <target name="-post-init">
185
        <!-- Empty placeholder for easier customization. -->
186
        <!-- You can override this target in the ../build.xml file. -->
187
    </target>
188
    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
189
        <fail unless="src.dir">Must set src.dir</fail>
190
        <fail unless="test.src.dir">Must set test.src.dir</fail>
191
        <fail unless="build.dir">Must set build.dir</fail>
192
        <fail unless="build.web.dir">Must set build.web.dir</fail>
193
        <fail unless="build.generated.dir">Must set build.generated.dir</fail>
194
        <fail unless="dist.dir">Must set dist.dir</fail>
195
        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
196
        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
197
        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
198
        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
199
        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
200
        <fail unless="dist.war">Must set dist.war</fail>
201
        <condition property="missing.j2ee.server.home">
202
            <and>
203
                <matches pattern="j2ee.server.home" string="${j2ee.platform.classpath}"/>
204
                <not>
205
                    <isset property="j2ee.server.home"/>
206
                </not>
207
            </and>
208
        </condition>
209
        <fail if="missing.j2ee.server.home">
210
The Java EE server classpath is not correctly set up - server home directory is missing.
211
Either open the project in the IDE and assign the server or setup the server classpath manually.
212
For example like this:
213
   ant -Dj2ee.server.home=&lt;app_server_installation_directory&gt;
214
                </fail>
215
        <fail unless="j2ee.platform.classpath">
216
The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}.
217
Either open the project in the IDE and assign the server or setup the server classpath manually.
218
For example like this:
219
   ant -Duser.properties.file=&lt;path_to_property_file&gt; (where you put the property "j2ee.platform.classpath" in a .properties file)
220
or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties file is used)
221
                </fail>
222
    </target>
223
    <target name="-init-macrodef-property">
224
        <macrodef name="property" uri="http://www.netbeans.org/ns/web-project/1">
225
            <attribute name="name"/>
226
            <attribute name="value"/>
227
            <sequential>
228
                <property name="@{name}" value="${@{value}}"/>
229
            </sequential>
230
        </macrodef>
231
    </target>
232
    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
233
        <macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2">
234
            <attribute default="${src.dir}" name="srcdir"/>
235
            <attribute default="${build.classes.dir}" name="destdir"/>
236
            <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
237
            <attribute default="${javac.processorpath}" name="processorpath"/>
238
            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
239
            <attribute default="${includes}" name="includes"/>
240
            <attribute default="${excludes}" name="excludes"/>
241
            <attribute default="${javac.debug}" name="debug"/>
242
            <attribute default="${empty.dir}" name="gensrcdir"/>
243
            <element name="customize" optional="true"/>
244
            <sequential>
245
                <property location="${build.dir}/empty" name="empty.dir"/>
246
                <mkdir dir="${empty.dir}"/>
247
                <mkdir dir="@{apgeneratedsrcdir}"/>
248
                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}">
249
                    <src>
250
                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
251
                            <include name="*"/>
252
                        </dirset>
253
                    </src>
254
                    <classpath>
255
                        <path path="@{classpath}"/>
256
                    </classpath>
257
                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
258
                    <compilerarg line="${javac.compilerargs}"/>
259
                    <compilerarg value="-processorpath"/>
260
                    <compilerarg path="@{processorpath}:${empty.dir}"/>
261
                    <compilerarg line="${ap.processors.internal}"/>
262
                    <compilerarg value="-s"/>
263
                    <compilerarg path="@{apgeneratedsrcdir}"/>
264
                    <compilerarg line="${ap.proc.none.internal}"/>
265
                    <customize/>
266
                </javac>
267
            </sequential>
268
        </macrodef>
269
    </target>
270
    <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
271
        <macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2">
272
            <attribute default="${src.dir}" name="srcdir"/>
273
            <attribute default="${build.classes.dir}" name="destdir"/>
274
            <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
275
            <attribute default="${javac.processorpath}" name="processorpath"/>
276
            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
277
            <attribute default="${includes}" name="includes"/>
278
            <attribute default="${excludes}" name="excludes"/>
279
            <attribute default="${javac.debug}" name="debug"/>
280
            <attribute default="${empty.dir}" name="gensrcdir"/>
281
            <element name="customize" optional="true"/>
282
            <sequential>
283
                <property location="${build.dir}/empty" name="empty.dir"/>
284
                <mkdir dir="${empty.dir}"/>
285
                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}">
286
                    <src>
287
                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
288
                            <include name="*"/>
289
                        </dirset>
290
                    </src>
291
                    <classpath>
292
                        <path path="@{classpath}"/>
293
                    </classpath>
294
                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
295
                    <compilerarg line="${javac.compilerargs}"/>
296
                    <customize/>
297
                </javac>
298
            </sequential>
299
        </macrodef>
300
    </target>
301
    <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
302
        <macrodef name="depend" uri="http://www.netbeans.org/ns/web-project/2">
303
            <attribute default="${src.dir}" name="srcdir"/>
304
            <attribute default="${build.classes.dir}" name="destdir"/>
305
            <attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
306
            <sequential>
307
                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
308
                    <classpath>
309
                        <path path="@{classpath}"/>
310
                    </classpath>
311
                </depend>
312
            </sequential>
313
        </macrodef>
314
        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/web-project/2">
315
            <attribute default="${build.classes.dir}" name="destdir"/>
316
            <sequential>
317
                <fail unless="javac.includes">Must set javac.includes</fail>
318
                <pathconvert pathsep="," property="javac.includes.binary">
319
                    <path>
320
                        <filelist dir="@{destdir}" files="${javac.includes}"/>
321
                    </path>
322
                    <globmapper from="*.java" to="*.class"/>
323
                </pathconvert>
324
                <delete>
325
                    <files includes="${javac.includes.binary}"/>
326
                </delete>
327
            </sequential>
328
        </macrodef>
329
    </target>
330
    <target name="-init-macrodef-junit">
331
        <macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2">
332
            <attribute default="${includes}" name="includes"/>
333
            <attribute default="${excludes}" name="excludes"/>
334
            <attribute default="**" name="testincludes"/>
335
            <sequential>
336
                <junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${java.io.tmpdir}">
337
                    <batchtest todir="${build.test.results.dir}">
338
                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
339
                            <filename name="@{testincludes}"/>
340
                        </fileset>
341
                    </batchtest>
342
                    <classpath>
343
                        <path path="${run.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}"/>
344
                    </classpath>
345
                    <syspropertyset>
346
                        <propertyref prefix="test-sys-prop."/>
347
                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
348
                    </syspropertyset>
349
                    <formatter type="brief" usefile="false"/>
350
                    <formatter type="xml"/>
351
                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
352
                    <jvmarg line="${runmain.jvmargs}"/>
353
                </junit>
354
            </sequential>
355
        </macrodef>
356
    </target>
357
    <target name="-init-macrodef-java">
358
        <macrodef name="java" uri="http://www.netbeans.org/ns/web-project/1">
359
            <attribute default="${main.class}" name="classname"/>
360
            <attribute default="${debug.classpath}" name="classpath"/>
361
            <element name="customize" optional="true"/>
362
            <sequential>
363
                <java classname="@{classname}" fork="true">
364
                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
365
                    <jvmarg line="${runmain.jvmargs}"/>
366
                    <classpath>
367
                        <path path="@{classpath}:${j2ee.platform.classpath}"/>
368
                    </classpath>
369
                    <syspropertyset>
370
                        <propertyref prefix="run-sys-prop."/>
371
                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
372
                    </syspropertyset>
373
                    <customize/>
374
                </java>
375
            </sequential>
376
        </macrodef>
377
    </target>
378
    <target name="-init-macrodef-nbjsdebug">
379
        <macrodef name="nbjsdebugstart" uri="http://www.netbeans.org/ns/web-project/1">
380
            <attribute default="${client.url}" name="webUrl"/>
381
            <sequential>
382
                <nbjsdebugstart urlPart="${client.urlPart}" webUrl="@{webUrl}"/>
383
            </sequential>
384
        </macrodef>
385
    </target>
386
    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
387
        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/web-project/1">
388
            <attribute default="${main.class}" name="name"/>
389
            <attribute default="${debug.classpath}:${j2ee.platform.classpath}" name="classpath"/>
390
            <sequential>
391
                <nbjpdastart addressproperty="jpda.address" name="@{name}" transport="${debug-transport}">
392
                    <classpath>
393
                        <path path="@{classpath}"/>
394
                    </classpath>
395
                </nbjpdastart>
396
            </sequential>
397
        </macrodef>
398
        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/web-project/1">
399
            <attribute default="${build.classes.dir}" name="dir"/>
400
            <sequential>
401
                <nbjpdareload>
402
                    <fileset dir="@{dir}" includes="${fix.classes}">
403
                        <include name="${fix.includes}*.class"/>
404
                    </fileset>
405
                </nbjpdareload>
406
            </sequential>
407
        </macrodef>
408
        <macrodef name="nbjpdaappreloaded" uri="http://www.netbeans.org/ns/web-project/1">
409
            <sequential>
410
                <nbjpdaappreloaded/>
411
            </sequential>
412
        </macrodef>
413
    </target>
414
    <target name="-init-debug-args">
415
        <property name="version-output" value="java version &quot;${ant.java.version}"/>
416
        <condition property="have-jdk-older-than-1.4">
417
            <or>
418
                <contains string="${version-output}" substring="java version &quot;1.0"/>
419
                <contains string="${version-output}" substring="java version &quot;1.1"/>
420
                <contains string="${version-output}" substring="java version &quot;1.2"/>
421
                <contains string="${version-output}" substring="java version &quot;1.3"/>
422
            </or>
423
        </condition>
424
        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
425
            <istrue value="${have-jdk-older-than-1.4}"/>
426
        </condition>
427
        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
428
            <os family="windows"/>
429
        </condition>
430
        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
431
            <isset property="debug.transport"/>
432
        </condition>
433
    </target>
434
    <target depends="-init-debug-args" name="-init-macrodef-debug">
435
        <macrodef name="debug" uri="http://www.netbeans.org/ns/web-project/1">
436
            <attribute default="${main.class}" name="classname"/>
437
            <attribute default="${debug.classpath}:${j2ee.platform.classpath}" name="classpath"/>
438
            <attribute default="${application.args.param}" name="args"/>
439
            <element name="customize" optional="true"/>
440
            <sequential>
441
                <java classname="@{classname}" fork="true">
442
                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
443
                    <jvmarg line="${debug-args-line}"/>
444
                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
445
                    <jvmarg line="${runmain.jvmargs}"/>
446
                    <classpath>
447
                        <path path="@{classpath}"/>
448
                    </classpath>
449
                    <syspropertyset>
450
                        <propertyref prefix="run-sys-prop."/>
451
                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
452
                    </syspropertyset>
453
                    <arg line="@{args}"/>
454
                    <customize/>
455
                </java>
456
            </sequential>
457
        </macrodef>
458
    </target>
459
    <target name="-init-taskdefs">
460
        <fail unless="libs.CopyLibs.classpath">
461
The libs.CopyLibs.classpath property is not set up.
462
This property must point to 
463
org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part
464
of NetBeans IDE installation and is usually located at 
465
&lt;netbeans_installation&gt;/java&lt;version&gt;/ant/extra folder.
466
Either open the project in the IDE and make sure CopyLibs library
467
exists or setup the property manually. For example like this:
468
 ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar
469
                </fail>
470
        <taskdef classpath="${libs.CopyLibs.classpath}" resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml"/>
471
    </target>
472
    <target name="-init-ap-cmdline-properties">
473
        <property name="annotation.processing.enabled" value="true"/>
474
        <property name="annotation.processing.processors.list" value=""/>
475
        <property name="annotation.processing.run.all.processors" value="true"/>
476
        <property name="javac.processorpath" value="${javac.classpath}"/>
477
        <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
478
        <condition property="ap.supported.internal" value="true">
479
            <not>
480
                <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
481
            </not>
482
        </condition>
483
    </target>
484
    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
485
        <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
486
            <isfalse value="${annotation.processing.run.all.processors}"/>
487
        </condition>
488
        <condition else="" property="ap.proc.none.internal" value="-proc:none">
489
            <isfalse value="${annotation.processing.enabled}"/>
490
        </condition>
491
    </target>
492
    <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
493
        <property name="ap.cmd.line.internal" value=""/>
494
    </target>
495
    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-nbjsdebug,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline" name="init"/>
496
    <!--
497
                COMPILATION SECTION
498
            -->
499
    <target depends="init" if="no.dist.ear.dir" name="deps-module-jar" unless="no.deps"/>
500
    <target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps"/>
501
    <target depends="init, deps-module-jar, deps-ear-jar" name="deps-jar" unless="no.deps"/>
502
    <target depends="init,deps-jar" name="-pre-pre-compile">
503
        <mkdir dir="${build.classes.dir}"/>
504
    </target>
505
    <target name="-pre-compile">
506
        <!-- Empty placeholder for easier customization. -->
507
        <!-- You can override this target in the ../build.xml file. -->
508
    </target>
509
    <target name="-copy-webdir">
510
        <copy todir="${build.web.dir}">
511
            <fileset dir="${web.docbase.dir}" excludes="${build.web.excludes},${excludes}" includes="${includes}"/>
512
        </copy>
513
        <copy todir="${build.web.dir}/WEB-INF">
514
            <fileset dir="${webinf.dir}" excludes="${build.web.excludes}"/>
515
        </copy>
516
    </target>
517
    <target depends="init, deps-jar, -pre-pre-compile, -pre-compile, -copy-manifest, -copy-persistence-xml, -copy-webdir, library-inclusion-in-archive,library-inclusion-in-manifest" if="have.sources" name="-do-compile">
518
        <webproject2:javac destdir="${build.classes.dir}" gensrcdir="${build.generated.sources.dir}"/>
519
        <copy todir="${build.classes.dir}">
520
            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
521
        </copy>
522
    </target>
523
    <target if="has.custom.manifest" name="-copy-manifest">
524
        <mkdir dir="${build.meta.inf.dir}"/>
525
        <copy todir="${build.meta.inf.dir}">
526
            <fileset dir="${conf.dir}" includes="MANIFEST.MF"/>
527
        </copy>
528
    </target>
529
    <target if="has.persistence.xml" name="-copy-persistence-xml">
530
        <mkdir dir="${build.web.dir}/WEB-INF/classes/META-INF"/>
531
        <copy todir="${build.web.dir}/WEB-INF/classes/META-INF">
532
            <fileset dir="${persistence.xml.dir}" includes="persistence.xml"/>
533
        </copy>
534
    </target>
535
    <target name="-post-compile">
536
        <!-- Empty placeholder for easier customization. -->
537
        <!-- You can override this target in the ../build.xml file. -->
538
    </target>
539
    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
540
    <target name="-pre-compile-single">
541
        <!-- Empty placeholder for easier customization. -->
542
        <!-- You can override this target in the ../build.xml file. -->
543
    </target>
544
    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
545
        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
546
        <webproject2:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}"/>
547
        <copy todir="${build.classes.dir}">
548
            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
549
        </copy>
550
    </target>
551
    <target name="-post-compile-single">
552
        <!-- Empty placeholder for easier customization. -->
553
        <!-- You can override this target in the ../build.xml file. -->
554
    </target>
555
    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
556
    <target depends="compile" description="Test compile JSP pages to expose compilation errors." if="do.compile.jsps" name="compile-jsps">
557
        <mkdir dir="${build.generated.dir}/src"/>
558
        <java classname="org.netbeans.modules.web.project.ant.JspC" failonerror="true" fork="true">
559
            <arg value="-uriroot"/>
560
            <arg file="${basedir}/${build.web.dir}"/>
561
            <arg value="-d"/>
562
            <arg file="${basedir}/${build.generated.dir}/src"/>
563
            <arg value="-die1"/>
564
            <arg value="-compilerSourceVM ${javac.source}"/>
565
            <arg value="-compilerTargetVM ${javac.target}"/>
566
            <arg value="-javaEncoding ${source.encoding}"/>
567
            <classpath path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/>
568
        </java>
569
        <mkdir dir="${build.generated.dir}/classes"/>
570
        <webproject2:javac classpath="${build.classes.dir}:${libs.jsp-compilation.classpath}:${javac.classpath}:${j2ee.platform.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src"/>
571
    </target>
572
    <target depends="compile" if="jsp.includes" name="-do-compile-single-jsp">
573
        <fail unless="javac.jsp.includes">Must select some files in the IDE or set javac.jsp.includes</fail>
574
        <mkdir dir="${build.generated.dir}/src"/>
575
        <java classname="org.netbeans.modules.web.project.ant.JspCSingle" failonerror="true" fork="true">
576
            <arg value="-uriroot"/>
577
            <arg file="${basedir}/${build.web.dir}"/>
578
            <arg value="-d"/>
579
            <arg file="${basedir}/${build.generated.dir}/src"/>
580
            <arg value="-die1"/>
581
            <arg value="-jspc.files"/>
582
            <arg path="${jsp.includes}"/>
583
            <arg value="-compilerSourceVM ${javac.source}"/>
584
            <arg value="-compilerTargetVM ${javac.target}"/>
585
            <arg value="-javaEncoding ${source.encoding}"/>
586
            <classpath path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/>
587
        </java>
588
        <mkdir dir="${build.generated.dir}/classes"/>
589
        <webproject2:javac classpath="${build.classes.dir}:${libs.jsp-compilation.classpath}:${javac.classpath}:${j2ee.platform.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src">
590
            <customize>
591
                <patternset includes="${javac.jsp.includes}"/>
592
            </customize>
593
        </webproject2:javac>
594
    </target>
595
    <target name="compile-single-jsp">
596
        <fail unless="jsp.includes">Must select a file in the IDE or set jsp.includes</fail>
597
        <antcall target="-do-compile-single-jsp"/>
598
    </target>
599
    <!--
600
                DIST BUILDING SECTION
601
            -->
602
    <target name="-pre-dist">
603
        <!-- Empty placeholder for easier customization. -->
604
        <!-- You can override this target in the ../build.xml file. -->
605
    </target>
606
    <target depends="init,compile,compile-jsps,-pre-dist" if="do.war.package.without.custom.manifest" name="-do-dist-without-manifest">
607
        <dirname file="${dist.war}" property="dist.jar.dir"/>
608
        <mkdir dir="${dist.jar.dir}"/>
609
        <jar compress="${jar.compress}" jarfile="${dist.war}">
610
            <fileset dir="${build.web.dir}"/>
611
        </jar>
612
    </target>
613
    <target depends="init,compile,compile-jsps,-pre-dist" if="do.war.package.with.custom.manifest" name="-do-dist-with-manifest">
614
        <dirname file="${dist.war}" property="dist.jar.dir"/>
615
        <mkdir dir="${dist.jar.dir}"/>
616
        <jar compress="${jar.compress}" jarfile="${dist.war}" manifest="${build.meta.inf.dir}/MANIFEST.MF">
617
            <fileset dir="${build.web.dir}"/>
618
        </jar>
619
    </target>
620
    <target depends="init,compile,compile-jsps,-pre-dist" if="do.tmp.war.package.without.custom.manifest" name="-do-tmp-dist-without-manifest">
621
        <dirname file="${dist.war}" property="dist.jar.dir"/>
622
        <mkdir dir="${dist.jar.dir}"/>
623
        <jar compress="${jar.compress}" jarfile="${dist.war}">
624
            <fileset dir="${build.web.dir}"/>
625
        </jar>
626
    </target>
627
    <target depends="init,compile,compile-jsps,-pre-dist" if="do.tmp.war.package.with.custom.manifest" name="-do-tmp-dist-with-manifest">
628
        <dirname file="${dist.war}" property="dist.jar.dir"/>
629
        <mkdir dir="${dist.jar.dir}"/>
630
        <jar compress="${jar.compress}" jarfile="${dist.war}" manifest="${build.meta.inf.dir}/MANIFEST.MF">
631
            <fileset dir="${build.web.dir}"/>
632
        </jar>
633
    </target>
634
    <target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/>
635
    <target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
636
        <copyfiles files="${libs.hibernate-support.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
637
        <copyfiles files="${libs.ejb3-persistence.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
638
        <copyfiles files="${file.reference.mysql-connector-java-5.1.6-bin.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
639
        <copyfiles files="${libs.metro.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
640
        <copyfiles files="${file.reference.gson-1.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
641
        <copyfiles files="${libs.JavaComm.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
642
        <copyfiles files="${file.reference.JPam-1.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
643
        <copyfiles files="${file.reference.commons-configuration-1.6.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
644
        <copyfiles files="${file.reference.commons-lang-2.5.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
645
        <copyfiles files="${file.reference.commons-collections-3.2.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
646
        <copyfiles files="${file.reference.gson-1.3.jar-1}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
647
        <mkdir dir="${build.web.dir}/META-INF"/>
648
        <manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
649
    </target>
650
    <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
651
        <copyfiles files="${libs.hibernate-support.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
652
        <copyfiles files="${libs.ejb3-persistence.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
653
        <copyfiles files="${file.reference.mysql-connector-java-5.1.6-bin.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
654
        <copyfiles files="${libs.metro.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
655
        <copyfiles files="${file.reference.gson-1.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
656
        <copyfiles files="${libs.JavaComm.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
657
        <copyfiles files="${file.reference.JPam-1.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
658
        <copyfiles files="${file.reference.commons-configuration-1.6.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
659
        <copyfiles files="${file.reference.commons-lang-2.5.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
660
        <copyfiles files="${file.reference.commons-collections-3.2.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
661
        <copyfiles files="${file.reference.gson-1.3.jar-1}" todir="${build.web.dir}/WEB-INF/lib"/>
662
    </target>
663
    <target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
664
        <delete dir="${build.web.dir}/WEB-INF/lib"/>
665
    </target>
666
    <target depends="init,-clean-webinf-lib,compile,compile-jsps,-pre-dist,library-inclusion-in-manifest" if="do.tmp.war.package" name="do-ear-dist">
667
        <dirname file="${dist.ear.war}" property="dist.jar.dir"/>
668
        <mkdir dir="${dist.jar.dir}"/>
669
        <jar compress="${jar.compress}" jarfile="${dist.ear.war}" manifest="${build.web.dir}/META-INF/MANIFEST.MF">
670
            <fileset dir="${build.web.dir}"/>
671
        </jar>
672
    </target>
673
    <target name="-post-dist">
674
        <!-- Empty placeholder for easier customization. -->
675
        <!-- You can override this target in the ../build.xml file. -->
676
    </target>
677
    <target depends="init,compile,-pre-dist,do-dist,-post-dist" description="Build distribution (WAR)." name="dist"/>
678
    <target depends="init,-clean-webinf-lib,-init-cos,compile,-pre-dist,do-ear-dist,-post-dist" description="Build distribution (WAR) to be packaged into an EAR." name="dist-ear"/>
679
    <!--
680
                EXECUTION SECTION
681
            -->
682
    <target depends="run-deploy,run-display-browser" description="Deploy to server and show in browser." name="run"/>
683
    <target name="-pre-run-deploy">
684
        <!-- Empty placeholder for easier customization. -->
685
        <!-- You can override this target in the ../build.xml file. -->
686
    </target>
687
    <target name="-post-run-deploy">
688
        <!-- Empty placeholder for easier customization. -->
689
        <!-- You can override this target in the ../build.xml file. -->
690
    </target>
691
    <target name="-pre-nbmodule-run-deploy">
692
        <!-- Empty placeholder for easier customization. -->
693
        <!-- This target can be overriden by NetBeans modules. Don't override it directly, use -pre-run-deploy task instead. -->
694
    </target>
695
    <target name="-post-nbmodule-run-deploy">
696
        <!-- Empty placeholder for easier customization. -->
697
        <!-- This target can be overriden by NetBeans modules. Don't override it directly, use -post-run-deploy task instead. -->
698
    </target>
699
    <target name="-run-deploy-am">
700
        <!-- Task to deploy to the Access Manager runtime. -->
701
    </target>
702
    <target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest,-pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,-post-run-deploy" name="run-deploy">
703
        <nbjpdaappreloaded/>
704
    </target>
705
    <target if="netbeans.home" name="-run-deploy-nb">
706
        <nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
707
    </target>
708
    <target name="-init-deploy-ant" unless="netbeans.home">
709
        <property name="deploy.ant.archive" value="${dist.war}"/>
710
        <property name="deploy.ant.docbase.dir" value="${web.docbase.dir}"/>
711
        <property name="deploy.ant.resource.dir" value="${resource.dir}"/>
712
        <property name="deploy.ant.enabled" value="true"/>
713
    </target>
714
    <target depends="dist,-run-undeploy-nb,-init-deploy-ant,-undeploy-ant" name="run-undeploy"/>
715
    <target if="netbeans.home" name="-run-undeploy-nb">
716
        <fail message="Undeploy is not supported from within the IDE"/>
717
    </target>
718
    <target depends="init,-pre-dist,dist,-post-dist" name="verify">
719
        <nbverify file="${dist.war}"/>
720
    </target>
721
    <target depends="run-deploy,-init-display-browser,-display-browser-nb,-display-browser-cl" name="run-display-browser"/>
722
    <target if="do.display.browser" name="-init-display-browser">
723
        <condition property="do.display.browser.nb">
724
            <isset property="netbeans.home"/>
725
        </condition>
726
        <condition property="do.display.browser.cl">
727
            <isset property="deploy.ant.enabled"/>
728
        </condition>
729
    </target>
730
    <target if="do.display.browser.nb" name="-display-browser-nb">
731
        <nbbrowse url="${client.url}"/>
732
    </target>
733
    <target if="do.display.browser.cl" name="-get-browser" unless="browser">
734
        <condition property="browser" value="rundll32">
735
            <os family="windows"/>
736
        </condition>
737
        <condition else="" property="browser.args" value="url.dll,FileProtocolHandler">
738
            <os family="windows"/>
739
        </condition>
740
        <condition property="browser" value="/usr/bin/open">
741
            <os family="mac"/>
742
        </condition>
743
        <property environment="env"/>
744
        <condition property="browser" value="${env.BROWSER}">
745
            <isset property="env.BROWSER"/>
746
        </condition>
747
        <condition property="browser" value="/usr/bin/firefox">
748
            <available file="/usr/bin/firefox"/>
749
        </condition>
750
        <condition property="browser" value="/usr/local/firefox/firefox">
751
            <available file="/usr/local/firefox/firefox"/>
752
        </condition>
753
        <condition property="browser" value="/usr/bin/mozilla">
754
            <available file="/usr/bin/mozilla"/>
755
        </condition>
756
        <condition property="browser" value="/usr/local/mozilla/mozilla">
757
            <available file="/usr/local/mozilla/mozilla"/>
758
        </condition>
759
        <condition property="browser" value="/usr/sfw/lib/firefox/firefox">
760
            <available file="/usr/sfw/lib/firefox/firefox"/>
761
        </condition>
762
        <condition property="browser" value="/opt/csw/bin/firefox">
763
            <available file="/opt/csw/bin/firefox"/>
764
        </condition>
765
        <condition property="browser" value="/usr/sfw/lib/mozilla/mozilla">
766
            <available file="/usr/sfw/lib/mozilla/mozilla"/>
767
        </condition>
768
        <condition property="browser" value="/opt/csw/bin/mozilla">
769
            <available file="/opt/csw/bin/mozilla"/>
770
        </condition>
771
    </target>
772
    <target depends="-get-browser" if="do.display.browser.cl" name="-display-browser-cl">
773
        <fail unless="browser">
774
                    Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable.
775
                </fail>
776
        <property name="browse.url" value="${deploy.ant.client.url}${client.urlPart}"/>
777
        <echo>Launching ${browse.url}</echo>
778
        <exec executable="${browser}" spawn="true">
779
            <arg line="${browser.args} ${browse.url}"/>
780
        </exec>
781
    </target>
782
    <target depends="init,-init-cos,compile-single" name="run-main">
783
        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
784
        <webproject1:java classname="${run.class}"/>
785
    </target>
786
    <target depends="init,compile-test-single,-pre-test-run-single" name="run-test-with-main">
787
        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
788
        <webproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
789
    </target>
790
    <!--
791
                DEBUGGING SECTION
792
            -->
793
    <target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest" description="Debug project in IDE." if="netbeans.home" name="debug">
794
        <nbstartserver debugmode="true"/>
795
        <antcall target="connect-debugger"/>
796
        <nbdeploy clientUrlPart="${client.urlPart}" debugmode="true" forceRedeploy="true"/>
797
        <antcall target="debug-display-browser"/>
798
        <antcall target="connect-client-debugger"/>
799
    </target>
800
    <target if="do.debug.server" name="connect-debugger" unless="is.debugged">
801
        <nbjpdaconnect address="${jpda.address}" host="${jpda.host}" name="${name}" transport="${jpda.transport}">
802
            <classpath>
803
                <path path="${debug.classpath}:${j2ee.platform.classpath}"/>
804
            </classpath>
805
            <sourcepath>
806
                <path path="${web.docbase.dir}"/>
807
            </sourcepath>
808
        </nbjpdaconnect>
809
    </target>
810
    <target if="do.display.browser.debug" name="debug-display-browser">
811
        <nbbrowse url="${client.url}"/>
812
    </target>
813
    <target if="do.debug.client" name="connect-client-debugger">
814
        <webproject1:nbjsdebugstart webUrl="${client.url}"/>
815
    </target>
816
    <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
817
        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
818
        <webproject1:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
819
    </target>
820
    <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
821
    <target depends="init,compile,compile-jsps,-do-compile-single-jsp,debug" if="netbeans.home" name="debug-single"/>
822
    <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
823
        <webproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
824
    </target>
825
    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
826
        <webproject1:nbjpdastart name="${debug.class}"/>
827
    </target>
828
    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
829
        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
830
        <webproject1:debug classname="${debug.class}"/>
831
    </target>
832
    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single-main"/>
833
    <target depends="init" name="-pre-debug-fix">
834
        <fail unless="fix.includes">Must set fix.includes</fail>
835
        <property name="javac.includes" value="${fix.includes}.java"/>
836
    </target>
837
    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
838
        <webproject1:nbjpdareload/>
839
    </target>
840
    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
841
    <!--
842
                JAVADOC SECTION
843
            -->
844
    <target depends="init" if="have.sources" name="javadoc-build">
845
        <mkdir dir="${dist.javadoc.dir}"/>
846
        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
847
            <classpath>
848
                <path path="${javac.classpath}:${j2ee.platform.classpath}"/>
849
            </classpath>
850
            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
851
                <filename name="**/*.java"/>
852
            </fileset>
853
            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
854
                <include name="**/*.java"/>
855
            </fileset>
856
        </javadoc>
857
    </target>
858
    <target depends="init,javadoc-build" if="netbeans.home" name="javadoc-browse" unless="no.javadoc.preview">
859
        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
860
    </target>
861
    <target depends="init,javadoc-build,javadoc-browse" description="Build Javadoc." name="javadoc"/>
862
    <!--
863
                
864
                JUNIT COMPILATION SECTION
865
            -->
866
    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
867
        <mkdir dir="${build.test.classes.dir}"/>
868
        <property name="j2ee.platform.embeddableejb.classpath" value=""/>
869
    </target>
870
    <target name="-pre-compile-test">
871
        <!-- Empty placeholder for easier customization. -->
872
        <!-- You can override this target in the ../build.xml file. -->
873
    </target>
874
    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test" if="have.tests" name="-do-compile-test">
875
        <webproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
876
        <copy todir="${build.test.classes.dir}">
877
            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
878
        </copy>
879
    </target>
880
    <target name="-post-compile-test">
881
        <!-- Empty placeholder for easier customization. -->
882
        <!-- You can override this target in the ../build.xml file. -->
883
    </target>
884
    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
885
    <target name="-pre-compile-test-single">
886
        <!-- Empty placeholder for easier customization. -->
887
        <!-- You can override this target in the ../build.xml file. -->
888
    </target>
889
    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
890
        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
891
        <webproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" srcdir="${test.src.dir}"/>
892
        <copy todir="${build.test.classes.dir}">
893
            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
894
        </copy>
895
    </target>
896
    <target name="-post-compile-test-single">
897
        <!-- Empty placeholder for easier customization. -->
898
        <!-- You can override this target in the ../build.xml file. -->
899
    </target>
900
    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
901
    <!--
902
                
903
                JUNIT EXECUTION SECTION
904
            -->
905
    <target depends="init" if="have.tests" name="-pre-test-run">
906
        <mkdir dir="${build.test.results.dir}"/>
907
    </target>
908
    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
909
        <webproject2:junit testincludes="**/*Test.java"/>
910
    </target>
911
    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
912
        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
913
    </target>
914
    <target depends="init" if="have.tests" name="test-report"/>
915
    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
916
    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
917
    <target depends="init" if="have.tests" name="-pre-test-run-single">
918
        <mkdir dir="${build.test.results.dir}"/>
919
    </target>
920
    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
921
        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
922
        <webproject2:junit excludes="" includes="${test.includes}"/>
923
    </target>
924
    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
925
        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
926
    </target>
927
    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
928
    <!--
929
                
930
                JUNIT DEBUGGING SECTION
931
            -->
932
    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
933
        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
934
        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
935
        <delete file="${test.report.file}"/>
936
        <!-- must exist, otherwise the XML formatter would fail -->
937
        <mkdir dir="${build.test.results.dir}"/>
938
        <webproject1:debug args="${test.class}" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}:${j2ee.platform.embeddableejb.classpath}">
939
            <customize>
940
                <arg value="showoutput=true"/>
941
                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
942
                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
943
            </customize>
944
        </webproject1:debug>
945
    </target>
946
    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
947
        <webproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
948
    </target>
949
    <target depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
950
    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
951
        <webproject1:nbjpdareload dir="${build.test.classes.dir}"/>
952
    </target>
953
    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
954
    <!--
955
                
956
                CLEANUP SECTION
957
            -->
958
    <target depends="init" if="no.dist.ear.dir" name="deps-clean" unless="no.deps"/>
959
    <target depends="init" name="do-clean">
960
        <condition property="build.dir.to.clean" value="${build.web.dir}">
961
            <isset property="dist.ear.dir"/>
962
        </condition>
963
        <property name="build.dir.to.clean" value="${build.web.dir}"/>
964
        <delete includeEmptyDirs="true" quiet="true">
965
            <fileset dir="${build.dir.to.clean}/WEB-INF/lib"/>
966
        </delete>
967
        <delete dir="${build.dir}"/>
968
        <available file="${build.dir.to.clean}/WEB-INF/lib" property="status.clean-failed" type="dir"/>
969
        <delete dir="${dist.dir}"/>
970
    </target>
971
    <target depends="do-clean" if="status.clean-failed" name="check-clean">
972
        <echo message="Warning: unable to delete some files in ${build.web.dir}/WEB-INF/lib - they are probably locked by the J2EE server. "/>
973
        <echo level="info" message="To delete all files undeploy the module from Server Registry in Runtime tab and then use Clean again."/>
974
    </target>
975
    <target depends="init" if="netbeans.home" name="undeploy-clean">
976
        <nbundeploy failOnError="false" startServer="false"/>
977
    </target>
978
    <target name="-post-clean">
979
        <!-- Empty placeholder for easier customization. -->
980
        <!-- You can override this target in the ../build.xml file. -->
981
    </target>
982
    <target depends="init,undeploy-clean,deps-clean,do-clean,check-clean,-post-clean" description="Clean build products." name="clean"/>
983
    <target depends="clean" description="Clean build products." name="clean-ear"/>
984
</project>
trunk/src/src/conf/MANIFEST.MF
1
Manifest-Version: 1.0
2

  
trunk/src/src/java/hibernate.cfg.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
3
<hibernate-configuration>
4
  <session-factory>
5
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
6
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
7
    <property name="hibernate.connection.url">jdbc:mysql://localhost/lidar</property>
8
    <property name="hibernate.connection.username">root</property>
9
    <property name="hibernate.connection.password">mwd40</property>
10
    <!-- Enable Hibernate's automatic session context management -->
11
    <property name="current_session_context_class">thread</property>
12
    
13
    <!--<mapping resource="hibernate.hbm.xml"/>-->
14
    <mapping class="org.lidar.db.Client"/>
15
    <mapping class="org.lidar.db.Log"/>
16
  </session-factory>
17
</hibernate-configuration>
trunk/src/src/java/hibernate.hbm.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
3
<hibernate-mapping>
4
  <class name="org.lidar.db.Log" table="log">
5
    <id column="id" name="id">
6
      <generator class="increment"/>
7
    </id>
8
    <property name="date"/>
9
    <property name="type"/>
10
    <property name="message"/>
11
  </class>
12
  <!--<class name="org.lidar.db.Client" table="client">
13
    <id column="id" name="id">
14
      <generator class="increment"/>
15
    </id>
16
    <property name="key"/>
17
    <property name="token"/>
18
  </class>-->
19
  <class name="org.lidar.db.AuthTokens" table="authentiaction_token">
20
    <id column="id" name="id">
21
      <generator class="increment"/>
22
    </id>
23
    <property name="token"/>
24
    <property name="access"/>
25
    <property name="ip"/>
26
  </class>
27
</hibernate-mapping>
trunk/src/src/java/org/lidar/HibernateUtil.java
1
package org.lidar;
2

  
3
import org.hibernate.SessionFactory;
4
import org.hibernate.cfg.AnnotationConfiguration;
5

  
6
/**
7
 *
8
 * @author Andrej Cimpersek
9
 */
10

  
11
public class HibernateUtil {
12
  private static final SessionFactory sessionFactory;
13
  static {
14
    try {
15
      // Create the SessionFactory from hibernate.cfg.xml
16
      sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
17
    } catch (Throwable ex) {
18
      // Make sure you log the exception, as it might be swallowed
19
      System.err.println("Initial SessionFactory creation failed." + ex);
20
      throw new ExceptionInInitializerError(ex);
21
    }
22
  }
23

  
24
  public static SessionFactory getSessionFactory() {
25
    return sessionFactory;
26
  }
27
}
trunk/src/src/java/org/lidar/Serial.java
1
package org.lidar;
2

  
3
import java.io.InputStream;
4
import java.io.OutputStream;
5
import javax.comm.*;
6
import java.util.*;
7
import org.apache.commons.configuration.XMLConfiguration;
8
import org.lidar.api.Management;
9

  
10
/**
11
 * Serial port communication
12
 * @author Andrej Cimpersek
13
 */
14
public class Serial {
15
    private boolean isOpened = false;
16
    private String deviceName;
17
    private String portName;
18
    private Enumeration portIdentifiers;
19
    private CommPortIdentifier portId;
20
    private SerialPort port;
21
    protected InputStream inputStream;
22
    protected OutputStream outputStream;
23
    private int baudRate, dataBits, stopBits, parity;
24
    private XMLConfiguration configuration;
25
    
26
    public Serial(String deviceName){
27
        configuration = Config.getConfiguration();
28
        this.portName = configuration.getString(String.format("devices.%s.port", deviceName));
29
        this.baudRate = configuration.getInt(String.format("devices.%s.baudRate", deviceName));
30
        this.dataBits = configuration.getInt(String.format("devices.%s.dataBits", deviceName));
31
        this.stopBits = configuration.getInt(String.format("devices.%s.stopBits", deviceName));
32
        this.parity = configuration.getInt(String.format("devices.%s.parity", deviceName));
33
    }
34

  
35
    /**
36
     * Check each port identifier if
37
     *   (a) it indicates a serial (not a parallel) port, and
38
     *   (b) matches the desired name.
39
     * @return boolean
40
     */
41
    protected boolean identfy(){
42
        this.portIdentifiers = CommPortIdentifier.getPortIdentifiers();
43
        this.portId = null;  // will be set if port found
44
        while (portIdentifiers.hasMoreElements())
45
        {
46
            CommPortIdentifier pid = (CommPortIdentifier)portIdentifiers.nextElement();
47
            if(pid.getPortType() == CommPortIdentifier.PORT_SERIAL && pid.getName().equals(this.portName)){
48
                this.portId = pid;
49
                return true;
50
            }
51
        }
52
        return false;
53
    }
54

  
55
    /**
56
     * Destructor - close port
57
     */
58
    @Override()
59
    protected void finalize() throws Throwable{
60
        closePort();
61
    }
62

  
63
    public boolean acquirePort(){
64
        if(this.portId == null) return false;
65
        // Use port identifier for acquiring the port
66
        try {
67
            this.port = (SerialPort)this.portId.open(
68
                this.deviceName, // Name of the application asking for the port
69
                10000   // Wait max. 10 sec. to acquire port
70
            );
71
        } catch(PortInUseException e) {
72
            return false;
73
        }
74

  
75
        return true;
76
    }
77

  
78
    public boolean openPort(){
79
        if(!acquirePort()) return false;
80
        closePort();
81
        try {
82
            this.port.setSerialPortParams(this.baudRate, this.dataBits, this.stopBits, this.parity);
83
            this.port.removeEventListener();
84
            this.port.addEventListener(new SerialPortEventListener() {
85
                public void serialEvent(SerialPortEvent event){
86
                    switch(event.getEventType()) {
87
                        case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
88
                            onOutputBufferEmpty(event);
89
                            break;
90

  
91
                        case SerialPortEvent.DATA_AVAILABLE:
92
                            onDataAvailable(event);
93
                            break;
94
                    }
95
                }
96
            });
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff