SuperDAO - předek DAO tříd, umí snadno načítat SQL dotazy a další parametry z XML souborů, které se jmenují stejně jako daná třída.
Je to lepší než používat konstanty v kódu.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/.hgignore Mon Oct 06 09:36:27 2008 +0200
1.3 @@ -0,0 +1,2 @@
1.4 +java/SuperDAO/dist/*
1.5 +java/SuperDAO/build/*
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/java/SuperDAO/nbproject/build-impl.xml Mon Oct 06 09:36:27 2008 +0200
2.3 @@ -0,0 +1,629 @@
2.4 +<?xml version="1.0" encoding="UTF-8"?>
2.5 +<!--
2.6 +*** GENERATED FROM project.xml - DO NOT EDIT ***
2.7 +*** EDIT ../build.xml INSTEAD ***
2.8 +
2.9 +For the purpose of easier reading the script
2.10 +is divided into following sections:
2.11 +
2.12 + - initialization
2.13 + - compilation
2.14 + - jar
2.15 + - execution
2.16 + - debugging
2.17 + - javadoc
2.18 + - junit compilation
2.19 + - junit execution
2.20 + - junit debugging
2.21 + - applet
2.22 + - cleanup
2.23 +
2.24 + -->
2.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="SuperDAO-impl">
2.26 + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
2.27 + <!--
2.28 + ======================
2.29 + INITIALIZATION SECTION
2.30 + ======================
2.31 + -->
2.32 + <target name="-pre-init">
2.33 + <!-- Empty placeholder for easier customization. -->
2.34 + <!-- You can override this target in the ../build.xml file. -->
2.35 + </target>
2.36 + <target depends="-pre-init" name="-init-private">
2.37 + <property file="nbproject/private/config.properties"/>
2.38 + <property file="nbproject/private/configs/${config}.properties"/>
2.39 + <property file="nbproject/private/private.properties"/>
2.40 + </target>
2.41 + <target depends="-pre-init,-init-private" name="-init-user">
2.42 + <property file="${user.properties.file}"/>
2.43 + <!-- The two properties below are usually overridden -->
2.44 + <!-- by the active platform. Just a fallback. -->
2.45 + <property name="default.javac.source" value="1.4"/>
2.46 + <property name="default.javac.target" value="1.4"/>
2.47 + </target>
2.48 + <target depends="-pre-init,-init-private,-init-user" name="-init-project">
2.49 + <property file="nbproject/configs/${config}.properties"/>
2.50 + <property file="nbproject/project.properties"/>
2.51 + </target>
2.52 + <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
2.53 + <available file="${manifest.file}" property="manifest.available"/>
2.54 + <condition property="manifest.available+main.class">
2.55 + <and>
2.56 + <isset property="manifest.available"/>
2.57 + <isset property="main.class"/>
2.58 + <not>
2.59 + <equals arg1="${main.class}" arg2="" trim="true"/>
2.60 + </not>
2.61 + </and>
2.62 + </condition>
2.63 + <condition property="manifest.available+main.class+mkdist.available">
2.64 + <and>
2.65 + <istrue value="${manifest.available+main.class}"/>
2.66 + <isset property="libs.CopyLibs.classpath"/>
2.67 + </and>
2.68 + </condition>
2.69 + <condition property="have.tests">
2.70 + <or>
2.71 + <available file="${test.src.dir}"/>
2.72 + </or>
2.73 + </condition>
2.74 + <condition property="have.sources">
2.75 + <or>
2.76 + <available file="${src.dir}"/>
2.77 + </or>
2.78 + </condition>
2.79 + <condition property="netbeans.home+have.tests">
2.80 + <and>
2.81 + <isset property="netbeans.home"/>
2.82 + <isset property="have.tests"/>
2.83 + </and>
2.84 + </condition>
2.85 + <condition property="no.javadoc.preview">
2.86 + <and>
2.87 + <isset property="javadoc.preview"/>
2.88 + <isfalse value="${javadoc.preview}"/>
2.89 + </and>
2.90 + </condition>
2.91 + <property name="run.jvmargs" value=""/>
2.92 + <property name="javac.compilerargs" value=""/>
2.93 + <property name="work.dir" value="${basedir}"/>
2.94 + <condition property="no.deps">
2.95 + <and>
2.96 + <istrue value="${no.dependencies}"/>
2.97 + </and>
2.98 + </condition>
2.99 + <property name="javac.debug" value="true"/>
2.100 + <property name="javadoc.preview" value="true"/>
2.101 + <property name="application.args" value=""/>
2.102 + <property name="source.encoding" value="${file.encoding}"/>
2.103 + <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
2.104 + <and>
2.105 + <isset property="javadoc.encoding"/>
2.106 + <not>
2.107 + <equals arg1="${javadoc.encoding}" arg2=""/>
2.108 + </not>
2.109 + </and>
2.110 + </condition>
2.111 + <property name="javadoc.encoding.used" value="${source.encoding}"/>
2.112 + <property name="includes" value="**"/>
2.113 + <property name="excludes" value=""/>
2.114 + <property name="do.depend" value="false"/>
2.115 + <condition property="do.depend.true">
2.116 + <istrue value="${do.depend}"/>
2.117 + </condition>
2.118 + <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
2.119 + <and>
2.120 + <isset property="jaxws.endorsed.dir"/>
2.121 + <available file="nbproject/jaxws-build.xml"/>
2.122 + </and>
2.123 + </condition>
2.124 + </target>
2.125 + <target name="-post-init">
2.126 + <!-- Empty placeholder for easier customization. -->
2.127 + <!-- You can override this target in the ../build.xml file. -->
2.128 + </target>
2.129 + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
2.130 + <fail unless="src.dir">Must set src.dir</fail>
2.131 + <fail unless="test.src.dir">Must set test.src.dir</fail>
2.132 + <fail unless="build.dir">Must set build.dir</fail>
2.133 + <fail unless="dist.dir">Must set dist.dir</fail>
2.134 + <fail unless="build.classes.dir">Must set build.classes.dir</fail>
2.135 + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
2.136 + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
2.137 + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
2.138 + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
2.139 + <fail unless="dist.jar">Must set dist.jar</fail>
2.140 + </target>
2.141 + <target name="-init-macrodef-property">
2.142 + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
2.143 + <attribute name="name"/>
2.144 + <attribute name="value"/>
2.145 + <sequential>
2.146 + <property name="@{name}" value="${@{value}}"/>
2.147 + </sequential>
2.148 + </macrodef>
2.149 + </target>
2.150 + <target name="-init-macrodef-javac">
2.151 + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
2.152 + <attribute default="${src.dir}" name="srcdir"/>
2.153 + <attribute default="${build.classes.dir}" name="destdir"/>
2.154 + <attribute default="${javac.classpath}" name="classpath"/>
2.155 + <attribute default="${includes}" name="includes"/>
2.156 + <attribute default="${excludes}" name="excludes"/>
2.157 + <attribute default="${javac.debug}" name="debug"/>
2.158 + <attribute default="" name="sourcepath"/>
2.159 + <element name="customize" optional="true"/>
2.160 + <sequential>
2.161 + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
2.162 + <classpath>
2.163 + <path path="@{classpath}"/>
2.164 + </classpath>
2.165 + <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
2.166 + <customize/>
2.167 + </javac>
2.168 + </sequential>
2.169 + </macrodef>
2.170 + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
2.171 + <attribute default="${src.dir}" name="srcdir"/>
2.172 + <attribute default="${build.classes.dir}" name="destdir"/>
2.173 + <attribute default="${javac.classpath}" name="classpath"/>
2.174 + <sequential>
2.175 + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
2.176 + <classpath>
2.177 + <path path="@{classpath}"/>
2.178 + </classpath>
2.179 + </depend>
2.180 + </sequential>
2.181 + </macrodef>
2.182 + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
2.183 + <attribute default="${build.classes.dir}" name="destdir"/>
2.184 + <sequential>
2.185 + <fail unless="javac.includes">Must set javac.includes</fail>
2.186 + <pathconvert pathsep="," property="javac.includes.binary">
2.187 + <path>
2.188 + <filelist dir="@{destdir}" files="${javac.includes}"/>
2.189 + </path>
2.190 + <globmapper from="*.java" to="*.class"/>
2.191 + </pathconvert>
2.192 + <delete>
2.193 + <files includes="${javac.includes.binary}"/>
2.194 + </delete>
2.195 + </sequential>
2.196 + </macrodef>
2.197 + </target>
2.198 + <target name="-init-macrodef-junit">
2.199 + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
2.200 + <attribute default="${includes}" name="includes"/>
2.201 + <attribute default="${excludes}" name="excludes"/>
2.202 + <attribute default="**" name="testincludes"/>
2.203 + <sequential>
2.204 + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
2.205 + <batchtest todir="${build.test.results.dir}">
2.206 + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
2.207 + <filename name="@{testincludes}"/>
2.208 + </fileset>
2.209 + </batchtest>
2.210 + <classpath>
2.211 + <path path="${run.test.classpath}"/>
2.212 + </classpath>
2.213 + <syspropertyset>
2.214 + <propertyref prefix="test-sys-prop."/>
2.215 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
2.216 + </syspropertyset>
2.217 + <formatter type="brief" usefile="false"/>
2.218 + <formatter type="xml"/>
2.219 + <jvmarg line="${run.jvmargs}"/>
2.220 + </junit>
2.221 + </sequential>
2.222 + </macrodef>
2.223 + </target>
2.224 + <target name="-init-macrodef-nbjpda">
2.225 + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
2.226 + <attribute default="${main.class}" name="name"/>
2.227 + <attribute default="${debug.classpath}" name="classpath"/>
2.228 + <attribute default="" name="stopclassname"/>
2.229 + <sequential>
2.230 + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
2.231 + <classpath>
2.232 + <path path="@{classpath}"/>
2.233 + </classpath>
2.234 + </nbjpdastart>
2.235 + </sequential>
2.236 + </macrodef>
2.237 + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
2.238 + <attribute default="${build.classes.dir}" name="dir"/>
2.239 + <sequential>
2.240 + <nbjpdareload>
2.241 + <fileset dir="@{dir}" includes="${fix.classes}">
2.242 + <include name="${fix.includes}*.class"/>
2.243 + </fileset>
2.244 + </nbjpdareload>
2.245 + </sequential>
2.246 + </macrodef>
2.247 + </target>
2.248 + <target name="-init-debug-args">
2.249 + <property name="version-output" value="java version "${ant.java.version}"/>
2.250 + <condition property="have-jdk-older-than-1.4">
2.251 + <or>
2.252 + <contains string="${version-output}" substring="java version "1.0"/>
2.253 + <contains string="${version-output}" substring="java version "1.1"/>
2.254 + <contains string="${version-output}" substring="java version "1.2"/>
2.255 + <contains string="${version-output}" substring="java version "1.3"/>
2.256 + </or>
2.257 + </condition>
2.258 + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
2.259 + <istrue value="${have-jdk-older-than-1.4}"/>
2.260 + </condition>
2.261 + </target>
2.262 + <target depends="-init-debug-args" name="-init-macrodef-debug">
2.263 + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
2.264 + <attribute default="${main.class}" name="classname"/>
2.265 + <attribute default="${debug.classpath}" name="classpath"/>
2.266 + <element name="customize" optional="true"/>
2.267 + <sequential>
2.268 + <java classname="@{classname}" dir="${work.dir}" fork="true">
2.269 + <jvmarg line="${debug-args-line}"/>
2.270 + <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
2.271 + <jvmarg line="${run.jvmargs}"/>
2.272 + <classpath>
2.273 + <path path="@{classpath}"/>
2.274 + </classpath>
2.275 + <syspropertyset>
2.276 + <propertyref prefix="run-sys-prop."/>
2.277 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
2.278 + </syspropertyset>
2.279 + <customize/>
2.280 + </java>
2.281 + </sequential>
2.282 + </macrodef>
2.283 + </target>
2.284 + <target name="-init-macrodef-java">
2.285 + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
2.286 + <attribute default="${main.class}" name="classname"/>
2.287 + <element name="customize" optional="true"/>
2.288 + <sequential>
2.289 + <java classname="@{classname}" dir="${work.dir}" fork="true">
2.290 + <jvmarg line="${run.jvmargs}"/>
2.291 + <classpath>
2.292 + <path path="${run.classpath}"/>
2.293 + </classpath>
2.294 + <syspropertyset>
2.295 + <propertyref prefix="run-sys-prop."/>
2.296 + <mapper from="run-sys-prop.*" to="*" type="glob"/>
2.297 + </syspropertyset>
2.298 + <customize/>
2.299 + </java>
2.300 + </sequential>
2.301 + </macrodef>
2.302 + </target>
2.303 + <target name="-init-presetdef-jar">
2.304 + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
2.305 + <jar compress="${jar.compress}" jarfile="${dist.jar}">
2.306 + <j2seproject1:fileset dir="${build.classes.dir}"/>
2.307 + </jar>
2.308 + </presetdef>
2.309 + </target>
2.310 + <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-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
2.311 + <!--
2.312 + ===================
2.313 + COMPILATION SECTION
2.314 + ===================
2.315 + -->
2.316 + <target depends="init" name="deps-jar" unless="no.deps"/>
2.317 + <target depends="init,deps-jar" name="-pre-pre-compile">
2.318 + <mkdir dir="${build.classes.dir}"/>
2.319 + </target>
2.320 + <target name="-pre-compile">
2.321 + <!-- Empty placeholder for easier customization. -->
2.322 + <!-- You can override this target in the ../build.xml file. -->
2.323 + </target>
2.324 + <target if="do.depend.true" name="-compile-depend">
2.325 + <j2seproject3:depend/>
2.326 + </target>
2.327 + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
2.328 + <j2seproject3:javac/>
2.329 + <copy todir="${build.classes.dir}">
2.330 + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
2.331 + </copy>
2.332 + </target>
2.333 + <target name="-post-compile">
2.334 + <!-- Empty placeholder for easier customization. -->
2.335 + <!-- You can override this target in the ../build.xml file. -->
2.336 + </target>
2.337 + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
2.338 + <target name="-pre-compile-single">
2.339 + <!-- Empty placeholder for easier customization. -->
2.340 + <!-- You can override this target in the ../build.xml file. -->
2.341 + </target>
2.342 + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
2.343 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
2.344 + <j2seproject3:force-recompile/>
2.345 + <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
2.346 + </target>
2.347 + <target name="-post-compile-single">
2.348 + <!-- Empty placeholder for easier customization. -->
2.349 + <!-- You can override this target in the ../build.xml file. -->
2.350 + </target>
2.351 + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
2.352 + <!--
2.353 + ====================
2.354 + JAR BUILDING SECTION
2.355 + ====================
2.356 + -->
2.357 + <target depends="init" name="-pre-pre-jar">
2.358 + <dirname file="${dist.jar}" property="dist.jar.dir"/>
2.359 + <mkdir dir="${dist.jar.dir}"/>
2.360 + </target>
2.361 + <target name="-pre-jar">
2.362 + <!-- Empty placeholder for easier customization. -->
2.363 + <!-- You can override this target in the ../build.xml file. -->
2.364 + </target>
2.365 + <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
2.366 + <j2seproject1:jar/>
2.367 + </target>
2.368 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
2.369 + <j2seproject1:jar manifest="${manifest.file}"/>
2.370 + </target>
2.371 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
2.372 + <j2seproject1:jar manifest="${manifest.file}">
2.373 + <j2seproject1:manifest>
2.374 + <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
2.375 + </j2seproject1:manifest>
2.376 + </j2seproject1:jar>
2.377 + <echo>To run this application from the command line without Ant, try:</echo>
2.378 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
2.379 + <property location="${dist.jar}" name="dist.jar.resolved"/>
2.380 + <pathconvert property="run.classpath.with.dist.jar">
2.381 + <path path="${run.classpath}"/>
2.382 + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
2.383 + </pathconvert>
2.384 + <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
2.385 + </target>
2.386 + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
2.387 + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
2.388 + <pathconvert property="run.classpath.without.build.classes.dir">
2.389 + <path path="${run.classpath}"/>
2.390 + <map from="${build.classes.dir.resolved}" to=""/>
2.391 + </pathconvert>
2.392 + <pathconvert pathsep=" " property="jar.classpath">
2.393 + <path path="${run.classpath.without.build.classes.dir}"/>
2.394 + <chainedmapper>
2.395 + <flattenmapper/>
2.396 + <globmapper from="*" to="lib/*"/>
2.397 + </chainedmapper>
2.398 + </pathconvert>
2.399 + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
2.400 + <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
2.401 + <fileset dir="${build.classes.dir}"/>
2.402 + <manifest>
2.403 + <attribute name="Main-Class" value="${main.class}"/>
2.404 + <attribute name="Class-Path" value="${jar.classpath}"/>
2.405 + </manifest>
2.406 + </copylibs>
2.407 + <echo>To run this application from the command line without Ant, try:</echo>
2.408 + <property location="${dist.jar}" name="dist.jar.resolved"/>
2.409 + <echo>java -jar "${dist.jar.resolved}"</echo>
2.410 + </target>
2.411 + <target name="-post-jar">
2.412 + <!-- Empty placeholder for easier customization. -->
2.413 + <!-- You can override this target in the ../build.xml file. -->
2.414 + </target>
2.415 + <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
2.416 + <!--
2.417 + =================
2.418 + EXECUTION SECTION
2.419 + =================
2.420 + -->
2.421 + <target depends="init,compile" description="Run a main class." name="run">
2.422 + <j2seproject1:java>
2.423 + <customize>
2.424 + <arg line="${application.args}"/>
2.425 + </customize>
2.426 + </j2seproject1:java>
2.427 + </target>
2.428 + <target name="-do-not-recompile">
2.429 + <property name="javac.includes.binary" value=""/>
2.430 + </target>
2.431 + <target depends="init,-do-not-recompile,compile-single" name="run-single">
2.432 + <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
2.433 + <j2seproject1:java classname="${run.class}"/>
2.434 + </target>
2.435 + <!--
2.436 + =================
2.437 + DEBUGGING SECTION
2.438 + =================
2.439 + -->
2.440 + <target depends="init" if="netbeans.home" name="-debug-start-debugger">
2.441 + <j2seproject1:nbjpdastart name="${debug.class}"/>
2.442 + </target>
2.443 + <target depends="init,compile" name="-debug-start-debuggee">
2.444 + <j2seproject3:debug>
2.445 + <customize>
2.446 + <arg line="${application.args}"/>
2.447 + </customize>
2.448 + </j2seproject3:debug>
2.449 + </target>
2.450 + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
2.451 + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
2.452 + <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
2.453 + </target>
2.454 + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
2.455 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
2.456 + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
2.457 + <j2seproject3:debug classname="${debug.class}"/>
2.458 + </target>
2.459 + <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
2.460 + <target depends="init" name="-pre-debug-fix">
2.461 + <fail unless="fix.includes">Must set fix.includes</fail>
2.462 + <property name="javac.includes" value="${fix.includes}.java"/>
2.463 + </target>
2.464 + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
2.465 + <j2seproject1:nbjpdareload/>
2.466 + </target>
2.467 + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
2.468 + <!--
2.469 + ===============
2.470 + JAVADOC SECTION
2.471 + ===============
2.472 + -->
2.473 + <target depends="init" name="-javadoc-build">
2.474 + <mkdir dir="${dist.javadoc.dir}"/>
2.475 + <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}">
2.476 + <classpath>
2.477 + <path path="${javac.classpath}"/>
2.478 + </classpath>
2.479 + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
2.480 + <filename name="**/*.java"/>
2.481 + </fileset>
2.482 + </javadoc>
2.483 + </target>
2.484 + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
2.485 + <nbbrowse file="${dist.javadoc.dir}/index.html"/>
2.486 + </target>
2.487 + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
2.488 + <!--
2.489 + =========================
2.490 + JUNIT COMPILATION SECTION
2.491 + =========================
2.492 + -->
2.493 + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
2.494 + <mkdir dir="${build.test.classes.dir}"/>
2.495 + </target>
2.496 + <target name="-pre-compile-test">
2.497 + <!-- Empty placeholder for easier customization. -->
2.498 + <!-- You can override this target in the ../build.xml file. -->
2.499 + </target>
2.500 + <target if="do.depend.true" name="-compile-test-depend">
2.501 + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
2.502 + </target>
2.503 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
2.504 + <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
2.505 + <copy todir="${build.test.classes.dir}">
2.506 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
2.507 + </copy>
2.508 + </target>
2.509 + <target name="-post-compile-test">
2.510 + <!-- Empty placeholder for easier customization. -->
2.511 + <!-- You can override this target in the ../build.xml file. -->
2.512 + </target>
2.513 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
2.514 + <target name="-pre-compile-test-single">
2.515 + <!-- Empty placeholder for easier customization. -->
2.516 + <!-- You can override this target in the ../build.xml file. -->
2.517 + </target>
2.518 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
2.519 + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
2.520 + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
2.521 + <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
2.522 + <copy todir="${build.test.classes.dir}">
2.523 + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
2.524 + </copy>
2.525 + </target>
2.526 + <target name="-post-compile-test-single">
2.527 + <!-- Empty placeholder for easier customization. -->
2.528 + <!-- You can override this target in the ../build.xml file. -->
2.529 + </target>
2.530 + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
2.531 + <!--
2.532 + =======================
2.533 + JUNIT EXECUTION SECTION
2.534 + =======================
2.535 + -->
2.536 + <target depends="init" if="have.tests" name="-pre-test-run">
2.537 + <mkdir dir="${build.test.results.dir}"/>
2.538 + </target>
2.539 + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
2.540 + <j2seproject3:junit testincludes="**/*Test.java"/>
2.541 + </target>
2.542 + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
2.543 + <fail if="tests.failed">Some tests failed; see details above.</fail>
2.544 + </target>
2.545 + <target depends="init" if="have.tests" name="test-report"/>
2.546 + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
2.547 + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
2.548 + <target depends="init" if="have.tests" name="-pre-test-run-single">
2.549 + <mkdir dir="${build.test.results.dir}"/>
2.550 + </target>
2.551 + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
2.552 + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
2.553 + <j2seproject3:junit excludes="" includes="${test.includes}"/>
2.554 + </target>
2.555 + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
2.556 + <fail if="tests.failed">Some tests failed; see details above.</fail>
2.557 + </target>
2.558 + <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
2.559 + <!--
2.560 + =======================
2.561 + JUNIT DEBUGGING SECTION
2.562 + =======================
2.563 + -->
2.564 + <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
2.565 + <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
2.566 + <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
2.567 + <delete file="${test.report.file}"/>
2.568 + <mkdir dir="${build.test.results.dir}"/>
2.569 + <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
2.570 + <customize>
2.571 + <syspropertyset>
2.572 + <propertyref prefix="test-sys-prop."/>
2.573 + <mapper from="test-sys-prop.*" to="*" type="glob"/>
2.574 + </syspropertyset>
2.575 + <arg value="${test.class}"/>
2.576 + <arg value="showoutput=true"/>
2.577 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
2.578 + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
2.579 + </customize>
2.580 + </j2seproject3:debug>
2.581 + </target>
2.582 + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
2.583 + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
2.584 + </target>
2.585 + <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
2.586 + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
2.587 + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
2.588 + </target>
2.589 + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
2.590 + <!--
2.591 + =========================
2.592 + APPLET EXECUTION SECTION
2.593 + =========================
2.594 + -->
2.595 + <target depends="init,compile-single" name="run-applet">
2.596 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
2.597 + <j2seproject1:java classname="sun.applet.AppletViewer">
2.598 + <customize>
2.599 + <arg value="${applet.url}"/>
2.600 + </customize>
2.601 + </j2seproject1:java>
2.602 + </target>
2.603 + <!--
2.604 + =========================
2.605 + APPLET DEBUGGING SECTION
2.606 + =========================
2.607 + -->
2.608 + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
2.609 + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
2.610 + <j2seproject3:debug classname="sun.applet.AppletViewer">
2.611 + <customize>
2.612 + <arg value="${applet.url}"/>
2.613 + </customize>
2.614 + </j2seproject3:debug>
2.615 + </target>
2.616 + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
2.617 + <!--
2.618 + ===============
2.619 + CLEANUP SECTION
2.620 + ===============
2.621 + -->
2.622 + <target depends="init" name="deps-clean" unless="no.deps"/>
2.623 + <target depends="init" name="-do-clean">
2.624 + <delete dir="${build.dir}"/>
2.625 + <delete dir="${dist.dir}"/>
2.626 + </target>
2.627 + <target name="-post-clean">
2.628 + <!-- Empty placeholder for easier customization. -->
2.629 + <!-- You can override this target in the ../build.xml file. -->
2.630 + </target>
2.631 + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
2.632 +</project>
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/java/SuperDAO/nbproject/genfiles.properties Mon Oct 06 09:36:27 2008 +0200
3.3 @@ -0,0 +1,8 @@
3.4 +build.xml.data.CRC32=958f21fd
3.5 +build.xml.script.CRC32=875a74e8
3.6 +build.xml.stylesheet.CRC32=be360661
3.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
3.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
3.9 +nbproject/build-impl.xml.data.CRC32=958f21fd
3.10 +nbproject/build-impl.xml.script.CRC32=196dbf97
3.11 +nbproject/build-impl.xml.stylesheet.CRC32=487672f9
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/java/SuperDAO/nbproject/private/private.properties Mon Oct 06 09:36:27 2008 +0200
4.3 @@ -0,0 +1,2 @@
4.4 +jaxws.endorsed.dir=/usr/local/netbeans-6.1/java2/modules/ext/jaxws21/api
4.5 +user.properties.file=/home/fiki/.netbeans/6.1/build.properties
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/java/SuperDAO/nbproject/project.properties Mon Oct 06 09:36:27 2008 +0200
5.3 @@ -0,0 +1,57 @@
5.4 +build.classes.dir=${build.dir}/classes
5.5 +build.classes.excludes=**/*.java,**/*.form
5.6 +# This directory is removed when the project is cleaned:
5.7 +build.dir=build
5.8 +build.generated.dir=${build.dir}/generated
5.9 +# Only compile against the classpath explicitly listed here:
5.10 +build.sysclasspath=ignore
5.11 +build.test.classes.dir=${build.dir}/test/classes
5.12 +build.test.results.dir=${build.dir}/test/results
5.13 +debug.classpath=\
5.14 + ${run.classpath}
5.15 +debug.test.classpath=\
5.16 + ${run.test.classpath}
5.17 +# This directory is removed when the project is cleaned:
5.18 +dist.dir=dist
5.19 +dist.jar=${dist.dir}/SuperDAO.jar
5.20 +dist.javadoc.dir=${dist.dir}/javadoc
5.21 +excludes=
5.22 +includes=**
5.23 +jar.compress=false
5.24 +javac.classpath=
5.25 +# Space-separated list of extra javac options
5.26 +javac.compilerargs=
5.27 +javac.deprecation=false
5.28 +javac.source=1.5
5.29 +javac.target=1.5
5.30 +javac.test.classpath=\
5.31 + ${javac.classpath}:\
5.32 + ${build.classes.dir}:\
5.33 + ${libs.junit.classpath}:\
5.34 + ${libs.junit_4.classpath}
5.35 +javadoc.additionalparam=
5.36 +javadoc.author=false
5.37 +javadoc.encoding=${source.encoding}
5.38 +javadoc.noindex=false
5.39 +javadoc.nonavbar=false
5.40 +javadoc.notree=false
5.41 +javadoc.private=false
5.42 +javadoc.splitindex=true
5.43 +javadoc.use=true
5.44 +javadoc.version=false
5.45 +javadoc.windowtitle=
5.46 +meta.inf.dir=${src.dir}/META-INF
5.47 +platform.active=default_platform
5.48 +run.classpath=\
5.49 + ${javac.classpath}:\
5.50 + ${build.classes.dir}
5.51 +# Space-separated list of JVM arguments used when running the project
5.52 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
5.53 +# or test-sys-prop.name=value to set system properties for unit tests):
5.54 +run.jvmargs=
5.55 +run.test.classpath=\
5.56 + ${javac.test.classpath}:\
5.57 + ${build.test.classes.dir}
5.58 +source.encoding=UTF-8
5.59 +src.dir=src
5.60 +test.src.dir=test
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/java/SuperDAO/nbproject/project.xml Mon Oct 06 09:36:27 2008 +0200
6.3 @@ -0,0 +1,16 @@
6.4 +<?xml version="1.0" encoding="UTF-8"?>
6.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
6.6 + <type>org.netbeans.modules.java.j2seproject</type>
6.7 + <configuration>
6.8 + <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
6.9 + <name>SuperDAO</name>
6.10 + <minimum-ant-version>1.6.5</minimum-ant-version>
6.11 + <source-roots>
6.12 + <root id="src.dir"/>
6.13 + </source-roots>
6.14 + <test-roots>
6.15 + <root id="test.src.dir"/>
6.16 + </test-roots>
6.17 + </data>
6.18 + </configuration>
6.19 +</project>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/java/SuperDAO/src/cz/frantovo/superDAO/SuperDAO.java Mon Oct 06 09:36:27 2008 +0200
7.3 @@ -0,0 +1,125 @@
7.4 +package cz.frantovo.superDAO;
7.5 +
7.6 +import java.io.InputStream;
7.7 +import java.sql.Connection;
7.8 +import java.sql.ResultSet;
7.9 +import java.sql.Statement;
7.10 +import java.util.Collections;
7.11 +import java.util.HashMap;
7.12 +import java.util.Map;
7.13 +import java.util.Properties;
7.14 +import java.util.logging.Level;
7.15 +import java.util.logging.Logger;
7.16 +
7.17 +/**
7.18 + * Předek všech DTOček
7.19 + * @author fiki
7.20 + */
7.21 +public class SuperDAO {
7.22 +
7.23 + protected Logger log = Logger.getLogger(getClass().getName());
7.24 + private static Map<Class, Properties> sql = Collections.synchronizedMap(new HashMap<Class, Properties>());
7.25 + private static Map<Class, Properties> vlastnosti = Collections.synchronizedMap(new HashMap<Class, Properties>());
7.26 +
7.27 + private enum SQL {
7.28 +
7.29 + AHOJ
7.30 + }
7.31 +
7.32 + /**
7.33 + * Načítá SQL dotazy ze souboru, který se jmenuje stejně jako třída a má příponu sql.xml
7.34 + * Do těchto souborů patří pouze SQL dotazy - všechny ostatní parametry dáme do .xml souboru.
7.35 + * @param klic Enum konstnanta z dané třídy
7.36 + * @return SQL dotaz nebo null v případě chyby
7.37 + */
7.38 + protected String getSQL(Enum klic) {
7.39 +
7.40 +
7.41 +
7.42 + return getHodnota(sql, "sql.xml", klic);
7.43 + }
7.44 +
7.45 + /**
7.46 + * Načítá textové hodnoty (vlastnosti) ze souboru, který se jmenuje stejně jako třída a má příponu xml
7.47 + * Sem patří všechny parametry tříd kromě SQL dotazů.
7.48 + * @param klic Enum konstnanta z dané třídy
7.49 + * @return textová hodnota nebo null v případě chyby
7.50 + */
7.51 + protected String getVlastnost(Enum klic) {
7.52 + return getHodnota(vlastnosti, "xml", klic);
7.53 + }
7.54 +
7.55 + /**
7.56 + * Nečte hodnoty přímo ze souboru, ale snaží se je nejprve najít ve statické mezipaměti.
7.57 + * @param klic Enum konstnanta z dané třídy
7.58 + * @return textová hodnota nebo null v případě chyby
7.59 + */
7.60 + private String getHodnota(Map<Class, Properties> mezipamet, String pripona, Enum klic) {
7.61 +
7.62 + if (mezipamet.get(getClass()) == null) {
7.63 + /** Ještě nemáme načteno ze souboru */
7.64 + mezipamet.put(getClass(), getHodnoty(pripona));
7.65 +
7.66 + if (mezipamet.get(getClass()) == null) {
7.67 + /** Došlo k chybě --> už to příště nebudeme zkoušet načítat */
7.68 + mezipamet.put(getClass(), new Properties());
7.69 + }
7.70 + }
7.71 +
7.72 + return mezipamet.get(getClass()).getProperty(klic.toString());
7.73 + }
7.74 +
7.75 + public static void main(String[] args) {
7.76 + System.out.println(new SuperDAO().getSQL(SQL.AHOJ));
7.77 +
7.78 + }
7.79 +
7.80 + /**
7.81 + * Načte vlastnosti dané třídy z XML souboru.
7.82 + * Soubory se dávají do stejného balíčku jako třída, akorát mají jinou příponu.
7.83 + * @param pripona přípona souboru - obvykle "sql.xml" nebo "xml" (bez tečky)
7.84 + * @return načtené vlastnosti nebo null v případě chyby
7.85 + */
7.86 + private Properties getHodnoty(String pripona) {
7.87 + Class trida = getClass();
7.88 + String soubor = trida.getSimpleName() + "." + pripona;
7.89 +
7.90 + Properties hodnoty = null;
7.91 + try {
7.92 + InputStream fis = trida.getResourceAsStream(soubor);
7.93 + hodnoty = new Properties();
7.94 + hodnoty.loadFromXML(fis);
7.95 + } catch (Exception e) {
7.96 + log.log(Level.SEVERE, "Chyba při načítání vlastností: " + soubor, e);
7.97 + }
7.98 +
7.99 + return hodnoty;
7.100 + }
7.101 +
7.102 + /**
7.103 + * Zavře všechno
7.104 + * @param spojeni DB spojení
7.105 + * @param prikaz DB dotaz
7.106 + * @param vysledek DB výsledek
7.107 + */
7.108 + protected void zavri(Connection spojeni, Statement prikaz, ResultSet vysledek) {
7.109 + if (vysledek != null) {
7.110 + try {
7.111 + vysledek.close();
7.112 + } catch (Exception e) {
7.113 + }
7.114 + }
7.115 + if (prikaz != null) {
7.116 + try {
7.117 + prikaz.close();
7.118 + } catch (Exception e) {
7.119 + }
7.120 + }
7.121 + if (spojeni != null) {
7.122 + try {
7.123 + spojeni.close();
7.124 + } catch (Exception e) {
7.125 + }
7.126 + }
7.127 + }
7.128 +}
7.129 \ No newline at end of file
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/java/SuperDAO/src/cz/frantovo/superDAO/SuperDAO.sql.xml Mon Oct 06 09:36:27 2008 +0200
8.3 @@ -0,0 +1,9 @@
8.4 +<?xml version="1.0" encoding="UTF-8"?>
8.5 +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
8.6 +<properties>
8.7 + <entry key="AHOJ">
8.8 + <![CDATA[
8.9 + Tak co, jak to jde? ;-)
8.10 + ]]>
8.11 + </entry>
8.12 +</properties>
8.13 \ No newline at end of file